|
SafeTypes2
|
The dict key-value mapping contaier type. More...
Macros | |
| #define | s2_is_dict(obj) |
| #define | s2dict_get_T(membertype) |
Functions | |
| void | siphash_setkey (void const *restrict in, size_t inlen) |
| Sets the randomization vector for hash tables globally. | |
| T * | s2dict_create () |
| Creates and returns an empty dictionary map. | |
| int | s2dict_get (T *dict, s2data_t *key, s2obj_t **out) |
| int | s2dict_set (T *dict, s2data_t *key, s2obj_t *value, int semantic) |
| int | s2dict_unset (T *dict, s2data_t *key) |
| unsets a key from a dict. | |
The dict key-value mapping contaier type.
| #define s2_is_dict | ( | obj | ) |
| obj | the object handle the type of which is being checked. |
| #define s2dict_get_T | ( | membertype | ) |
| membertype | the type of the object the handle would point to. |
The type-safe method to get a value object without type casting. Invoked as: s2dict_get_T(type)(dict, key, out). Defined as a marcro in terms of s2dict_get.
| T * s2dict_create | ( | ) |
Creates and returns an empty dictionary map.
| dict | the dict from which a member is retrieved using a data key. |
| key | the said data key. |
| out | the pointer to the object handle where the retrieved object will be stored. |
''refcnt'' and ''keptcnt'' are not incremented, because they're still available from the dict (i.e. not unset). They have to be explicitly retained.
s2_access_success is returned when an object is successfully retrieved. s2_access_nullval is returned on success, when the key is unset. s2_access_error is returned on error. See s2containers.h for further detail. | dict | the dict to which a value object will be set using a data key. |
| key | the said key. |
| value | the said value object. |
| semantic | the setter semantic, see file s2containers.h. |
Sets a value object into dict at key. If there exists a value at the key, it's first released by s2obj_leave.
If semantic is s2_setter_kept, then reference count stays the same while kept count is incremented. If semantic is s2_setter_gave, then reference count is decremented while kept count is incremented. See s2containers.h for further detail.
s2_access_success is returned when an object is successfully retrieved. s2_access_error is returned on error. See s2containers.h for further detail. | int s2dict_unset | ( | T * | dict, |
| s2data_t * | key ) |
unsets a key from a dict.
| dict | the dict from which a key will be unset. |
| key | the key to unset. |
s2_access_success is returned when an object is successfully retrieved. s2_access_error is returned on error. See s2containers.h for further detail. | void siphash_setkey | ( | void const *restrict | in, |
| size_t | inlen ) |
Sets the randomization vector for hash tables globally.
| in | the randomization vector data. |
| inlen | the length of the data. |