23#include <ql/errors.hpp>
35 QL_REQUIRE(
hasGroup(groupName),
"param group '" << groupName <<
"' not found");
36 auto it =
data_.find(groupName);
37 return (it->second.find(paramName) != it->second.end());
40string Parameters::get(
const string& groupName,
const string& paramName,
bool fail)
const {
42 QL_REQUIRE(
has(groupName, paramName),
"parameter " << paramName <<
" not found in param group " << groupName);
43 auto it =
data_.find(groupName);
44 return it->second.find(paramName)->second;
46 if (!
hasGroup(groupName) || !
has(groupName,paramName))
49 auto it =
data_.find(groupName);
50 return it->second.find(paramName)->second;
56 auto it =
data_.find(groupName);
57 QL_REQUIRE(it !=
data_.end(),
"param group '" << groupName <<
"' not found");
62 return data(
"markets");
66 LOG(
"load ORE configuration from " << fileName);
70 LOG(
"load ORE configuration from " << fileName <<
" done.");
79 QL_REQUIRE(setupNode,
"node Setup not found in parameter file");
80 map<string, string> setupMap;
84 setupMap[key] =
value;
86 data_[
"setup"] = setupMap;
90 map<string, string> loggingMap;
94 loggingMap[key] =
value;
96 data_[
"logging"] = loggingMap;
101 map<string, string> marketsMap;
105 marketsMap[key] =
value;
107 data_[
"markets"] = marketsMap;
114 map<string, string> analyticsMap;
119 analyticsMap[key] =
value;
121 data_[groupName] = analyticsMap;
128 QL_FAIL(
"Parameters::toXML not implemented yet");
135 for (
auto pp : p.second)
136 LOG(
"group = " << p.first <<
" : " << pp.first <<
" = " << pp.second);
void fromFile(const string &)
bool has(const string &groupName, const string ¶mName) const
string get(const string &groupName, const string ¶mName, bool fail=true) const
map< string, map< string, string > > data_
const map< string, string > & data(const string &groupName) const
const map< string, string > & markets() const
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
bool hasGroup(const string &groupName) const
XMLNode * allocNode(const string &nodeName)
XMLNode * getFirstNode(const string &name) const
static string getAttribute(XMLNode *node, const string &attrName)
static void checkNode(XMLNode *n, const string &expectedName)
static XMLNode * getChildNode(XMLNode *n, const string &name="")
static string getNodeValue(XMLNode *node)
static XMLNode * getNextSibling(XMLNode *node, const string &name="")
SafeStack< ValueType > value
Open Risk Engine setup and analytics choice.