set_option Subroutine

private pure subroutine set_option(self, option_name, val, error)

Set option value (scalar).

Arguments

TypeIntentOptionalAttributesName
class(section), intent(inout) :: self

Section data.

character, intent(in) :: option_name

Option name.

class(*), intent(in) :: val

Value.

integer(kind=I4P), intent(out), optional :: error

Error code.


Contents

Source Code


Source Code

  pure subroutine set_option(self, option_name, val, error)
  !< Set option value (scalar).
  class(section), intent(inout)         :: self        !< Section data.
  character(*),   intent(in)            :: option_name !< Option name.
  class(*),       intent(in)            :: val         !< Value.
  integer(I4P),   intent(out), optional :: error       !< Error code.
  integer(I4P)                          :: errd        !< Error code.
  integer(I4P)                          :: o           !< Counter.

  errd = ERR_SECTION_OPTIONS
  if (allocated(self%options)) then
    do o=1, size(self%options, dim=1)
      if (self%options(o) == trim(adjustl(option_name))) then
        call self%options(o)%set(val=val)
        errd = 0
        exit
      endif
    enddo
  endif
  if (present(error)) error = errd
  endsubroutine set_option