For handling JSON config files
a class for handling JSON config files.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | private, | allocatable | :: | name |
the file name |
||
type(json_file), | public | :: | json |
made it public so we can use the methods |
procedure, public :: open => open_config_file | |
procedure, public :: close => close_config_file | |
generic, public :: get => get_int, get_real, get_logical, get_char, get_real_vec | |
procedure, private :: get_real_vec | |
procedure, private :: get_char | |
procedure, private :: get_logical | |
procedure, private :: get_real | |
procedure, private :: get_int |
Open the file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(config_file), | intent(inout) | :: | me | |||
character(len=*), | intent(in) | :: | filename |
the name of the JSON file |
Open the file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(config_file), | intent(inout) | :: | me |
Get an integer variable from the config file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(config_file), | intent(inout) | :: | me | |||
character(len=*), | intent(in) | :: | name |
name of the variable |
||
integer, | intent(inout) | :: | variable |
the variable to populate with the value |
||
logical, | intent(out), | optional | :: | found |
if the variable was in the file |
Get a real variable from the config file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(config_file), | intent(inout) | :: | me | |||
character(len=*), | intent(in) | :: | name |
name of the variable |
||
real(kind=wp), | intent(inout) | :: | variable |
the variable to populate with the value |
||
logical, | intent(out), | optional | :: | found |
if the variable was in the file |
Get a logical variable from the config file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(config_file), | intent(inout) | :: | me | |||
character(len=*), | intent(in) | :: | name |
name of the variable |
||
logical, | intent(inout) | :: | variable |
the variable to populate with the value |
||
logical, | intent(out), | optional | :: | found |
if the variable was in the file |
Get a character variable from the config file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(config_file), | intent(inout) | :: | me | |||
character(len=*), | intent(in) | :: | name |
name of the variable |
||
character(len=:), | intent(inout), | allocatable | :: | variable |
the variable to populate with the value |
|
logical, | intent(out), | optional | :: | found |
if the variable was in the file |
Get a real vector from the config file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(config_file), | intent(inout) | :: | me | |||
character(len=*), | intent(in) | :: | name |
name of the variable |
||
real(kind=wp), | intent(inout), | dimension(:), allocatable | :: | variable |
the variable to populate with the value |
|
logical, | intent(out), | optional | :: | found |
if the variable was in the file |