#include <PythonManager.h>
Static Public Member Functions | |
static PythonManagerHandle | handle () |
Private Member Functions | |
void | decrement () |
void | increment () |
PythonManager () | |
~PythonManager () | |
Private Attributes | |
std::string | initCommand_ |
unsigned long | refCount_ |
Friends | |
class | PythonManagerHandle |
Definition at line 24 of file PythonManager.h.
PythonManager::PythonManager | ( | ) | [private] |
Definition at line 37 of file PythonManager.cc.
References Exception, initCommand_, initlibFWCorePython(), and query::result.
: refCount_(0), initCommand_( "import sys\n" "sys.path.append('./')\n" "import ROOT\n" "ROOT.gSystem.Load(\"libFWCoreFWLite\")\n" "ROOT.AutoLibraryLoader.enable()\n" "import libFWCorePython as edm\n") { Py_InitializeEx(0); using namespace boost::python; if(PyImport_AppendInittab(const_cast<char *>("libFWCorePython"),initlibFWCorePython)==-1) { throw cms::Exception("InitializationFailure" ) <<"failed to add libFWCorePython python module to python interpreter"; } object main_module(( boost::python::handle<PyObject>(borrowed(PyImport_AddModule(const_cast<char *>("__main__")))))); object main_namespace = main_module.attr("__dict__"); try { object result((boost::python::handle<>(PyRun_String(initCommand_.c_str(), Py_file_input, main_namespace.ptr(), main_namespace.ptr())))); } catch(... ) { throw cms::Exception("Configuration") << "test"; } }
PythonManager::~PythonManager | ( | ) | [inline, private] |
Definition at line 31 of file PythonManager.h.
{ Py_Finalize(); }
void PythonManager::decrement | ( | ) | [inline, private] |
Definition at line 33 of file PythonManager.h.
References refCount_.
Referenced by PythonManagerHandle::~PythonManagerHandle().
PythonManagerHandle PythonManager::handle | ( | ) | [static] |
Definition at line 32 of file PythonManager.cc.
References PythonManagerHandle.
{ static PythonManager s_manager; return PythonManagerHandle( s_manager); }
void PythonManager::increment | ( | ) | [inline, private] |
Definition at line 32 of file PythonManager.h.
References refCount_.
Referenced by PythonManagerHandle::PythonManagerHandle().
{ ++refCount_; }
friend class PythonManagerHandle [friend] |
Definition at line 26 of file PythonManager.h.
Referenced by handle().
std::string PythonManager::initCommand_ [private] |
Definition at line 35 of file PythonManager.h.
Referenced by PythonManager().
unsigned long PythonManager::refCount_ [private] |
Definition at line 34 of file PythonManager.h.
Referenced by decrement(), and increment().