svZeroDSolver
Loading...
Searching...
No Matches
JsonWrapper Class Reference

Wrapper class for nlohmann:json with error checking. More...

#include <SimulationParameters.h>

Inheritance diagram for JsonWrapper:
[legend]

Public Member Functions

 JsonWrapper (const nlohmann::json &json, const std::string &component, const std::string &name_str, const int &id)
 Wrap around JSON configuration with detailed error message in case key is not found in configuration.
 
const nlohmann::json & operator[] (const char *key) const
 Wrap error check around key retrieval (throws detailed error if key doesn't exist)
 

Detailed Description

Wrapper class for nlohmann:json with error checking.

Constructor & Destructor Documentation

◆ JsonWrapper()

JsonWrapper::JsonWrapper ( const nlohmann::json & json,
const std::string & component,
const std::string & name_str,
const int & id )
inline

Wrap around JSON configuration with detailed error message in case key is not found in configuration.

Parameters
jsonJSON configuration
componentName of the JSON sub-list to be extracted
name_strName string of the JSON sub-list to be extracted
idIndex of JSON sub-list to be extracted

Member Function Documentation

◆ operator[]()

const nlohmann::json & JsonWrapper::operator[] ( const char * key) const
inline

Wrap error check around key retrieval (throws detailed error if key doesn't exist)

Parameters
keyKey to retrieve from JSON object
Returns
JSON entry of key

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