|
INOS
|

Public Types | |
| typedef bool(ObjectType::* | tPreDispatchFunction) (CINOSTaskExMsg *apMsg) |
| typedef void(ObjectType::* | tOnMsgDoneFunction) (CINOSTaskExMsg *apMsg, CINOSTaskExDef::ERplId aRplId, tMcAppError aAppError) |
| Type of OnMsgDone functions. Functions of this type can be used as a callback in SetOnMsgDone. More... | |
Public Types inherited from CINOSTaskExCmdHookBase | |
| typedef bool(CINOSTaskEx::* | tPreDispatchFunctionBase) (CINOSTaskExMsg *apMsg) |
| Base type of pre-dispatch functions. Functions of this type can be used as a callback in SetPreDispatcher. More... | |
| typedef void(CINOSTaskEx::* | tOnMsgDoneFunctionBase) (CINOSTaskExMsg *apMsg, CINOSTaskExDef::ERplId aRplId, tMcAppError aAppError) |
| Base type of OnMsgDone functions. Functions of this type can be used as a callback in SetOnMsgDone. More... | |
Public Member Functions | |
| TINOSTaskExCmdHook (const char *apName, ObjectType &aTask, tPreDispatchFunction apPreDispatchFunction=nullptr, tOnMsgDoneFunction apMsgDoneFunction=nullptr) | |
| Constructor. More... | |
| virtual tPreDispatchFunctionBase | GetPreDispatchFunction () const override |
| Returns the pre-dispatch hook function if it is set and if the task calling it is of the same type or inherited type of the hook task type. Returns nullptr otherwise. | |
| virtual tOnMsgDoneFunctionBase | GetOnMsgDoneFunction () const override |
| Returns the on-msg-done hook function if it is set and if the task calling it is of the same type or inherited type of the hook task type. Returns nullptr otherwise. | |
| virtual | ~TINOSTaskExCmdHook () |
| virtual destructor to avoid compiler warning | |
Public Member Functions inherited from CINOSTaskExCmdHookBase | |
| const char * | GetName () const |
| Returns the name of the hook. | |
| int | operator< (CINOSTaskExCmdHookBase &aHook) |
| binary tree operators | |
| int | operator== (CINOSTaskExCmdHookBase &aHook) |
| int | operator< (const char *aName) |
| int | operator== (const char *aName) |
| virtual | ~CINOSTaskExCmdHookBase () |
| virtual destructor to avoid compiler warning | |
Additional Inherited Members | |
Protected Member Functions inherited from CINOSTaskExCmdHookBase | |
| CINOSTaskExCmdHookBase (const char *apName, CINOSTaskEx &aTask) | |
| Constructor (base constructor is protected, as this class is abstract) | |
| typedef void(ObjectType::* TINOSTaskExCmdHook< ObjectType >::tOnMsgDoneFunction) (CINOSTaskExMsg *apMsg, CINOSTaskExDef::ERplId aRplId, tMcAppError aAppError) |
Type of OnMsgDone functions. Functions of this type can be used as a callback in SetOnMsgDone.
| apMsg | CINOSTaskExMsg* the message that MsgDone was called on. |
| apMsg | aRplId CINOSTaskExDef::ERplId reply id provided to MsgDone. |
| apMsg | aAppError tMcAppError error code provided to MsgDone. |
| typedef bool(ObjectType::* TINOSTaskExCmdHook< ObjectType >::tPreDispatchFunction) (CINOSTaskExMsg *apMsg) |
\briefType of pre-dispatch functions. Functions of this type can be used as a callback in SetPreDispatcher.
| apMsg | CINOSTaskExMsg* the message that is about to be dispatched. |
|
inline |
Constructor.
| apName | const char* name of the command hook. |
| aTask | ObjectType the CINOSTaskEx to which this hook will be registered for. |
| apPreDispatchFunction | tPreDispatchFunction main function of this command. This function is called when the message of this command is dispatched. |
| apMsgDoneFunction | tOnMsgDoneFunction timed function of this command will be called immediately when this command msg is put into the queue even if the msg has a trigger. |
This construction is intended to be used directly in the header file. Since C++11 direct member initialization in the header file is supported. To avoid defining the type of the command and parameter twice, list initialization (using curly brackets without =) should be used.
Example: Lets assume the are internal functions void CEXPModule::MyPreDispatcher(CINOSTaskExMsg* apMsg) void CEXPModule::MyOnMsgDone(CINOSTaskExMsg* apMsg, CINOSTaskExDef::ERplId aRplId, tMcAppError aAppError)
You can then register this function as hook for commands with the following statement in the header.
TINOSTaskExCmdHook<CEXPModule> MyHook { "MyHook", *this, &CEXPModule::MyPreDispatcher, &CEXPModule::MyOnMsgDone };
It is possible to only register one of the two functions by passing a nullptr for the other.