fixed_array_int_push_back Subroutine

private pure subroutine fixed_array_int_push_back(self, value, err)

Append an element. If the array is already at capacity the element is not stored, the size is left unchanged and err is set to ERROR_VALIDATION. On success err is left untouched.

Type Bound

fixed_array_int_t

Arguments

Type IntentOptional Attributes Name
class(fixed_array_int_t), intent(inout) :: self
integer(kind=default_int), intent(in) :: value
type(error_t), intent(inout) :: err

Calls

proc~~fixed_array_int_push_back~~CallsGraph proc~fixed_array_int_push_back fixed_array_int_t%fixed_array_int_push_back proc~error_set error_t%error_set proc~fixed_array_int_push_back->proc~error_set

Source Code

   pure subroutine fixed_array_int_push_back(self, value, err)
      !! Append an element. If the array is already at capacity the element
      !! is *not* stored, the size is left unchanged and `err` is set to
      !! `ERROR_VALIDATION`. On success `err` is left untouched.
      class(fixed_array_int_t), intent(inout) :: self
      integer(default_int), intent(in) :: value
      type(error_t), intent(inout) :: err

      if (self%n_items >= PIC_FIXED_ARRAY_CAPACITY) then
         call err%set(ERROR_VALIDATION, MSG_OVERFLOW)
         return
      end if

      self%n_items = self%n_items + 1
      self%items(self%n_items) = value
   end subroutine fixed_array_int_push_back