Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-18 08:30:33

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 //! Provides a tool for analyzing (reading) and creating (writing)
0039 //! references to external files in STEP
0040 //!
0041 //! It maintains a data structure in the form of sequences
0042 //! of relevant STEP entities (roots), allowing either to create
0043 //! them by convenient API, or load from existing model and
0044 //! investigate
0045 class STEPConstruct_ExternRefs : public STEPConstruct_Tool
0046 {
0047 public:
0048   DEFINE_STANDARD_ALLOC
0049 
0050   //! Creates an empty tool
0051   Standard_EXPORT STEPConstruct_ExternRefs();
0052 
0053   //! Creates a tool and initializes it
0054   Standard_EXPORT STEPConstruct_ExternRefs(const Handle(XSControl_WorkSession)& WS);
0055 
0056   //! Initializes tool; returns True if succeeded
0057   Standard_EXPORT Standard_Boolean Init(const Handle(XSControl_WorkSession)& WS);
0058 
0059   //! Clears internal fields (list of defined extern refs)
0060   Standard_EXPORT void Clear();
0061 
0062   //! Searches current STEP model for external references
0063   //! and loads them to the internal data structures
0064   //! NOTE: does not clear data structures before loading
0065   Standard_EXPORT Standard_Boolean LoadExternRefs();
0066 
0067   //! Returns number of defined extern references
0068   Standard_EXPORT Standard_Integer NbExternRefs() const;
0069 
0070   //! Returns filename for numth extern reference
0071   //! Returns Null if FileName is not defined or bad
0072   Standard_EXPORT Standard_CString FileName(const Standard_Integer num) const;
0073 
0074   //! Returns ProductDefinition to which numth extern reference
0075   //! is associated.
0076   //! Returns Null if cannot be detected or if extern reference
0077   //! is not associated to SDR in a proper way.
0078   Standard_EXPORT Handle(StepBasic_ProductDefinition) ProdDef(const Standard_Integer num) const;
0079 
0080   //! Returns DocumentFile to which numth extern reference
0081   //! is associated.
0082   //! Returns Null if cannot be detected.
0083   Standard_EXPORT Handle(StepBasic_DocumentFile) DocFile(const Standard_Integer num) const;
0084 
0085   //! Returns format identification string for the extern document
0086   //! Returns Null handle if format is not defined
0087   Standard_EXPORT Handle(TCollection_HAsciiString) Format(const Standard_Integer num) const;
0088 
0089   //! Create a new external reference with specified attributes
0090   //! attached to a given SDR
0091   //! <format> can be Null string, in that case this information
0092   //! is not written. Else, it can be "STEP AP214" or "STEP AP203"
0093   //! Returns index of a new extern ref
0094   Standard_EXPORT Standard_Integer AddExternRef(const Standard_CString                     filename,
0095                                                 const Handle(StepBasic_ProductDefinition)& PD,
0096                                                 const Standard_CString                     format);
0097 
0098   //! Check (create if it is null) all shared entities for the model
0099   Standard_EXPORT void checkAP214Shared();
0100 
0101   //! Adds all the currently defined external refs to the model
0102   //! Returns number of written extern refs
0103   Standard_EXPORT Standard_Integer WriteExternRefs(const Standard_Integer num) const;
0104 
0105   //! Set the ApplicationProtocolDefinition of the PDM schema
0106   Standard_EXPORT void SetAP214APD(const Handle(StepBasic_ApplicationProtocolDefinition)& APD);
0107 
0108   //! Returns the ApplicationProtocolDefinition of the PDM schema
0109   //! NOTE: if not defined then create new APD with new Application Context
0110   Standard_EXPORT Handle(StepBasic_ApplicationProtocolDefinition) GetAP214APD();
0111 
0112 protected:
0113   //! Create a new additional structure entities and add necessary references
0114   //! Note: do not refer from ADR to DF directly in AP214 (TRJ11).
0115   Standard_EXPORT Standard_Boolean
0116     addAP214ExterRef(const Handle(StepAP214_AppliedDocumentReference)& ADR,
0117                      const Handle(StepBasic_ProductDefinition)&        PD,
0118                      const Handle(StepBasic_DocumentFile)&             DF,
0119                      const Standard_CString                            filename);
0120 
0121 private:
0122   TColStd_SequenceOfTransient                     myAEIAs;
0123   TColStd_SequenceOfTransient                     myRoles;
0124   TColStd_SequenceOfTransient                     myFormats;
0125   TColStd_SequenceOfTransient                     myShapes;
0126   TColStd_SequenceOfTransient                     myTypes;
0127   TColStd_SequenceOfInteger                       myIsAP214;
0128   TColStd_SequenceOfInteger                       myReplaceNum;
0129   TColStd_SequenceOfTransient                     myDocFiles;
0130   Handle(StepBasic_ProductRelatedProductCategory) mySharedPRPC;
0131   Handle(StepBasic_DocumentType)                  mySharedDocType;
0132   Handle(StepBasic_ProductDefinitionContext)      mySharedPDC;
0133   Handle(StepBasic_ProductContext)                mySharedPC;
0134   Handle(StepBasic_ApplicationProtocolDefinition) myAPD;
0135 };
0136 
0137 #endif // _STEPConstruct_ExternRefs_HeaderFile