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

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

Private Member Functions

class(*) function, pointer list_get_generic (specificlist, i)
 Retrieves the element at index i from the list or null if index < list size. More...
 
class(*) function, pointer stack_get_generic (specificstack, i)
 Gets a specific element from the stack at index specified or null if the index > stack size. More...
 
class(*) function, pointer queue_get_generic (specificqueue, i)
 Returns a specific queue element at an index or null if index > queue size. More...
 
class(*) function, pointer map_get_generic (specificmap, key)
 Gets a specific element out of the map with the corresponding key. More...
 
class(*) function, pointer hashmap_get_generic (specificmap, key)
 Gets a specific element out of the hashmap with the corresponding key. More...
 
class(*) function, pointer mapentry_get_generic (mapentry_item)
 Retrieves the generic value from a map entry. More...
 

Detailed Description

Gets a specific generic 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
Generic pointer to the value associated with the key or null if none exists

Definition at line 367 of file collections.F90.

Member Function/Subroutine Documentation

◆ hashmap_get_generic()

class(*) function, pointer collections_mod::c_get_generic::hashmap_get_generic ( 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
Pointer to the generic value associated with the key or null if none exists

Definition at line 1775 of file collections.F90.

1775  type(hashmap_type), intent(inout) :: specificmap
1776  character(len=*), intent(in) :: key
1777  class(*), pointer :: hashmap_get_generic, raw_map_node
1778 
1779  raw_map_node=>hashmap_getnode(specificmap, key)
1780  if (associated(raw_map_node)) then
1781  select type (raw_map_node)
1782  type is (mapnode_type)
1783  hashmap_get_generic=>raw_map_node%value
1784  end select
1785  return
1786  end if
1787  hashmap_get_generic=>null()

◆ list_get_generic()

class(*) function, pointer collections_mod::c_get_generic::list_get_generic ( type(list_type), intent(inout)  specificlist,
integer, intent(in)  i 
)
private

Retrieves the element at index i from the list or null if index < list size.

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

Parameters
specificlistThe specific list involved
iIndex to look up
Returns
Pointer to the generic data in the list

Definition at line 3118 of file collections.F90.

3118  type(list_type), intent(inout) :: specificlist
3119  integer, intent(in) :: i
3120  class(*), pointer :: list_get_generic
3121 
3122  integer :: j
3123  type(listnode_type), pointer :: node
3124 
3125  j=1
3126  if (specificlist%size .lt. i) then
3127  list_get_generic => null()
3128  return
3129  end if
3130  node => specificlist%head
3131  do while(j .lt. i)
3132  if (.not. associated(node)) exit
3133  node => node%next
3134  j=j+1
3135  end do
3136  list_get_generic => node%data

◆ map_get_generic()

class(*) function, pointer collections_mod::c_get_generic::map_get_generic ( 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
Pointer to the generic value associated with the key or null if none exists

Definition at line 1137 of file collections.F90.

1137  type(map_type), intent(inout) :: specificmap
1138  character(len=*), intent(in) :: key
1139  class(*), pointer :: map_get_generic, raw_map_node
1140 
1141  raw_map_node=>map_getnode(specificmap, key)
1142  if (associated(raw_map_node)) then
1143  select type (raw_map_node)
1144  type is (mapnode_type)
1145  map_get_generic => raw_map_node%value
1146  end select
1147  return
1148  end if
1149  map_get_generic => null()

◆ mapentry_get_generic()

class(*) function, pointer collections_mod::c_get_generic::mapentry_get_generic ( type(mapentry_type), intent(in)  mapentry_item)
private

Retrieves the generic value from a map entry.

Parameters
mapentry_itemThe map entry to retrieve the generic value from

Definition at line 3380 of file collections.F90.

3380  type(mapentry_type), intent(in) :: mapentry_item
3381  class(*), pointer :: mapentry_get_generic
3382 
3383  mapentry_get_generic=>mapentry_item%value

◆ queue_get_generic()

class(*) function, pointer collections_mod::c_get_generic::queue_get_generic ( type(queue_type), intent(inout)  specificqueue,
integer, intent(in)  i 
)
private

Returns a specific queue element at an index or null if index > queue size.

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
Pointer to the generic queue element at i or null if the index does not exist

Definition at line 2724 of file collections.F90.

2724  type(queue_type), intent(inout) :: specificqueue
2725  integer, intent(in) :: i
2726  class(*), pointer :: queue_get_generic
2727 
2728  queue_get_generic=>list_get_generic(specificqueue%queue_ds, i)

◆ stack_get_generic()

class(*) function, pointer collections_mod::c_get_generic::stack_get_generic ( type(stack_type), intent(inout)  specificstack,
integer, intent(in)  i 
)
private

Gets a specific element from the stack at index specified or null if the index > stack size.

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
Pointer to the generic data

Definition at line 2428 of file collections.F90.

2428  type(stack_type), intent(inout) :: specificstack
2429  integer, intent(in) :: i
2430  class(*), pointer :: stack_get_generic
2431 
2432  stack_get_generic=>list_get_generic(specificstack%stack_ds, i)

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