Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:05

0001 // Created on: 2000-09-29
0002 // Created by: Andrey BETENEV
0003 // Copyright (c) 2000-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _STEPConstruct_ExternRefs_HeaderFile
0017 #define _STEPConstruct_ExternRefs_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <TColStd_SequenceOfTransient.hxx>
0024 #include <STEPConstruct_Tool.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <Standard_CString.hxx>
0027 class StepBasic_ProductRelatedProductCategory;
0028 class StepBasic_DocumentType;
0029 class StepBasic_ProductDefinitionContext;
0030 class StepBasic_ProductContext;
0031 class StepBasic_ApplicationProtocolDefinition;
0032 class XSControl_WorkSession;
0033 class StepBasic_ProductDefinition;
0034 class TCollection_HAsciiString;
0035 class StepAP214_AppliedDocumentReference;
0036 class StepBasic_DocumentFile;
0037 
0038 
0039 //! Provides a tool for analyzing (reading) and creating (writing)
0040 //! references to external files in STEP
0041 //!
0042 //! It maintains a data structure in the form of sequences
0043 //! of relevant STEP entities (roots), allowing either to create
0044 //! them by convenient API, or load from existing model and
0045 //! investigate
0046 class STEPConstruct_ExternRefs  : public STEPConstruct_Tool
0047 {
0048 public:
0049 
0050   DEFINE_STANDARD_ALLOC
0051 
0052   
0053   //! Creates an empty tool
0054   Standard_EXPORT STEPConstruct_ExternRefs();
0055   
0056   //! Creates a tool and initializes it
0057   Standard_EXPORT STEPConstruct_ExternRefs(const Handle(XSControl_WorkSession)& WS);
0058   
0059   //! Initializes tool; returns True if succeeded
0060   Standard_EXPORT Standard_Boolean Init (const Handle(XSControl_WorkSession)& WS);
0061   
0062   //! Clears internal fields (list of defined extern refs)
0063   Standard_EXPORT void Clear();
0064   
0065   //! Searches current STEP model for external references
0066   //! and loads them to the internal data structures
0067   //! NOTE: does not clear data structures before loading
0068   Standard_EXPORT Standard_Boolean LoadExternRefs();
0069   
0070   //! Returns number of defined extern references
0071   Standard_EXPORT Standard_Integer NbExternRefs() const;
0072   
0073   //! Returns filename for numth extern reference
0074   //! Returns Null if FileName is not defined or bad
0075   Standard_EXPORT Standard_CString FileName (const Standard_Integer num) const;
0076   
0077   //! Returns ProductDefinition to which numth extern reference
0078   //! is associated.
0079   //! Returns Null if cannot be detected or if extern reference
0080   //! is not associated to SDR in a proper way.
0081   Standard_EXPORT Handle(StepBasic_ProductDefinition) ProdDef (const Standard_Integer num) const;
0082   
0083   //! Returns DocumentFile to which numth extern reference
0084   //! is associated.
0085   //! Returns Null if cannot be detected.
0086   Standard_EXPORT Handle(StepBasic_DocumentFile) DocFile (const Standard_Integer num) const;
0087 
0088   //! Returns format identification string for the extern document
0089   //! Returns Null handle if format is not defined
0090   Standard_EXPORT Handle(TCollection_HAsciiString) Format (const Standard_Integer num) const;
0091   
0092   //! Create a new external reference with specified attributes
0093   //! attached to a given SDR
0094   //! <format> can be Null string, in that case this information
0095   //! is not written. Else, it can be "STEP AP214" or "STEP AP203"
0096   //! Returns index of a new extern ref
0097   Standard_EXPORT Standard_Integer AddExternRef (const Standard_CString filename, const Handle(StepBasic_ProductDefinition)& PD, const Standard_CString format);
0098   
0099   //! Check (create if it is null) all shared entities for the model
0100   Standard_EXPORT void checkAP214Shared();
0101   
0102   //! Adds all the currently defined external refs to the model
0103   //! Returns number of written extern refs
0104   Standard_EXPORT Standard_Integer WriteExternRefs (const Standard_Integer num) const;
0105   
0106   //! Set the ApplicationProtocolDefinition of the PDM schema
0107   Standard_EXPORT void SetAP214APD (const Handle(StepBasic_ApplicationProtocolDefinition)& APD);
0108   
0109   //! Returns the ApplicationProtocolDefinition of the PDM schema
0110   //! NOTE: if not defined then create new APD with new Application Context
0111   Standard_EXPORT Handle(StepBasic_ApplicationProtocolDefinition) GetAP214APD();
0112 
0113 
0114 
0115 
0116 protected:
0117 
0118   
0119   //! Create a new additional structure entities and add ncessary references
0120   //! Note: do not refer from ADR to DF directly in AP214 (TRJ11).
0121   Standard_EXPORT Standard_Boolean addAP214ExterRef (const Handle(StepAP214_AppliedDocumentReference)& ADR, const Handle(StepBasic_ProductDefinition)& PD, const Handle(StepBasic_DocumentFile)& DF, const Standard_CString filename);
0122 
0123 
0124 
0125 
0126 private:
0127 
0128 
0129 
0130   TColStd_SequenceOfTransient myAEIAs;
0131   TColStd_SequenceOfTransient myRoles;
0132   TColStd_SequenceOfTransient myFormats;
0133   TColStd_SequenceOfTransient myShapes;
0134   TColStd_SequenceOfTransient myTypes;
0135   TColStd_SequenceOfInteger myIsAP214;
0136   TColStd_SequenceOfInteger myReplaceNum;
0137   TColStd_SequenceOfTransient myDocFiles;
0138   Handle(StepBasic_ProductRelatedProductCategory) mySharedPRPC;
0139   Handle(StepBasic_DocumentType) mySharedDocType;
0140   Handle(StepBasic_ProductDefinitionContext) mySharedPDC;
0141   Handle(StepBasic_ProductContext) mySharedPC;
0142   Handle(StepBasic_ApplicationProtocolDefinition) myAPD;
0143 
0144 
0145 };
0146 
0147 
0148 
0149 
0150 
0151 
0152 
0153 #endif // _STEPConstruct_ExternRefs_HeaderFile