1#ifndef CYCLUS_SRC_INFILE_TREE_H_
2#define CYCLUS_SRC_INFILE_TREE_H_
8#include <boost/algorithm/string.hpp>
9#include <boost/lexical_cast.hpp>
42 virtual int NMatches(std::string query);
48 virtual std::string
GetString(std::string query,
int index = 0);
73 std::set<InfileTree*> spawned_children_;
74 xmlpp::Node* current_node_;
85 return boost::lexical_cast<T>(tree->
GetString(query, index).c_str());
95 std::string s = tree->
GetString(query, index);
97 return boost::lexical_cast<int>(s.c_str());
102 std::string s = tree->
GetString(query, index);
104 return boost::lexical_cast<float>(s.c_str());
109 std::string s = tree->
GetString(query, index);
111 return boost::lexical_cast<double>(s.c_str());
124 val = boost::lexical_cast<T>(tree->
GetString(query).c_str()) :
132 int val = default_val;
136 val = boost::lexical_cast<int>(s.c_str());
150 std::transform(s.begin(), s.end(), s.begin(), ::tolower);
151 return s ==
"true" || s ==
"t" || s ==
"1";
157 float val = default_val;
161 val = boost::lexical_cast<float>(s.c_str());
168 double default_val) {
169 double val = default_val;
173 val = boost::lexical_cast<double>(s.c_str());
A class for extracting information from a given XML parser.
virtual InfileTree * GetEngineFromQuery(std::string query, int index)
every derived infile must return a new instance initialized by a query.
InfileTree(XMLParser &parser)
constructor given a parser
virtual int NMatches(std::string query)
investigates the current status and returns the number of elements matching a query
virtual std::string GetElementName(int index=0)
investigates the current status and returns a string representing the name of a given index
InfileTree * SubTree(std::string query, int index=0)
populates a child infile based on a query and index
void SetCurrentNode(xmlpp::Node *node)
sets the current node to a given node
virtual std::string GetString(std::string query, int index=0)
investigates the current status and returns a string representing the content of a query at a given i...
A helper class to hold xml file data and provide automatic validation.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
T Query(InfileTree *tree, std::string query, int index=0)
a query method for required parameters
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters