Non-CStream serialization functions (in

#include <mrpt/serializatin/CSerializable.h>)

// global functions

void mrpt::serialization::ObjectToOctetVector(const CSerializable* o, std::vector<uint8_t>& out_vector);
void mrpt::serialization::OctetVectorToObject(const std::vector<uint8_t>& in_data, CSerializable::Ptr& obj);

Global Functions

void mrpt::serialization::ObjectToOctetVector(
    const CSerializable* o,
    std::vector<uint8_t>& out_vector
    )

Converts (serializes) an MRPT object into an array of bytes.

Parameters:

o

The object to be serialized.

out_vector

The vector which at return will contain the data. Size will be set automatically.

See also:

OctetVectorToObject, ObjectToString

void mrpt::serialization::OctetVectorToObject(
    const std::vector<uint8_t>& in_data,
    CSerializable::Ptr& obj
    )

Converts back (de-serializes) a sequence of binary data into a MRPT object, without prior information about the object’s class.

Parameters:

in_data

The serialized input data representing the object.

obj

The newly created object will be stored in this smart pointer.

None

On any internal exception, this function returns a nullptr pointer.

See also:

ObjectToOctetVector, StringToObject