Public Member Functions | Private Member Functions | Private Attributes
vgui_observable Class Reference

Base class for classes that want to broadcast messages to observers. More...

#include <vgui_observable.h>

Inheritance diagram for vgui_observable:
Inheritance graph
[legend]

List of all members.

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_observableoperator= (vgui_observable const &)
 Disallow assignment.

Private Attributes

vcl_vector< vgui_observer * > observers
 List of all observers for this observable.

Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.


Member Data Documentation

vcl_vector<vgui_observer*> vgui_observable::observers [private]

List of all observers for this observable.

Definition at line 56 of file vgui_observable.h.


The documentation for this class was generated from the following files: