0023024: Update headers of OCCT files
[occt.git] / src / BinObjMgt / BinObjMgt_Persistent.cdl
CommitLineData
b311480e 1-- Created on: 2002-10-30
2-- Created by: Michael SAZONOV
3-- Copyright (c) 2002-2012 OPEN CASCADE SAS
4--
5-- The content of this file is subject to the Open CASCADE Technology Public
6-- License Version 6.5 (the "License"). You may not use the content of this file
7-- except in compliance with the License. Please obtain a copy of the License
8-- at http://www.opencascade.org and read it completely before using this file.
9--
10-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12--
13-- The Original Code and all software distributed under the License is
14-- distributed on an "AS IS" basis, without warranty of any kind, and the
15-- Initial Developer hereby disclaims all such warranties, including without
16-- limitation, any warranties of merchantability, fitness for a particular
17-- purpose or non-infringement. Please see the License for the specific terms
18-- and conditions governing the rights and limitations under the License.
19
7fd59977 20
21class Persistent from BinObjMgt
22 ---Purpose: Binary persistent representation of an object.
23 -- Really it is used as a buffer for read/write an object.
24 --
25 -- It takes care of Little/Big endian by inversing bytes
26 -- in objects of standard types (see FSD_FileHeader.hxx
27 -- for the default value of DO_INVERSE).
28
29uses
30 Integer from Standard,
31 Address from Standard,
32 OStream from Standard,
33 IStream from Standard,
34 SequenceOfAddress from TColStd,
35 AsciiString from TCollection,
36 ExtendedString from TCollection,
37 Label from TDF,
38 Data from TDF,
39 PChar from BinObjMgt,
40 PExtChar from BinObjMgt,
41 PInteger from BinObjMgt,
42 PReal from BinObjMgt,
43 PShortReal from BinObjMgt,
44 PByte from BinObjMgt
45
46is
47
48 Create
49 returns Persistent from BinObjMgt;
50 ---Purpose: Empty constructor
51
52 -------------------------------------------
53 ---Category: API for attribute drivers
54 -------------------------------------------
55
56 PutCharacter (me : in out; theValue : Character from Standard)
57 returns like me;
58 ---C++: alias operator <<
59 ---C++: return &
60
61 PutByte (me : in out; theValue : Byte from Standard)
62 returns like me;
63 ---C++: alias operator <<
64 ---C++: return &
65
66 PutExtCharacter (me : in out; theValue : ExtCharacter from Standard)
67 returns like me;
68 ---C++: alias operator <<
69 ---C++: return &
70
71 PutInteger (me : in out; theValue : Integer from Standard)
72 returns like me;
73 ---C++: alias operator <<
74 ---C++: return &
75
76 PutBoolean (me : in out; theValue : Boolean from Standard)
77 returns like me;
78 ---C++: alias operator <<
79 ---C++: inline
80 ---C++: return &
81
82 PutReal (me : in out; theValue : Real from Standard)
83 returns like me;
84 ---C++: alias operator <<
85 ---C++: return &
86
87 PutShortReal (me : in out; theValue : ShortReal from Standard)
88 returns like me;
89 ---C++: alias operator <<
90 ---C++: return &
91
92 PutCString (me : in out; theValue : CString from Standard)
93 returns like me;
94 ---C++: alias operator <<
95 ---C++: return &
96 ---Purpose: Offset in output buffer is not aligned
97
98 PutAsciiString (me : in out; theValue : AsciiString from TCollection)
99 returns like me;
100 ---C++: alias operator <<
101 ---C++: return &
102 ---Purpose: Offset in output buffer is word-aligned
103
104 PutExtendedString (me : in out; theValue : ExtendedString from TCollection)
105 returns like me;
106 ---C++: alias operator <<
107 ---C++: return &
108 ---Purpose: Offset in output buffer is word-aligned
109
110 PutLabel (me : in out; theValue : Label from TDF)
111 returns like me;
112 ---C++: alias operator <<
113 ---C++: return &
114
115 PutGUID (me : in out; theValue : GUID from Standard)
116 returns like me;
117 ---C++: alias operator <<
118 ---C++: return &
119
120 PutCharArray (me : in out; theArray : PChar from BinObjMgt;
121 theLength: Integer from Standard)
122 returns like me;
123 ---C++: return &
124 ---Purpose: Put C array of char, theLength is the number of elements
125
126 PutByteArray (me : in out; theArray : PByte from BinObjMgt;
127 theLength: Integer from Standard)
128 returns like me;
129 ---C++: return &
130 ---Purpose: Put C array of unsigned chars, theLength is the number of elements
131
132 PutExtCharArray (me : in out; theArray : PExtChar from BinObjMgt;
133 theLength: Integer from Standard)
134 returns like me;
135 ---C++: return &
136 ---Purpose: Put C array of ExtCharacter, theLength is the number of elements
137
138 PutIntArray (me : in out; theArray : PInteger from BinObjMgt;
139 theLength: Integer from Standard)
140 returns like me;
141 ---C++: return &
142 ---Purpose: Put C array of int, theLength is the number of elements
143
144 PutRealArray (me : in out; theArray : PReal from BinObjMgt;
145 theLength: Integer from Standard)
146 returns like me;
147 ---C++: return &
148 ---Purpose: Put C array of double, theLength is the number of elements
149
150 PutShortRealArray (me : in out; theArray : PShortReal from BinObjMgt;
151 theLength: Integer from Standard)
152 returns like me;
153 ---C++: return &
154 ---Purpose: Put C array of float, theLength is the number of elements
155
156 GetCharacter (me : in; theValue : out Character from Standard)
157 returns like me;
158 ---C++: alias operator >>
159 ---C++: return const &
160
161 GetByte (me : in; theValue : out Byte from Standard)
162 returns like me;
163 ---C++: alias operator >>
164 ---C++: return const &
165
166 GetExtCharacter (me : in; theValue : out ExtCharacter from Standard)
167 returns like me;
168 ---C++: alias operator >>
169 ---C++: return const &
170
171 GetInteger (me : in; theValue : out Integer from Standard)
172 returns like me;
173 ---C++: alias operator >>
174 ---C++: return const &
175
176 GetBoolean (me : in; theValue : out Boolean from Standard)
177 returns like me;
178 ---C++: alias operator >>
179 ---C++: inline
180 ---C++: return const &
181
182 GetReal (me : in; theValue : out Real from Standard)
183 returns like me;
184 ---C++: alias operator >>
185 ---C++: return const &
186
187 GetShortReal (me : in; theValue : out ShortReal from Standard)
188 returns like me;
189 ---C++: alias operator >>
190 ---C++: return const &
191
192 GetAsciiString (me : in; theValue : out AsciiString from TCollection)
193 returns like me;
194 ---C++: alias operator >>
195 ---C++: return const &
196
197 GetExtendedString (me : in; theValue : out ExtendedString from TCollection)
198 returns like me;
199 ---C++: alias operator >>
200 ---C++: return const &
201
202 GetLabel (me : in; theDS : Data from TDF;
203 theValue : out Label from TDF)
204 returns like me;
205 ---C++: return const &
206
207 GetGUID (me : in; theValue : out GUID from Standard)
208 returns like me;
209 ---C++: alias operator >>
210 ---C++: return const &
211
212 GetCharArray (me : in; theArray : PChar from BinObjMgt;
213 theLength: Integer from Standard)
214 returns like me;
215 ---C++: return const &
216 ---Purpose: Get C array of char, theLength is the number of elements;
217 -- theArray must point to a
218 -- space enough to place theLength elements
219
220 GetByteArray (me : in; theArray : PByte from BinObjMgt;
221 theLength: Integer from Standard)
222 returns like me;
223 ---C++: return const &
224 ---Purpose: Get C array of unsigned chars, theLength is the number of elements;
225 -- theArray must point to a
226 -- space enough to place theLength elements
227
228 GetExtCharArray (me : in; theArray : PExtChar from BinObjMgt;
229 theLength: Integer from Standard)
230 returns like me;
231 ---C++: return const &
232 ---Purpose: Get C array of ExtCharacter, theLength is the number of elements;
233 -- theArray must point to a
234 -- space enough to place theLength elements
235
236 GetIntArray (me : in; theArray : PInteger from BinObjMgt;
237 theLength: Integer from Standard)
238 returns like me;
239 ---C++: return const &
240 ---Purpose: Get C array of int, theLength is the number of elements;
241 -- theArray must point to a
242 -- space enough to place theLength elements
243
244 GetRealArray (me : in; theArray : PReal from BinObjMgt;
245 theLength: Integer from Standard)
246 returns like me;
247 ---C++: return const &
248 ---Purpose: Get C array of double, theLength is the number of elements;
249 -- theArray must point to a
250 -- space enough to place theLength elements
251
252 GetShortRealArray (me : in; theArray : PShortReal from BinObjMgt;
253 theLength: Integer from Standard)
254 returns like me;
255 ---C++: return const &
256 ---Purpose: Get C array of float, theLength is the number of elements;
257 -- theArray must point to a
258 -- space enough to place theLength elements
259
260 Position (me) returns Integer from Standard;
261 ---C++: inline
262 ---Purpose: Tells the current position for get/put
263
264 SetPosition (me; thePos : Integer from Standard)
265 returns Boolean from Standard;
266 ---C++: inline
267 ---Purpose: Sets the current position for get/put.
268 -- Resets an error state depending on the validity of thePos.
269 -- Returns the new state (value of IsOK())
270
271 Truncate (me : in out);
272 ---C++: inline
273 ---Purpose: Truncates the buffer by current position,
274 -- i.e. updates mySize
275
276 IsError (me) returns Boolean from Standard;
277 ---C++: inline
278 ---C++: alias operator !
279 ---Purpose: Indicates an error after Get methods or SetPosition
280
281 IsOK (me) returns Boolean from Standard;
282 ---C++: inline
283 ---C++: alias "operator Standard_Boolean () const { return IsOK(); }"
284 ---Purpose: Indicates a good state after Get methods or SetPosition
285
286 -------------------------------------------
287 ---Category: API for retrieval/storage driver
288 -------------------------------------------
289
290 Init (me: in out);
291 ---Purpose: Initializes me to reuse again
292
293 SetId (me:out; theId: Integer from Standard)
294 is static;
295 ---C++: inline
296 ---Purpose: Sets the Id of the object
297
298 SetTypeId (me:out; theId: Integer from Standard)
299 is static;
300 ---C++: inline
301 ---Purpose: Sets the Id of the type of the object
302
303 Id (me) returns Integer from Standard
304 is static;
305 ---C++: inline
306 ---Purpose: Returns the Id of the object
307
308 TypeId (me) returns Integer from Standard
309 is static;
310 ---C++: inline
311 ---Purpose: Returns the Id of the type of the object
312
313 Length (me) returns Integer from Standard
314 is static;
315 ---C++: inline
316 ---Purpose: Returns the length of data
317
318 Write (me: in out; theOS: in out OStream from Standard)
319 returns OStream from Standard is static;
320 ---C++: return &
321 ---Purpose: Stores <me> to the stream.
322 -- inline Standard_OStream& operator<< (Standard_OStream&,
323 -- BinObjMgt_Persistent&) is also available
324
325 Read (me: in out; theIS: in out IStream from Standard)
326 returns IStream from Standard is static;
327 ---C++: return &
328 ---Purpose: Retrieves <me> from the stream.
329 -- inline Standard_IStream& operator>> (Standard_IStream&,
330 -- BinObjMgt_Persistent&) is also available
331
332 Destroy (me: in out);
333 ---C++: alias ~
334 ---Purpose: Frees the allocated memory;
335 -- This object can be reused after call to Init
336
337 -------------------------------------------
338 ---Category: Private methods
339 -------------------------------------------
340
341 alignOffset (me; theSize: Integer from Standard;
342 toClear: Boolean from Standard = Standard_False)
343 is private;
344 ---C++: inline
345 ---Purpose: Aligns myOffset to the given size;
346 -- enters the next piece if the end of the current one is reached;
347 -- toClear==true means to fill unused space by 0
348
349 prepareForPut (me: in out; theSize: Integer from Standard)
350 returns Integer from Standard is private;
351 ---C++: inline
352 ---Purpose: Prepares the room for theSize bytes;
353 -- returns the number of pieces except for the current one
354 -- are to be occupied
355
356 incrementData (me: in out; theNbPieces: Integer from Standard)
357 is private;
358 ---Purpose: Allocates theNbPieces more pieces
359
360 noMoreData (me; theSize: Integer from Standard)
361 returns Boolean from Standard is private;
362 ---C++: inline
363 ---Purpose: Checks if there is no more data of the given size starting
364 -- from the current position in myData
365
366 putArray (me : in out; theArray : Address from Standard;
367 theSize : Integer from Standard)
368 is private;
369 ---Purpose: Puts theLength bytes from theArray
370
371 getArray (me : in; theArray : Address from Standard;
372 theSize : Integer from Standard)
373 is private;
374 ---Purpose: Gets theLength bytes into theArray
375
376 inverseExtCharData (me : in out;
377 theIndex, theOffset, theSize : Integer from Standard)
378 is private;
379 ---Purpose: Inverses bytes in the data addressed by the given values
380
381 inverseIntData (me : in out;
382 theIndex, theOffset, theSize : Integer from Standard)
383 is private;
384 ---Purpose: Inverses bytes in the data addressed by the given values
385
386 inverseRealData (me : in out;
387 theIndex, theOffset, theSize : Integer from Standard)
388 is private;
389 ---Purpose: Inverses bytes in the data addressed by the given values
390
391 inverseShortRealData (me : in out;
392 theIndex, theOffset, theSize : Integer from Standard)
393 is private;
394 ---Purpose: Inverses bytes in the data addressed by the given values
395
396fields
397 -- Sequence of pieces of data; the 1st piece is as follows:
398 -- (int) [0] the TypeId
399 -- (int) [1] the Id
400 -- (int) [2] the length of data of the object in bytes
401 -- the remainder is for data of the object
402 myData : SequenceOfAddress from TColStd;
403 -- Current position: the piece index (start from 1) and offset (start from 0)
404 myIndex : Integer from Standard;
405 myOffset : Integer from Standard;
406 -- The size of filled data
407 mySize : Integer from Standard;
408 myIsError : Boolean from Standard;
409
410end Persistent;