|
ATLAS Offline Software
|
Go to the documentation of this file.
27 #include "GaudiKernel/System.h"
28 #include "GaudiKernel/MsgStream.h"
29 #include "GaudiKernel/ServiceHandle.h"
42 base_class(
name, svcLocator ),
60 return PyAthena::callPyMethod(
m_self,
"sysInitialize" );
67 return PyAthena::callPyMethod(
m_self,
"sysReinitialize" );
74 return PyAthena::callPyMethod(
m_self,
"sysFinalize" );
80 return PyAthena::callPyMethod(
m_self,
"sysStart" );
86 return PyAthena::callPyMethod(
m_self,
"sysStop" );
93 (
"PyAthena::PyComponentMgr/PyComponentMgr",
name() );
94 if ( !pyMgr.retrieve().isSuccess() ) {
96 (
"Could not retrieve service [" << pyMgr.typeAndName() <<
"] !!");
97 return StatusCode::FAILURE;
101 m_self = pyMgr->pyObject(
this );
103 if (
m_self == Py_None ) {
105 return StatusCode::FAILURE;
109 return SvcBase_t::sysInitialize();
116 static const std::string tname = System::typeinfoName(
typeid(*
this));
117 return tname.c_str();
125 if (0 == PyObject_HasAttrString (
m_self, (
char*)
"handle")) {
132 PyObject *o = TPython::CPPInstance_FromVoidPtr ((
void*)(&inc),
"Incident");
158 PyObject* pyobj = TPython::CPPInstance_FromVoidPtr
163 pyobj = TPython::CPPInstance_FromVoidPtr ((
void*)
this,
"PyAthena::Svc");
165 (
"could not dyncast component [" <<
name() <<
"] to a python "
166 <<
"object of type [" << this->
typeName() <<
"] (probably a missing "
167 <<
"dictionary)" <<
endmsg
168 <<
"fallback to [PyAthena::Svc]...");
173 (
"Could not dyncast component [" <<
name() <<
"] to a pyobject of type ["
176 if ( -1 == PyObject_SetAttrString(o,
"_cppHandle", pyobj) ) {
179 (
"Could not attach C++ handle [" <<
name() <<
"] to its python "
181 if ( -1 == PyObject_SetAttrString(o,
"_cppHandle", Py_None) ) {
184 (
"could not attach a dummy C++ handle [" <<
name() <<
"] to its "
185 <<
"python cousin !");
virtual StatusCode reinitialize() override
void throw_py_exception(bool display=true)
helper function to capture the boilerplate code for user friendly stack trace display
virtual ~Svc()
Destructor:
Svc()=delete
Default constructor:
virtual StatusCode start() override
const char * typeName() const override
return the std::type_info name of the underlying py-component This is used by concrete implementation...
::StatusCode StatusCode
StatusCode definition for legacy code.
std::pair< std::vector< unsigned int >, bool > res
PyObject * m_self
Pointer to self (from the python world)
virtual StatusCode finalize() override
virtual StatusCode sysInitialize() override
virtual StatusCode initialize() override
Gaudi Service Implementation.
virtual StatusCode stop() override
#define ATH_MSG_WARNING(x)
virtual void handle(const Incident &incident) override
callback method for the IIncidentSvc
virtual bool setPyAttr(PyObject *pyobj) override
attach the C++ component to its python cousin