Torque2D Reference
Classes | Public Member Functions | Protected Attributes | List of all members
SignalBase Class Reference

#include <delegateSignal.h>

+ Inheritance diagram for SignalBase:

Classes

struct  DelegateLink
 

Public Member Functions

 SignalBase ()
 
 ~SignalBase ()
 
void removeAll ()
 Removes all the delegates from the signal. More...
 
bool isEmpty () const
 Returns true if the delegate list is empty. More...
 

Protected Attributes

DelegateLink mList
 
Vector< DelegateLink * > mTriggerNext
 

Detailed Description

Signals (Multi-cast Delegates)

Signals are used throughout this engine to allow subscribers to listen for generated events for various things.

Signals are called according to their order parameter (lower numbers first).

Signal functions can return bool or void. If bool then returning false from a signal function will cause entries in the ordered signal list after that one to not be called.

This allows handlers of a given event to say to the signal generator, "I handled this message, and it is no longer appropriate for other listeners to handle it"

Constructor & Destructor Documentation

SignalBase ( )
inline
~SignalBase ( )

Member Function Documentation

bool isEmpty ( ) const
inline

Returns true if the delegate list is empty.

void removeAll ( )

Removes all the delegates from the signal.

Member Data Documentation

DelegateLink mList
protected
Vector<DelegateLink*> mTriggerNext
protected

We need to protect the delegate list against removal of the currently triggering node as well removal of the next node in the list. When not handling these two cases correctly, removing delegates from a signal while it is triggering will lead to crashes.

So this field stores the next node of each active traversal so that when we unlink a node, we can check it against this field and move the traversal along if needed.


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