A MemoryBlock encapsulates a chunk of memory. It's used by the IOQueue and IOStack classes.
|
| | MemoryBlock (uint8_t *data, unsigned int size) |
| | Construct a new MemoryBlock.
|
| |
|
| ~MemoryBlock () |
| | Destructor, this frees the memory for the block.
|
| |
|
void | SeekBack () |
| | Move the insertation point to the end of the block. This is useful if you want to use the block in pre-pend mode.
|
| |
| unsigned int | Capacity () const |
| | The size of the memory region for this block.
|
| |
| unsigned int | Remaining () const |
| | The free space at the end of the block.
|
| |
| unsigned int | Size () const |
| | The size of data in this block.
|
| |
| bool | Empty () const |
| | Check if the block contains data.
|
| |
| uint8_t * | Data () const |
| | Provides a pointer to the first byte of valid data in this block.
|
| |
| unsigned int | Append (const uint8_t *data, unsigned int length) |
| | Append data to this block.
|
| |
| unsigned int | Prepend (const uint8_t *data, unsigned int length) |
| | Prepend data to this block.
|
| |
| unsigned int | Copy (uint8_t *data, unsigned int length) const |
| |
| unsigned int | PopFront (unsigned int length) |
| | Remove data from the front of the block.
|
| |
◆ MemoryBlock()
| ola::io::MemoryBlock::MemoryBlock |
( |
uint8_t * | data, |
|
|
unsigned int | size ) |
|
inline |
Construct a new MemoryBlock.
- Parameters
-
| data | a pointer to the memory region to use, ownership is transferred. |
| size | the size of the memory region to use |
◆ Append()
| unsigned int ola::io::MemoryBlock::Append |
( |
const uint8_t * | data, |
|
|
unsigned int | length ) |
|
inline |
Append data to this block.
- Parameters
-
| data | the data to append. |
| length | the length of the data to append. |
- Returns
- the number of bytes written, which will be less than length if the block is now full.
◆ Capacity()
| unsigned int ola::io::MemoryBlock::Capacity |
( |
| ) |
const |
|
inline |
The size of the memory region for this block.
- Returns
- the size of the memory region for this block.
◆ Copy()
| unsigned int ola::io::MemoryBlock::Copy |
( |
uint8_t * | data, |
|
|
unsigned int | length ) const |
|
inline |
Copy data from the MemoryBlock into the location provided.
- Parameters
-
| [out] | data | a pointer to the memory to copy the block data to. |
| length | the maximum size of data to copy. |
- Returns
- the amount of data copied
◆ Data()
| uint8_t * ola::io::MemoryBlock::Data |
( |
| ) |
const |
|
inline |
Provides a pointer to the first byte of valid data in this block.
- Returns
- a pointer to the first byte of valid data in this block.
◆ Empty()
| bool ola::io::MemoryBlock::Empty |
( |
| ) |
const |
|
inline |
Check if the block contains data.
- Returns
- true if the block contains no data, false otherwise.
◆ PopFront()
| unsigned int ola::io::MemoryBlock::PopFront |
( |
unsigned int | length | ) |
|
|
inline |
Remove data from the front of the block.
- Parameters
-
| length | the amount of data to remove |
- Returns
- the amount of data removed.
◆ Prepend()
| unsigned int ola::io::MemoryBlock::Prepend |
( |
const uint8_t * | data, |
|
|
unsigned int | length ) |
|
inline |
Prepend data to this block.
- Parameters
-
| data | the data to prepend. |
| length | the length of the data to prepend. |
- Returns
- the amount of data prepended, (from the end of data), which will be less than length if the block is now full.
◆ Remaining()
| unsigned int ola::io::MemoryBlock::Remaining |
( |
| ) |
const |
|
inline |
The free space at the end of the block.
- Returns
- the free space at the end of the block.
◆ Size()
| unsigned int ola::io::MemoryBlock::Size |
( |
| ) |
const |
|
inline |
The size of data in this block.
- Returns
- the size of the data in this block.
The documentation for this class was generated from the following file: