Get CLA (multiple) value with varying size, logical.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_argument), | intent(inout) | :: | self |
CLA data. |
||
logical, | intent(out), | allocatable | :: | val(:) |
CLA values. |
|
character(len=*), | intent(in), | optional | :: | pref |
Prefixing string. |
subroutine get_cla_list_varying_logical(self, val, pref) !< Get CLA (multiple) value with varying size, logical. class(command_line_argument), intent(inout) :: self !< CLA data. logical, allocatable, intent(out) :: val(:) !< CLA values. character(*), optional, intent(in) :: pref !< Prefixing string. integer(I4P) :: Nv !< Number of values. character(len=len(self%val)), allocatable :: valsV(:) !< String array of values based on self%val. character(len=len(self%def)), allocatable :: valsD(:) !< String array of values based on self%def. integer(I4P) :: v !< Values counter. if (.not.self%is_required_passed(pref=pref)) return if (.not.allocated(self%nargs)) then call self%errored(pref=pref, error=ERROR_NO_LIST) return endif if (self%act==action_store) then if (self%is_passed) then call tokenize(strin=self%val, delimiter=ARGS_SEP, toks=valsV, Nt=Nv) if (.not.self%check_list_size(Nv=Nv, val=valsV(1), pref=pref)) return allocate(logical:: val(1:Nv)) do v=1,Nv read(valsV(v), *, iostat=self%error)val(v) if (self%error/=0) then call self%errored(pref=pref, error=ERROR_CASTING_LOGICAL, log_value=valsD(v)) exit endif enddo else ! using default value call tokenize(strin=self%def, delimiter=ARGS_SEP, toks=valsD, Nt=Nv) if (.not.self%check_list_size(Nv=Nv, val=valsD(1), pref=pref)) return allocate(logical:: val(1:Nv)) do v=1,Nv read(valsD(v), *, iostat=self%error)val(v) if (self%error/=0) then call self%errored(pref=pref, error=ERROR_CASTING_LOGICAL, log_value=valsD(v)) exit endif enddo endif endif endsubroutine get_cla_list_varying_logical