|
Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Include dependency graph for kv_store.c:Go to the source code of this file.
Functions | |
| void | kv_init (kv_store_t *kv, size_t capacity, size_t esize, uint32_t *keys, void *values, uint8_t *used) |
| Initializes a key-value store. | |
| static int | kv_find (const kv_store_t *kv, uint32_t key, size_t *index) |
| Finds the index of a given key in the store. | |
| int | kv_exists (const kv_store_t *kv, uint32_t key) |
| Checks if a key exists in the store. | |
| int | kv_set (kv_store_t *kv, uint32_t key, const void *value) |
| Sets a value for a given key. | |
| void * | kv_get (const kv_store_t *kv, uint32_t key) |
| Retrieves the value associated with a given key. | |
| int | kv_remove (kv_store_t *kv, uint32_t key) |
| Removes a key-value pair from the store. | |
| int kv_exists | ( | const kv_store_t * | kv, |
| uint32_t | key | ||
| ) |
Checks if a key exists in the store.
| kv | Pointer to the kv_store_t structure. |
| key | The key to check for existence. |
Definition at line 64 of file kv_store.c.
References foo, kv, and kv_find().
Here is the call graph for this function:Finds the index of a given key in the store.
| kv | Pointer to the kv_store_t structure. |
| key | The key to search for. |
| index | Pointer to a size_t where the index will be stored if found (can be NULL). |
Definition at line 42 of file kv_store.c.
References kv.
Referenced by kv_exists(), kv_get(), kv_remove(), and kv_set().
Here is the caller graph for this function:| void * kv_get | ( | const kv_store_t * | kv, |
| uint32_t | key | ||
| ) |
Retrieves the value associated with a given key.
| kv | Pointer to the kv_store_t structure. |
| key | The key to retrieve the value for. |
Definition at line 111 of file kv_store.c.
References foo, kv, and kv_find().
Referenced by get_transfer_id().
Here is the call graph for this function:
Here is the caller graph for this function:| void kv_init | ( | kv_store_t * | kv, |
| size_t | capacity, | ||
| size_t | esize, | ||
| uint32_t * | keys, | ||
| void * | values, | ||
| uint8_t * | used | ||
| ) |
Initializes a key-value store.
| kv | Pointer to the kv_store_t structure to initialize. |
| capacity | The maximum number of key-value pairs the store can hold. |
| esize | The size in bytes of each value element. |
| keys | Pointer to an array of uint32_t for storing keys. At least "capacity" long. |
| values | Pointer to the memory area for storing values. At least "capacity * esize" long. |
| used | Pointer to an array of uint8_t flags indicating if a slot is used. At least "capacity" long. |
Definition at line 20 of file kv_store.c.
References kv.
Referenced by uavcanInitIface().
Here is the caller graph for this function:| int kv_remove | ( | kv_store_t * | kv, |
| uint32_t | key | ||
| ) |
Removes a key-value pair from the store.
| kv | Pointer to the kv_store_t structure. |
| key | The key to remove. |
Definition at line 127 of file kv_store.c.
Here is the call graph for this function:| int kv_set | ( | kv_store_t * | kv, |
| uint32_t | key, | ||
| const void * | value | ||
| ) |
Sets a value for a given key.
If the key already exists, its value is updated. If not, a new key-value pair is inserted into the first available slot. If the store is full, the operation fails.
| kv | Pointer to the kv_store_t structure. |
| key | The key to set. |
| value | Pointer to the value to store. Value will be memcpy in the store, so the pointer does not need to be valid afterward. |
Definition at line 79 of file kv_store.c.
References foo, kv, and kv_find().
Referenced by get_transfer_id().
Here is the call graph for this function:
Here is the caller graph for this function: