SimGrid  3.11
Versatile Simulation of Distributed Systems
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Dict: generic dictionnary

The dictionary data structure (comparable to hash tables) More...

Modules

 Dict constructor and destructor
 
 Dictionaries basic usage
 
 Dictionaries with non-nul terminated keys
 
 Cursors on dictionaries
 

Detailed Description

The dictionary data structure (comparable to hash tables)

This section describes the API to a dictionary structure that associates as string to a void* key. It provides the same functionality than an hash table.

Here is a little example of use:

 xbt_dict_t mydict = xbt_dict_new();
 char buff[512];

 sprintf(buff,"some very precious data");
 xbt_dict_set(mydict,"my data", strdup(buff), free);

 sprintf(buff,"another good stuff");
 xbt_dict_set(mydict,"my data", strdup(buff), free); // previous data gets erased (and freed) by second add