24 struct CSerializablePtr;
51 virtual size_t Read(
void *Buffer,
size_t Count) = 0;
55 virtual size_t Write(
const void *Buffer,
size_t Count) = 0;
60 template <
bool EXISTING_OBJ>
void internal_ReadObject(CSerializablePtr &newObj,
CSerializable *existingObj = NULL);
77 size_t ReadBuffer(
void *Buffer,
size_t Count);
97 #if !MRPT_IS_BIG_ENDIAN 99 return ReadBuffer(ptr,ElementCount*
sizeof(T));
102 const size_t nread = ReadBuffer(ptr,ElementCount*
sizeof(T));
120 void WriteBuffer (
const void *Buffer,
size_t Count);
138 template <
typename T>
141 #if !MRPT_IS_BIG_ENDIAN 143 return WriteBuffer(ptr,ElementCount*
sizeof(T));
146 for (
size_t i=0;i<ElementCount;i++) (*
this) << ptr[i];
161 virtual uint64_t getTotalBytesCount() = 0;
175 CSerializablePtr ReadObject();
193 template <
typename STORED_TYPE,
typename CAST_TO_TYPE>
197 read_here =
static_cast<CAST_TO_TYPE
>(var);
207 template <typename CONTAINER_TYPE>
208 void printf_vector(const
char *fmt, const CONTAINER_TYPE &V,
char separator = ',' )
211 const size_t N = V.size();
212 for (
size_t i=0;i<N;i++)
214 this->printf(fmt,V[i]);
215 if (i!=(N-1)) this->printf(
"%c",separator);
265 #define DECLARE_CSTREAM_READ_WRITE_SIMPLE_TYPE( T ) \ 266 CStream BASE_IMPEXP & operator<<(mrpt::utils::CStream&out, const T &a); \ 267 CStream BASE_IMPEXP & operator>>(mrpt::utils::CStream&in, T &a); 281 #ifdef HAVE_LONG_DOUBLE 303 CStream
BASE_IMPEXP & operator << (mrpt::utils::CStream&, const std::vector<std::string> &);
305 #if MRPT_WORD_SIZE!=32 // If it's 32 bit, size_t <=> uint32_t 306 CStream
BASE_IMPEXP & operator << (mrpt::utils::CStream&, const std::vector<size_t> &
a);
327 CStream
BASE_IMPEXP & operator << (mrpt::utils::CStream&s, const std::vector<float> &
a);
328 CStream
BASE_IMPEXP & operator << (mrpt::utils::CStream&s, const std::vector<double> &
a);
330 #if MRPT_WORD_SIZE!=32 // If it's 32 bit, size_t <=> uint32_t unsigned __int16 uint16_t
std::vector< uint32_t > vector_uint
virtual size_t ReadBufferImmediate(void *Buffer, size_t Count)
Reads a block of bytes from the stream into Buffer, and returns the amound of bytes actually read...
std::vector< uint8_t > vector_byte
void BASE_IMPEXP reverseBytesInPlace(bool &v_in_out)
Reverse the order of the bytes of a given type (useful for transforming btw little/big endian) ...
TSeekOrigin
Used in CStream::Seek.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
GLsizei GLsizei GLuint * obj
std::vector< int8_t > vector_signed_byte
#define MRPT_printf_format_check(_FMT_, _VARARGS_)
std::vector< bool > vector_bool
A type for passing a vector of bools.
std::vector< int64_t > vector_long
::mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CImagePtr &pObj)
void WriteBufferFixEndianness(const T *ptr, size_t ElementCount)
Writes a sequence of elemental datatypes, taking care of reordering their bytes from the running arch...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
#define DECLARE_CSTREAM_READ_WRITE_SIMPLE_TYPE(T)
CStream BASE_IMPEXP & operator<<(mrpt::utils::CStream &s, const char *a)
GLsizei const GLchar ** string
unsigned __int64 uint64_t
void ReadAsAndCastTo(CAST_TO_TYPE &read_here)
Read a value from a stream stored in a type different of the target variable, making the conversion v...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void printf_vector(const char *fmt, const std::vector< T > &V)
Prints a vector in the format [A,B,C,...] to std::cout, and the fmt string for each vector element...
size_t ReadBufferFixEndianness(T *ptr, size_t ElementCount)
Reads a sequence of elemental datatypes, taking care of reordering their bytes from the MRPT stream s...
std::vector< uint16_t > vector_word
std::vector< int16_t > vector_signed_word
std::vector< int32_t > vector_int
unsigned __int32 uint32_t
GLubyte GLubyte GLubyte a
A class that contain generic messages, that can be sent and received from a "CClientTCPSocket" object...