Documentation for module dict

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).

source: dict.F
Loading...

public Types:

dict_i4tuple_callstat_type
...
dict_i4tuple_callstat_item_type
...
dict_str_i4_item_type
...
dict_str_i4_type
...

Generic procedures:

dict_destroy
dict_get
dict_haskey
dict_init
dict_items
dict_set
dict_size

public Types:

TYPE :: dict_i4tuple_callstat_item_type

...


INTEGER(int_4),
DIMENSION(2) :: key ...
POINTER :: value ...

TYPE :: dict_i4tuple_callstat_type

...


DIMENSION(:), POINTER :: buckets => NULL() ...
INTEGER
:: size = -1 ...

TYPE :: dict_str_i4_item_type

...


:: key ...
INTEGER(int_4)
:: value ...

TYPE :: dict_str_i4_type

...


DIMENSION(:), POINTER :: buckets => NULL() ...
INTEGER
:: size = -1 ...


Generic procedure dict_destroy

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.

INTENT(inout)
:: dict ×
INTENT(inout)
:: dict ×

Generic procedure dict_get

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.

INTENT(inout)
:: dict ×
INTENT(inout)
:: dict ×
:: key ×
INTEGER(int_4)
:: key(2) ×
INTEGER(int_4),
INTENT(in),
OPTIONAL
:: default_value ×
INTENT(in),
POINTER, OPTIONAL
:: default_value ×

Generic procedure dict_haskey

Checks whether a given key is currently stored in the dictionary.

INTENT(inout)
:: dict ×
INTENT(inout)
:: dict ×
:: key ×
INTEGER(int_4)
:: key(2) ×

Generic procedure dict_init

Allocates the internal data-structures of the given dictionary.

INTENT(inout)
:: dict ×
INTENT(inout)
:: dict ×
INTEGER,
INTENT(in),
OPTIONAL
:: initial_capacity × ×

Generic procedure dict_items

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.

INTENT(inout)
:: dict ×
INTENT(inout)
:: dict ×

Generic procedure dict_set

Stores, and possibly overwrites, a given value under a given key.

INTENT(inout)
:: dict ×
INTENT(inout)
:: dict ×
INTENT(in)
:: key ×
INTEGER(int_4),
INTENT(in)
:: key(2) ×
INTEGER(int_4),
INTENT(in)
:: value ×
INTENT(in),
POINTER
:: value ×

Generic procedure dict_size

Returns the number of key/value-items currently stored in the dictionary.

INTENT(inout)
:: dict ×
INTENT(inout)
:: dict ×

SUBROUTINEdict_str_i4_destroy(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.

Arguments:
INTENT(inout)
:: dict ...

SUBROUTINEdict_i4tuple_callstat_destroy(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.

Arguments:
INTENT(inout)
:: dict ...

FUNCTIONdict_str_i4_get(dict, key, 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.

Return Value ::
INTEGER(int_4)
Arguments:
INTENT(inout)
:: dict ...
:: key ...
INTEGER(int_4),
INTENT(in),
OPTIONAL
:: default_value ...

FUNCTIONdict_i4tuple_callstat_get(dict, key, 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.

Return Value ::
Arguments:
INTENT(inout)
:: dict ...
INTEGER(int_4)
:: key(2) ...
INTENT(in),
POINTER, OPTIONAL
:: default_value ...

FUNCTIONdict_str_i4_haskey(dict, key)

Checks whether a given key is currently stored in the dictionary.

Return Value ::
LOGICAL
Arguments:
INTENT(inout)
:: dict ...
:: key ...

FUNCTIONdict_i4tuple_callstat_haskey(dict, key)

Checks whether a given key is currently stored in the dictionary.

Return Value ::
LOGICAL
Arguments:
INTENT(inout)
:: dict ...
INTEGER(int_4)
:: key(2) ...

SUBROUTINEdict_str_i4_init(dict, initial_capacity)

Allocates the internal data-structures of the given dictionary.

Arguments:
INTENT(inout)
:: dict ...
INTEGER,
INTENT(in),
OPTIONAL
:: initial_capacity The initial size of the internal array (default=11).

SUBROUTINEdict_i4tuple_callstat_init(dict, initial_capacity)

Allocates the internal data-structures of the given dictionary.

Arguments:
INTENT(inout)
:: dict ...
INTEGER,
INTENT(in),
OPTIONAL
:: initial_capacity The initial size of the internal array (default=11).

FUNCTIONdict_str_i4_items(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.

Return Value ::
Arguments:
INTENT(inout)
:: dict ...

FUNCTIONdict_i4tuple_callstat_items(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.

Return Value ::
Arguments:
INTENT(inout)
:: dict ...

SUBROUTINEdict_str_i4_set(dict, key, value)

Stores, and possibly overwrites, a given value under a given key.

Arguments:
INTENT(inout)
:: dict ...
INTENT(in)
:: key ...
INTEGER(int_4),
INTENT(in)
:: value ...

SUBROUTINEdict_i4tuple_callstat_set(dict, key, value)

Stores, and possibly overwrites, a given value under a given key.

Arguments:
INTENT(inout)
:: dict ...
INTEGER(int_4),
INTENT(in)
:: key(2) ...
INTENT(in),
POINTER
:: value ...

FUNCTIONdict_str_i4_size(dict)

Returns the number of key/value-items currently stored in the dictionary.

Return Value ::
INTEGER
Arguments:
INTENT(inout)
:: dict ...

FUNCTIONdict_i4tuple_callstat_size(dict)

Returns the number of key/value-items currently stored in the dictionary.

Return Value ::
INTEGER
Arguments:
INTENT(inout)
:: dict ...

private Parameters/Types:

private Types:

TYPE :: private_item_p_type_i4tuple_callstat

...


POINTER :: p => NULL() ...

TYPE :: private_item_p_type_str_i4

...


POINTER :: p => NULL() ...

TYPE :: private_item_type_i4tuple_callstat

...


INTEGER(int_4),
DIMENSION(2) :: key ...
POINTER :: value ...
INTEGER(int_8)
:: hash ...
POINTER :: next => NULL() ...

TYPE :: private_item_type_str_i4

...


:: key ...
INTEGER(int_4)
:: value ...
INTEGER(int_8)
:: hash ...
POINTER :: next => NULL() ...