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;
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];
165 virtual uint64_t getTotalBytesCount() = 0;
169 virtual uint64_t getPosition() =0;
179 CSerializablePtr ReadObject();
204 template <typename T>
209 for (
size_t i=0;i<N;i++)
211 this->printf(fmt,V[i]);
212 if (i!=(N-1)) this->printf(
",");
256 bool getline(std::string &out_str);
262 #define DECLARE_CSTREAM_READ_WRITE_SIMPLE_TYPE( T ) \ 263 CStream BASE_IMPEXP & operator<<(mrpt::utils::CStream&out, const T &a); \ 264 CStream BASE_IMPEXP & operator>>(mrpt::utils::CStream&in, T &a); 278 #ifdef HAVE_LONG_DOUBLE 300 CStream
BASE_IMPEXP & operator << (mrpt::utils::CStream&, const std::vector<std::string> &);
302 #if MRPT_WORD_SIZE!=32 // If it's 32 bit, size_t <=> uint32_t 303 CStream
BASE_IMPEXP & operator << (mrpt::utils::CStream&, const std::vector<size_t> &a);
324 CStream
BASE_IMPEXP & operator << (mrpt::utils::CStream&s, const std::vector<float> &a);
325 CStream
BASE_IMPEXP & operator << (mrpt::utils::CStream&s, const std::vector<double> &a);
327 #if MRPT_WORD_SIZE!=32 // If it's 32 bit, size_t <=> uint32_t CStream BASE_IMPEXP & operator<<(mrpt::utils::CStream &s, const char *a)
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
TSeekOrigin
Used in CStream::Seek.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
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)
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
void reverseBytesInPlace(T &v_in_out)
Reverse the order of the bytes of a given type (useful for transforming btw little/big endian) ...
A class that contain generic messages, that can be sent and received from a "CClientTCPSocket" object...