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

Retrieves a map entry at a specific index. This is more efficient than calling key at and then value at (or get with the key) as only requires one search for both the key and value. More...

Private Member Functions

logical function map_string_entry_at (specificmap, i, key, str_val)
 Retrieves the entry at a specific map index or null if index > map elements. More...
 
logical function hashmap_string_entry_at (specificmap, i, key, str_val)
 Retrieves the entry at a specific map index. More...
 

Detailed Description

Retrieves a map entry at a specific index. This is more efficient than calling key at and then value at (or get with the key) as only requires one search for both the key and value.

This has a time complexity of O(n)

Parameters
collectionThe specific map involved
indexThe index to get value from
keyThe associated key
valueString value or raises an error if none is found

Definition at line 543 of file collections.F90.

Member Function/Subroutine Documentation

◆ hashmap_string_entry_at()

logical function collections_mod::c_string_entry_at::hashmap_string_entry_at ( type(hashmap_type), intent(inout)  specificmap,
integer, intent(in)  i,
character(len=*), intent(out)  key,
character(len=string_length), intent(out)  str_val 
)
private

Retrieves the entry at a specific map index.

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

Parameters
specificmapThe specific map involved
iIndex to get value from
keyThe associated key
valueString value or raises an error if none is found

Definition at line 1573 of file collections.F90.

1574  type(hashmap_type), intent(inout) :: specificmap
1575  integer, intent(in) :: i
1576  character(len=*), intent(out) :: key
1577  character(len=STRING_LENGTH), intent(out) :: str_val
1578 
1579  class(*), pointer :: generic
1580 
1581  hashmap_string_entry_at=hashmap_generic_entry_at(specificmap, i, key, generic)
1582  if (.not. associated(generic)) call log_log(log_error, "Can not find string entry with key '"//trim(key)//"'")
1583  str_val=conv_to_string(generic, .false., string_length)

◆ map_string_entry_at()

logical function collections_mod::c_string_entry_at::map_string_entry_at ( type(map_type), intent(inout)  specificmap,
integer, intent(in)  i,
character(len=*), intent(out)  key,
character(len=string_length), intent(out)  str_val 
)
private

Retrieves the entry at a specific map index or null if index > map elements.

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

Parameters
specificmapThe specific map involved
iIndex to get value from
keyThe associated key
valueString value or raises an error if none is found

Definition at line 932 of file collections.F90.

933  type(map_type), intent(inout) :: specificmap
934  integer, intent(in) :: i
935  character(len=*), intent(out) :: key
936  character(len=STRING_LENGTH), intent(out) :: str_val
937 
938  class(*), pointer :: generic
939 
940  map_string_entry_at=map_generic_entry_at(specificmap, i, key, generic)
941  if (.not. associated(generic)) call log_log(log_error, "Can not find string entry with key '"//trim(key)//"'")
942  str_val=conv_to_string(generic, .false., string_length)

The documentation for this interface was generated from the following file:
logging_mod::log_error
integer, parameter, public log_error
Only log ERROR messages.
Definition: logging.F90:11
logging_mod::log_log
subroutine, public log_log(level, message, str)
Logs a message at the specified level. If the level is above the current level then the message is ig...
Definition: logging.F90:75