multimap Derived Type

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

type~~multimap~~InheritsGraph type~multimap multimap type~dictionary dictionary type~dictionary->type~multimap 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, potentially holding multiple values per key.


Type-Bound Procedures

procedure(get_func), public, deferred :: get

Returns a list of values associated with the specified key.

  • pure function get_func(this, key) Prototype

    Arguments

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

    The key whose associated values are to be returned

    Return Value type(array_list)

    The values associated with the specified key

procedure(get_count_func), public, deferred :: get_count

Returns the number of values associated with the specified key.

  • pure function get_count_func(this, key) Prototype

    Arguments

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

    The key whose associated values are to be counted

    Return Value real

procedure(update_map_sub), private, deferred :: update_map

Adds any key-value pairs in the standard map to this one. If a key does not already exist in this dictionary then it is created and assigned the corresponding value. Otherwise, the value in the other dictionary is just added to the values associated with the key in this one.

  • pure subroutine update_map_sub(this, other) Prototype

    Arguments

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

    A map whose key-value pairs will be added to this one, appending the value to any keys which already exist in this one.

procedure(update_multimap_sub), private, deferred :: update_multimap

Adds any key-value pairs in the second multipmap to this one. If a key does not already exist in this dictionary then it is created and assigned the corresponding values. Otherwise, the values in the other dictionary add just added to the values associated with the key in this one.

  • pure subroutine update_multimap_sub(this, other) Prototype

    Arguments

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

    A multimap whose key-value pairs will be added to this one, adding values to any keys which already exist in this one.

generic, public :: update => update_map, update_multimap

Update this multimap's contents with those of another (multi)map

  • pure subroutine update_map_sub(this, other) Prototype

    Arguments

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

    A map whose key-value pairs will be added to this one, appending the value to any keys which already exist in this one.

  • pure subroutine update_multimap_sub(this, other) Prototype

    Arguments

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

    A multimap whose key-value pairs will be added to this one, adding values to any keys which already exist in this one.

procedure(remove_val_sub), public, deferred :: remove_value

Remove the specified value from the specified key

  • pure subroutine remove_val_sub(this, key, val) Prototype

    Arguments

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

    A key from which to remove a value

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

    A value which will be removed from key, if key has such a value.

Source Code

  type, public, extends(dictionary), abstract :: multimap
    !* 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, potentially 
    ! holding multiple values per key.
    !
  contains
    procedure(get_func), deferred :: get
      !! Returns a list of values associated with the specified key.
    procedure(get_count_func), deferred :: get_count
      !! Returns the number of values associated with the specified key.
    procedure(update_map_sub), deferred, private :: update_map
      !! Adds any key-value pairs in the standard map to this one. If a
      !! key does not already exist in this dictionary then it is 
      !! created and assigned the corresponding value. Otherwise, the
      !! value in the other dictionary is just added to the values 
      !! associated with the key in this one.
    procedure(update_multimap_sub), deferred, private :: update_multimap
      !! Adds any key-value pairs in the second multipmap to this one.
      !! If a key does not already exist in this dictionary then it is
      !! created and assigned the corresponding values. Otherwise, the
      !! values in the other dictionary add just added to the values 
      !! associated with the key in this one.
    generic :: update => update_map, update_multimap
      !! Update this multimap's contents with those of another 
      !! (multi)map
    procedure(remove_val_sub), deferred :: remove_value
      !! Remove the specified value from the specified key
  end type multimap