Observable.h

Go to the documentation of this file.
00001 /* -*- mode: c++ -*- */
00002 
00014 #ifndef _Observable_H_
00015 #define _Observable_H_
00016 
00017 #include "libhippo.h"
00018 
00019 #ifdef _MSC_VER
00020 #include <msdevstudio/MSconfig.h>
00021 #endif
00022 
00023 #include <list>
00024 
00025 namespace hippodraw {
00026 
00027   class Observer;
00028 
00039 class MDL_HIPPOPLOT_API Observable
00040 {
00041 public:
00042 
00045   typedef std::list < Observer * > ObserverList_t;
00046 
00047 private:
00048 
00051   ObserverList_t m_list;
00052 
00053 //protected:
00054 
00055 public:
00057   Observable();
00058 
00059 public:
00060 
00066   virtual ~ Observable ();
00067 
00069   void addObserver ( Observer * );
00070 
00072   const ObserverList_t & getObservers () const;
00073 
00075   void removeObserver ( Observer * );
00076 
00083   virtual void notifyObservers () const;
00084 
00086   typedef void ( Observer::*Action ) ( const Observable * );
00087 
00088 protected:
00089 
00092   void notifyObservers ( Action action ) const;
00093 
00094 };
00095 
00096 } // namespace hippodraw
00097 
00098 #endif // _Observable_H_

Generated for HippoDraw Class Library by doxygen