helics  2.8.1
Functions
JsonProcessingFunctions.hpp File Reference
#include "../core/helics-time.hpp"
#include "json/json.h"
#include <functional>
#include <string>

Go to the source code of this file.

Functions

bool hasJsonExtension (const std::string &jsonString)
 
Json::Value loadJson (const std::string &jsonString)
 
Json::Value loadJsonStr (const std::string &jsonString)
 
helics::Time loadJsonTime (const Json::Value &timeElement, time_units defaultUnits=time_units::sec)
 
std::string getKey (const Json::Value &element)
 
std::string generateJsonString (const Json::Value &block)
 
std::string JsonAsString (const Json::Value &element)
 
std::string getOrDefault (const Json::Value &element, const std::string &key, const std::string &defVal)
 
double getOrDefault (const Json::Value &element, const std::string &key, double defVal)
 
bool getOrDefault (const Json::Value &element, const std::string &key, bool defVal)
 
int64_t getOrDefault (const Json::Value &element, const std::string &key, int64_t defVal)
 
bool callIfMember (const Json::Value &element, const std::string &key, const std::function< void(const std::string &, helics::Time)> &call)
 
bool callIfMember (const Json::Value &element, const std::string &key, const std::function< void(const std::string &, bool)> &call)
 
bool callIfMember (const Json::Value &element, const std::string &key, const std::function< void(const std::string &, int)> &call)
 
bool callIfMember (const Json::Value &element, const std::string &key, const std::function< void(const std::string &)> &call)
 
void replaceIfMember (const Json::Value &element, const std::string &key, helics::Time &timeVal)
 
void replaceIfMember (const Json::Value &element, const std::string &key, std::string &sval)
 
void replaceIfMember (const Json::Value &element, const std::string &key, bool &bval)
 
void replaceIfMember (const Json::Value &element, const std::string &key, int &sval)
 

Detailed Description

functions related to loading and evaluating JSON files and helper functions for reading them using the jsoncpp library

Function Documentation

◆ generateJsonString()

std::string generateJsonString ( const Json::Value &  block)

◆ getKey()

std::string getKey ( const Json::Value &  element)

get a name or key from the element

◆ hasJsonExtension()

bool hasJsonExtension ( const std::string &  jsonString)

check if the file has a valid JSON extension

◆ loadJson()

Json::Value loadJson ( const std::string &  jsonString)

◆ loadJsonStr()

Json::Value loadJsonStr ( const std::string &  jsonString)

◆ loadJsonTime()

helics::Time loadJsonTime ( const Json::Value &  timeElement,
time_units  defaultUnits 
)

read a time from a JSON value element