SimGrid  3.13
Versatile Simulation of Distributed Systems
dict.c File Reference
#include <string.h>
#include <stdio.h>
#include "xbt/ex.h"
#include "xbt/log.h"
#include "xbt/mallocator.h"
#include "src/xbt_modinter.h"
#include "xbt/str.h"
#include "dict_private.h"

Functions

 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (xbt_dict, xbt,"Dictionaries provide the same functionalities as hash tables")
 
xbt_dict_t xbt_dict_new (void)
 Constructor. More...
 
xbt_dict_t xbt_dict_new_homogeneous (void_f_pvoid_t free_ctn)
 Constructor. More...
 
void xbt_dict_free (xbt_dict_t *dict)
 Destructor. More...
 
unsigned int xbt_dict_size (xbt_dict_t dict)
 Returns the amount of elements in the dict. More...
 
static void xbt_dict_rehash (xbt_dict_t dict)
 
void xbt_dict_set_ext (xbt_dict_t dict, const char *key, int key_len, void *data, void_f_pvoid_t free_ctn)
 Add data to the dict (arbitrary key) More...
 
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) More...
 
voidxbt_dict_get_ext (xbt_dict_t dict, const char *key, int key_len)
 Retrieve data from the dict (arbitrary key) More...
 
voidxbt_dict_get_or_null_ext (xbt_dict_t dict, const char *key, int key_len)
 like xbt_dict_get_ext(), but returning NULL when not found More...
 
char * xbt_dict_get_key (xbt_dict_t dict, const void *data)
 retrieve the key associated to that object. More...
 
char * xbt_dict_get_elm_key (xbt_dictelm_t elm)
 retrieve the key associated to that xbt_dictelm_t. More...
 
voidxbt_dict_get (xbt_dict_t dict, const char *key)
 Retrieve data from the dict (null-terminated key) More...
 
xbt_dictelm_t xbt_dict_get_elm (xbt_dict_t dict, const char *key)
 Retrieve element from the dict (null-terminated key) More...
 
voidxbt_dict_get_or_null (xbt_dict_t dict, const char *key)
 like xbt_dict_get(), but returning NULL when not found More...
 
xbt_dictelm_t xbt_dict_get_elm_or_null (xbt_dict_t dict, const char *key)
 like xbt_dict_get_elm(), but returning NULL when not found More...
 
void xbt_dict_remove_ext (xbt_dict_t dict, const char *key, int key_len)
 Remove data from the dict (arbitrary key) More...
 
void xbt_dict_remove (xbt_dict_t dict, const char *key)
 Remove data from the dict (null-terminated key) More...
 
void xbt_dict_reset (xbt_dict_t dict)
 Remove all data from the dict. More...
 
int xbt_dict_length (xbt_dict_t dict)
 Return the number of elements in the dict. More...
 
void xbt_dict_dump_output_string (void *s)
 function to be used in xbt_dict_dump as long as the stored values are strings More...
 
int xbt_dict_is_empty (xbt_dict_t dict)
 test if the dict is empty or not More...
 
void xbt_dict_dump (xbt_dict_t dict, void_f_pvoid_t output)
 Outputs the content of the structure (debugging purpose) More...
 
void xbt_dict_dump_sizes (xbt_dict_t dict)
 shows some debugging info about the bucklet repartition More...
 
void xbt_dict_preinit (void)
 Create the dict mallocators. More...
 
void xbt_dict_postexit (void)
 Destroy the dict mallocators. More...
 

Variables

xbt_dynar_t all_sizes = NULL
 

Function Documentation

XBT_LOG_NEW_DEFAULT_SUBCATEGORY ( xbt_dict  ,
xbt  ,
"Dictionaries provide the same functionalities as hash tables"   
)
static void xbt_dict_rehash ( xbt_dict_t  dict)
static
void xbt_dict_preinit ( void  )

Create the dict mallocators.

This is an internal XBT function called during the lib initialization. It can be used several times to recreate the mallocator, for example when you switch to MC mode

void xbt_dict_postexit ( void  )

Destroy the dict mallocators.

This is an internal XBT function during the lib initialization

Variable Documentation

xbt_dynar_t all_sizes = NULL