29 #include <boost/regex.hpp>
30 #include <boost/program_options.hpp>
32 namespace swarm {
namespace query {
38 if(s ==
"MIN") {
return MIN; }
39 if(s ==
"MAX") {
return MAX; }
40 return boost::lexical_cast<T>(s);
55 const std::vector<std::string>& values,
58 using namespace boost::program_options;
62 validators::check_first_occurrence(v);
66 const std::string& s = validators::get_single_string(values);
70 v = boost::any(rangeT(ALL));
74 static boost::regex r(
"(.+?)(?:\\.\\.(.+))?");
76 if (boost::regex_match(s, match, r)) {
80 v = boost::any(rangeT(arg_parse<T>(match[1])));
84 v = boost::any(rangeT(arg_parse<T>(match[1]), arg_parse<T>(match[2])));
87 #if BOOST_VERSION < 104200
88 throw validation_error(
"invalid value");
90 throw validation_error(validation_error::invalid_option_value);
100 std::ostream &operator<<(std::ostream &out, const range<T> &r)
102 if(r.first == T(MIN) && r.last == T(MAX)) {
return out <<
"ALL"; }
103 if(r.first == r.last) {
return out << r.first; }
105 if(r.first == T(MIN)) { out <<
"MIN"; }
else { out << r.first; }
107 if(r.last == T(MAX)) { out <<
"MAX"; }
else { out << r.last; }
112 void execute(
const std::string &dbfile, time_range_t T, sys_range_t sys, body_range_t bod = body_range_t() );
118 std::ostream &
output_record(std::ostream &out, gpulog::logrecord &lr,
const body_range_t &bod = body_range_t() );
130 astrocentric, barycentric, jacobi, origin