Allocate dynamic memory members.
No check is done on the allocations status that must be handled outside this procedure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
||
class(*), | intent(in), | optional | :: | typeguard_key | Key type guard (mold) for homogeneous keys check. |
|
class(*), | intent(in), | optional | :: | typeguard_content | content type guard (mold) for homogeneous contents check. |
subroutine allocate_members(self, typeguard_key, typeguard_content)
!---------------------------------------------------------------------------------------------------------------------------------
!< Allocate dynamic memory members.
!<
!< @note No check is done on the allocations status that must be handled outside this procedure.
!---------------------------------------------------------------------------------------------------------------------------------
class(hash_table), intent(inout) :: self !< The hash table.
class(*), intent(in), optional :: typeguard_key !< Key type guard (mold) for homogeneous keys check.
class(*), intent(in), optional :: typeguard_content !< content type guard (mold) for homogeneous contents check.
integer(I4P) :: b !< Bucket index, namely hashed key.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
#ifdef CAF
allocate(self%bucket(1:self%buckets_number)[*])
allocate(self%ids_(1:2,1:self%buckets_number)[*])
allocate(self%nodes_number_[*])
#else
allocate(self%bucket(1:self%buckets_number))
allocate(self%ids_(1:2,1:self%buckets_number))
#endif
do b=1, self%buckets_number
self%ids_(1:2, b) = [huge(1_I8P), -huge(1_I8P)]
enddo
self%nodes_number_ = 0
if (present(typeguard_key)) allocate(self%typeguard_key, mold=typeguard_key)
if (present(typeguard_content)) allocate(self%typeguard_content, mold=typeguard_content)
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine allocate_members