placeat_ga_stringkeyvaluepair_vec Subroutine

private subroutine placeat_ga_stringkeyvaluepair_vec(me, val, pos, length)

adds the values starting from a given position inside the growing array.

if the requested position is outside the current array bounds, the array will be resized accordingly. if it is inside the current array bounds, the elements starting from the requested position will be replaced up to the element at position pos + size(val) - 1.

Arguments

Type IntentOptional AttributesName
type(grw_stringkeyvaluepairarray_type) :: me
type(tem_stringKeyValuePair_type), intent(in) :: val(:)
integer, intent(in) :: pos
integer, intent(in), optional :: length

optional length to expand the array


Calls

proc~~placeat_ga_stringkeyvaluepair_vec~~CallsGraph proc~placeat_ga_stringkeyvaluepair_vec placeat_ga_stringkeyvaluepair_vec interface~expand~7 expand proc~placeat_ga_stringkeyvaluepair_vec->interface~expand~7 proc~expand_ga_stringkeyvaluepair expand_ga_stringkeyvaluepair interface~expand~7->proc~expand_ga_stringkeyvaluepair

Called by

proc~~placeat_ga_stringkeyvaluepair_vec~~CalledByGraph proc~placeat_ga_stringkeyvaluepair_vec placeat_ga_stringkeyvaluepair_vec interface~placeat~6 placeat interface~placeat~6->proc~placeat_ga_stringkeyvaluepair_vec

Contents


Source Code

  subroutine placeat_ga_stringkeyvaluepair_vec(me, val, pos, length)
    type(grw_stringkeyvaluepairarray_type) :: me !< array to append the value to
    type(tem_stringkeyvaluepair_type), intent(in) :: val(:) !< values to append
    integer, intent(in) :: pos !< predefined position
    !> optional length to expand the array
    integer, intent(in), optional :: length

    integer :: ub, ii

    if (me%nvals == huge(me%nvals)) then
      write(*,*) "reached end of integer range for growing array!"
      write(*,*) "aborting!!"
      stop
    end if

    ub = pos + size(val) - 1

    if (ub > me%containersize) then
      ! expand the array, if its boundary is reached
      call expand(me = me, pos = ub, length = length)
    end if

    me%nvals = max( ub, me%nvals )
    do ii = pos, ub
      me%val(ii) = val(1+ii-pos)
    end do

  end subroutine placeat_ga_stringkeyvaluepair_vec