31 #ifndef PTLIB_NOTIFIER_EXT_H
32 #define PTLIB_NOTIFIER_EXT_H
78 #define PDECLARE_SMART_NOTIFIEE \
79 PSmartNotifieeRegistrar m_Registrar; \
81 #define PCREATE_SMART_NOTIFIEE m_Registrar.Init(this)
83 #define PDECLARE_SMART_NOTIFIER(notifier, notifiee, func) \
84 class func##_PSmartNotifier : public PSmartNotifierFunction { \
86 func##_PSmartNotifier(unsigned id) : PSmartNotifierFunction(id) { } \
87 virtual void Call(PObject & note, INT extra) const \
89 void * obj = GetNotifiee(); \
91 ((notifiee*)obj)->func((notifier &)note, extra); \
93 PTRACE(2, "PWLib\tInvalid notifiee"); \
96 friend class func##_PSmartNotifier; \
97 virtual void func(notifier & note, INT extra)
99 #define PCREATE_SMART_NOTIFIER(func) PNotifier(new func##_PSmartNotifier(m_Registrar.GetID()))
108 _PNotifierList m_TheList;
114 PINDEX
GetSize()
const {
return m_TheList.GetSize(); }
126 #endif // PTLIB_NOTIFIER_EXT_H
~PSmartNotifieeRegistrar()
Definition: notifier_ext.h:50
Definition: notifier_ext.h:64
PBoolean IsValid() const
Definition: notifier_ext.h:75
unsigned GetNotifieeID() const
Definition: notifier_ext.h:73
Class specialisation for PNotifierTemplate<INT>
Implements a function similar to the PNotifier, but uses an "id" to link the caller and callee rather...
Definition: notifier_ext.h:46
PBoolean RemoveTarget(PObject *obj)
PSmartNotifieeRegistrar()
Definition: notifier_ext.h:49
BOOL PBoolean
Definition: object.h:102
PINDEX GetSize() const
Definition: notifier_ext.h:114
unsigned m_ID
Definition: notifier_ext.h:61
void Add(PNotifier *handler)
Definition: notifier_ext.h:116
void Init(void *obj)
Definition: notifier_ext.h:52
unsigned m_NotifieeID
Definition: notifier_ext.h:69
static void * GetNotifiee(unsigned id)
static unsigned RegisterNotifiee(void *obj)
void Remove(PNotifier *handler)
Definition: notifier_ext.h:117
unsigned GetID() const
Definition: notifier_ext.h:53
static PBoolean UnregisterNotifiee(unsigned id)
void * GetNotifiee() const
Definition: notifier_ext.h:74
This is an abstract class for which a descendent is declared for every function that may be called...
Definition: notifier.h:63
Definition: notifier_ext.h:102
PSmartNotifierFunction(unsigned id)
Definition: notifier_ext.h:72
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PBoolean Fire(PObject &obj, INT val=0)
void Move(PNotifierList &that)