1 #ifndef DATAQUEUE_CONFIGURE_HH
2 #define DATAQUEUE_CONFIGURE_HH
7 #include <boost/foreach.hpp>
8 #include <boost/tokenizer.hpp>
9 #include <boost/lexical_cast.hpp>
10 #include <boost/property_tree/ptree.hpp>
11 #include <boost/algorithm/string/trim.hpp>
19 static const boost::char_separator<char>
args_sep(
";");
20 static const boost::char_separator<char>
fields_sep(
"=");
21 static const boost::char_separator<char>
white_spaces(
"\t ");
27 boost::property_tree::ptree pt;
28 boost::tokenizer<boost::char_separator<char> > tok(str, args_sep);
33 boost::tokenizer<boost::char_separator<char> > fields(s, fields_sep);
34 typedef boost::tokenizer<boost::char_separator<char> >::iterator Iter;
36 Iter it = fields.begin();
42 if (it != fields.end()) {
49 throw std::runtime_error(
"Parsing error: malformed input buffer.");
52 if (it != fields.end()) {
53 throw std::runtime_error(
"Parsing error: malformed input buffer.");
64 boost::tokenizer<boost::char_separator<char> > elements(str, white_spaces);
68 vec.push_back(boost::lexical_cast<T>(elem));
76 #endif // DATAQUEUE_CONFIGURE_HH
static const boost::char_separator< char > fields_sep("=")
std::vector< T > vectorize(const std::string &str)
static const boost::char_separator< char > white_spaces("\t ")
std::string trim(const std::string &buffer)
Trim string.
boost::property_tree::ptree parse(std::string str)
static const boost::char_separator< char > args_sep(";")