// File generated by CPPExt (Value)
//
//                     Copyright (C) 1991 - 2000 by  
//                      Matra Datavision SA.  All rights reserved.
//  
//                     Copyright (C) 2001 - 2004 by
//                     Open CASCADE SA.  All rights reserved.
// 
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//  
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.

#ifndef _STEPConstruct_ExternRefs_HeaderFile
#define _STEPConstruct_ExternRefs_HeaderFile

#ifndef _TColStd_SequenceOfTransient_HeaderFile
#include <TColStd_SequenceOfTransient.hxx>
#endif
#ifndef _TColStd_SequenceOfInteger_HeaderFile
#include <TColStd_SequenceOfInteger.hxx>
#endif
#ifndef _Handle_StepBasic_ProductRelatedProductCategory_HeaderFile
#include <Handle_StepBasic_ProductRelatedProductCategory.hxx>
#endif
#ifndef _Handle_StepBasic_DocumentType_HeaderFile
#include <Handle_StepBasic_DocumentType.hxx>
#endif
#ifndef _Handle_StepBasic_ProductDefinitionContext_HeaderFile
#include <Handle_StepBasic_ProductDefinitionContext.hxx>
#endif
#ifndef _Handle_StepBasic_ProductContext_HeaderFile
#include <Handle_StepBasic_ProductContext.hxx>
#endif
#ifndef _Handle_StepBasic_ApplicationProtocolDefinition_HeaderFile
#include <Handle_StepBasic_ApplicationProtocolDefinition.hxx>
#endif
#ifndef _STEPConstruct_Tool_HeaderFile
#include <STEPConstruct_Tool.hxx>
#endif
#ifndef _Handle_XSControl_WorkSession_HeaderFile
#include <Handle_XSControl_WorkSession.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
#ifndef _Handle_StepBasic_ProductDefinition_HeaderFile
#include <Handle_StepBasic_ProductDefinition.hxx>
#endif
#ifndef _Handle_TCollection_HAsciiString_HeaderFile
#include <Handle_TCollection_HAsciiString.hxx>
#endif
#ifndef _Handle_StepAP214_AppliedDocumentReference_HeaderFile
#include <Handle_StepAP214_AppliedDocumentReference.hxx>
#endif
#ifndef _Handle_StepBasic_DocumentFile_HeaderFile
#include <Handle_StepBasic_DocumentFile.hxx>
#endif
class StepBasic_ProductRelatedProductCategory;
class StepBasic_DocumentType;
class StepBasic_ProductDefinitionContext;
class StepBasic_ProductContext;
class StepBasic_ApplicationProtocolDefinition;
class XSControl_WorkSession;
class StepBasic_ProductDefinition;
class TCollection_HAsciiString;
class StepAP214_AppliedDocumentReference;
class StepBasic_DocumentFile;


#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

//! Provides a tool for analyzing (reading) and creating (writing) <br>
//!          references to external files in STEP <br>
class STEPConstruct_ExternRefs  : public STEPConstruct_Tool {

public:

    void* operator new(size_t,void* anAddress) 
      {
        return anAddress;
      }
    void* operator new(size_t size) 
      { 
        return Standard::Allocate(size); 
      }
    void  operator delete(void *anAddress) 
      { 
        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
      }
 // Methods PUBLIC
 // 

//! Creates an empty tool <br>
Standard_EXPORT STEPConstruct_ExternRefs();

//! Creates a tool and initializes it <br>
Standard_EXPORT STEPConstruct_ExternRefs(const Handle(XSControl_WorkSession)& WS);

//! Initializes tool; returns True if succeeded <br>
Standard_EXPORT   Standard_Boolean Init(const Handle(XSControl_WorkSession)& WS) ;

//! Clears internal fields (list of defined extern refs) <br>
Standard_EXPORT   void Clear() ;

//! Searches current STEP model for external references <br>
//!          and loads them to the internal data structures <br>
//!          NOTE: does not clear data structures before loading <br>
Standard_EXPORT   Standard_Boolean LoadExternRefs() ;

//! Returns number of defined extern references <br>
Standard_EXPORT   Standard_Integer NbExternRefs() const;

//! Returns filename for numth extern reference <br>
//!          Returns Null if FileName is not defined or bad <br>
Standard_EXPORT  const Standard_CString FileName(const Standard_Integer num) const;

//! Returns ProductDefinition to which numth extern reference <br>
//!          is associated. <br>
//!          Returns Null if cannot be detected or if extern reference <br>
//!          is not associated to SDR in a proper way. <br>
Standard_EXPORT   Handle_StepBasic_ProductDefinition ProdDef(const Standard_Integer num) const;

//! Returns format identification string for the extern document <br>
//!          Returns Null handle if format is not defined <br>
Standard_EXPORT   Handle_TCollection_HAsciiString Format(const Standard_Integer num) const;

//! Create a new external reference with specified attributes <br>
//!          attached to a given SDR <br>
//!          <format> can be Null string, in that case this information <br>
//!          is not written. Else, it can be "STEP AP214" or "STEP AP203" <br>
//!          Returns index of a new extern ref <br>
Standard_EXPORT   Standard_Integer AddExternRef(const Standard_CString filename,const Handle(StepBasic_ProductDefinition)& PD,const Standard_CString format) ;

//! Check (create if it is null) all shared entities for the model <br>
Standard_EXPORT   void checkAP214Shared() ;

//! Adds all the currently defined external refs to the model <br>
//!          Returns number of written extern refs <br>
Standard_EXPORT   Standard_Integer WriteExternRefs(const Standard_Integer num) const;

//! Set the ApplicationProtocolDefinition of the PDM schema <br>
Standard_EXPORT   void SetAP214APD(const Handle(StepBasic_ApplicationProtocolDefinition)& APD) ;

//! Returns the ApplicationProtocolDefinition of the PDM schema <br>
//!          NOTE: if not defined then create new APD with new Application Context <br>
Standard_EXPORT   Handle_StepBasic_ApplicationProtocolDefinition GetAP214APD() ;





protected:

 // Methods PROTECTED
 // 

//! Create a new additional structure entities and add ncessary references <br>
//!          Note: do not refer from ADR to DF directly in AP214 (TRJ11). <br>
Standard_EXPORT   Standard_Boolean addAP214ExterRef(const Handle(StepAP214_AppliedDocumentReference)& ADR,const Handle(StepBasic_ProductDefinition)& PD,const Handle(StepBasic_DocumentFile)& DF,const Standard_CString filename) ;


 // Fields PROTECTED
 //


private: 

 // Methods PRIVATE
 // 


 // Fields PRIVATE
 //
TColStd_SequenceOfTransient myAEIAs;
TColStd_SequenceOfTransient myRoles;
TColStd_SequenceOfTransient myFormats;
TColStd_SequenceOfTransient myShapes;
TColStd_SequenceOfTransient myTypes;
TColStd_SequenceOfInteger myIsAP214;
TColStd_SequenceOfInteger myReplaceNum;
TColStd_SequenceOfTransient myDocFiles;
Handle_StepBasic_ProductRelatedProductCategory mySharedPRPC;
Handle_StepBasic_DocumentType mySharedDocType;
Handle_StepBasic_ProductDefinitionContext mySharedPDC;
Handle_StepBasic_ProductContext mySharedPC;
Handle_StepBasic_ApplicationProtocolDefinition myAPD;


};





// other Inline functions and methods (like "C++: function call" methods)
//


#endif
