dc_hash::dchashput Interface Reference

Private Member Functions

subroutine dchashput0 (hashv, key, value)
 

Detailed Description

Definition at line 119 of file dc_hash.f90.

Member Function/Subroutine Documentation

◆ dchashput0()

subroutine dc_hash::dchashput::dchashput0 ( type(hash), intent(inout)  hashv,
character(*), intent(in)  key,
character(*), intent(in)  value 
)
private

Definition at line 181 of file dc_hash.f90.

181  !
182  ! *hashv* のキー *key* に値 *value* を関連付けます.
183  !
184  implicit none
185  type(hash), intent(inout) :: hashv
186  character(*), intent(in) :: key, value
187  type(hash_internal), pointer :: hash_table_tmp(:) => null()
188  integer :: table_size, new_index, i
189  logical :: found
190  character(STRING) :: search_value
191  continue
192  call dchashget(hashv, key, search_value, found)
193  if (.not. found) then
194  table_size = dchashnumber(hashv)
195  if (table_size > 0) then
196  allocate(hash_table_tmp(table_size))
197  hash_table_tmp = hashv % hash_table
198  deallocate(hashv % hash_table)
199  allocate(hashv % hash_table(table_size + 1))
200  hashv % hash_table(1:table_size) = hash_table_tmp(1:table_size)
201  deallocate(hash_table_tmp)
202  new_index = table_size + 1
203  else
204  allocate(hashv % hash_table(1))
205  new_index = 1
206  end if
207 
208  hashv % hash_table(new_index) % key = key
209  hashv % hash_table(new_index) % value = value
210  else
211  do i = 1, size(hashv % hash_table)
212  if (trim(hashv % hash_table(i) % key) == trim(key)) then
213  hashv % hash_table(i) % value = value
214  end if
215  end do
216  end if
217 

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