MRPT  1.9.9
CSerializable.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://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:4070
unsigned char uint8_t
Definition: rptypes.h:41
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:555
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020