INOS
TINOSTaskExCmdHook< ObjectType > Class Template Reference
Inheritance diagram for TINOSTaskExCmdHook< ObjectType >:

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.
 
- 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.
 
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.
 

Public Member Functions

 TINOSTaskExCmdHook (const char *apName, ObjectType &aTask, tPreDispatchFunction apPreDispatchFunction=nullptr, tOnMsgDoneFunction apMsgDoneFunction=nullptr)
 Constructor.
 
virtual tPreDispatchFunctionBase GetPreDispatchFunction () const
 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
 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 charGetName () 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)
 

Member Typedef Documentation

◆ tOnMsgDoneFunction

template<typename ObjectType >
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.

Parameters
apMsgCINOSTaskExMsg* the message that MsgDone was called on.
apMsgaRplId CINOSTaskExDef::ERplId reply id provided to MsgDone.
apMsgaAppError tMcAppError error code provided to MsgDone.

◆ tPreDispatchFunction

template<typename ObjectType >
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.

Parameters
apMsgCINOSTaskExMsg* the message that is about to be dispatched.

Constructor & Destructor Documentation

◆ TINOSTaskExCmdHook()

template<typename ObjectType >
TINOSTaskExCmdHook< ObjectType >::TINOSTaskExCmdHook ( const char apName,
ObjectType aTask,
tPreDispatchFunction  apPreDispatchFunction = nullptr,
tOnMsgDoneFunction  apMsgDoneFunction = nullptr 
)
inline

Constructor.

Parameters
apNameconst char* name of the command hook.
aTaskObjectType the CINOSTaskEx to which this hook will be registered for.
apPreDispatchFunctiontPreDispatchFunction main function of this command. This function is called when the message of this command is dispatched.
apMsgDoneFunctiontOnMsgDoneFunction 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.

Member Function Documentation

◆ GetOnMsgDoneFunction()

template<typename ObjectType >
virtual tOnMsgDoneFunctionBase TINOSTaskExCmdHook< ObjectType >::GetOnMsgDoneFunction ( ) const
inlinevirtual

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.

Implements CINOSTaskExCmdHookBase.

◆ GetPreDispatchFunction()

template<typename ObjectType >
virtual tPreDispatchFunctionBase TINOSTaskExCmdHook< ObjectType >::GetPreDispatchFunction ( ) const
inlinevirtual

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.

Implements CINOSTaskExCmdHookBase.


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