CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
InspectorPythonWrapper.h
Go to the documentation of this file.
1 #include <boost/python.hpp>
2 #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
4 
5 
6 namespace condPython {
7  template<typename T>
8  void defineWhat() {
9  using namespace boost::python;
10  typedef cond::ExtractWhat<T> What;
11  class_<What>("What",init<>());
12  }
13 
14 }
15 
16 namespace {
17 
18  template<typename Wrapper>
19  void define() {
20  using namespace boost::python;
21  typedef typename Wrapper::Extractor Extractor;
22  typedef typename Extractor::What What;
23 
24  condPython::defineWhat<typename Extractor::Class>();
25 
26  class_<Extractor>("Extractor", init<>())
27  .def(init<What>())
28  .def("what",Extractor::what)
29  .def("values",&Extractor::values, return_value_policy<copy_const_reference>())
30  ;
31 
32  class_<Wrapper>("Object",init<>())
33  .def(init<cond::CondDB>())
34  .def("load",&Wrapper::load)
35  .def("dump",&Wrapper::dump)
36  .def("dumpXML",&Wrapper::dumpXML)
37  .def("plot",&Wrapper::plot)
38  .def("summary",&Wrapper::summary)
39  .def("extract",&Wrapper::extract)
40  .def("trend_plot",&Wrapper::trend_plot)
41  .def("summary_adv",&Wrapper::summary_adv)
42  .def("dumpFile", &Wrapper::dumpFile)
43  ;
44  }
45 }
46 
47 
48 #define PYTHON_WRAPPER(_class,_name) \
49 namespace { typedef cond::PayLoadInspector< _class > PythonWrapper;} \
50  BOOST_PYTHON_MODULE(plugin ## _name ## PyInterface) { define<PythonWrapper>(); } \
51 namespace { const char * pluginName_="plugin" #_name "PyInterface"; }\
52  PYTHON_ID(PythonWrapper::Class, pluginName_, _name)
53 
54 
def load
Definition: svgfig.py:546
int extract(std::vector< int > *output, const std::string &dati)