OCC Main Page | ApplicationFramework | Toolkits | Packages | Class Hierarchy | Data Structures | File List | Data Fields | Globals

ApplicationFramework
TKBinL
BinObjMgt


BinObjMgt_Persistent Class Reference

Binary persistent representation of an object.
Really it is used as a buffer for read/write an object.

It takes care of Little/Big endian by inversing bytes
in objects of standard types (see FSD_FileHeader.hxx
for the default value of DO_INVERSE).
.

#include <BinObjMgt_Persistent.hxx>


Public Member Functions

void * operator new (size_t, void *anAddress)
void * operator new (size_t size)
void operator delete (void *anAddress)
Standard_EXPORT BinObjMgt_Persistent ()
 Empty constructor
.
Standard_EXPORT BinObjMgt_PersistentPutCharacter (const Standard_Character theValue)
BinObjMgt_Persistentoperator<< (const Standard_Character theValue)
Standard_EXPORT BinObjMgt_PersistentPutByte (const Standard_Byte theValue)
BinObjMgt_Persistentoperator<< (const Standard_Byte theValue)
Standard_EXPORT BinObjMgt_PersistentPutExtCharacter (const Standard_ExtCharacter theValue)
BinObjMgt_Persistentoperator<< (const Standard_ExtCharacter theValue)
Standard_EXPORT BinObjMgt_PersistentPutInteger (const Standard_Integer theValue)
BinObjMgt_Persistentoperator<< (const Standard_Integer theValue)
BinObjMgt_PersistentPutBoolean (const Standard_Boolean theValue)
BinObjMgt_Persistentoperator<< (const Standard_Boolean theValue)
Standard_EXPORT BinObjMgt_PersistentPutReal (const Standard_Real theValue)
BinObjMgt_Persistentoperator<< (const Standard_Real theValue)
Standard_EXPORT BinObjMgt_PersistentPutShortReal (const Standard_ShortReal theValue)
BinObjMgt_Persistentoperator<< (const Standard_ShortReal theValue)
Standard_EXPORT BinObjMgt_PersistentPutCString (const Standard_CString theValue)
 Offset in output buffer is not aligned
.
BinObjMgt_Persistentoperator<< (const Standard_CString theValue)
Standard_EXPORT BinObjMgt_PersistentPutAsciiString (const TCollection_AsciiString &theValue)
 Offset in output buffer is word-aligned
.
BinObjMgt_Persistentoperator<< (const TCollection_AsciiString &theValue)
Standard_EXPORT BinObjMgt_PersistentPutExtendedString (const TCollection_ExtendedString &theValue)
 Offset in output buffer is word-aligned
.
BinObjMgt_Persistentoperator<< (const TCollection_ExtendedString &theValue)
Standard_EXPORT BinObjMgt_PersistentPutLabel (const TDF_Label &theValue)
BinObjMgt_Persistentoperator<< (const TDF_Label &theValue)
Standard_EXPORT BinObjMgt_PersistentPutGUID (const Standard_GUID &theValue)
BinObjMgt_Persistentoperator<< (const Standard_GUID &theValue)
Standard_EXPORT BinObjMgt_PersistentPutCharArray (const BinObjMgt_PChar theArray, const Standard_Integer theLength)
 Put C array of char, theLength is the number of elements
.
Standard_EXPORT BinObjMgt_PersistentPutByteArray (const BinObjMgt_PByte theArray, const Standard_Integer theLength)
 Put C array of unsigned chars, theLength is the number of elements
.
Standard_EXPORT BinObjMgt_PersistentPutExtCharArray (const BinObjMgt_PExtChar theArray, const Standard_Integer theLength)
 Put C array of ExtCharacter, theLength is the number of elements
.
Standard_EXPORT BinObjMgt_PersistentPutIntArray (const BinObjMgt_PInteger theArray, const Standard_Integer theLength)
 Put C array of int, theLength is the number of elements
.
Standard_EXPORT BinObjMgt_PersistentPutRealArray (const BinObjMgt_PReal theArray, const Standard_Integer theLength)
 Put C array of double, theLength is the number of elements
.
Standard_EXPORT BinObjMgt_PersistentPutShortRealArray (const BinObjMgt_PShortReal theArray, const Standard_Integer theLength)
 Put C array of float, theLength is the number of elements
.
Standard_EXPORT const BinObjMgt_PersistentGetCharacter (Standard_Character &theValue) const
const BinObjMgt_Persistentoperator>> (Standard_Character &theValue) const
Standard_EXPORT const BinObjMgt_PersistentGetByte (Standard_Byte &theValue) const
const BinObjMgt_Persistentoperator>> (Standard_Byte &theValue) const
Standard_EXPORT const BinObjMgt_PersistentGetExtCharacter (Standard_ExtCharacter &theValue) const
const BinObjMgt_Persistentoperator>> (Standard_ExtCharacter &theValue) const
Standard_EXPORT const BinObjMgt_PersistentGetInteger (Standard_Integer &theValue) const
const BinObjMgt_Persistentoperator>> (Standard_Integer &theValue) const
const BinObjMgt_PersistentGetBoolean (Standard_Boolean &theValue) const
const BinObjMgt_Persistentoperator>> (Standard_Boolean &theValue) const
Standard_EXPORT const BinObjMgt_PersistentGetReal (Standard_Real &theValue) const
const BinObjMgt_Persistentoperator>> (Standard_Real &theValue) const
Standard_EXPORT const BinObjMgt_PersistentGetShortReal (Standard_ShortReal &theValue) const
const BinObjMgt_Persistentoperator>> (Standard_ShortReal &theValue) const
Standard_EXPORT const BinObjMgt_PersistentGetAsciiString (TCollection_AsciiString &theValue) const
const BinObjMgt_Persistentoperator>> (TCollection_AsciiString &theValue) const
Standard_EXPORT const BinObjMgt_PersistentGetExtendedString (TCollection_ExtendedString &theValue) const
const BinObjMgt_Persistentoperator>> (TCollection_ExtendedString &theValue) const
Standard_EXPORT const BinObjMgt_PersistentGetLabel (const Handle(TDF_Data)&theDS, TDF_Label &theValue) const
Standard_EXPORT const BinObjMgt_PersistentGetGUID (Standard_GUID &theValue) const
const BinObjMgt_Persistentoperator>> (Standard_GUID &theValue) const
Standard_EXPORT const BinObjMgt_PersistentGetCharArray (const BinObjMgt_PChar theArray, const Standard_Integer theLength) const
 Get C array of char, theLength is the number of elements;
theArray must point to a
space enough to place theLength elements
.
Standard_EXPORT const BinObjMgt_PersistentGetByteArray (const BinObjMgt_PByte theArray, const Standard_Integer theLength) const
 Get C array of unsigned chars, theLength is the number of elements;
theArray must point to a
space enough to place theLength elements
.
Standard_EXPORT const BinObjMgt_PersistentGetExtCharArray (const BinObjMgt_PExtChar theArray, const Standard_Integer theLength) const
 Get C array of ExtCharacter, theLength is the number of elements;
theArray must point to a
space enough to place theLength elements
.
Standard_EXPORT const BinObjMgt_PersistentGetIntArray (const BinObjMgt_PInteger theArray, const Standard_Integer theLength) const
 Get C array of int, theLength is the number of elements;
theArray must point to a
space enough to place theLength elements
.
Standard_EXPORT const BinObjMgt_PersistentGetRealArray (const BinObjMgt_PReal theArray, const Standard_Integer theLength) const
 Get C array of double, theLength is the number of elements;
theArray must point to a
space enough to place theLength elements
.
Standard_EXPORT const BinObjMgt_PersistentGetShortRealArray (const BinObjMgt_PShortReal theArray, const Standard_Integer theLength) const
 Get C array of float, theLength is the number of elements;
theArray must point to a
space enough to place theLength elements
.
Standard_Integer Position () const
 Tells the current position for get/put
.
Standard_Boolean SetPosition (const Standard_Integer thePos) const
 Sets the current position for get/put.
Resets an error state depending on the validity of thePos.
Returns the new state (value of IsOK())
.
void Truncate ()
 Truncates the buffer by current position,
i.e. updates mySize
.
Standard_Boolean IsError () const
 Indicates an error after Get methods or SetPosition
.
Standard_Boolean operator! () const
Standard_Boolean IsOK () const
 Indicates a good state after Get methods or SetPosition
.
 operator Standard_Boolean () const
Standard_EXPORT void Init ()
 Initializes me to reuse again
.
void SetId (const Standard_Integer theId)
 Sets the Id of the object
.
void SetTypeId (const Standard_Integer theId)
 Sets the Id of the type of the object
.
Standard_Integer Id () const
 Returns the Id of the object
.
Standard_Integer TypeId () const
 Returns the Id of the type of the object
.
Standard_Integer Length () const
 Returns the length of data
.
Standard_EXPORT Standard_OStream & Write (Standard_OStream &theOS)
 Stores <me> to the stream.
inline Standard_OStream& operator<< (Standard_OStream&,
BinObjMgt_Persistent&) is also available
.
Standard_EXPORT Standard_IStream & Read (Standard_IStream &theIS)
 Retrieves <me> from the stream.
inline Standard_IStream& operator>> (Standard_IStream&,
BinObjMgt_Persistent&) is also available
.
Standard_EXPORT void Destroy ()
 Frees the allocated memory;
This object can be reused after call to Init
.
 ~BinObjMgt_Persistent ()

Private Member Functions

void alignOffset (const Standard_Integer theSize, const Standard_Boolean toClear=Standard_False) const
 Aligns myOffset to the given size;
enters the next piece if the end of the current one is reached;
toClear==true means to fill unused space by 0
.
Standard_Integer prepareForPut (const Standard_Integer theSize)
 Prepares the room for theSize bytes;
returns the number of pieces except for the current one
are to be occupied
.
Standard_EXPORT void incrementData (const Standard_Integer theNbPieces)
 Allocates theNbPieces more pieces
.
Standard_Boolean noMoreData (const Standard_Integer theSize) const
 Checks if there is no more data of the given size starting
from the current position in myData
.
Standard_EXPORT void putArray (const Standard_Address theArray, const Standard_Integer theSize)
 Puts theLength bytes from theArray
.
Standard_EXPORT void getArray (const Standard_Address theArray, const Standard_Integer theSize) const
 Gets theLength bytes into theArray
.
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
.
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
.
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
.
Standard_EXPORT void inverseShortRealData (const Standard_Integer theIndex, const Standard_Integer theOffset, const Standard_Integer theSize)
 Inverses bytes in the data addressed by the given values
.

Private Attributes

BinObjMgt_SequenceOfAddress myData
Standard_Integer myIndex
Standard_Integer myOffset
Standard_Integer mySize
Standard_Boolean myIsError


Constructor & Destructor Documentation

Standard_EXPORT BinObjMgt_Persistent::BinObjMgt_Persistent  ) 
 

BinObjMgt_Persistent::~BinObjMgt_Persistent  )  [inline]
 


Member Function Documentation

void BinObjMgt_Persistent::alignOffset const Standard_Integer  theSize,
const Standard_Boolean  toClear = Standard_False
const [inline, private]
 

Standard_EXPORT void BinObjMgt_Persistent::Destroy  ) 
 

Standard_EXPORT void BinObjMgt_Persistent::getArray const Standard_Address  theArray,
const Standard_Integer  theSize
const [private]
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetAsciiString TCollection_AsciiString theValue  )  const
 

const BinObjMgt_Persistent & BinObjMgt_Persistent::GetBoolean Standard_Boolean &  theValue  )  const [inline]
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetByte Standard_Byte &  theValue  )  const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetByteArray const BinObjMgt_PByte  theArray,
const Standard_Integer  theLength
const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetCharacter Standard_Character &  theValue  )  const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetCharArray const BinObjMgt_PChar  theArray,
const Standard_Integer  theLength
const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetExtCharacter Standard_ExtCharacter &  theValue  )  const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetExtCharArray const BinObjMgt_PExtChar  theArray,
const Standard_Integer  theLength
const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetExtendedString TCollection_ExtendedString &  theValue  )  const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetGUID Standard_GUID &  theValue  )  const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetIntArray const BinObjMgt_PInteger  theArray,
const Standard_Integer  theLength
const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetInteger Standard_Integer &  theValue  )  const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetLabel const Handle(TDF_Data)&  theDS,
TDF_Label theValue
const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetReal Standard_Real &  theValue  )  const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetRealArray const BinObjMgt_PReal  theArray,
const Standard_Integer  theLength
const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetShortReal Standard_ShortReal &  theValue  )  const
 

Standard_EXPORT const BinObjMgt_Persistent& BinObjMgt_Persistent::GetShortRealArray const BinObjMgt_PShortReal  theArray,
const Standard_Integer  theLength
const
 

Standard_Integer BinObjMgt_Persistent::Id  )  const [inline]
 

Standard_EXPORT void BinObjMgt_Persistent::incrementData const Standard_Integer  theNbPieces  )  [private]
 

Standard_EXPORT void BinObjMgt_Persistent::Init  ) 
 

Standard_EXPORT void BinObjMgt_Persistent::inverseExtCharData const Standard_Integer  theIndex,
const Standard_Integer  theOffset,
const Standard_Integer  theSize
[private]
 

Standard_EXPORT void BinObjMgt_Persistent::inverseIntData const Standard_Integer  theIndex,
const Standard_Integer  theOffset,
const Standard_Integer  theSize
[private]
 

Standard_EXPORT void BinObjMgt_Persistent::inverseRealData const Standard_Integer  theIndex,
const Standard_Integer  theOffset,
const Standard_Integer  theSize
[private]
 

Standard_EXPORT void BinObjMgt_Persistent::inverseShortRealData const Standard_Integer  theIndex,
const Standard_Integer  theOffset,
const Standard_Integer  theSize
[private]
 

Standard_Boolean BinObjMgt_Persistent::IsError  )  const [inline]
 

Standard_Boolean BinObjMgt_Persistent::IsOK  )  const [inline]
 

Standard_Integer BinObjMgt_Persistent::Length  )  const [inline]
 

Standard_Boolean BinObjMgt_Persistent::noMoreData const Standard_Integer  theSize  )  const [inline, private]
 

void BinObjMgt_Persistent::operator delete void *  anAddress  )  [inline]
 

void* BinObjMgt_Persistent::operator new size_t  size  )  [inline]
 

void* BinObjMgt_Persistent::operator new size_t  ,
void *  anAddress
[inline]
 

BinObjMgt_Persistent::operator Standard_Boolean  )  const [inline]
 

Standard_Boolean BinObjMgt_Persistent::operator!  )  const [inline]
 

BinObjMgt_Persistent& BinObjMgt_Persistent::operator<< const Standard_GUID &  theValue  )  [inline]
 

BinObjMgt_Persistent& BinObjMgt_Persistent::operator<< const TDF_Label theValue  )  [inline]
 

BinObjMgt_Persistent& BinObjMgt_Persistent::operator<< const TCollection_ExtendedString &  theValue  )  [inline]
 

BinObjMgt_Persistent& BinObjMgt_Persistent::operator<< const TCollection_AsciiString theValue  )  [inline]
 

BinObjMgt_Persistent& BinObjMgt_Persistent::operator<< const Standard_CString  theValue  )  [inline]
 

BinObjMgt_Persistent& BinObjMgt_Persistent::operator<< const Standard_ShortReal  theValue  )  [inline]
 

BinObjMgt_Persistent& BinObjMgt_Persistent::operator<< const Standard_Real  theValue  )  [inline]
 

BinObjMgt_Persistent& BinObjMgt_Persistent::operator<< const Standard_Boolean  theValue  )  [inline]
 

BinObjMgt_Persistent& BinObjMgt_Persistent::operator<< const Standard_Integer  theValue  )  [inline]
 

BinObjMgt_Persistent& BinObjMgt_Persistent::operator<< const Standard_ExtCharacter  theValue  )  [inline]
 

BinObjMgt_Persistent& BinObjMgt_Persistent::operator<< const Standard_Byte  theValue  )  [inline]
 

BinObjMgt_Persistent& BinObjMgt_Persistent::operator<< const Standard_Character  theValue  )  [inline]
 

const BinObjMgt_Persistent& BinObjMgt_Persistent::operator>> Standard_GUID &  theValue  )  const [inline]
 

const BinObjMgt_Persistent& BinObjMgt_Persistent::operator>> TCollection_ExtendedString &  theValue  )  const [inline]
 

const BinObjMgt_Persistent& BinObjMgt_Persistent::operator>> TCollection_AsciiString theValue  )  const [inline]
 

const BinObjMgt_Persistent& BinObjMgt_Persistent::operator>> Standard_ShortReal &  theValue  )  const [inline]
 

const BinObjMgt_Persistent& BinObjMgt_Persistent::operator>> Standard_Real &  theValue  )  const [inline]
 

const BinObjMgt_Persistent& BinObjMgt_Persistent::operator>> Standard_Boolean &  theValue  )  const [inline]
 

const BinObjMgt_Persistent& BinObjMgt_Persistent::operator>> Standard_Integer &  theValue  )  const [inline]
 

const BinObjMgt_Persistent& BinObjMgt_Persistent::operator>> Standard_ExtCharacter &  theValue  )  const [inline]
 

const BinObjMgt_Persistent& BinObjMgt_Persistent::operator>> Standard_Byte &  theValue  )  const [inline]
 

const BinObjMgt_Persistent& BinObjMgt_Persistent::operator>> Standard_Character &  theValue  )  const [inline]
 

Standard_Integer BinObjMgt_Persistent::Position  )  const [inline]
 

Standard_Integer BinObjMgt_Persistent::prepareForPut const Standard_Integer  theSize  )  [inline, private]
 

Standard_EXPORT void BinObjMgt_Persistent::putArray const Standard_Address  theArray,
const Standard_Integer  theSize
[private]
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutAsciiString const TCollection_AsciiString theValue  ) 
 

BinObjMgt_Persistent & BinObjMgt_Persistent::PutBoolean const Standard_Boolean  theValue  )  [inline]
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutByte const Standard_Byte  theValue  ) 
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutByteArray const BinObjMgt_PByte  theArray,
const Standard_Integer  theLength
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutCharacter const Standard_Character  theValue  ) 
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutCharArray const BinObjMgt_PChar  theArray,
const Standard_Integer  theLength
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutCString const Standard_CString  theValue  ) 
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutExtCharacter const Standard_ExtCharacter  theValue  ) 
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutExtCharArray const BinObjMgt_PExtChar  theArray,
const Standard_Integer  theLength
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutExtendedString const TCollection_ExtendedString &  theValue  ) 
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutGUID const Standard_GUID &  theValue  ) 
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutIntArray const BinObjMgt_PInteger  theArray,
const Standard_Integer  theLength
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutInteger const Standard_Integer  theValue  ) 
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutLabel const TDF_Label theValue  ) 
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutReal const Standard_Real  theValue  ) 
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutRealArray const BinObjMgt_PReal  theArray,
const Standard_Integer  theLength
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutShortReal const Standard_ShortReal  theValue  ) 
 

Standard_EXPORT BinObjMgt_Persistent& BinObjMgt_Persistent::PutShortRealArray const BinObjMgt_PShortReal  theArray,
const Standard_Integer  theLength
 

Standard_EXPORT Standard_IStream& BinObjMgt_Persistent::Read Standard_IStream &  theIS  ) 
 

void BinObjMgt_Persistent::SetId const Standard_Integer  theId  )  [inline]
 

Standard_Boolean BinObjMgt_Persistent::SetPosition const Standard_Integer  thePos  )  const [inline]
 

void BinObjMgt_Persistent::SetTypeId const Standard_Integer  theId  )  [inline]
 

void BinObjMgt_Persistent::Truncate  )  [inline]
 

Standard_Integer BinObjMgt_Persistent::TypeId  )  const [inline]
 

Standard_EXPORT Standard_OStream& BinObjMgt_Persistent::Write Standard_OStream &  theOS  ) 
 


Field Documentation

BinObjMgt_SequenceOfAddress BinObjMgt_Persistent::myData [private]
 

Standard_Integer BinObjMgt_Persistent::myIndex [private]
 

Standard_Boolean BinObjMgt_Persistent::myIsError [private]
 

Standard_Integer BinObjMgt_Persistent::myOffset [private]
 

Standard_Integer BinObjMgt_Persistent::mySize [private]
 


The documentation for this class was generated from the following files:
Generated on Mon Aug 25 14:12:44 2008 for OpenCASCADE by  doxygen 1.4.1