9 #ifndef _SERIALIZABLE_HPP_
10 #define _SERIALIZABLE_HPP_
20 class SerializerBackend;
73 uint16_t version(in.
retrieve<uint16_t>());
77 ss <<
"Version mismatch in '" <<
typeid(*this).name();
78 ss <<
"': '" << version <<
"' != '" <<
_version <<
"'";
79 throw std::runtime_error(ss.str());
virtual void writeVersion(SerializerBackend &out) const
write the version to the stream
virtual bool deserialize(SerializerBackend &)=0
pure virtual function that needs to be defined by the derived class.
file contains classes for serializing objects
uint16_t _version
the version for de/serializing
Serializable(uint16_t version)
constructor initializing the version
virtual void serialize(SerializerBackend &) const =0
pure virtual function that needs to be defined by the derived class.
uint16_t ver() const
retrieve the version of the serializer
virtual void checkVersion(SerializerBackend &in) const
check the version
virtual ~Serializable()
virtual destructor to avoid warning with gcc 4.1.2
Type retrieve()
read arbitrary value from stream
void add(const Type &value)
add arbitrary value to the stream