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;
116 typedef std::map<std::string, FunctionVariableMap >
124 public boost::enable_shared_from_this<SessionReader>
141 int argc,
char *argv[])
162 std::vector<std::string> &pFilenames,
167 ::AllocateSharedPtr(argc, argv, pFilenames, pComm);
175 const std::vector<std::string> &pFilenames,
185 const std::string& pPath);
188 const std::string& pPath)
const;
204 const std::string &name)
const;
207 const std::string &pName)
const;
210 const std::string &name,
214 const std::string &name,
216 const int &def)
const;
219 const std::string &name,
223 const std::string &name,
228 const std::string &name,
232 const std::string &name,
239 const std::string &name)
const;
242 const std::string &pProperty)
const;
245 const std::string &pProperty,
const std::string &pValue);
252 const std::string &vValue)
const;
255 const std::string &name,
257 const std::string &def =
"")
const;
260 const std::string &name,
261 const std::string &trueval,
263 const bool &def =
false)
const;
266 const std::string &name,
267 const std::string &trueval)
const;
271 const std::string &name,
272 const T &trueval)
const;
281 const std::string &pName,
282 const std::string &pValue);
287 const std::string &variable,
288 const std::string &property)
const;
291 const std::string &variable,
292 const std::string &property)
const;
298 const std::string &name)
const;
301 const std::string &name,
303 const std::string &def =
"")
const;
306 const std::string &name,
308 const bool &def =
false)
const;
311 const std::string &name,
316 const std::string &name,
317 const std::string &trueval,
319 const bool &def =
false)
const;
324 const unsigned int &idx)
const;
326 const unsigned int &idx,
327 std::string newname);
335 const std::string &name)
const;
338 const std::string &name,
339 const std::string &variable,
340 const int pDomain = 0)
const;
343 const std::string &name,
344 const std::string &variable,
345 const int pDomain = 0)
const;
348 const std::string &name,
349 const unsigned int &var,
350 const int pDomain = 0)
const;
353 const std::string &name,
354 const std::string &variable,
355 const int pDomain = 0)
const;
358 const std::string &pName,
359 const unsigned int &pVar,
360 const int pDomain = 0)
const;
363 const std::string &name,
364 const std::string &variable,
365 const int pDomain = 0)
const;
368 const std::string &name,
369 const unsigned int &var,
370 const int pDomain = 0)
const;
374 const std::string &name,
375 const std::string &variable,
376 const int pDomain = 0)
const;
386 const std::string& pName)
const;
389 const std::string& pName,
390 const std::string& pValue);
393 const std::string& pName)
const;
401 const std::string& pName)
const;
403 template <
typename T>
405 const std::string& pName)
const
412 const std::string &pName,
413 const std::string &pShortName,
414 const std::string &pDescription);
418 const std::string &pName,
419 const std::string &pShortName,
420 const std::string &pDescription);
486 int argc,
char *argv[]);
493 const std::string &pFilename,
494 TiXmlDocument* pDoc)
const;
497 const std::vector<std::string> &pFilenames)
const;
517 TiXmlElement *conditions);
531 const std::string &line,
542 const std::string &name,
const T &trueval)
const
544 return (GetSolverInfoAsEnum<T>(name) == trueval);
553 const std::string &pName)
const
555 std::string vName = boost::to_upper_copy(pName);
557 "Solver info '" + pName +
"' not defined.");
563 "Enum for SolverInfo property '" + pName +
"' not found.");
566 ASSERTL0((y = x->second.find(vValue)) != x->second.end(),
567 "Value of SolverInfo property '" + pName +
580 const std::string &pName,
581 const std::string &pValue)
const
583 std::string vName = boost::to_upper_copy(pName);
588 "Enum for property '" + pName +
"' not found.");
591 ASSERTL0((y = x->second.find(pValue)) != x->second.end(),
592 "Value of property '" + pValue +
"' is invalid.");
624 std::string pEnum, std::string pString,
int pEnumValue)
626 std::string vEnum = boost::to_upper_copy(pEnum);
634 x->second[pString] = pEnumValue;
657 const std::string &pName,
658 const std::string &pValue)
660 std::string vName = boost::to_upper_copy(pName);
670 const std::string &pName,
671 const std::string &pShortName,
672 const std::string &pDescription)
674 ASSERTL0(!pName.empty(),
"Empty name for cmdline argument.");
677 x.description = pDescription;
688 const std::string &pName,
689 const std::string &pShortName,
690 const std::string &pDescription)
692 ASSERTL0(!pName.empty(),
"Empty name for cmdline argument.");
695 x.description = pDescription;
708 return shared_from_this();