placeat_ga_stringkeyvaluepair Subroutine

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

adds the value to 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 element at the requested position will be replaced.

Arguments

Type IntentOptional Attributes Name
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~~CallsGraph proc~placeat_ga_stringkeyvaluepair placeat_ga_stringkeyvaluepair interface~expand~24 expand proc~placeat_ga_stringkeyvaluepair->interface~expand~24 proc~expand_ga_stringkeyvaluepair expand_ga_stringkeyvaluepair interface~expand~24->proc~expand_ga_stringkeyvaluepair

Called by

proc~~placeat_ga_stringkeyvaluepair~~CalledByGraph proc~placeat_ga_stringkeyvaluepair placeat_ga_stringkeyvaluepair interface~placeat~14 placeat interface~placeat~14->proc~placeat_ga_stringkeyvaluepair

Contents


Source Code

  subroutine placeat_ga_stringkeyvaluepair(me, val, pos, length)
    type(grw_stringkeyvaluepairarray_type) :: me !< array to place the value into
    type(tem_stringkeyvaluepair_type), intent(in) :: val !< value to place at the given position
    integer, intent(in) :: pos !< predefined position
    !> optional length to expand the array
    integer, intent(in), optional :: length


    ! value to append is larger than all existing ones,
    ! just put it to the end of the list, this captures
    ! also the case of empty lists.
    ! in this case foundpos = me%nvals + 1 holds.
    if (pos > me%containersize) then
      ! expand the array, if its boundary is reached
      call expand(me = me, pos = pos, length = length)
    end if

    me%nvals = max( pos, me%nvals )
    me%val(pos) = val

  end subroutine placeat_ga_stringkeyvaluepair