hash_map_get Subroutine

private subroutine hash_map_get(this, key, value, found)

Look up key. A missing key is an ordinary outcome, not an error: found comes back .false. and value is set to 0.

Type Bound

hash_map_t

Arguments

Type IntentOptional Attributes Name
class(hash_map_t), intent(in) :: this
character(len=*), intent(in) :: key
integer(kind=int64), intent(out) :: value
logical, intent(out) :: found

Calls

proc~~hash_map_get~~CallsGraph proc~hash_map_get hash_map_t%hash_map_get proc~find_entry find_entry proc~hash_map_get->proc~find_entry proc~home_bucket home_bucket proc~find_entry->proc~home_bucket proc~key_matches key_matches proc~find_entry->proc~key_matches interface~fnv_1a_hash fnv_1a_hash proc~home_bucket->interface~fnv_1a_hash

Variables

Type Visibility Attributes Name Initial
integer(kind=default_int), private :: entry

Source Code

   subroutine hash_map_get(this, key, value, found)
      !! Look up `key`. A missing key is an ordinary outcome, not an error:
      !! `found` comes back `.false.` and `value` is set to 0.
      class(hash_map_t), intent(in) :: this
      character(len=*), intent(in) :: key
      integer(int64), intent(out) :: value
      logical, intent(out) :: found

      integer(default_int) :: entry

      entry = find_entry(this, key)
      found = (entry > 0)
      if (found) then
         value = this%entry_value(entry)
      else
         value = 0_int64
      end if
   end subroutine hash_map_get