openPMD-api
Public Member Functions | Public Attributes | List of all members
openPMD::json::TracingJSON Class Reference

Extend nlohmann::json with tracing of which keys have been accessed by operator[](). More...

#include <JSON_internal.hpp>

Public Member Functions

 TracingJSON (nlohmann::json, SupportedLanguages)
 
 TracingJSON (ParsedConfig)
 
nlohmann::json & json ()
 Access the underlying JSON value. More...
 
template<typename Key >
TracingJSON operator[] (Key &&key)
 
nlohmann::json const & getShadow () const
 Get the "shadow", i.e. More...
 
nlohmann::json & getShadow ()
 
nlohmann::json invertShadow () const
 Invert the "shadow", i.e. More...
 
void declareFullyRead ()
 Declare all keys of the current object read. More...
 

Public Attributes

SupportedLanguages originallySpecifiedAs {SupportedLanguages::JSON}
 

Detailed Description

Extend nlohmann::json with tracing of which keys have been accessed by operator[]().

An access is only registered if the current JSON value is a JSON object (not an array) and if the accessed JSON value is a leaf, i.e. anything but an object. This means that objects contained in arrays will not be traced.

If working directly with the underlying JSON value (necessary since this class only redefines operator[]), declareFullyRead() may be used to declare keys read manually.

Member Function Documentation

◆ declareFullyRead()

void openPMD::json::TracingJSON::declareFullyRead ( )

Declare all keys of the current object read.

Rationale: This class does not (yet) trace array types (or anything contained in an array). Use this call to explicitly declare an array as read.

◆ getShadow()

nlohmann::json const & openPMD::json::TracingJSON::getShadow ( ) const

Get the "shadow", i.e.

a copy of the original JSON value containing all accessed object keys.

Returns
nlohmann::json const&

◆ invertShadow()

nlohmann::json openPMD::json::TracingJSON::invertShadow ( ) const

Invert the "shadow", i.e.

a copy of the original JSON value that contains exactly those values that have not been accessed yet.

Returns
nlohmann::json

◆ json()

nlohmann::json& openPMD::json::TracingJSON::json ( )
inline

Access the underlying JSON value.

Returns
nlohmann::json&

The documentation for this class was generated from the following files: