dict_str_i4_items Function

private function dict_str_i4_items(dict) result(items)

Returns a pointer to an array of all key/value-items stored in the dictionary. Caution: The caller is responsible for deallocating targeted array after usage.

Arguments

Type IntentOptional Attributes Name
type(dict_str_i4_type), intent(inout) :: dict

Return Value type(dict_str_i4_item_type), dimension(:), POINTER


Source Code

      FUNCTION dict_str_i4_items(dict) RESULT(items)
# 338 "/__w/dbcsr/dbcsr/src/core/dbcsr_dict.F"
      !! Returns a pointer to an array of all key/value-items stored in the dictionary.
      !! Caution: The caller is responsible for deallocating targeted array after usage.
         TYPE(dict_str_i4_type), intent(inout)  :: dict
# 341 "/__w/dbcsr/dbcsr/src/core/dbcsr_dict.F"
         TYPE(dict_str_i4_item_type), dimension(:), POINTER :: items
# 342 "/__w/dbcsr/dbcsr/src/core/dbcsr_dict.F"

         TYPE(private_item_type_str_i4), POINTER  :: item
# 344 "/__w/dbcsr/dbcsr/src/core/dbcsr_dict.F"
         INTEGER :: i, j

         IF (.not. ASSOCIATED(dict%buckets)) &
            DBCSR_ABORT("dict_str_i4_items: dictionary is not initialized.")
# 348 "/__w/dbcsr/dbcsr/src/core/dbcsr_dict.F"

         allocate (items(dict%size))
         j = 1
         do i = 1, size(dict%buckets)
            item => dict%buckets(i)%p
            do while (ASSOCIATED(item))
               items(j)%key =item%key
# 355 "/__w/dbcsr/dbcsr/src/core/dbcsr_dict.F"
               items(j)%value =item%value
# 356 "/__w/dbcsr/dbcsr/src/core/dbcsr_dict.F"
               j = j + 1
               item => item%next
            end do
         end do

         IF (j /= dict%size + 1) &
            DBCSR_ABORT("dict_str_i4_items: assertion failed!")
# 363 "/__w/dbcsr/dbcsr/src/core/dbcsr_dict.F"
      END FUNCTION dict_str_i4_items