#include <mrpt/utils/CMemoryStream.h>

Public Member Functions | |
| CMemoryStream () | |
| Default constructor. | |
| CMemoryStream (const void *data, const size_t nBytesInData) | |
| Constructor to initilize the data in the stream from a block of memory (which is copied), and sets the current stream position at the beginning of the data. | |
| virtual | ~CMemoryStream () |
| Destructor. | |
| void | Clear () |
| Clears the memory buffer. | |
| void | changeSize (size_t newSize) |
| Change size. | |
| size_t | Seek (long Offset, CStream::TSeekOrigin Origin=sFromBeginning) |
| Method for moving to a specified position in the streamed resource. | |
| size_t | getTotalBytesCount () |
| Returns the total size of the internal buffer. | |
| size_t | getPosition () |
| Method for getting the current cursor position, where 0 is the first byte and TotalBytesCount-1 the last one. | |
| void * | getRawBufferData () |
| Method for getting a pointer to the raw stored data. | |
| bool | saveBufferToFile (const std::string &file_name) |
| Saves the entire buffer to a file. | |
| bool | loadBufferFromFile (const std::string &file_name) |
| Loads the entire buffer from a file. | |
| void | setAllocBlockSize (size_t alloc_block_size) |
| Change the size of the additional memory block that is reserved whenever the current block runs too short (default=0x10000 bytes). | |
Protected Member Functions | |
| size_t | Read (void *Buffer, size_t Count) |
| Method responsible for reading from the stream. | |
| size_t | Write (const void *Buffer, size_t Count) |
| Method responsible for writing to the stream. | |
| void | resize (size_t newSize) |
| Resizes the internal buffer size. | |
Protected Attributes | |
| void_ptr_noncopy | m_memory |
| Internal data. | |
| size_t | m_size |
| size_t | m_position |
| size_t | m_bytesWritten |
| size_t | m_alloc_block_size |
This class is useful for storing any required set of variables or objects, and then read them to other objects, or storing them to a file, for example.
Definition at line 47 of file CMemoryStream.h.
| mrpt::utils::CMemoryStream::CMemoryStream | ( | ) |
Default constructor.
| mrpt::utils::CMemoryStream::CMemoryStream | ( | const void * | data, | |
| const size_t | nBytesInData | |||
| ) |
Constructor to initilize the data in the stream from a block of memory (which is copied), and sets the current stream position at the beginning of the data.
| virtual mrpt::utils::CMemoryStream::~CMemoryStream | ( | ) | [virtual] |
Destructor.
| void mrpt::utils::CMemoryStream::changeSize | ( | size_t | newSize | ) |
Change size.
This would be rarely used. Use ">>" operators for writing to stream.
| void mrpt::utils::CMemoryStream::Clear | ( | ) |
Clears the memory buffer.
| size_t mrpt::utils::CMemoryStream::getPosition | ( | ) | [virtual] |
Method for getting the current cursor position, where 0 is the first byte and TotalBytesCount-1 the last one.
Implements mrpt::utils::CStream.
| void* mrpt::utils::CMemoryStream::getRawBufferData | ( | ) |
Method for getting a pointer to the raw stored data.
The lenght in bytes is given by getTotalBytesCount
| size_t mrpt::utils::CMemoryStream::getTotalBytesCount | ( | ) | [virtual] |
| bool mrpt::utils::CMemoryStream::loadBufferFromFile | ( | const std::string & | file_name | ) |
Loads the entire buffer from a file.
| size_t mrpt::utils::CMemoryStream::Read | ( | void * | Buffer, | |
| size_t | Count | |||
| ) | [protected, virtual] |
| void mrpt::utils::CMemoryStream::resize | ( | size_t | newSize | ) | [protected] |
Resizes the internal buffer size.
| bool mrpt::utils::CMemoryStream::saveBufferToFile | ( | const std::string & | file_name | ) |
Saves the entire buffer to a file.
| size_t mrpt::utils::CMemoryStream::Seek | ( | long | Offset, | |
| CStream::TSeekOrigin | Origin = sFromBeginning | |||
| ) | [virtual] |
Method for moving to a specified position in the streamed resource.
Implements mrpt::utils::CStream.
| void mrpt::utils::CMemoryStream::setAllocBlockSize | ( | size_t | alloc_block_size | ) | [inline] |
Change the size of the additional memory block that is reserved whenever the current block runs too short (default=0x10000 bytes).
Definition at line 120 of file CMemoryStream.h.
References ASSERT_.
| size_t mrpt::utils::CMemoryStream::Write | ( | const void * | Buffer, | |
| size_t | Count | |||
| ) | [protected, virtual] |
Method responsible for writing to the stream.
Write attempts to write up to Count bytes to Buffer, and returns the number of bytes actually written.
Implements mrpt::utils::CStream.
size_t mrpt::utils::CMemoryStream::m_alloc_block_size [protected] |
Definition at line 63 of file CMemoryStream.h.
size_t mrpt::utils::CMemoryStream::m_bytesWritten [protected] |
Definition at line 62 of file CMemoryStream.h.
void_ptr_noncopy mrpt::utils::CMemoryStream::m_memory [protected] |
size_t mrpt::utils::CMemoryStream::m_position [protected] |
Definition at line 62 of file CMemoryStream.h.
size_t mrpt::utils::CMemoryStream::m_size [protected] |
Definition at line 62 of file CMemoryStream.h.
| Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN: at Thu Feb 26 02:07:47 EST 2009 |