#include "list.h"
#include "array.h"
Go to the source code of this file.
Classes | |
| struct | ds_data_t |
| struct | dataset_node |
Defines | |
| #define | DS_NOCOPY 0x01 |
| #define | DATASET_DEFAULT DATASET_HASH |
| #define | DS_NOTFOUND 0x00 /**< DS_FIND: Continue iteration */ |
| #define | DS_FOUND 0x02 /**< DS_FIND: Found, halt iteration */ |
| #define | DS_CONTINUE 0x01 /**< DS_FOREACH: Continue iteration */ |
| #define | DS_BREAK 0x02 /**< DS_FOREACH: Halt iteration */ |
| #define | DS_REMOVE 0x04 /**< DS_FOREACH: Remove the node */ |
| #define | DS_FOREACH(func) ((DatasetForeachFn)func) |
| #define | DS_FOREACH_EX(func) ((DatasetForeachExFn)func) |
| #define | DS_FIND(func) ((DatasetFindFn)func) |
Typedefs | |
| typedef dataset | Dataset |
| typedef dataset_node | DatasetNode |
| typedef void(* | DatasetForeachFn )(ds_data_t *key, ds_data_t *value, void *udata) |
| typedef int(* | DatasetForeachExFn )(ds_data_t *key, ds_data_t *value, void *udata) |
| typedef DatasetForeachExFn | DatasetFindFn |
Enumerations | |
| enum | DatasetType { DATASET_LIST, DATASET_ARRAY, DATASET_HASH } |
Functions | |
| EXTERN_C_BEGIN LIBGIFT_EXPORT Dataset * | dataset_new (DatasetType type) |
| LIBGIFT_EXPORT void | dataset_clear (Dataset *d) |
| LIBGIFT_EXPORT void | ds_data_init (ds_data_t *dsdata, const void *data, size_t len, int flags) |
| LIBGIFT_EXPORT DatasetNode * | dataset_insert_ex (Dataset **d, ds_data_t *key, ds_data_t *value) |
| LIBGIFT_EXPORT DatasetNode * | dataset_insert (Dataset **d, const void *key, size_t key_len, const void *value, size_t value_len) |
| LIBGIFT_EXPORT DatasetNode * | dataset_insertstr (Dataset **d, const char *key, const char *value) |
| LIBGIFT_EXPORT void | dataset_remove_ex (Dataset *d, ds_data_t *key) |
| LIBGIFT_EXPORT void | dataset_remove (Dataset *d, const void *key, size_t key_len) |
| LIBGIFT_EXPORT void | dataset_removestr (Dataset *d, const char *key) |
| LIBGIFT_EXPORT void | dataset_remove_node (Dataset *d, DatasetNode *node) |
| LIBGIFT_EXPORT ds_data_t * | dataset_lookup_ex (Dataset *d, ds_data_t *key) |
| LIBGIFT_EXPORT void * | dataset_lookup (Dataset *d, const void *key, size_t key_len) |
| LIBGIFT_EXPORT void * | dataset_lookupstr (Dataset *d, const char *key) |
| LIBGIFT_EXPORT DatasetNode * | dataset_lookup_node_ex (Dataset *d, ds_data_t *key) |
| LIBGIFT_EXPORT DatasetNode * | dataset_lookup_node (Dataset *d, const void *key, size_t key_len) |
| LIBGIFT_EXPORT void | dataset_foreach (Dataset *d, DatasetForeachFn func, void *udata) |
| LIBGIFT_EXPORT void | dataset_foreach_ex (Dataset *d, DatasetForeachExFn func, void *udata) |
| LIBGIFT_EXPORT void * | dataset_find (Dataset *d, DatasetFindFn func, void *udata) |
| LIBGIFT_EXPORT DatasetNode * | dataset_find_node (Dataset *d, DatasetFindFn func, void *udata) |
| LIBGIFT_EXPORT unsigned int | dataset_length (Dataset *d) |
| LIBGIFT_EXPORT List * | dataset_flatten (Dataset *d) |
| LIBGIFT_EXPORT uint32_t | dataset_uniq32 (Dataset *d, uint32_t *counter) |
Flexible data structure used for management of arbitrary sets of data. Currently supports a hash table and a linked list backend, btree should come soon.
|
|
DS_FOREACH: Halt iteration |
|
|
DS_FOREACH: Continue iteration |
|
|
Helper macro for properly typecasting iterator functions. |
|
|
DS_FIND: Found, halt iteration |
|
|
DS_FIND: Continue iteration |
|
|
DS_FOREACH: Remove the node |
|
|
Extended dataset iterator capable of basic flow control and removal of entries as you pass by them.
|
|
|
Main dataset iterator callback. See DatasetForeachExFn for the extended type. |
|
|
Selects the backend data structure implementation for the dataset to use. |
|
|
Unallocate a dataset and all internally allocated variables. |
|
||||||||||||||||
|
Locate a set value through iteration. See dataset_find_node.
|
|
||||||||||||||||
|
Locate a dataset node through iteration. DatasetForeach returns TRUE when the set has been found. |
|
|
Flatten a dataset to a reallocated list. The values are not copied. |
|
||||||||||||||||
|
Iterate an entire dataset. This is the simplest form and does not have any kind of flow control of extended features.
|
|
||||||||||||||||
|
Extended iterator for the dataset capable of simple flow control and removal of entries as you pass over them. See dataset_foreach for more details. |
|
||||||||||||||||||||||||
|
Insert a new key/value set. If the value at d is NULL, a new dataset will be allocated using DATASET_DEFAULT.
|
|
||||||||||||||||
|
Base implementation for dataset_insert and dataset_insertstr. |
|
||||||||||||||||
|
Wrapper around dataset_insert for string constants. Copies both key and value. |
|
|
Calculate the dataset length (total number of sets currently inserted). Please note that the DATASET_LIST backend requires iteration to perform this task and as such is considered expensive.
|
|
||||||||||||||||
|
Lookup a value by the set's key. If you need to know the value_len, consider using dataset_lookup_node. |
|
||||||||||||
|
Base implementation for dataset_lookup and dataset_lookupstr. |
|
||||||||||||||||
|
Lookup a complete set by the set's key. Similar to dataset_lookup except that the full set is returned. |
|
||||||||||||
|
Base implementation for dataset_lookup_node. |
|
||||||||||||
|
Wrapper around dataset_lookup for aggregate string constants. |
|
|
Allocate a new dataset. Using this function is optional, see dataset_insert for more information.
|
|
||||||||||||||||
|
Remove a key/value set by the key. |
|
||||||||||||
|
Base implementation for dataset_remove and dataset_removestr. |
|
||||||||||||
|
Perform a remove operation from the original lookup node. No extra lookup will be performed. |
|
||||||||||||
|
Wrapped around dataset_remove for string constants. |
|
||||||||||||
|
Find a unique, non-zero 32-bit value that is not contained in the dataset. Assumes that the dataset contains integers.
|
|
||||||||||||||||||||
|
Initialize a ds_data_t element for use with the extended dataset interface. Example usage:
|
1.3.7