NEURON
observe.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1992 Stanford University
3  * Copyright (c) 1992 Silicon Graphics, Inc.
4  *
5  * Permission to use, copy, modify, distribute, and sell this software and
6  * its documentation for any purpose is hereby granted without fee, provided
7  * that (i) the above copyright notices and this permission notice appear in
8  * all copies of the software and related documentation, and (ii) the names of
9  * Stanford and Silicon Graphics may not be used in any advertising or
10  * publicity relating to the software without the specific, prior written
11  * permission of Stanford and Silicon Graphics.
12  *
13  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
14  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
15  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR
18  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
21  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22  * OF THIS SOFTWARE.
23  */
24 
25 /*
26  * Observable - object to observe
27  */
28 
29 #ifndef iv_observe_h
30 #define iv_observe_h
31 
32 #include <InterViews/enter-scope.h>
33 
34 #include <InterViews/_enter.h>
35 
36 class Observer;
37 class ObserverList;
38 
39 class Observable {
40 public:
41  Observable();
42  virtual ~Observable();
43 
44  virtual void attach(Observer*);
45  virtual void detach(Observer*);
46  virtual void notify();
47 private:
49 };
50 
51 class Observer {
52 protected:
53  Observer();
54 public:
55  virtual ~Observer();
56 
57  virtual void update(Observable*);
58  virtual void disconnect(Observable*);
59 };
60 
61 #include <InterViews/_leave.h>
62 
63 #endif
#define ObserverList
Definition: _defines.h:192
virtual void notify()
Definition: observe.cpp:75
virtual void attach(Observer *)
Definition: observe.cpp:54
Observable()
Definition: observe.cpp:38
virtual ~Observable()
Definition: observe.cpp:42
virtual void detach(Observer *)
Definition: observe.cpp:63
ObserverList * observers_
Definition: observe.h:48
Observer()
Definition: observe.cpp:84
virtual ~Observer()
Definition: observe.cpp:85
virtual void disconnect(Observable *)
Definition: observe.cpp:87
virtual void update(Observable *)
Definition: observe.cpp:86