VR-Forces 4.1 Class Documentation
List of all members | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
DtCallbackList< T_CallbackArg > Class Template Reference

DtCallbackList; DtNoArgumentCallbackList. More...

Inheritance diagram for DtCallbackList< T_CallbackArg >:
Inheritance graph
[legend]

Public Types

typedef void(* DtCallbackFunctionType )(T_CallbackArg, void *)
 The function signature of the callback function.

Public Member Functions

 DtCallbackList ()
 DtCallbackList (const DtCallbackList &orig)
 ~DtCallbackList ()
DtCallbackListoperator= (const DtCallbackList &orig)
void addCallback (DtCallbackFunctionType fcn, void *usrData)
 Adds a new callback to the list.
void removeCallback (DtCallbackFunctionType fcn, void *usrData)
 Removes the specified callback from the list.
void invokeCallbacks (T_CallbackArg arg)
 Invokes all the callbacks currently on the callback list.
void removeAll ()
 Removes all callbacks that have been registered.

Protected Types

typedef std::pair
< DtCallbackFunctionType, void * > 
DtCallbackInfoType
typedef std::list
< DtCallbackInfoType
DtCallbackListType

Protected Member Functions

bool contains (const DtCallbackListType &callbackList, DtCallbackFunctionType fcn, void *usrData) const

Protected Attributes

DtCallbackListType myCallbackList
bool myInvokingCallbacks
 Flag used to indicate that the invokeCallbacks method is currently running.
DtCallbackListType myCallbacksToRemove
 List used to queue callbacks for removal if removeCallback() is called during callback invokation.

Detailed Description

template<typename T_CallbackArg>
class DtCallbackList< T_CallbackArg >

DtCallbackList; DtNoArgumentCallbackList.

This is a templated class which manages a list of callbacks. A class is instantiated from this template by specifying the argument to be passed into the callback function. A callback function signature is created by this class (as the DtCallbackFunctionType definition) using the specified argument.

Note
It is safe to add and remove callbacks from this table during callback invokation, so callbacks functions may safely remove themselves.
A version of this class for callback with no arguments is DtNoArgumentCallbackList.

Member Typedef Documentation

template<typename T_CallbackArg>
typedef void(* DtCallbackList< T_CallbackArg >::DtCallbackFunctionType)(T_CallbackArg, void *)

The function signature of the callback function.

template<typename T_CallbackArg>
typedef std::pair<DtCallbackFunctionType, void*> DtCallbackList< T_CallbackArg >::DtCallbackInfoType
protected
template<typename T_CallbackArg>
typedef std::list<DtCallbackInfoType> DtCallbackList< T_CallbackArg >::DtCallbackListType
protected

Constructor & Destructor Documentation

template<typename T_CallbackArg>
DtCallbackList< T_CallbackArg >::DtCallbackList ( )
template<typename T_CallbackArg>
DtCallbackList< T_CallbackArg >::DtCallbackList ( const DtCallbackList< T_CallbackArg > &  orig)
template<typename T_CallbackArg>
DtCallbackList< T_CallbackArg >::~DtCallbackList ( )

Member Function Documentation

template<typename T_CallbackArg>
DtCallbackList& DtCallbackList< T_CallbackArg >::operator= ( const DtCallbackList< T_CallbackArg > &  orig)
template<typename T_CallbackArg>
void DtCallbackList< T_CallbackArg >::addCallback ( DtCallbackFunctionType  fcn,
void *  usrData 
)

Adds a new callback to the list.

A duplicate entry is checked for first, and if found, this new function is not added.

Note
It is safe to call this from inside a callback function.
template<typename T_CallbackArg>
void DtCallbackList< T_CallbackArg >::removeCallback ( DtCallbackFunctionType  fcn,
void *  usrData 
)

Removes the specified callback from the list.

Note
It is safe to call this from inside a callback function.
template<typename T_CallbackArg>
void DtCallbackList< T_CallbackArg >::invokeCallbacks ( T_CallbackArg  arg)

Invokes all the callbacks currently on the callback list.

Note
This method must not be called by any of the callbacks it invokes.
template<typename T_CallbackArg>
void DtCallbackList< T_CallbackArg >::removeAll ( )

Removes all callbacks that have been registered.

template<typename T_CallbackArg>
bool DtCallbackList< T_CallbackArg >::contains ( const DtCallbackListType callbackList,
DtCallbackFunctionType  fcn,
void *  usrData 
) const
protected
Returns
True if the callback list currently contains an entry for the specified callback function and user data.

Member Data Documentation

template<typename T_CallbackArg>
DtCallbackListType DtCallbackList< T_CallbackArg >::myCallbackList
protected
template<typename T_CallbackArg>
bool DtCallbackList< T_CallbackArg >::myInvokingCallbacks
protected

Flag used to indicate that the invokeCallbacks method is currently running.

Value not copied with the copy constructor/assignment operator.

template<typename T_CallbackArg>
DtCallbackListType DtCallbackList< T_CallbackArg >::myCallbacksToRemove
protected

List used to queue callbacks for removal if removeCallback() is called during callback invokation.

Value not copied with the copy constructor/assignment operator.


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

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)