gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dc_hash::delete Interface Reference

Public Member Functions

subroutine dchashdelete0 (hashv, key)
 

Detailed Description

Definition at line 249 of file dc_hash.f90.

Member Function/Subroutine Documentation

◆ dchashdelete0()

subroutine dc_hash::delete::dchashdelete0 ( type(hash), intent(inout)  hashv,
character(*), intent(in), optional  key 
)

Delete associated value from hash with key

Deletes key and its associated value from hashv. If key is not found in hashv, nothing is done.

If key is omitted, all keys and values in hashv are deleted.

Parameters
[in,out]hashvHash variable
[in]keyKey string to delete (optional)

Definition at line 582 of file dc_hash.f90.

583 implicit none
584 type(HASH), intent(inout) :: hashv
585 character(*), intent(in), optional :: key
586 type(HASH_INTERNAL), pointer :: hash_table_tmp(:) => null()
587 integer :: table_size, i, j
588 logical :: found
589 character(STRING) :: search_value
590 continue
591 if (present(key)) then
592 call dchashget(hashv, key, search_value, found)
593 table_size = dchashnumber(hashv)
594 if (found .and. table_size > 1) then
595 allocate(hash_table_tmp(table_size))
596 hash_table_tmp = hashv % hash_table
597 deallocate(hashv % hash_table)
598 allocate(hashv % hash_table(table_size - 1))
599 j = 1
600 do i = 1, table_size
601 if (trim(hash_table_tmp(i) % key) /= trim(key)) then
602 hashv % hash_table(j) % key = hash_table_tmp(i) % key
603 hashv % hash_table(j) % value = hash_table_tmp(i) % value
604 j = j + 1
605 end if
606 end do
607
608 deallocate(hash_table_tmp)
609 elseif (found .and. table_size == 1) then
610 deallocate(hashv % hash_table)
611 end if
612 else
613 if (associated(hashv % hash_table)) deallocate(hashv % hash_table)
614 end if
615

The documentation for this interface was generated from the following file: