Puts a generic key-value pair into the map.
More...
|
subroutine | map_put_generic (specificmap, key, data, memory_allocation_automatic) |
| Puts a specific key-value pair into the map. More...
|
|
subroutine | hashmap_put_generic (specificmap, key, data, memory_allocation_automatic) |
| Puts a specific key-value pair into the hashmap. More...
|
|
Puts a generic key-value pair into the map.
If the key is not already held in the map then the key-value pair will be added, otherwise the existing key-value pair will be modified to hold this updated value (keys must be unique) This has a time complexity of O(n) due to key look up
- Parameters
-
collection | The specific map involved |
key | The key to place in the map |
value | Pointer to the generic data value to place in the map |
memory_allocation_automatic | Whether the collections API should manage the freeing of memory |
Definition at line 305 of file collections.F90.
◆ hashmap_put_generic()
subroutine collections_mod::c_put_generic::hashmap_put_generic |
( |
type(hashmap_type), intent(inout) |
specificmap, |
|
|
character(len=*), intent(in) |
key, |
|
|
class(*), intent(in), pointer |
data, |
|
|
logical, intent(in) |
memory_allocation_automatic |
|
) |
| |
|
private |
Puts a specific key-value pair into the hashmap.
If the key is not already held in the hashmap then the key-value pair will be added, otherwise the existing key-value pair will be modified to hold this updated value (keys must be unique). This uses a hashing function for performance Do not call directly from external module, this is called via the appropriate interface
- Parameters
-
specificmap | The specific map involved |
key | The key to place in the map |
data | Pointer to the generic data value to place in the map |
memory_allocation_automatic | Whether the collections API should manage the freeing of memory |
Definition at line 1365 of file collections.F90.
1365 type(hashmap_type),
intent(inout) :: specificmap
1366 class(*),
pointer,
intent(in) :: data
1367 character(len=*),
intent(in) :: key
1368 logical,
intent(in) :: memory_allocation_automatic
1370 class(*),
pointer :: raw_map_node, generic_map_node
1371 type(mapnode_type),
pointer :: newmapnode
1373 if (.not.
associated(specificmap%map_ds))
allocate(specificmap%map_ds(hash_size))
1376 raw_map_node=>hashmap_getnode(specificmap, key)
1378 if (
associated(raw_map_node))
then 1379 select type(raw_map_node)
1380 type is (mapnode_type)
1381 raw_map_node%value=>
data 1384 allocate(newmapnode)
1385 newmapnode%value=>
data 1387 newmapnode%memory_allocation_automatic=memory_allocation_automatic
1390 allocate(generic_map_node, source=newmapnode)
1391 deallocate(newmapnode)
1392 call list_add_generic(specificmap%map_ds(get_hashkey(key)), generic_map_node, .false.)
1393 specificmap%size=specificmap%size+1
◆ map_put_generic()
subroutine collections_mod::c_put_generic::map_put_generic |
( |
type(map_type), intent(inout) |
specificmap, |
|
|
character(len=*), intent(in) |
key, |
|
|
class(*), intent(in), pointer |
data, |
|
|
logical, intent(in) |
memory_allocation_automatic |
|
) |
| |
|
private |
Puts a specific key-value pair into the map.
If the key is not already held in the map then the key-value pair will be added, otherwise the existing key-value pair will be modified to hold this updated value (keys must be unique) Do not call directly from external module, this is called via the appropriate interface
- Parameters
-
specificmap | The specific map involved |
key | The key to place in the map |
data | Pointer to the generic data value to place in the map |
memory_allocation_automatic | Whether the collections API should manage the freeing of memory |
Definition at line 726 of file collections.F90.
726 type(map_type),
intent(inout) :: specificmap
727 class(*),
pointer,
intent(in) :: data
728 character(len=*),
intent(in) :: key
729 logical,
intent(in) :: memory_allocation_automatic
731 class(*),
pointer :: raw_map_node, generic_map_node
732 type(mapnode_type),
pointer :: newmapnode
735 raw_map_node=>map_getnode(specificmap, key)
737 if (
associated(raw_map_node))
then 738 select type(raw_map_node)
739 type is (mapnode_type)
740 raw_map_node%value =>
data 744 newmapnode%value =>
data 746 newmapnode%memory_allocation_automatic=memory_allocation_automatic
749 allocate(generic_map_node, source=newmapnode)
750 deallocate(newmapnode)
751 call list_add_generic(specificmap%map_ds, generic_map_node, .false.)
The documentation for this interface was generated from the following file:
- /nfs/a277/earlcd/dev/monc/svn-git/monc/model_core/src/utils/collections.F90