#include <PyAthenaAud.h>
|
| | Aud (const std::string &name, ISvcLocator *svcLocator) |
| | Constructor with parameters:
|
| virtual | ~Aud () |
| | Destructor:
|
| virtual StatusCode | initialize () override |
| | Gaudi Aud Implementation.
|
| virtual StatusCode | sysInitialize () override |
| virtual StatusCode | finalize () override |
| virtual const char * | typeName () const override |
| | return the std::type_info name of the underlying py-component This is used by concrete implementations to connect a python component to its C++ counter-part
|
| virtual void | before (const std::string &evt, const std::string &name, const EventContext &ctx) override |
| | Auditor interface
|
| virtual void | after (const std::string &evt, const std::string &name, const EventContext &ctx, const StatusCode &sc) override |
| virtual PyObject * | self () override |
| | return associated python object.
|
| | DeclareInterfaceID (IPyComponent, 1, 0) |
|
| virtual bool | setPyAttr (PyObject *pyobj) override |
| | attach the C++ component to its python cousin
|
Definition at line 30 of file PyAthenaAud.h.
◆ Aud() [1/2]
| PyAthena::Aud::Aud |
( |
const std::string & | name, |
|
|
ISvcLocator * | svcLocator ) |
Constructor with parameters:
Definition at line 42 of file PyAthenaAud.cxx.
42 :
43 Gaudi::Auditor( name, svcLocator ),
45{}
PyObject * m_self
Pointer to self (from the python world)
◆ ~Aud()
Destructor:
Definition at line 49 of file PyAthenaAud.cxx.
50{
52 RootUtils::PyGILStateEnsure ensure;
55 }
56}
◆ Aud() [2/2]
◆ after()
| void PyAthena::Aud::after |
( |
const std::string & | evt, |
|
|
const std::string & | name, |
|
|
const EventContext & | ctx, |
|
|
const StatusCode & | sc ) |
|
overridevirtual |
Definition at line 117 of file PyAthenaAud.cxx.
119{
120 std::string evtname =
evt;
122 PyAthena::pyAudit (
m_self,
"after", evtname.c_str(),
name.c_str(),
sc);
123}
void tolower(std::string &s)
◆ before()
| void PyAthena::Aud::before |
( |
const std::string & | evt, |
|
|
const std::string & | name, |
|
|
const EventContext & | ctx ) |
|
overridevirtual |
Auditor interface
Definition at line 108 of file PyAthenaAud.cxx.
110{
111 std::string evtname =
evt;
113 PyAthena::pyAudit (
m_self,
"before", evtname.c_str(),
name.c_str());
114}
◆ DeclareInterfaceID()
◆ finalize()
| StatusCode PyAthena::Aud::finalize |
( |
| ) |
|
|
overridevirtual |
◆ initialize()
| StatusCode PyAthena::Aud::initialize |
( |
| ) |
|
|
overridevirtual |
◆ self()
| virtual PyObject * PyAthena::Aud::self |
( |
| ) |
|
|
inlineoverridevirtual |
◆ setPyAttr()
| bool PyAthena::Aud::setPyAttr |
( |
PyObject * | pyobj | ) |
|
|
overrideprotectedvirtual |
attach the C++ component to its python cousin
Implements IPyComponent.
Definition at line 130 of file PyAthenaAud.cxx.
131{
132
133 RootUtils::PyGILStateEnsure ensure;
134 PyObject* pyobj = TPython::CPPInstance_FromVoidPtr
136 if ( !pyobj ) {
137 PyErr_Clear();
138
139 pyobj = TPython::CPPInstance_FromVoidPtr ((void*)this, "PyAthena::Aud");
142 <<
"could not dyncast component [" <<
name() <<
"] to a python "
143 <<
"object of type [" << this->
typeName() <<
"] (probably a missing "
144 <<
"dictionary)" <<
endmsg
145 << "fallback to [PyAthena::Aud]..."
147 }
148 if ( !pyobj ) {
149 PyErr_Clear();
151 msg << MSG::WARNING <<
"Could not dyncast component ["
152 <<
name() <<
"] to a pyobject of type ["
155 } else {
156 if ( -1 == PyObject_SetAttrString(o, "_cppHandle", pyobj) ) {
157 PyErr_Clear();
160 <<
"Could not attach C++ handle [" <<
name() <<
"] to its python "
161 << "cousin !"
163 if ( -1 == PyObject_SetAttrString(o, "_cppHandle", Py_None) ) {
164 PyErr_Clear();
166 <<
"could not attach a dummy C++ handle [" <<
name() <<
"] to its "
167 << "python cousin !"
169 }
170 } else {
171 return true;
172 }
173 }
174 return false;
175}
virtual const char * typeName() const override
return the std::type_info name of the underlying py-component This is used by concrete implementation...
msgSvc
Provide convenience handles for various services.
◆ sysInitialize()
| StatusCode PyAthena::Aud::sysInitialize |
( |
| ) |
|
|
overridevirtual |
Definition at line 67 of file PyAthenaAud.cxx.
68{
69 ServiceHandle<IPyComponentMgr> pyMgr
70 (
"PyAthena::PyComponentMgr/PyComponentMgr",
name() );
71 if ( !pyMgr.retrieve().isSuccess() ) {
72 return StatusCode::FAILURE;
73 }
74
75
76 m_self = pyMgr->pyObject(
this );
77
79 return StatusCode::FAILURE;
80 }
81
82
83 return Gaudi::Auditor::sysInitialize();
84}
◆ typeName()
| const char * PyAthena::Aud::typeName |
( |
| ) |
const |
|
overridevirtual |
return the std::type_info name of the underlying py-component This is used by concrete implementations to connect a python component to its C++ counter-part
Implements IPyComponent.
Definition at line 97 of file PyAthenaAud.cxx.
98{
99 static const std::string tname = System::typeinfoName(typeid(*this));
100 return tname.c_str();
101}
◆ m_self
Pointer to self (from the python world)
Definition at line 90 of file PyAthenaAud.h.
The documentation for this class was generated from the following files: