}
/** Returns the amount of elements in the dict */
-unsigned int xbt_dict_size(xbt_dict_t dict)
+unsigned int xbt_dict_size(const_xbt_dict_t dict)
{
return (dict != nullptr ? static_cast<unsigned int>(dict->count) : static_cast<unsigned int>(0));
}
*
* Search the given @a key. Throws std::out_of_range when not found.
*/
-void *xbt_dict_get_ext(xbt_dict_t dict, const char *key, int key_len)
+void* xbt_dict_get_ext(const_xbt_dict_t dict, const char* key, int key_len)
{
unsigned int hash_code = xbt_str_hash_ext(key, key_len);
const s_xbt_dictelm* current = dict->table[hash_code & dict->table_size];
}
/** @brief like xbt_dict_get_ext(), but returning nullptr when not found */
-void *xbt_dict_get_or_null_ext(xbt_dict_t dict, const char *key, int key_len)
+void* xbt_dict_get_or_null_ext(const_xbt_dict_t dict, const char* key, int key_len)
{
unsigned int hash_code = xbt_str_hash_ext(key, key_len);
const s_xbt_dictelm* current = dict->table[hash_code & dict->table_size];
*
* Returns nullptr if the object cannot be found
*/
-char *xbt_dict_get_key(xbt_dict_t dict, const void *data)
+char* xbt_dict_get_key(const_xbt_dict_t dict, const void* data)
{
for (int i = 0; i <= dict->table_size; i++) {
const s_xbt_dictelm* current = dict->table[i];
* Search the given @a key. Throws std::out_of_range when not found.
* Check xbt_dict_get_or_null() for a version returning nullptr without exception when not found.
*/
-void *xbt_dict_get(xbt_dict_t dict, const char *key)
+void* xbt_dict_get(const_xbt_dict_t dict, const char* key)
{
return xbt_dict_get_elm(dict, key)->content;
}
* Search the given @a key. Throws std::out_of_range when not found.
* Check xbt_dict_get_or_null() for a version returning nullptr without exception when not found.
*/
-xbt_dictelm_t xbt_dict_get_elm(xbt_dict_t dict, const char *key)
+xbt_dictelm_t xbt_dict_get_elm(const_xbt_dict_t dict, const char* key)
{
xbt_dictelm_t current = xbt_dict_get_elm_or_null(dict, key);
/**
* @brief like xbt_dict_get(), but returning nullptr when not found
*/
-void *xbt_dict_get_or_null(xbt_dict_t dict, const char *key)
+void* xbt_dict_get_or_null(const_xbt_dict_t dict, const char* key)
{
const s_xbt_dictelm* current = xbt_dict_get_elm_or_null(dict, key);
/**
* @brief like xbt_dict_get_elm(), but returning nullptr when not found
*/
-xbt_dictelm_t xbt_dict_get_elm_or_null(xbt_dict_t dict, const char *key)
+xbt_dictelm_t xbt_dict_get_elm_or_null(const_xbt_dict_t dict, const char* key)
{
unsigned int hash_code = xbt_str_hash(key);
xbt_dictelm_t current = dict->table[hash_code & dict->table_size];
* @brief Return the number of elements in the dict.
* @param dict a dictionary
*/
-int xbt_dict_length(xbt_dict_t dict)
+int xbt_dict_length(const_xbt_dict_t dict)
{
return dict->count;
}
/**
* @brief test if the dict is empty or not
*/
-int xbt_dict_is_empty(xbt_dict_t dict)
+int xbt_dict_is_empty(const_xbt_dict_t dict)
{
return not dict || (xbt_dict_length(dict) == 0);
}