Public Member Functions | List of all members
mirtk::EventDelegate Class Reference

#include <EventDelegate.h>

Inheritance diagram for mirtk::EventDelegate:
Inheritance graph
Collaboration diagram for mirtk::EventDelegate:
Collaboration graph

Public Member Functions

void Bind (Delegate0)
 Bind callback (member) function for any event with no arguments.
 
void Bind (Delegate1)
 Bind callback (member) function for any event with one argument.
 
void Bind (Delegate2)
 Bind callback (member) function for any event with two arguments.
 
void Bind (Delegate3)
 Bind callback (member) function for any event with four arguments.
 
void Bind (Event, Delegate0)
 Bind callback (member) function to specified event.
 
void Bind (Event, Delegate1)
 Bind callback (member) function to specified event.
 
void Bind (Event, Delegate2)
 Bind callback (member) function to specified event.
 
void Bind (Event, Delegate3)
 Bind callback (member) function to specified event.
 
 EventDelegate ()
 Default constructor.
 
void HandleEvent (Observable *, Event, const void *=NULL)
 Forward event notification to registered callback (member) function.
 
 ~EventDelegate ()
 Destructor.
 
- Public Member Functions inherited from mirtk::Observer
void ClearObservables ()
 Stop observing any of the currently monitored observables.
 
- Public Member Functions inherited from mirtk::Object
virtual const char * NameOfClass () const =0
 Get name of class, which this object is an instance of.
 
virtual ParameterList Parameter () const
 Get parameter name/value pairs.
 
bool Parameter (const ParameterList &)
 Set parameters from name/value pairs.
 
virtual bool Set (const char *name, const char *value)
 
virtual ~Object ()
 Destructor.
 

Additional Inherited Members

- Static Public Member Functions inherited from mirtk::Object
static const char * NameOfType ()
 Get name of this class type.
 
- Protected Member Functions inherited from mirtk::Observer
 Observer ()
 Default constructor.
 
 Observer (const Observer &)
 Copy constructor.
 
Observeroperator= (const Observer &)
 Assignment operator.
 
virtual ~Observer ()
 Destructor.
 
- Protected Member Functions inherited from mirtk::Object
template<typename... Args>
void Throw (ErrorType err, const char *func, Args... args) const
 
- Static Protected Member Functions inherited from mirtk::Object
template<typename... Args>
static void ThrowStatic (ErrorType err, const char *cls, const char *func, Args... args)
 

Detailed Description

Invokes a callback function for observed events

This class can be registered as observer of an observable object derived from Observable. It receives the event notifications from the observed object(s) and dispatches the corresponding registered callback (member) function (if any). It therefore uses instances of FastDelegate.

Note
Do not derive from this class. Instead add instances of it as attributes to classes which observe other objects and handle the events.
EventDelegate delegate;
// Bind non-member function to any event
delegate.Bind(&function);
// Bind static member function to EndEvent
delegate.Bind(EndEvent, &function);
// Bind non-static member function to IterationEvent
delegate.Bind(IterationEvent, MakeDelegate(&obj, &method));

Definition at line 53 of file EventDelegate.h.


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