9 #ifndef CMEMORYSTREAM_H
10 #define CMEMORYSTREAM_H
67 void* getRawBufferData();
70 bool saveBufferToFile( const std::
string &file_name );
73 bool loadBufferFromFile( const std::
string &file_name );
76 void setAllocBlockSize( uint64_t alloc_block_size )
79 m_alloc_block_size = alloc_block_size;
This CStream derived class allow using a memory buffer as a CStream.
size_t Read(void *Buffer, size_t Count) MRPT_OVERRIDE
Introduces a pure virtual method responsible for reading from the stream.
void assignMemoryNotOwn(const void *data, const uint64_t nBytesInData)
Initilize the data in the stream from a block of memory which is NEITHER OWNED NOR COPIED by the obje...
bool m_read_only
If the memory block does not belong to the object.
uint64_t getTotalBytesCount() MRPT_OVERRIDE
Returns the total size of the internal buffer
uint64_t Seek(uint64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning) MRPT_OVERRIDE
Introduces a pure virtual method for moving to a specified position in the streamed resource.
void changeSize(uint64_t newSize)
Change size. This would be rarely used. Use ">>" operators for writing to stream.
uint64_t m_alloc_block_size
void resize(uint64_t newSize)
Resizes the internal buffer size.
void Clear()
Clears the memory buffer.
CMemoryStream(const void *data, const uint64_t nBytesInData)
Constructor to initilize the data in the stream from a block of memory (which is copied),...
size_t Write(const void *Buffer, size_t Count) MRPT_OVERRIDE
Introduces a pure virtual method responsible for writing to the stream.
void_ptr_noncopy m_memory
Internal data.
CMemoryStream()
Default constructor.
virtual ~CMemoryStream()
Destructor.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
TSeekOrigin
Used in CStream::Seek.
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.