|
typedef RT | ReturnType |
| Definition of the return type of this callback object.
|
|
typedef PT0 | ParameterType0 |
| Definition of the 1st parameter type of this callback object.
|
|
typedef PT1 | ParameterType1 |
| Definition of the 2rd parameter type of this callback object.
|
|
typedef PT2 | ParameterType2 |
| Definition of the 3rd parameter type of this callback object.
|
|
typedef PT3 | ParameterType3 |
| Definition of the 4th parameter type of this callback object.
|
|
typedef PT4 | ParameterType4 |
| Definition of the 5th parameter type of this callback object.
|
|
typedef PT5 | ParameterType5 |
| Definition of the 6th parameter type of this callback object.
|
|
typedef PT6 | ParameterType6 |
| Definition of the 7th parameter type of this callback object.
|
|
typedef PT7 | ParameterType7 |
| Definition of the 8th parameter type of this callback object.
|
|
typedef PT8 | ParameterType8 |
| Definition of the 9th parameter type of this callback object.
|
|
typedef PT9 | ParameterType9 |
| Definition of the 10th parameter type of this callback object.
|
|
typedef PT10 | ParameterType10 |
| Definition of the 11th parameter type of this callback object.
|
|
typedef PT11 | ParameterType11 |
| Definition of the 12th parameter type of this callback object.
|
|
typedef PT12 | ParameterType12 |
| Definition of the 13th parameter type of this callback object.
|
|
typedef PT13 | ParameterType13 |
| Definition of the 14th parameter type of this callback object.
|
|
typedef PT14 | ParameterType14 |
| Definition of the 15th parameter type of this callback object.
|
|
typedef PT15 | ParameterType15 |
| Definition of the 16th parameter type of this callback object.
|
|
typedef PT16 | ParameterType16 |
| Definition of the 17th parameter type of this callback object.
|
|
typedef PT17 | ParameterType17 |
| Definition of the 18th parameter type of this callback object.
|
|
typedef PT18 | ParameterType18 |
| Definition of the 19th parameter type of this callback object.
|
|
typedef PT19 | ParameterType19 |
| Definition of the 20th parameter type of this callback object.
|
|
|
| Callback () |
| Creates an empty callback container.
|
|
| Callback (const Callback &callback) |
| Copies a callback container.
|
|
template<typename CT > |
| Callback (CT &object, typename MemberFunctionPointerMaker< CT, RT, PT0, PT1, PT2, PT3, PT4, PT5, PT6, PT7, PT8, PT9, PT10, PT11, PT12, PT13, PT14, PT15, PT16, PT17, PT18, PT19 >::Type function) |
| Creates a new callback container for a member function.
|
|
| Callback (typename StaticFunctionPointerMaker< RT, PT0, PT1, PT2, PT3, PT4, PT5, PT6, PT7, PT8, PT9, PT10, PT11, PT12, PT13, PT14, PT15, PT16, PT17, PT18, PT19 >::Type function) |
| Creates a new callback container for a static function.
|
|
virtual | ~Callback () |
| Destructs a callback container object.
|
|
bool | isNull () const |
| Returns whether this container holds no function.
|
|
RT | operator() (PT0 param0=PT0(), PT1 param1=PT1(), PT2 param2=PT2(), PT3 param3=PT3(), PT4 param4=PT4(), PT5 param5=PT5(), PT6 param6=PT6(), PT7 param7=PT7(), PT8 param8=PT8(), PT9 param9=PT9(), PT10 param10=PT10(), PT11 param11=PT11(), PT12 param12=PT12(), PT13 param13=PT13(), PT14 param14=PT14(), PT15 param15=PT15(), PT16 param16=PT16(), PT17 param17=PT17(), PT18 param18=PT18(), PT19 param19=PT19()) const |
| Calls the encapsulated callback function.
|
|
Callback & | operator= (const Callback &callback) |
| Assigns a callback container.
|
|
bool | operator== (const Callback &callback) const |
| Returns whether two callback container addressing the same class object and the same local member function.
|
|
bool | operator!= (const Callback &callback) const |
| Returns whether two callback container addressing not the same class object or not the same local member function.
|
|
| operator bool () const |
| Returns whether this container holds an encapsulated function.
|
|
|
template<typename CT > |
static Callback< RT, PT0, PT1, PT2, PT3, PT4, PT5, PT6, PT7, PT8, PT9, PT10, PT11, PT12, PT13, PT14, PT15, PT16, PT17, PT18, PT19 > | create (CT &object, typename MemberFunctionPointerMaker< CT, RT, PT0, PT1, PT2, PT3, PT4, PT5, PT6, PT7, PT8, PT9, PT10, PT11, PT12, PT13, PT14, PT15, PT16, PT17, PT18, PT19 >::Type function) |
| Creates a new callback container for a member function.
|
|
static Callback< RT, PT0, PT1, PT2, PT3, PT4, PT5, PT6, PT7, PT8, PT9, PT10, PT11, PT12, PT13, PT14, PT15, PT16, PT17, PT18, PT19 > | createStatic (typename StaticFunctionPointerMaker< RT, PT0, PT1, PT2, PT3, PT4, PT5, PT6, PT7, PT8, PT9, PT10, PT11, PT12, PT13, PT14, PT15, PT16, PT17, PT18, PT19 >::Type function) |
| Creates a new callback container for a static function.
|
|
template<typename RT, typename PT0 = NullClass, typename PT1 = NullClass, typename PT2 = NullClass, typename PT3 = NullClass, typename PT4 = NullClass, typename PT5 = NullClass, typename PT6 = NullClass, typename PT7 = NullClass, typename PT8 = NullClass, typename PT9 = NullClass, typename PT10 = NullClass, typename PT11 = NullClass, typename PT12 = NullClass, typename PT13 = NullClass, typename PT14 = NullClass, typename PT15 = NullClass, typename PT16 = NullClass, typename PT17 = NullClass, typename PT18 = NullClass, typename PT19 = NullClass>
class Ocean::Callback< RT, PT0, PT1, PT2, PT3, PT4, PT5, PT6, PT7, PT8, PT9, PT10, PT11, PT12, PT13, PT14, PT15, PT16, PT17, PT18, PT19 >
This class implements a container for callback functions.
Use this callback container to encapsulate callback functions to static functions or member functions (of classes).
For member functions, this class is independent from the function's owner (class) and therefore can be stored without the definition of the class type.
This template class holds several template parameters, all specifying return and function parameter types.
- Template Parameters
-
RT | Specifies the return type of the callback function |
PT0 | Specifies the 1st possible function parameter type |
PT1 | Specifies the 2rd possible function parameter type |
PT2 | Specifies the 3rd possible function parameter type |
PT3 | Specifies the 4th possible function parameter type |
PT4 | Specifies the 5th possible function parameter type |
PT5 | Specifies the 6th possible function parameter type |
PT6 | Specifies the 7th possible function parameter type |
PT7 | Specifies the 8th possible function parameter type |
PT8 | Specifies the 9th possible function parameter type |
PT9 | Specifies the 10th possible function parameter type |
PT10 | Specifies the 11th possible function parameter type |
PT11 | Specifies the 12th possible function parameter type |
PT12 | Specifies the 13th possible function parameter type |
PT13 | Specifies the 14th possible function parameter type |
PT14 | Specifies the 15th possible function parameter type |
PT15 | Specifies the 16th possible function parameter type |
PT16 | Specifies the 17th possible function parameter type |
PT17 | Specifies the 18th possible function parameter type |
PT18 | Specifies the 19th possible function parameter type |
PT19 | Specifies the 20th possible function parameter type |
- See also
- Callbacks, ConcurrentCallbacks.
See the following code tutorial:
class TestClass
{
public:
void firstMemberFunction();
bool secondMemberFunction(int param0, const unsigned char* param1);
static std::string staticFunction(short param);
}
static void globalFunction()
{
}
typedef Callback<void> FirstCallback;
typedef Callback<bool, int, const unsigned char*> SecondCallback;
typedef Callback<std::string, short> ThirdCallback;
void main()
{
TestClass testClassObject;
FirstCallback firstCallback(testClassObject, &TestClass::firstMemberFunction);
SecondCallback secondCallback(testClassObject, &TestClass::secondMemberFunction);
ThirdCallback thirdCallback(&TestClass::staticFunction);
FirstCallback fourthCallback(&globalFunction);
firstCallback();
bool resultBool = secondCallback(5, "test");
std::string resultString = thirdCallback(3);
fourthCallback();
}