hasty_dictionary Module

module~~hasty_dictionary~~UsesGraph module~hasty_dictionary hasty_dictionary module~penf penf module~penf->module~hasty_dictionary module~hasty_key_base hasty_key_base module~penf->module~hasty_key_base module~hasty_dictionary_node hasty_dictionary_node module~penf->module~hasty_dictionary_node module~hasty_key_base->module~hasty_dictionary module~hasty_key_base->module~hasty_dictionary_node module~hasty_dictionary_node->module~hasty_dictionary module~penf_global_parameters_variables penf_global_parameters_variables module~penf_global_parameters_variables->module~penf module~penf_b_size penf_b_size module~penf_global_parameters_variables->module~penf_b_size module~penf_stringify penf_stringify module~penf_global_parameters_variables->module~penf_stringify module~penf_b_size->module~penf module~penf_b_size->module~penf_stringify module~penf_stringify->module~penf iso_fortran_env iso_fortran_env iso_fortran_env->module~penf_stringify module~hasty_content_adt hasty_content_adt module~hasty_content_adt->module~hasty_dictionary_node
Help

HASTY dictionary class.

Used By

module~~hasty_dictionary~~UsedByGraph module~hasty_dictionary hasty_dictionary module~hasty_hash_table hasty_hash_table module~hasty_dictionary->module~hasty_hash_table module~hasty hasty module~hasty_dictionary->module~hasty module~hasty_hash_table->module~hasty program~hasty_test_caf_basic hasty_test_caf_basic module~hasty->program~hasty_test_caf_basic program~hasty_test_hash_table_homo hasty_test_hash_table_homo module~hasty->program~hasty_test_hash_table_homo program~hasty_test_hash_table_homocontent_failure hasty_test_hash_table_homocontent_failure module~hasty->program~hasty_test_hash_table_homocontent_failure program~hasty_test_caf_get_clone hasty_test_caf_get_clone module~hasty->program~hasty_test_caf_get_clone program~hasty_test_hash_table_homokey_failure hasty_test_hash_table_homokey_failure module~hasty->program~hasty_test_hash_table_homokey_failure program~hasty_test_dictionary hasty_test_dictionary module~hasty->program~hasty_test_dictionary program~hasty_test_hash_table hasty_test_hash_table module~hasty->program~hasty_test_hash_table
Help


Interfaces

public interface len

Overload len builtin for accepting a dictionary.

  • private elemental function dictionary_len(self) result(length)

    Return the number of nodes of the dictionary, namely the dictionary length.

    Arguments

    Type IntentOptional AttributesName
    type(dictionary), intent(in) :: self

    The dictionary.

    Return Value integer(kind=I4P)

    The dictionary length.


Abstract Interfaces

abstract interface

Iterator procedure for traversing all nodes in a dictionary by keys.

  • public subroutine key_iterator_interface(key, content, done)

    Iterator procedure for traversing all nodes in a dictionary by keys.

    Arguments

    Type IntentOptional AttributesName
    class(*), intent(in) :: key

    The node key.

    class(*), intent(in), pointer:: content

    The generic content.

    logical, intent(out) :: done

    Flag to set to true to stop traversing.

abstract interface

Iterator procedure for traversing all nodes in a dictionary.

  • private subroutine iterator_interface(node, done)

    Iterator procedure for traversing all nodes in a dictionary.

    Arguments

    Type IntentOptional AttributesName
    type(dictionary_node), intent(in), pointer:: node

    Actual node pointer in the dictionary.

    logical, intent(out) :: done

    Flag to set to true to stop traversing.


Derived Types

type, public :: dictionary

Dictionary class to storage any contents by means of generic key/content pairs nodes.

Components

TypeVisibility AttributesNameInitial
type(dictionary_node), private, pointer:: head=> null()

The first node in the dictionary.

type(dictionary_node), private, pointer:: tail=> null()

The last node in the dictionary.

integer(kind=I4P), private :: nodes_number =0

Number of nodes in the dictionary.

integer(kind=I8P), private :: ids_(1:2) =[0, 0]

Minimum and maximum unique key id values actually stored.

Finalizations Procedures

final :: finalize

Finalize the dictionary.

Type-Bound Procedures

procedure, public, pass(self) :: add_pointer

Add a node pointer to the dictionary.

procedure, public, pass(self) :: add_clone

Add a node to the dictionary cloning contents (non pointer add).

procedure, public, pass(self) :: destroy

Destroy the dictionary.

procedure, public, pass(self) :: get_clone

Return a node's content by cloning.

procedure, public, pass(self) :: get_pointer

Return a pointer to a node's content.

procedure, public, pass(self) :: ids

Return the list of ids actually stored.

procedure, public, pass(self) :: has_key

Check if the key is present in the dictionary.

procedure, public, pass(self) :: loop

Sentinel while-loop on nodes returning the key/content pair (for dictionary looping).

procedure, public, pass(self) :: node

Return a pointer to a node in the dictionary.

procedure, public, pass(self) :: print_keys

Print the dictionary keys.

procedure, public, pass(self) :: remove

Remove a node from the dictionary, given the key.

procedure, public, pass(self) :: traverse

Traverse dictionary from head to tail calling the iterator procedure.

procedure, private, pass(self) :: add_id

Add a id to ids list.

procedure, private, pass(self) :: remove_by_pointer

Remove node from dictionary, given pointer to it.

procedure, private, pass(self) :: remove_id

Remove a id from ids list.

procedure, private, pass(self) :: traverse_iterator

Traverse dictionary from head to tail calling the iterator procedure.


Functions

private elemental function dictionary_len(self) result(length)

Return the number of nodes of the dictionary, namely the dictionary length.

Arguments

Type IntentOptional AttributesName
type(dictionary), intent(in) :: self

The dictionary.

Return Value integer(kind=I4P)

The dictionary length.

private function get_pointer(self, key) result(content)

Return a pointer to a node's content.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(in) :: self

The dictionary.

class(*), intent(in) :: key

The key.

Return Value class(*), pointer

Content pointer of the queried node.

private function has_key(self, key)

Check if the key is present in the dictionary.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(in) :: self

The dictionary.

class(*), intent(in) :: key

The key.

Return Value logical

Check result.

private pure function ids(self)

Return the minimum and maximum unique key id values actually stored.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(in) :: self

The dictionary.

Return Value integer(kind=I8P) (1:2)

Minimum and maximum id values actually stored.

private function loop(self, key, content) result(again)

Sentinel while-loop on nodes returning the key/content pair (for dictionary looping).

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(in) :: self

The dictionary.

class(*), intent(out), optional allocatable:: key

The key.

class(*), intent(out), optional pointer:: content

The content.

Return Value logical

Sentinel flag to contine the loop.

private function node(self, key) result(p)

Return a pointer to a node in the dictionary.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(in) :: self

The dictionary.

class(*), intent(in) :: key

The key.

Return Value type(dictionary_node), pointer

Pointer to node queried.


Subroutines

private subroutine add_pointer(self, key, content, buckets_number)

Add a node pointer to the dictionary.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(inout) :: self

The dictionary.

class(*), intent(in) :: key

The key.

class(*), intent(in), pointer:: content

The content.

integer(kind=I4P), intent(in), optional :: buckets_number

Buckets number.

private subroutine add_clone(self, key, content, buckets_number)

Add a node to the dictionary cloning content (non pointer add).

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(inout) :: self

The dictionary.

class(*), intent(in) :: key

The key.

class(*), intent(in) :: content

The content.

integer(kind=I4P), intent(in), optional :: buckets_number

Buckets number.

private elemental subroutine destroy(self)

Destroy the dictionary.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(inout) :: self

The dictionary.

public subroutine get_clone(self, key, content)

Return a node's content by cloning.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(in) :: self

The dictionary.

class(*), intent(in) :: key

The key.

class(*), intent(out), allocatable:: content

Content of the queried node.

private subroutine print_keys(self)

Print the dictionary keys.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(in) :: self

The dictionary.

private subroutine remove(self, key)

Remove a node from the dictionary, given the key.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(inout) :: self

The dictionary.

class(*), intent(in) :: key

The key.

private subroutine traverse(self, iterator)

Traverse dictionary from head to tail calling the iterator procedure.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(in) :: self

The dictionary.

procedure(key_iterator_interface) :: iterator

The (key) iterator procedure to call for each node.

private pure subroutine add_id(self, id)

Add a id to minimum and maximum unique key id values.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(inout) :: self

The dictionary.

integer(kind=I8P), intent(in) :: id

Unique id to add.

private subroutine remove_by_pointer(self, p)

Remove node from dictionary, given pointer to it.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(inout) :: self

The dictionary.

type(dictionary_node), intent(inout), pointer:: p

Pointer to the node to remove.

private subroutine remove_id(self, id)

Remove a id from ids list.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(inout) :: self

The dictionary.

integer(kind=I8P), intent(in) :: id

Unique id to add.

private subroutine traverse_iterator(self, iterator)

Traverse dictionary from head to tail calling the iterator procedure.

Arguments

Type IntentOptional AttributesName
class(dictionary), intent(in) :: self

The dictionary.

procedure(iterator_interface) :: iterator

The iterator procedure to call for each node.

private elemental subroutine finalize(self)

Finalize the dictionary.

Arguments

Type IntentOptional AttributesName
type(dictionary), intent(inout) :: self

The dictionary.