27 class(*),
pointer :: data => null()
28 logical :: memory_allocation_automatic
33 logical :: memory_allocation_automatic
35 character(len=STRING_LENGTH) :: key
37 class(*),
pointer ::
value => null()
43 character(len=STRING_LENGTH) :: key
47 character(len=STRING_LENGTH) :: key
48 class(*),
pointer ::
value => null()
53 type(
list_type),
dimension(:),
pointer :: hash_structure
64 integer,
private :: size=0
96 type(
list_type),
pointer,
dimension(:),
private :: map_ds => null()
97 integer,
private :: size=0
103 type(
list_type),
pointer,
dimension(:),
private :: set_ds => null()
104 integer,
private :: size=0
646 integer,
intent(in) :: int_data
647 character(len=*),
intent(in) :: key
649 class(*),
pointer :: generic
651 generic=>conv_to_generic(int_data, .true.)
666 character(len=STRING_LENGTH),
intent(in) :: str_data
667 character(len=*),
intent(in) :: key
669 class(*),
pointer :: generic
671 generic=>conv_to_generic(str_data, .true.)
686 real(kind=DEFAULT_PRECISION),
intent(in) :: real_data
687 character(len=*),
intent(in) :: key
689 class(*),
pointer :: generic
691 generic=>conv_to_generic(real_data, .true.)
706 logical,
intent(in) :: logical_data
707 character(len=*),
intent(in) :: key
709 class(*),
pointer :: generic
711 generic=>conv_to_generic(logical_data, .true.)
725 subroutine map_put_generic(specificmap, key, data, memory_allocation_automatic)
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
737 if (
associated(raw_map_node))
then 738 select type(raw_map_node)
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)
763 character(len=*),
intent(in) :: key
765 integer :: key_location
766 class(*),
pointer :: raw_map_node
768 raw_map_node =>
map_getnode(specificmap, key, key_location)
778 character(len=STRING_LENGTH) function map_key_at(specificmap, i)
780 integer,
intent(in) :: i
782 class(*),
pointer :: raw_map_node
783 integer :: the_map_size
785 the_map_size =
map_size(specificmap)
786 if (i .le. the_map_size)
then 788 if (
associated(raw_map_node))
then 789 select type(raw_map_node)
807 integer,
intent(in) :: i
808 integer :: map_integer_at
810 class(*),
pointer :: generic
813 if (.not.
associated(generic))
call log_log(log_error,
"Can not find integer at "//trim(conv_to_string(i)))
814 map_integer_at=conv_to_integer(generic, .false.)
825 integer,
intent(in) :: i
826 character(len=STRING_LENGTH) :: map_string_at
828 class(*),
pointer :: generic
831 if (.not.
associated(generic))
call log_log(log_error,
"Can not find string at "//trim(conv_to_string(i)))
832 map_string_at=conv_to_string(generic, .false., string_length)
843 integer,
intent(in) :: i
844 real(kind=DEFAULT_PRECISION) :: map_real_at
846 class(*),
pointer :: generic
849 if (.not.
associated(generic))
call log_log(log_error,
"Can not find real at "//trim(conv_to_string(i)))
850 select type(vr=>generic)
851 type is (
real(kind=default_precision))
854 map_real_at=conv_single_real_to_double(vr)
856 map_real_at=conv_single_real_to_double(conv_to_real(vr))
868 integer,
intent(in) :: i
869 logical :: map_logical_at
871 class(*),
pointer :: generic
874 if (.not.
associated(generic))
call log_log(log_error,
"Can not find logical at "//trim(conv_to_string(i)))
875 map_logical_at=conv_to_logical(generic, .false.)
886 integer,
intent(in) :: i
888 class(*),
pointer :: raw_map_node, map_generic_at
889 integer :: the_map_size
891 the_map_size =
map_size(specificmap)
892 if (i .le. the_map_size)
then 894 if (
associated(raw_map_node))
then 895 select type(raw_map_node)
897 map_generic_at => raw_map_node%value
902 map_generic_at=>null()
914 integer,
intent(in) :: i
915 character(len=*),
intent(out) :: key
916 integer,
intent(out) :: int_val
918 class(*),
pointer :: generic
921 if (.not.
associated(generic))
call log_log(log_error,
"Can not find integer entry with key '"//trim(key)//
"'")
922 int_val=conv_to_integer(generic, .false.)
934 integer,
intent(in) :: i
935 character(len=*),
intent(out) :: key
936 character(len=STRING_LENGTH),
intent(out) :: str_val
938 class(*),
pointer :: 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)
954 integer,
intent(in) :: i
955 character(len=*),
intent(out) :: key
956 real(kind=DEFAULT_PRECISION),
intent(out) :: real_val
958 class(*),
pointer :: generic
961 if (.not.
associated(generic))
call log_log(log_error,
"Can not find real entry with key '"//trim(key)//
"'")
962 select type(vr=>generic)
963 type is (
real(kind=default_precision))
966 real_val=conv_single_real_to_double(vr)
968 real_val=conv_single_real_to_double(conv_to_real(vr))
981 integer,
intent(in) :: i
982 character(len=*),
intent(out) :: key
983 logical,
intent(out) :: logical_val
985 class(*),
pointer :: generic
988 if (.not.
associated(generic))
call log_log(log_error,
"Can not find logical entry with key '"//trim(key)//
"'")
989 logical_val=conv_to_logical(generic, .false.)
1001 integer,
intent(in) :: i
1002 character(len=*),
intent(out) :: key
1003 class(*),
pointer,
intent(out) :: val
1005 class(*),
pointer :: raw_map_node
1006 integer :: the_map_size
1008 the_map_size =
map_size(specificmap)
1009 if (i .le. the_map_size)
then 1011 if (
associated(raw_map_node))
then 1012 select type(raw_map_node)
1014 val=>raw_map_node%value
1015 key=raw_map_node%key
1032 character(len=*),
intent(in) :: key
1034 integer :: key_location
1035 class(*),
pointer :: raw_map_node
1037 raw_map_node=>
map_getnode(specificmap, key, key_location)
1039 if (key_location .gt. 0)
then 1040 select type (raw_map_node)
1042 if (raw_map_node%memory_allocation_automatic)
then 1043 if (
associated(raw_map_node%value))
deallocate(raw_map_node%value)
1045 deallocate(raw_map_node)
1047 call list_remove(specificmap%map_ds, key_location)
1059 character(len=*),
intent(in) :: key
1060 integer :: map_get_int
1062 class(*),
pointer :: generic
1065 if (.not.
associated(generic))
call log_log(log_error,
"Can not find integer entry with key '"//trim(key)//
"'")
1066 map_get_int=conv_to_integer(generic, .false.)
1077 character(len=*),
intent(in) :: key
1078 character(len=STRING_LENGTH) :: map_get_string
1080 class(*),
pointer :: generic
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)
1095 character(len=*),
intent(in) :: key
1096 real(kind=DEFAULT_PRECISION) :: map_get_real
1098 class(*),
pointer :: generic
1101 if (.not.
associated(generic))
call log_log(log_error,
"Can not find real entry with key '"//trim(key)//
"'")
1102 select type(vr=>generic)
1103 type is (
real(kind=default_precision))
1106 map_get_real=conv_single_real_to_double(vr)
1108 map_get_real=conv_single_real_to_double(conv_to_real(vr))
1120 character(len=*),
intent(in) :: key
1121 logical :: map_get_logical
1123 class(*),
pointer :: generic
1126 if (.not.
associated(generic))
call log_log(log_error,
"Can not find logical entry with key '"//trim(key)//
"'")
1127 map_get_logical=conv_to_logical(generic, .false.)
1138 character(len=*),
intent(in) :: key
1139 class(*),
pointer :: map_get_generic, raw_map_node
1142 if (
associated(raw_map_node))
then 1143 select type (raw_map_node)
1145 map_get_generic => raw_map_node%value
1149 map_get_generic => null()
1160 function map_getnode(specificmap, key, foundindex)
1162 integer,
intent(out),
optional :: foundindex
1163 character(len=*),
intent(in) :: key
1164 class(*),
pointer :: raw_data, map_getnode
1170 node=>specificmap%map_ds%head
1171 if (
associated(node))
then 1174 if (
associated(raw_data))
then 1175 select type (raw_data)
1177 if (raw_data%key .eq. key)
then 1178 map_getnode=>raw_data
1179 if (
present(foundindex)) foundindex=i
1186 if (.not.
associated(node))
exit 1189 map_getnode => null()
1190 if(
present(foundindex)) foundindex = 0
1198 integer function map_size(specificmap)
1226 node=>specificmap%map_ds%head
1227 previousnode=>null()
1229 if (
associated(node))
then 1233 if (
associated(previousnode%data))
then 1234 select type (n=>previousnode%data)
1236 if (n%memory_allocation_automatic)
then 1237 if (
associated(n%value))
deallocate(n%value)
1240 deallocate(previousnode%data)
1242 deallocate(previousnode)
1243 if (.not.
associated(node))
exit 1247 specificmap%map_ds%tail=>null()
1248 specificmap%map_ds%head=>null()
1249 specificmap%map_ds%size=0
1255 type(
iterator_type) function hashmap_get_iterator(specificmap)
1260 hashmap_get_iterator%next_item=>null()
1261 if (
associated(specificmap%map_ds))
then 1262 hashmap_get_iterator%hash_structure=>specificmap%map_ds
1264 do i=1,
size(specificmap%map_ds)
1265 if (specificmap%map_ds(i)%size .gt. 0)
then 1266 hashmap_get_iterator%next_item=>specificmap%map_ds(i)%head
1270 hashmap_get_iterator%hash_ptr=i+1
1285 integer,
intent(in) :: int_data
1286 character(len=*),
intent(in) :: key
1288 class(*),
pointer :: generic
1290 generic=>conv_to_generic(int_data, .true.)
1305 character(len=STRING_LENGTH),
intent(in) :: str_data
1306 character(len=*),
intent(in) :: key
1308 class(*),
pointer :: generic
1310 generic=>conv_to_generic(str_data, .true.)
1325 real(kind=DEFAULT_PRECISION),
intent(in) :: real_data
1326 character(len=*),
intent(in) :: key
1328 class(*),
pointer :: generic
1330 generic=>conv_to_generic(real_data, .true.)
1345 logical,
intent(in) :: logical_data
1346 character(len=*),
intent(in) :: key
1348 class(*),
pointer :: generic
1350 generic=>conv_to_generic(logical_data, .true.)
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
1373 if (.not.
associated(specificmap%map_ds))
allocate(specificmap%map_ds(
hash_size))
1378 if (
associated(raw_map_node))
then 1379 select type(raw_map_node)
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)
1393 specificmap%size=specificmap%size+1
1405 character(len=*),
intent(in) :: key
1407 class(*),
pointer :: raw_map_node
1420 character(len=STRING_LENGTH) function hashmap_key_at(specificmap, i)
1422 integer,
intent(in) :: i
1424 class(*),
pointer :: raw_map_node
1427 if (
associated(raw_map_node))
then 1428 select type(raw_map_node)
1447 integer,
intent(in) :: i
1448 integer :: hashmap_integer_at
1450 class(*),
pointer :: generic
1453 if (.not.
associated(generic))
call log_log(log_error,
"Can not find integer at "//trim(conv_to_string(i)))
1454 hashmap_integer_at=conv_to_integer(generic, .false.)
1466 integer,
intent(in) :: i
1467 character(len=STRING_LENGTH) :: hashmap_string_at
1469 class(*),
pointer :: generic
1472 if (.not.
associated(generic))
call log_log(log_error,
"Can not find string at "//trim(conv_to_string(i)))
1473 hashmap_string_at=conv_to_string(generic, .false., string_length)
1485 integer,
intent(in) :: i
1486 integer :: hashmap_real_at
1488 class(*),
pointer :: generic
1491 if (.not.
associated(generic))
call log_log(log_error,
"Can not find real at "//trim(conv_to_string(i)))
1492 select type(vr=>generic)
1493 type is (
real(kind=default_precision))
1496 hashmap_real_at=conv_single_real_to_double(vr)
1498 hashmap_real_at=conv_single_real_to_double(conv_to_real(vr))
1511 integer,
intent(in) :: i
1512 logical :: hashmap_logical_at
1514 class(*),
pointer :: generic
1517 if (.not.
associated(generic))
call log_log(log_error,
"Can not find logical at "//trim(conv_to_string(i)))
1518 hashmap_logical_at=conv_to_logical(generic, .false.)
1530 integer,
intent(in) :: i
1532 class(*),
pointer :: raw_map_node, hashmap_generic_at
1535 if (
associated(raw_map_node))
then 1536 select type(raw_map_node)
1538 hashmap_generic_at=>raw_map_node%value
1542 hashmap_generic_at=>null()
1555 integer,
intent(in) :: i
1556 character(len=*),
intent(out) :: key
1557 integer,
intent(out) :: int_val
1559 class(*),
pointer :: generic
1562 if (.not.
associated(generic))
call log_log(log_error,
"Can not find integer entry with key '"//trim(key)//
"'")
1563 int_val=conv_to_integer(generic, .false.)
1575 integer,
intent(in) :: i
1576 character(len=*),
intent(out) :: key
1577 character(len=STRING_LENGTH),
intent(out) :: str_val
1579 class(*),
pointer :: 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)
1595 integer,
intent(in) :: i
1596 character(len=*),
intent(out) :: key
1597 real(kind=DEFAULT_PRECISION),
intent(out) :: real_val
1599 class(*),
pointer :: generic
1602 if (.not.
associated(generic))
call log_log(log_error,
"Can not find real entry with key '"//trim(key)//
"'")
1603 select type(vr=>generic)
1604 type is (
real(kind=default_precision))
1607 real_val=conv_single_real_to_double(vr)
1609 real_val=conv_single_real_to_double(conv_to_real(vr))
1622 integer,
intent(in) :: i
1623 character(len=*),
intent(out) :: key
1624 logical,
intent(out) :: logical_val
1626 class(*),
pointer :: generic
1629 if (.not.
associated(generic))
call log_log(log_error,
"Can not find logical entry with key '"//trim(key)//
"'")
1630 logical_val=conv_to_logical(generic, .false.)
1642 integer,
intent(in) :: i
1643 character(len=*),
intent(out) :: key
1644 class(*),
pointer,
intent(out) :: val
1646 class(*),
pointer :: raw_map_node
1649 if (
associated(raw_map_node))
then 1650 select type(raw_map_node)
1652 val=>raw_map_node%value
1653 key=raw_map_node%key
1669 character(len=*),
intent(in) :: key
1671 integer :: key_location
1672 class(*),
pointer :: raw_map_node
1676 if (key_location .gt. 0)
then 1677 select type (raw_map_node)
1679 if (raw_map_node%memory_allocation_automatic)
then 1680 if (
associated(raw_map_node%value))
deallocate(raw_map_node%value)
1682 deallocate(raw_map_node)
1685 specificmap%size=specificmap%size-1
1697 character(len=*),
intent(in) :: key
1698 integer :: hashmap_get_int
1700 class(*),
pointer :: generic
1703 if (.not.
associated(generic))
call log_log(log_error,
"Can not find integer entry with key '"//trim(key)//
"'")
1704 hashmap_get_int=conv_to_integer(generic, .false.)
1715 character(len=*),
intent(in) :: key
1716 character(len=STRING_LENGTH) :: hashmap_get_string
1718 class(*),
pointer :: generic
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)
1733 character(len=*),
intent(in) :: key
1734 real(kind=DEFAULT_PRECISION) :: hashmap_get_real
1736 class(*),
pointer :: generic
1739 if (.not.
associated(generic))
call log_log(log_error,
"Can not find real entry with key '"//trim(key)//
"'")
1740 select type(vr=>generic)
1741 type is (
real(kind=default_precision))
1744 hashmap_get_real=conv_single_real_to_double(vr)
1746 hashmap_get_real=conv_single_real_to_double(conv_to_real(vr))
1758 character(len=*),
intent(in) :: key
1759 logical :: hashmap_get_logical
1761 class(*),
pointer :: generic
1764 if (.not.
associated(generic))
call log_log(log_error,
"Can not find logical entry with key '"//trim(key)//
"'")
1765 hashmap_get_logical=conv_to_logical(generic, .false.)
1776 character(len=*),
intent(in) :: key
1777 class(*),
pointer :: hashmap_get_generic, raw_map_node
1780 if (
associated(raw_map_node))
then 1781 select type (raw_map_node)
1783 hashmap_get_generic=>raw_map_node%value
1787 hashmap_get_generic=>null()
1800 character(len=*),
intent(in) :: key
1801 integer,
intent(out),
optional :: key_location
1802 class(*),
pointer :: raw_data, hashmap_getnode
1807 hashmap_getnode=>null()
1808 if (
present(key_location)) key_location=0
1810 if (.not.
associated(specificmap%map_ds))
return 1815 node=>specificmap%map_ds(hash)%head
1816 if (
associated(node))
then 1819 if (
associated(raw_data))
then 1820 select type (raw_data)
1822 if (raw_data%key .eq. key)
then 1823 hashmap_getnode=>raw_data
1824 if (
present(key_location)) key_location=i
1831 if (.not.
associated(node))
exit 1834 if (
present(key_location)) key_location=0
1844 integer,
intent(in) :: index
1845 class(*),
pointer :: hashmap_getnode_atindex
1847 integer :: i, current_size, prev
1849 hashmap_getnode_atindex=>null()
1850 if (.not.
associated(specificmap%map_ds) .or. index .gt. specificmap%size)
return 1855 current_size=current_size+
list_size(specificmap%map_ds(i))
1856 if (current_size .ge. index)
then 1857 hashmap_getnode_atindex=>
list_get_generic(specificmap%map_ds(i), index-prev)
1898 if (
associated(specificmap%map_ds))
then 1900 node=>specificmap%map_ds(i)%head
1901 previousnode=>null()
1903 if (
associated(node))
then 1907 if (
associated(previousnode%data))
then 1908 select type (n=>previousnode%data)
1910 if (n%memory_allocation_automatic)
then 1911 if (
associated(n%value))
deallocate(n%value)
1914 deallocate(previousnode%data)
1916 deallocate(previousnode)
1917 if (.not.
associated(node))
exit 1921 specificmap%map_ds(i)%tail=>null()
1922 specificmap%map_ds(i)%head=>null()
1923 specificmap%map_ds(i)%size=0
1926 deallocate(specificmap%map_ds)
1933 type(
iterator_type) function hashset_get_iterator(specificset)
1938 hashset_get_iterator%next_item=>null()
1939 if (
associated(specificset%set_ds))
then 1940 hashset_get_iterator%hash_structure=>specificset%set_ds
1942 do i=1,
size(specificset%set_ds)
1943 if (specificset%set_ds(i)%size .gt. 0)
then 1944 hashset_get_iterator%next_item=>specificset%set_ds(i)%head
1948 hashset_get_iterator%hash_ptr=i+1
1960 character(len=*),
intent(in) :: key
1962 class(*),
pointer :: generic
1964 integer :: hash, location
1966 if (.not.
associated(specificset%set_ds))
allocate(specificset%set_ds(
hash_size))
1970 if (hash .gt. 0 .and. location .eq. 0)
then 1971 allocate(newsetnode)
1975 allocate(generic, source=newsetnode)
1976 deallocate(newsetnode)
1978 specificset%size=specificset%size+1
1989 character(len=*),
intent(in) :: key
1991 integer :: location, hash
1994 if (hash .gt. 0 .and. location .gt. 0)
then 1995 call list_remove(specificset%set_ds(hash), location)
1996 specificset%size=specificset%size-1
2007 character(len=*),
intent(in) :: key
2009 integer :: hash, key_location
2025 character(len=*),
intent(in) :: key
2026 integer,
intent(out) :: hash, key_location
2027 class(*),
pointer :: raw_data
2035 if (.not.
associated(specificset%set_ds))
return 2040 node=>specificset%set_ds(hash)%head
2041 if (
associated(node))
then 2044 if (
associated(raw_data))
then 2045 select type (raw_data)
2047 if (raw_data%key .eq. key)
then 2055 if (.not.
associated(node))
exit 2080 integer,
intent(in) :: index
2081 class(*),
pointer :: generic
2083 integer :: i, current_size, prev
2086 if (.not.
associated(specificset%set_ds) .or. index .gt. specificset%size)
return 2091 current_size=current_size+
list_size(specificset%set_ds(i))
2092 if (current_size .ge. index)
then 2094 if (
associated(generic))
then 2095 select type (generic)
2101 call log_log(log_error,
"Can not find hashset entry at index "//trim(conv_to_string(index)))
2120 if (
associated(specificset%set_ds))
then 2122 node=>specificset%set_ds(i)%head
2123 previousnode=>null()
2125 if (
associated(node))
then 2129 if (
associated(previousnode%data))
then 2130 deallocate(previousnode%data)
2132 deallocate(previousnode)
2133 if (.not.
associated(node))
exit 2137 specificset%set_ds(i)%tail=>null()
2138 specificset%set_ds(i)%head=>null()
2139 specificset%set_ds(i)%size=0
2142 deallocate(specificset%set_ds)
2162 character(len=*),
intent(in) :: key
2167 do i=1, len(trim(key))
2176 type(
iterator_type) function stack_get_iterator(specificstack)
2179 stack_get_iterator%next_item=>specificstack%stack_ds%head
2180 stack_get_iterator%hash_structure=>null()
2181 stack_get_iterator%hash_ptr=0
2191 integer,
intent(in) :: int_data
2193 class(*),
pointer :: generic
2195 generic=>conv_to_generic(int_data, .true.)
2206 character(len=STRING_LENGTH),
intent(in) :: str_data
2208 class(*),
pointer :: generic
2210 generic=>conv_to_generic(str_data, .true.)
2221 real(kind=DEFAULT_PRECISION),
intent(in) :: real_data
2223 class(*),
pointer :: generic
2225 generic=>conv_to_generic(real_data, .true.)
2236 logical,
intent(in) :: logical_data
2238 class(*),
pointer :: generic
2240 generic=>conv_to_generic(logical_data, .true.)
2252 class(*),
pointer,
intent(in) :: data
2253 logical,
intent(in) :: memory_allocation_automatic
2265 integer :: stack_pop_int
2267 class(*),
pointer :: generic
2270 if (.not.
associated(generic))
call log_log(log_error,
"Can not pop integer from stack")
2271 stack_pop_int=conv_to_integer(generic, .false.)
2281 character(len=STRING_LENGTH) :: stack_pop_string
2283 class(*),
pointer :: generic
2286 if (.not.
associated(generic))
call log_log(log_error,
"Can not pop string from stack")
2287 stack_pop_string=conv_to_string(generic, .false., string_length)
2297 real(kind=DEFAULT_PRECISION) :: stack_pop_real
2299 class(*),
pointer :: generic
2302 if (.not.
associated(generic))
call log_log(log_error,
"Can not pop real from stack")
2303 select type(vr=>generic)
2304 type is (
real(kind=default_precision))
2307 stack_pop_real=conv_single_real_to_double(vr)
2309 stack_pop_real=conv_single_real_to_double(conv_to_real(vr))
2320 logical :: stack_pop_logical
2322 class(*),
pointer :: generic
2325 if (.not.
associated(generic))
call log_log(log_error,
"Can not pop logical from stack")
2326 stack_pop_logical=conv_to_logical(generic, .false.)
2336 class(*),
pointer :: stack_pop_generic
2350 integer,
intent(in) :: i
2351 integer :: stack_get_int
2353 class(*),
pointer :: generic
2356 if (.not.
associated(generic))
call log_log(log_error,
"Can not get integer from stack at index "//trim(conv_to_string(i)))
2357 stack_get_int=conv_to_integer(generic, .false.)
2368 integer,
intent(in) :: i
2369 character(len=STRING_LENGTH) :: stack_get_string
2371 class(*),
pointer :: generic
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)
2386 integer,
intent(in) :: i
2387 real(kind=DEFAULT_PRECISION) :: stack_get_real
2389 class(*),
pointer :: generic
2392 if (.not.
associated(generic))
call log_log(log_error,
"Can not get real from stack at index "//trim(conv_to_string(i)))
2393 select type(vr=>generic)
2394 type is (
real(kind=default_precision))
2397 stack_get_real=conv_single_real_to_double(vr)
2399 stack_get_real=conv_single_real_to_double(conv_to_real(vr))
2411 integer,
intent(in) :: i
2412 logical :: stack_get_logical
2414 class(*),
pointer :: generic
2417 if (.not.
associated(generic))
call log_log(log_error,
"Can not get logical from stack at index "//trim(conv_to_string(i)))
2418 stack_get_logical=conv_to_logical(generic, .false.)
2429 integer,
intent(in) :: i
2430 class(*),
pointer :: stack_get_generic
2472 type(
iterator_type) function queue_get_iterator(specificqueue)
2475 queue_get_iterator%next_item=>specificqueue%queue_ds%head
2476 queue_get_iterator%hash_structure=>null()
2477 queue_get_iterator%hash_ptr=0
2487 integer,
intent(in) :: int_data
2489 class(*),
pointer :: generic
2491 generic=>conv_to_generic(int_data, .true.)
2502 character(len=STRING_LENGTH),
intent(in) :: str_data
2504 class(*),
pointer :: generic
2506 generic=>conv_to_generic(str_data, .true.)
2517 real(kind=DEFAULT_PRECISION),
intent(in) :: real_data
2519 class(*),
pointer :: generic
2521 generic=>conv_to_generic(real_data, .true.)
2532 logical,
intent(in) :: logical_data
2534 class(*),
pointer :: generic
2536 generic=>conv_to_generic(logical_data, .true.)
2548 class(*),
pointer,
intent(in) :: data
2549 logical,
intent(in) :: memory_allocation_automatic
2551 call list_add_generic(specificqueue%queue_ds,
data, memory_allocation_automatic)
2561 integer :: queue_pop_int
2563 class(*),
pointer :: generic
2566 if (.not.
associated(generic))
call log_log(log_error,
"Can not pop integer from queue")
2567 queue_pop_int=conv_to_integer(generic, .false.)
2577 character(len=STRING_LENGTH) :: queue_pop_string
2579 class(*),
pointer :: generic
2582 if (.not.
associated(generic))
call log_log(log_error,
"Can not pop string from queue")
2583 queue_pop_string=conv_to_string(generic, .false., string_length)
2593 real(kind=DEFAULT_PRECISION) :: queue_pop_real
2595 class(*),
pointer :: generic
2598 if (.not.
associated(generic))
call log_log(log_error,
"Can not pop real from queue")
2599 select type(vr=>generic)
2600 type is (
real(kind=default_precision))
2603 queue_pop_real=conv_single_real_to_double(vr)
2605 queue_pop_real=conv_single_real_to_double(conv_to_real(vr))
2616 logical :: queue_pop_logical
2618 class(*),
pointer :: generic
2621 if (.not.
associated(generic))
call log_log(log_error,
"Can not pop logical from queue")
2622 queue_pop_logical=conv_to_logical(generic, .false.)
2632 class(*),
pointer :: queue_pop_generic
2646 integer,
intent(in) :: i
2647 integer :: queue_get_int
2649 class(*),
pointer :: generic
2652 if (.not.
associated(generic))
call log_log(log_error,
"Can not get integer from queue at index "//trim(conv_to_string(i)))
2653 queue_get_int=conv_to_integer(generic, .false.)
2664 integer,
intent(in) :: i
2665 character(len=STRING_LENGTH) :: queue_get_string
2667 class(*),
pointer :: generic
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)
2682 integer,
intent(in) :: i
2683 real(kind=DEFAULT_PRECISION) :: queue_get_real
2685 class(*),
pointer :: generic
2688 if (.not.
associated(generic))
call log_log(log_error,
"Can not get real from queue at index "//trim(conv_to_string(i)))
2689 select type(vr=>generic)
2690 type is (
real(kind=default_precision))
2693 queue_get_real=conv_single_real_to_double(vr)
2695 queue_get_real=conv_single_real_to_double(conv_to_real(vr))
2707 integer,
intent(in) :: i
2708 logical :: queue_get_logical
2710 class(*),
pointer :: generic
2713 if (.not.
associated(generic))
call log_log(log_error,
"Can not get logical from queue at index "//trim(conv_to_string(i)))
2714 queue_get_logical=conv_to_logical(generic, .false.)
2725 integer,
intent(in) :: i
2726 class(*),
pointer :: queue_get_generic
2768 type(
iterator_type) function list_get_iterator(specificlist)
2771 list_get_iterator%next_item=>specificlist%head
2772 list_get_iterator%hash_structure=>null()
2773 list_get_iterator%hash_ptr=0
2784 integer,
intent(in) :: i, int_data
2786 class(*),
pointer :: generic
2788 generic=>conv_to_generic(int_data, .true.)
2800 integer,
intent(in) :: i
2801 character(len=STRING_LENGTH),
intent(in) :: str_data
2803 class(*),
pointer :: generic
2805 generic=>conv_to_generic(str_data, .true.)
2817 integer,
intent(in) :: i
2818 real(kind=DEFAULT_PRECISION),
intent(in) :: real_data
2820 class(*),
pointer :: generic
2822 generic=>conv_to_generic(real_data, .true.)
2834 integer,
intent(in) :: i
2835 logical,
intent(in) :: logical_data
2837 class(*),
pointer :: generic
2839 generic=>conv_to_generic(logical_data, .true.)
2851 integer,
intent(in) :: i
2852 class(*),
pointer,
intent(in) :: data
2853 logical,
intent(in) :: memory_allocation_automatic
2859 newnode%data =>
data 2862 node => specificlist%head
2863 if (
associated(node))
then 2865 if (.not.
associated(node%next))
exit 2871 newnode%next => node
2872 newnode%prev => node%prev
2873 newnode%memory_allocation_automatic=memory_allocation_automatic
2874 if (
associated(node%prev)) node%prev%next=>newnode
2875 node%prev => newnode
2876 if (
associated(node,
target=specificlist%head)) specificlist%head=>newnode
2879 newnode%prev=>specificlist%tail
2880 if (
associated(specificlist%tail))
then 2881 specificlist%tail%next => newnode
2883 specificlist%tail => newnode
2885 if (
associated(specificlist%head) .eqv. .false.)
then 2886 specificlist%head=>newnode
2891 specificlist%head => newnode
2892 specificlist%tail => newnode
2894 specificlist%size=specificlist%size+1
2904 integer,
intent(in) :: int_data
2906 class(*),
pointer :: generic
2908 generic=>conv_to_generic(int_data, .true.)
2919 character(len=STRING_LENGTH),
intent(in) :: str_data
2921 class(*),
pointer :: generic
2923 generic=>conv_to_generic(str_data, .true.)
2934 real(kind=DEFAULT_PRECISION),
intent(in) :: real_data
2936 class(*),
pointer :: generic
2938 generic=>conv_to_generic(real_data, .true.)
2949 logical,
intent(in) :: logical_data
2951 class(*),
pointer :: generic
2953 generic=>conv_to_generic(logical_data, .true.)
2963 subroutine list_add_generic(specificlist, data, memory_allocation_automatic)
2965 class(*),
pointer,
intent(in) :: data
2966 logical,
intent(in) :: memory_allocation_automatic
2971 newnode%data =>
data 2973 newnode%prev=>specificlist%tail
2974 newnode%memory_allocation_automatic=memory_allocation_automatic
2975 if (
associated(specificlist%tail))
then 2976 specificlist%tail%next => newnode
2978 specificlist%tail => newnode
2980 if (
associated(specificlist%head) .eqv. .false.)
then 2981 specificlist%head=>newnode
2984 specificlist%size=specificlist%size+1
2994 integer,
intent(in) :: i
3000 if (i .le. specificlist%size)
then 3001 node => specificlist%head
3003 if (.not.
associated(node))
exit 3007 if (
associated(node))
then 3008 if (
associated(node%prev)) node%prev%next => node%next
3009 if (
associated(node%next)) node%next%prev => node%prev
3010 if (
associated(node,
target=specificlist%head)) specificlist%head => node%next
3011 if (
associated(node,
target=specificlist%tail)) specificlist%tail => node%prev
3012 if (node%memory_allocation_automatic)
then 3013 if (
associated(node%data))
deallocate(node%data)
3016 specificlist%size = specificlist%size - 1
3040 integer,
intent(in) :: i
3041 integer :: list_get_int
3043 class(*),
pointer :: generic
3046 if (.not.
associated(generic))
call log_log(log_error,
"Can not get integer from list at index "//trim(conv_to_string(i)))
3047 list_get_int=conv_to_integer(generic, .false.)
3058 integer,
intent(in) :: i
3059 character(len=STRING_LENGTH) :: list_get_string
3061 class(*),
pointer :: generic
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)
3076 integer,
intent(in) :: i
3077 real(kind=DEFAULT_PRECISION) :: list_get_real
3079 class(*),
pointer :: generic
3082 if (.not.
associated(generic))
call log_log(log_error,
"Can not get real from list at index "//trim(conv_to_string(i)))
3083 select type(vr=>generic)
3084 type is (
real(kind=default_precision))
3087 list_get_real=conv_single_real_to_double(vr)
3089 list_get_real=conv_single_real_to_double(conv_to_real(vr))
3101 integer,
intent(in) :: i
3102 logical :: list_get_logical
3104 class(*),
pointer :: generic
3107 if (.not.
associated(generic))
call log_log(log_error,
"Can not get logical from list at index "//trim(conv_to_string(i)))
3108 list_get_logical=conv_to_logical(generic, .false.)
3119 integer,
intent(in) :: i
3120 class(*),
pointer :: list_get_generic
3126 if (specificlist%size .lt. i)
then 3127 list_get_generic => null()
3130 node => specificlist%head
3132 if (.not.
associated(node))
exit 3136 list_get_generic => node%data
3150 node=>specificlist%head
3151 previousnode=>null()
3153 if (
associated(node))
then 3157 if (previousnode%memory_allocation_automatic)
then 3158 if (
associated(previousnode%data))
deallocate(previousnode%data)
3160 deallocate(previousnode)
3161 if (.not.
associated(node))
exit 3165 specificlist%tail=>null()
3166 specificlist%head=>null()
3175 integer function list_size(specificlist)
3196 class(*),
pointer :: generic
3199 if (
associated(generic))
then 3202 call log_log(log_error,
"Can not get next integer in iterator as iterator has reached end of collection")
3212 class(*),
pointer :: generic
3215 if (
associated(generic))
then 3216 select type(generic)
3223 call log_log(log_error,
"Can not get next string in iterator as iterator has reached end of collection")
3234 class(*),
pointer :: generic
3237 if (
associated(generic))
then 3238 select type(vr=>generic)
3239 type is (
real(kind=default_precision))
3247 call log_log(log_error,
"Can not get next real in iterator as iterator has reached end of collection")
3257 class(*),
pointer :: generic
3260 if (
associated(generic))
then 3263 call log_log(log_error,
"Can not get next logical in iterator as iterator has reached end of collection")
3275 class(*),
pointer :: generic
3278 if (
associated(generic))
then 3279 select type(generic)
3281 iterator_get_next_mapentry%key=generic%key
3282 iterator_get_next_mapentry%value=>generic%value
3284 call log_log(log_error,
"Next item in iterator is not a map entry")
3287 call log_log(log_error,
"Can not get next map entry in iterator as iterator has reached end of collection")
3296 class(*),
pointer :: iterator_get_next_generic
3300 if (
associated(iterator%next_item))
then 3301 iterator_get_next_generic=>iterator%next_item%data
3302 iterator%next_item=>iterator%next_item%next
3303 if (.not.
associated(iterator%next_item) .and.
associated(iterator%hash_structure) .and. &
3304 iterator%hash_ptr .le.
size(iterator%hash_structure))
then 3305 do i=iterator%hash_ptr,
size(iterator%hash_structure)
3306 if (iterator%hash_structure(i)%size .gt. 0)
then 3307 iterator%next_item=>iterator%hash_structure(i)%head
3311 iterator%hash_ptr=i+1
3314 iterator_get_next_generic=>null()
3322 integer :: mapentry_get_int
3324 class(*),
pointer :: generic
3326 generic=>mapentry_item%value
3327 if (.not.
associated(generic))
call log_log(log_error,
"Can not get integer from map entry")
3328 mapentry_get_int=conv_to_integer(generic, .false.)
3335 character(len=STRING_LENGTH) :: mapentry_get_string
3337 class(*),
pointer :: generic
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)
3348 real(kind=DEFAULT_PRECISION) :: mapentry_get_real
3350 class(*),
pointer :: generic
3352 generic=>mapentry_item%value
3353 if (.not.
associated(generic))
call log_log(log_error,
"Can not get real from map entry")
3354 select type(vr=>generic)
3355 type is (
real(kind=default_precision))
3356 mapentry_get_real=vr
3358 mapentry_get_real=conv_single_real_to_double(vr)
3360 mapentry_get_real=conv_single_real_to_double(conv_to_real(vr))
3368 logical :: mapentry_get_logical
3370 class(*),
pointer :: generic
3372 generic=>mapentry_item%value
3373 if (.not.
associated(generic))
call log_log(log_error,
"Can not get logical from map entry")
3374 mapentry_get_logical=conv_to_logical(generic, .false.)
3381 class(*),
pointer :: mapentry_get_generic
3383 mapentry_get_generic=>mapentry_item%value
Adds a double precision real element to the end of the list.
type(mapentry_type) function iterator_get_next_mapentry(iterator)
Returns the next mapentry referenced by the iterator and advanced it, or an error if it has reached t...
Private list node which holds the raw generic node data and pointers to next and previous list nodes...
Gets a specific logical element out of the list, stack, queue or map with the corresponding key...
subroutine hashmap_put_logical(specificmap, key, logical_data)
Puts a specific key-value pair into the hashmap.
Retrieves the string value held at the specific map index or null if index > map elements.
subroutine list_add_int(specificlist, int_data)
Adds an element to the end of the list.
integer function mapentry_get_int(mapentry_item)
Retrieves the integer value from a map entry.
subroutine queue_push_real(specificqueue, real_data)
Adds an element to the end of the queue (FIFO)
type(iterator_type) function list_get_iterator(specificlist)
Retrieves an iterator representation of the list, ready to access the first element.
subroutine list_add_string(specificlist, str_data)
Adds an element to the end of the list.
Retrieves the integer value held at the specific map index or null if index > map elements...
subroutine hashmap_put_generic(specificmap, key, data, memory_allocation_automatic)
Puts a specific key-value pair into the hashmap.
real(kind=default_precision) function stack_pop_real(specificstack)
Pops an element off the stack (LIFO). Converts between precision and from int.
subroutine hashset_free(specificset)
Frees up all the allocatable, heap, memory associated with a specific set.
subroutine list_remove(specificlist, i)
Removes an element from the list at a specific index.
subroutine queue_free(specificqueue)
Frees up all the allocatable, heap, memory associated with a specific queue.
subroutine map_remove(specificmap, key)
Removes a specific key-value pair from the map.
logical function hashset_is_empty(specificset)
Determines whether or not the hashset is empty.
integer, parameter, private hash_size
Number of entries in the hash table, this is a tradeoff - larger means more memory but smaller runtim...
Adds a logical element to the end of the list.
logical function stack_get_logical(specificstack, i)
Gets a specific element from the stack at index specified.
logical function hashmap_get_logical(specificmap, key)
Gets a specific element out of the hashmap with the corresponding key.
subroutine stack_push_logical(specificstack, logical_data)
Pushes an element onto the stack (LIFO)
logical function map_generic_entry_at(specificmap, i, key, val)
Retrieves the entry at a specific map index or null if index > map elements.
Retrieves the key currently being held at a specific index in the map or "" if the index > map elemen...
logical function map_logical_at(specificmap, i)
Retrieves the logical value held at the specific map index.
Gets a specific generic element out of the list, stack, queue or map with the corresponding key...
subroutine list_insert_int(specificlist, int_data, i)
Inserts an element into the list or places at the end if the index > list size.
subroutine queue_push_string(specificqueue, str_data)
Adds an element to the end of the queue (FIFO)
Private set key structure.
Returns whether a collection is empty.
Puts an integer key-value pair into the map.
logical function map_contains_key(specificmap, key)
Determines whether or not a map contains a specific key.
logical function queue_is_empty(specificqueue)
Returns whether a queue is empty.
logical function map_real_entry_at(specificmap, i, key, real_val)
Retrieves the entry at a specific map index or null if index > map elements. This converts precision ...
Inserts a generic element into the list or places at the end if the index > list size.
integer function hashmap_real_at(specificmap, i)
Retrieves the value held at the specific hashmap index. Converts between precision and from int...
subroutine map_free(specificmap)
Frees up all the allocatable, heap, memory associated with a specific map.
class(*) function, pointer queue_get_generic(specificqueue, i)
Returns a specific queue element at an index or null if index > queue size.
Inserts an integer element into the list or places at the end if the index > list size...
real(kind=default_precision) function queue_get_real(specificqueue, i)
Returns a specific queue element at an index. Converts between precision and from int...
integer function list_get_int(specificlist, i)
Retrieves the element at index i from the list.
Pushes a generic element onto the stack or queue.
integer, parameter, public log_error
Only log ERROR messages.
subroutine list_add_real(specificlist, real_data)
Adds an element to the end of the list.
subroutine map_put_generic(specificmap, key, data, memory_allocation_automatic)
Puts a specific key-value pair into the map.
logical function hashset_contains(specificset, key)
Determines wheter the hashset contains a specific key or not.
logical function mapentry_get_logical(mapentry_item)
Retrieves the logical value from a map entry.
class(*) function, pointer map_getnode(specificmap, key, foundindex)
This gets the map node that the key represents (rather than the specific value)
subroutine queue_push_logical(specificqueue, logical_data)
Adds an element to the end of the queue (FIFO)
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 el...
real(kind=default_precision) function mapentry_get_real(mapentry_item)
Retrieves the double precision real value from a map entry.
subroutine hashmap_put_string(specificmap, key, str_data)
Puts a specific key-value pair into the hashmap.
logical function queue_pop_logical(specificqueue)
Pops the queue element off the head of the queue (FIFO)
subroutine map_put_real(specificmap, key, real_data)
Puts a specific key-value pair into the map.
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
integer function map_size(specificmap)
Returns the number of elements in the map.
character(len=string_length) function iterator_get_next_string(iterator)
Returns the next string referenced by the iterator and advanced it, or an error if it has reached the...
class(*) function, pointer map_get_generic(specificmap, key)
Gets a specific element out of the map with the corresponding key.
class(*) function, pointer queue_pop_generic(specificqueue)
Pops the queue element off the head of the queue (FIFO)
subroutine list_insert_generic(specificlist, data, i, memory_allocation_automatic)
Inserts an element into the list or places at the end if the index > list size.
logical function map_get_logical(specificmap, key)
Gets a specific element out of the map with the corresponding key.
class(*) function, pointer hashmap_getnode_atindex(specificmap, index)
This gets the hashmap node at a specific index, from the first hash linked list to the end...
Converts a data type into the generic (class *) form.
logical function list_is_empty(specificlist)
Determines whether or not the list is empty.
Contains common definitions for the data and datatypes used by MONC.
real(kind=default_precision) function list_get_real(specificlist, i)
Retrieves the element at index i from the list. Converts between precision and from int...
subroutine stack_push_int(specificstack, int_data)
Pushes an element onto the stack (LIFO)
Adds an integer element to the end of the list.
Pushes a double precision real element onto the stack or queue.
Pops a generic element off the stack or queue.
logical function hashmap_is_empty(specificmap)
Returns whether a hashmap is empty.
A hashmap structure, the same as a map but uses hashing for greatly improved performance when storing...
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.
subroutine hashmap_remove(specificmap, key)
Removes a specific key-value pair from the hashmap.
character(len=string_length) function hashmap_get_string(specificmap, key)
Gets a specific element out of the hashmap with the corresponding key.
subroutine map_put_logical(specificmap, key, logical_data)
Puts a specific key-value pair into the map.
character(len=string_length) function stack_pop_string(specificstack)
Pops an element off the stack (LIFO)
real(kind=default_precision) function map_get_real(specificmap, key)
Gets a specific element out of the map with the corresponding key. This converts between precision an...
logical function iteratior_has_next(iterator)
Deduces whether an iterator has a next entry or not.
Inserts a logical element into the list or places at the end if the index > list size.
logical function queue_get_logical(specificqueue, i)
Returns a specific queue element at an index.
logical function hashmap_logical_entry_at(specificmap, i, key, logical_val)
Retrieves the entry at a specific map index.
Gets a specific integer element out of the list, stack, queue or map with the corresponding key...
Conversion between common inbuilt FORTRAN data types.
character(len=string_length) function map_string_at(specificmap, i)
Retrieves the string value held at the specific map index.
Converts data types to strings.
subroutine map_put_int(specificmap, key, int_data)
Puts a specific key-value pair into the map.
Puts a string key-value pair into the map.
subroutine map_put_string(specificmap, key, str_data)
Puts a specific key-value pair into the map.
integer function get_hashkey(key)
Translates the string key into a hash from 1 to hash_size (inclusive.) This encoding is deterministic...
logical function hashmap_contains_key(specificmap, key)
Determines whether or not a hashmap contains a specific key.
logical function stack_pop_logical(specificstack)
Pops an element off the stack (LIFO)
class(*) function, pointer hashmap_get_generic(specificmap, key)
Gets a specific element out of the hashmap with the corresponding key.
type(iterator_type) function stack_get_iterator(specificstack)
Retrieves an iterator representation of the stack, ready to access the first element.
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...
Converts data types to logical.
Puts a logical key-value pair into the map.
logical function map_logical_entry_at(specificmap, i, key, logical_val)
Retrieves the entry at a specific map index or null if index > map elements.
Pops a string off the stack or queue.
integer function stack_pop_int(specificstack)
Pops an element off the stack (LIFO)
real(kind=default_precision) function stack_get_real(specificstack, i)
Gets a specific element from the stack at index specified. Converts between precision and from int...
Private map key-value pair data structure.
integer function hashmap_size(specificmap)
Returns the number of elements in the hashmap.
real(kind=default_precision) function iterator_get_next_real(iterator)
Returns the next real (double precision) referenced by the iterator and advanced it, or an error if it has reached the end of iteration.
integer function stack_size(specificstack)
Returns the number of elements held on the stack.
integer function map_integer_at(specificmap, i)
Retrieves the integer value held at the specific map index.
subroutine list_add_generic(specificlist, data, memory_allocation_automatic)
Adds an element to the end of the list.
Pops a logical element off the stack or queue.
Map data structure that holds string (length 20 maximum) key value pairs.
logical function hashmap_generic_entry_at(specificmap, i, key, val)
Retrieves the entry at a specific map index or null if index > map elements.
character(len=string_length) function queue_get_string(specificqueue, i)
Returns a specific queue element at an index.
subroutine stack_push_string(specificstack, str_data)
Pushes an element onto the stack (LIFO)
integer function queue_get_int(specificqueue, i)
Returns a specific queue element at an index.
Returns the number of elements in the collection.
Inserts a string into the list or places at the end if the index > list size.
character(len=string_length) function queue_pop_string(specificqueue)
Pops the queue element off the head of the queue (FIFO)
subroutine stack_push_real(specificstack, real_data)
Pushes an element onto the stack (LIFO)
real(kind=default_precision) function map_real_at(specificmap, i)
Retrieves the real value held at the specific map index. Converts between precision and int...
type(iterator_type) function hashset_get_iterator(specificset)
Retrieves an iterator representation of the hashset, ready to access the first element.
integer function list_size(specificlist)
Returns the number of elements in a list.
logical function hashmap_logical_at(specificmap, i)
Retrieves the value held at the specific hashmap index. Note that this is an expensive operation has ...
Collection data structures.
subroutine hashset_remove(specificset, key)
Removes a string from the hashset.
subroutine queue_push_int(specificqueue, int_data)
Adds an element to the end of the queue (FIFO)
type(iterator_type) function queue_get_iterator(specificqueue)
Retrieves an iterator representation of the queue, ready to access the first element.
subroutine list_add_logical(specificlist, logical_data)
Adds an element to the end of the list.
type(iterator_type) function map_get_iterator(specificmap)
Retrieves an iterator representation of the map, ready to access the first element.
type(iterator_type) function hashmap_get_iterator(specificmap)
Retrieves an iterator representation of the hashmap, ready to access the first element.
Retrieves a map entry at a specific index. This is more efficient than calling key at and then value ...
Pushes a string element onto the stack or queue.
logical function hashmap_real_entry_at(specificmap, i, key, real_val)
Retrieves the entry at a specific map index. This converts between precision and from int...
Inserts a double precision real element into the list or places at the end if the index > list size...
logical function map_is_empty(specificmap)
Returns whether a map is empty.
integer function hashmap_get_int(specificmap, key)
Gets a specific element out of the hashmap with the corresponding key.
integer function iterator_get_next_integer(iterator)
Returns the next integer referenced by the iterator and advanced it, or an error if it has reached th...
integer function stack_get_int(specificstack, i)
Gets a specific element from the stack at index specified.
Converts data types to real.
real(kind=default_precision) function hashmap_get_real(specificmap, key)
Gets a specific element out of the hashmap with the corresponding key. Converts between precision and...
logical function hashmap_integer_entry_at(specificmap, i, key, int_val)
Retrieves the entry at a specific map index.
integer, parameter, public string_length
Default length of strings.
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 elemen...
subroutine hashmap_put_int(specificmap, key, int_data)
Puts a specific key-value pair into the hashmap.
Retrieves a map entry at a specific index or null if index > map elements. This is more efficient tha...
character(len=string_length) function hashmap_string_at(specificmap, i)
Retrieves the value held at the specific hashmap index. Note that this is an expensive operation has ...
character(len=string_length) function list_get_string(specificlist, i)
Retrieves the element at index i from the list.
List data structure which implements a doubly linked list. This list will preserve its order...
subroutine hashset_getlocation(specificset, key, hash, key_location)
Determines the location and hash of a key within a specific hashset. The hash is set regardless of wh...
Queue (FIFO) data structure.
real(kind=default_precision) function, pointer, public generic_to_double_real(generic, makecopy)
Converts a generic to a double real.
subroutine hashset_add(specificset, key)
Adds a string to the hashset which stores unique strings, therefore if the string already exists then...
logical function stack_is_empty(specificstack)
Returns whether a stack is empty.
subroutine list_free(specificlist)
Frees up all the allocatable, heap, memory associated with a specific list.
class(*) function, pointer hashmap_getnode(specificmap, key, key_location)
This gets the hashmap node that the key represents (rather than the specific value) ...
Adds a generic element to the end of the list.
subroutine stack_free(specificstack)
Frees up all the allocatable, heap, memory associated with a specific stack.
subroutine list_insert_string(specificlist, str_data, i)
Inserts an element into the list or places at the end if the index > list size.
subroutine stack_push_generic(specificstack, data, memory_allocation_automatic)
Pushes an element onto the stack (LIFO)
class(*) function, pointer stack_pop_generic(specificstack)
Pops an element off the stack (LIFO)
Pushes a logical element onto the stack or queue.
logical function map_integer_entry_at(specificmap, i, key, int_val)
Retrieves the entry at a specific map index or null if index > map elements.
integer function hashset_size(specificset)
Returns the number of elements in a list.
Pops an integer element off the stack or queue.
Frees up all the allocatable, heap, memory associated with a list, stack, queue or map...
class(*) function, pointer iterator_get_next_generic(iterator)
Returns the next generic referenced by the iterator and advanced it, or null if it has reached the en...
Retrieves the logical value held at the specific map index or null if index > map elements...
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...
real(kind=default_precision) function queue_pop_real(specificqueue)
Pops the queue element off the head of the queue (FIFO). Converts between precision and from int...
class(*) function, pointer mapentry_get_generic(mapentry_item)
Retrieves the generic value from a map entry.
class(*) function, pointer hashmap_generic_at(specificmap, i)
Retrieves the value held at the specific hashmap index or null if index > map elements. Note that this is an expensive operation has it has to potentially process all internal hashed lists so avoid if can.
subroutine list_insert_logical(specificlist, logical_data, i)
Inserts an element into the list or places at the end if the index > list size.
Puts a generic key-value pair into the map.
logical function hashmap_string_entry_at(specificmap, i, key, str_val)
Retrieves the entry at a specific map index.
integer function queue_pop_int(specificqueue)
Pops the queue element off the head of the queue (FIFO)
integer function map_get_int(specificmap, key)
Gets a specific element out of the map with the corresponding key.
subroutine hashmap_put_real(specificmap, key, real_data)
Puts a specific key-value pair into the hashmap.
integer function queue_size(specificqueue)
Returns the number of elements held in a queue.
Retrieves the generic value held at the specific map index or null if index > map elements...
Pushes an integer element onto the stack or queue.
Hashset structure which will store unique strings. The hashing aspect means that lookup is very fast ...
Stack (FILO) data structure.
character(len=string_length) function map_get_string(specificmap, key)
Gets a specific element out of the map with the corresponding key.
character(len=string_length) function mapentry_get_string(mapentry_item)
Retrieves the string value from a map entry.
Converts data types to integers.
character(len=string_length) function stack_get_string(specificstack, i)
Gets a specific element from the stack at index specified.
Determines whether or not a map contains a specific key.
Gets a specific double precision real element out of the list, stack, queue or map with the correspon...
logical function iterator_get_next_logical(iterator)
Returns the next logical referenced by the iterator and advanced it, or an error if it has reached th...
Adds a string to the end of the list.
subroutine hashmap_free(specificmap)
Frees up all the allocatable, heap, memory associated with a specific hashmap.
Retrieves a map entry at a specific index. This is more efficient than calling key at and then value ...
logical function list_get_logical(specificlist, i)
Retrieves the element at index i from the list.
integer function hashmap_integer_at(specificmap, i)
Retrieves the value held at the specific hashmap index. Note that this is an expensive operation has ...
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.
Retrieves a map entry at a specific index. This is more efficient than calling key at and then value ...
subroutine list_insert_real(specificlist, real_data, i)
Inserts an element into the list or places at the end if the index > list size.
Gets a specific string element out of the list, stack, queue or map with the corresponding key...
Retrieves the double precision real value held at the specific map index or null if index > map eleme...
Pops a double precision real element off the stack or queue.
subroutine queue_push_generic(specificqueue, data, memory_allocation_automatic)
Adds an element to the end of the queue (FIFO)
real(kind=double_precision) function, public conv_single_real_to_double(input_real)
Converts from a single to double precision real. This applies some rounding to a certain number of de...
Retrieves a map entry at a specific index. This is more efficient than calling key at and then value ...
Puts a double precision real key-value pair into the map.
class(*) function, pointer map_generic_at(specificmap, i)
Retrieves the generic value held at the specific map index or null if index > map elements...
Removes a specific element from the list or map.
class(*) function, pointer list_get_generic(specificlist, i)
Retrieves the element at index i from the list or null if index < list size.