9 #include "configFileHelpers.hpp"
13 #include <type_traits>
17 template<
typename Callable>
18 bool addTargets(
const toml::value& section, std::string targetName, Callable callback)
23 auto targets = toml::find_or(section, targetName, uval);
24 if (!targets.is_uninitialized()) {
25 if (targets.is_array()) {
26 auto& targetArray = targets.as_array();
27 for (
const auto& target : targetArray) {
28 callback(
static_cast<const std::string&
>(target.as_string()));
31 callback(
static_cast<const std::string&
>(targets.as_string()));
35 if (targetName.back() ==
's') {
36 targetName.pop_back();
38 target = toml::find_or(section, targetName, target);
39 if (!target.empty()) {
47 template<
typename Callable>
48 bool addTargets(
const Json::Value& section, std::string targetName, Callable callback)
52 if (section.isMember(targetName)) {
53 auto targets = section[targetName];
54 if (targets.isArray()) {
55 for (
const auto& target : targets) {
56 callback(target.asString());
59 callback(targets.asString());
63 if (targetName.back() ==
's') {
64 targetName.pop_back();
65 if (section.isMember(targetName)) {
66 callback(section[targetName].asString());
73 template<
typename Block,
typename Callable>
74 void addTargetVariations(
const Block& section,
75 const std::string& name1,
79 bool found = addTargets(section, name1 +
"_" + name2, callback);
81 found = addTargets(section, name1 + name2, callback);
84 name2.front() = std::toupper(name2.front());
85 addTargets(section, name1 + name2, callback);
89 void processOptions(
const toml::value& section,
90 const std::function<
int(
const std::string&)>& optionConversion,
91 const std::function<
int(
const std::string&)>& valueConversion,
92 const std::function<
void(
int,
int)>& optionAction);
94 void processOptions(
const Json::Value& section,
95 const std::function<
int(
const std::string&)>& optionConversion,
96 const std::function<
int(
const std::string&)>& valueConversion,
97 const std::function<
void(
int,
int)>& optionAction);
99 void loadTags(
const Json::Value& section,
100 const std::function<
void(std::string_view, std::string_view)>& tagAction);
102 void loadTags(
const toml::value& section,
103 const std::function<
void(std::string_view, std::string_view)>& tagAction);
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14