Main MRPT website > C++ reference
MRPT logo
Classes | Namespaces | Defines | Variables

CSerializable.h File Reference

#include <mrpt/utils/CObject.h>
#include <mrpt/utils/CStream.h>
#include <mrpt/utils/safe_pointers.h>
#include <mrpt/utils/CObject.h>
#include <mrpt/utils/CStream.h>
Include dependency graph for CSerializable.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mrpt::utils::CSerializablePtr
class  mrpt::utils::CSerializable
 The virtual base class which provides a unified interface for all persistent objects in MRPT. More...
struct  mrpt::utils::TTypeName< T >
 A template to obtain the type of its argument as a string at compile time. More...
struct  mrpt::utils::TTypeName< std::pair< T1, T2 > >

Namespaces

namespace  mrpt
 

This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.


namespace  mrpt::utils
 

Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.


Defines

#define DEFINE_SERIALIZABLE(class_name)
 This declaration must be inserted in all CSerializable classes definition, within the class declaration.
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_LINKAGE(class_name, _LINKAGE_)
 This declaration must be inserted in all CSerializable classes definition, before the class declaration.
#define DEFINE_SERIALIZABLE_PRE(class_name)
 This declaration must be inserted in all CSerializable classes definition, before the class declaration.
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
 This declaration must be inserted in all CSerializable classes definition, before the class declaration.
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
 This declaration must be inserted in all CSerializable classes definition, before the class declaration.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
 This must be inserted in all CSerializable classes implementation files:
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)   DEFINE_VIRTUAL_MRPT_OBJECT(class_name)
 This declaration must be inserted in virtual CSerializable classes definition:
#define IMPLEMENTS_VIRTUAL_SERIALIZABLE(class_name, base_class_name, NameSpace)
 This must be inserted as implementation of some required members for virtual CSerializable classes:
Conversion of type to string at compile time

IMPORTANT: See also the implementation of Serialization for STL containers in mrpt/utils/stl_extensions.h

#define DECLARE_CUSTOM_TTYPENAME(_TYPE)   namespace mrpt { namespace utils { MRPT_DECLARE_TTYPENAME(_TYPE) } }
 Identical to MRPT_DECLARE_TTYPENAME but intended for user code.
#define MRPT_DECLARE_TTYPENAME(_TYPE)
#define MRPT_DECLARE_TTYPENAME_PTR(_TYPE)
#define MRPT_DECLARE_TTYPENAME_CONTAINER(_CONTAINER)
#define MRPT_DECLARE_TTYPENAME_MAP_FOR_VECTOR(_CONT)   template<> struct TTypeName <_CONT> : TTypeName<std::vector<_CONT::Scalar> > { };
#define MRPT_DECLARE_TTYPENAME_CONTAINER_ASSOC(_CONTAINER)

Functions

Non-streaming serialization functions
std::string BASE_IMPEXP mrpt::utils::ObjectToString (const CSerializable *o)
 Used to pass MRPT objects into a CORBA-like object (strings).
void BASE_IMPEXP mrpt::utils::StringToObject (const std::string &str, CSerializablePtr &obj)
 Used to pass CORBA-like objects (strings) into a MRPT object.
void BASE_IMPEXP mrpt::utils::ObjectToOctetVector (const CSerializable *o, vector_byte &out_vector)
 Converts (serializes) an MRPT object into an array of bytes.
void BASE_IMPEXP mrpt::utils::OctetVectorToObject (const vector_byte &in_data, CSerializablePtr &obj)
 Converts back (de-serializes) a sequence of binary data into a MRPT object, without prior information about the object's class.
void BASE_IMPEXP mrpt::utils::ObjectToRawString (const CSerializable *o, std::string &out_str)
 Converts (serializes) an MRPT object into an array of bytes within a std::string, without codifying to avoid NULL characters.
void BASE_IMPEXP mrpt::utils::RawStringToObject (const std::string &in_str, CSerializablePtr &obj)
 Converts back (de-serializes) a sequence of binary data within a std::string into a MRPT object, without prior information about the object's class.

Variables

class BASE_IMPEXP mrpt::utils::CSerializable

Define Documentation

#define DECLARE_CUSTOM_TTYPENAME (   _TYPE)    namespace mrpt { namespace utils { MRPT_DECLARE_TTYPENAME(_TYPE) } }

Identical to MRPT_DECLARE_TTYPENAME but intended for user code.

MUST be placed at the GLOBAL namespace.

Definition at line 174 of file CSerializable.h.

#define DEFINE_SERIALIZABLE (   class_name)
Value:
DEFINE_MRPT_OBJECT(class_name) \
                protected: \
                        /*! @name CSerializable virtual methods */ \
                        /*! @{ */ \
                        void  writeToStream(mrpt::utils::CStream &out, int *getVersion) const;\
                        void  readFromStream(mrpt::utils::CStream &in, int version); \

This declaration must be inserted in all CSerializable classes definition, within the class declaration.

Definition at line 257 of file CSerializable.h.

#define DEFINE_SERIALIZABLE_PRE (   class_name)
Value:

This declaration must be inserted in all CSerializable classes definition, before the class declaration.

Definition at line 275 of file CSerializable.h.

#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE (   class_name,
  base_name 
)
Value:

This declaration must be inserted in all CSerializable classes definition, before the class declaration.

Definition at line 288 of file CSerializable.h.

#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE (   class_name,
  base_name,
  _LINKAGE_ 
)
Value:
DEFINE_MRPT_OBJECT_PRE_CUSTOM_BASE_LINKAGE2(class_name, base_name, _LINKAGE_ class_name) \
                        _LINKAGE_ ::mrpt::utils::CStream& operator>>(mrpt::utils::CStream& in, class_name##Ptr &pObj);

This declaration must be inserted in all CSerializable classes definition, before the class declaration.

Definition at line 281 of file CSerializable.h.

#define DEFINE_SERIALIZABLE_PRE_CUSTOM_LINKAGE (   class_name,
  _LINKAGE_ 
)
Value:

This declaration must be inserted in all CSerializable classes definition, before the class declaration.

Definition at line 268 of file CSerializable.h.

#define DEFINE_VIRTUAL_SERIALIZABLE (   class_name)    DEFINE_VIRTUAL_MRPT_OBJECT(class_name)

This declaration must be inserted in virtual CSerializable classes definition:

Definition at line 301 of file CSerializable.h.

#define IMPLEMENTS_SERIALIZABLE (   class_name,
  base,
  NameSpace 
)
Value:
IMPLEMENTS_MRPT_OBJECT(class_name, base,NameSpace) \
                        mrpt::utils::CStream& NameSpace::operator>>(mrpt::utils::CStream& in, NameSpace::class_name##Ptr &pObj) \
                        { pObj = NameSpace::class_name##Ptr( in.ReadObject() ); return in; }

This must be inserted in all CSerializable classes implementation files:

Definition at line 294 of file CSerializable.h.

#define IMPLEMENTS_VIRTUAL_SERIALIZABLE (   class_name,
  base_class_name,
  NameSpace 
)
Value:
IMPLEMENTS_VIRTUAL_MRPT_OBJECT(class_name, base_class_name,NameSpace) \
                        mrpt::utils::CStream& NameSpace::operator>>(mrpt::utils::CStream& in, class_name##Ptr &pObj) \
                        { pObj = class_name##Ptr( in.ReadObject() ); return in; }

This must be inserted as implementation of some required members for virtual CSerializable classes:

Definition at line 307 of file CSerializable.h.

#define MRPT_DECLARE_TTYPENAME (   _TYPE)
Value:
template<> struct TTypeName <_TYPE > { \
                                static std::string get() { return std::string(#_TYPE); } };

Definition at line 177 of file CSerializable.h.

#define MRPT_DECLARE_TTYPENAME_CONTAINER (   _CONTAINER)
Value:
template< typename V > \
                        struct TTypeName <_CONTAINER<V> > { \
                                static std::string get() { \
                                        return std::string( #_CONTAINER )+std::string("<")+std::string( TTypeName<V>::get() ) + std::string(">"); \
                                } \
                        };

Definition at line 200 of file CSerializable.h.

#define MRPT_DECLARE_TTYPENAME_CONTAINER_ASSOC (   _CONTAINER)
Value:
template< typename K, typename V > \
                        struct TTypeName <_CONTAINER<K,V> > { \
                                static std::string get() { \
                                        return std::string( #_CONTAINER )+std::string("<")+std::string( TTypeName<K>::get() )+ std::string(",")+std::string( TTypeName<V>::get() )+std::string(">"); \
                                } \
                        };

Definition at line 233 of file CSerializable.h.

#define MRPT_DECLARE_TTYPENAME_MAP_FOR_VECTOR (   _CONT)    template<> struct TTypeName <_CONT> : TTypeName<std::vector<_CONT::Scalar> > { };

Definition at line 214 of file CSerializable.h.

#define MRPT_DECLARE_TTYPENAME_PTR (   _TYPE)
Value:
template<> struct TTypeName <_TYPE##Ptr> { \
                        static std::string get() { return TTypeName<_TYPE>::get(); }    };

Definition at line 181 of file CSerializable.h.




Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011