1 #ifndef CondTools_RunInfo_OMSAccess_h 2 #define CondTools_RunInfo_OMSAccess_h 6 #include <boost/property_tree/ptree.hpp> 7 #include <boost/property_tree/json_parser.hpp> 8 #include <boost/date_time/posix_time/posix_time.hpp> 16 static constexpr
const char*
const OMS_TIME_FMT =
"%Y-%m-%dT%H:%M:%SZ";
18 template <
typename T, T fun(const std::
string&)>
21 if (not attributeValue.empty() && attributeValue !=
"null") {
22 ret = fun(attributeValue);
29 throw std::invalid_argument(
"");
40 return from_string_impl<float, &s_to_f>(attributeValue, 0.);
46 return from_string_impl<int, &s_to_i>(attributeValue, 0);
52 unsigned long int_val = from_string_impl<unsigned long, &s_to_ul>(attributeValue, 0);
53 return (
unsigned short)int_val;
58 unsigned long long int_val = from_string_impl<unsigned long long, &s_to_ull>(attributeValue, 0);
63 boost::posix_time::time_input_facet* facet =
new boost::posix_time::time_input_facet(
OMS_TIME_FMT);
65 ss.imbue(std::locale(std::locale(), facet));
67 boost::posix_time::ptime
time;
73 return from_string_impl<boost::posix_time::ptime, &s_to_time>(attributeValue, boost::posix_time::ptime());
94 boost::posix_time::time_facet* facet =
new boost::posix_time::time_facet();
97 stream.imbue(std::locale(std::locale::classic(), facet));
113 template <
typename T>
115 return impl::from_string<T>(
getAttribute(attributeName));
118 template <
typename primitive>
120 std::vector<primitive>
ret;
121 for (
auto&
item :
m_row->get_child(attributeName)) {
129 const boost::property_tree::ptree*
m_row =
nullptr;
145 boost::property_tree::ptree::const_iterator
m_iter;
177 static constexpr
const char*
const NEQ =
"NEQ";
178 static constexpr
const char*
const EQ =
"EQ";
179 static constexpr
const char*
const LT =
"LT";
180 static constexpr
const char*
const LE =
"LE";
181 static constexpr
const char*
const GT =
"GT";
182 static constexpr
const char*
const GE =
"GE";
183 static constexpr
const char*
const SNULL =
"null";
194 template <
typename T>
210 template <
typename T>
212 return filter<T>(
EQ, varName,
value);
214 template <
typename T>
216 return filter<T>(
NEQ, varName,
value);
218 template <
typename T>
220 return filter<T>(
GT, varName,
value);
222 template <
typename T>
224 return filter<T>(
GE, varName,
value);
226 template <
typename T>
228 return filter<T>(
LT, varName,
value);
230 template <
typename T>
232 return filter<T>(
LE, varName,
value);
OMSServiceQuery & addOutputVars(const std::initializer_list< const char *> &varNames)
OMSServiceQuery & filterNEQ(const std::string &varName, const T &value)
OMSServiceResultRef()=delete
OMSServiceQuery & filterLT(const std::string &varName, const T &value)
boost::property_tree::ptree * m_data
std::string getAttribute(const std::string &attributeName)
OMSServiceQuery & addOutputVar(const std::string &varName)
static constexpr const char *const NEQ
OMSServiceResultRef operator*()
std::unique_ptr< OMSServiceQuery > query(const std::string &function) const
static constexpr const char *const GT
ret
prodAgent to be discontinued
T from_string(const std::string &attributeValue)
OMSServiceQuery & filterGT(const std::string &varName, const T &value)
OMSServiceQuery & filter(const char *cmp, const std::string &varName, const T &value)
std::string to_string(const V &value)
OMSServiceQuery & filterEQ(const std::string &varName, const T &value)
float s_to_f(const std::string &val)
OMSServiceResultRef front() const
std::vector< primitive > getArray(const std::string &attributeName)
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
constexpr char const * varNames[]
OMSServiceResultRef back() const
static constexpr const char *const EQ
static std::string to_string(const XMLCh *ch)
Primitive< F, X >::type primitive(const F &f)
boost::posix_time::ptime s_to_time(const std::string &val)
int s_to_i(const std::string &val)
static constexpr const char *const OMS_TIME_FMT
bool operator!=(const OMSServiceResultIterator &rhs)
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t V
OMSServiceQuery & filterGE(const std::string &varName, const T &value)
unsigned long long s_to_ull(const std::string &val)
OMSServiceResult & result()
boost::property_tree::ptree::const_iterator m_iter
const boost::property_tree::ptree * m_row
bool operator==(const OMSServiceResultIterator &rhs)
T from_string_impl(const std::string &attributeValue, T zero)
OMSServiceResultIterator & operator++()
static constexpr const char *const LE
OMSServiceResultIterator end() const
static constexpr const char *const LT
OMSServiceResultIterator()=delete
void addVar(const std::string &varName)
unsigned long s_to_ul(const std::string &val)
std::unique_ptr< OMSServiceResult > m_result
char data[epos_bytes_allocation]
OMSServiceQuery & filterLE(const std::string &varName, const T &value)
size_t parseData(const std::string &data)
OMSServiceQuery & filterNotNull(const std::string &varName)
void connect(const std::string &baseUrl)
OMSServiceResultIterator begin() const
boost::property_tree::ptree m_root
static constexpr const char *const SNULL
OMSServiceQuery & limit(int value)
static constexpr const char *const GE