31 #ifndef PTLIB_NOTIFIER_H
32 #define PTLIB_NOTIFIER_H
62 template <
typename ParmType>
108 template <
typename ParmType>
163 #define PDECLARE_NOTIFIER2(notifier, notifiee, func, type) \
164 class func##_PNotifier : public PNotifierFunctionTemplate<type> { \
166 func##_PNotifier(notifiee * obj) : PNotifierFunctionTemplate<type>(obj) { } \
167 virtual void Call(PObject & note, type extra) const \
168 { ((notifiee*)object)->func((notifier &)note, extra); } \
170 friend class func##_PNotifier; \
171 virtual void func(notifier & note, type extra)
174 #define PDECLARE_NOTIFIER(notifier, notifiee, func) \
175 PDECLARE_NOTIFIER2(notifier, notifiee, func, INT)
186 #define PCREATE_NOTIFIER2_EXT(obj, notifiee, func, type) PNotifierTemplate<type>(new notifiee::func##_PNotifier(obj))
189 #define PCREATE_NOTIFIER_EXT( obj, notifiee, func) PCREATE_NOTIFIER2_EXT(obj, notifiee, func, INT)
200 #define PCREATE_NOTIFIER2(func, type) PNotifierTemplate<type>(new func##_PNotifier(this))
203 #define PCREATE_NOTIFIER(func) PCREATE_NOTIFIER2(func, INT)
206 #endif // PTLIB_NOTIFIER_H
PNotifierTemplate(PNotifierFunctionTemplate< ParmType > *func=NULL)
Create a new notification function smart pointer.
Definition: notifier.h:115
void * object
Object instance to receive the notification function call.
Definition: notifier.h:84
This is the class for pointers to objects that use the smart pointer system.
Definition: smartptr.h:88
virtual void Call(PObject ¬ifier, ParmType extra) const =0
Execute the call to the actual notification function on the object instance contained in this object...
PNotifierFunctionTemplate< INT > PNotifierFunction
Definition: notifier.h:87
PNotifierTemplate< INT > PNotifier
Definition: notifier.h:136
The PNotifier and PNotifierFunction classes build a completely type safe mechanism for calling arbitr...
Definition: notifier.h:109
PNotifierFunctionTemplate(void *obj)
Create a notification function instance.
Definition: notifier.h:69
#define PAssertNULL(ptr)
This macro is used to assert that a pointer must be non-null.
Definition: object.h:220
This is the base class for objects that use the smart pointer system.
Definition: smartptr.h:52
This is an abstract class for which a descendent is declared for every function that may be called...
Definition: notifier.h:63
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
virtual void operator()(PObject ¬ifier, ParmType extra) const
Execute the call to the actual notification function on the object instance contained in this object...
Definition: notifier.h:124