CMS 3D CMS Logo

CondPyWrappers.cc File Reference

#include "CondCore/DBCommon/interface/Exception.h"
#include "CondCore/Utilities/interface/CondPyInterface.h"
#include "CondCore/IOVService/interface/IOVProxy.h"
#include "CondCore/DBCommon/interface/LogDBEntry.h"
#include "CondCore/DBCommon/interface/ClassInfoLoader.h"
#include "CondCore/DBCommon/interface/ClassID.h"
#include "StorageSvc/DbReflex.h"
#include "FWCore/PluginManager/interface/PluginManager.h"
#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include <iostream>

Go to the source code of this file.

Functions

void append2VS (std::vector< std::string > &v, std::string s)
 BOOST_PYTHON_MODULE (pluginCondDBPyInterface)
void exceptionTranslator (const std::exception &e)
boost::python::tuple getState (cond::LogDBEntry &l)
std::string moduleName (cond::CondDB &db, std::string const &ss)
std::string moduleNameByTag (cond::CondDB &db, std::string const &tag)
std::string moduleNameByToken (std::string const &token)
boost::shared_ptr
< cond::ClassInfo
pyInfo (std::string const &token)


Function Documentation

void @1885::append2VS ( std::vector< std::string > &  v,
std::string  s 
) [static]

Definition at line 81 of file CondPyWrappers.cc.

Referenced by BOOST_PYTHON_MODULE().

00081                                                         {
00082     v.push_back(s);
00083   }

BOOST_PYTHON_MODULE ( pluginCondDBPyInterface   ) 

Definition at line 87 of file CondPyWrappers.cc.

References cond::CondDB::allTags(), append2VS(), cond::IOVProxy::begin(), cond::LogDBEntry::destinationDB, cond::IOVProxy::end(), exceptionTranslator(), cond::LogDBEntry::execmessage, cond::LogDBEntry::exectime, cond::RDBMS::getDB(), getState(), cond::IOVProxy::head(), cond::CondDB::iov(), cond::LogDBEntry::iovtag, cond::LogDBEntry::iovtimetype, cond::CondDB::iovWithLib(), cond::CondDB::lastLogEntry(), cond::CondDB::lastLogEntryOK(), cond::LogDBEntry::logId, moduleName(), cond::CondDB::payLoad(), cond::LogDBEntry::payloadContainer, cond::LogDBEntry::payloadIdx, cond::LogDBEntry::payloadName, cond::IOVElement::payloadToken(), cond::LogDBEntry::payloadToken, cond::LogDBEntry::provenance, range, cond::RDBMS::setLogger(), cond::IOVProxy::setRange(), cond::IOVElement::since(), cond::IOVProxy::size(), cond::IOVProxy::tail(), cond::IOVElement::till(), and cond::LogDBEntry::usertext.

00087                                              {
00088   
00089   def("append2VS",&append2VS);
00090 
00091   class_<cond::LogDBEntry>("LogDBEntry")
00092     .def("getState",getState)
00093     .def_readonly("logId",  &cond::LogDBEntry::logId)
00094     .def_readonly("destinationDB",   &cond::LogDBEntry::destinationDB)   
00095     .def_readonly("provenance",  &cond::LogDBEntry::provenance)
00096     .def_readonly("usertext",  &cond::LogDBEntry::usertext)
00097     .def_readonly("iovtag",  &cond::LogDBEntry::iovtag)
00098     .def_readonly("iovtimetype",   &cond::LogDBEntry::iovtimetype)
00099     .def_readonly("payloadIdx",   &cond::LogDBEntry::payloadIdx)
00100     .def_readonly("payloadName",   &cond::LogDBEntry::payloadName)
00101     .def_readonly("payloadToken",   &cond::LogDBEntry::payloadToken)
00102     .def_readonly("payloadContainer",   &cond::LogDBEntry::payloadContainer)
00103     .def_readonly("exectime",   &cond::LogDBEntry::exectime)
00104     .def_readonly("execmessage",  &cond::LogDBEntry::execmessage)
00105     ;
00106 
00107   class_<std::vector<std::string> >("VString")
00108     .def(vector_indexing_suite<std::vector<std::string> >())
00109     ;
00110 
00111   class_<std::vector<float> >("VFloat")
00112     .def(vector_indexing_suite<std::vector<float> >())
00113     ;
00114 
00115   class_<std::vector<int> >("VInt")
00116     .def(vector_indexing_suite<std::vector<int> >())
00117     ;
00118    
00119   class_<cond::IOVElement>("IOVElement", init<>())
00120     .def("since", &cond::IOVElement::since)
00121     .def("till", &cond::IOVElement::till)
00122     .def("payloadToken", &cond::IOVElement::payloadToken, return_value_policy<copy_const_reference>())
00123     ;
00124   
00125   class_<cond::IOVProxy>("IOV", init<>())
00126     .def("size", &cond::IOVProxy::size)
00127     .def("setRange", &cond::IOVProxy::setRange)
00128     .def("head", &cond::IOVProxy::head)
00129     .def("tail", &cond::IOVProxy::tail)
00130     .add_property("elements", range( &cond::IOVProxy::begin,  &cond::IOVProxy::end))
00131     ;
00132   
00133   
00134   class_<cond::FWIncantation>("FWIncantation", init<>());
00135   
00136   class_<cond::CondDB>("CondDB", init<>())
00137     .def("allTags", &cond::CondDB::allTags)
00138     .def("iov", &cond::CondDB::iov)
00139     .def("iovWithLib", &cond::CondDB::iovWithLib)
00140     .def("payLoad", &cond::CondDB::payLoad)
00141     .def("moduleName",moduleName)
00142     .def("lastLogEntry", &cond::CondDB::lastLogEntry)
00143     .def("lastLogEntryOK", &cond::CondDB::lastLogEntryOK)
00144     ;
00145   
00146 
00147   class_<cond::RDBMS>("RDBMS", init<>())
00148     .def(init<std::string>())
00149     .def(init<std::string, std::string>())
00150     .def("setLogger",&cond::RDBMS::setLogger)
00151     .def("getDB", &cond::RDBMS::getDB)
00152     ;
00153 
00154 
00155 //  register_exception_translator<edm::Exception>(exceptionTranslator);
00156   register_exception_translator<std::exception>(exceptionTranslator);
00157 
00158 
00159 }

void @1885::exceptionTranslator ( const std::exception e  )  [static]

Definition at line 55 of file CondPyWrappers.cc.

Referenced by BOOST_PYTHON_MODULE().

00056   {
00057     PyErr_SetString(PyExc_RuntimeError, e.what());
00058   }

boost::python::tuple @1885::getState ( cond::LogDBEntry l  )  [static]

Definition at line 62 of file CondPyWrappers.cc.

References cond::LogDBEntry::destinationDB, cond::LogDBEntry::execmessage, cond::LogDBEntry::exectime, cond::LogDBEntry::iovtag, cond::LogDBEntry::iovtimetype, cond::LogDBEntry::logId, cond::LogDBEntry::payloadContainer, cond::LogDBEntry::payloadIdx, cond::LogDBEntry::payloadName, cond::LogDBEntry::payloadToken, cond::LogDBEntry::provenance, and cond::LogDBEntry::usertext.

Referenced by BOOST_PYTHON_MODULE().

00063     {
00064       return boost::python::make_tuple(
00065                                        l.logId,
00066                                        l.destinationDB,
00067                                        l.provenance,
00068                                        l.usertext,
00069                                        l.iovtag,
00070                                        l.iovtimetype,
00071                                        l.payloadIdx,
00072                                        l.payloadName,
00073                                        l.payloadToken,
00074                                        l.payloadContainer,
00075                                        l.exectime,
00076                                        l.execmessage
00077                                        );
00078     }

std::string @1885::moduleName ( cond::CondDB db,
std::string const &  ss 
) [static]

Definition at line 44 of file CondPyWrappers.cc.

References moduleNameByTag(), and moduleNameByToken().

Referenced by BOOST_PYTHON_MODULE(), evf::fuep::TriggerReportHelpers::formatReportTable(), evf::FUEventProcessor::initEventProcessor(), PixelToFEDAssociateFromAscii::operator()(), pos::PixelDetectorConfig::PixelDetectorConfig(), edm::RootFile::reportOpened(), and edm::RootOutputFile::RootOutputFile().

00044                                                               {
00045     //assume tags never start with '['
00046     if (ss[0]=='[') return moduleNameByToken(ss);
00047     return  moduleNameByTag(db,ss);
00048   }

std::string @1885::moduleNameByTag ( cond::CondDB db,
std::string const &  tag 
) [static]

Definition at line 33 of file CondPyWrappers.cc.

References cond::IOVProxy::begin(), cond::CondDB::iov(), pyInfo(), and cond::IOVProxy::size().

Referenced by moduleName().

00033                                                                     {
00034     cond::IOVProxy iov = db.iov(tag);
00035     if (0==iov.size()) return std::string();
00036     return pyInfo(iov.begin()->payloadToken())->resource();
00037   }

std::string @1885::moduleNameByToken ( std::string const &  token  )  [static]

Definition at line 39 of file CondPyWrappers.cc.

References pyInfo().

Referenced by moduleName().

00039                                                        {
00040     if (token.empty()) return std::string();
00041     return pyInfo(token)->resource();
00042   }

boost::shared_ptr<cond::ClassInfo> @1885::pyInfo ( std::string const &  token  )  [static]

Definition at line 27 of file CondPyWrappers.cc.

References cond::classID(), DBSPlugin::get(), prof2calltree::prefix, and cond::idCategories::pythonIDCategory().

Referenced by moduleNameByTag(), and moduleNameByToken().

00027                                                                  {
00028     static std::string const prefix = cond::idCategories::pythonIDCategory + "/";
00029     std::string pluginName = prefix + cond::classID(token);
00030     return boost::shared_ptr<cond::ClassInfo>(cond::ClassInfoFactory::get()->create(pluginName));
00031   }


Generated on Tue Jun 9 17:51:34 2009 for CMSSW by  doxygen 1.5.4