CMS 3D CMS Logo

InspectorPythonWrapper.h

Go to the documentation of this file.
00001 #include <boost/python.hpp>
00002 #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
00003 #include "CondCore/DBCommon/interface/ClassID.h"
00004 
00005 
00006 using namespace boost::python;
00007 
00008 namespace condPython {
00009   template<typename T>
00010   void defineWhat() {
00011     typedef cond::ExtractWhat<T> What;
00012     class_<What>("What",init<>());
00013   }
00014 
00015 }
00016 
00017 namespace {
00018   
00019   template<typename Wrapper>
00020   void define() {
00021     typedef typename Wrapper::Extractor Extractor;
00022     typedef typename Extractor::What What;
00023 
00024     condPython::defineWhat<typename Extractor::Class>();
00025 
00026     class_<Extractor>("Extractor", init<>())
00027       .def(init<What>())
00028       .def("what",Extractor::what)
00029       .def("values",&Extractor::values, return_value_policy<copy_const_reference>())
00030       ;
00031 
00032     class_<Wrapper>("Object",init<>()) 
00033       .def(init<cond::IOVElement>())
00034       .def("dump",&Wrapper::dump)
00035       .def("plot",&Wrapper::plot)
00036       .def("summary",&Wrapper::summary) 
00037       .def("extract",&Wrapper::extract)
00038       ; 
00039   }
00040 }
00041 
00042 
00043 #define PYTHON_WRAPPER(_class,_name) \
00044 namespace { typedef cond::PayLoadInspector< _class > PythonWrapper;} \
00045  BOOST_PYTHON_MODULE(plugin ## _name ## PyInterface) { define<PythonWrapper>(); } \
00046 namespace { const char * pluginName_="plugin"  #_name "PyInterface"; }\
00047 PYTHON_ID(PythonWrapper::Class, pluginName_)
00048 
00049 

Generated on Tue Jun 9 17:26:15 2009 for CMSSW by  doxygen 1.5.4