|
| DataRef () |
| Creates a DataRef with no memory used.
|
|
| DataRef (DataRef &&other) |
| Takes control of another DataRef's memory allocation.
|
|
| DataRef (const std::uint8_t *value, std::size_t length) |
| Initialises a DataRef from a std::uint8_t array of length length
|
|
| DataRef (const std::byte *value, std::size_t length) |
| Initialises a DataRef from a std::byte array of length length
|
|
| DataRef (const std::string &from) |
| Initialises a DataRef from a string of chars.
|
|
| DataRef (const DataRef &from) |
| Initialises a DataRef copying another data object (uses more data, to ensure only one object owns the entry)
|
|
| DataRef (std::byte repeating, std::size_t count) |
| Initialises a DataRef with count number of repeating bytes.
|
|
| DataRef (std::size_t reserveLength) |
| Initialises a DataRef with reserveLength bytes of undefined data.
|
|
DataRef & | operator= (const DataRef &other) |
| Copy assign operator. Copies the data to be sure only one object owns the entry.
|
|
| ~DataRef () |
| Default destructor.
|
|
std::string | description () const |
| Returns the hex encoded string represetation as the description.
|
|
DataRef | subdata (std::size_t offset) const |
| Returns a NEWLY allocated DataRef instance returning a subset of this instance.
|
|
DataRef | subdata (std::size_t offset, std::size_t length) const |
| Returns a NEWLY allocated DataRef instance returning a subset of this instance.
|
|
std::byte | at (std::size_t index) const |
| Returns the individual byte at index position, or a byte value of zero if index is out of bounds.
|
|
void | assign (const DataRef &other) |
| Assigns the data in-place, reserving the size required if the current size is too small. More...
|
|
void | append (const DataRef &rawData, std::size_t offset, std::size_t length) |
| Copies another DataRef into this instance, expanding if required.
|
|
void | append (const std::string &rawData) |
| Appends a set of characters to the end of this DataRef.
|
|
void | append (const std::uint8_t *rawData, std::size_t offset, std::size_t length) |
| Copies a uint8_t array onto the end of this instance, expanding if necessary.
|
|
void | appendReversed (const DataRef &rawData, std::size_t offset, std::size_t length) |
| Appends the specified DataRef to this one, but in its reverse order.
|
|
void | append (const DataRef &rawData) |
| Appends the specified DataRef to this one.
|
|
void | append (std::byte rawData) |
| Appends a single byte.
|
|
void | append (uint8_t rawData) |
| appends a single uint8_t
|
|
void | append (uint16_t rawData) |
| Appends a single uint16_t.
|
|
void | append (uint32_t rawData) |
| Appends a single uint32_t.
|
|
void | append (uint64_t rawData) |
| Appends a single uint64_t.
|
|
bool | uint8 (std::size_t fromIndex, uint8_t &into) const noexcept |
| Returns whether reading a single uint8_t to into at fromIndex was successful.
|
|
bool | uint16 (std::size_t fromIndex, uint16_t &into) const noexcept |
| Returns whether reading a single uint16_t to into at fromIndex was successful.
|
|
bool | uint32 (std::size_t fromIndex, uint32_t &into) const noexcept |
| Returns whether reading a single uint32_t to into at fromIndex was successful.
|
|
bool | uint64 (std::size_t fromIndex, uint64_t &into) const noexcept |
| Returns whether reading a single uint64_t to into at fromIndex was successful.
|
|
bool | operator== (const DataRef &other) const noexcept |
| Equality operator for another DataRef instance (same memory arena)
|
|
bool | operator!= (const DataRef &other) const noexcept |
| Inequality operator for another DataRef instance (same memory arena)
|
|
bool | operator< (const DataRef &other) const noexcept |
| Less than operator for another DataRef instance (same memory arena)
|
|
bool | operator> (const DataRef &other) const noexcept |
| Greater than operator for another DataRef instance (same memory arena)
|
|
DataRef | reversed () const |
| Returns a new DataRef instance with the same data as this one, but in the reverse order.
|
|
DataRef | reverseEndianness () const |
| Returns the same order of bytes, but with the bits in each byte reversed.
|
|
std::string | hexEncodedString () const noexcept |
| Returns a hex encoded string of this binary data.
|
|
std::size_t | hashCode () const noexcept |
| Returns the hash code of this instance.
|
|
std::size_t | size () const noexcept |
| Returns the size in allocated bytes of this instance.
|
|
void | clear () noexcept |
| Clears (deallocates) the bytes referred to by this instance.
|
|
template<typename MemoryArenaT = MemoryArena<8192, 8>>
class herald::datatype::DataRef< MemoryArenaT >
The main data workhorse class of the Herald API.
A vitally important part of Herald's datatypes. Many other types are actually just aliases or thin wrappers to the DataRef class.
This class represents an arbitrarily long Big Endian list of std::byte. DataRef instances are used to encode Bluetooth advert data, to pass payloads between herald enabled devices, or to share data to and from backend systems.