Read a value as real(dp), strictly.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cli_t), | intent(in) | :: | this | |||
| character(len=*), | intent(in) | :: | name |
Long name of a declared entry. |
||
| real(kind=dp), | intent(out) | :: | value |
Parsed value; zero when the conversion failed. |
||
| type(error_t), | intent(inout), | optional | :: | err |
Set on an undeclared name or an unparsable value. |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(error_t), | private | :: | local | ||||
| type(string_type), | private | :: | text |
subroutine cli_get_real_dp(this, name, value, err) !! Read a value as `real(dp)`, strictly. class(cli_t), intent(in) :: this character(len=*), intent(in) :: name !! Long name of a declared entry. real(dp), intent(out) :: value !! Parsed value; zero when the conversion failed. type(error_t), intent(inout), optional :: err !! Set on an undeclared name or an unparsable value. type(string_type) :: text type(error_t) :: local value = 0.0_dp call this%get_string(name, text, err) if (present(err)) then if (err%has_error()) return else if (this%find(name) == 0_default_int) return end if call parse_real(char(text), value, local) if (local%has_error()) then call fail(err, ERROR_PARSE, "pic_cli: "//name//" is not a real: "//char(text)) end if end subroutine cli_get_real_dp