Get CLA (single) value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_argument), | intent(inout) | :: | self |
CLA data. |
||
class(*), | intent(inout) | :: | val |
CLA value. |
||
character(len=*), | intent(in), | optional | :: | pref |
Prefixing string. |
subroutine get_cla(self, val, pref) !< Get CLA (single) value. implicit none class(command_line_argument), intent(inout) :: self !< CLA data. class(*), intent(inout) :: val !< CLA value. character(*), optional, intent(in) :: pref !< Prefixing string. if (.not.self%is_required_passed(pref=pref)) return if (self%act==action_store.or.self%act==action_store_star) then if (self%is_passed.and.allocated(self%val)) then call self%get_cla_from_buffer(buffer=self%val, val=val, pref=pref) elseif (allocated(self%def)) then ! using default value call self%get_cla_from_buffer(buffer=self%def, val=val, pref=pref) endif if (allocated(self%choices).and.self%error==0) call self%check_choices(val=val, pref=pref) elseif (self%act==action_store_true) then if (self%is_passed) then select type(val) type is(logical) val = .true. endselect elseif (allocated(self%def)) then select type(val) type is(logical) read(self%def, *, iostat=self%error)val if (self%error/=0) call self%errored(pref=pref, error=ERROR_CASTING_LOGICAL, log_value=self%def) endselect endif elseif (self%act==action_store_false) then if (self%is_passed) then select type(val) type is(logical) val = .false. endselect elseif (allocated(self%def)) then select type(val) type is(logical) read(self%def, *, iostat=self%error)val if (self%error/=0) call self%errored(pref=pref, error=ERROR_CASTING_LOGICAL, log_value=self%def) endselect endif endif endsubroutine get_cla