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> 31 virtual int NElements();
70 void SetCurrentNode(xmlpp::Node* node);
73 std::set<InfileTree*> spawned_children_;
74 xmlpp::Node* current_node_;
85 return boost::lexical_cast<T>(tree->
GetString(query, index).c_str());
97 return boost::lexical_cast<
int>(s.c_str());
104 return boost::lexical_cast<
float>(s.c_str());
111 return boost::lexical_cast<
double>(s.c_str());
120 template <
typename T>
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());
180 #endif // CYCLUS_SRC_INFILE_TREE_H_ double OptionalQuery(InfileTree *tree, std::string query, double default_val)
virtual int NMatches(std::string query)
investigates the current status and returns the number of elements matching a query ...
A class for extracting information from a given XML parser.
double Query(InfileTree *tree, std::string query, int index)
A helper class to hold xml file data and provide automatic validation.
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...
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.