ERC CISST - cisst software

cmnDeSerializer Class Reference
[Common Tools]

#include <cmnDeSerializer.h>

Inheritance diagram for cmnDeSerializer:

Inheritance graph
[legend]
Collaboration diagram for cmnDeSerializer:

Collaboration graph
[legend]
List of all members.

Detailed Description

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.

See also:
cmnSerializer cmnGenericObject

Definition at line 125 of file cmnDeSerializer.h.

Public Types

Public Member Functions


Member Typedef Documentation

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.

Definition at line 132 of file cmnDeSerializer.h.


Constructor & Destructor Documentation

cmnDeSerializer::cmnDeSerializer ( std::istream &  inputStream  ) 

Constructor.

Parameters:
inputStream any stream derived from std::istream. The output stream must be created with the open flag std::istream::binary.


Member Function Documentation

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.

Parameters:
serializeObject If true, object content is serialized. If false, only class services is serialized and object content is not serialized. True by default.
Note:
As this method relies on cmnDeSerializeRaw, it might throw an exception.

Referenced by mtsProxySerializer::DeSerialize().

template<class _elementType>
void cmnDeSerializer::DeSerialize ( _elementType &  object,
const bool  serializeObject = true 
) [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.

Note:
As this method relies on cmnDeSerializeRaw, it might throw an exception.

Definition at line 176 of file cmnDeSerializer.h.

References CMN_LOG_CLASS_RUN_ERROR, and cmnDeSerializeRaw().


The documentation for this class was generated from the following file:
erc-cisst-devel<at>lists.johnshopkins.edu