Inherit from this class for those objects capable of being observed by a CObserver class.
The only thing to do in your child class is to call CObservable::publishEvent() whenever needed and all the observer classes will be notified.
Definition at line 33 of file CObservable.h.
#include <mrpt/utils/CObservable.h>
Public Member Functions | |
CObservable () | |
virtual | ~CObservable () |
Protected Member Functions | |
void | publishEvent (const mrptEvent &e) const |
Called when you want this object to emit an event to all the observers currently subscribed to this object. More... | |
bool | hasSubscribers () const |
Can be called by a derived class before preparing an event for publishing with publishEvent to determine if there is no one subscribed, so it can save the wasted time preparing an event that will be not read. More... | |
Private Member Functions | |
void | internal_observer_begin (CObserver *) |
void | internal_observer_end (CObserver *) |
Private Attributes | |
std::set< CObserver * > | m_subscribers |
Friends | |
class | CObserver |
mrpt::utils::CObservable::CObservable | ( | ) |
|
virtual |
|
inlineprotected |
Can be called by a derived class before preparing an event for publishing with publishEvent to determine if there is no one subscribed, so it can save the wasted time preparing an event that will be not read.
Definition at line 52 of file CObservable.h.
|
private |
|
private |
|
protected |
Called when you want this object to emit an event to all the observers currently subscribed to this object.
|
friend |
Definition at line 35 of file CObservable.h.
|
private |
Definition at line 42 of file CObservable.h.
Page generated by Doxygen 1.8.16 for MRPT 1.4.0 SVN: at Mon Oct 14 22:32:58 UTC 2019 |