MRPT
1.9.9
|
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 31 of file CObservable.h.
#include <mrpt/system/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 |
CObservable::CObservable | ( | ) |
Definition at line 19 of file CObservable.cpp.
|
virtual |
Definition at line 20 of file CObservable.cpp.
|
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 53 of file CObservable.h.
References m_subscribers.
Referenced by mrpt::gui::CWindowDialog::OnMouseDown(), mrpt::gui::CWindowDialog::OnMouseMove(), mrpt::gui::CWindowDialog::OnResize(), and mrpt::opengl::COpenGLViewport::render().
Definition at line 29 of file CObservable.cpp.
Definition at line 34 of file CObservable.cpp.
References ASSERTMSG_, MRPT_END, and MRPT_START.
Called when you want this object to emit an event to all the observers currently subscribed to this object.
Definition at line 48 of file CObservable.cpp.
References MRPT_END, and MRPT_START.
Referenced by mrpt::gui::CDisplayWindow3D::internal_emitGrabImageEvent(), mrpt::gui::CWindowDialog::OnChar(), mrpt::gui::CWindowDialog::OnClose(), mrpt::gui::C3DWindowDialog::OnClose(), mrpt::gui::CWindowDialog::OnMouseDown(), mrpt::gui::CWindowDialog::OnMouseMove(), mrpt::gui::CWindowDialog::OnResize(), mrpt::gui::C3DWindowDialog::OnResize(), and mrpt::opengl::COpenGLViewport::render().
|
friend |
Definition at line 33 of file CObservable.h.
|
private |
Definition at line 40 of file CObservable.h.
Referenced by hasSubscribers().
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020 |