Simple test of a py-service
Definition at line 54 of file PyTestsLib.py.
◆ __init__()
def python.tests.PyTestsLib.MySvc.__init__ |
( |
|
self, |
|
|
|
name = "MySvc" , |
|
|
** |
kw |
|
) |
| |
Definition at line 57 of file PyTestsLib.py.
57 def __init__(self, name = "MySvc", **kw):
62 self.counter = kw.get(
'counter', 0)
◆ finalize() [1/2]
StatusCode PyAthena::Svc::finalize |
( |
| ) |
|
|
overridevirtualinherited |
◆ finalize() [2/2]
def python.tests.PyTestsLib.MySvc.finalize |
( |
|
self | ) |
|
Definition at line 70 of file PyTestsLib.py.
71 self.msg.
info(
"==> finalize..." )
72 self.msg.
info(
"cnt: %r",self.counter )
73 return StatusCode.Success
◆ handle()
void PyAthena::Svc::handle |
( |
const Incident & |
incident | ) |
|
|
overridevirtualinherited |
callback method for the IIncidentSvc
Definition at line 122 of file PyAthenaSvc.cxx.
125 if (0 == PyObject_HasAttrString (
m_self, (
char*)
"handle")) {
132 PyObject *o = TPython::CPPInstance_FromVoidPtr ((
void*)(&inc),
"Incident");
◆ initialize() [1/2]
StatusCode PyAthena::Svc::initialize |
( |
| ) |
|
|
overridevirtualinherited |
◆ initialize() [2/2]
def python.tests.PyTestsLib.MySvc.initialize |
( |
|
self | ) |
|
Definition at line 64 of file PyTestsLib.py.
65 self.sg = PyAthena.py_svc(
"StoreGateSvc")
66 self.msg.
info(
"==> initializing [%s]...", self.name )
67 self.msg.
info(
"cnt: %r",self.counter )
68 return StatusCode.Success
◆ reinitialize()
StatusCode PyAthena::Svc::reinitialize |
( |
| ) |
|
|
overridevirtualinherited |
◆ self()
virtual PyObject* PyAthena::Svc::self |
( |
| ) |
|
|
inlineoverridevirtualinherited |
return associated python object.
BORROWED reference.
Definition at line 68 of file PyAthenaSvc.h.
◆ setPyAttr()
bool PyAthena::Svc::setPyAttr |
( |
PyObject * |
pyobj | ) |
|
|
overrideprotectedvirtualinherited |
attach the C++ component to its python cousin
Definition at line 154 of file PyAthenaSvc.cxx.
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 !");
◆ start()
StatusCode PyAthena::Svc::start |
( |
| ) |
|
|
overridevirtualinherited |
◆ stop()
StatusCode PyAthena::Svc::stop |
( |
| ) |
|
|
overridevirtualinherited |
◆ sysInitialize()
StatusCode PyAthena::Svc::sysInitialize |
( |
| ) |
|
|
overridevirtualinherited |
Definition at line 90 of file PyAthenaSvc.cxx.
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();
◆ typeName()
const char * PyAthena::Svc::typeName |
( |
| ) |
const |
|
overrideinherited |
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
Definition at line 114 of file PyAthenaSvc.cxx.
117 return tname.c_str();
◆ counter
python.tests.PyTestsLib.MySvc.counter |
◆ m_self
Pointer to self (from the python world)
Definition at line 89 of file PyAthenaSvc.h.
◆ sg
python.tests.PyTestsLib.MySvc.sg |
The documentation for this class was generated from the following file: