Gyoto
GyotoHooks.h
Go to the documentation of this file.
1
12/*
13 Copyright 2012-2013 Thibaut Paumard
14
15 This file is part of Gyoto.
16
17 Gyoto is free software: you can redistribute it and/or modify
18 it under the terms of the GNU General Public License as published by
19 the Free Software Foundation, either version 3 of the License, or
20 (at your option) any later version.
21
22 Gyoto is distributed in the hope that it will be useful,
23 but WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 GNU General Public License for more details.
26
27 You should have received a copy of the GNU General Public License
28 along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
29 */
30
31#ifndef __GyotoHooks_h
32#define __GyotoHooks_h
33
44namespace Gyoto {
45 namespace Hook {
52 class Teller;
53
60 class Listener;
61 }
62}
63
65 friend class Gyoto::Hook::Teller;
66 public:
68 virtual ~Listener();
69
70 protected:
79 virtual void tell(Gyoto::Hook::Teller *msg);
80};
81
83 friend class Gyoto::Hook::Listener;
84 private:
89 class ListenerItem;
90
95
96 public:
98 Teller(const Teller &);
99 virtual ~Teller();
100
114 virtual void hook (Listener * listener);
115
129 virtual void unhook (Listener * listener);
130
131 protected:
138 virtual void tellListeners();
139};
140
141#endif
I might listen to a Teller.
Definition: GyotoHooks.h:64
Listener()
Constructor.
virtual ~Listener()
Destructor.
virtual void tell(Gyoto::Hook::Teller *msg)
This is how a Teller tells.
Listen to me and I'll warn you when I change.
Definition: GyotoHooks.h:82
virtual void hook(Listener *listener)
Start listening.
virtual ~Teller()
Destructor.
virtual void unhook(Listener *listener)
Stop listening.
Teller()
Default constructor.
Teller(const Teller &)
Copy constructor.
ListenerItem * listeners_
Linked list of Listener items.
Definition: GyotoHooks.h:94
virtual void tellListeners()
Call tell() on each hooked Listener.
Private (undocumented) class to hold listeners_.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43