All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
ndn::DynamicMallocUInt8ArrayLite Class Reference

A DynamicMallocUInt8ArrayLite extends DynamicUInt8ArrayLite to use malloc and realloc to resize the array. More...

#include <dynamic-malloc-uint8-array-lite.hpp>

Inheritance diagram for ndn::DynamicMallocUInt8ArrayLite:
ndn::DynamicUInt8ArrayLite ndn_DynamicUInt8Array

Public Member Functions

 DynamicMallocUInt8ArrayLite (size_t initialLength)
 Create a DynamicMallocUInt8ArrayLite with a buffer of the initial length. More...
 
 ~DynamicMallocUInt8ArrayLite ()
 Free the malloced array.
 
- Public Member Functions inherited from ndn::DynamicUInt8ArrayLite
 DynamicUInt8ArrayLite (uint8_t *array, size_t length, ndn_ReallocFunction reallocFunction)
 Create a DynamicUInt8ArrayLite with the given array buffer. More...
 
uint8_t * getArray ()
 Get the current allocated array. More...
 
const uint8_t * getArray () const
 
size_t getLength () const
 Get the current length of the allocated array. More...
 
ndn_Error ensureLength (size_t length)
 Ensure that getLength() is greater than or equal to length. More...
 
ndn_Error copy (const uint8_t *value, size_t valueLength, size_t offset)
 Copy value into this object's array at offset, using ensureLength to make sure the array has enough length. More...
 
ndn_Error ensureLengthFromBack (size_t length)
 Ensure that getLength() is greater than or equal to the given length. More...
 
ndn_Error copyFromBack (const uint8_t *value, size_t valueLength, size_t offsetFromBack)
 First call ensureLengthFromBack to make sure this object's array has offsetFromBack bytes. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ndn::DynamicUInt8ArrayLite
static DynamicUInt8ArrayLitedownCast (ndn_DynamicUInt8Array &dynamicArray)
 Downcast the reference to the ndn_DynamicUInt8Array struct to a DynamicUInt8ArrayLite. More...
 
static const
DynamicUInt8ArrayLite
downCast (const ndn_DynamicUInt8Array &dynamicArray)
 
- Protected Member Functions inherited from ndn::DynamicUInt8ArrayLite
void setArrayAndLength (uint8_t *array, size_t length)
 Set the array and length. More...
 

Detailed Description

A DynamicMallocUInt8ArrayLite extends DynamicUInt8ArrayLite to use malloc and realloc to resize the array.

Note that the destructor frees the memory; if you continue to need the array, you must copy getArray() before this object is destructed. We also disable the copy constructor and assignment operator because we don't do reference counting of the malloced array. If your lightweight platform doesn't support malloc then don't link to this file, and use DynamicUInt8ArrayLite directly with a fixed-size array.

Constructor & Destructor Documentation

ndn::DynamicMallocUInt8ArrayLite::DynamicMallocUInt8ArrayLite ( size_t  initialLength)

Create a DynamicMallocUInt8ArrayLite with a buffer of the initial length.

Parameters
initialLengthThe initial size of the malloced array. This may be 0.

The documentation for this class was generated from the following files: