Detailed Description
Careful, those functions assume that the key is null-terminated.
Function Documentation
void xbt_dict_set |
( |
xbt_dict_t |
dict, |
|
|
const char * |
key, |
|
|
void * |
data, |
|
|
void_f_pvoid_t |
free_ctn | |
|
) |
| | |
Add data to the dict (null-terminated key).
- Parameters:
-
| dict | the dict |
| key | the key to set the new data |
| data | the data to add in the dict |
| free_ctn | function to call with (key as argument) when key is removed from the dictionary |
set the data in the structure under the key, which is a null terminated string.
void* xbt_dict_get |
( |
xbt_dict_t |
dict, |
|
|
const char * |
key | |
|
) |
| | |
Retrieve data from the dict (null-terminated key).
- Parameters:
-
| dict | the dealer of data |
| key | the key to find data |
- Returns:
- the data that we are looking for
Search the given key. Throws not_found_error when not found. Check xbt_dict_get_or_null() for a version returning NULL without exception when not found.
char* xbt_dict_get_key |
( |
xbt_dict_t |
dict, |
|
|
const void * |
data | |
|
) |
| | |
retrieve the key associated to that object. Warning, that's a linear search
Returns NULL if the object cannot be found
void xbt_dict_remove |
( |
xbt_dict_t |
dict, |
|
|
const char * |
key | |
|
) |
| | |
Remove data from the dict (null-terminated key).
- Parameters:
-
| dict | the dict |
| key | the key of the data to be removed |
Remove the entry associated with the given key
Remove all data from the dict.
- Parameters:
-
Return the number of elements in the dict.
- Parameters:
-