0024750: Replace instantiations of TCollection generic classes by NCollection templat...
[occt.git] / src / StepData / StepData_StepReaderData.cdl
CommitLineData
b311480e 1-- Created on: 1992-02-11
2-- Created by: Christian CAILLET
3-- Copyright (c) 1992-1999 Matra Datavision
973c2be1 4-- Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5--
973c2be1 6-- This file is part of Open CASCADE Technology software library.
b311480e 7--
d5f74e42 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
973c2be1 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.
b311480e 13--
973c2be1 14-- Alternatively, this file may be used under the terms of Open CASCADE
15-- commercial license or contractual agreement.
7fd59977 16
17class StepReaderData from StepData inherits FileReaderData
18
19 ---Purpose : Specific FileReaderData for Step
20 -- Contains litteral description of entities (for each one : type
21 -- as a string, ident, parameter list)
22 -- provides references evaluation, plus access to litteral data
23 -- and specific access methods (Boolean, XY, XYZ)
24
25uses Integer, Boolean, CString, Transient, Type, HAsciiString from TCollection,
26 Array1OfInteger from TColStd, AsciiString from TCollection,
27 Array1OfAsciiString, SequenceOfAsciiString from TColStd,
28 Check from Interface, ParamType from Interface,
29 Logical from StepData, SelectType from StepData, EnumTool from StepData,
30 SelectMember from StepData, Field from StepData, PDescr from StepData,
31 FieldList from StepData, ESDescr from StepData,
32 IndexedMapOfAsciiString from Interface,
33 DataMapOfIntegerInteger from TColStd
34
35is
36
37 -- -- File data storing and access (specific) -- --
38
6e33d3ce 39 Create (nbheader,nbtotal,nbpar : Integer) returns StepReaderData;
7fd59977 40 ---Purpose : creates StepReaderData correctly dimensionned (necessary at
41 -- creation time, because it contains arrays)
42 -- nbheader is nb of records for Header, nbtotal for Header+Data
43 -- and nbpar gives the total count of parameters
44
45 SetRecord (me : mutable; num : Integer;
46 ident : CString; type : CString; nbpar : Integer)
47 is static;
48 ---Purpose : Fills the fields of a record
49
50 AddStepParam (me : mutable; num : Integer;
51 aval : CString; atype : ParamType; nument : Integer = 0)
52 is static;
53 ---Purpose : Fills the fields of a parameter of a record. This is a variant
54 -- of AddParam, Adapted to STEP (optimized for specific values)
55
56 RecordType (me; num : Integer) returns AsciiString from TCollection
57 is static;
58 ---Purpose : Returns Record Type
59 ---C++ : return const &
60
61 CType (me; num : Integer) returns CString is static;
62 ---Purpose : Returns Record Type as a CString
63 -- was C++ : return const
64
65 RecordIdent (me; num : Integer) returns Integer is static;
66 ---Purpose : Returns record identifier (Positive number)
67 -- If returned ident is not positive : Sub-List or Scope mark
68
69 SubListNumber (me; num, nump : Integer; aslast : Boolean) returns Integer
70 is static;
71 ---Purpose : Returns SubList numero designated by a parameter (nump) in a
72 -- record (num), or zero if the parameter does not exist or is
73 -- not a SubList address. Zero too If aslast is True and nump
74 -- is not for the last parameter
75
76 IsComplex (me; num : Integer) returns Boolean is static;
77 ---Purpose : Returns True if <num> corresponds to a Complex Type Entity
78 -- (as can be defined by ANDOR Express clause)
79
80 ComplexType (me; num : Integer;
81 types : in out SequenceOfAsciiString from TColStd)
82 is static;
83 ---Purpose : Returns the List of Types which correspond to a Complex Type
84 -- Entity. If not Complex, there is just one Type in it
85 -- For a SubList or a Scope mark, <types> remains empty
86
87 NextForComplex (me; num : Integer) returns Integer is static;
88 ---Purpose : Returns the Next "Componant" for a Complex Type Entity, of
89 -- which <num> is already a Componant (the first one or a next one)
90 -- Returns 0 for a Simple Type or for the last Componant
91
92 NamedForComplex (me; name : CString; num0 : Integer;
93 num : in out Integer; ach : in out Check)
94 returns Boolean;
95 ---Purpose : Determines the first component which brings a given name, for
96 -- a Complex Type Entity
97 -- <num0> is the very first record of this entity
98 -- <num> is given the last NextNamedForComplex, starts at zero
99 -- it is returned as the newly found number
100 -- Hence, in the normal case, NextNamedForComplex starts by num0
101 -- if <num> is zero, else by NextForComplex(num)
102 -- If the alphabetic order is not respected, it restarts from
103 -- num0 and loops on NextForComplex until finding <name>
104 -- In case of "non-alphabetic order", <ach> is filled with a
105 -- Warning for this name
106 -- In case of "not-found at all", <ach> is filled with a Fail,
107 -- and <num> is returned as zero
108 --
109 -- Returns True if alphabetic order, False else
110
111 -- -- Some Useful Accesses which are provided -- --
112
113 CheckNbParams (me; num : Integer; nbreq : Integer; ach : in out Check;
114 mess : CString = "") returns Boolean is static;
115 ---Purpose : Checks Count of Parameters of record <num> to equate <nbreq>
116 -- If this Check is successful, returns True
117 -- Else, fills <ach> with an Error Message then returns False
118 -- <mess> is included in the Error message if given non empty
119
120 ReadSubList (me; num, nump : Integer; mess : CString; ach : in out Check;
121 numsub : out Integer;
122 optional : Boolean = Standard_False;
123 lenmin : Integer = 0; lenmax : Integer = 0)
124 returns Boolean is static;
125 ---Purpose : reads parameter <nump> of record <num> as a sub-list (may be
126 -- typed, see ReadTypedParameter in this case)
127 -- Returns True if OK. Else (not a LIST), returns false and
128 -- feeds Check with appropriate check
129 -- If <optional> is True and Param is not defined, returns True
130 -- with <ach> not filled and <numsub> returned as 0
131 -- Works with SubListNumber with <aslast> false (no specific case
132 -- for last parameter)
133
134 ReadSub (me; numsub : Integer; mess : CString; ach : in out Check;
135 descr : PDescr; val : out Transient) returns Integer;
136 ---Purpose : reads the content of a sub-list into a transient :
137 -- SelectNamed, or HArray1 of Integer,Real,String,Transient ...
138 -- recursive call if list of list ...
139 -- If a sub-list has mixed types, an HArray1OfTransient is
140 -- produced, it may contain SelectMember
141 -- Intended to be called by ReadField
142 -- The returned status is : negative if failed, 0 if empty.
143 -- Else the kind to be recorded in the field
144
145 ReadMember (me; num, nump : Integer; mess : CString; ach : in out Check;
6e33d3ce 146 val : in out SelectMember) returns Boolean;
7fd59977 147 ---Purpose : Reads parameter <nump> of record <num> into a SelectMember,
148 -- self-sufficient (no Description needed)
149 -- If <val> is already created, it will be filled, as possible
150 -- And if reading does not match its own description, the result
151 -- will be False
152 -- If <val> is not it not yet created, it will be (SelectNamed)
153 -- Usefull if a field is defined as a SelectMember, directly
154 -- (SELECT with no Entity as member)
155 -- But SelectType also manages SelectMember (for SELECT with
156 -- some members as Entity, some other not)
157
158 ReadField (me; num, nump : Integer; mess : CString; ach : in out Check;
159 descr : PDescr; fild : in out Field) returns Boolean;
160 ---Purpose : reads parameter <nump> of record <num> into a Field,
161 -- controlled by a Parameter Descriptor (PDescr), which controls
162 -- its allowed type(s) and value
163 -- <ach> is filled if the read parameter does not match its
164 -- description (but the field is read anyway)
165 -- If the description is not defined, no control is done
166 -- Returns True when done
167
168 ReadList (me; num : Integer; ach : in out Check;
169 descr : ESDescr; list : in out FieldList) returns Boolean;
170 ---Purpose : reads a list of fields controlled by an ESDescr
171
172 ReadAny (me; num, nump : Integer; mess : CString; ach : in out Check;
6e33d3ce 173 descr : PDescr; val : in out Transient) returns Boolean;
7fd59977 174 ---Purpose : Reads parameter <nump> of record <num> into a Transient Value
175 -- according to the type of the parameter :
176 -- Named for Integer,Boolean,Logical,Enum,Real : SelectNamed
177 -- Immediate Integer,Boolean,Logical,Enum,Real : SelectInt/Real
178 -- Text : HAsciiString
179 -- Ident : the referenced Entity
180 -- Sub-List not processed, see ReadSub
181 -- This value is controlled by a Parameter Descriptor (PDescr),
182 -- which controls its allowed type and value
183 -- <ach> is filled if the read parameter does not match its
184 -- description (the select is nevertheless created if possible)
185 --
186 -- Warning : val is in out, hence it is possible to predefine a specific
187 -- SelectMember then to fill it. If <val> is Null or if the
188 -- result is not a SelectMember, val itself is returned a new ref
189 -- For a Select with a Name, <val> must then be a SelectNamed
190
191 ReadXY (me; num, nump : Integer; mess : CString; ach : in out Check;
192 X,Y : out Real) returns Boolean is static;
193 ---Purpose : reads parameter <nump> of record <num> as a sub-list of
194 -- two Reals X,Y. Returns True if OK. Else, returns false and
195 -- feeds Check with appropriate Fails (parameter not a sub-list,
196 -- not two Reals in the sub-list) composed with "mess" which
197 -- gives the name of the parameter
198
199 ReadXYZ (me; num, nump : Integer; mess : CString; ach : in out Check;
200 X,Y,Z : out Real) returns Boolean is static;
201 ---Purpose : reads parameter <nump> of record <num> as a sub-list of
202 -- three Reals X,Y,Z. Return value and Check managed as by
203 -- ReadXY (demands a sub-list of three Reals)
204
205 ReadReal (me; num, nump : Integer; mess : CString; ach : in out Check;
206 val : out Real) returns Boolean is static;
207 ---Purpose : reads parameter <nump> of record <num> as a single Real value.
208 -- Return value and Check managed as by ReadXY (demands a Real)
209
210 ReadEntity (me; num, nump : Integer; mess : CString; ach : in out Check;
6e33d3ce 211 atype : Type; ent : out Transient)
7fd59977 212 returns Boolean is static;
213 ---Purpose : Reads parameter <nump> of record <num> as a single Entity.
214 -- Return value and Check managed as by ReadReal (demands a
215 -- reference to an Entity). In Addition, demands read Entity
216 -- to be Kind of a required Type <atype>.
217 -- Remark that returned status is False and <ent> is Null if
218 -- parameter is not an Entity, <ent> remains Not Null is parameter
219 -- is an Entity but is not Kind of required type
220
221 ReadEntity (me; num, nump : Integer; mess : CString; ach : in out Check;
222 sel : in out SelectType) returns Boolean is static;
223 ---Purpose : Same as above, but a SelectType checks Type Matching, and
224 -- records the read Entity (see method Value from SelectType)
225
226 ReadInteger (me; num, nump : Integer; mess : CString; ach : in out Check;
227 val : out Integer) returns Boolean is static;
228 ---Purpose : reads parameter <nump> of record <num> as a single Integer.
229 -- Return value & Check managed as by ReadXY (demands an Integer)
230
231 ReadBoolean (me; num, nump : Integer; mess : CString; ach : in out Check;
232 flag : out Boolean) returns Boolean is static;
233 ---Purpose : reads parameter <nump> of record <num> as a Boolean
234 -- Return value and Check managed as by ReadReal (demands a
235 -- Boolean enum, i.e. text ".T." for True or ".F." for False)
236
237 ReadLogical (me; num, nump : Integer; mess : CString; ach : in out Check;
238 flag : out Logical from StepData) returns Boolean is static;
239 ---Purpose : reads parameter <nump> of record <num> as a Logical
240 -- Return value and Check managed as by ReadBoolean (demands a
241 -- Logical enum, i.e. text ".T.", ".F.", or ".U.")
242
243 ReadString (me; num, nump : Integer; mess : CString; ach : in out Check;
6e33d3ce 244 val : out HAsciiString from TCollection)
7fd59977 245 returns Boolean is static;
246 ---Purpose : reads parameter <nump> of record <num> as a String (text
247 -- between quotes, quotes are removed by the Read operation)
248 -- Return value and Check managed as by ReadXY (demands a String)
249
250 ReadEnumParam (me; num, nump : Integer; mess : CString; ach : in out Check;
251 text : out CString)
252 returns Boolean is static;
253 ---Puroise : Reads parameter <nump> of record <num>, checks if it is an
254 -- Enumeration, if yes returns its text value
255 -- Returns True if OK, False (+ empty string) if not an enum
256 -- (also fills <ach>
257
258 FailEnumValue (me; num, nump : Integer; mess : CString; ach : in out Check);
259 ---Purpose : Fills a check with a fail message if enumeration value does
260 -- match parameter definition
261 -- Just a help to centralize message definitions
262
263 ReadEnum (me; num, nump : Integer; mess : CString; ach : in out Check;
264 enumtool : EnumTool from StepData; val : out Integer)
265 returns Boolean is static;
266 ---Purpose : Reads parameter <nump> of record <num> as an Enumeration (text
267 -- between dots) and converts it to an integer value, by an
268 -- EnumTool. Returns True if OK, false if : this parameter is not
269 -- enumeration, or is not recognized by the EnumTool (with fail)
270
271 ReadTypedParam (me; num,nump : Integer; mustbetyped : Boolean;
272 mess : CString; ach : in out Check;
273 numr,numrp : out Integer; typ : out AsciiString)
274 returns Boolean is static;
275 ---Purpose : Resolves a parameter which can be enclosed in a type def., as
276 -- TYPE(val). The parameter must then be read normally according
277 -- its type. Parameter to be resolved is <nump> of record <num>
278 -- <mustbetyped> True demands a typed parameter
279 -- <mustbetyped> False accepts a non-typed parameter as option
280 -- mess and ach as usual
281 -- <numr>,<numrp> are the resolved record and parameter numbers
282 -- = num,nump if no type, else numrp=1
283 -- <typ> returns the recorded type, or empty string
284 -- Remark : a non-typed list is considered as "non-typed"
285
286 CheckDerived (me; num, nump : Integer; mess : CString; ach : in out Check;
287 errstat : Boolean = Standard_False)
288 returns Boolean is static;
289 ---Purpose : Checks if parameter <nump> of record <num> is given as Derived
290 -- If this Check is successful (i.e. Param = "*"), returns True
291 -- Else, fills <ach> with a Message which contains <mess> and
292 -- returns False. According to <errstat>, this message is Warning
293 -- if errstat is False (Default), Fail if errstat is True
294
295 -- -- General exploitation methods -- --
296
297 NbEntities (me) returns Integer is redefined;
298 ---Purpose : Returns total count of Entities (including Header)
299
300 FindNextRecord (me; num : Integer) returns Integer;
301 ---Purpose : determines the first suitable record following a given one
302 -- that is, skips SCOPE,ENDSCOPE and SUBLIST records
303 -- Note : skips Header records, which are accessed separately
304
305 FindEntityNumber (me; num, id : Integer) returns Integer is static private;
306 ---Purpose : Searches for a Parameter of the record <num>, which refers to
307 -- the Ident <id> (form #nnn). [Used by SetEntityNumbers]
308 -- If found, returns its EntityNumber, else returns Zero.
309
310 -- -- Preparation before loading model -- --
311
312 SetEntityNumbers (me : mutable; withmap : Boolean = Standard_True);
313 ---Purpose : determines reference numbers in EntityNumber fields
314 -- called by Prepare from StepReaderTool to prepare later using
315 -- by a StepModel. This method is attached to StepReaderData
316 -- because it needs a massive amount of data accesses to work
317 --
318 -- If <withmap> is given False, the basic exploration algorithm
319 -- is activated, otherwise a map is used as far as it is possible
320 -- this option can be used only to test this algorithm
321
322 -- -- Managing Header -- --
323 -- Header is defined as a list of StepEntities (without ident)
324
325 FindNextHeaderRecord (me; num : Integer) returns Integer;
326 ---Purpose : determine first suitable record of Header
327 -- works as FindNextRecord, but treats only Header records
328
329 PrepareHeader (me : mutable);
330 ---Purpose : Works as SetEntityNumbers but for Header : more simple because
331 -- there are no Reference, only Sub-Lists
332
333 GlobalCheck (me) returns Check;
334 ---Purpose : Returns the Global Check. It can record Fail messages about
335 -- Undefined References (detected by SetEntityNumbers)
336 ---C++ : return const
337
338fields
339
340 theidents : Array1OfInteger from TColStd;
341 -- ident (entity/sub) or indicates SCOPE/END.
342-- thetypes : Array1OfAsciiString;
343 thetypes : Array1OfInteger;
344 thenametypes : IndexedMapOfAsciiString from Interface;
345 themults : DataMapOfIntegerInteger from TColStd;
346 --themults : Array1OfInteger from TColStd; -- For Complex Type Entities
347 thenbents : Integer; -- internal data used for optimization
348 thelastn : Integer;
349 thenbhead : Integer; -- nb of records taken by Header
350 thenbscop : Integer;
351 thecheck : Check;
352
353end StepReaderData;