20 namespace serialization
22 template <
class Derived>
32 template <
class Derived>
37 Derived&
derived() {
return static_cast<Derived&
>(*this); }
40 return static_cast<const Derived&
>(*this);
44 template <
class Derived>
49 template <
class Derived>
52 out << static_cast<uint64_t>(derived().getTotalBytesCount());
53 if (derived().getTotalBytesCount())
55 ASSERT_(derived().getRawBufferData());
57 derived().getRawBufferData(), derived().getTotalBytesCount());
60 template <
class Derived>
69 derived().changeSize(N);
71 if (N)
in.ReadBuffer(derived().getRawBufferData(), N);
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
void WriteBuffer(const void *Buffer, size_t Count)
Writes a block of bytes to the stream from Buffer.
mrpt::io::CMemoryStream CMemoryStream
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
A memory buffer (implements CStream) which can be itself serialized.
#define ASSERT_(f)
Defines an assertion mechanism.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
unsigned __int64 uint64_t
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Virtual base class for "archives": classes abstracting I/O streams.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
const Derived & derived() const
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.