33 #include <boost/shared_ptr.hpp> 35 #include <rsc/runtime/Printable.h> 36 #include <rsc/runtime/TypeStringTools.h> 40 #include "rsb/rsbexports.h" 45 #define RSB_TYPE_TAG(T) (reinterpret_cast<T*> (0)) 52 template<
class WireType>
79 const WireType& wire) = 0;
101 typedef boost::shared_ptr<Converter<WireType> >
Ptr;
114 dataType(dataType), wireSchema(wireSchema) {
128 template<
typename DataType>
129 Converter(
const std::string& wireSchema,
const DataType* = 0) :
130 dataType(rsc::runtime::typeName<DataType>()), wireSchema(wireSchema) {
139 return rsc::runtime::typeName(*
this);
143 stream <<
"wireType = " << rsc::runtime::typeName<WireType>()
void printContents(std::ostream &stream) const
std::pair< std::string, boost::shared_ptr< void > > AnnotatedData
A combination of data type and the actual data.
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 p...
std::string getClassName() const
virtual std::string getWireSchema() const
Returns the name of the wire schema this converter can (de)serialize from/to.
virtual AnnotatedData deserialize(const std::string &wireSchema, const WireType &wire)=0
Deserializes a domain object from a wire type.
boost::shared_ptr< Converter< WireType > > Ptr
virtual std::string serialize(const AnnotatedData &data, WireType &wire)=0
Serialized the given domain object to the wire.
virtual std::string getDataType() const
Returns the name of the data type this converter is applicable for.
Converter(const std::string &dataType, const std::string &wireSchema, bool dummy=true)
Creates a new instance of this class with automatic handling for types.