42 for (
size_t i = 0; i <
n; i++)
44 unsigned char c =
data[i];
55 unsigned char dumm[2];
76 catch (std::bad_alloc&)
80 catch (std::exception& e)
82 fprintf(stderr,
"[ObjectToString] Exception: %s\n", e.what());
87 fprintf(stderr,
"[ObjectToString] Unknown exception\n");
100 if (str.empty())
return;
113 const char*
data = str.c_str();
115 for (i = 0; i <
n && (
c =
data[i]) != 0; i++)
163 out_vector.resize(N);
169 catch (std::bad_alloc&)
173 catch (std::exception& e)
175 fprintf(stderr,
"[ObjectToOctetVector] Exception: %s\n", e.what());
179 fprintf(stderr,
"[ObjectToOctetVector] Unknown exception\n");
193 if (in_data.empty())
return;
199 catch (std::bad_alloc&)
203 catch (std::exception& e)
205 fprintf(stderr,
"[OctetVectorToObject] Exception: %s\n", e.what());
209 fprintf(stderr,
"[OctetVectorToObject] Unknown exception\n");
224 out_vector.resize(N);
230 catch (std::bad_alloc&)
234 catch (std::exception& e)
236 fprintf(stderr,
"[ObjectToRawString] Exception: %s\n", e.what());
240 fprintf(stderr,
"[ObjectToRawString] Unknown exception\n");
254 if (in_data.empty())
return;
260 catch (std::bad_alloc&)
264 catch (std::exception& e)
266 fprintf(stderr,
"[RawStringToObject] Exception: %s\n", e.what());
270 fprintf(stderr,
"[RawStringToObject] Unknown exception\n");
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
std::vector< uint8_t > vector_byte
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
The virtual base class which provides a unified interface for all persistent objects in MRPT...
void StringToObject(const std::string &str, CSerializable::Ptr &obj)
Used to pass CORBA-like objects (strings) into a MRPT object.
uint64_t Seek(uint64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning) override
Introduces a pure virtual method for moving to a specified position in the streamed resource...
void WriteBuffer(const void *Buffer, size_t Count)
Writes a block of bytes to the stream from Buffer.
GLsizei GLsizei GLuint * obj
void OctetVectorToObject(const vector_byte &in_data, CSerializable::Ptr &obj)
Converts back (de-serializes) a sequence of binary data into a MRPT object, without prior information...
CSerializable::Ptr ReadObject()
Reads an object from stream, its class determined at runtime, and returns a smart pointer to the obje...
IMPLEMENTS_VIRTUAL_MRPT_OBJECT(CMultiObjectiveMotionOptimizerBase, CObject, mrpt::nav) CMultiObjectiveMotionOptimizerBase
void ObjectToOctetVector(const CSerializable *o, vector_byte &out_vector)
Converts (serializes) an MRPT object into an array of bytes.
This CStream derived class allow using a memory buffer as a CStream.
void WriteObject(const CSerializable *o)
Writes an object to the stream.
GLsizei const GLchar ** string
std::shared_ptr< CSerializable > Ptr
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf.
void * getRawBufferData()
Method for getting a pointer to the raw stored data.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void assignMemoryNotOwn(const void *data, const uint64_t nBytesInData)
Initilize the data in the stream from a block of memory which is NEITHER OWNED NOR COPIED by the obje...
void RawStringToObject(const std::string &in_str, CSerializable::Ptr &obj)
Converts back (de-serializes) a sequence of binary data within a std::string into a MRPT object...
void ObjectToRawString(const CSerializable *o, std::string &out_str)
Converts (serializes) an MRPT object into an array of bytes within a std::string, without codifying t...
std::string ObjectToString(const CSerializable *o)
Used to pass MRPT objects into a CORBA-like object (strings).
The virtual base class of all MRPT classes with a unified RTTI system.
uint64_t getTotalBytesCount() override
Returns the total size of the internal buffer.
GLsizei GLsizei GLenum GLenum const GLvoid * data
void memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) noexcept
An OS and compiler independent version of "memcpy".