DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Callback.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DD4HEP_CALLBACK_H
14 #define DD4HEP_CALLBACK_H
15 
16 // C/C++ include files
17 #include <algorithm>
18 #include <typeinfo>
19 #include <vector>
20 
22 namespace dd4hep {
23 
24 
26 
38  class Callback {
39  public:
40  typedef unsigned long (*func_t)(void* obj, const void* fun, const void* args[]);
42  struct mfunc_t {
43  void *first, *second;
44  };
45  typedef unsigned long ulong;
46 
47  void* par;
50 
53  : par(0), call(0) {
54  func.first = func.second = 0;
55  }
57  Callback(void* p)
58  : par(p), call(0) {
59  func.first = func.second = 0;
60  }
62  Callback(const void* p)
63  : par((void*)p), call(0) {
64  func.first = func.second = 0;
65  }
67  Callback(void* p, void* mf, func_t c)
68  : par(p), call(c) {
69  func = *(mfunc_t*) mf;
70  }
72  operator bool() const {
73  return (call && par && func.first);
74  }
76  unsigned long execute(const void* user_param[]) const {
77  return (*this) ? call(par, &func, user_param) : 0;
78  }
80  template <typename T> static T* cast(void* p) {
81  return (T*) p;
82  }
84  template <typename T> static const T* c_cast(const void* p) {
85  return (const T*) p;
86  }
87 
89 
97  template <typename T> class Wrapper {
98  public:
99  typedef T pmf_t;
101  union Functor {
104  Functor(const void* f) {
105  ptr = *(mfunc_t*) f;
106  }
108  pmf = f;
109  }
110  };
111  static mfunc_t pmf(pmf_t f) {
112  const Functor func(f);
113  return func.ptr;
114  }
115  };
116 
118  template <typename T> const Callback& _make(ulong (*fptr)(void* o, const void* f, const void* u[]), T pmf) {
120  typename Wrapper<T>::Functor f(pmf);
121  func = f.ptr;
122  call = fptr;
123  return *this;
124  }
126  template <typename R, typename T> const Callback& make(R (T::*pmf)()) {
127  typedef R (T::*pfunc_t)();
128  struct _Wrapper : public Wrapper<pfunc_t> {
129  static ulong call(void* o, const void* f, const void*[]) {
130  return (ulong) (cast<T>(o)->*(typename Wrapper<pfunc_t>::Functor(f).pmf))();
131  }
132  };
133  return _make(_Wrapper::call, pmf);
134  }
136  template <typename R, typename T> const Callback& make(R (T::*pmf)() const) {
137  typedef R (T::*pfunc_t)() const;
138  struct _Wrapper : public Wrapper<pfunc_t> {
139  static ulong call(void* o, const void* f, const void*[]) {
140  return (ulong) (cast<T>(o)->*(typename Wrapper<pfunc_t>::Functor(f).pmf))();
141  }
142  };
143  return _make(_Wrapper::call, pmf);
144  }
146  template <typename T> const Callback& make(void (T::*pmf)()) {
147  typedef void (T::*pfunc_t)() const;
148  struct _Wrapper : public Wrapper<pfunc_t> {
149  static ulong call(void* o, const void* f, const void*[]) {
150  (cast<T>(o)->*(typename Wrapper<pfunc_t>::Functor(f).pmf))();
151  return 1;
152  }
153  };
154  return _make(_Wrapper::call, pmf);
155  }
157  template <typename T> const Callback& make(void (T::*pmf)() const) {
158  typedef void (T::*pfunc_t)() const;
159  struct _Wrapper : public Wrapper<pfunc_t> {
160  static ulong call(void* o, const void* f, const void*[]) {
161  (cast<T>(o)->*(typename Wrapper<pfunc_t>::Functor(f).pmf))();
162  return 1;
163  }
164  };
165  return _make(_Wrapper::call, pmf);
166  }
167 
169  template <typename R, typename T, typename A> const Callback& make(R (T::*pmf)(A)) {
171  typedef R (T::*pfunc_t)(A);
172  struct _Wrapper : public Wrapper<pfunc_t> {
173  static ulong call(void* o, const void* f, const void* u[]) {
174  return (ulong) (cast<T>(o)->*(typename Wrapper<pfunc_t>::Functor(f).pmf))((A) u[0]);
175  }
176  };
177  return _make(_Wrapper::call, pmf);
178  }
180  template <typename R, typename T, typename A> const Callback& make(R (T::*pmf)(A) const) {
181  typedef R (T::*pfunc_t)(A) const;
182  struct _Wrapper : public Wrapper<pfunc_t> {
183  static ulong call(void* o, const void* f, const void* u[]) {
184  return (ulong) (cast<T>(o)->*(typename Wrapper<pfunc_t>::Functor(f).pmf))((A) u[0]);
185  }
186  };
187  return _make(_Wrapper::call, pmf);
188  }
190  template <typename T, typename A> const Callback& make(void (T::*pmf)(A)) {
191  typedef void (T::*pfunc_t)(const A);
192  struct _Wrapper : public Wrapper<pfunc_t> {
193  static ulong call(void* o, const void* f, const void* u[]) {
194  (cast<T>(o)->*(typename Wrapper<pfunc_t>::Functor(f).pmf))((A) u[0]);
195  return 1;
196  }
197  };
198  return _make(_Wrapper::call, pmf);
199  }
201  template <typename T, typename A> const Callback& make(void (T::*pmf)(A) const) {
202  typedef void (T::*pfunc_t)(const A) const;
203  struct _Wrapper : public Wrapper<pfunc_t> {
204  static ulong call(void* o, const void* f, const void* u[]) {
205  (cast<T>(o)->*(typename Wrapper<pfunc_t>::Functor(f).pmf))((A) u[0]);
206  return 1;
207  }
208  };
209  return _make(_Wrapper::call, pmf);
210  }
211 
214  template <typename R, typename T, typename A0, typename A1> const Callback& make(R (T::*pmf)(A0, A1)) {
216  typedef R (T::*pfunc_t)(A0, A1);
217  typedef Wrapper<pfunc_t> _W;
218  struct _Wrapper : public _W {
219  static ulong call(void* o, const void* f, const void* u[]) {
220  return (ulong) (cast<T>(o)->*(typename _W::Functor(f).pmf))((A0) u[0], (A1) u[1]);
221  }
222  };
223  return _make(_Wrapper::call, pmf);
224  }
226  template <typename R, typename T, typename A0, typename A1> const Callback& make(R (T::*pmf)(A0, A1) const) {
227  typedef R (T::*pfunc_t)(A0, A1);
228  typedef Wrapper<pfunc_t> _W;
229  struct _Wrapper : public _W {
230  static ulong call(void* o, const void* f, const void* u[]) {
231  return (ulong) (cast<T>(o)->*(typename _W::Functor(f).pmf))((A0) u[0], (A1) u[1]);
232  }
233  };
234  return _make(_Wrapper::call, pmf);
235  }
237  template <typename T, typename A0, typename A1> const Callback& make(void (T::*pmf)(A0, A1)) {
238  typedef void (T::*pfunc_t)(A0, A1);
239  typedef Wrapper<pfunc_t> _W;
240  struct _Wrapper : public _W {
241  static ulong call(void* o, const void* f, const void* u[]) {
242  (cast<T>(o)->*(typename _W::Functor(f).pmf))((A0) u[0], (A1) u[1]);
243  return 1;
244  }
245  };
246  return _make(_Wrapper::call, pmf);
247  }
249  template <typename T, typename A0, typename A1> const Callback& make(void (T::*pmf)(A0, A1) const) {
250  typedef void (T::*pfunc_t)(A0, A1);
251  typedef Wrapper<pfunc_t> _W;
252  struct _Wrapper : public _W {
253  static ulong call(void* o, const void* f, const void* u[]) {
254  (cast<T>(o)->*(typename _W::Functor(f).pmf))((A0) u[0], (A1) u[1]);
255  return 1;
256  }
257  };
258  return _make(_Wrapper::call, pmf);
259  }
260 
263  template <typename R, typename T, typename A0, typename A1, typename A2> const Callback& make(R (T::*pmf)(A0, A1, A2)) {
265  typedef R (T::*pfunc_t)(A0, A1, A2);
266  typedef Wrapper<pfunc_t> _W;
267  struct _Wrapper : public _W {
268  static ulong call(void* o, const void* f, const void* u[]) {
269  return (ulong) (cast<T>(o)->*(typename _W::Functor(f).pmf))((A0) u[0], (A1) u[1], (A2) u[2]);
270  }
271  };
272  return _make(_Wrapper::call, pmf);
273  }
275  template <typename R, typename T, typename A0, typename A1, typename A2> const Callback& make(R (T::*pmf)(A0, A1, A2) const) {
276  typedef R (T::*pfunc_t)(A0, A1, A2);
277  typedef Wrapper<pfunc_t> _W;
278  struct _Wrapper : public _W {
279  static ulong call(void* o, const void* f, const void* u[]) {
280  return (ulong) (cast<T>(o)->*(typename _W::Functor(f).pmf))((A0) u[0], (A1) u[1], (A2) u[2]);
281  }
282  };
283  return _make(_Wrapper::call, pmf);
284  }
286  template <typename T, typename A0, typename A1, typename A2> const Callback& make(void (T::*pmf)(A0, A1, A2)) {
287  typedef void (T::*pfunc_t)(A0, A1, A2);
288  typedef Wrapper<pfunc_t> _W;
289  struct _Wrapper : public _W {
290  static ulong call(void* o, const void* f, const void* u[]) {
291  (cast<T>(o)->*(typename _W::Functor(f).pmf))((A0) u[0], (A1) u[1], (A2) u[2]);
292  return 1;
293  }
294  };
295  return _make(_Wrapper::call, pmf);
296  }
298  template <typename T, typename A0, typename A1, typename A2> const Callback& make(void (T::*pmf)(A0, A1, A2) const) {
299  typedef void (T::*pfunc_t)(A0, A1, A2);
300  typedef Wrapper<pfunc_t> _W;
301  struct _Wrapper : public _W {
302  static ulong call(void* o, const void* f, const void* u[]) {
303  (cast<T>(o)->*(typename _W::Functor(f).pmf))((A0) u[0], (A1) u[1], (A2) u[2]);
304  return 1;
305  }
306  };
307  return _make(_Wrapper::call, pmf);
308  }
309 
310  template <typename T> static Callback make(void* p, T pmf) {
311  return Callback(p).make(pmf);
312  }
313 
314  template <typename P, typename R, typename T> static T* dyn_cast(P* p, R (T::*)()) {
315  return dynamic_cast<T*>(p);
316  }
317  template <typename P, typename R, typename T> static const T* dyn_cast(const P* p, R (T::*)() const) {
318  return dynamic_cast<const T*>(p);
319  }
320 
321  template <typename P, typename R, typename T, typename A> static T* dyn_cast(P* p, R (T::*)(A)) {
322  return dynamic_cast<T*>(p);
323  }
324  template <typename P, typename R, typename T, typename A> static const T* dyn_cast(const P* p, R (T::*)(A) const) {
325  return dynamic_cast<const T*>(p);
326  }
327  };
328 
330 
340  typedef std::vector<Callback> Callbacks;
341  enum Location { FRONT, END };
345  }
348  : callbacks(c.callbacks) {
349  }
352  if ( this != & c ) callbacks = c.callbacks;
353  return *this;
354  }
355 
356  //template <typename TYPE, typename R, typename OBJECT>
357  // CallbackSequence(const std::vector<TYPE*>& objects, R (TYPE::value_type::*pmf)()) {
358  //}
359  bool empty() const {
360  return callbacks.empty();
361  }
363  void clear() {
364  callbacks.clear();
365  }
367  void add(const Callback& cb,Location where) {
368  if ( where == CallbackSequence::FRONT )
369  callbacks.insert(callbacks.begin(),cb);
370  else
371  callbacks.insert(callbacks.end(),cb);
372  }
374  void add(const Callback& cb) {
375  callbacks.insert(callbacks.end(),cb);
376  }
378  void operator()() const;
380  template <typename A0> void operator()(A0 a0) const;
382  template <typename A0, typename A1> void operator()(A0 a0, A1 a1) const;
384  template <typename A0, typename A1, typename A2> void operator()(A0 a0, A1 a1, A2 a2) const;
386  static void checkTypes(const std::type_info& typ1, const std::type_info& typ2, void* test);
387 
389  template <typename TYPE, typename R, typename OBJECT>
391  void add(TYPE* pointer, R (OBJECT::*pmf)(),Location where=CallbackSequence::END) {
392  checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer));
393  add(Callback(pointer).make(pmf),where);
394  }
396  template <typename TYPE, typename R, typename OBJECT>
397  void add(TYPE* pointer, R (OBJECT::*pmf)() const,Location where=CallbackSequence::END) {
398  checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer));
399  add(Callback(pointer).make(pmf),where);
400  }
402  template <typename TYPE, typename OBJECT>
403  void add(TYPE* pointer, void (OBJECT::*pmf)(),Location where=CallbackSequence::END) {
404  checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer));
405  add(Callback(pointer).make(pmf),where);
406  }
408  template <typename TYPE, typename OBJECT>
409  void add(TYPE* pointer, void (OBJECT::*pmf)() const,Location where=CallbackSequence::END) {
410  checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer));
411  add(Callback(pointer).make(pmf),where);
412  }
413 
415  template <typename TYPE, typename R, typename OBJECT, typename A>
417  void add(TYPE* pointer, R (OBJECT::*pmf)(A),Location where=CallbackSequence::END) {
418  checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer));
419  add(Callback(pointer).make(pmf),where);
420  }
422  template <typename TYPE, typename OBJECT, typename A>
423  void add(TYPE* pointer, void (OBJECT::*pmf)(A),Location where=CallbackSequence::END) {
424  checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer));
425  add(Callback(pointer).make(pmf),where);
426  }
428  template <typename TYPE, typename R, typename OBJECT, typename A>
429  void add(TYPE* pointer, R (OBJECT::*pmf)(A) const,Location where=CallbackSequence::END) {
430  checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer));
431  add(Callback(pointer).make(pmf),where);
432  }
434  template <typename TYPE, typename OBJECT, typename A>
435  void add(TYPE* pointer, void (OBJECT::*pmf)(A) const,Location where=CallbackSequence::END) {
436  checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer));
437  add(Callback(pointer).make(pmf),where);
438  }
439 
440 
442  template <typename TYPE, typename R, typename OBJECT, typename A1, typename A2>
444  void add(TYPE* pointer, R (OBJECT::*pmf)(A1, A2),Location where=CallbackSequence::END) {
445  checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer));
446  add(Callback(pointer).make(pmf),where);
447  }
449  template <typename TYPE, typename R, typename OBJECT, typename A1, typename A2>
450  void add(TYPE* pointer, R (OBJECT::*pmf)(A1, A2) const,Location where=CallbackSequence::END) {
451  checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer));
452  add(Callback(pointer).make(pmf),where);
453  }
455  template <typename TYPE, typename OBJECT, typename A1, typename A2>
456  void add(TYPE* pointer, void (OBJECT::*pmf)(A1, A2),Location where=CallbackSequence::END) {
457  checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer));
458  add(Callback(pointer).make(pmf),where);
459  }
461  template <typename TYPE, typename OBJECT, typename A1, typename A2>
462  void add(TYPE* pointer, void (OBJECT::*pmf)(A1, A2) const,Location where=CallbackSequence::END) {
463  checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer));
464  add(Callback(pointer).make(pmf),where);
465  }
466  };
467 
469  inline void CallbackSequence::operator()() const {
470  if (!callbacks.empty()) {
471  const void* args[1] = { 0 };
472  for (Callbacks::const_iterator i = callbacks.begin(); i != callbacks.end(); ++i)
473  (*i).execute(args);
474  }
475  }
477  template <typename A0> inline
478  void CallbackSequence::operator()(A0 a0) const {
479  if (!callbacks.empty()) {
480  const void* args[1] = { a0 };
481  for (Callbacks::const_iterator i = callbacks.begin(); i != callbacks.end(); ++i)
482  (*i).execute(args);
483  }
484  }
486  template <typename A0, typename A1> inline
487  void CallbackSequence::operator()(A0 a0, A1 a1) const {
488  if (!callbacks.empty()) {
489  const void* args[2] = { a0, a1 };
490  for (Callbacks::const_iterator i = callbacks.begin(); i != callbacks.end(); ++i)
491  (*i).execute(args);
492  }
493  }
495  template <typename A0, typename A1, typename A2> inline
496  void CallbackSequence::operator()(A0 a0, A1 a1, A2 a2) const {
497  if (!callbacks.empty()) {
498  const void* args[3] = { a0, a1, a2 };
499  for (Callbacks::const_iterator i = callbacks.begin(); i != callbacks.end(); ++i)
500  (*i).execute(args);
501  }
502  }
503 
504 } // End namespace dd4hep
505 #endif // DD4HEP_CALLBACK_H
dd4hep::CallbackSequence::add
void add(TYPE *pointer, void(OBJECT::*pmf)(A) const, Location where=CallbackSequence::END)
Add a new callback to a const void member function and 1 argument.
Definition: Callback.h:435
dd4hep::CallbackSequence::add
void add(TYPE *pointer, void(OBJECT::*pmf)(), Location where=CallbackSequence::END)
Add a new callback to a void member function with no arguments.
Definition: Callback.h:403
dd4hep::Callback::ulong
unsigned long ulong
Definition: Callback.h:45
dd4hep::Callback::dyn_cast
static const T * dyn_cast(const P *p, R(T::*)() const)
Definition: Callback.h:317
dd4hep::Callback::mfunc_t
Structure definition to store callback related data.
Definition: Callback.h:42
dd4hep::Callback::Callback
Callback(const void *p)
Constructor with object initialization.
Definition: Callback.h:62
dd4hep::CallbackSequence::add
void add(TYPE *pointer, void(OBJECT::*pmf)(A), Location where=CallbackSequence::END)
Add a new callback to a void member function and 1 argument.
Definition: Callback.h:423
dd4hep::Callback::_make
const Callback & _make(ulong(*fptr)(void *o, const void *f, const void *u[]), T pmf)
Callback setup function for Callbacks with member functions taking no arguments.
Definition: Callback.h:119
dd4hep::CallbackSequence::operator=
CallbackSequence & operator=(const CallbackSequence &c)
Assignment operator.
Definition: Callback.h:351
dd4hep::CallbackSequence::FRONT
@ FRONT
Definition: Callback.h:341
dd4hep::Callback::Wrapper::pmf
static mfunc_t pmf(pmf_t f)
Definition: Callback.h:111
dd4hep::CallbackSequence::Location
Location
Definition: Callback.h:341
dd4hep::Callback::make
const Callback & make(void(T::*pmf)(A0, A1))
Callback setup function for Callbacks with const void member functions taking 2 arguments.
Definition: Callback.h:237
dd4hep::CallbackSequence::checkTypes
static void checkTypes(const std::type_info &typ1, const std::type_info &typ2, void *test)
Check the compatibility of two typed objects. The test is the result of a dynamic_cast.
Definition: Callback.cpp:19
dd4hep::CallbackSequence::add
void add(const Callback &cb, Location where)
Generically Add a new callback to the sequence depending on the location arguments.
Definition: Callback.h:367
dd4hep::Callback::dyn_cast
static T * dyn_cast(P *p, R(T::*)(A))
Definition: Callback.h:321
dd4hep::CallbackSequence::CallbackSequence
CallbackSequence(const CallbackSequence &c)
Copy constructor.
Definition: Callback.h:347
dd4hep::CallbackSequence::add
void add(TYPE *pointer, R(OBJECT::*pmf)() const, Location where=CallbackSequence::END)
Add a new callback to a const member function with explicit return type and no arguments.
Definition: Callback.h:397
dd4hep::CallbackSequence::add
void add(TYPE *pointer, void(OBJECT::*pmf)() const, Location where=CallbackSequence::END)
Add a new callback to a const void member function and no arguments.
Definition: Callback.h:409
dd4hep::Callback::make
const Callback & make(R(T::*pmf)(A0, A1, A2) const)
Callback setup function for Callbacks with const member functions with explicit return type taking 3 ...
Definition: Callback.h:275
dd4hep::CallbackSequence::add
void add(TYPE *pointer, R(OBJECT::*pmf)(A1, A2), Location where=CallbackSequence::END)
Add a new callback to a member function with explicit return type and 2 arguments.
Definition: Callback.h:444
dd4hep::Callback::func
mfunc_t func
Definition: Callback.h:49
dd4hep::Callback::Wrapper::pmf_t
T pmf_t
Definition: Callback.h:99
dd4hep::Callback::make
const Callback & make(R(T::*pmf)())
Callback setup function for Callbacks with member functions with explicit return type taking no argum...
Definition: Callback.h:126
dd4hep::CallbackSequence::END
@ END
Definition: Callback.h:341
dd4hep::CallbackSequence::add
void add(TYPE *pointer, R(OBJECT::*pmf)(), Location where=CallbackSequence::END)
Add a new callback to a member function with explicit return type and no arguments.
Definition: Callback.h:391
dd4hep::CallbackSequence
Definition of an actor on sequences of callbacks.
Definition: Callback.h:339
dd4hep::CallbackSequence::CallbackSequence
CallbackSequence()
Default constructor.
Definition: Callback.h:344
dd4hep::Callback::make
static Callback make(void *p, T pmf)
Definition: Callback.h:310
dd4hep::Callback::Callback
Callback(void *p)
Constructor with object initialization.
Definition: Callback.h:57
dd4hep::CallbackSequence::add
void add(TYPE *pointer, void(OBJECT::*pmf)(A1, A2) const, Location where=CallbackSequence::END)
Add a new callback to a const void member function with 2 arguments.
Definition: Callback.h:462
dd4hep::Callback
Definition of the generic callback structure for member functions.
Definition: Callback.h:38
dd4hep::Callback::make
const Callback & make(void(T::*pmf)(A0, A1, A2))
Callback setup function for Callbacks with const void member functions taking 3 arguments.
Definition: Callback.h:286
dd4hep::CallbackSequence::add
void add(TYPE *pointer, R(OBJECT::*pmf)(A), Location where=CallbackSequence::END)
Add a new callback to a member function with explicit return type and 1 argument.
Definition: Callback.h:417
dd4hep::Callback::call
func_t call
Definition: Callback.h:48
dd4hep::Callback::dyn_cast
static T * dyn_cast(P *p, R(T::*)())
Definition: Callback.h:314
dd4hep::CallbackSequence::add
void add(const Callback &cb)
Generically Add a new callback to the sequence depending on the location arguments.
Definition: Callback.h:374
dd4hep::CallbackSequence::operator()
void operator()() const
Execution overload for callbacks with no arguments.
Definition: Callback.h:469
dd4hep::Callback::make
const Callback & make(void(T::*pmf)(A0, A1) const)
Callback setup function for Callbacks with const void member functions taking 2 arguments.
Definition: Callback.h:249
dd4hep::CallbackSequence::clear
void clear()
Clear the sequence and remove all callbacks.
Definition: Callback.h:363
dd4hep::Callback::Wrapper::Functor::Functor
Functor(const void *f)
Definition: Callback.h:104
dd4hep::CallbackSequence::add
void add(TYPE *pointer, R(OBJECT::*pmf)(A) const, Location where=CallbackSequence::END)
Add a new callback to a const member function with explicit return type and 1 argument.
Definition: Callback.h:429
dd4hep::Callback::dyn_cast
static const T * dyn_cast(const P *p, R(T::*)(A) const)
Definition: Callback.h:324
dd4hep::Callback::par
void * par
Definition: Callback.h:47
dd4hep::Callback::Callback
Callback(void *p, void *mf, func_t c)
Initializing constructor.
Definition: Callback.h:67
dd4hep::Callback::make
const Callback & make(void(T::*pmf)(A0, A1, A2) const)
Callback setup function for Callbacks with const void member functions taking 3 arguments.
Definition: Callback.h:298
dd4hep::CallbackSequence::empty
bool empty() const
Definition: Callback.h:359
dd4hep::Callback::Wrapper
Wrapper around a C++ member function pointer.
Definition: Callback.h:97
dd4hep::Callback::Wrapper::Functor::Functor
Functor(pmf_t f)
Definition: Callback.h:107
dd4hep::Callback::make
const Callback & make(void(T::*pmf)())
Callback setup function for Callbacks with void member functions taking no arguments.
Definition: Callback.h:146
dd4hep::Callback::make
const Callback & make(R(T::*pmf)(A) const)
Callback setup function for Callbacks with const member functions with explicit return type taking 1 ...
Definition: Callback.h:180
dd4hep::Callback::Wrapper::Functor
Union to store pointers to member functions in callback objects.
Definition: Callback.h:101
dd4hep::Callback::execute
unsigned long execute(const void *user_param[]) const
Execute the callback with the required number of user parameters.
Definition: Callback.h:76
dd4hep::Callback::mfunc_t::first
void * first
Definition: Callback.h:43
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::Callback::Callback
Callback()
Default constructor.
Definition: Callback.h:52
dd4hep::CallbackSequence::add
void add(TYPE *pointer, R(OBJECT::*pmf)(A1, A2) const, Location where=CallbackSequence::END)
Add a new callback to a const member function with explicit return type and 2 arguments.
Definition: Callback.h:450
dd4hep::CallbackSequence::add
void add(TYPE *pointer, void(OBJECT::*pmf)(A1, A2), Location where=CallbackSequence::END)
Add a new callback to a void member function with 2 arguments.
Definition: Callback.h:456
dd4hep::Callback::cast
static T * cast(void *p)
Template cast function used internally by the wrapper for type conversion to the object's type.
Definition: Callback.h:80
dd4hep::Callback::make
const Callback & make(void(T::*pmf)(A))
Callback setup function for Callbacks with void member functions taking 1 argument.
Definition: Callback.h:190
dd4hep::CallbackSequence::Callbacks
std::vector< Callback > Callbacks
Definition: Callback.h:340
dd4hep::Callback::make
const Callback & make(R(T::*pmf)(A0, A1) const)
Callback setup function for Callbacks with const member functions with explicit return type taking 2 ...
Definition: Callback.h:226
dd4hep::Callback::mfunc_t::second
void * second
Definition: Callback.h:43
dd4hep::Callback::c_cast
static const T * c_cast(const void *p)
Template const cast function used internally by the wrapper for type conversion to the object's type.
Definition: Callback.h:84
dd4hep::Callback::make
const Callback & make(R(T::*pmf)() const)
Callback setup function for Callbacks with const member functions with explicit return type taking no...
Definition: Callback.h:136
dd4hep::Callback::Wrapper::Functor::pmf
pmf_t pmf
Definition: Callback.h:103
dd4hep::Callback::make
const Callback & make(void(T::*pmf)(A) const)
Callback setup function for Callbacks with const void member functions taking 1 argument.
Definition: Callback.h:201
dd4hep::CallbackSequence::callbacks
Callbacks callbacks
Definition: Callback.h:342
dd4hep::Callback::Wrapper::Functor::ptr
mfunc_t ptr
Definition: Callback.h:102
dd4hep::Callback::make
const Callback & make(void(T::*pmf)() const)
Callback setup function for Callbacks with const void member functions taking no arguments.
Definition: Callback.h:157
dd4hep::Callback::func_t
unsigned long(* func_t)(void *obj, const void *fun, const void *args[])
Definition: Callback.h:40