GyotoHooks.h
Go to the documentation of this file.
/*
Copyright 2012-2013 Thibaut Paumard
This file is part of Gyoto.
Gyoto is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gyoto is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GyotoHooks_h
#define __GyotoHooks_h
namespace Gyoto {
namespace Hook {
class Teller;
class Listener;
}
}
class Gyoto::Hook::Listener {
friend class Gyoto::Hook::Teller;
public:
Listener();
virtual ~Listener();
protected:
virtual void tell(Gyoto::Hook::Teller *msg);
};
class Gyoto::Hook::Teller {
friend class Gyoto::Hook::Listener;
private:
class ListenerItem;
ListenerItem *listeners_;
public:
Teller();
Teller(const Teller &);
virtual ~Teller();
virtual void hook (Listener * listener);
virtual void unhook (Listener * listener);
protected:
virtual void tellListeners();
};
#endif
Gyoto::Hook::Listener
I might listen to a Teller.
Definition GyotoHooks.h:64
Gyoto::Hook::Listener::Listener
Listener()
Constructor.
Gyoto::Hook::Listener::~Listener
virtual ~Listener()
Destructor.
Gyoto::Hook::Listener::tell
virtual void tell(Gyoto::Hook::Teller *msg)
This is how a Teller tells.
Gyoto::Hook::Teller
Listen to me and I'll warn you when I change.
Definition GyotoHooks.h:82
Gyoto::Hook::Teller::hook
virtual void hook(Listener *listener)
Start listening.
Gyoto::Hook::Teller::~Teller
virtual ~Teller()
Destructor.
Gyoto::Hook::Teller::unhook
virtual void unhook(Listener *listener)
Stop listening.
Gyoto::Hook::Teller::Teller
Teller()
Default constructor.
Gyoto::Hook::Teller::Teller
Teller(const Teller &)
Copy constructor.
Gyoto::Hook::Teller::listeners_
ListenerItem * listeners_
Linked list of Listener items.
Definition GyotoHooks.h:94
Gyoto::Hook::Teller::tellListeners
virtual void tellListeners()
Call tell() on each hooked Listener.
ListenerItem
Private (undocumented) class to hold listeners_.
Gyoto::Hook
Listeners attach to Tellers.
Gyoto
Namespace for the Gyoto library.
Definition GyotoAstrobj.h:44