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];
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
305 #if MRPT_WORD_SIZE!=32
330 #if MRPT_WORD_SIZE!=32
#define DECLARE_CSTREAM_READ_WRITE_SIMPLE_TYPE(T)
A class that contain generic messages, that can be sent and received from a "CClientTCPSocket" object...
The virtual base class which provides a unified interface for all persistent objects in MRPT.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
virtual uint64_t Seek(int64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning)=0
Introduces a pure virtual method for moving to a specified position in the streamed resource.
virtual size_t Write(const void *Buffer, size_t Count)=0
Introduces a pure virtual method responsible for writing to the stream.
virtual size_t Read(void *Buffer, size_t Count)=0
Introduces a pure virtual method responsible for reading from the stream.
virtual uint64_t getPosition()=0
Method for getting the current cursor position, where 0 is the first byte and TotalBytesCount-1 the l...
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...
virtual uint64_t getTotalBytesCount()=0
Returns the total amount of bytes in the stream.
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,...
TSeekOrigin
Used in CStream::Seek.
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...
void WriteBufferFixEndianness(const T *ptr, size_t ElementCount)
Writes a sequence of elemental datatypes, taking care of reordering their bytes from the running arch...
GLsizei GLsizei GLuint * obj
GLubyte GLubyte GLubyte a
GLsizei const GLchar ** string
std::vector< int16_t > vector_signed_word
std::vector< uint8_t > vector_byte
std::vector< uint16_t > vector_word
std::vector< int64_t > vector_long
std::vector< bool > vector_bool
A type for passing a vector of bools.
std::vector< uint32_t > vector_uint
std::vector< int32_t > vector_int
std::vector< int8_t > vector_signed_byte
#define MRPT_printf_format_check(_FMT_, _VARARGS_)
::mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CImagePtr &pObj)
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)
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.
CStream BASE_IMPEXP & operator<<(mrpt::utils::CStream &s, const char *a)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned __int16 uint16_t
unsigned __int32 uint32_t
unsigned __int64 uint64_t