|
| ByteArray (uint8_t _value[_size]) |
| Constructor. More...
|
|
| ByteArray (uint8_t _value) |
| Constructor. More...
|
|
uint16_t | size () const |
| Number bytes needed to serialize the message. More...
|
|
uint16_t | pack (Common::ByteArray &array, uint16_t offset=0) const |
| Write the object on to a ByteArray so it can be sent over the network. More...
|
|
uint16_t | unpack (const Common::ByteArray &array, uint16_t offset=0) |
| Read a message from a ByteArray. More...
|
|
int | compare (const UID_T &other) const |
| Compare the current UID with the given UID. More...
|
|
uint8_t const & | operator[] (uint16_t index) const |
| Get byte at the given index . More...
|
|
uint8_t & | operator[] (uint16_t index) |
| Get byte at the given index . More...
|
|
uint8_t const & | at (uint16_t index) const |
| Get byte at the given index , asserting that the index is within the correct range. More...
|
|
uint8_t & | at (uint16_t index) |
| Get byte at the given index , asserting that the index is within the correct range. More...
|
|
void | fill (uint8_t byte) |
| Fill the underlining byte array with the given value. More...
|
|
void | clear () |
| Fill the underlining byte array with 0.
|
|
uint8_t | type () const |
| Type of the UID. More...
|
|
virtual | ~Serializable () |
| Destructor.
|
|
virtual UID_T * | clone () const=0 |
| Create a clone object of the object where this method is being called. More...
|
|
template<typename _Class, uint8_t _size, uint8_t _type>
class HF::UID::ByteArray< _Class, _size, _type >
Helper template parent class for all UIDs based on fixed number of bytes.
- Template Parameters
-
_Class | child class being created. |
_size | number of bytes in the UID. |
_type | UID type value. |
Definition at line 192 of file uids.h.
template<typename _Class, uint8_t _size, uint8_t _type>
Compare the current UID with the given UID.
This function returns a value less that 0 if the current UID object order is lower that the given UID, 0 if the UIDs represent the same entity and a value greater that 0 if current UID object is above the given UID.
- Parameters
-
[in] | other | a pointer to a UID object to compare to. |
- Return values
-
<0 | the current UID is lower that the given UID. |
0 | the current UID is the same as given UID. |
>0 | the current UID is greater that the given UID. |
Reimplemented from HF::UID::UID_T.
Definition at line 274 of file uids.h.
279 0 ? memcmp(value, ((_Class *) &other)->value,
sizeof(value)) : res);
virtual int compare(const UID_T &other) const
Compare the current UID with the given UID.
template<typename _Class, uint8_t _size, uint8_t _type>
Write the object on to a ByteArray so it can be sent over the network.
The buffer passed in MUST have enough size to hold the serialized object, e.g.,
Serializable obj;
ByteArray payload(obj.size());
obj.pack(payload);
- Parameters
-
[in,out] | array | ByteArray reference to write the object to. |
[in] | offset | offset to start writing to. |
- Returns
- the number of bytes written.
Reimplemented from HF::UID::UID_T.
Definition at line 230 of file uids.h.
236 offset += array.write(offset, (uint8_t)
sizeof(value));
238 for (uint8_t i = 0; i <
sizeof(value); i++)
240 offset += array.write(offset, value[i]);
#define HF_SERIALIZABLE_CHECK(__array, __offset, __size)
Helper macro to check if the given __array has enough size so __size bytes can be written/read from t...
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.