A dictionary (also known as hashtable or hashmap). Internally the dictionary uses an array to holds its data. If this array reaches a load-factor of 75%, a new array with twice the size will be allocated and the items are then copied over. This ensures that the dictionary will perform operations in O(1).
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=*), | private, | parameter | :: | moduleN | = | 'dbcsr_dict' |
Allocates the internal data-structures of the given dictionary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict | |||
integer, | intent(in), | optional | :: | initial_capacity |
The initial size of the internal array (default=11). |
Allocates the internal data-structures of the given dictionary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict | |||
integer, | intent(in), | optional | :: | initial_capacity |
The initial size of the internal array (default=11). |
Checks whether a given key is currently stored in the dictionary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict | |||
character(len=default_string_length) | :: | key |
Checks whether a given key is currently stored in the dictionary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict | |||
integer(kind=int_4), | dimension(2) | :: | key |
Stores, and possibly overwrites, a given value under a given key.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict | |||
character(len=default_string_length), | intent(in) | :: | key | |||
integer(kind=int_4), | intent(in) | :: | value |
Stores, and possibly overwrites, a given value under a given key.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict | |||
integer(kind=int_4), | intent(in), | dimension(2) | :: | key | ||
type(call_stat_type), | intent(in), | POINTER | :: | value |
Gets a value for a given key from the dictionary. If the key is not found the default_value will be returned. If the key is not found and default_value was not provided the program stops.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict | |||
character(len=default_string_length) | :: | key | ||||
integer(kind=int_4), | intent(in), | optional | :: | default_value |
Gets a value for a given key from the dictionary. If the key is not found the default_value will be returned. If the key is not found and default_value was not provided the program stops.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict | |||
integer(kind=int_4), | dimension(2) | :: | key | |||
type(call_stat_type), | intent(in), | optional, | POINTER | :: | default_value |
Returns a pointer to an array of all key/value-items stored in the dictionary. Caution: The caller is responsible for deallocating targeted array after usage.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict |
Returns a pointer to an array of all key/value-items stored in the dictionary. Caution: The caller is responsible for deallocating targeted array after usage.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict |
Returns the number of key/value-items currently stored in the dictionary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict |
Returns the number of key/value-items currently stored in the dictionary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict |
Deallocated the internal data-structures if the given dictionary. Caution: If the stored keys or values are pointers, their targets will not get deallocated by this routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict |
Deallocated the internal data-structures if the given dictionary. Caution: If the stored keys or values are pointers, their targets will not get deallocated by this routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=default_string_length), | private | :: | key | = | "" | ||
integer(kind=int_4), | private | :: | value | = | -1_int_4 | ||
integer(kind=int_8), | private | :: | hash | = | -1_int_8 | ||
type(private_item_type_str_i4), | private, | POINTER | :: | next | => | Null() |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(private_item_type_str_i4), | private, | POINTER | :: | p | => | Null() |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(private_item_p_type_str_i4), | private, | DIMENSION(:), POINTER | :: | buckets | => | Null() | |
integer, | private | :: | size | = | -1 |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=default_string_length), | public | :: | key | = | "" | ||
integer(kind=int_4), | public | :: | value | = | -1_int_4 |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=int_4), | private, | dimension(2) | :: | key | = | -1_int_4 | |
type(call_stat_type), | private, | POINTER | :: | value | => | NULL() | |
integer(kind=int_8), | private | :: | hash | = | -1_int_8 | ||
type(private_item_type_i4tuple_callstat), | private, | POINTER | :: | next | => | Null() |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(private_item_type_i4tuple_callstat), | private, | POINTER | :: | p | => | Null() |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(private_item_p_type_i4tuple_callstat), | private, | DIMENSION(:), POINTER | :: | buckets | => | Null() | |
integer, | private | :: | size | = | -1 |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=int_4), | public, | dimension(2) | :: | key | = | -1_int_4 | |
type(call_stat_type), | public, | POINTER | :: | value | => | NULL() |
This is joaat_hash from string_table.F, generates the hash of a given string
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | key |
key a string of any length |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=int_4), | intent(in), | dimension(2) | :: | key |
Gets a value for a given key from the dictionary. If the key is not found the default_value will be returned. If the key is not found and default_value was not provided the program stops.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict | |||
character(len=default_string_length) | :: | key | ||||
integer(kind=int_4), | intent(in), | optional | :: | default_value |
Returns the number of key/value-items currently stored in the dictionary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict |
Checks whether a given key is currently stored in the dictionary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict | |||
character(len=default_string_length) | :: | key |
Returns a pointer to an array of all key/value-items stored in the dictionary. Caution: The caller is responsible for deallocating targeted array after usage.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict |
Gets a value for a given key from the dictionary. If the key is not found the default_value will be returned. If the key is not found and default_value was not provided the program stops.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict | |||
integer(kind=int_4), | dimension(2) | :: | key | |||
type(call_stat_type), | intent(in), | optional, | POINTER | :: | default_value |
Returns the number of key/value-items currently stored in the dictionary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict |
Checks whether a given key is currently stored in the dictionary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict | |||
integer(kind=int_4), | dimension(2) | :: | key |
Returns a pointer to an array of all key/value-items stored in the dictionary. Caution: The caller is responsible for deallocating targeted array after usage.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict |
Allocates the internal data-structures of the given dictionary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict | |||
integer, | intent(in), | optional | :: | initial_capacity |
The initial size of the internal array (default=11). |
Deallocated the internal data-structures if the given dictionary. Caution: If the stored keys or values are pointers, their targets will not get deallocated by this routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict |
Stores, and possibly overwrites, a given value under a given key.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict | |||
character(len=default_string_length), | intent(in) | :: | key | |||
integer(kind=int_4), | intent(in) | :: | value |
Common code used internally by dict_set() and change_capacity().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict | |||
character(len=default_string_length), | intent(in) | :: | key | |||
integer(kind=int_4), | intent(in) | :: | value | |||
integer(kind=int_8), | intent(in) | :: | hash |
Internal routine for changing the dictionary's capacity.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_str_i4_type), | intent(inout) | :: | dict | |||
integer, | intent(in) | :: | new_capacity |
Allocates the internal data-structures of the given dictionary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict | |||
integer, | intent(in), | optional | :: | initial_capacity |
The initial size of the internal array (default=11). |
Deallocated the internal data-structures if the given dictionary. Caution: If the stored keys or values are pointers, their targets will not get deallocated by this routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict |
Stores, and possibly overwrites, a given value under a given key.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict | |||
integer(kind=int_4), | intent(in), | dimension(2) | :: | key | ||
type(call_stat_type), | intent(in), | POINTER | :: | value |
Common code used internally by dict_set() and change_capacity().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict | |||
integer(kind=int_4), | intent(in), | dimension(2) | :: | key | ||
type(call_stat_type), | intent(in), | POINTER | :: | value | ||
integer(kind=int_8), | intent(in) | :: | hash |
Internal routine for changing the dictionary's capacity.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict | |||
integer, | intent(in) | :: | new_capacity |