36 #ifndef NEKTAR_LIB_UTILITIES_SESSIONREADER_H
37 #define NEKTAR_LIB_UTILITIES_SESSIONREADER_H
47 #include <boost/algorithm/string.hpp>
48 #include <boost/enable_shared_from_this.hpp>
49 #include <boost/program_options/variables_map.hpp>
56 namespace LibUtilities
63 typedef std::map<std::string, std::string>
TagMap;
77 typedef std::map<std::string, int>
EnumMap;
114 typedef std::map<std::string, FunctionVariableMap >
122 public boost::enable_shared_from_this<SessionReader>
139 int argc,
char *argv[])
160 std::vector<std::string> &pFilenames,
165 ::AllocateSharedPtr(argc, argv, pFilenames, pComm);
173 const std::vector<std::string> &pFilenames,
183 const std::string& pPath);
186 const std::string& pPath)
const;
201 const std::string &name)
const;
204 const std::string &pName)
const;
207 const std::string &name,
211 const std::string &name,
213 const int &def)
const;
216 const std::string &name,
220 const std::string &name,
225 const std::string &name,
229 const std::string &name,
236 const std::string &name)
const;
239 const std::string &pProperty)
const;
242 const std::string &pProperty,
const std::string &pValue);
249 const std::string &vValue)
const;
252 const std::string &name,
254 const std::string &def =
"")
const;
257 const std::string &name,
258 const std::string &trueval,
260 const bool &def =
false)
const;
263 const std::string &name,
264 const std::string &trueval)
const;
268 const std::string &name,
269 const T &trueval)
const;
278 const std::string &pName,
279 const std::string &pValue);
284 const std::string &variable,
285 const std::string &property)
const;
288 const std::string &variable,
289 const std::string &property)
const;
295 const std::string &name)
const;
298 const std::string &name,
300 const std::string &def =
"")
const;
303 const std::string &name,
305 const bool &def =
false)
const;
308 const std::string &name,
313 const std::string &name,
314 const std::string &trueval,
316 const bool &def =
false)
const;
321 const unsigned int &idx)
const;
323 const unsigned int &idx,
324 std::string newname);
332 const std::string &name)
const;
335 const std::string &name,
336 const std::string &variable,
337 const int pDomain = 0)
const;
340 const std::string &name,
341 const std::string &variable,
342 const int pDomain = 0)
const;
345 const std::string &name,
346 const unsigned int &var,
347 const int pDomain = 0)
const;
350 const std::string &name,
351 const std::string &variable,
352 const int pDomain = 0)
const;
355 const std::string &pName,
356 const unsigned int &pVar,
357 const int pDomain = 0)
const;
360 const std::string &name,
361 const std::string &variable,
362 const int pDomain = 0)
const;
365 const std::string &name,
366 const unsigned int &var,
367 const int pDomain = 0)
const;
377 const std::string& pName)
const;
380 const std::string& pName,
381 const std::string& pValue);
384 const std::string& pName)
const;
392 const std::string& pName)
const;
394 template <
typename T>
396 const std::string& pName)
const
403 const std::string &pName,
404 const std::string &pShortName,
405 const std::string &pDescription);
409 const std::string &pName,
410 const std::string &pShortName,
411 const std::string &pDescription);
479 int argc,
char *argv[]);
483 const std::string &pFilename,
484 TiXmlDocument* pDoc)
const;
487 const std::vector<std::string> &pFilenames)
const;
507 TiXmlElement *conditions);
523 const std::string &line,
534 const std::string &name,
const T &trueval)
const
536 return (GetSolverInfoAsEnum<T>(name) == trueval);
545 const std::string &pName)
const
547 std::string vName = boost::to_upper_copy(pName);
549 "Solver info '" + pName +
"' not defined.");
555 "Enum for SolverInfo property '" + pName +
"' not found.");
558 ASSERTL0((y = x->second.find(vValue)) != x->second.end(),
559 "Value of SolverInfo property '" + pName +
572 const std::string &pName,
573 const std::string &pValue)
const
575 std::string vName = boost::to_upper_copy(pName);
580 "Enum for property '" + pName +
"' not found.");
583 ASSERTL0((y = x->second.find(pValue)) != x->second.end(),
584 "Value of property '" + pValue +
"' is invalid.");
616 std::string pEnum, std::string pString,
int pEnumValue)
618 std::string vEnum = boost::to_upper_copy(pEnum);
626 x->second[pString] = pEnumValue;
649 const std::string &pName,
650 const std::string &pValue)
652 std::string vName = boost::to_upper_copy(pName);
662 const std::string &pName,
663 const std::string &pShortName,
664 const std::string &pDescription)
666 ASSERTL0(!pName.empty(),
"Empty name for cmdline argument.");
669 x.description = pDescription;
680 const std::string &pName,
681 const std::string &pShortName,
682 const std::string &pDescription)
684 ASSERTL0(!pName.empty(),
"Empty name for cmdline argument.");
687 x.description = pDescription;
700 return shared_from_this();