MONC
Private Member Functions | List of all members
collections_mod::c_key_at Interface Reference

Retrieves the key currently being held at a specific index in the map or "" if the index > map elements. More...

Private Member Functions

character(len=string_length) function map_key_at (specificmap, i)
 Retrieves the key currently being held at a specific index in the map or "" if the index > map elements. More...
 
character(len=string_length) function hashmap_key_at (specificmap, i)
 Retrieves the key currently being held at a specific index in the hashmap or "" if the index > map elements. Note that this is an expensive operation has it has to potentially process all internal hashed lists so avoid if can. More...
 

Detailed Description

Retrieves the key currently being held at a specific index in the map or "" if the index > map elements.

This has a time complexity of O(n)

Parameters
collectionThe specific map involved
indexThe index to retrieve the key from
Returns
The key string

Definition at line 457 of file collections.F90.

Member Function/Subroutine Documentation

◆ hashmap_key_at()

character(len=string_length) function collections_mod::c_key_at::hashmap_key_at ( type(hashmap_type), intent(inout)  specificmap,
integer, intent(in)  i 
)
private

Retrieves the key currently being held at a specific index in the hashmap or "" if the index > map elements. Note that this is an expensive operation has it has to potentially process all internal hashed lists so avoid if can.

Do not call directly from external module, this is called via the appropriate interface

Parameters
specificmapThe specific hashmap involved
iThe index to retrieve the key from
Returns
The key string

Definition at line 1420 of file collections.F90.

1421  type(hashmap_type), intent(inout) :: specificmap
1422  integer, intent(in) :: i
1423 
1424  class(*), pointer :: raw_map_node
1425 
1426  raw_map_node=>hashmap_getnode_atindex(specificmap, i)
1427  if (associated(raw_map_node)) then
1428  select type(raw_map_node)
1429  type is(mapnode_type)
1430  hashmap_key_at = raw_map_node%key
1431  end select
1432  return
1433  else
1434  hashmap_key_at=""
1435  end if

◆ map_key_at()

character(len=string_length) function collections_mod::c_key_at::map_key_at ( type(map_type), intent(inout)  specificmap,
integer, intent(in)  i 
)
private

Retrieves the key currently being held at a specific index in the map or "" if the index > map elements.

Do not call directly from external module, this is called via the appropriate interface

Parameters
specificmapThe specific map involved
iThe index to retrieve the key from
Returns
The key string

Definition at line 778 of file collections.F90.

779  type(map_type), intent(inout) :: specificmap
780  integer, intent(in) :: i
781 
782  class(*), pointer :: raw_map_node
783  integer :: the_map_size
784 
785  the_map_size = map_size(specificmap)
786  if (i .le. the_map_size) then
787  raw_map_node=>list_get_generic(specificmap%map_ds, i)
788  if (associated(raw_map_node)) then
789  select type(raw_map_node)
790  type is(mapnode_type)
791  map_key_at = raw_map_node%key
792  end select
793  return
794  end if
795  end if
796  map_key_at=""

The documentation for this interface was generated from the following file: