Checks whether a given key is currently stored in the dictionary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dict_i4tuple_callstat_type), | intent(inout) | :: | dict | |||
integer(kind=int_4), | dimension(2) | :: | key |
FUNCTION dict_i4tuple_callstat_haskey(dict, key) RESULT(res) !! Checks whether a given key is currently stored in the dictionary. TYPE(dict_i4tuple_callstat_type), intent(inout) :: dict INTEGER(kind=int_4), dimension(2) :: key LOGICAL :: res TYPE(private_item_type_i4tuple_callstat), POINTER :: item INTEGER(KIND=int_8) :: hash, idx IF (.not. ASSOCIATED(dict%buckets)) & DBCSR_ABORT("dict_i4tuple_callstat_haskey: dictionary is not initialized.") res = .FALSE. IF (dict%size == 0) RETURN hash = hash_i4tuple (key) idx = MOD(hash, INT(size(dict%buckets), KIND=int_8)) + 1 item => dict%buckets(idx)%p do while (ASSOCIATED(item)) IF (item%hash == hash) THEN IF (ALL(item%key==key)) THEN res = .TRUE. return END IF END IF item => item%next end do END FUNCTION dict_i4tuple_callstat_haskey