RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
Observer.h
1/***********************************************************************
2 * The rDock program was developed from 1998 - 2006 by the software team
3 * at RiboTargets (subsequently Vernalis (R&D) Ltd).
4 * In 2006, the software was licensed to the University of York for
5 * maintenance and distribution.
6 * In 2012, Vernalis and the University of York agreed to release the
7 * program as Open Source software.
8 * This version is licensed under GNU-LGPL version 3.0 with support from
9 * the University of Barcelona.
10 * http://rdock.sourceforge.net/
11 ***********************************************************************/
12
13// Abstract Observer class for Subject-Observer design pattern, see Subject.h
14// Design considerations:
15// Subclasses should override the Update and Deleted methods, which are invoked
16// by the subject when the subject changes state or is about to be deleted,
17// respectively.
18// Observer subclasses also need to store a pointer to the concrete subject
19// subclass (e.g. WorkSpace), either via Register and Unregister methods or
20// via the constructor, so that subject subclass methods can be called to get
21// details of the change in state. No pointer to the base subject object is
22// stored in the base observer object.
23
24#ifndef _RBTOBSERVER_H_
25#define _RBTOBSERVER_H_
26
27#include <vector>
28
29namespace rxdock {
30
31class Subject;
32
33class Observer {
34public:
36 // Constructors/destructors
37 virtual ~Observer(); // Default destructor
38
40 // Public methods
42 // PURE VIRTUAL - DERIVED CLASSES MUST OVERRIDE
43 // Notify observer that subject has changed
44 virtual void Update(Subject *theChangedSubject) = 0;
45 // Notify observer that subject is about to be deleted
46 virtual void Deleted(Subject *theDeletedSubject) = 0;
47
48protected:
50 // Protected methods
52 Observer();
53
54private:
56 // Private methods
58 Observer(const Observer &); // Copy constructor disabled by default
59 Observer &operator=(const Observer &); // Copy assignment disabled by default
60
61protected:
63 // Protected data
65
66private:
68 // Private data
70};
71
72// Useful typedefs
73typedef std::vector<Observer *> ObserverList;
74typedef ObserverList::iterator ObserverListIter;
75typedef ObserverList::const_iterator ObserverListConstIter;
76
77} // namespace rxdock
78
79#endif //_RBTOBSERVER_H_
Definition Observer.h:33
Definition Subject.h:35