31 #ifndef PTLIB_NOTIFIER_EXT_H
32 #define PTLIB_NOTIFIER_EXT_H
86 template <
typename ParamType>
95 ,
m_targetID(notifierTarget->m_validatedNotifierId)
111 #define PDECLARE_VALIDATED_NOTIFIER_EXT(notifierType, notifierArg, notifiee, func, ParamType, ParamArg) \
112 PDECLARE_NOTIFIER_COMMON(notifierType, notifierArg, notifiee, func, ParamType, ParamArg, PValidatedNotifierFunction<ParamType>)
117 #define PDECLARE_VALIDATED_NOTIFIER2(notifierType, notifiee, func, ParamType ) \
118 PDECLARE_VALIDATED_NOTIFIER_EXT(notifierType, , notifiee, func, ParamType, )
121 #define PDECLARE_VALIDATED_NOTIFIER(notifierType, notifiee, func) \
122 PDECLARE_VALIDATED_NOTIFIER2(notifierType, notifiee, func, P_INT_PTR)
130 virtual void Call() = 0;
194 template <
typename ParamType>
203 ,
m_targetID(notifierTarget->m_asyncNotifierId)
209 template <
class Target>
213 const Target & m_target;
220 , m_notifier(notifier)
226 m_target.AsyncCall(m_notifier, m_extra);
235 #define PDECLARE_ASYNC_NOTIFIER_EXT(notifierType, notifierArg, notifiee, func, ParamType, ParamArg) \
236 PDECLARE_NOTIFIER_COMMON1(notifierType, notifiee, func, ParamType, PAsyncNotifierFunction<ParamType>) \
237 { PAsyncNotifierCallback::Queue(m_targetID, new TypedCallback<func##_PNotifier>(*this, note, extra)); } \
238 void AsyncCall(PObject & note, ParamType extra) const \
239 PDECLARE_NOTIFIER_COMMON2(notifierType, notifierArg, notifiee, func, ParamType, ParamArg, PAsyncNotifierFunction<ParamType>)
244 #define PDECLARE_ASYNC_NOTIFIER2(notifierType, notifiee, func, ParamType) \
245 PDECLARE_ASYNC_NOTIFIER_EXT(notifierType, , notifiee, func, ParamType, )
248 #define PDECLARE_ASYNC_NOTIFIER(notifierType, notifiee, func) \
249 PDECLARE_ASYNC_NOTIFIER2(notifierType, notifiee, func, P_INT_PTR)
256 template <
typename ParamType>
262 typedef std::list<Notifier> List;
267 PINDEX
GetSize()
const {
return this->m_list.size(); }
272 this->m_list.push_back(handler);
278 this->m_list.remove(handler);
281 class IsObj :
public std::unary_function<PObject, bool>
292 this->m_list.remove_if(IsObj(obj));
298 if (this->m_list.empty())
300 for (
typename List::iterator it = this->m_list.begin(); it != this->m_list.end() ; ++it)
309 #endif // PTLIB_NOTIFIER_EXT_H