Wrap a memory buffer with an index.
More...
#include <be_memory_indexedbuffer.h>
Inherited by BiometricEvaluation::Memory::MutableIndexedBuffer.
|
| IndexedBuffer () |
| Wrap a nullptr buffer. More...
|
|
| IndexedBuffer (const uint8_t *data, uint64_t size) |
| Wrap an existing buffer of a given length. More...
|
|
| IndexedBuffer (const uint8Array &aa) |
| Wrap an existing uint8Array. More...
|
|
| IndexedBuffer (const IndexedBuffer ©)=default |
| Copy constructor (default). More...
|
|
uint32_t | getSize () const |
| Obtain the current size of the buffer. More...
|
|
uint32_t | getIndex () const |
| Obtain the current index into the buffer. More...
|
|
void | setIndex (uint64_t index) |
| Set the current index into the buffer. More...
|
|
uint8_t | scanU8Val () |
| Obtain the next element of the buffer and increment the current index value. More...
|
|
uint16_t | scanU16Val () |
| Obtain the next two elements of the buffer and increment the current index value. More...
|
|
uint16_t | scanBeU16Val () |
| Obtain the next two elements of the buffer, scanned as a big-endian value, and increment the current index value. More...
|
|
uint32_t | scanU32Val () |
| Obtain the next four elements of the buffer and increment the current index value by four. More...
|
|
uint32_t | scanBeU32Val () |
| Obtain the next four elements of the buffer, scanned as a big-endian value, and increment the current index value. More...
|
|
uint64_t | scanU64Val () |
| Obtain the next eight elements of the buffer and increment the current index value by eight. More...
|
|
uint64_t | scan (void *buf, uint64_t len) |
| Obtain the next 'n' elements of the buffer and increment the current index value by n. More...
|
|
virtual const uint8_t * | get () const |
| Returns a pointer to the managed buffer. More...
|
|
virtual | ~IndexedBuffer ()=default |
| Destructor (default). More...
|
|
Wrap a memory buffer with an index.
The memory buffer is treated as an array of unsigned eight bit values. This class provides safe access to the array with methods to retrieve 8/16/32/64-bit elements, or and arbitrary segment starting at the index, from the array while advancing the current index. An exception is thrown by these methods whenever the retrieval would reach beyond the size of the buffer. IndexedBuffers do not own the memory of the buffers they wrap.
Definition at line 33 of file be_memory_indexedbuffer.h.
◆ IndexedBuffer() [1/4]
BiometricEvaluation::Memory::IndexedBuffer::IndexedBuffer |
( |
| ) |
|
◆ IndexedBuffer() [2/4]
BiometricEvaluation::Memory::IndexedBuffer::IndexedBuffer |
( |
const uint8_t * |
data, |
|
|
uint64_t |
size |
|
) |
| |
Wrap an existing buffer of a given length.
- Parameters
-
data | Buffer to wrap. |
size | Size of buffer. |
◆ IndexedBuffer() [3/4]
BiometricEvaluation::Memory::IndexedBuffer::IndexedBuffer |
( |
const uint8Array & |
aa | ) |
|
Wrap an existing uint8Array.
- Parameters
-
◆ IndexedBuffer() [4/4]
BiometricEvaluation::Memory::IndexedBuffer::IndexedBuffer |
( |
const IndexedBuffer & |
copy | ) |
|
|
default |
Copy constructor (default).
◆ ~IndexedBuffer()
virtual BiometricEvaluation::Memory::IndexedBuffer::~IndexedBuffer |
( |
| ) |
|
|
virtualdefault |
◆ getSize()
uint32_t BiometricEvaluation::Memory::IndexedBuffer::getSize |
( |
| ) |
const |
Obtain the current size of the buffer.
- Returns
- The current buffer size.
◆ getIndex()
uint32_t BiometricEvaluation::Memory::IndexedBuffer::getIndex |
( |
| ) |
const |
Obtain the current index into the buffer.
- Returns
- The current buffer index.
- Note
- When getIndex() == getSize(), the buffer is exhausted from scanning.
◆ setIndex()
void BiometricEvaluation::Memory::IndexedBuffer::setIndex |
( |
uint64_t |
index | ) |
|
Set the current index into the buffer.
- Parameters
-
[in] | index | The index value to set. |
- Exceptions
-
◆ scanU8Val()
uint8_t BiometricEvaluation::Memory::IndexedBuffer::scanU8Val |
( |
| ) |
|
Obtain the next element of the buffer and increment the current index value.
- Returns
- The next element of the buffer as an unsigned 8-bit value.
- Exceptions
-
◆ scanU16Val()
uint16_t BiometricEvaluation::Memory::IndexedBuffer::scanU16Val |
( |
| ) |
|
Obtain the next two elements of the buffer and increment the current index value.
- Returns
- The next element of the buffer as an unsigned 16-bit value.
- Exceptions
-
◆ scanBeU16Val()
uint16_t BiometricEvaluation::Memory::IndexedBuffer::scanBeU16Val |
( |
| ) |
|
Obtain the next two elements of the buffer, scanned as a big-endian value, and increment the current index value.
- Returns
- The next element of the buffer as an unsigned 16-bit value.
- Exceptions
-
◆ scanU32Val()
uint32_t BiometricEvaluation::Memory::IndexedBuffer::scanU32Val |
( |
| ) |
|
Obtain the next four elements of the buffer and increment the current index value by four.
- Returns
- The next element of the buffer as an unsigned 32-bit value.
- Exceptions
-
◆ scanBeU32Val()
uint32_t BiometricEvaluation::Memory::IndexedBuffer::scanBeU32Val |
( |
| ) |
|
Obtain the next four elements of the buffer, scanned as a big-endian value, and increment the current index value.
- Returns
- The next element of the buffer as an unsigned 32-bit value.
- Exceptions
-
◆ scanU64Val()
uint64_t BiometricEvaluation::Memory::IndexedBuffer::scanU64Val |
( |
| ) |
|
Obtain the next eight elements of the buffer and increment the current index value by eight.
- Returns
- The next element of the buffer as an unsigned 64-bit value.
- Exceptions
-
◆ scan()
uint64_t BiometricEvaluation::Memory::IndexedBuffer::scan |
( |
void * |
buf, |
|
|
uint64_t |
len |
|
) |
| |
Obtain the next 'n' elements of the buffer and increment the current index value by n.
- Parameters
-
[in] | buf | Buffer to store the copied data, or nullptr. |
[in] | len | The number of elements to copy. |
- Exceptions
-
- Returns
- The number of elements copied.
◆ get()
virtual const uint8_t * BiometricEvaluation::Memory::IndexedBuffer::get |
( |
| ) |
const |
|
virtual |
The documentation for this class was generated from the following file: