17 #include "msdevstudio/MSconfig.h" 28 #ifdef ITERATOR_MEMBER_DEFECT 39 Observable::Observable ()
45 Observable::~ Observable ()
54 m_list.push_back ( observer );
60 getObservers ( )
const 68 m_list.remove ( observer );
72 void Observable::notifyObservers ( Action action )
const 76 ObserverList_t::const_iterator first = m_list.begin ();
78 for ( ; first != m_list.end (); ++first ) {
79 ( (*first)->*action ) (
this );
83 for_each ( m_list.begin (), m_list.end (),
84 bind2nd ( mem_fun1 ( action ),
this ) );
86 for_each ( m_list.begin (), m_list.end (),
87 bind2nd ( mem_fun ( action ),
this ) );
93 void Observable::notifyObservers ( )
const virtual void update(const Observable *)=0
The update method.
std::list< Observer *> ObserverList_t
The type of STL container to maintain list of Observer objects.
Observable class interface.
Observer class interface.
Part of an implementation of the Observable Observer pattern based on the example implementation in t...