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