Skip to content

Commit a637f50

Browse files
committed
updated specification of stdlib_hashmaps
1 parent 6937b24 commit a637f50

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

doc/specs/stdlib_hashmaps.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,10 @@ It also defines five non-overridable procedures:
890890
* `num_slots` - returns the number of slots in the map; and
891891

892892
* `slots_bits` - returns the number of bits used to address the slots;
893-
and eleven deferred procedures:
893+
894+
and ten deferred procedures:
895+
896+
* `get_all_keys` - gets all the keys presented in a map;
894897

895898
* `get_other_data` - gets the other map data associated with the key;
896899

@@ -932,6 +935,7 @@ The type's definition is below:
932935
procedure, non_overridable, pass(map) :: map_probes
933936
procedure, non_overridable, pass(map) :: slots_bits
934937
procedure, non_overridable, pass(map) :: num_slots
938+
procedure(get_all_keys), deferred, pass(map) :: get_all_keys
935939
procedure(get_other), deferred, pass(map) :: get_other_data
936940
procedure(init_map), deferred, pass(map) :: init
937941
procedure(key_test), deferred, pass(map) :: key_test
@@ -1026,6 +1030,7 @@ as follows:
10261030
type(chaining_map_entry_ptr), allocatable :: inverse(:)
10271031
type(chaining_map_entry_ptr), allocatable :: slots(:)
10281032
contains
1033+
procedure :: get_all_keys => get_all_chaining_keys
10291034
procedure :: get_other_data => get_other_chaining_data
10301035
procedure :: init => init_chaining_map
10311036
procedure :: key => chaining_key_test
@@ -1103,6 +1108,7 @@ as follows:
11031108
type(open_map_entry_ptr), allocatable :: inverse(:)
11041109
integer(int_index), allocatable :: slots(:)
11051110
contains
1111+
procedure :: get_all_keys => get_all_open_keys
11061112
procedure :: get_other_data => get_other_open_data
11071113
procedure :: init => init_open_map
11081114
procedure :: key_test => open_key_test
@@ -1148,6 +1154,9 @@ Procedures to modify the content of a map:
11481154

11491155
Procedures to report the content of a map:
11501156

1157+
* `map % get_all_keys( all_keys )` - Returns all the keys
1158+
presented in the map;
1159+
11511160
* `map % get_other_data( key, other, exists )` - Returns the other data
11521161
associated with the `key`;
11531162

@@ -1251,6 +1260,41 @@ The result will be the number of entries in the hash map.
12511260
```
12521261

12531262

1263+
#### `get_all_keys` - Returns all the keys presented in a map
1264+
1265+
##### Status
1266+
1267+
Experimental
1268+
1269+
##### Description
1270+
1271+
Returns all the keys presented in a map.
1272+
1273+
##### Syntax
1274+
1275+
`call map % [[hashmap_type(type):get_all_keys(bound)]]( all_keys )`
1276+
1277+
##### Class
1278+
1279+
Subroutine
1280+
1281+
##### Arguments
1282+
1283+
`map` (pass): shall be a scalar variable of class
1284+
`chaining_hashmap_type` or `open_hashmap_type`. It is an
1285+
`intent(in)` argument. It will be
1286+
the hash map used to store and access the other data.
1287+
1288+
`all_keys`: shall be a rank-1 allocatable array of type `key_type`.
1289+
It is an `intent(out)` argument.
1290+
1291+
##### Example
1292+
1293+
```fortran
1294+
{!example/hashmaps/example_hashmaps_get_all_keys.f90!}
1295+
```
1296+
1297+
12541298
#### `get_other_data` - Returns other data associated with the `key`
12551299

12561300
##### Status

0 commit comments

Comments
 (0)