|
| Static_KV_Builder () |
|
template<class T > |
bool | add (const char *key, const T *data, size_t count) |
| Add a key-value pair to the dictionary, or update the existing value with the same key. More...
|
|
template<class T > |
bool | add (const char *key, const T &value) |
| Add a key-value pair to the dictionary, or update the existing value with the same key. More...
|
|
bool | add (const char *key, const char *data) |
| Add a key-value pair to the dictionary, or update the existing value with the same key. More...
|
|
template<class T , size_t N> |
bool | add (const char *key, const T(&array)[N]) |
| Add a key-value pair to the dictionary, or update the existing value with the same key. More...
|
|
template<class T > |
bool | add (const char *key, std::initializer_list< T > list) |
| Add a key-value pair to the dictionary, or update the existing value with the same key. More...
|
|
template<class T , size_t N> |
bool | add (const char *key, const std::array< T, N > &array) |
| Add a key-value pair to the dictionary, or update the existing value with the same key. More...
|
|
template<class T > |
bool | add (const char *key, const std::vector< T > &vector) |
| Add a key-value pair to the dictionary, or update the existing value with the same key. More...
|
|
void | clear () |
| Clear all elements of the dictionary. More...
|
|
void | print (std::ostream &os) const |
|
void | print (Print &os) const |
| Dump the dictionary buffer to the given output stream in a human-readable format (offset + hexadecimal + ASCII). More...
|
|
void | printPython (std::ostream &os) const |
|
void | printPython (Print &os) const |
| Dump the dictionary buffer to the given output stream as a Python bytes object. More...
|
|
const uint8_t * | getBuffer () const |
| Get the buffer containing the dictionary. More...
|
|
size_t | getBufferSize () const |
| Get the total size of the buffer. More...
|
|
size_t | getLength () const |
| Get the length of the used part of the buffer. More...
|
|
void | changeBuffer (uint8_t *buffer, size_t size) |
| Replace the buffer. More...
|
|
KV_Iterator::iterator | find (const char *key) const |
| Get the element with the given key. More...
|
|
|
uint8_t * | writeHeader (const char *key, uint8_t typeID, size_t length) |
| Write the header of a new element into the buffer, advance the write pointer, and return a pointer to where the data should be written. More...
|
|
template<class T > |
bool | append (const char *key, const T *data, size_t count) |
| Append the new element to the buffer. More...
|
|
template<class T > |
bool | overwrite (KV_Iterator::iterator existing, const T *data, size_t count) |
| Overwrite the existing element referenced by existing with the new data, if the type and size match. More...
|
|
template<class T > |
void | overwrite (uint8_t *buffer, const T *data, size_t count) |
| (Over)write the data of an element to the buffer. More...
|
|
template<size_t N>
class Static_KV_Builder< N >
KV_Builder with a static buffer.
- Examples
- KVComm-Send.ino.
Definition at line 452 of file KV_Builder.hpp.
bool add |
( |
const char * |
key, |
|
|
const T * |
data, |
|
|
size_t |
count |
|
) |
| |
|
inlineinherited |
Add a key-value pair to the dictionary, or update the existing value with the same key.
If the key can't be found in the dictionary, the new element is appended. If a value with the same key is found, and if the type and size are the same, the existing value is updated with the new value. If the type or size don't match, the dictionary is not altered.
- Template Parameters
-
T | The type of the value to add. |
- Parameters
-
key | The key for this element. The maximum length is 255 characters. |
data | A pointer to the (array of) value(s) to add. |
count | The number of elements in the array. The maximum size is 65535 bytes, so the maximum count is 65535 divided by the size of one element. |
- Return values
-
true | The element was added to the dictionary successfully, or the existing element with the same key was updated with the new value. |
false | The buffer is full, the key or data length is too large, or the type and size don't match the ones of the existing element with the same key. |
Definition at line 142 of file KV_Builder.hpp.
bool add |
( |
const char * |
key, |
|
|
const T & |
value |
|
) |
| |
|
inlineinherited |
Add a key-value pair to the dictionary, or update the existing value with the same key.
The data of the element is a single value.
If the key can't be found in the dictionary, the new element is appended. If a value with the same key is found, and if the type and size are the same, the existing value is updated with the new value. If the type or size don't match, the dictionary is not altered.
- Template Parameters
-
T | The type of the value to add. |
- Parameters
-
key | The key for this element. The maximum length is 255 characters. |
value | The value to add. The maximum size is 65535 bytes. |
- Return values
-
true | The element was added to the dictionary successfully, or the existing element with the same key was updated with the new value. |
false | The buffer is full, the key or data length is too large, or the type and size don't match the ones of the existing element with the same key. |
Definition at line 187 of file KV_Builder.hpp.
bool add |
( |
const char * |
key, |
|
|
const char * |
data |
|
) |
| |
|
inlineinherited |
Add a key-value pair to the dictionary, or update the existing value with the same key.
The data of the element is a null-terminated string.
If the key can't be found in the dictionary, the new element is appended. If a value with the same key is found, and if the type and size are the same, the existing value is updated with the new value. If the type or size don't match, the dictionary is not altered.
- Parameters
-
key | The key for this element. The maximum length is 255 characters. |
data | The string to add. The maximum length is 65534 characters. |
- Return values
-
true | The element was added to the dictionary successfully, or the existing element with the same key was updated with the new value. |
false | The buffer is full, the key or data length is too large, or the type and size don't match the ones of the existing element with the same key. |
Definition at line 216 of file KV_Builder.hpp.
bool add |
( |
const char * |
key, |
|
|
const T(&) |
array[N] |
|
) |
| |
|
inlineinherited |
Add a key-value pair to the dictionary, or update the existing value with the same key.
The data of the element is an array of values.
If the key can't be found in the dictionary, the new element is appended. If a value with the same key is found, and if the type and size are the same, the existing value is updated with the new value. If the type or size don't match, the dictionary is not altered.
- Template Parameters
-
T | The type of the values to add. |
N | The number of values to add. |
- Parameters
-
key | The key for this element. The maximum length is 255 characters. |
array | The array of values to add. The maximum size is 65535 bytes. |
- Return values
-
true | The element was added to the dictionary successfully, or the existing element with the same key was updated with the new value. |
false | The buffer is full, the key or data length is too large, or the type and size don't match the ones of the existing element with the same key. |
Definition at line 250 of file KV_Builder.hpp.
bool add |
( |
const char * |
key, |
|
|
std::initializer_list< T > |
list |
|
) |
| |
|
inlineinherited |
Add a key-value pair to the dictionary, or update the existing value with the same key.
The data of the element is a list of values.
If the key can't be found in the dictionary, the new element is appended. If a value with the same key is found, and if the type and size are the same, the existing value is updated with the new value. If the type or size don't match, the dictionary is not altered.
- Template Parameters
-
T | The type of the values to add. |
- Parameters
-
key | The key for this element. The maximum length is 255 characters. |
list | The list of values to add. The maximum size is 65535 bytes. |
- Return values
-
true | The element was added to the dictionary successfully, or the existing element with the same key was updated with the new value. |
false | The buffer is full, the key or data length is too large, or the type and size don't match the ones of the existing element with the same key. |
Definition at line 282 of file KV_Builder.hpp.
bool add |
( |
const char * |
key, |
|
|
const std::array< T, N > & |
array |
|
) |
| |
|
inlineinherited |
Add a key-value pair to the dictionary, or update the existing value with the same key.
The data of the element is an std::array of values.
If the key can't be found in the dictionary, the new element is appended. If a value with the same key is found, and if the type and size are the same, the existing value is updated with the new value. If the type or size don't match, the dictionary is not altered.
- Template Parameters
-
T | The type of the values to add. |
N | The number of values to add. |
- Parameters
-
key | The key for this element. The maximum length is 255 characters. |
array | The array of values to add. The maximum size is 65535 bytes. |
- Return values
-
true | The element was added to the dictionary successfully, or the existing element with the same key was updated with the new value. |
false | The buffer is full, the key or data length is too large, or the type and size don't match the ones of the existing element with the same key. |
Definition at line 316 of file KV_Builder.hpp.
bool add |
( |
const char * |
key, |
|
|
const std::vector< T > & |
vector |
|
) |
| |
|
inlineinherited |
Add a key-value pair to the dictionary, or update the existing value with the same key.
The data of the element is an std::vector of values.
If the key can't be found in the dictionary, the new element is appended. If a value with the same key is found, and if the type and size are the same, the existing value is updated with the new value. If the type or size don't match, the dictionary is not altered.
- Template Parameters
-
T | The type of the values to add. |
- Parameters
-
key | The key for this element. The maximum length is 255 characters. |
vector | The vector of values to add. The maximum size is 65535 bytes. |
- Return values
-
true | The element was added to the dictionary successfully, or the existing element with the same key was updated with the new value. |
false | The buffer is full, the key or data length is too large, or the type and size don't match the ones of the existing element with the same key. |
Definition at line 348 of file KV_Builder.hpp.
uint8_t * writeHeader |
( |
const char * |
key, |
|
|
uint8_t |
typeID, |
|
|
size_t |
length |
|
) |
| |
|
privateinherited |
Write the header of a new element into the buffer, advance the write pointer, and return a pointer to where the data should be written.
Returns a null pointer if the element is too large for the buffer, and in that case, the write pointer is unaltered.
Definition at line 29 of file KV_Builder.cpp.