Check type consistency.
If the key/content type-guard memebers are not already allocated the passed key/content are used as mold variables.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
||
class(*), | intent(in) | :: | key | The key. |
||
class(*), | intent(in) | :: | content | The content. |
subroutine check_type(self, key, content)
!---------------------------------------------------------------------------------------------------------------------------------
!< Check type consistency.
!<
!< @note If the key/content type-guard memebers are not already allocated the passed key/content are used as mold variables.
!---------------------------------------------------------------------------------------------------------------------------------
class(hash_table), intent(inout) :: self !< The hash table.
class(*), intent(in) :: key !< The key.
class(*), intent(in) :: content !< The content.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
if (self%is_homogeneous_) then
if (.not.allocated(self%typeguard_key)) then
allocate(self%typeguard_key, mold=key)
elseif (.not.same_type_as(self%typeguard_key, key)) then
error stop 'error: key type is different from type-guard one for the homogeneous table'
endif
if (.not.allocated(self%typeguard_content)) then
allocate(self%typeguard_content, mold=content)
elseif (.not.same_type_as(self%typeguard_content, content)) then
error stop 'error: content type is different from type-guard one for the homogeneous table'
endif
endif
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine check_type