Gyoto
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
Gyoto::Hook::Teller Class Reference

Listen to me and I'll warn you when I change. More...

#include <GyotoHooks.h>

Inheritance diagram for Gyoto::Hook::Teller:
Gyoto::Metric::Generic Gyoto::Spectrometer::Generic Gyoto::Metric::Complex Gyoto::Metric::Hayward Gyoto::Metric::KerrBL Gyoto::Metric::KerrKS Gyoto::Metric::Minkowski Gyoto::Metric::NumericalMetricLorene Gyoto::Metric::Python Gyoto::Metric::RezzollaZhidenko Gyoto::Metric::RotStar3_1 Gyoto::Metric::Shift Gyoto::Spectrometer::Complex Gyoto::Spectrometer::Uniform

Public Member Functions

 Teller ()
 Default constructor.
 
 Teller (const Teller &)
 Copy constructor.
 
virtual ~Teller ()
 Destructor.
 
virtual void hook (Listener *listener)
 Start listening. More...
 
virtual void unhook (Listener *listener)
 Stop listening. More...
 

Protected Member Functions

virtual void tellListeners ()
 Call tell() on each hooked Listener. More...
 

Private Attributes

ListenerItemlisteners_
 Linked list of Listener items.
 

Friends

class Gyoto::Hook::Listener
 

Detailed Description

Listen to me and I'll warn you when I change.

Listen to me by calling my hook() method.

Member Function Documentation

◆ hook()

virtual void Gyoto::Hook::Teller::hook ( Listener listener)
virtual

Start listening.

Use from a Hook::Listener object method:

teller->hook(this)

where "this" is a Listener and "teller" is a Teller.

Use unhook() later to stop listening to a given Teller.

Parameters
listenerpointer to the new listener

◆ tellListeners()

virtual void Gyoto::Hook::Teller::tellListeners ( )
protectedvirtual

Call tell() on each hooked Listener.

Whenever a Teller mutates, it should warn any Listener hooked to it using tellListeners().

◆ unhook()

virtual void Gyoto::Hook::Teller::unhook ( Listener listener)
virtual

Stop listening.

Use from a Hook::Listener object method:

teller->unhook(this)

where "this" is a Listener, "teller" is a Teller, and "this" has called teller->hook(this) previously.

Parameters
listenerpointer to the listener

The documentation for this class was generated from the following file: