template class Poco::Observer
Overview
This template class implements an adapter that sits between a NotificationCenter and an object receiving notifications from it. Moreā¦
#include <Observer.h> template < class C, class N > class Observer: public Poco::AbstractObserver { public: // typedefs typedef void(C::* Callback)(N *); // construction Observer( C& object, Callback method ); Observer(const Observer& observer); // methods Observer& operator=(const Observer& observer); virtual void notify(Notification* pNf) const; virtual bool equals(const AbstractObserver& abstractObserver) const; virtual bool accepts(Notification* pNf) const; virtual AbstractObserver* clone() const; virtual void disable(); };
Inherited Members
public: // methods AbstractObserver& operator=(const AbstractObserver& observer); virtual void notify(Notification* pNf) const = 0; virtual bool equals(const AbstractObserver& observer) const = 0; virtual bool accepts(Notification* pNf) const = 0; virtual AbstractObserver* clone() const = 0; virtual void disable() = 0;
Detailed Documentation
This template class implements an adapter that sits between a NotificationCenter and an object receiving notifications from it.
It is quite similar in concept to the RunnableAdapter, but provides some NotificationCenter specific additional methods. See the NotificationCenter class for information on how to use this template class.
Instead of the Observer class template, you might want to use the NObserver class template, which uses an AutoPtr to pass the Notification to the callback function, thus freeing you from memory management issues.