Check if the key is present in the hash table.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(in) | :: | self | The hash table. |
||
class(*), | intent(in) | :: | key | The key. |
Check result.
function has_key(self, key)
!---------------------------------------------------------------------------------------------------------------------------------
!< Check if the key is present in the hash table.
!---------------------------------------------------------------------------------------------------------------------------------
class(hash_table), intent(in) :: self !< The hash table.
class(*), intent(in) :: key !< The key.
logical :: has_key !< Check result.
integer(I4P) :: b !< Bucket index.
integer(I4P) :: i !< Image index.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
has_key = .false.
if (self%is_initialized_) then
call self%get_bucket_image_indexes(key=key, bucket=b, image=i)
if (b>0.and.i==self%me) then
has_key = self%bucket(b)%has_key(key=key)
endif
endif
!---------------------------------------------------------------------------------------------------------------------------------
endfunction has_key