1 // Created on: 1993-02-03
2 // Created by: Christian CAILLET
3 // Copyright (c) 1993-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_Protocol_HeaderFile
18 #define _StepData_Protocol_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Interface_DataMapOfTransientInteger.hxx>
24 #include <Interface_Protocol.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_Type.hxx>
27 #include <Standard_CString.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <TColStd_SequenceOfAsciiString.hxx>
30 class Interface_Protocol;
31 class Standard_Transient;
32 class Interface_InterfaceModel;
33 class StepData_EDescr;
34 class StepData_ESDescr;
35 class StepData_ECDescr;
36 class StepData_PDescr;
39 class StepData_Protocol;
40 DEFINE_STANDARD_HANDLE(StepData_Protocol, Interface_Protocol)
42 //! Description of Basic Protocol for Step
43 //! The class Protocol from StepData itself describes a default
44 //! Protocol, which recognizes only UnknownEntities.
45 //! Sub-classes will redefine CaseNumber and, if necessary,
46 //! NbResources and Resources.
47 class StepData_Protocol : public Interface_Protocol
53 Standard_EXPORT StepData_Protocol();
55 //! Gives the count of Protocols used as Resource (can be zero)
57 Standard_EXPORT Standard_Integer NbResources() const Standard_OVERRIDE;
59 //! Returns a Resource, given a rank. Here, none
60 Standard_EXPORT Handle(Interface_Protocol) Resource (const Standard_Integer num) const Standard_OVERRIDE;
62 //! Returns a unique positive number for any recognized entity
63 //! Redefined to work by calling both TypeNumber and, for a
64 //! Described Entity (late binding) DescrNumber
65 Standard_EXPORT virtual Standard_Integer CaseNumber (const Handle(Standard_Transient)& obj) const Standard_OVERRIDE;
67 //! Returns a Case Number, specific of each recognized Type
68 //! Here, only Unknown Entity is recognized
69 Standard_EXPORT Standard_Integer TypeNumber (const Handle(Standard_Type)& atype) const Standard_OVERRIDE;
71 //! Returns the Schema Name attached to each class of Protocol
72 //! To be redefined by each sub-class
73 //! Here, SchemaName returns "(DEFAULT)"
74 //! was C++ : return const
75 Standard_EXPORT virtual Standard_CString SchemaName() const;
77 //! Creates an empty Model for Step Norm
78 Standard_EXPORT Handle(Interface_InterfaceModel) NewModel() const Standard_OVERRIDE;
80 //! Returns True if <model> is a Model of Step Norm
81 Standard_EXPORT Standard_Boolean IsSuitableModel (const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
83 //! Creates a new Unknown Entity for Step (UndefinedEntity)
84 Standard_EXPORT Handle(Standard_Transient) UnknownEntity() const Standard_OVERRIDE;
86 //! Returns True if <ent> is an Unknown Entity for the Norm, i.e.
87 //! Type UndefinedEntity, status Unknown
88 Standard_EXPORT Standard_Boolean IsUnknownEntity (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
90 //! Returns a unique positive CaseNumber for types described by
91 //! an EDescr (late binding)
92 //! Warning : TypeNumber and DescrNumber must give together a unique
93 //! positive case number for each distinct case, type or descr
94 Standard_EXPORT virtual Standard_Integer DescrNumber (const Handle(StepData_EDescr)& adescr) const;
96 //! Records an EDescr with its case number
97 //! Also records its name for an ESDescr (simple type): an ESDescr
98 //! is then used, for case number, or for type name
99 Standard_EXPORT void AddDescr (const Handle(StepData_EDescr)& adescr, const Standard_Integer CN);
101 //! Tells if a Protocol brings at least one ESDescr, i.e. if it
102 //! defines at least one entity description by ESDescr mechanism
103 Standard_EXPORT Standard_Boolean HasDescr() const;
105 //! Returns the description attached to a case number, or null
106 Standard_EXPORT Handle(StepData_EDescr) Descr (const Standard_Integer num) const;
108 //! Returns a description according to its name
109 //! <anylevel> True (D) : for <me> and its resources
110 //! <anylevel> False : for <me> only
111 Standard_EXPORT Handle(StepData_EDescr) Descr (const Standard_CString name, const Standard_Boolean anylevel = Standard_True) const;
113 //! Idem as Descr but cast to simple description
114 Standard_EXPORT Handle(StepData_ESDescr) ESDescr (const Standard_CString name, const Standard_Boolean anylevel = Standard_True) const;
116 //! Returns a complex description according to list of names
117 //! <anylevel> True (D) : for <me> and its resources
118 //! <anylevel> False : for <me> only
119 Standard_EXPORT Handle(StepData_ECDescr) ECDescr (const TColStd_SequenceOfAsciiString& names, const Standard_Boolean anylevel = Standard_True) const;
121 //! Records an PDescr
122 Standard_EXPORT void AddPDescr (const Handle(StepData_PDescr)& pdescr);
124 //! Returns a parameter description according to its name
125 //! <anylevel> True (D) : for <me> and its resources
126 //! <anylevel> False : for <me> only
127 Standard_EXPORT Handle(StepData_PDescr) PDescr (const Standard_CString name, const Standard_Boolean anylevel = Standard_True) const;
129 //! Records an ESDescr, intended to build complex descriptions
130 Standard_EXPORT void AddBasicDescr (const Handle(StepData_ESDescr)& esdescr);
132 //! Returns a basic description according to its name
133 //! <anylevel> True (D) : for <me> and its resources
134 //! <anylevel> False : for <me> only
135 Standard_EXPORT Handle(StepData_EDescr) BasicDescr (const Standard_CString name, const Standard_Boolean anylevel = Standard_True) const;
140 DEFINE_STANDARD_RTTIEXT(StepData_Protocol,Interface_Protocol)
150 Interface_DataMapOfTransientInteger thedscnum;
151 NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thedscnam;
152 NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thepdescr;
153 NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thedscbas;
164 #endif // _StepData_Protocol_HeaderFile