cisst-saw
|
De-serialization utility class.This class allows to deserialize objects previously serialized using cmnSerializer. More...
#include <cmnDeSerializer.h>
Public Types | |
typedef long long int | TypeId |
Public Member Functions | |
cmnDeSerializer (std::istream &inputStream) | |
~cmnDeSerializer () | |
void | Reset (void) |
cmnGenericObject * | DeSerialize (const bool serializeObject=true) |
template<class _elementType > | |
void | DeSerialize (_elementType &object, const bool serializeObject=true) |
![]() | |
virtual | ~cmnGenericObject (void) |
virtual const cmnClassServicesBase * | Services (void) const =0 |
bool | ReconstructFrom (const cmnGenericObject &other) |
std::string | ToString (void) const |
virtual void | ToStream (std::ostream &outputStream) const |
virtual void | ToStreamRaw (std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const |
virtual bool | FromStreamRaw (std::istream &inputStream, const char delimiter= ' ') |
virtual void | SerializeRaw (std::ostream &outputStream) const |
virtual void | DeSerializeRaw (std::istream &inputStream) |
virtual cmnLogger::StreamBufType * | GetLogMultiplexer (void) const |
virtual size_t | ScalarNumber (void) const |
virtual bool | ScalarNumberIsFixed (void) const |
virtual double | Scalar (const size_t CMN_UNUSED(index)) const throw (std::out_of_range) |
virtual std::string | ScalarDescription (const size_t CMN_UNUSED(index), const std::string &CMN_UNUSED(userDescription)) const |
De-serialization utility class.
This class allows to deserialize objects previously serialized using cmnSerializer.
As each object serialized is identified by a unique class identifer defined at runtime (address of the object cmnClassServices), this class maintains a table of equivalence between the remote class identifiers and local class identifiers. This class can be used to read both the class information and objects in any order as long as the class information for a specific object has been received before the object itself.
typedef long long int cmnDeSerializer::TypeId |
Type used to identify objects over the network. It uses the services pointer but as the sender or receiver could be a 32 or 64 bits OS, we use a data type that can handle both.
cmnDeSerializer::cmnDeSerializer | ( | std::istream & | inputStream | ) |
Constructor.
inputStream | any stream derived from std::istream . The output stream must be created with the open flag std::istream::binary . |
cmnDeSerializer::~cmnDeSerializer | ( | ) |
Destructor
cmnGenericObject* cmnDeSerializer::DeSerialize | ( | const bool | serializeObject = true | ) |
De-serialize an object from the input stream. This method will create an object dynamically therefore the class of the object serialized must have been registered using the flag CMN_DYNAMIC_CREATION (see cmnClassServices and cmnClassRegister). This also requires to provide a default constructor for the given class.
This method will deserialize one object only. If the stream contains some class identifiers (pair of class name, remote class identifer) it will read them all until an object is found.
serializeObject | If true, object content is serialized. If false, only class services is serialized and object content is not serialized. True by default. |
|
inline |
De-serialize an object from the input stream. This method will replace the object content by the data read from the input stream. There is no dynamic creation involved.
This method will deserialize one object only. If the stream contains some class identifiers (pair of class name, remote class identifer) it will read them all until an object is found.
void cmnDeSerializer::Reset | ( | void | ) |
Reset the list of types already received.