#include <XDRPersistenceManager.h>
Public Member Functions |
|
Constructors and Destructors
|
|
XDRPersistenceManager () | |
Default constructor. |
|
XDRPersistenceManager (std::istream &is) | |
Detailed constructor with an input
stream. |
|
XDRPersistenceManager (std::ostream &os) | |
Detailed constructor with an output
stream. |
|
XDRPersistenceManager (std::istream &is, std::ostream &os) | |
Detailed constructor with an input
stream and an output stream. |
|
Layer 0 methods
|
|
virtual void | writeHeader (const char *type_name, const char *name, LongSize ptr) |
Write an object header. |
|
virtual bool | checkHeader (const char *type_name, const char *name, LongSize &ptr) |
Check for an object header. |
|
virtual void | writeTrailer (const char *name=0) |
Write an object trailer. |
|
virtual bool | checkTrailer (const char *name=0) |
Check for an object trailer.
|
|
virtual void | writeStreamHeader () |
Write a start marker to the output
stream. |
|
virtual void | writeStreamTrailer () |
Write an end marker to the output
stream. |
|
virtual bool | checkStreamHeader () |
Check for the start marker in the
input stream. |
|
virtual bool | checkStreamTrailer () |
Check for the end marker in the
output stream. |
|
virtual bool | getObjectHeader (String &type_name, LongSize &ptr) |
Get an (unknown) object
header. |
|
virtual void | writeName (const char *name) |
Write a variable/member
name. |
|
virtual bool | checkName (const char *name) |
Check for variable/member
name. |
|
virtual void | writeStorableHeader (const char *type_name, const char *name) |
Write storable object
header. |
|
virtual bool | checkStorableHeader (const char *type_name, const char *name) |
Check for storable object
header. |
|
virtual void | writePrimitiveHeader (const char *type_name, const char *name) |
Write type header and name for a
primitive type. |
|
virtual bool | checkPrimitiveHeader (const char *type_name, const char *name) |
Check for a type header and name for
a primitive type. |
|
virtual void | writeStorableTrailer () |
Write storable object
trailer. |
|
virtual bool | checkStorableTrailer () |
Check for storable object
trailer. |
|
virtual void | writePrimitiveTrailer () |
Write the trailer for a primitive
type. |
|
virtual bool | checkPrimitiveTrailer () |
Check the trailer of a primitive
type. |
|
virtual void | writeObjectPointerHeader (const char *type_name, const char *name) |
Write header for a pointer to a
PersistentObject. |
|
virtual bool | checkObjectPointerHeader (const char *type_name, const char *name) |
Check for header for a pointer to a
PersistentObject. |
|
virtual void | writeObjectReferenceHeader (const char *type_name, const char *name) |
Write header for a reference to a
PersistentObject. |
|
virtual bool | checkObjectReferenceHeader (const char *type_name, const char *name) |
Check for header for a reference to
a PersistentObject. |
|
virtual void | writeObjectPointerArrayHeader (const char *type_name, const char *name, Size size) |
Write header for an array of
pointers to PersistentObjects. |
|
virtual bool | checkObjectPointerArrayHeader (const char *type_name, const char *name, Size &size) |
Check for header for an array of
pointers to PersistentObjects. |
|
virtual void | writeObjectPointerArrayTrailer () |
Write trailer for an array of
pointers to PersistentObjects. |
|
virtual bool | checkObjectPointerArrayTrailer () |
Check for trailer for an array of
pointers to PersistentObjects. |
|
virtual void | initializeOutputStream () |
Prepare the stream for output.
|
|
virtual void | finalizeOutputStream () |
Prepare the stream for closing.
|
|
virtual void | initializeInputStream () |
Prepare the stream for output.
|
|
virtual void | finalizeInputStream () |
Prepare the stream for closing.
|
|
Put methods for primitive data types.
|
|
virtual void | put (const char c) |
Write a signed char to the output
stream. |
|
virtual void | put (const Byte b) |
Write a single byte the output
stream. |
|
virtual void | put (const Index i) |
Write an Index to the output
stream. |
|
virtual void | put (const Size s) |
Write a Size or a Position to the
output stream. |
|
virtual void | put (const bool b) |
Write a boolean value to the output
stream. |
|
virtual void | put (const Real f) |
Write a single precision floating
point number to the output stream. |
|
virtual void | put (const DoubleReal d) |
Write a double precision floating
point number to the output stream. |
|
virtual void | put (const string &s) |
Write a string to the
output. |
|
virtual void | put (const LongSize p) |
Write a pointer to the
output. |
|
Get methods for primitive data types.
|
|
virtual void | get (char &c) |
Read a signed char from the input
stream. |
|
virtual void | get (Byte &c) |
Read a single byte from the input
stream. |
|
virtual void | get (Index &s) |
Read an Index from the input
stream. |
|
virtual void | get (Size &s) |
Read a Size or a Position from the
input stream. |
|
virtual void | get (bool &b) |
Read a boolean value from the input
stream. |
|
virtual void | get (Real &f) |
Read a single precision floating
point number from the input stream. |
|
virtual void | get (DoubleReal &d) |
Read a double precision floating
point number from the input stream. |
|
virtual void | get (string &s) |
Read a string from the output
stream. |
|
virtual void | get (LongSize &p) |
Read a pointer from the input
stream. |
|
void | setHandleStreamsExternally (bool handle_externally) |
Accesssors. |
|
Static Public Attributes |
|
Constants
|
|
static const Size | STREAM_HEADER |
A constant value used to mark the
beginning of a persistent stream. |
|
static const Size | STREAM_TRAILER |
A constant value used to mark the
end of a persistent stream. |
|
static const Size | OBJECT_HEADER |
A constant value used to mark the
beginning of an object. |
|
static const Size | OBJECT_TRAILER |
A constant value used to mark the
end of an object. |
This class implements a persistence manager that reads and writes its objects in a portable binary format.
virtual bool BALL::XDRPersistenceManager::checkHeader | ( | const char * | type_name, | |
const char * | name, | |||
LongSize & | ptr | |||
) | [virtual] |
Check for an object header.
This method reads an int form the input stream (using
xdr_int
) and returns true if the value
read equals OBJECT_HEADER .
Implements BALL::PersistenceManager.
virtual bool BALL::XDRPersistenceManager::checkTrailer | ( | const char * | name =
0 |
) | [virtual] |
Check for an object trailer.
This method reads an int form the input stream (using
xdr_int
) and returns true if the value
read equals OBJECT_TRAILER .
Implements BALL::PersistenceManager.
virtual void BALL::XDRPersistenceManager::finalizeInputStream | ( | ) | [virtual] |
Prepare the stream for closing.
This method destroys the XDR output stream (using xdr_destroy).
Reimplemented from BALL::PersistenceManager.
virtual void BALL::XDRPersistenceManager::finalizeOutputStream | ( | ) | [virtual] |
Prepare the stream for closing.
This method destroys the XDR output stream (using xdr_destroy).
Reimplemented from BALL::PersistenceManager.
virtual void BALL::XDRPersistenceManager::initializeInputStream | ( | ) | [virtual] |
Prepare the stream for output.
This method creates an XDR output stream (using xdrrec_create) and prepares it for output.
Reimplemented from BALL::PersistenceManager.
virtual void BALL::XDRPersistenceManager::initializeOutputStream | ( | ) | [virtual] |
Prepare the stream for output.
This method creates an XDR output stream (using xdrrec_create) and prepares it for output.
Reimplemented from BALL::PersistenceManager.
void BALL::XDRPersistenceManager::setHandleStreamsExternally | ( | bool | handle_externally | ) |
Accesssors.
With this method, our caller can take responsibility for initializing and destroying the XDR streams.
virtual void BALL::XDRPersistenceManager::writeHeader | ( | const char * | type_name, | |
const char * | name, | |||
LongSize | ptr | |||
) | [virtual] |
Write an object header.
This method stores OBJECT_HEADER as an int value to mark the start of
an object (using xdr_int
).
Implements BALL::PersistenceManager.
virtual void BALL::XDRPersistenceManager::writeTrailer | ( | const char * | name =
0 |
) | [virtual] |
Write an object trailer.
This method stores OBJECT_TRAILER as an int value to mark the start of
an object (using xdr_int
).
Implements BALL::PersistenceManager.