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;
97 #if !MRPT_IS_BIG_ENDIAN
99 return ReadBuffer(ptr,ElementCount*
sizeof(T));
102 const size_t nread = ReadBuffer(ptr,ElementCount*
sizeof(T));
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];
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(
",");
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
302 #if MRPT_WORD_SIZE!=32
327 #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...
void ReadObject(CSerializable *existingObj)
Reads an object from stream, where its class must be the same as the supplied object,...
void sendMessage(const utils::CMessage &msg)
Send a message to the device.
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.
size_t ReadBuffer(void *Buffer, size_t Count)
Reads a block of bytes from the stream into Buffer.
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
void WriteBuffer(const void *Buffer, size_t Count)
Writes a block of bytes to the stream from Buffer.
CSerializablePtr ReadObject()
Reads an object from stream, its class determined at runtime, and returns a smart pointer to the obje...
virtual uint64_t getPosition()=0
Method for getting the current cursor position, where 0 is the first byte and TotalBytesCount-1 the l...
bool getline(std::string &out_str)
Reads from the stream until a ' ' character is found ('\r' characters are ignored).
virtual uint64_t Seek(uint64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning)=0
Introduces a pure virtual method for moving to a specified position in the streamed resource.
CSerializable * internal_ReadObject(CSerializable *existingObj=NULL)
A common template code for both versions of CStream::ReadObject()
virtual uint64_t getTotalBytesCount()=0
Returns the total amount of bytes in the stream.
bool receiveMessage(utils::CMessage &msg)
Tries to receive a message from the device.
void WriteObject(const CSerializable *o)
Writes an object to 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...
size_t CopyFrom(mrpt::utils::CStream *Source, size_t Count)
Copies a specified number of bytes from one stream to another.
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)
CStream BASE_IMPEXP & operator<<(mrpt::utils::CStream &s, const char *a)
void reverseBytesInPlace(T &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.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.