ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Common::CallbackBridge< T, OS, S > Class Template Reference

CallbackBridge<T, OS, S> helps you to chain callbacks. More...

#include <callback.h>

Inheritance diagram for Common::CallbackBridge< T, OS, S >:
Collaboration diagram for Common::CallbackBridge< T, OS, S >:

List of all members.

Public Member Functions

 CallbackBridge (T *object, TCallbackMethod method, BaseCallback< OS > *outerCallback)
virtual ~CallbackBridge ()
void operator() (S data)

Private Types

typedef void(T::* TCallbackMethod )(BaseCallback< OS > *, S)

Private Attributes

T * _object
TCallbackMethod _method
BaseCallback< OS > * _outerCallback

Detailed Description

template<class T, typename OS, typename S = void *>
class Common::CallbackBridge< T, OS, S >

CallbackBridge<T, OS, S> helps you to chain callbacks.

CallbackBridge keeps a pointer to BaseCallback<OS>. When its operator() is called, it passes this pointer along with the actual data (of type <S>) to the method of <T> class.

This is needed when you have to call a callback only when your own callback is called. So, your callback is "inner" and the other one is "outer".

CallbackBridge implements the "inner" one and calls the method you wanted. It passes the "outer", so you can call it from your method. You can ignore it, but probably there is no point in using CallbackBridge then.

So, if you receive a BaseCallback<SomeClass> callback and you want to call it from your MyClass::myMethod method, you should create CallbackBridge<MyClass, SomeClass, S>, where <S> is data type you want to receive in MyClass::myMethod.

You create it similarly to this: new Callback<MyClass, SomeClass, AnotherClass>( pointerToMyClassObject, &MyClass::myMethod, outerCallback ) where `outerCallback` is BaseCallback<SomeClass> and `myMethod` is: void MyClass::myMethod(BaseCallback<SomeClass> *, AnotherClass)

Definition at line 124 of file callback.h.


Member Typedef Documentation

template<class T, typename OS, typename S = void *>
typedef void(T::* Common::CallbackBridge< T, OS, S >::TCallbackMethod)(BaseCallback< OS > *, S) [private]

Definition at line 125 of file callback.h.


Constructor & Destructor Documentation

template<class T, typename OS, typename S = void *>
Common::CallbackBridge< T, OS, S >::CallbackBridge ( T *  object,
TCallbackMethod  method,
BaseCallback< OS > *  outerCallback 
) [inline]

Definition at line 130 of file callback.h.

template<class T, typename OS, typename S = void *>
virtual Common::CallbackBridge< T, OS, S >::~CallbackBridge (  )  [inline, virtual]

Definition at line 132 of file callback.h.


Member Function Documentation

template<class T, typename OS, typename S = void *>
void Common::CallbackBridge< T, OS, S >::operator() ( data  )  [inline, virtual]

Implements Common::BaseCallback< S >.

Definition at line 133 of file callback.h.


Member Data Documentation

template<class T, typename OS, typename S = void *>
TCallbackMethod Common::CallbackBridge< T, OS, S >::_method [private]

Definition at line 127 of file callback.h.

template<class T, typename OS, typename S = void *>
T* Common::CallbackBridge< T, OS, S >::_object [private]

Definition at line 126 of file callback.h.

template<class T, typename OS, typename S = void *>
BaseCallback<OS>* Common::CallbackBridge< T, OS, S >::_outerCallback [private]

Definition at line 128 of file callback.h.


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


Generated on Sat Aug 17 2019 05:02:36 for ResidualVM by doxygen 1.7.1
curved edge   curved edge