REC RPC library
Classes | Namespaces | Macros
rec_rpc_serialization_Complex.h File Reference
#include "rec/rpc/serialization/rec_rpc_serialization_Serializable.h"
#include "rec/rpc/defines.h"
#include <QDataStream>
#include <QList>
Include dependency graph for rec_rpc_serialization_Complex.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  rec::rpc::serialization::Complex
 Base class for complex serializable data containers. More...
 

Namespaces

 rec
 
 rec::rpc
 
 rec::rpc::serialization
 

Macros

#define BEGIN_COMPLEX_DATA_DECLARATION(TYPENAME)
 Begin declaration of a custom complex data type. More...
 
#define END_COMPLEX_DATA_DECLARATION   };
 End declaration of a custom complex data type. More...
 
#define BEGIN_COMPLEX_DATA_IMPLEMENTATION(TYPENAME, VERSION)
 Begin implementation of a custom complex data type's constructor. More...
 
#define END_COMPLEX_DATA_IMPLEMENTATION   }
 End implementation of a custom complex data type's constructor. More...
 
#define BEGIN_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION(TYPENAME, VERSION)
 Begin declaration and implementation of a custom complex data parameter type. More...
 
#define END_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION_CONSTRUCTOR   }
 End constructor and begin member declaration of a custom complex data type. More...
 
#define END_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION   };
 End implementation and declaration of a custom complex data type. More...
 
#define USE_COMPLEX_DATA(EXISTINGTYPENAME, NEWTYPENAME)
 Reuse an existing data type definition. More...
 
#define USE_COMPLEX_DATA_AS_PARAM(TYPENAME, FUNCTIONNAME)   USE_COMPLEX_DATA( TYPENAME, FUNCTIONNAME##Param )
 Use an existing complex type definition for a function which uses this type as parameter type. More...
 
#define USE_COMPLEX_DATA_AS_RESULT(TYPENAME, FUNCTIONNAME)   USE_COMPLEX_DATA( TYPENAME, FUNCTIONNAME##Result )
 Use an existing complex type definition for a function which uses the type as result type. More...
 
#define USE_COMPLEX_DATA_AS_TOPICDATA(TYPENAME, TOPICNAME)   USE_COMPLEX_DATA( TYPENAME, topic##TOPICNAME##Data )
 Use an existing complex data type definition for a topic which uses this data type. More...
 
#define DECLARE_CUSTOM_MEMBER(DATATYPE, NAME)
 Complex data container member definition for any rec::rpc::serialization::Serializable subclass. More...
 
#define ADD_MEMBER(NAME)
 

Macro Definition Documentation

#define ADD_MEMBER (   NAME)
Value:
create_##NAME(); \
addChild( _##NAME.data() );

Add serializable to the list of children. This must be done in the constructor.

Parameters
NAMEName of the child.
See also
rec::rpc::serialization::Complex::addChild()

Definition at line 252 of file rec_rpc_serialization_Complex.h.

#define BEGIN_COMPLEX_DATA_DECLARATION (   TYPENAME)
Value:
class TYPENAME; \
typedef QSharedPointer< TYPENAME > TYPENAME##Ptr; \
typedef QSharedPointer< const TYPENAME > TYPENAME##PtrConst; \
class TYPENAME : public rec::rpc::serialization::Complex \
{ \
public: \
TYPENAME();
Base class for complex serializable data containers.

Begin declaration of a custom complex data type.

This macro inserts the code necessary to declare a rec::rpc::serialization::Complex subclass into a header file. Below this macro, use the appropriate preprocessor macros to declare children.

Parameters
TYPENAMEName of the subclass.
See also
END_COMPLEX_DATA_DECLARATION, BEGIN_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION
DECLARE_CUSTOM_MEMBER, DECLARE_PRIMITIVE_MEMBER, DECLARE_STRING_MEMBER, DECLARE_BYTEARRAY_MEMBER, DECLARE_IMAGE_MEMBER
DECLARE_Position_MEMBER, DECLARE_Orientation_MEMBER, DECLARE_POSE_MEMBER, DECLARE_POSEARRAY_MEMBER, DECLARE_POSE2D_MEMBER, DECLARE_POSE2DARRAY_MEMBER
USE_COMPLEX_DATA_AS_PARAM, USE_COMPLEX_DATA_AS_RESULT, USE_COMPLEX_DATA_AS_TOPICDATA

Definition at line 99 of file rec_rpc_serialization_Complex.h.

#define BEGIN_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION (   TYPENAME,
  VERSION 
)
Value:
class TYPENAME; \
typedef QSharedPointer< TYPENAME > TYPENAME##Ptr; \
typedef QSharedPointer< const TYPENAME > TYPENAME##PtrConst; \
class TYPENAME : public rec::rpc::serialization::Complex \
{ \
public: \
TYPENAME() \
: rec::rpc::serialization::Complex( #TYPENAME "_" #VERSION ) \
{
Base class for complex serializable data containers.

Begin declaration and implementation of a custom complex data parameter type.

This macro inserts the code necessary to declare a rec::rpc::serialization::Complex subclass with its constructor into a header file. Use this macro if you want the serializazable declarations only in header files. Below this macro, the preprocessor macro ADD_MEMBER must be used to insert the members to the list of children to be serialized. Then END_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION_CONSTRUCTOR must be inserted to begin the declaration of the children.

Parameters
TYPENAMEName of the subclass.
VERSIONVersion string. If data that has been serialized with a type version different from this, it can't be deserialized with this version.
See also
END_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION, END_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION_CONSTRUCTOR
DECLARE_CUSTOM_MEMBER, DECLARE_PRIMITIVE_MEMBER, DECLARE_STRING_MEMBER, DECLARE_BYTEARRAY_MEMBER, DECLARE_IMAGE_MEMBER
DECLARE_Position_MEMBER, DECLARE_Orientation_MEMBER, DECLARE_POSE_MEMBER, DECLARE_POSEARRAY_MEMBER, DECLARE_POSE2D_MEMBER, DECLARE_POSE2DARRAY_MEMBER
USE_COMPLEX_DATA_AS_PARAM, USE_COMPLEX_DATA_AS_RESULT, USE_COMPLEX_DATA_AS_TOPICDATA

Definition at line 154 of file rec_rpc_serialization_Complex.h.

#define BEGIN_COMPLEX_DATA_IMPLEMENTATION (   TYPENAME,
  VERSION 
)
Value:
TYPENAME::TYPENAME() \
: rec::rpc::serialization::Complex( #TYPENAME "_" #VERSION ) \
{
Base class for complex serializable data containers.

Begin implementation of a custom complex data type's constructor.

This macro inserts the code necessary to implement the constructor of a custom complex data type into a source file. Below this macro, the preprocessor macro ADD_MEMBER must be used to insert the members to the list of children to be serialized.

Parameters
TYPENAMEName of the data type.
VERSIONVersion string. If data that has been serialized with a type version different from this, it can't be deserialized with this version.
See also
END_COMPLEX_DATA_IMPLEMENTATION, BEGIN_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION, ADD_MEMBER

Definition at line 126 of file rec_rpc_serialization_Complex.h.

#define DECLARE_CUSTOM_MEMBER (   DATATYPE,
  NAME 
)
Value:
private: \
QSharedPointer< DATATYPE > _##NAME; \
void create_##NAME() { _##NAME = QSharedPointer< DATATYPE >( new DATATYPE ); } \
public: \
DATATYPE& NAME() { return *_##NAME; } \
const DATATYPE& NAME() const { return *_##NAME; } \
void set##NAME( const DATATYPE& pos ) { *_##NAME = pos; }

Complex data container member definition for any rec::rpc::serialization::Serializable subclass.

Place this macro into the declaration of a rec::rpc::serialization::Complex subclass to add a custom member. It can be accessed via NAME() (const and non-const).

Parameters
DATATYPEType name of the rec::rpc::serialization::Serializable subclass.
NAMEMember name.
See also
rec::rpc::serialization::Complex

Definition at line 236 of file rec_rpc_serialization_Complex.h.

#define END_COMPLEX_DATA_DECLARATION   };

End declaration of a custom complex data type.

See also
BEGIN_COMPLEX_DATA_DECLARATION

Definition at line 113 of file rec_rpc_serialization_Complex.h.

#define END_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION   };

End implementation and declaration of a custom complex data type.

See also
BEGIN_COMPLEX_DATA_IMPLEMENTATION_AND_DECLARATION

Definition at line 180 of file rec_rpc_serialization_Complex.h.

#define END_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION_CONSTRUCTOR   }

End constructor and begin member declaration of a custom complex data type.

This macro closes the constructor and allows you to declare the children. To declare the children, use the appropriate preprocessor macros. Finally insert END_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION.

See also
BEGIN_COMPLEX_DATA_DECLARATION, BEGIN_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION, END_COMPLEX_DATA_DECLARATION_AND_IMPLEMENTATION_CONSTRUCTOR

Definition at line 173 of file rec_rpc_serialization_Complex.h.

#define END_COMPLEX_DATA_IMPLEMENTATION   }

End implementation of a custom complex data type's constructor.

See also
BEGIN_COMPLEX_DATA_IMPLEMENTATION

Definition at line 136 of file rec_rpc_serialization_Complex.h.

#define USE_COMPLEX_DATA (   EXISTINGTYPENAME,
  NEWTYPENAME 
)
Value:
typedef EXISTINGTYPENAME NEWTYPENAME; \
typedef QSharedPointer< NEWTYPENAME > NEWTYPENAME##Ptr; \
typedef QSharedPointer< const NEWTYPENAME > NEWTYPENAME##PtrConst;

Reuse an existing data type definition.

Parameters
EXISTINGTYPENAMEData type that shall be reused.
NEWTYPENAMENew data type name.
See also
BEGIN_COMPLEX_DATA_DECLARATION, END_COMPLEX_DATA_DECLARATION

Definition at line 190 of file rec_rpc_serialization_Complex.h.

#define USE_COMPLEX_DATA_AS_PARAM (   TYPENAME,
  FUNCTIONNAME 
)    USE_COMPLEX_DATA( TYPENAME, FUNCTIONNAME##Param )

Use an existing complex type definition for a function which uses this type as parameter type.

Parameters
TYPENAMEName of the data type that shall be used.
FUNCTIONNAMEName of the function which uses the type as parameter type.
See also
BEGIN_COMPLEX_DATA_DECLARATION, END_COMPLEX_DATA_DECLARATION, USE_COMPLEX_DATA

Definition at line 203 of file rec_rpc_serialization_Complex.h.

#define USE_COMPLEX_DATA_AS_RESULT (   TYPENAME,
  FUNCTIONNAME 
)    USE_COMPLEX_DATA( TYPENAME, FUNCTIONNAME##Result )

Use an existing complex type definition for a function which uses the type as result type.

Parameters
TYPENAMEName of the data type that shall be used.
FUNCTIONNAMEName of the function which uses the type as parameter type.
See also
BEGIN_COMPLEX_DATA_DECLARATION, END_COMPLEX_DATA_DECLARATION, USE_COMPLEX_DATA

Definition at line 213 of file rec_rpc_serialization_Complex.h.

#define USE_COMPLEX_DATA_AS_TOPICDATA (   TYPENAME,
  TOPICNAME 
)    USE_COMPLEX_DATA( TYPENAME, topic##TOPICNAME##Data )

Use an existing complex data type definition for a topic which uses this data type.

Parameters
TYPENAMEName of the data type that shall be used.
TOPICNAMEName of the topic which uses the type.
See also
BEGIN_COMPLEX_DATA_DECLARATION, END_COMPLEX_DATA_DECLARATION, USE_COMPLEX_DATA

Definition at line 223 of file rec_rpc_serialization_Complex.h.