to_real Subroutine

private subroutine to_real(json, p, val, name)

Change the json_value variable to a real.

Type Bound

json_core

Arguments

Type IntentOptional Attributes Name
class(json_core), intent(inout) :: json
type(json_value), pointer :: p
real(kind=RK), intent(in), optional :: val

if the value is also to be set (if not present, then 0.0_rk is used).

character(kind=CK, len=*), intent(in), optional :: name

if the name is also to be changed.


Calls

proc~~to_real~~CallsGraph proc~to_real json_core%to_real proc~destroy_json_data destroy_json_data proc~to_real->proc~destroy_json_data

Called by

proc~~to_real~~CalledByGraph proc~to_real json_core%to_real proc~json_update_real json_core%json_update_real proc~json_update_real->proc~to_real proc~json_value_create_real json_core%json_value_create_real proc~json_value_create_real->proc~to_real proc~parse_number json_core%parse_number proc~parse_number->proc~to_real none~update json_core%update none~update->proc~json_update_real proc~json_update_real32 json_core%json_update_real32 none~update->proc~json_update_real32 proc~parse_value json_core%parse_value proc~parse_value->proc~parse_number proc~parse_array json_core%parse_array proc~parse_value->proc~parse_array proc~parse_object json_core%parse_object proc~parse_value->proc~parse_object proc~json_file_update_integer json_file%json_file_update_integer proc~json_file_update_integer->none~update proc~json_file_update_logical json_file%json_file_update_logical proc~json_file_update_logical->none~update proc~json_file_update_real json_file%json_file_update_real proc~json_file_update_real->none~update proc~json_file_update_string json_file%json_file_update_string proc~json_file_update_string->none~update proc~json_parse_file json_core%json_parse_file proc~json_parse_file->proc~parse_value proc~json_parse_string json_core%json_parse_string proc~json_parse_string->proc~parse_value proc~json_update_real32->none~update proc~json_update_string_name_ascii json_update_string_name_ascii proc~json_update_string_name_ascii->none~update proc~json_update_string_val_ascii json_update_string_val_ascii proc~json_update_string_val_ascii->none~update proc~parse_array->proc~parse_value proc~parse_object->proc~parse_value proc~parse_object->proc~parse_object proc~wrap_json_update_integer wrap_json_update_integer proc~wrap_json_update_integer->none~update proc~wrap_json_update_logical wrap_json_update_logical proc~wrap_json_update_logical->none~update proc~wrap_json_update_real wrap_json_update_real proc~wrap_json_update_real->none~update proc~wrap_json_update_real32 wrap_json_update_real32 proc~wrap_json_update_real32->none~update proc~wrap_json_update_string wrap_json_update_string proc~wrap_json_update_string->none~update none~deserialize json_core%deserialize none~deserialize->proc~json_parse_string none~load json_core%load none~load->proc~json_parse_file none~update~2 json_file%update none~update~2->proc~json_file_update_integer none~update~2->proc~json_file_update_logical none~update~2->proc~json_file_update_real none~update~2->proc~json_file_update_string proc~json_file_update_real32 json_file%json_file_update_real32 none~update~2->proc~json_file_update_real32 proc~json_file_load json_file%json_file_load proc~json_file_load->none~load proc~json_file_load_from_string json_file%json_file_load_from_string proc~json_file_load_from_string->none~deserialize proc~json_file_update_real32->none~update~2 proc~json_file_update_string_name_ascii json_file_update_string_name_ascii proc~json_file_update_string_name_ascii->none~update~2 proc~json_file_update_string_val_ascii json_file_update_string_val_ascii proc~json_file_update_string_val_ascii->none~update~2 proc~wrap_json_file_update_integer wrap_json_file_update_integer proc~wrap_json_file_update_integer->none~update~2 proc~wrap_json_file_update_logical wrap_json_file_update_logical proc~wrap_json_file_update_logical->none~update~2 proc~wrap_json_file_update_real wrap_json_file_update_real proc~wrap_json_file_update_real->none~update~2 proc~wrap_json_file_update_real32 wrap_json_file_update_real32 proc~wrap_json_file_update_real32->none~update~2 proc~wrap_json_file_update_string wrap_json_file_update_string proc~wrap_json_file_update_string->none~update~2 proc~wrap_json_parse_string wrap_json_parse_string proc~wrap_json_parse_string->none~deserialize none~deserialize~2 json_file%deserialize none~deserialize~2->proc~json_file_load_from_string proc~assign_string_to_json_file json_file%assign_string_to_json_file proc~assign_string_to_json_file->none~deserialize~2 proc~initialize_json_file_from_string initialize_json_file_from_string proc~initialize_json_file_from_string->none~deserialize~2 proc~initialize_json_file_from_string_v2 initialize_json_file_from_string_v2 proc~initialize_json_file_from_string_v2->none~deserialize~2 proc~wrap_json_file_load_from_string wrap_json_file_load_from_string proc~wrap_json_file_load_from_string->none~deserialize~2 interface~json_file json_file interface~json_file->proc~initialize_json_file_from_string interface~json_file->proc~initialize_json_file_from_string_v2 proc~wrap_assign_string_to_json_file wrap_assign_string_to_json_file proc~wrap_assign_string_to_json_file->proc~assign_string_to_json_file proc~wrap_initialize_json_file_from_string wrap_initialize_json_file_from_string proc~wrap_initialize_json_file_from_string->proc~initialize_json_file_from_string proc~wrap_initialize_json_file_from_string_v2 wrap_initialize_json_file_from_string_v2 proc~wrap_initialize_json_file_from_string_v2->proc~initialize_json_file_from_string_v2

Source Code

    subroutine to_real(json,p,val,name)

    implicit none

    class(json_core),intent(inout)               :: json
    type(json_value),pointer                     :: p
    real(RK),intent(in),optional                 :: val   !! if the value is also to be set
                                                          !! (if not present, then 0.0_rk is used).
    character(kind=CK,len=*),intent(in),optional :: name  !! if the name is also to be changed.

    !set type and value:
    call destroy_json_data(p)
    p%var_type = json_real
    allocate(p%dbl_value)
    if (present(val)) then
        p%dbl_value = val
    else
        p%dbl_value = 0.0_RK    !default value
    end if

    !name:
    if (present(name)) call json%rename(p,name)

    end subroutine to_real