A DynamicUInt8Vector extends ndn_DynamicUInt8Array to hold a shared_ptr<vector<uint8_t> > for use with C functions which need an ndn_DynamicUInt8Array.
More...
#include <dynamic-uint8-vector.hpp>
|
| DynamicUInt8Vector (size_t initialLength) |
| Create a new DynamicUInt8Vector with an initial length. More...
|
|
void | ensureLength (size_t length) |
| Ensure that the vector size is greater than or equal to length. More...
|
|
size_t | copy (const uint8_t *value, size_t valueLength, size_t offset) |
| Copy value into the vector at offset, using ensureLength to make sure the vector has enough size. More...
|
|
size_t | copy (const std::vector< uint8_t > &value, size_t offset) |
| Copy value into the vector at offset, using ensureLength to make sure the vector has enough size. More...
|
|
void | ensureLengthFromBack (size_t length) |
| Ensure that the vector size is greater than or equal to length. More...
|
|
void | copyFromBack (const uint8_t *value, size_t valueLength, size_t offsetFromBack) |
| First call ensureLengthFromBack to make sure the vector has offsetFromBack bytes. More...
|
|
ptr_lib::shared_ptr< std::vector< uint8_t > > & | get () |
| Get the shared_ptr to the allocated vector. More...
|
|
Blob | finish (size_t size) |
| Resize the allocated vector to the given size, transfer the bytes to a Blob and return the Blob. More...
|
|
uint8_t & | operator[] (size_t i) |
|
const uint8_t & | operator[] (size_t i) const |
|
|
uint8_t * | array |
| the allocated array buffer
|
|
size_t | length |
| the length of the allocated array buffer
|
|
ndn_ReallocFunction | realloc |
| a pointer to a function that reallocates array and returns a new pointer to a buffer of length bytes, or 0 for error. More...
|
|
A DynamicUInt8Vector extends ndn_DynamicUInt8Array to hold a shared_ptr<vector<uint8_t> > for use with C functions which need an ndn_DynamicUInt8Array.
ndn::DynamicUInt8Vector::DynamicUInt8Vector |
( |
size_t |
initialLength | ) |
|
Create a new DynamicUInt8Vector with an initial length.
- Parameters
-
initialLength | The initial size of the allocated vector. |
size_t ndn::DynamicUInt8Vector::copy |
( |
const uint8_t * |
value, |
|
|
size_t |
valueLength, |
|
|
size_t |
offset |
|
) |
| |
|
inline |
Copy value into the vector at offset, using ensureLength to make sure the vector has enough size.
- Parameters
-
value | The buffer to copy from. |
valueLength | The length of the value buffer. |
offset | The offset in the vector to copy to. |
- Returns
- The new offset which is offset + valueLength.
size_t ndn::DynamicUInt8Vector::copy |
( |
const std::vector< uint8_t > & |
value, |
|
|
size_t |
offset |
|
) |
| |
|
inline |
Copy value into the vector at offset, using ensureLength to make sure the vector has enough size.
- Parameters
-
value | The buffer to copy from. |
offset | The offset in the vector to copy to. |
- Returns
- The new offset which is offset + value.size().
void ndn::DynamicUInt8Vector::copyFromBack |
( |
const uint8_t * |
value, |
|
|
size_t |
valueLength, |
|
|
size_t |
offsetFromBack |
|
) |
| |
|
inline |
First call ensureLengthFromBack to make sure the vector has offsetFromBack bytes.
Then copy value into the vector starting offsetFromBack bytes from the back of the vector.
- Parameters
-
value | The buffer to copy from. |
valueLength | The length of the value buffer. |
offsetFromBack | The offset from the back of the array to start copying. |
void ndn::DynamicUInt8Vector::ensureLength |
( |
size_t |
length | ) |
|
|
inline |
Ensure that the vector size is greater than or equal to length.
If it is, just return. Otherwise, resize the vector (copying as needed). (The new vector size may be greater than length.)
- Parameters
-
length | The minimum size of the vector. |
void ndn::DynamicUInt8Vector::ensureLengthFromBack |
( |
size_t |
length | ) |
|
|
inline |
Ensure that the vector size is greater than or equal to length.
If it is, just return. Otherwise, resize the vector and shift existing data to the back. (The new vector size may be greater than length.)
- Parameters
-
length | The minimum size of the vector. |
Blob ndn::DynamicUInt8Vector::finish |
( |
size_t |
size | ) |
|
|
inline |
Resize the allocated vector to the given size, transfer the bytes to a Blob and return the Blob.
Further calls to get() will return a null pointer.
- Parameters
-
size | The final size of the allocated vector. |
- Returns
- A new Blob with the bytes from the vector.
ptr_lib::shared_ptr<std::vector<uint8_t> >& ndn::DynamicUInt8Vector::get |
( |
| ) |
|
|
inline |
Get the shared_ptr to the allocated vector.
- Returns
- The shared_ptr to the allocated vector.
The documentation for this class was generated from the following files: