45 for (
size_t i=0;i<
n;i++)
47 unsigned char c =
data[i];
49 if (
c == 0x01 || !
c )
58 unsigned char dumm[2];
79 catch (std::bad_alloc &)
83 catch(std::exception &e)
85 fprintf(stderr,
"[ObjectToString] Exception: %s\n", e.what());
90 fprintf(stderr,
"[ObjectToString] Unknown exception\n");
105 if (str.empty())
return;
118 const char *
data = str.c_str();
120 for (i=0;i<
n && (
c=
data[i])!=0;i++)
166 out_vector.resize(N);
172 catch (std::bad_alloc &)
176 catch(std::exception &e)
178 fprintf(stderr,
"[ObjectToOctetVector] Exception: %s\n",e.what());
182 fprintf(stderr,
"[ObjectToOctetVector] Unknown exception\n");
195 if (in_data.empty())
return;
201 catch (std::bad_alloc &)
205 catch(std::exception &e)
207 fprintf(stderr,
"[OctetVectorToObject] Exception: %s\n",e.what());
211 fprintf(stderr,
"[OctetVectorToObject] Unknown exception\n");
226 out_vector.resize(N);
232 catch (std::bad_alloc &)
236 catch(std::exception &e)
238 fprintf(stderr,
"[ObjectToRawString] Exception: %s\n",e.what());
242 fprintf(stderr,
"[ObjectToRawString] Unknown exception\n");
255 if (in_data.empty())
return;
261 catch (std::bad_alloc &)
265 catch(std::exception &e)
267 fprintf(stderr,
"[RawStringToObject] Exception: %s\n",e.what());
271 fprintf(stderr,
"[RawStringToObject] Unknown exception\n");
void BASE_IMPEXP memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) MRPT_NO_THROWS
An OS and compiler independent version of "memcpy".
void BASE_IMPEXP OctetVectorToObject(const vector_byte &in_data, CSerializablePtr &obj)
Converts back (de-serializes) a sequence of binary data into a MRPT object, without prior information...
CSerializablePtr ReadObject()
Reads an object from stream, its class determined at runtime, and returns a smart pointer to the obje...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
#define IMPLEMENTS_VIRTUAL_MRPT_OBJECT(class_name, base_class_name, NameSpace)
This must be inserted as implementation of some required members for virtual CSerializable classes: ...
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 WriteBuffer(const void *Buffer, size_t Count)
Writes a block of bytes to the stream from Buffer.
int BASE_IMPEXP fprintf(FILE *fil, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(2
An OS-independent version of fprintf.
GLsizei GLsizei GLuint * obj
void BASE_IMPEXP 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 BASE_IMPEXP RawStringToObject(const std::string &in_str, CSerializablePtr &obj)
Converts back (de-serializes) a sequence of binary data within a std::string into a MRPT object...
void WriteObject(const CSerializable *o)
Writes an object to the stream.
GLsizei const GLchar ** string
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 BASE_IMPEXP 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 BASE_IMPEXP ObjectToString(const CSerializable *o)
Used to pass MRPT objects into a CORBA-like object (strings).
uint64_t getTotalBytesCount() MRPT_OVERRIDE
Returns the total size of the internal buffer.
uint64_t Seek(int64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning) MRPT_OVERRIDE
Introduces a pure virtual method for moving to a specified position in the streamed resource...
The virtual base class of all MRPT classes with a unified RTTI system.
void BASE_IMPEXP StringToObject(const std::string &str, CSerializablePtr &obj)
Used to pass CORBA-like objects (strings) into a MRPT object.
GLsizei GLsizei GLenum GLenum const GLvoid * data