This class safetly handles allocation and deallocation of memory. It can be used in conjunction with meshPacket or meshFrame to create data(payload) part before creating packet or frame. Main advantage is, that std::move can be used to set data (payload) with variable array without manually copying each element in array.
More...
|
| MeshVariableArray () |
| Constructor. More...
|
|
| MeshVariableArray (const uint16_t length) |
| Create uninitialized array with specified length. More...
|
|
| MeshVariableArray (const T *newData, const uint16_t newDataLength) |
| Sets new data to whole and sets its size. More...
|
|
| MeshVariableArray (const T fillItem, const uint16_t length) |
| Fills whole array with the specified item. More...
|
|
| MeshVariableArray (const MeshVariableArray< T > &mva) |
| Copy constructor. More...
|
|
| MeshVariableArray (MeshVariableArray< T > &&mva) noexcept |
| Move constructor. More...
|
|
| ~MeshVariableArray () |
| Destructor. More...
|
|
MeshVariableArray< T > & | operator= (const MeshVariableArray< T > &mva) |
| Copy assignment operator. More...
|
|
MeshVariableArray< T > & | operator= (MeshVariableArray< T > &&mva) noexcept |
| Move assignment operator. More...
|
|
uint16_t | Length () const |
| Length of data. More...
|
|
T | operator[] (uint16_t i) const |
|
T & | operator[] (uint16_t i) |
|
T | GetAt (uint16_t index) const |
| Reads item at specified index. More...
|
|
bool | SetAt (uint16_t index, T value) |
| Sets item at specified index. More...
|
|
bool | SetArray (const T *newData, const uint16_t newDataLength) |
| Sets new data to whole and resizes (expand/shrink) it. More...
|
|
bool | SetData (const T *newData, uint16_t startIndex, const uint16_t newDataLength) |
| Sets new data. Array will be expanded if data won't fit. More...
|
|
void | FillArray (const T fillItem) |
| Fills whole array with the specified item. More...
|
|
bool | FillData (const T fillItem, uint16_t startIndex, uint16_t count) |
| Fills specified part of array with the specified item. Array can be expanded when startIndex + count is more than array length. More...
|
|
void | GetData (T *data, uint16_t &dataLength) const |
| Gets data from whole array. More...
|
|
bool | ResizeArray (uint16_t size, bool doNotCopy=false) |
| Resizes array. More...
|
|
void | Clear () |
| Sets array size to 0. More...
|
|
bool | CopyFrom (const MeshVariableArray< T > &another) |
| Copyies data from another array to current array. More...
|
|
void | MoveFrom (MeshVariableArray< T > &another) |
| Moves data from another array to current array. More...
|
|
void | MoveFrom (T *&dataPtr, uint16_t dataLength) |
| Moves data from another array to current array. More...
|
|
T * | UnsafeDataMove () |
| Takes pointer to allocated array and removes that pointer from current class. More...
|
|
const T * | d_ptr () const |
| Pointer to data. More...
|
|
template<typename T>
class MeshVariableArray< T >
This class safetly handles allocation and deallocation of memory. It can be used in conjunction with meshPacket or meshFrame to create data(payload) part before creating packet or frame. Main advantage is, that std::move can be used to set data (payload) with variable array without manually copying each element in array.
- See also
- meshVariableArray.h