#include <callback.h>
Public Member Functions | |
CallbackBridge (T *object, TCallbackMethod method, BaseCallback< OS > *outerCallback) | |
void | operator() (S data) |
CallbackBridge<T, OS, S> allows 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 the data type you want to receive in MyClass::myMethod.
You can create it in the following way: new Callback<MyClass, SomeClass, AnotherClass>( pointerToMyClassObject, &MyClass::myMethod, outerCallback ) where outerCallback
is BaseCallback<SomeClass> and myMethod
is: void MyClass::myMethod(BaseCallback<SomeClass> *, AnotherClass)
|
inlinevirtual |
Type of the object passed to the operator.
Implements Common::BaseCallback< S >.