VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Protected Types | Protected Attributes | Private Member Functions
DtCallbackList< T_CallbackArg > Class Template Reference

DtCallbackList; DtNoArgumentCallbackList. More...

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

Classes

struct  DtCallbackInfoType

Public Types

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

Public Member Functions

 DtCallbackList ()
 Default constructor.
 DtCallbackList (const DtCallbackList &orig)
 Copy constructor.
bool addCallback (DtCallbackFunctionType fcn, void *usrData)
 Adds a new callback to the list.
bool 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::list
< boost::shared_ptr
< DtCallbackInfoType > > 
DtCallbackListType

Protected Attributes

tbb::spin_mutex myMutex
DtCallbackListType myCallbackList
unsigned myCallbackCount

Private Member Functions

DtCallbackListoperator= (const DtCallbackList &orig)

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.
It is safe to add and remove callbacks simultaneously from multiple threads.
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::list< boost::shared_ptr<DtCallbackInfoType> > DtCallbackList< T_CallbackArg >::DtCallbackListType
protected

Constructor & Destructor Documentation

template<typename T_CallbackArg>
DtCallbackList< T_CallbackArg >::DtCallbackList ( )

Default constructor.

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

Copy constructor.

Exists mostly so that std::map will work on linux without C++11.

Member Function Documentation

template<typename T_CallbackArg>
bool 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.
Returns
True if this was the first callback added.
template<typename T_CallbackArg>
bool 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.
Returns
True if this was the last callback removed.
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>
DtCallbackList& DtCallbackList< T_CallbackArg >::operator= ( const DtCallbackList< T_CallbackArg > &  orig)
private

Member Data Documentation

template<typename T_CallbackArg>
tbb::spin_mutex DtCallbackList< T_CallbackArg >::myMutex
mutableprotected
template<typename T_CallbackArg>
DtCallbackListType DtCallbackList< T_CallbackArg >::myCallbackList
protected
template<typename T_CallbackArg>
unsigned DtCallbackList< T_CallbackArg >::myCallbackCount
protected

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

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)