Integration of OCCT 6.5.0 from SVN
[occt.git] / src / Interface / Interface_FileReaderData.cdl
1 -- File:        FileReaderData.cdl
2 -- Created:     Mon Feb 10 16:51:50 1992
3 -- Author:      Christian CAILLET
4 --              <cky@phobox>
5 ---Copyright:    Matra Datavision 1992
6
7
8 deferred class FileReaderData  from Interface  inherits TShared
9
10     ---Purpose : This class defines services which permit to access Data issued
11     --           from a File, in a form which does not depend of physical
12     --           format : thus, each Record has an attached ParamList (to be
13     --           managed) and resulting Entity.
14     --           
15     --           Each Interface defines its own FileReaderData : on one hand by
16     --           defining deferred methods given here, on the other hand by
17     --           describing literal data and their accesses, with the help of
18     --           basic classes such as String, Array1OfString, etc...
19     --           
20     --           FileReaderData is used by a FileReaderTool, which is also
21     --           specific of each Norm, to read an InterfaceModel of the Norm
22     --           FileReaderData inherits TShared to be accessed by Handle :
23     --           this allows FileReaderTool to define more easily the specific
24     --           methods, and improves memory management.
25
26 uses Integer, Boolean,  CString, Transient,  AsciiString from TCollection,
27      Array1OfInteger  from TColStd,     Array1OfTransient from TColStd,
28      InterfaceModel,  Check,  FileParameter,  ParamSet,  ParamList,  ParamType
29
30 raises NoSuchObject
31
32 is
33
34     Initialize (nbr : Integer; npar : Integer);
35     ---Purpose : Initializes arrays of Entities and of ParamLists attached
36     --           to registered records
37     --           <nbr> must be the maximum number of records to get (no way to
38     --           extend it at run-time) : count entities and sub-entities ...
39     --           <npar> is the total count of parameters (if it is not exact,
40     --           it will be extented as necessary)
41     --           
42     --           Hence, to each record can be bound an Entity and a list of
43     --           Parameters. Each kind of FileReaderData can add other data, by
44     --           having them in parallel (other arrays with same sizes)
45     --           Else, it must manage binding between items and their data
46
47
48     NbRecords (me) returns Integer   is virtual;
49     ---Purpose : Returns the count of registered records
50     --           That is, value given for Initialization (can be redefined)
51
52     NbEntities (me) returns Integer  is virtual;
53     ---Purpose : Returns the count of entities. Depending of each norm, records
54     --           can be Entities or SubParts (SubList in STEP, SubGroup in SET
55     --           ...). NbEntities counts only Entities, not Subs
56     --           Used for memory reservation in InterfaceModel
57     --           Default implementation uses FindNextRecord
58     --           Can be redefined into a more performant way
59
60     FindNextRecord (me; num : Integer) returns Integer is deferred;
61     ---Purpose : Determines the record number defining an Entity following a
62     --           given record number. Specific to each sub-class of
63     --           FileReaderData. Returning zero means no record found
64
65         -- --   access to Paramaters   -- --
66
67     InitParams (me : mutable; num : Integer);
68     ---Purpose : attaches an empty ParamList to a Record
69
70     AddParam   (me : mutable; num : Integer; aval : CString;
71                 atype : ParamType; nument : Integer = 0);
72     ---Purpose : Adds a parameter to record no "num" and fills its fields
73     --           (EntityNumber is optional)
74     --  Warning : <aval> is assumed to be memory-managed elsewhere : it is NOT
75     --           copied. This gives a best speed : strings remain stored in
76     --           pages of characters
77
78     AddParam   (me : mutable; num : Integer; aval : AsciiString from TCollection;
79                 atype : ParamType; nument : Integer = 0);
80     ---Purpose : Same as above, but gets a AsciiString from TCollection
81     --           Remark that the content of the AsciiString is locally copied
82     --           (because its content is most often lost after using)
83
84     AddParam   (me : mutable; num : Integer; FP : FileParameter);
85     ---Purpose : Same as above, but gets a complete FileParameter
86     --  Warning : Content of <FP> is NOT copied : its original address and space
87     --           in memory are assumed to be managed elsewhere (see ParamSet)
88
89     SetParam   (me : mutable; num, nump : Integer; FP : FileParameter);
90     ---Purpose : Sets a new value for a parameter of a record, given by :
91     --           num : record number; nump : parameter number in the record
92
93     NbParams (me; num : Integer) returns Integer  is static;
94     ---Purpose : Returns count of parameters attached to record "num"
95     --           If <num> = 0, returns the total recorded count of parameters
96
97     Params   (me; num : Integer) returns ParamList  is static;
98     ---Purpose : Returns the complete ParamList of a record (read only)
99     --           num = 0 to return the whole param list for the file
100
101     Param       (me; num, nump : Integer) returns FileParameter  is static;
102     ---Purpose : Returns parameter "nump" of record "num", as a complete
103     --           FileParameter
104     ---C++ : return const &
105
106     ChangeParam (me : mutable; num, nump : Integer) returns FileParameter
107         is static;
108     ---Purpose : Same as above, but in order to be modified on place
109     ---C++ : return &
110
111     ParamType   (me; num, nump : Integer) returns ParamType  is static;
112     ---Purpose : Returns type of parameter "nump" of record "num"
113
114 --    ParamValue  (me; num, nump : Integer) returns AsciiString from TCollection;
115     ---Purpose : Returns literal value of parameter "nump" of record "num"
116     --  was C++ : return const &
117
118     ParamCValue (me; num, nump : Integer) returns CString  is static;
119     ---Purpose : Same as above, but as a CString
120     --  was C++ : return const
121
122     IsParamDefined (me; num, nump : Integer) returns Boolean  is static;
123     ---Purpose : Returns True if parameter "nump" of record "num" is defined
124     --           (it is not if its type is ParamVoid)
125
126     ParamNumber (me; num, nump : Integer) returns Integer  is static;
127     ---Purpose : Returns record number of an entity referenced by a parameter
128     --           of type Ident; 0 if no EntityNumber has been determined
129     --           Note that it is used to reference Entities but also Sublists
130     --           (sublists are not objects, but internal descriptions)
131
132     ParamEntity (me; num, nump : Integer)
133         returns mutable Transient  raises NoSuchObject  is static;
134     ---Purpose : Returns the StepEntity referenced by a parameter
135     --           Error if none
136     ---C++ : return const &
137
138     ChangeParameter (me : mutable; numpar : Integer) returns FileParameter
139         is static protected;
140     ---Purpose : Returns a parameter given its absolute rank in the file
141     --           in order to be consulted or modified in specilaized actions
142     ---C++ : return &
143
144     ParamPosition (me; numpar : Integer; num,nump : out Integer)
145         is static protected;
146     ---Purpose : For a given absolute rank of parameter, determines the
147     --           record to which its belongs, and the parameter number for it
148
149     ParamFirstRank (me; num : Integer) returns Integer  is static;
150     ---Purpose : Returns the absolute rank of the beginning of a record
151     --           (its lsit is from ParamFirstRank+1 to ParamFirstRank+NbParams)
152
153         -- --   binding empty entities before loading model   -- --
154
155     BoundEntity (me; num : Integer) returns mutable Transient;
156     ---Purpose : Returns the entity bound to a record, set by SetEntities
157     ---C++ : return const &
158
159     BindEntity (me : mutable; num : Integer; ent : mutable Transient);
160     ---Purpose : Binds an entity to a record
161
162     SetErrorLoad (me : mutable; val : Boolean);
163     ---Purpose : Sets the status "Error Load" on, to overside check fails
164     --           <val> True  : declares unloaded
165     --           <val> False : declares loaded
166     --           If not called before loading (see FileReaderTool), check fails
167     --             give the status
168     --           IsErrorLoad says if SetErrorLoad has been called by user
169     --           ResetErrorLoad resets it (called by FileReaderTool)
170     --           This allows to specify that the currently loaded entity
171     --           remains unloaded (because of syntactic fail)
172
173     IsErrorLoad (me) returns Boolean;
174     ---Purpose : Returns True if the status "Error Load" has been set (to True
175     --           or False)
176
177     ResetErrorLoad (me : mutable) returns Boolean;
178     ---Purpose : Returns the former value of status "Error Load" then resets it
179     --           Used to read the status then ensure it is reset
180
181         -- --   specials    -- --
182
183     Destroy (me : mutable);
184     ---Purpose : Destructor (waiting for memory management)
185     ---C++ : alias ~
186
187     Fastof (myclass; str : CString) returns Real;
188     ---Purpose : Same spec.s as standard <atof> but 5 times faster
189
190 fields
191
192     thenum0   : Integer;        -- current data for access to parameters
193     thenump0  : Integer;
194     therrload : Integer;
195     theparams : ParamSet;               -- the general set of parameters
196     thenumpar : Array1OfInteger   from TColStd;   -- beginning of each one
197 --    thenbpar  : Array1OfInteger   from TColStd;   -- its size
198     theents   : Array1OfTransient from TColStd;   -- entities bound to records
199
200 end FileReaderData;