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.
Returns a list of values associated with the specified key.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(multimap), | intent(in) | :: | this | |||
class(*), | intent(in) | :: | key | The key whose associated values are to be returned |
The values associated with the specified key
Returns the number of values associated with the specified key.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(multimap), | intent(in) | :: | this | |||
class(*), | intent(in) | :: | key | The key whose associated values are to be counted |
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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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. |
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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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. |
Update this multimap's contents with those of another (multi)map
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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. |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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. |
Remove the specified value from the specified key
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
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