@@ -254,6 +254,37 @@ module subroutine free_open_map( map )
254
254
end subroutine free_open_map
255
255
256
256
257
+ module subroutine get_all_open_keys (map , all_keys )
258
+ ! ! Version: Experimental
259
+ ! !
260
+ ! ! Returns all the keys presented in a hash map
261
+ ! ! Arguments:
262
+ ! ! map - an open hash map
263
+ ! ! all_keys - all the keys presented in a hash map
264
+ !
265
+ class(open_hashmap_type), intent (in ) :: map
266
+ type (key_type), allocatable , intent (out ) :: all_keys(:)
267
+
268
+ integer (int32) :: num_keys
269
+ integer (int_index) :: i, key_idx
270
+
271
+ num_keys = map % entries()
272
+ allocate ( all_keys(num_keys) )
273
+ if ( num_keys == 0 ) return
274
+
275
+ if ( allocated ( map % inverse) ) then
276
+ key_idx = 1_int_index
277
+ do i= 1_int_index , size ( map % inverse, kind= int_index )
278
+ if ( associated ( map % inverse(i) % target ) ) then
279
+ all_keys(key_idx) = map % inverse(i) % target % key
280
+ key_idx = key_idx + 1_int_index
281
+ end if
282
+ end do
283
+ end if
284
+
285
+ end subroutine get_all_open_keys
286
+
287
+
257
288
module subroutine get_other_open_data ( map , key , other , exists )
258
289
! ! Version: Experimental
259
290
! !
0 commit comments