class Listener

Listener interface for Notifier events. More...

Full nameTSE3::Listener
Definition#include <Notifier.h>
Template formListener<class interface_type>
Inheritsinterface_type (unknown) [public ]
Inherited byApplication, Mixer, Modified, Modified, Modified, Modified, Modified, Modified, Modified, Modified, Modified, Modified, Modified, Part, Part, Part, Part, PartSelection, PartSelection, Phrase, PhraseList, Record, Song, Track, Track, TrackSelection, TrackSelection, Transport, Transport, Transport, Transport, Transport
List of all Methods
Annotated List

Public Types

Public Methods

Public Members

Protected Types

Protected Methods

Detailed Description

The Listener class receives events sent from a Notifier class.

Listener inherits from the specified interface_type so you don't need to mupltiply inherit from both Listener the interface_type in your derived class.

To instatiate the Listener class inherit from Listener. Following the example in the Notifier documentation, this would be:

     class Voyeur : public Listener
             virtual void eventOne(Exhibitionist *src)        { ... }
             virtual void eventTwo(Exhibitionist *src, int a) { ... }
             virtual void Notifier_Deleted(Exhibitionist *src)
                 // The 'src' is being deleted - you do not need to
                 // detach from it, the link is automatically broken.

                 // This method is not defined in the
                 // ExhibitionistListener base class, but is defined by
                 // the Listener class. You
                 // don't have to implement it if you don't need it.

Upon deletion, the Listener class ensures that it is detached from every Notifier it has been attached to. This prevents a Notifier later trying to callback to an invalid object.

See also: Notifier

typedef Notifier notifier_type


The type of Notifier class this listener works with.

void  attachTo (notifier_type *notifier)


Attaches this Listener to notifier.

You can only attach to a Notifer object once - any subsequent attempt to attach to it results in nothing happening; it is not an error, but the Listener will still only ever receive one copy of any event.

notifierThe Notifier object to attach to

void  detachFrom (notifier_type *notifier)


Detaches this Listener from notifier.

If the listener is not already attached to this Notifier no error is raised.

notifierThe Notifier object to detach from

friend class notifier_type


 Listener ()



Creates a new Listener which is not attached to any Notifier.

Use attachTo to attach to Notifiers.

You can only subclass this type, not instanitate it directly.

typedef interface_type::notifier_type c_notifier_type



The concrete Notifier type (i.e. the class that derives from Notifier.

void  Notifier_Deleted (c_notifier_type * )


[protected virtual]

This may be implemented by Listener classes if they care about a Notifier object being deleted.

It is called by the Notifer destructor - so the notifier is in the process of being deleted. Therefore it is not safe to call methods on the event source object any more.

You do not need to detachFrom the the Notifier since the link is automatically broken for you.

notifierThe Notifier that has been deleted

 ~Listener ()


[protected virtual]

The destructor ensures that the Listener is detached from every Notifier it has been attached to.

This means that you don't have to specifically detach from all Notifier sources yourself, although it is still considered good practice to do so.