42cf5bc1 |
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 |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _StepData_Protocol_HeaderFile |
18 | #define _StepData_Protocol_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Interface_DataMapOfTransientInteger.hxx> |
24 | #include <Interface_Protocol.hxx> |
25 | #include <Standard_Integer.hxx> |
42cf5bc1 |
26 | #include <TColStd_SequenceOfAsciiString.hxx> |
42cf5bc1 |
27 | class Interface_InterfaceModel; |
28 | class StepData_EDescr; |
29 | class StepData_ESDescr; |
30 | class StepData_ECDescr; |
31 | class StepData_PDescr; |
32 | |
33 | |
34 | class StepData_Protocol; |
35 | DEFINE_STANDARD_HANDLE(StepData_Protocol, Interface_Protocol) |
36 | |
37 | //! Description of Basic Protocol for Step |
38 | //! The class Protocol from StepData itself describes a default |
39 | //! Protocol, which recognizes only UnknownEntities. |
40 | //! Sub-classes will redefine CaseNumber and, if necessary, |
41 | //! NbResources and Resources. |
42 | class StepData_Protocol : public Interface_Protocol |
43 | { |
44 | |
45 | public: |
46 | |
47 | |
48 | Standard_EXPORT StepData_Protocol(); |
49 | |
50 | //! Gives the count of Protocols used as Resource (can be zero) |
51 | //! Here, No resource |
79104795 |
52 | Standard_EXPORT Standard_Integer NbResources() const Standard_OVERRIDE; |
42cf5bc1 |
53 | |
54 | //! Returns a Resource, given a rank. Here, none |
79104795 |
55 | Standard_EXPORT Handle(Interface_Protocol) Resource (const Standard_Integer num) const Standard_OVERRIDE; |
42cf5bc1 |
56 | |
57 | //! Returns a unique positive number for any recognized entity |
58 | //! Redefined to work by calling both TypeNumber and, for a |
59 | //! Described Entity (late binding) DescrNumber |
60 | Standard_EXPORT virtual Standard_Integer CaseNumber (const Handle(Standard_Transient)& obj) const Standard_OVERRIDE; |
61 | |
62 | //! Returns a Case Number, specific of each recognized Type |
63 | //! Here, only Unknown Entity is recognized |
79104795 |
64 | Standard_EXPORT Standard_Integer TypeNumber (const Handle(Standard_Type)& atype) const Standard_OVERRIDE; |
42cf5bc1 |
65 | |
66 | //! Returns the Schema Name attached to each class of Protocol |
67 | //! To be redefined by each sub-class |
68 | //! Here, SchemaName returns "(DEFAULT)" |
69 | //! was C++ : return const |
70 | Standard_EXPORT virtual Standard_CString SchemaName() const; |
71 | |
72 | //! Creates an empty Model for Step Norm |
79104795 |
73 | Standard_EXPORT Handle(Interface_InterfaceModel) NewModel() const Standard_OVERRIDE; |
42cf5bc1 |
74 | |
75 | //! Returns True if <model> is a Model of Step Norm |
79104795 |
76 | Standard_EXPORT Standard_Boolean IsSuitableModel (const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE; |
42cf5bc1 |
77 | |
78 | //! Creates a new Unknown Entity for Step (UndefinedEntity) |
79104795 |
79 | Standard_EXPORT Handle(Standard_Transient) UnknownEntity() const Standard_OVERRIDE; |
42cf5bc1 |
80 | |
81 | //! Returns True if <ent> is an Unknown Entity for the Norm, i.e. |
82 | //! Type UndefinedEntity, status Unknown |
79104795 |
83 | Standard_EXPORT Standard_Boolean IsUnknownEntity (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE; |
42cf5bc1 |
84 | |
85 | //! Returns a unique positive CaseNumber for types described by |
86 | //! an EDescr (late binding) |
87 | //! Warning : TypeNumber and DescrNumber must give together a unique |
88 | //! positive case number for each distinct case, type or descr |
89 | Standard_EXPORT virtual Standard_Integer DescrNumber (const Handle(StepData_EDescr)& adescr) const; |
90 | |
91 | //! Records an EDescr with its case number |
92 | //! Also records its name for an ESDescr (simple type): an ESDescr |
93 | //! is then used, for case number, or for type name |
94 | Standard_EXPORT void AddDescr (const Handle(StepData_EDescr)& adescr, const Standard_Integer CN); |
95 | |
96 | //! Tells if a Protocol brings at least one ESDescr, i.e. if it |
97 | //! defines at least one entity description by ESDescr mechanism |
98 | Standard_EXPORT Standard_Boolean HasDescr() const; |
99 | |
100 | //! Returns the description attached to a case number, or null |
101 | Standard_EXPORT Handle(StepData_EDescr) Descr (const Standard_Integer num) const; |
102 | |
103 | //! Returns a description according to its name |
104 | //! <anylevel> True (D) : for <me> and its resources |
105 | //! <anylevel> False : for <me> only |
106 | Standard_EXPORT Handle(StepData_EDescr) Descr (const Standard_CString name, const Standard_Boolean anylevel = Standard_True) const; |
107 | |
108 | //! Idem as Descr but cast to simple description |
109 | Standard_EXPORT Handle(StepData_ESDescr) ESDescr (const Standard_CString name, const Standard_Boolean anylevel = Standard_True) const; |
110 | |
111 | //! Returns a complex description according to list of names |
112 | //! <anylevel> True (D) : for <me> and its resources |
113 | //! <anylevel> False : for <me> only |
114 | Standard_EXPORT Handle(StepData_ECDescr) ECDescr (const TColStd_SequenceOfAsciiString& names, const Standard_Boolean anylevel = Standard_True) const; |
115 | |
116 | //! Records an PDescr |
117 | Standard_EXPORT void AddPDescr (const Handle(StepData_PDescr)& pdescr); |
118 | |
119 | //! Returns a parameter description according to its name |
120 | //! <anylevel> True (D) : for <me> and its resources |
121 | //! <anylevel> False : for <me> only |
122 | Standard_EXPORT Handle(StepData_PDescr) PDescr (const Standard_CString name, const Standard_Boolean anylevel = Standard_True) const; |
123 | |
124 | //! Records an ESDescr, intended to build complex descriptions |
125 | Standard_EXPORT void AddBasicDescr (const Handle(StepData_ESDescr)& esdescr); |
126 | |
127 | //! Returns a basic description according to its name |
128 | //! <anylevel> True (D) : for <me> and its resources |
129 | //! <anylevel> False : for <me> only |
130 | Standard_EXPORT Handle(StepData_EDescr) BasicDescr (const Standard_CString name, const Standard_Boolean anylevel = Standard_True) const; |
131 | |
132 | |
133 | |
134 | |
92efcf78 |
135 | DEFINE_STANDARD_RTTIEXT(StepData_Protocol,Interface_Protocol) |
42cf5bc1 |
136 | |
137 | protected: |
138 | |
139 | |
140 | |
141 | |
142 | private: |
143 | |
144 | |
145 | Interface_DataMapOfTransientInteger thedscnum; |
997e128f |
146 | NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thedscnam; |
147 | NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thepdescr; |
148 | NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thedscbas; |
42cf5bc1 |
149 | |
150 | |
151 | }; |
152 | |
153 | |
154 | |
155 | |
156 | |
157 | |
158 | |
159 | #endif // _StepData_Protocol_HeaderFile |