RSB  0.7.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rsb::converter::Converter< WireType > Class Template Reference

#include <Converter.h>

Inheritance diagram for rsb::converter::Converter< WireType >:
Inheritance graph
Collaboration diagram for rsb::converter::Converter< WireType >:
Collaboration graph

Public Types

typedef boost::shared_ptr
< Converter< WireType > > 
Ptr

Public Member Functions

virtual ~Converter ()
virtual std::string serialize (const AnnotatedData &data, WireType &wire)=0
 Serialized the given domain object to the wire.
virtual AnnotatedData deserialize (const std::string &wireSchema, const WireType &wire)=0
 Deserializes a domain object from a wire type.
virtual std::string getDataType () const
 Returns the name of the data type this converter is applicable for.
virtual std::string getWireSchema () const
 Returns the name of the wire schema this converter can (de)serialize from/to.

Protected Member Functions

 Converter (const std::string &dataType, const std::string &wireSchema, bool dummy=true)
 Creates a new instance of this class with automatic handling for types.
template<typename DataType >
 Converter (const std::string &wireSchema, const DataType *=0)
 Creates a new instance of this class with a data type string that is inferred based on the template parameter DataType.

Private Member Functions

std::string getClassName () const
void printContents (std::ostream &stream) const

Private Attributes

std::string dataType
std::string wireSchema

Detailed Description

template<class WireType>
class rsb::converter::Converter< WireType >

Author
swrede
jwienke
Template Parameters
WireTypeis the serialization format, uchar, string, binary, ...

Definition at line 53 of file Converter.h.

Member Typedef Documentation

template<class WireType>
typedef boost::shared_ptr<Converter<WireType> > rsb::converter::Converter< WireType >::Ptr

Definition at line 101 of file Converter.h.

Constructor & Destructor Documentation

template<class WireType>
virtual rsb::converter::Converter< WireType >::~Converter ( )
inlinevirtual

Definition at line 56 of file Converter.h.

template<class WireType>
rsb::converter::Converter< WireType >::Converter ( const std::string &  dataType,
const std::string &  wireSchema,
bool  dummy = true 
)
inlineprotected

Creates a new instance of this class with automatic handling for types.

Parameters
dataTypedata type this converter can serialize
wireSchemawire schema this converter can deserialize
dummyThis parameter is used to disambiguate constructor signatures when WireType is std::string .

Definition at line 113 of file Converter.h.

template<class WireType>
template<typename DataType >
rsb::converter::Converter< WireType >::Converter ( const std::string &  wireSchema,
const DataType *  = 0 
)
inlineprotected

Creates a new instance of this class with a data type string that is inferred based on the template parameter DataType.

Template Parameters
DataTypetype of the objects that the converter (de)serializes. Use the RSB_TYPE_TAG macro with this.
Parameters
wireSchemawire schema from/to this converter can (de)serialize.

Definition at line 129 of file Converter.h.

Member Function Documentation

template<class WireType>
virtual AnnotatedData rsb::converter::Converter< WireType >::deserialize ( const std::string &  wireSchema,
const WireType &  wire 
)
pure virtual

Deserializes a domain object from a wire type.

Parameters
wireSchematype of the wire message
wirethe wire containing the data
Returns
the deserialized domain object annotated with its data type name
Exceptions
SerializationExceptionif deserializing the message fails

Implemented in rsb::converter::EventsByScopeMapConverter, rsb::converter::ProtocolBufferConverter< ProtocolBuffer >, rsb::converter::EventIdConverter, rsb::converter::RosettaConverter< Mechanism, Type >, rsb::converter::ByteArrayConverter, rsb::converter::BoolConverter, rsb::converter::SchemaAndByteArrayConverter, rsb::converter::StringConverter, rsb::converter::Uint32Converter, rsb::converter::Uint64Converter, and rsb::converter::VoidConverter.

Referenced by rsb::converter::EventIdConverter::deserialize().

Here is the caller graph for this function:

template<class WireType>
std::string rsb::converter::Converter< WireType >::getClassName ( ) const
inlineprivate
template<class WireType>
virtual std::string rsb::converter::Converter< WireType >::getDataType ( ) const
inlinevirtual

Returns the name of the data type this converter is applicable for.

Returns
name of the data type this converter can be used for

Definition at line 86 of file Converter.h.

template<class WireType>
virtual std::string rsb::converter::Converter< WireType >::getWireSchema ( ) const
inlinevirtual

Returns the name of the wire schema this converter can (de)serialize from/to.

Returns
name of the wire schema from/to this converter can (de)serialize

Reimplemented in rsb::converter::EventsByScopeMapConverter, and rsb::converter::EventIdConverter.

Definition at line 97 of file Converter.h.

Referenced by rsb::converter::EventIdConverter::getWireSchema(), and rsb::converter::EventsByScopeMapConverter::getWireSchema().

Here is the caller graph for this function:

template<class WireType>
void rsb::converter::Converter< WireType >::printContents ( std::ostream &  stream) const
inlineprivate

Definition at line 142 of file Converter.h.

template<class WireType>
virtual std::string rsb::converter::Converter< WireType >::serialize ( const AnnotatedData data,
WireType &  wire 
)
pure virtual

Member Data Documentation

template<class WireType>
std::string rsb::converter::Converter< WireType >::dataType
private
template<class WireType>
std::string rsb::converter::Converter< WireType >::wireSchema
private

The documentation for this class was generated from the following file: