MRPT  1.9.9
CSerializable.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "serialization-precomp.h" // Precompiled headers
11 
14 #include <cstdio>
15 
16 using namespace mrpt;
17 using namespace mrpt::serialization;
18 
20 
21 void mrpt::serialization::ObjectToOctetVector(
22  const CSerializable* o, std::vector<uint8_t>& out_vector)
23 {
24  out_vector.clear();
25  auto arch = archiveFrom(out_vector);
26  arch << *o;
27 }
28 
30  const std::vector<uint8_t>& in_data, CSerializable::Ptr& obj)
31 {
32  obj.reset();
33 
34  if (in_data.empty()) return;
35  auto arch = archiveFrom(in_data);
36  obj = arch.ReadObject();
37 }
void ObjectToOctetVector(const CSerializable *o, std::vector< uint8_t > &out_vector)
Converts (serializes) an MRPT object into an array of bytes.
STL namespace.
GLsizei GLsizei GLuint * obj
Definition: glext.h:4085
CArchiveStreamBase< STREAM > archiveFrom(STREAM &s)
Helper function to create a templatized wrapper CArchive object for a: MRPT&#39;s CStream, std::istream, std::ostream, std::stringstream.
Definition: CArchive.h:591
IMPLEMENTS_VIRTUAL_MRPT_OBJECT(CMultiObjectiveMotionOptimizerBase, CObject, mrpt::nav) CMultiObjectiveMotionOptimizerBase
void 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...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:30
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 0cbd40372 Sun Nov 17 09:43:05 2019 +0100 at dom nov 17 09:45:09 CET 2019