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

Gets a specific string element out of the list, stack, queue or map with the corresponding key. More...

Private Member Functions

character(len=string_length) function list_get_string (specificlist, i)
 Retrieves the element at index i from the list. More...
 
character(len=string_length) function stack_get_string (specificstack, i)
 Gets a specific element from the stack at index specified. More...
 
character(len=string_length) function queue_get_string (specificqueue, i)
 Returns a specific queue element at an index. More...
 
character(len=string_length) function map_get_string (specificmap, key)
 Gets a specific element out of the map with the corresponding key. More...
 
character(len=string_length) function hashmap_get_string (specificmap, key)
 Gets a specific element out of the hashmap with the corresponding key. More...
 
character(len=string_length) function hashset_get_string (specificset, index)
 Retrieves the key at index i from the set or empty string if index < list size. More...
 
character(len=string_length) function mapentry_get_string (mapentry_item)
 Retrieves the string value from a map entry. More...
 

Detailed Description

Gets a specific string element out of the list, stack, queue or map with the corresponding key.

This has a time complexity of O(n)

Parameters
collectionThe specific list, stack, queue or map involved
keyString look up key
Returns
String value associated with the key or raises an error if none exists

Definition at line 388 of file collections.F90.

Member Function/Subroutine Documentation

◆ hashmap_get_string()

character(len=string_length) function collections_mod::c_get_string::hashmap_get_string ( type(hashmap_type), intent(inout)  specificmap,
character(len=*), intent(in)  key 
)
private

Gets a specific element out of the hashmap with the corresponding key.

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

Parameters
specificmapThe specific hashmap involved
keyLook up key
Returns
String value associated with the key or raises an error if none is found

Definition at line 1713 of file collections.F90.

1714  type(hashmap_type), intent(inout) :: specificmap
1715  character(len=*), intent(in) :: key
1716  character(len=STRING_LENGTH) :: hashmap_get_string
1717 
1718  class(*), pointer :: generic
1719 
1720  generic=>hashmap_get_generic(specificmap, key)
1721  if (.not. associated(generic)) call log_log(log_error, "Can not find string entry with key '"//trim(key)//"'")
1722  hashmap_get_string=conv_to_string(generic, .false., string_length)

◆ hashset_get_string()

character(len=string_length) function collections_mod::c_get_string::hashset_get_string ( type(hashset_type), intent(inout)  specificset,
integer, intent(in)  index 
)
private

Retrieves the key at index i from the set or empty string if index < list size.

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

Parameters
specificsetThe specific set involved
iIndex to look up
Returns
The corresponding key at this location or empty string if none is found

Definition at line 2078 of file collections.F90.

2079  type(hashset_type), intent(inout) :: specificset
2080  integer, intent(in) :: index
2081  class(*), pointer :: generic
2082 
2083  integer :: i, current_size, prev
2084 
2085  hashset_get_string=""
2086  if (.not. associated(specificset%set_ds) .or. index .gt. specificset%size) return
2087 
2088  current_size=0
2089  prev=0
2090  do i=1, hash_size
2091  current_size=current_size+list_size(specificset%set_ds(i))
2092  if (current_size .ge. index) then
2093  generic=>list_get_generic(specificset%set_ds(i), index-prev)
2094  if (associated(generic)) then
2095  select type (generic)
2096  type is (setnode_type)
2097  hashset_get_string=generic%key
2098  end select
2099  return
2100  else
2101  call log_log(log_error, "Can not find hashset entry at index "//trim(conv_to_string(index)))
2102  end if
2103  end if
2104  prev=current_size
2105  end do

◆ list_get_string()

character(len=string_length) function collections_mod::c_get_string::list_get_string ( type(list_type), intent(inout)  specificlist,
integer, intent(in)  i 
)
private

Retrieves the element at index i from the list.

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

Parameters
specificlistThe specific list involved
iIndex to look up
Returns
String data in the list or raises an error if none is found

Definition at line 3056 of file collections.F90.

3057  type(list_type), intent(inout) :: specificlist
3058  integer, intent(in) :: i
3059  character(len=STRING_LENGTH) :: list_get_string
3060 
3061  class(*), pointer :: generic
3062 
3063  generic=>list_get_generic(specificlist, i)
3064  if (.not. associated(generic)) call log_log(log_error, "Can not get string from list at index "//trim(conv_to_string(i)))
3065  list_get_string=conv_to_string(generic, .false., string_length)

◆ map_get_string()

character(len=string_length) function collections_mod::c_get_string::map_get_string ( type(map_type), intent(inout)  specificmap,
character(len=*), intent(in)  key 
)
private

Gets a specific element out of the map with the corresponding key.

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

Parameters
specificmapThe specific map involved
keyLook up key
Returns
String value associated with the key or raises an error if none is found

Definition at line 1075 of file collections.F90.

1076  type(map_type), intent(inout) :: specificmap
1077  character(len=*), intent(in) :: key
1078  character(len=STRING_LENGTH) :: map_get_string
1079 
1080  class(*), pointer :: generic
1081 
1082  generic=>map_get_generic(specificmap, key)
1083  if (.not. associated(generic)) call log_log(log_error, "Can not find string entry with key '"//trim(key)//"'")
1084  map_get_string=conv_to_string(generic, .false., string_length)

◆ mapentry_get_string()

character(len=string_length) function collections_mod::c_get_string::mapentry_get_string ( type(mapentry_type), intent(in)  mapentry_item)
private

Retrieves the string value from a map entry.

Parameters
mapentry_itemThe map entry to retrieve the string value from

Definition at line 3333 of file collections.F90.

3334  type(mapentry_type), intent(in) :: mapentry_item
3335  character(len=STRING_LENGTH) :: mapentry_get_string
3336 
3337  class(*), pointer :: generic
3338 
3339  generic=>mapentry_item%value
3340  if (.not. associated(generic)) call log_log(log_error, "Can not get string from map entry")
3341  mapentry_get_string=conv_to_string(generic, .false., string_length)

◆ queue_get_string()

character(len=string_length) function collections_mod::c_get_string::queue_get_string ( type(queue_type), intent(inout)  specificqueue,
integer, intent(in)  i 
)
private

Returns a specific queue element at an index.

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

Parameters
specificqueueThe specific queue involved
iThe index to look up
Returns
String element at i or raises an error if none is found

Definition at line 2662 of file collections.F90.

2663  type(queue_type), intent(inout) :: specificqueue
2664  integer, intent(in) :: i
2665  character(len=STRING_LENGTH) :: queue_get_string
2666 
2667  class(*), pointer :: generic
2668 
2669  generic=>queue_get_generic(specificqueue, i)
2670  if (.not. associated(generic)) call log_log(log_error, "Can not get string from queue at index "//trim(conv_to_string(i)))
2671  queue_get_string=conv_to_string(generic, .false., string_length)

◆ stack_get_string()

character(len=string_length) function collections_mod::c_get_string::stack_get_string ( type(stack_type), intent(inout)  specificstack,
integer, intent(in)  i 
)
private

Gets a specific element from the stack at index specified.

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

Parameters
specificstackThe specific stack involved
iThe index to retrieve the element at
Returns
String data or raises an error if none is found

Definition at line 2366 of file collections.F90.

2367  type(stack_type), intent(inout) :: specificstack
2368  integer, intent(in) :: i
2369  character(len=STRING_LENGTH) :: stack_get_string
2370 
2371  class(*), pointer :: generic
2372 
2373  generic=>stack_get_generic(specificstack, i)
2374  if (.not. associated(generic)) call log_log(log_error, "Can not get string from stack at index "//trim(conv_to_string(i)))
2375  stack_get_string=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