json_get_real32_by_path Subroutine

private subroutine json_get_real32_by_path(json, me, path, value, found, default)

Alternate version of json_get_real_by_path where value=real32.

Arguments

Type IntentOptional AttributesName
class(json_core), intent(inout) :: json
type(json_value), pointer:: me
character(kind=CK,len=*), intent(in) :: path
real(kind=real32), intent(out) :: value
logical(kind=LK), intent(out), optional :: found
real(kind=real32), intent(in), optional :: default

default value if not found


Contents


Source Code

    subroutine json_get_real32_by_path(json, me, path, value, found, default)

    implicit none

    class(json_core),intent(inout)      :: json
    type(json_value),pointer            :: me
    character(kind=CK,len=*),intent(in) :: path
    real(real32),intent(out)            :: value
    logical(LK),intent(out),optional    :: found
    real(real32),intent(in),optional    :: default !! default value if not found

    real(RK) :: tmp
    real(RK) :: tmp_default

    if (present(default)) then
        tmp_default = real(default,RK)
        call json%get(me, path, tmp, found, tmp_default)
    else
        call json%get(me, path, tmp, found)
    end if

    value = real(tmp,RK)

    end subroutine json_get_real32_by_path