23 #include "TNotifyLink.h"
68 :
public TNotifyLinkBase
84 virtual Bool_t Notify()
override;
87 virtual void Clear (Option_t* =
"")
override;
110 TreeNotifier::TreeNotifier (TTree*
tree,
112 : m_treeobj_ref (treeobj_ref),
113 m_chain (
tree->GetNotify()),
142 if (pynotify_str == 0)
143 pynotify_str = PyUnicode_InternFromString(
"__pynotify__");
148 PyObject** dictptr = _PyObject_GetDictPtr (treeobj);
149 if (dictptr && *dictptr) {
150 PyObject* notobj = PyObject_GetItem (*dictptr, pynotify_str);
154 PyObject_CallMethod (notobj,
const_cast<char*
> (
"Notify"), NULL);
184 if ( ! PyArg_ParseTuple(
args,
const_cast< char*
>(
"OO:SetNotify" ),
189 if (pynotify_str == 0) {
190 pynotify_str = PyUnicode_InternFromString(
"__pynotify__");
192 if (notifier_str == 0) {
193 notifier_str = PyUnicode_InternFromString(
"__notifier__");
197 if (!PyObject_HasAttr (
self, notifier_str)) {
199 void* vp = TPython::CPPInstance_AsVoidPtr (
self);
201 (TTree*)
objectIsA(
self)->DynamicCast ( TTree::Class(), vp );
203 PyObject* treeobj_ref = PyWeakref_NewRef (
self, 0);
207 PyObject* notobj = TPython::CPPInstance_FromVoidPtr (notifier,
"TObject");
209 int stat = PyObject_SetAttr (
self, notifier_str, notobj);
213 tree->SetNotify (notifier);
217 int stat = PyObject_SetAttr (
self, pynotify_str,
obj);
234 if ( ! PyArg_ParseTuple(
args,
const_cast< char*
>(
"O:SetNotify" ),
239 if (pynotify_str == 0)
240 pynotify_str = PyUnicode_InternFromString(
"__pynotify__");
243 PyObject* ret = PyObject_GetAttr (
self, pynotify_str);
262 if ( ! PyArg_ParseTuple(
args,
const_cast< char*
>(
"OO:SetBranchAddress" ),
268 if (TPython::CPPInstance_Check (
self)) {
271 TPython::CPPInstance_AsVoidPtr(
self) );
275 PyErr_SetString( PyExc_TypeError,
276 "TBranch::SetAddress must be called with a "
277 "TBranch instance as first argument" );
283 if ( TPython::CPPInstance_Check(
address ) ) {
293 branch->SetAddress( buf );
295 Py_INCREF( Py_None );
312 pdef.ml_name =
const_cast<char*
> (
name);
313 pdef.ml_meth = cfunc;
314 pdef.ml_flags = METH_VARARGS;
317 PyObject* func = PyCFunction_New (&pdef, 0);
319 Bool_t isOK = PyObject_SetAttrString (pyclass, pdef.ml_name,
method) == 0;
321 if (PyErr_Occurred())
322 fprintf (
stderr,
"Py error");
324 fprintf (
stderr,
"Could not add method %s\n",
name);
339 # define INSTALL_METHOD(pyclass, name, func) do { \
340 static PyMethodDef pdef; \
341 installMethod (pyclass, pdef, name, (PyCFunction)func); \
347 #undef INSTALL_METHOD