map Derived Type

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

type~~map~~InheritsGraph type~map map type~dictionary dictionary type~dictionary->type~map 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 the standard map data structures. These are data structures which consist of key-value pairs, with only one value per key. It has similar functionality to the dictionary type in Python.


Type-Bound Procedures

procedure(get_func), public, deferred :: get

Returns the value associated with the specified key.

  • pure function get_func(this, key) Prototype

    Arguments

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

    The key whose associated value is to be returned

    Return Value class(container), allocatable

    The value associated with the specified key

procedure(update_sub), public, deferred :: update

Adds any key-value pairs in the second map not already present. Updates the value for all keys in this dictionary also present in the second dictionary.

  • pure subroutine update_sub(this, other) Prototype

    Arguments

    Type IntentOptional AttributesName
    class(map), intent(inout) :: this
    class(map), intent(in) :: other

    A map whose key-value pairs will be added to this one, overwriting as necessary.

Source Code

  type, public, extends(dictionary), abstract :: map
    !* Author: Chris MacMackin
    !  Date: March 2016
    !
    ! An abstract type for the standard map data structures. These are 
    ! data structures which consist of key-value pairs, with only one 
    ! value per key. It has similar functionality to the 
    ! [dictionary](https://docs.python.org/2/library/stdtypes.html#mapping-types-dict) 
    ! type in Python.
    !
  contains
    procedure(get_func), deferred :: get
      !! Returns the value associated with the specified key.
    procedure(update_sub), deferred :: update
      !! Adds any key-value pairs in the second map not already present.
      !! Updates the value for all keys in this dictionary also present 
      !! in the second dictionary.
  end type map