51 virtual size_t Read(
void *Buffer,
size_t Count) = 0;
56 virtual size_t Write(
const void *Buffer,
size_t Count) = 0;
72 size_t ReadBuffer(
void *Buffer,
size_t Count);
92 #if !MRPT_IS_BIG_ENDIAN 94 return ReadBuffer(ptr,ElementCount*
sizeof(T));
97 const size_t nread = ReadBuffer(ptr,ElementCount*
sizeof(T));
115 void WriteBuffer (
const void *Buffer,
size_t Count);
133 template <
typename T>
136 #if !MRPT_IS_BIG_ENDIAN 138 return WriteBuffer(ptr,ElementCount*
sizeof(T));
141 for (
size_t i=0;i<ElementCount;i++) (*
this) << ptr[i];
147 size_t CopyFrom(
CStream* Source,
size_t Count);
160 virtual uint64_t getTotalBytesCount() = 0;
164 virtual uint64_t getPosition() =0;
199 template <typename T>
204 for (
size_t i=0;i<N;i++)
206 this->printf(fmt,V[i]);
207 if (i!=(N-1)) this->printf(
",");
251 bool getline(std::string &out_str);
257 #define DECLARE_CSTREAM_READ_WRITE_SIMPLE_TYPE( T ) \ 258 CStream BASE_IMPEXP & operator<<(CStream&out, const T &a); \ 259 CStream BASE_IMPEXP & operator>>(CStream&in, T &a); 273 #ifdef HAVE_LONG_DOUBLE 300 #if MRPT_WORD_SIZE!=32 // If it's 32 bit, size_t <=> uint32_t 328 #if MRPT_WORD_SIZE!=32 // If it's 32 bit, size_t <=> uint32_t std::vector< int32_t > vector_int
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.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
class BASE_IMPEXP CStream
std::vector< bool > vector_bool
A type for passing a vector of bools.
std::vector< int8_t > vector_signed_byte
std::vector< int16_t > vector_signed_word
std::vector< int64_t > vector_long
#define MRPT_printf_format_check(_FMT_, _VARARGS_)
::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)
std::vector< uint8_t > vector_byte
dynamicsize_vector< double > vector_double
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...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CStream BASE_IMPEXP & operator<<(CStream &s, const char *a)
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
void reverseBytesInPlace(T &v_in_out)
Reverse the order of the bytes of a given type (useful for transforming btw little/big endian) ...
std::vector< uint32_t > vector_uint
dynamicsize_vector< float > vector_float
A class that contain generic messages, that can be sent and received from a "CClientTCPSocket" object...