Globals Library 1.0
Loading...
Searching...
No Matches
jsondata Module Reference

Data Types

type  json_type
 Derived data type to handle JSON data. More...

Functions/Subroutines

subroutine init_core (this)
 Static constructor for internal JSON core settings.
subroutine throw_error (this)
 Checks for parsing/runtime errors and raises Fortran exception.
subroutine init_empty (this)
 Initialize the object as an empty JSON file/database.
subroutine init_string (this, str)
 Initialize the object from a JSON string payload.
subroutine kill_json_type (this)
 Destroys the JSON object and deallocates internal variables.
subroutine finalize_json_type (this)
 Finalization routine triggered implicitly when object goes out of scope or is destroyed.
subroutine write_to_console (this)
 Print the JSON object representation to standard output.
subroutine write_to_unit (this, iunit)
 Print the JSON object representation to a specific formatted Fortran unit.
subroutine write_to_file (this, filename)
 Save the JSON object representation directly to a file.
subroutine load_file_name (this, filename)
 Construct a JSON structure from a JSON file path.
logical function check_path_is_valid (this, path)
 Verify if a specific path exists within the JSON tree.
subroutine rename_path (this, path, new_name)
 Rename a node located at the specified path.
subroutine remove_path (this, path)
 Remove a node located at the specified path entirely.
subroutine set_object (this, path, value)
 Append a deeply copied instance of another JSON object at path.
subroutine set_logical (this, path, value)
 Setup a logical boolean value inside the JSON tree.
subroutine set_integer (this, path, value)
 Setup an integer value inside the JSON tree.
subroutine set_real (this, path, value)
 Setup a float literal (double precision) value into JSON tree.
subroutine set_string (this, path, value)
 Setup a JSON string scalar property.
subroutine set_vec_logical (this, path, value)
 Adds an array dimension of logic variables linearly.
subroutine set_vec_integer (this, path, value)
 Adds an array block size containing integers to current root.
subroutine set_vec_real (this, path, value)
 Adds an array literal values consisting of double precisions.
subroutine get_object (this, path, value)
 Parses a subtree and clones its content into an alternative object variable.
subroutine get_integer (this, path, value, default)
 Retrive integer primitive from loaded property tree.
subroutine get_real (this, path, value, default)
 Retrieve floating point double sequence type variable.
subroutine get_logical (this, path, value, default)
 Get a logical expression defined inside properties list mapping.
subroutine get_string (this, path, value, default)
 Retrieve string character definitions loaded dynamically via parsed map length format.
subroutine get_vec_integer (this, path, value, default)
 Parses target dynamically evaluated integer matrix structure hierarchy sequences.
subroutine get_vec_real (this, path, value, default)
 Retrives continuous unmapped values sequence containing decimal arrays.
subroutine get_vec_logical (this, path, value, default)
 Returns memory structure block sequences representing dynamically stored logic array data.
subroutine set_null_value (this, path)
 Modifies payload hierarchy to explicitly associate a JSON null block.
subroutine set_vec_null_value (this, path, nvalues)
 Evaluates an explicitly formatted sized array mapped block of JSON null components.
subroutine assign_json_type (this, other)
 Prepares native assignments logic deeply copies mapping JSON representation states.

Function/Subroutine Documentation

◆ init_core()

subroutine jsondata::init_core ( class(json_type), intent(inout) this)

Static constructor for internal JSON core settings.


Sets the preferred configuration for json-fortran's core.

Definition at line 89 of file modJsonData.f90.

◆ throw_error()

subroutine jsondata::throw_error ( class(json_type), intent(inout) this)
private

Checks for parsing/runtime errors and raises Fortran exception.


If an error has been registered within the json_file instance, this subroutine throws a standard Fortran error stop with the message.

Definition at line 109 of file modJsonData.f90.

◆ init_empty()

subroutine jsondata::init_empty ( class(json_type), intent(inout) this)
private

Initialize the object as an empty JSON file/database.


Definition at line 123 of file modJsonData.f90.

◆ init_string()

subroutine jsondata::init_string ( class(json_type), intent(inout) this,
character(len=*), intent(in) str )
private

Initialize the object from a JSON string payload.


Parameters
[in]strcharacter string payload in JSON format

Definition at line 137 of file modJsonData.f90.

◆ kill_json_type()

subroutine jsondata::kill_json_type ( class(json_type), intent(inout) this)
private

Destroys the JSON object and deallocates internal variables.


Definition at line 151 of file modJsonData.f90.

◆ finalize_json_type()

subroutine jsondata::finalize_json_type ( type(json_type), intent(inout) this)
private

Finalization routine triggered implicitly when object goes out of scope or is destroyed.


Definition at line 164 of file modJsonData.f90.

◆ write_to_console()

subroutine jsondata::write_to_console ( class(json_type), intent(inout) this)
private

Print the JSON object representation to standard output.


Definition at line 175 of file modJsonData.f90.

◆ write_to_unit()

subroutine jsondata::write_to_unit ( class(json_type), intent(inout) this,
integer, intent(in) iunit )
private

Print the JSON object representation to a specific formatted Fortran unit.


Parameters
[in]iunitinteger, connected Fortran file unit

Definition at line 190 of file modJsonData.f90.

◆ write_to_file()

subroutine jsondata::write_to_file ( class(json_type), intent(inout) this,
character(len=*), intent(in) filename )
private

Save the JSON object representation directly to a file.


Parameters
[in]filenamename of the output JSON file

Definition at line 205 of file modJsonData.f90.

◆ load_file_name()

subroutine jsondata::load_file_name ( class(json_type), intent(inout) this,
character(len=*), intent(in) filename )
private

Construct a JSON structure from a JSON file path.


Parameters
[in]filenamepath to the JSON file to parse

Definition at line 220 of file modJsonData.f90.

◆ check_path_is_valid()

logical function jsondata::check_path_is_valid ( class(json_type), intent(inout) this,
character(len=*), intent(in) path )
private

Verify if a specific path exists within the JSON tree.


Parameters
[in]pathvalid JSONPath style or key path
Returns
found: logical, true if path exists, false otherwise

Definition at line 236 of file modJsonData.f90.

◆ rename_path()

subroutine jsondata::rename_path ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
character(len=*), intent(in) new_name )
private

Rename a node located at the specified path.


Parameters
[in]pathpath to the node to rename
[in]new_namenew string identifier for the node

Definition at line 252 of file modJsonData.f90.

◆ remove_path()

subroutine jsondata::remove_path ( class(json_type), intent(inout) this,
character(len=*), intent(in) path )
private

Remove a node located at the specified path entirely.


Parameters
[in]pathpath to the node to remove

Definition at line 274 of file modJsonData.f90.

◆ set_object()

subroutine jsondata::set_object ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
type(json_type), intent(inout) value )
private

Append a deeply copied instance of another JSON object at path.


Parameters
[in]pathpath where the new object will be inserted
[in,out]valuestandard json_type object (content will be copied)

Definition at line 290 of file modJsonData.f90.

◆ set_logical()

subroutine jsondata::set_logical ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
logical, intent(in) value )
private

Setup a logical boolean value inside the JSON tree.


Parameters
[in]pathtarget property path
[in]valuetarget scalar array to map

Definition at line 312 of file modJsonData.f90.

◆ set_integer()

subroutine jsondata::set_integer ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
integer, intent(in) value )
private

Setup an integer value inside the JSON tree.


Parameters
[in]pathtarget property path
[in]valuetarget scalar to map

Definition at line 329 of file modJsonData.f90.

◆ set_real()

subroutine jsondata::set_real ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
real(kind=double), intent(in) value )
private

Setup a float literal (double precision) value into JSON tree.


Parameters
[in]pathtarget property path
[in]valuetarget scalar to map

Definition at line 346 of file modJsonData.f90.

◆ set_string()

subroutine jsondata::set_string ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
character(len=*), intent(in) value )
private

Setup a JSON string scalar property.


Parameters
[in]pathtarget property path
[in]valuecharacter string to add

Definition at line 363 of file modJsonData.f90.

◆ set_vec_logical()

subroutine jsondata::set_vec_logical ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
logical, dimension(:), intent(in) value )
private

Adds an array dimension of logic variables linearly.


Parameters
[in]pathtarget property path
[in]valuelogical dimension 1 vector mapping

Definition at line 380 of file modJsonData.f90.

◆ set_vec_integer()

subroutine jsondata::set_vec_integer ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
integer, dimension(:), intent(in) value )
private

Adds an array block size containing integers to current root.


Parameters
[in]pathtarget property path
[in]valueinteger target dimensions to add

Definition at line 397 of file modJsonData.f90.

◆ set_vec_real()

subroutine jsondata::set_vec_real ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
real(kind=double), dimension(:), intent(in) value )
private

Adds an array literal values consisting of double precisions.


Parameters
[in]pathtarget property path
[in]valuesequence representing float point doubles

Definition at line 414 of file modJsonData.f90.

◆ get_object()

subroutine jsondata::get_object ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
type(json_type), intent(inout) value )
private

Parses a subtree and clones its content into an alternative object variable.


Parameters
[in]pathjson path identifier to load the object hierarchy
[in,out]valuedistinct json_type object constructed from that path copy

Definition at line 433 of file modJsonData.f90.

◆ get_integer()

subroutine jsondata::get_integer ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
integer, intent(out) value,
integer, intent(in), optional default )
private

Retrive integer primitive from loaded property tree.


Parameters
[in]pathinteger json path target to retrieve
[out]valueoutput mapped variable memory target
[in]defaultinteger default backup variable if path does not exist

Definition at line 458 of file modJsonData.f90.

◆ get_real()

subroutine jsondata::get_real ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
real(kind=double), intent(out) value,
real(kind=double), intent(in), optional default )
private

Retrieve floating point double sequence type variable.


Parameters
[in]pathtarget search index representing object floating node
[out]valueoutput double float mapped variable target
[in]defaultdouble precision backup variable definition

Definition at line 477 of file modJsonData.f90.

◆ get_logical()

subroutine jsondata::get_logical ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
logical, intent(out) value,
logical, intent(in), optional default )
private

Get a logical expression defined inside properties list mapping.


Parameters
[in]pathstructural map defining where local var resides
[out]valuemapping output variable allocation logic
[in]defaultliteral substitution default sequence expression

Definition at line 496 of file modJsonData.f90.

◆ get_string()

subroutine jsondata::get_string ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
character(len=:), intent(out), allocatable value,
character(len=*), intent(in), optional default )
private

Retrieve string character definitions loaded dynamically via parsed map length format.


Parameters
[in]pathmapping representation block identifier parameter
[out]valueexplicit allocation string containing sequence variable loaded
[in]defaultbase case default string text returned as alternative definition structure

Definition at line 518 of file modJsonData.f90.

◆ get_vec_integer()

subroutine jsondata::get_vec_integer ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
integer, dimension(:), intent(out), allocatable value,
integer, dimension(:), intent(in), optional default )
private

Parses target dynamically evaluated integer matrix structure hierarchy sequences.


Parameters
[in]pathjson-fortran query pointer representing valid location definitions array
[out]valueparsed output list of dynamically typed integers map
[in]defaultalternative list sequence to bypass failing load tree elements logic structure

Definition at line 540 of file modJsonData.f90.

◆ get_vec_real()

subroutine jsondata::get_vec_real ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
real(kind=double), dimension(:), intent(out), allocatable value,
real(kind=double), dimension(:), intent(in), optional default )
private

Retrives continuous unmapped values sequence containing decimal arrays.


Parameters
[in]pathstandard map search component path lookup identifier map sequence
[out]valuemapped data payload holding dynamic floating sequences size allocation
[in]defaultdefinition array fallback defaults representation

Definition at line 562 of file modJsonData.f90.

◆ get_vec_logical()

subroutine jsondata::get_vec_logical ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
logical, dimension(:), intent(out), allocatable value,
logical, dimension(:), intent(in), optional default )
private

Returns memory structure block sequences representing dynamically stored logic array data.


Parameters
[in]pathbase location directory to find boolean maps vector
[out]valuememory structure to assign found array boolean literals map dynamically
[in]defaultprecomputed defaults mapping fallback sequence vector structure list

Definition at line 584 of file modJsonData.f90.

◆ set_null_value()

subroutine jsondata::set_null_value ( class(json_type), intent(inout) this,
character(len=*), intent(in) path )
private

Modifies payload hierarchy to explicitly associate a JSON null block.


Parameters
[in]pathJSON property where null literal representation is added mapping identifier sequence

Definition at line 603 of file modJsonData.f90.

◆ set_vec_null_value()

subroutine jsondata::set_vec_null_value ( class(json_type), intent(inout) this,
character(len=*), intent(in) path,
integer, intent(in) nvalues )
private

Evaluates an explicitly formatted sized array mapped block of JSON null components.


Parameters
[in]pathdirectory sequence pointer map parameter reference string identifier
[in]nvaluesamount of mapped identical logical NULL array sequence size representation vector

Definition at line 622 of file modJsonData.f90.

◆ assign_json_type()

subroutine jsondata::assign_json_type ( class(json_type), intent(out) this,
type(json_type), intent(in) other )
private

Prepares native assignments logic deeply copies mapping JSON representation states.


Parameters
[in]otherrepresentation data map wrapper struct source variable reference structure target

Definition at line 640 of file modJsonData.f90.