get_option Subroutine

private subroutine get_option(self, option_name, val, error)

Get option value (scalar).

Arguments

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

Section data.

character, intent(in) :: option_name

Option name.

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

Value.

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

Error code.


Contents

Source Code


Source Code

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

  errd = ERR_OPTION
  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)%get(error=errd, val=val)
        exit
      endif
    enddo
  endif
  if (present(error)) error = errd
  endsubroutine get_option