1 // Created on: 1992-02-11
2 // Created by: Christian CAILLET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _StepData_StepModel_HeaderFile
18 #define _StepData_StepModel_HeaderFile
20 #include <Interface_EntityList.hxx>
21 #include <TColStd_HArray1OfInteger.hxx>
22 #include <Interface_InterfaceModel.hxx>
23 #include <Resource_FormatType.hxx>
25 class Standard_NoSuchObject;
26 class Standard_Transient;
27 class Interface_InterfaceModel;
28 class Interface_EntityIterator;
29 class Interface_Check;
30 class TCollection_HAsciiString;
32 class StepData_StepModel;
33 DEFINE_STANDARD_HANDLE(StepData_StepModel, Interface_InterfaceModel)
36 //! - entities in a STEP file,
37 //! - the STEP file header.
38 class StepData_StepModel : public Interface_InterfaceModel
44 //! Creates an empty STEP model with an empty header.
45 Standard_EXPORT StepData_StepModel();
47 //! returns entity given its rank.
48 //! Same as InterfaceEntity, but with a shorter name
49 Standard_EXPORT Handle(Standard_Transient) Entity (const Standard_Integer num) const;
51 //! gets header from another Model (uses Header Protocol)
52 Standard_EXPORT void GetFromAnother (const Handle(Interface_InterfaceModel)& other) Standard_OVERRIDE;
54 //! Returns a New Empty Model, same type as <me>, i.e. StepModel
55 Standard_EXPORT Handle(Interface_InterfaceModel) NewEmptyModel() const Standard_OVERRIDE;
57 //! returns Header entities under the form of an iterator
58 Standard_EXPORT Interface_EntityIterator Header() const;
60 //! says if a Header entity has a specifed type
61 Standard_EXPORT Standard_Boolean HasHeaderEntity (const Handle(Standard_Type)& atype) const;
63 //! Returns Header entity with specified type, if there is
64 Standard_EXPORT Handle(Standard_Transient) HeaderEntity (const Handle(Standard_Type)& atype) const;
67 Standard_EXPORT void ClearHeader() Standard_OVERRIDE;
69 //! Adds an Entity to the Header
70 Standard_EXPORT void AddHeaderEntity (const Handle(Standard_Transient)& ent);
72 //! Specific Check, checks Header Items with HeaderProtocol
73 Standard_EXPORT virtual void VerifyCheck (Handle(Interface_Check)& ach) const Standard_OVERRIDE;
75 //! Dumps the Header, with the Header Protocol of StepData.
76 //! If the Header Protocol is not defined, for each Header Entity,
77 //! prints its Type. Else sends the Header under the form of
78 //! HEADER Section of an Ascii Step File
79 //! <level> is not used because Header is not so big
80 Standard_EXPORT void DumpHeader (Standard_OStream& S, const Standard_Integer level = 0) const Standard_OVERRIDE;
82 //! erases specific labels, i.e. clears the map (entity-ident)
83 Standard_EXPORT void ClearLabels() Standard_OVERRIDE;
85 //! Attaches an ident to an entity to produce a label
86 //! (does nothing if <ent> is not in <me>)
87 Standard_EXPORT void SetIdentLabel (const Handle(Standard_Transient)& ent, const Standard_Integer ident);
89 //! returns the label ident attached to an entity, 0 if not in me
90 Standard_EXPORT Standard_Integer IdentLabel (const Handle(Standard_Transient)& ent) const;
92 //! Prints label specific to STEP norm for a given entity, i.e.
93 //! if a LabelIdent has been recorded, its value with '#', else
94 //! the number in the model with '#' and between ()
95 Standard_EXPORT void PrintLabel (const Handle(Standard_Transient)& ent, Standard_OStream& S) const Standard_OVERRIDE;
97 //! Returns a string with the label attached to a given entity,
98 //! same form as for PrintLabel
99 Standard_EXPORT Handle(TCollection_HAsciiString) StringLabel (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
101 //! Return the encoding of STEP file for converting names into UNICODE.
102 //! Initialized from "read.step.codepage" variable by constructor, which is Resource_UTF8 by default.
103 Resource_FormatType SourceCodePage() const { return mySourceCodePage; }
105 //! Return the encoding of STEP file for converting names into UNICODE.
106 void SetSourceCodePage (Resource_FormatType theCode) { mySourceCodePage = theCode; }
109 DEFINE_STANDARD_RTTIEXT(StepData_StepModel,Interface_InterfaceModel)
119 Interface_EntityList theheader;
120 Handle(TColStd_HArray1OfInteger) theidnums;
121 Resource_FormatType mySourceCodePage;
132 #endif // _StepData_StepModel_HeaderFile