Observable.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
2 
14 #ifndef _Observable_H_
15 #define _Observable_H_
16 
17 #include "libhippo.h"
18 
19 #ifdef _MSC_VER
20 #include <msdevstudio/MSconfig.h>
21 #endif
22 
23 #include <list>
24 
25 namespace hippodraw {
26 
27  class Observer;
28 
40 {
41 public:
42 
45  typedef std::list < Observer * > ObserverList_t;
46 
47 private:
48 
52 
53 //protected:
54 
55 public:
57  Observable();
58 
59 public:
60 
66  virtual ~ Observable ();
67 
69  void addObserver ( Observer * );
70 
72  const ObserverList_t & getObservers () const;
73 
75  void removeObserver ( Observer * );
76 
83  virtual void notifyObservers () const;
84 
86  typedef void ( Observer::*Action ) ( const Observable * );
87 
88 protected:
89 
92  void notifyObservers ( Action action ) const;
93 
94 };
95 
96 } // namespace hippodraw
97 
98 #endif // _Observable_H_
#define MDL_HIPPOPLOT_API
Definition: libhippo.h:36
Part of an implementation of the Observable-Observer pattern based on the example in the GOF Patterns...
Definition: Observable.h:39
std::list< Observer * > ObserverList_t
The type of STL container to maintain list of Observer objects.
Definition: Observable.h:45
Part of an implementation of the Observable Observer pattern based on the example implementation in t...
Definition: Observer.h:34
ObserverList_t m_list
The list of objects observing this Observable.
Definition: Observable.h:51

Generated for HippoDraw Class Library by doxygen