dictionary Derived Type

type, public, abstract, extends(data_set) :: dictionary

type~~dictionary~~InheritsGraph type~dictionary dictionary type~data_set data_set type~data_set->type~dictionary type~countable countable type~countable->type~data_set type~iterable iterable type~iterable->type~countable
Help


An abstract type for mapping data structures. These are data structures which consist of key-value pairs. Examples of such structures are dictionaries in Python or a hash variable in Perl.

Inherited By

type~~dictionary~~InheritedByGraph type~dictionary dictionary type~map map type~dictionary->type~map type~multimap multimap type~dictionary->type~multimap
Help

Type-Bound Procedures

procedure(keys_func), public, deferred :: keys

Returns a list of the keys in this dictionary

  • pure function keys_func(this) Prototype

    Arguments

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

    Return Value type(array_list)

    A list containing all of the keys in this dictionary

procedure(values_func), public, deferred :: values

Returns a list of the values stored in this dictionary, in the same order as the corresponding keys are returned when keys is called

  • pure function values_func(this) Prototype

    Arguments

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

    Return Value type(array_list)

    A list containing all of the values in this dictionary, stored in the same order as their corresponding key would be were keys called

procedure(set_func), public, deferred :: set

Sets the given key to the give value

  • function set_func(this, key, val) Prototype

    Arguments

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

    The key whose value is to be set

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

    The value to be assigned to the specified key

    Return Value real

procedure(type_func), public, deferred :: key_type

Returns a container of the dynamics type used to store keys

  • pure function type_func(this) Prototype

    Arguments

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

    Return Value class(container), allocatable

    A container of the dynamic type used to store this dictionary's keys or values.

procedure(type_func), public, deferred :: value_type

Returns a container of dynamics the type used to store values

  • pure function type_func(this) Prototype

    Arguments

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

    Return Value class(container), allocatable

    A container of the dynamic type used to store this dictionary's keys or values.

Source Code

  type, public, extends(data_set), abstract :: dictionary
    !* Author: Chris MacMackin
    !  Date: March 2016
    !
    ! An abstract type for mapping data structures. These are data 
    ! structures which consist of key-value pairs. Examples of such
    ! structures are 
    ! [dictionaries](https://docs.python.org/2/library/stdtypes.html#mapping-types-dict) 
    ! in Python or a
    ! [hash](https://en.wikibooks.org/wiki/Perl_Programming/Hash_Variables)
    ! variable in Perl.
    !
  contains
    procedure(keys_func), deferred :: keys
      !! Returns a list of the keys in this dictionary
    procedure(values_func), deferred :: values
      !! Returns a list of the values stored in this dictionary, in the
      !! same order as the corresponding keys are returned when
      !! [[dictionary:keys]] is called
    procedure(set_func), deferred :: set
      !! Sets the given key to the give value
    procedure(type_func), deferred :: key_type
      !! Returns a [[container]] of the dynamics type used to store keys
    procedure(type_func), deferred :: value_type
      !! Returns a [[container]] of dynamics the type used to store 
      !! values
  end type dictionary