#include <PyComponentMgr.h>
|
PyObject * | m_dict |
| The dictionary of python components' description It should be of the form: { 'name' : { 'package' : "MyAnaPkg", 'class' : "MyAlg", 'pyprops' : { 'OutputLevel' : 1, ..., } }, }. More...
|
|
PyComponents_t | m_components |
| A fast look-up hash-map for python components { 'name' : PyObject* } PyObject* is NULL if not yet instantiated Note that we own the PyObjects. More...
|
|
Definition at line 35 of file PyComponentMgr.h.
◆ PyComponents_t
◆ PyComponentMgr() [1/2]
PyComponentMgr::PyComponentMgr |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
◆ ~PyComponentMgr()
PyComponentMgr::~PyComponentMgr |
( |
| ) |
|
|
virtual |
◆ PyComponentMgr() [2/2]
PyAthena::PyComponentMgr::PyComponentMgr |
( |
| ) |
|
|
privatedelete |
◆ finalize()
StatusCode PyComponentMgr::finalize |
( |
| ) |
|
|
overridevirtual |
◆ initialize()
StatusCode PyComponentMgr::initialize |
( |
| ) |
|
|
overridevirtual |
Gaudi Service Implementation.
Definition at line 116 of file PyComponentMgr.cxx.
120 const std::string pyModuleName =
"AthenaPython.Configurables";
124 ATH_MSG_DEBUG(
"Importing module [" << pyModuleName <<
"]...");
125 PyObject*
module = PyImport_ImportModule(
const_cast<char*
>(pyModuleName.c_str()) );
127 ATH_MSG_ERROR(
"Could not import [" << pyModuleName <<
"] !!");
132 const std::string pyClassName =
"PyComponents";
134 pyClass = PyDict_GetItemString( PyModule_GetDict(
module ),
135 const_cast<char*
>( pyClassName.c_str() ) );
138 Py_XINCREF( pyClass );
142 <<
"] from module [" << pyModuleName <<
"] !!");
145 return StatusCode::FAILURE;
148 m_dict = PyObject_GetAttrString( pyClass,
149 const_cast<char*
>(
"instances" ) );
151 ATH_MSG_ERROR(
"Could not retrieve attribute [instances] from class ["
152 << pyClassName <<
"] !!");
155 return StatusCode::FAILURE;
164 fancy_attr = PyDict_GetItemString(PyModule_GetDict(
module),
165 (
char*)
"_install_fancy_attrs");
167 Py_XINCREF(fancy_attr);
171 (
"could not retrieve function [_install_fancy_attrs] from module ["
172 << pyModuleName <<
"]");
174 PyObject* ret = PyObject_CallFunction(fancy_attr, NULL);
177 Py_XDECREF(fancy_attr);
182 const std::string pyRootFixes =
"RootUtils.PyROOTFixes";
183 ATH_MSG_DEBUG(
"Importing module [" << pyRootFixes <<
"]...");
185 rootFixes = PyImport_ImportModule(
const_cast<char*
>(pyRootFixes.c_str()));
186 if ( !rootFixes || !PyModule_Check( rootFixes ) ) {
191 <<
"Some problem may appear with some C++->python binded classes (YMMV)");
193 Py_XDECREF(rootFixes);
194 return StatusCode::SUCCESS;
◆ pyObject()
Retrieve a python object from the python world.
this returns a NEW reference to that python object.
Hum... remove ? or not ? leaving the objects on the python side may allow easier retrieval from py-components...
Definition at line 206 of file PyComponentMgr.cxx.
208 const std::string&
name = cppComp->name();
214 Py_INCREF (
comp->second);
222 Py_INCREF( Py_None );
227 const_cast<char*
>(
name.c_str()) );
234 <<
"] or invalid item !!");
250 if ( !cppComp->setPyAttr(o) ) {
252 << cppComp->typeName() <<
"/" << cppComp->name()
253 <<
"] with its python cousin !");
◆ SvcFactory< PyAthena::PyComponentMgr >
◆ m_components
A fast look-up hash-map for python components { 'name' : PyObject* } PyObject* is NULL if not yet instantiated Note that we own the PyObjects.
Definition at line 90 of file PyComponentMgr.h.
◆ m_dict
PyObject* PyAthena::PyComponentMgr::m_dict |
|
private |
The dictionary of python components' description It should be of the form: { 'name' : { 'package' : "MyAnaPkg", 'class' : "MyAlg", 'pyprops' : { 'OutputLevel' : 1, ..., } }, }.
Definition at line 82 of file PyComponentMgr.h.
The documentation for this class was generated from the following files: