summaryrefslogtreecommitdiff
path: root/plugins/WinterSpeak/src/Subject.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/WinterSpeak/src/Subject.h')
-rw-r--r--plugins/WinterSpeak/src/Subject.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/plugins/WinterSpeak/src/Subject.h b/plugins/WinterSpeak/src/Subject.h
new file mode 100644
index 0000000000..f4bba3b075
--- /dev/null
+++ b/plugins/WinterSpeak/src/Subject.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#include "Observer.h"
+
+#include <list>
+class Subject
+{
+public:
+ Subject();
+ virtual ~Subject();
+
+ //--------------------------------------------------------------------------
+ // Description : Notify all observers of a state change
+ //--------------------------------------------------------------------------
+ void notify();
+
+ //--------------------------------------------------------------------------
+ // Description : Attach an observer to the subject
+ // Parameters : observer - the observer
+ //--------------------------------------------------------------------------
+ void attach(Observer &observer);
+
+ //--------------------------------------------------------------------------
+ // Description : Detach an observer from the subject
+ // Parameters : observer - the observer
+ //--------------------------------------------------------------------------
+ void detach(const Observer &observer);
+
+ private:
+ //--------------------------------------------------------------------------
+ // Description : Disallow assignment operator and copy constructor
+ //--------------------------------------------------------------------------
+ Subject(const Subject &rhs);
+ const Subject & operator=(const Subject &rhs);
+
+ std::list<Observer *> m_observer_list;
+};
+