Destroy the hash table.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
elemental subroutine destroy(self)
!---------------------------------------------------------------------------------------------------------------------------------
!< Destroy the hash table.
!---------------------------------------------------------------------------------------------------------------------------------
class(hash_table), intent(inout) :: self !< The hash table.
integer(I4P) :: b !< Counter.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
if (allocated(self%bucket)) then
do b=1, size(self%bucket, dim=1)
call self%bucket(b)%destroy
enddo
deallocate(self%bucket)
endif
if (allocated(self%ids_)) deallocate(self%ids_)
#ifdef CAF
if (allocated(self%nodes_number_)) deallocate(self%nodes_number_)
#else
self%nodes_number_ = 0_I4P
#endif
self%me = 0
self%images_number = 0
self%buckets_number = 0_I4P
self%is_homogeneous_ = .false.
self%is_initialized_ = .false.
if (allocated(self%typeguard_key)) then
associate(key=>self%typeguard_key)
select type(key)
class is(key_base)
call key%destroy
endselect
endassociate
deallocate(self%typeguard_key)
endif
if (allocated(self%typeguard_content)) then
associate(content=>self%typeguard_content)
select type(content)
class is(content_adt)
call content%destroy
endselect
endassociate
deallocate(self%typeguard_content)
endif
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine destroy