Base class for classes that want to broadcast messages to observers. More...
#include <vgui_observable.h>
Public Member Functions | |
vgui_observable () | |
Constructor - create a default observable. | |
virtual | ~vgui_observable () |
Destructor. | |
void | attach (vgui_observer *) |
Attach the given observer to receive notify messages. | |
void | detach (vgui_observer *) |
Detach the given observer. | |
void | get_observers (vcl_vector< vgui_observer * > &) const |
Returns a list of all the observers for this observable. | |
virtual void | notify () const |
Broadcast an update to all observers of this class. | |
virtual void | notify (const vgui_message &) const |
Broadcast a message to all observers of this class. | |
Private Member Functions | |
vgui_observable (vgui_observable const &) | |
Disallow assignment. | |
vgui_observable & | operator= (vgui_observable const &) |
Disallow assignment. | |
Private Attributes | |
vcl_vector< vgui_observer * > | observers |
List of all observers for this observable. |
Base class for classes that want to broadcast messages to observers.
Objects from classes derived from vgui_observable can broadcast a vgui_message or an update using notify() to all the vgui_observer's attached to themselves.
Definition at line 30 of file vgui_observable.h.
vgui_observable::vgui_observable | ( | ) | [inline] |
Constructor - create a default observable.
Definition at line 34 of file vgui_observable.h.
vgui_observable::~vgui_observable | ( | ) | [virtual] |
Destructor.
Definition at line 21 of file vgui_observable.cxx.
vgui_observable::vgui_observable | ( | vgui_observable const & | ) | [inline, private] |
Disallow assignment.
Definition at line 59 of file vgui_observable.h.
void vgui_observable::attach | ( | vgui_observer * | o | ) |
Attach the given observer to receive notify messages.
Definition at line 27 of file vgui_observable.cxx.
void vgui_observable::detach | ( | vgui_observer * | o | ) |
Detach the given observer.
Definition at line 32 of file vgui_observable.cxx.
void vgui_observable::get_observers | ( | vcl_vector< vgui_observer * > & | o_list | ) | const |
Returns a list of all the observers for this observable.
Definition at line 42 of file vgui_observable.cxx.
void vgui_observable::notify | ( | ) | const [virtual] |
Broadcast an update to all observers of this class.
Definition at line 49 of file vgui_observable.cxx.
void vgui_observable::notify | ( | const vgui_message & | m | ) | const [virtual] |
Broadcast a message to all observers of this class.
Definition at line 57 of file vgui_observable.cxx.
vgui_observable& vgui_observable::operator= | ( | vgui_observable const & | ) | [inline, private] |
Disallow assignment.
Definition at line 62 of file vgui_observable.h.
vcl_vector<vgui_observer*> vgui_observable::observers [private] |
List of all observers for this observable.
Definition at line 56 of file vgui_observable.h.