#include "gi_list.h"
#include "array.h"
Go to the source code of this file.
Classes | |
| struct | ds_data_t |
| struct | gi_dataset_node |
Defines | |
| #define | DS_NOCOPY 0x01 |
| #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_RETURN(ret) ((ret) & 0x03) |
| #define | DS_FOREACH(func) ((GiDatasetForeachFn)func) |
| #define | DS_FOREACH_EX(func) ((GiDatasetForeachExFn)func) |
| #define | DS_FIND(func) ((GiDatasetFindFn)func) |
Typedefs | |
| typedef gi_dataset_node | GiDatasetNode |
| typedef gi_dataset | GiDataset |
| typedef void(* | GiDatasetForeachFn )(ds_data_t *key, ds_data_t *value, void *udata) |
| typedef int(* | GiDatasetForeachExFn )(ds_data_t *key, ds_data_t *value, void *udata) |
| typedef GiDatasetForeachExFn | GiDatasetFindFn |
Enumerations | |
| enum | GiDatasetType { GI_DATASET_LIST, GI_DATASET_ARRAY, GI_DATASET_HASH, GI_DATASET_DEFAULT = GI_DATASET_HASH } |
Functions | |
| EXTERN_C_BEGIN LIBGIFT_EXPORT GiDataset * | gi_dataset_new (GiDatasetType type) |
| LIBGIFT_EXPORT void | gi_dataset_clear (GiDataset *d) |
| LIBGIFT_EXPORT void | gi_dataset_destroy (GiDataset **d) |
| LIBGIFT_EXPORT void | ds_data_init (ds_data_t *dsdata, const void *data, size_t len, int flags) |
| LIBGIFT_EXPORT GiDatasetNode * | gi_dataset_insert_ex (GiDataset **d, ds_data_t *key, ds_data_t *value) |
| LIBGIFT_EXPORT GiDatasetNode * | gi_dataset_insert (GiDataset **d, const void *key, size_t key_len, const void *value, size_t value_len) |
| LIBGIFT_EXPORT GiDatasetNode * | gi_dataset_insertstr (GiDataset **d, const char *key, const char *value) |
| LIBGIFT_EXPORT void | gi_dataset_remove_ex (GiDataset *d, ds_data_t *key) |
| LIBGIFT_EXPORT void | gi_dataset_remove (GiDataset *d, const void *key, size_t key_len) |
| LIBGIFT_EXPORT void | gi_dataset_removestr (GiDataset *d, const char *key) |
| LIBGIFT_EXPORT void | gi_dataset_remove_node (GiDataset *d, GiDatasetNode *node) |
| LIBGIFT_EXPORT ds_data_t * | gi_dataset_lookup_ex (GiDataset *d, ds_data_t *key) |
| LIBGIFT_EXPORT void * | gi_dataset_lookup (GiDataset *d, const void *key, size_t key_len) |
| LIBGIFT_EXPORT void * | gi_dataset_lookupstr (GiDataset *d, const char *key) |
| LIBGIFT_EXPORT GiDatasetNode * | gi_dataset_lookup_node_ex (GiDataset *d, ds_data_t *key) |
| LIBGIFT_EXPORT GiDatasetNode * | gi_dataset_lookup_node (GiDataset *d, const void *key, size_t key_len) |
| LIBGIFT_EXPORT void | gi_dataset_foreach (GiDataset *d, GiDatasetForeachFn func, void *udata) |
| LIBGIFT_EXPORT void | gi_dataset_foreach_ex (GiDataset *d, GiDatasetForeachExFn func, void *udata) |
| LIBGIFT_EXPORT void * | gi_dataset_find (GiDataset *d, GiDatasetFindFn func, void *udata) |
| LIBGIFT_EXPORT GiDatasetNode * | gi_dataset_find_node (GiDataset *d, GiDatasetFindFn func, void *udata) |
| LIBGIFT_EXPORT unsigned int | gi_dataset_length (GiDataset *d) |
| LIBGIFT_EXPORT GiList * | gi_dataset_flatten (GiDataset *d) |
| LIBGIFT_EXPORT uint32_t | gi_dataset_uniq32 (GiDataset *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 GiDatasetForeachExFn for the extended type. |
|
|
Describes a specific key/value set. |
|
|
Selects the backend data structure implementation for the dataset to use. |
|
||||||||||||||||||||
|
Initialize a ds_data_t element for use with the extended dataset interface. Example usage:
|
|
|
Clear all internally allocated data entries, but do not destroy the dataset handle itself. |
|
|
Unallocate a dataset and clear all internally allocated data members. |
|
||||||||||||||||
|
Locate a set value through iteration. See gi_dataset_find_node.
|
|
||||||||||||||||
|
Locate a dataset node through iteration. GiDatasetForeach 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 gi_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 GI_DATASET_DEFAULT.
|
|
||||||||||||||||
|
Base implementation for gi_dataset_insert and gi_dataset_insertstr. |
|
||||||||||||||||
|
Wrapper around gi_dataset_insert for string constants. Copies both key and value. |
|
|
Calculate the dataset length (total number of sets currently inserted). Please note that the GI_gi_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 gi_dataset_lookup_node. |
|
||||||||||||
|
Base implementation for gi_dataset_lookup and gi_dataset_lookupstr. |
|
||||||||||||||||
|
Lookup a complete set by the set's key. Similar to gi_dataset_lookup except that the full set is returned. |
|
||||||||||||
|
Base implementation for gi_dataset_lookup_node. |
|
||||||||||||
|
Wrapper around gi_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 gi_dataset_remove and gi_dataset_removestr. |
|
||||||||||||
|
Perform a remove operation from the original lookup node. No extra lookup will be performed. |
|
||||||||||||
|
Wrapped around gi_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.
|
1.3.7