1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
|
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to
// this header file considered to be the "object code" form of the original source.
#ifndef _BinObjMgt_Persistent_HeaderFile
#define _BinObjMgt_Persistent_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _TColStd_SequenceOfAddress_HeaderFile
#include <TColStd_SequenceOfAddress.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_Character_HeaderFile
#include <Standard_Character.hxx>
#endif
#ifndef _Standard_Byte_HeaderFile
#include <Standard_Byte.hxx>
#endif
#ifndef _Standard_ExtCharacter_HeaderFile
#include <Standard_ExtCharacter.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Standard_ShortReal_HeaderFile
#include <Standard_ShortReal.hxx>
#endif
#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
#ifndef _BinObjMgt_PChar_HeaderFile
#include <BinObjMgt_PChar.hxx>
#endif
#ifndef _BinObjMgt_PByte_HeaderFile
#include <BinObjMgt_PByte.hxx>
#endif
#ifndef _BinObjMgt_PExtChar_HeaderFile
#include <BinObjMgt_PExtChar.hxx>
#endif
#ifndef _BinObjMgt_PInteger_HeaderFile
#include <BinObjMgt_PInteger.hxx>
#endif
#ifndef _BinObjMgt_PReal_HeaderFile
#include <BinObjMgt_PReal.hxx>
#endif
#ifndef _BinObjMgt_PShortReal_HeaderFile
#include <BinObjMgt_PShortReal.hxx>
#endif
#ifndef _Handle_TDF_Data_HeaderFile
#include <Handle_TDF_Data.hxx>
#endif
#ifndef _Standard_OStream_HeaderFile
#include <Standard_OStream.hxx>
#endif
#ifndef _Standard_IStream_HeaderFile
#include <Standard_IStream.hxx>
#endif
#ifndef _Standard_Address_HeaderFile
#include <Standard_Address.hxx>
#endif
class TCollection_AsciiString;
class TCollection_ExtendedString;
class TDF_Label;
class Standard_GUID;
class TDF_Data;
//! Binary persistent representation of an object. <br>
//! Really it is used as a buffer for read/write an object. <br>
//! <br>
//! It takes care of Little/Big endian by inversing bytes <br>
//! in objects of standard types (see FSD_FileHeader.hxx <br>
//! for the default value of DO_INVERSE). <br>
class BinObjMgt_Persistent {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
//! Empty constructor <br>
Standard_EXPORT BinObjMgt_Persistent();
Standard_EXPORT BinObjMgt_Persistent& PutCharacter(const Standard_Character theValue) ;
BinObjMgt_Persistent& operator <<(const Standard_Character theValue)
{
return PutCharacter(theValue);
}
Standard_EXPORT BinObjMgt_Persistent& PutByte(const Standard_Byte theValue) ;
BinObjMgt_Persistent& operator <<(const Standard_Byte theValue)
{
return PutByte(theValue);
}
Standard_EXPORT BinObjMgt_Persistent& PutExtCharacter(const Standard_ExtCharacter theValue) ;
BinObjMgt_Persistent& operator <<(const Standard_ExtCharacter theValue)
{
return PutExtCharacter(theValue);
}
Standard_EXPORT BinObjMgt_Persistent& PutInteger(const Standard_Integer theValue) ;
BinObjMgt_Persistent& operator <<(const Standard_Integer theValue)
{
return PutInteger(theValue);
}
BinObjMgt_Persistent& PutBoolean(const Standard_Boolean theValue) ;
BinObjMgt_Persistent& operator <<(const Standard_Boolean theValue)
{
return PutBoolean(theValue);
}
Standard_EXPORT BinObjMgt_Persistent& PutReal(const Standard_Real theValue) ;
BinObjMgt_Persistent& operator <<(const Standard_Real theValue)
{
return PutReal(theValue);
}
Standard_EXPORT BinObjMgt_Persistent& PutShortReal(const Standard_ShortReal theValue) ;
BinObjMgt_Persistent& operator <<(const Standard_ShortReal theValue)
{
return PutShortReal(theValue);
}
//! Offset in output buffer is not aligned <br>
Standard_EXPORT BinObjMgt_Persistent& PutCString(const Standard_CString theValue) ;
BinObjMgt_Persistent& operator <<(const Standard_CString theValue)
{
return PutCString(theValue);
}
//! Offset in output buffer is word-aligned <br>
Standard_EXPORT BinObjMgt_Persistent& PutAsciiString(const TCollection_AsciiString& theValue) ;
BinObjMgt_Persistent& operator <<(const TCollection_AsciiString& theValue)
{
return PutAsciiString(theValue);
}
//! Offset in output buffer is word-aligned <br>
Standard_EXPORT BinObjMgt_Persistent& PutExtendedString(const TCollection_ExtendedString& theValue) ;
BinObjMgt_Persistent& operator <<(const TCollection_ExtendedString& theValue)
{
return PutExtendedString(theValue);
}
Standard_EXPORT BinObjMgt_Persistent& PutLabel(const TDF_Label& theValue) ;
BinObjMgt_Persistent& operator <<(const TDF_Label& theValue)
{
return PutLabel(theValue);
}
Standard_EXPORT BinObjMgt_Persistent& PutGUID(const Standard_GUID& theValue) ;
BinObjMgt_Persistent& operator <<(const Standard_GUID& theValue)
{
return PutGUID(theValue);
}
//! Put C array of char, theLength is the number of elements <br>
Standard_EXPORT BinObjMgt_Persistent& PutCharArray(const BinObjMgt_PChar theArray,const Standard_Integer theLength) ;
//! Put C array of unsigned chars, theLength is the number of elements <br>
Standard_EXPORT BinObjMgt_Persistent& PutByteArray(const BinObjMgt_PByte theArray,const Standard_Integer theLength) ;
//! Put C array of ExtCharacter, theLength is the number of elements <br>
Standard_EXPORT BinObjMgt_Persistent& PutExtCharArray(const BinObjMgt_PExtChar theArray,const Standard_Integer theLength) ;
//! Put C array of int, theLength is the number of elements <br>
Standard_EXPORT BinObjMgt_Persistent& PutIntArray(const BinObjMgt_PInteger theArray,const Standard_Integer theLength) ;
//! Put C array of double, theLength is the number of elements <br>
Standard_EXPORT BinObjMgt_Persistent& PutRealArray(const BinObjMgt_PReal theArray,const Standard_Integer theLength) ;
//! Put C array of float, theLength is the number of elements <br>
Standard_EXPORT BinObjMgt_Persistent& PutShortRealArray(const BinObjMgt_PShortReal theArray,const Standard_Integer theLength) ;
Standard_EXPORT const BinObjMgt_Persistent& GetCharacter(Standard_Character& theValue) const;
const BinObjMgt_Persistent& operator >>(Standard_Character& theValue) const
{
return GetCharacter(theValue);
}
Standard_EXPORT const BinObjMgt_Persistent& GetByte(Standard_Byte& theValue) const;
const BinObjMgt_Persistent& operator >>(Standard_Byte& theValue) const
{
return GetByte(theValue);
}
Standard_EXPORT const BinObjMgt_Persistent& GetExtCharacter(Standard_ExtCharacter& theValue) const;
const BinObjMgt_Persistent& operator >>(Standard_ExtCharacter& theValue) const
{
return GetExtCharacter(theValue);
}
Standard_EXPORT const BinObjMgt_Persistent& GetInteger(Standard_Integer& theValue) const;
const BinObjMgt_Persistent& operator >>(Standard_Integer& theValue) const
{
return GetInteger(theValue);
}
const BinObjMgt_Persistent& GetBoolean(Standard_Boolean& theValue) const;
const BinObjMgt_Persistent& operator >>(Standard_Boolean& theValue) const
{
return GetBoolean(theValue);
}
Standard_EXPORT const BinObjMgt_Persistent& GetReal(Standard_Real& theValue) const;
const BinObjMgt_Persistent& operator >>(Standard_Real& theValue) const
{
return GetReal(theValue);
}
Standard_EXPORT const BinObjMgt_Persistent& GetShortReal(Standard_ShortReal& theValue) const;
const BinObjMgt_Persistent& operator >>(Standard_ShortReal& theValue) const
{
return GetShortReal(theValue);
}
Standard_EXPORT const BinObjMgt_Persistent& GetAsciiString(TCollection_AsciiString& theValue) const;
const BinObjMgt_Persistent& operator >>(TCollection_AsciiString& theValue) const
{
return GetAsciiString(theValue);
}
Standard_EXPORT const BinObjMgt_Persistent& GetExtendedString(TCollection_ExtendedString& theValue) const;
const BinObjMgt_Persistent& operator >>(TCollection_ExtendedString& theValue) const
{
return GetExtendedString(theValue);
}
Standard_EXPORT const BinObjMgt_Persistent& GetLabel(const Handle(TDF_Data)& theDS,TDF_Label& theValue) const;
Standard_EXPORT const BinObjMgt_Persistent& GetGUID(Standard_GUID& theValue) const;
const BinObjMgt_Persistent& operator >>(Standard_GUID& theValue) const
{
return GetGUID(theValue);
}
//! Get C array of char, theLength is the number of elements; <br>
//! theArray must point to a <br>
//! space enough to place theLength elements <br>
Standard_EXPORT const BinObjMgt_Persistent& GetCharArray(const BinObjMgt_PChar theArray,const Standard_Integer theLength) const;
//! Get C array of unsigned chars, theLength is the number of elements; <br>
//! theArray must point to a <br>
//! space enough to place theLength elements <br>
Standard_EXPORT const BinObjMgt_Persistent& GetByteArray(const BinObjMgt_PByte theArray,const Standard_Integer theLength) const;
//! Get C array of ExtCharacter, theLength is the number of elements; <br>
//! theArray must point to a <br>
//! space enough to place theLength elements <br>
Standard_EXPORT const BinObjMgt_Persistent& GetExtCharArray(const BinObjMgt_PExtChar theArray,const Standard_Integer theLength) const;
//! Get C array of int, theLength is the number of elements; <br>
//! theArray must point to a <br>
//! space enough to place theLength elements <br>
Standard_EXPORT const BinObjMgt_Persistent& GetIntArray(const BinObjMgt_PInteger theArray,const Standard_Integer theLength) const;
//! Get C array of double, theLength is the number of elements; <br>
//! theArray must point to a <br>
//! space enough to place theLength elements <br>
Standard_EXPORT const BinObjMgt_Persistent& GetRealArray(const BinObjMgt_PReal theArray,const Standard_Integer theLength) const;
//! Get C array of float, theLength is the number of elements; <br>
//! theArray must point to a <br>
//! space enough to place theLength elements <br>
Standard_EXPORT const BinObjMgt_Persistent& GetShortRealArray(const BinObjMgt_PShortReal theArray,const Standard_Integer theLength) const;
//! Tells the current position for get/put <br>
Standard_Integer Position() const;
//! Sets the current position for get/put. <br>
//! Resets an error state depending on the validity of thePos. <br>
//! Returns the new state (value of IsOK()) <br>
Standard_Boolean SetPosition(const Standard_Integer thePos) const;
//! Truncates the buffer by current position, <br>
//! i.e. updates mySize <br>
void Truncate() ;
//! Indicates an error after Get methods or SetPosition <br>
Standard_Boolean IsError() const;
Standard_Boolean operator !() const
{
return IsError();
}
//! Indicates a good state after Get methods or SetPosition <br>
Standard_Boolean IsOK() const;
operator Standard_Boolean () const { return IsOK(); }
//! Initializes me to reuse again <br>
Standard_EXPORT void Init() ;
//! Sets the Id of the object <br>
void SetId(const Standard_Integer theId) ;
//! Sets the Id of the type of the object <br>
void SetTypeId(const Standard_Integer theId) ;
//! Returns the Id of the object <br>
Standard_Integer Id() const;
//! Returns the Id of the type of the object <br>
Standard_Integer TypeId() const;
//! Returns the length of data <br>
Standard_Integer Length() const;
//! Stores <me> to the stream. <br>
//! inline Standard_OStream& operator<< (Standard_OStream&, <br>
//! BinObjMgt_Persistent&) is also available <br>
Standard_EXPORT Standard_OStream& Write(Standard_OStream& theOS) ;
//! Retrieves <me> from the stream. <br>
//! inline Standard_IStream& operator>> (Standard_IStream&, <br>
//! BinObjMgt_Persistent&) is also available <br>
Standard_EXPORT Standard_IStream& Read(Standard_IStream& theIS) ;
//! Frees the allocated memory; <br>
//! This object can be reused after call to Init <br>
Standard_EXPORT void Destroy() ;
~BinObjMgt_Persistent()
{
Destroy();
}
protected:
private:
//! Aligns myOffset to the given size; <br>
//! enters the next piece if the end of the current one is reached; <br>
//! toClear==true means to fill unused space by 0 <br>
void alignOffset(const Standard_Integer theSize,const Standard_Boolean toClear = Standard_False) const;
//! Prepares the room for theSize bytes; <br>
//! returns the number of pieces except for the current one <br>
//! are to be occupied <br>
Standard_Integer prepareForPut(const Standard_Integer theSize) ;
//! Allocates theNbPieces more pieces <br>
Standard_EXPORT void incrementData(const Standard_Integer theNbPieces) ;
//! Checks if there is no more data of the given size starting <br>
//! from the current position in myData <br>
Standard_Boolean noMoreData(const Standard_Integer theSize) const;
//! Puts theLength bytes from theArray <br>
Standard_EXPORT void putArray(const Standard_Address theArray,const Standard_Integer theSize) ;
//! Gets theLength bytes into theArray <br>
Standard_EXPORT void getArray(const Standard_Address theArray,const Standard_Integer theSize) const;
//! Inverses bytes in the data addressed by the given values <br>
Standard_EXPORT void inverseExtCharData(const Standard_Integer theIndex,const Standard_Integer theOffset,const Standard_Integer theSize) ;
//! Inverses bytes in the data addressed by the given values <br>
Standard_EXPORT void inverseIntData(const Standard_Integer theIndex,const Standard_Integer theOffset,const Standard_Integer theSize) ;
//! Inverses bytes in the data addressed by the given values <br>
Standard_EXPORT void inverseRealData(const Standard_Integer theIndex,const Standard_Integer theOffset,const Standard_Integer theSize) ;
//! Inverses bytes in the data addressed by the given values <br>
Standard_EXPORT void inverseShortRealData(const Standard_Integer theIndex,const Standard_Integer theOffset,const Standard_Integer theSize) ;
TColStd_SequenceOfAddress myData;
Standard_Integer myIndex;
Standard_Integer myOffset;
Standard_Integer mySize;
Standard_Boolean myIsError;
};
#include <BinObjMgt_Persistent.lxx>
// other Inline functions and methods (like "C++: function call" methods)
#endif
|