helics  3.5.2
Namespaces | Functions
JsonProcessingFunctions.hpp File Reference
#include "../core/helicsTime.hpp"
#include "json/json.h"
#include <functional>
#include <string>
#include <string_view>

Go to the source code of this file.

Namespaces

 helics
 the main namespace for the helics co-simulation library User functions will be in the helics namespace with internal functions possible in a lower level namespace
 

Functions

bool helics::fileops::hasJsonExtension (std::string_view jsonString)
 
bool helics::fileops::looksLikeConfigJson (std::string_view jsonString)
 
Json::Value helics::fileops::loadJson (const std::string &jsonString)
 
Json::Value helics::fileops::loadJsonStr (std::string_view jsonString)
 
helics::Time helics::fileops::loadJsonTime (const Json::Value &timeElement, time_units defaultUnits)
 
std::string helics::fileops::getName (const Json::Value &element)
 
std::string helics::fileops::generateJsonString (const Json::Value &block)
 
std::string helics::fileops::JsonAsString (const Json::Value &element)
 
std::string helics::fileops::getOrDefault (const Json::Value &element, const std::string &key, std::string_view defVal)
 
double helics::fileops::getOrDefault (const Json::Value &element, const std::string &key, double defVal)
 
bool helics::fileops::getOrDefault (const Json::Value &element, const std::string &key, bool defVal)
 
int64_t helics::fileops::getOrDefault (const Json::Value &element, const std::string &key, int64_t defVal)
 
bool helics::fileops::callIfMember (const Json::Value &element, const std::string &key, const std::function< void(const std::string &, helics::Time)> &call)
 
bool helics::fileops::callIfMember (const Json::Value &element, const std::string &key, const std::function< void(const std::string &, bool)> &call)
 
bool helics::fileops::callIfMember (const Json::Value &element, const std::string &key, const std::function< void(const std::string &, int)> &call)
 
bool helics::fileops::callIfMember (const Json::Value &element, const std::string &key, const std::function< void(const std::string &)> &call)
 
void helics::fileops::replaceIfMember (const Json::Value &element, const std::string &key, helics::Time &timeVal)
 
void helics::fileops::replaceIfMember (const Json::Value &element, const std::string &key, std::string &sval)
 
void helics::fileops::replaceIfMember (const Json::Value &element, const std::string &key, bool &bval)
 
void helics::fileops::replaceIfMember (const Json::Value &element, const std::string &key, int &sval)
 
void helics::fileops::replaceIfMember (const Json::Value &element, const std::string &key, double &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 helics::fileops::generateJsonString ( const Json::Value &  block)

generate a Json String

◆ getName()

std::string helics::fileops::getName ( const Json::Value &  element)

get a name or key from the element

◆ hasJsonExtension()

bool helics::fileops::hasJsonExtension ( std::string_view  jsonString)

check if the file has a valid JSON extension

◆ loadJson()

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

load a JSON string or filename that points to a JSON file and return a JSON::Value to the root object

◆ loadJsonStr()

Json::Value helics::fileops::loadJsonStr ( std::string_view  jsonString)

load a JSON object in a string

◆ loadJsonTime()

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

read a time from a JSON value element

◆ looksLikeConfigJson()

bool helics::fileops::looksLikeConfigJson ( std::string_view  jsonString)

check if the string looks like a possible config object in json format