@@ -94,6 +94,7 @@ module stdlib_hashmaps
9494 procedure , non_overridable, pass(map) :: map_probes
9595 procedure , non_overridable, pass(map) :: num_slots
9696 procedure , non_overridable, pass(map) :: slots_bits
97+ procedure (get_all_keys), deferred, pass(map) :: get_all_keys
9798 procedure (get_other), deferred, pass(map) :: get_other_data
9899 procedure (init_map), deferred, pass(map) :: init
99100 procedure (key_test), deferred, pass(map) :: key_test
@@ -109,6 +110,21 @@ module stdlib_hashmaps
109110
110111 abstract interface
111112
113+ subroutine get_all_keys (map , all_keys )
114+ ! ! Version: Experimental
115+ ! !
116+ ! ! Returns the all keys contained in a hash map
117+ ! ! ([Specifications](../page/specs/stdlib_hashmaps.html#get_all_keys-returns-all-the-keys-contained-in-a-map))
118+ ! !
119+ ! ! Arguments:
120+ ! ! map - a hash map
121+ ! ! all_keys - all the keys contained in a hash map
122+ !
123+ import hashmap_type, key_type
124+ class(hashmap_type), intent (in ) :: map
125+ type (key_type), allocatable , intent (out ) :: all_keys(:)
126+ end subroutine get_all_keys
127+
112128 subroutine get_other ( map , key , other , exists )
113129! ! Version: Experimental
114130! !
@@ -319,6 +335,7 @@ end function total_depth
319335 type (chaining_map_entry_ptr), allocatable :: slots(:)
320336! ! Array of bucket lists Note # slots=size(slots)
321337 contains
338+ procedure :: get_all_keys = > get_all_chaining_keys
322339 procedure :: get_other_data = > get_other_chaining_data
323340 procedure :: init = > init_chaining_map
324341 procedure :: loading = > chaining_loading
@@ -345,6 +362,19 @@ module subroutine free_chaining_map( map )
345362 end subroutine free_chaining_map
346363
347364
365+ module subroutine get_all_chaining_keys (map , all_keys )
366+ ! ! Version: Experimental
367+ ! !
368+ ! ! Returns all the keys contained in a hashmap
369+ ! ! Arguments:
370+ ! ! map - an chaining hash map
371+ ! ! all_keys - all the keys contained in a hash map
372+ !
373+ class(chaining_hashmap_type), intent (in ) :: map
374+ type (key_type), allocatable , intent (out ) :: all_keys(:)
375+ end subroutine get_all_chaining_keys
376+
377+
348378 module subroutine get_other_chaining_data ( map , key , other , exists )
349379! ! Version: Experimental
350380! !
@@ -556,6 +586,7 @@ end function total_chaining_depth
556586 integer (int_index), allocatable :: slots(:)
557587! ! Array of indices to the inverse Note # slots=size(slots)
558588 contains
589+ procedure :: get_all_keys = > get_all_open_keys
559590 procedure :: get_other_data = > get_other_open_data
560591 procedure :: init = > init_open_map
561592 procedure :: loading = > open_loading
@@ -581,6 +612,19 @@ module subroutine free_open_map( map )
581612 end subroutine free_open_map
582613
583614
615+ module subroutine get_all_open_keys (map , all_keys )
616+ ! ! Version: Experimental
617+ ! !
618+ ! ! Returns all the keys contained in a hashmap
619+ ! ! Arguments:
620+ ! ! map - an open hash map
621+ ! ! all_keys - all the keys contained in a hash map
622+ !
623+ class(open_hashmap_type), intent (in ) :: map
624+ type (key_type), allocatable , intent (out ) :: all_keys(:)
625+ end subroutine get_all_open_keys
626+
627+
584628 module subroutine get_other_open_data ( map , key , other , exists )
585629! ! Version: Experimental
586630! !
0 commit comments