28#ifndef INC_CINOSTASKEXTMPL_H
29#define INC_CINOSTASKEXTMPL_H
39#include <cinoseventlogger.h>
63 const char*
Unit =
"",
92 const char*
Unit =
"",
112 pParam->SetMaxValue((real64)m_Max);
113 pParam->SetMinValue((real64)m_Min);
115 pParam->SetCharacteristics(m_uCharacteristics);
116 pParam->SetFlag(m_uFlags);
117 pParam->SetComboData(m_pComboData);
127 uint32 m_uCharacteristics;
129 const char* m_pComboData;
166 pParam->SetFlag(m_uFlags);
205 pParam->SetComboData(m_pComboData);
206 pParam->SetFlag(m_uFlags);
213 const char* m_pComboData;
245 pParam->SetCharacteristics(m_uCharacteristics);
246 pParam->SetFlag(m_uFlags);
253 uint32 m_uCharacteristics;
314 aTask.RegisterHook(
this);
324template <
typename ObjectType>
765 INOS_ERROR(
"CINOSTaskExCmdBase::CheckParams type mismatch");
840template<
class ObjectType>
984template<
class ObjectType,
typename... ParamType>
1051 virtual void SetDefaults(ParamType...
Default) {
1053 uint32
dummy[
sizeof...(Default)] = {
1059 uint32
dummy[
sizeof...(Default)] = {
1087 if((
params[
uIx]->GetFlag() & CINOSTaskExMsgParam::eFlgStructure) != 0) {
1096 if(this->
m_pTask !=
nullptr && apName !=
nullptr) {
1098 this->
m_pTask->CINOSTaskEx::RegisterCommand(
this);
1101 template<
typename T>
1103 return apMsg->AddParam(
aValue);
1108 return apMsg->AddJsonParam(
pValue);
1111 return apMsg->AddParam(
pValue);
1131template<
class ObjectType,
typename... ParamType>
1323 if(m_pFunction ==
nullptr) {
1341 if(m_pFunctionTmd) {
1371template<
class ObjectType,
typename... ParamType>
1543 if(m_pFunction ==
nullptr) {
1557 if(m_pFunctionTmd) {
1558 (this->
m_pObject->*m_pFunctionTmd)(apMsg);
CINOSTaskEx * ActualTaskEx()
Definition cinostaskex.h:2575
Definition cinosmcmodule.h:1900
Definition cinostaskextmpl.h:435
uint16 m_uKeyLevel
Key level of the INCO registration of this commands.
Definition cinostaskextmpl.h:810
tPreDispatchFunction m_pPreDispatchFunction
Function that is called before messages of this command are dispatched.
Definition cinostaskextmpl.h:796
void OnMsgDone(CINOSTaskExMsg *apMsg, CINOSTaskExDef::ERplId aRplId, tMcAppError aAppError)
Function is called by the module (CINOSTaskEx) when MsgDone is called on a message of this command.
Definition cinostaskextmpl.h:727
void SetName(const char *apName)
Returns the name of this command.
Definition cinostaskextmpl.h:554
void AddParam(const char *apName, const char *apValue, const char *apComboData=nullptr, uint32 auFlags=0)
Adds a string (char*) param description. This function may only be used if the param description has ...
Definition cinostaskextmpl.h:602
CINOSTaskExMsg & GetMsg()
Returns the message of this command.
Definition cinostaskextmpl.h:561
virtual void SetPreDispatcher(const CINOSTaskExCmdHookBase *apPreDispatchHook)
Sets the pre dispatch callback which is called before a message is of this command is dispatched.
Definition cinostaskextmpl.h:451
CINOSTaskEx * m_pTask
Task of this command.
Definition cinostaskextmpl.h:793
uint64 m_uIsStructureBitmap
Bitmap that defines if the parameter corresponding to the bit number is a structure.
Definition cinostaskextmpl.h:806
CINOSTaskExMsg * m_pRegisterMsg
Register message for this command (in the task ex for INCO tree)
Definition cinostaskextmpl.h:819
virtual void DispatchTmd(CINOSTaskExMsg *apMsg)=0
Dispatches a timed message if this command. Used by CINOSTaskEx.
uint64 m_uCharacteristics
Characteristics of the INCO registration of this commands.
Definition cinostaskextmpl.h:803
virtual uint32 AddCommand(bool abDeleteOnRemove=false)
Adds this command to the module it belongs to. And makes it therefore callable. This function also ch...
Definition cinostaskextmpl.h:484
virtual uint32 AddCommand(uint64 aChar, uint16 aKeyLevel, bool abRegisterInco=true, bool abDeleteOnRemove=false)
Adds this command to the module it belongs to. And makes it therefore callable. This function also ch...
Definition cinostaskextmpl.h:507
void AddParam(const char *apName, bool abValue, uint32 auFlags=0)
Adds a bool param description. This function may only be used if the param description has not be pro...
Definition cinostaskextmpl.h:620
CINOSTaskExMsg m_CommandMsg
Prototype message for this command.
Definition cinostaskextmpl.h:816
void SetAllowedStates(uint32 auStateBitmap)
Sets the states in which this command is allowed to be called.
Definition cinostaskextmpl.h:633
tOnMsgDoneFunction m_pMsgDoneFunction
Function that is called when MsgDone is called on messages of this command.
Definition cinostaskextmpl.h:799
bool PreDispatch(CINOSTaskExMsg *apMsg)
Function is called by the module (CINOSTaskEx) before the message of this command is dispatched.
Definition cinostaskextmpl.h:706
void AddParam(const char *apName, real64 arValue, real64 arMin, real64 arMax, const char *apUnit="", uint32 auChar=0, uint32 auFlags=0)
Adds a real64 param description. This function may only be used if the param description has not be p...
Definition cinostaskextmpl.h:581
void Claim()
Claims the object of this command. This ensures that in case this command.
Definition cinostaskextmpl.h:657
const char * GetOption() const
Returns the option string of this command.
Definition cinostaskextmpl.h:540
bool(CINOSTaskEx::* tPreDispatchFunction)(CINOSTaskExMsg *apMsg)
Type of pre-dispatch functions. Functions of this type can be used as a callback in SetPreDispatcher.
Definition cinostaskextmpl.h:445
void Release(CINOSTaskExMsg *apMsg=nullptr)
Releases the object of this command. This ensures that in case this command.
Definition cinostaskextmpl.h:667
int operator<(CINOSTaskExCmdBase &aTaskExMsg)
binary tree operators
Definition cinostaskextmpl.h:638
virtual ~CINOSTaskExCmdBase()
Destructor.
Definition cinostaskextmpl.h:648
bool m_bRegisterInco
Defines if this command is registered to the INCO tree if not.
Definition cinostaskextmpl.h:813
virtual void DeleteCommand()
Deletes the object of this command, dispatch if called from.
Definition cinostaskextmpl.h:777
CINOSTaskExMsg * CreateMsg(CINOSSync *apSync=DF_INOS_SYNCHRONOUS)
Create a message of this command. Can be used for manual, customized call.
Definition cinostaskextmpl.h:530
bool CheckParams(size_t count,...)
Checks if thie added parameters match the template definition.
Definition cinostaskextmpl.h:759
const char * GetName()
Returns the name of this command.
Definition cinostaskextmpl.h:547
std::atomic_ulong m_uReferenceCount
Reference count for dynamically created and added objects. If count is 0 the.
Definition cinostaskextmpl.h:829
CINOSTaskExCmdBase(const char *apName, CINOSTaskEx *apTask, uint32 auStateBitmap, const char *apOption, uint64 auCharacteristics, uint16 auKeyLevel, bool abRegisterInco)
Constructor (base constructor is protected, as this class is abstract)
Definition cinostaskextmpl.h:736
void(CINOSTaskEx::* tOnMsgDoneFunction)(CINOSTaskExMsg *apMsg, CINOSTaskExDef::ERplId aRplId, tMcAppError aAppError)
Type of OnMsgDone functions. Functions of this type can be used as a callback in SetOnMsgDone.
Definition cinostaskextmpl.h:465
virtual void SetOnMsgDone(const CINOSTaskExCmdHookBase *apOnMsgDoneHook)
Sets the OnMsgDone callback which is called when MsgDone is called on a message of this command.
Definition cinostaskextmpl.h:472
virtual void Dispatch(CINOSTaskExMsg *apMsg)=0
Dispatches a message if this command. Used by CINOSTaskEx.
const char * m_pOption
Option(s) of the module which are required for this command to be added.
Definition cinostaskextmpl.h:825
uint32 m_uAllowedStates
Bitmap of states in which this command is allowed to be called.
Definition cinostaskextmpl.h:822
Definition cinostaskextmpl.h:262
virtual tOnMsgDoneFunctionBase GetOnMsgDoneFunction() const =0
Returns the on-msg-done hook function if it is set and if the task calling it is of the same type or ...
int operator<(CINOSTaskExCmdHookBase &aHook)
binary tree operators
Definition cinostaskextmpl.h:285
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.
Definition cinostaskextmpl.h:277
virtual ~CINOSTaskExCmdHookBase()
virtual destructor to avoid compiler warning
Definition cinostaskextmpl.h:307
virtual tPreDispatchFunctionBase GetPreDispatchFunction() const =0
Returns the pre-dispatch hook function if it is set and if the task calling it is of the same type or...
const char * GetName() const
Returns the name of the hook.
Definition cinostaskextmpl.h:280
CINOSTaskExCmdHookBase(const char *apName, CINOSTaskEx &aTask)
Constructor (base constructor is protected, as this class is abstract)
Definition cinostaskextmpl.h:312
bool(CINOSTaskEx::* tPreDispatchFunctionBase)(CINOSTaskExMsg *apMsg)
Base type of pre-dispatch functions. Functions of this type can be used as a callback in SetPreDispat...
Definition cinostaskextmpl.h:268
Definition cinostaskexdef.h:70
Definition cinostaskexdef.h:610
Definition cinostaskexdef.h:129
uint32 SetTypedValue(T aValue)
SetTypedValue.
Definition cinostaskexdef.h:202
Definition cinostaskex.h:396
void FstParam()
reset internal pointer to first param
Definition cinostaskex.h:412
uint32 GetFlags()
get flags
Definition cinostaskex.h:636
char * GetName(bool abResolveIfEmpty=false)
CINOSTaskExMsgDefaultParam * AddDefaultParam(const char *apName, T aValue)
add default param
Definition cinostaskex.h:2454
void SetName(const char *apName)
set name
Definition cinostaskex.h:715
uint32 GetParamCnt() const
get number of param's
Definition cinostaskex.h:448
Definition cinostaskex.h:966
virtual CMcResult PutMsg(CINOSTaskExMsg *apMsg, tMsgId aMsgId=0)
put message to queue and return command id
virtual void MsgError(CINOSTaskExMsg *apMsg, tMcAppError aAppError)
message error
virtual void AddCommand(const char *apName, uint32 auCode, CINCOProcedure *apProc)
add inco command
virtual void MsgDone(tMsgId aMsgId, tMcAppError aAppError=0)
message done (used for deferred messages)
Abstract template base class for all TINOSTaskExCmd variants.
Definition cinostaskextmpl.h:986
virtual uint32 AddCommand(bool abDeleteOnRemove=false) override
Adds this command to the module it belongs to. And makes it therefore callable. This function also ch...
Definition cinostaskextmpl.h:1024
ObjectType * m_pObject
Object of this command.
Definition cinostaskextmpl.h:1116
virtual uint32 AddCommand(uint64 aChar, uint16 aKeyLevel, bool abRegisterInco=true, bool abDeleteOnRemove=false) override
Adds this command to the module it belongs to. And makes it therefore callable. This function also ch...
Definition cinostaskextmpl.h:1039
virtual ~TINOSTaskExCmdBaseParam()
Destructor.
Definition cinostaskextmpl.h:1066
CMcResult operator()(ParamType... Params, CINOSSync *apSync=DF_INOS_SYNCHRONOUS)
Calls this command (dispatched). This function creates and puts a message of this command to the task...
Definition cinostaskextmpl.h:994
TINOSTaskExCmdBaseParam(const char *apName, CINOSTaskEx *apTask, ObjectType *apObject, TINOSTaskExValDef< ParamType >... apDefaultParams, uint32 auStateBitmap, const char *apOption, uint64 auCharacteristics, uint16 auKeyLevel, bool abRegisterInco)
Constructor (base constructor is protected, as this class is abstract)
Definition cinostaskextmpl.h:1071
Class for dynamically created commands. As dynamic (programmatically) created code can not instantiat...
Definition cinostaskextmpl.h:842
void(ObjectType::* tCommandFunction)(CINOSTaskExMsg *apMsg)
Type of functions of this command. Functions of this type must be used in the constructor of this com...
Definition cinostaskextmpl.h:848
ObjectType * m_pObject
Object of this command.
Definition cinostaskextmpl.h:963
CMcResult operator()(ParamType... Params, CINOSSync *apSync=DF_INOS_SYNCHRONOUS)
Calls this command (dispatched). This function creates and puts a message of this command to the task...
Definition cinostaskextmpl.h:857
virtual void DispatchTmd(CINOSTaskExMsg *apMsg) override
Dispatches a timed message if this command. Used by CINOSTaskEx.
Definition cinostaskextmpl.h:956
virtual ~TINOSTaskExCmdDyn()
Destructor.
Definition cinostaskextmpl.h:926
virtual void Dispatch(CINOSTaskExMsg *apMsg) override
Dispatches a message if this command. Used by CINOSTaskEx.
Definition cinostaskextmpl.h:933
Definition cinostaskextmpl.h:325
TINOSTaskExCmdHook(const char *apName, ObjectType &aTask, tPreDispatchFunction apPreDispatchFunction=nullptr, tOnMsgDoneFunction apMsgDoneFunction=nullptr)
Constructor.
Definition cinostaskextmpl.h:375
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 ...
Definition cinostaskextmpl.h:402
virtual ~TINOSTaskExCmdHook()
virtual destructor to avoid compiler warning
Definition cinostaskextmpl.h:410
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...
Definition cinostaskextmpl.h:391
bool(ObjectType::* tPreDispatchFunction)(CINOSTaskExMsg *apMsg)
Definition cinostaskextmpl.h:331
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.
Definition cinostaskextmpl.h:340
Template class that can be used for methods that take the command message as function argument.
Definition cinostaskextmpl.h:1373
virtual void Dispatch(CINOSTaskExMsg *apMsg) override
Dispatches a message if this command. Used by CINOSTaskEx.
Definition cinostaskextmpl.h:1533
void(ObjectType::* tCommandFunction)(CINOSTaskExMsg *apMsg)
Type of functions of this command. Functions of this type must be used in the constructor of this com...
Definition cinostaskextmpl.h:1379
virtual ~TINOSTaskExCmdMsg()
Destructor.
Definition cinostaskextmpl.h:1525
virtual void DispatchTmd(CINOSTaskExMsg *apMsg) override
Dispatches a timed message if this command. Used by CINOSTaskEx.
Definition cinostaskextmpl.h:1556
TINOSTaskExCmdMsg(const char *apName, tCommandFunction apFunction, tCommandFunction apFunctionTmd, ObjectType &aObject, TINOSTaskExValDef< ParamType >... apDefaultParams, uint32 auStateBitmap=0xFFFFFFFF, const char *apOption=nullptr, uint64 auCharacteristics=0, uint16 auKeyLevel=cKeyLevelMin, bool abRegisterInco=true)
Constructor. This variant takes the parameter definitions and INCO item properties....
Definition cinostaskextmpl.h:1441
TINOSTaskExCmdMsg(const char *apName, CINOSTaskEx *apTask, ObjectType *apObject, tCommandFunction apFunction, tCommandFunction apFunctionTmd, TINOSTaskExValDef< ParamType >... apDefaultParams, uint32 auStateBitmap=0xFFFFFFFF, const char *apOption=nullptr, uint64 auCharacteristics=0, uint16 auKeyLevel=cKeyLevelMin, bool abRegisterInco=true)
Constructor. This variant takes a separate object pointer and task pointer the command is only added ...
Definition cinostaskextmpl.h:1506
Template class that can be used for methods that take the command parameters as function arguments.
Definition cinostaskextmpl.h:1133
TINOSTaskExCmd(const char *apName, CINOSTaskEx *apTask, ObjectType *apObject, tCommandFunction apFunction, tCommandFunction apFunctionTmd, TINOSTaskExValDef< ParamType >... apParamDefinitions, uint32 auStateBitmap=0xFFFFFFFF, const char *apOption=nullptr, uint64 auCharacteristics=0, uint16 auKeyLevel=cKeyLevelMin, bool abRegisterInco=true)
Constructor. This variant takes a separate object pointer and task pointer the command is only added ...
Definition cinostaskextmpl.h:1282
TINOSTaskExCmd(const char *apName, tCommandFunction apFunction, tCommandFunction apFunctionTmd, ObjectType &aObject, TINOSTaskExValDef< ParamType >... apParamDefinitions, uint32 auStateBitmap=0xFFFFFFFF, const char *apOption=nullptr, uint64 auCharacteristics=0, uint16 auKeyLevel=cKeyLevelMin, bool abRegisterInco=true)
Constructor. This variant takes the parameter definitions and INCO item properties....
Definition cinostaskextmpl.h:1205
virtual void Dispatch(CINOSTaskExMsg *apMsg)
Dispatches a message if this command. Used by CINOSTaskEx.
Definition cinostaskextmpl.h:1313
virtual void DispatchTmd(CINOSTaskExMsg *apMsg)
Dispatches a timed message if this command. Used by CINOSTaskEx.
Definition cinostaskextmpl.h:1340
virtual ~TINOSTaskExCmd()
Destructor.
Definition cinostaskextmpl.h:1307
void(ObjectType::* tCommandFunction)(ParamType... Params)
Type of functions of this command. Functions of this type must be used in the constructor of this com...
Definition cinostaskextmpl.h:1139
CINOSTaskExMsgDefaultParam * AddToMsg(CINOSTaskExMsg &aMsg)
Creates a parameter definition object with combo data used by TINOSTaskExCmd templates.
Definition cinostaskextmpl.h:164
TINOSTaskExValDef(const char *Name, T *Value, uint32 Flags=0)
Creates a parameter definition object used by TINOSTaskExCmd templates.
Definition cinostaskextmpl.h:144
CINOSTaskExMsgDefaultParam * AddToMsg(CINOSTaskExMsg &aMsg)
Adds a CINOSTaskExMsgDefaultParam that represent this definition to given message....
Definition cinostaskextmpl.h:243
TINOSTaskExValDef(const char *Name, bool Value, uint32 Characteristics=0, uint32 Flags=0)
Creates a parameter definition object used by TINOSTaskExCmd templates.
Definition cinostaskextmpl.h:230
CINOSTaskExMsgDefaultParam * AddToMsg(CINOSTaskExMsg &aMsg)
Adds a CINOSTaskExMsgDefaultParam that represent this definition to given message....
Definition cinostaskextmpl.h:203
TINOSTaskExValDef(const char *Name, const char *Default, const char *ComboData=nullptr, uint32 Flags=0)
Creates a parameter definition object used by TINOSTaskExCmd templates.
Definition cinostaskextmpl.h:190
Definition cinostaskextmpl.h:48
TINOSTaskExValDef(const char *Name, const char *ComboData, T Value, T Min, T Max, const char *Unit="", uint32 Characteristics=0, uint32 Flags=0)
Creates a parameter definition object with combo data used by TINOSTaskExCmd templates.
Definition cinostaskextmpl.h:87
CINOSTaskExMsgDefaultParam * AddToMsg(CINOSTaskExMsg &aMsg)
Adds a CINOSTaskExMsgDefaultParam that represent this definition to given message....
Definition cinostaskextmpl.h:110
TINOSTaskExValDef(const char *Name, T Value, T Min, T Max, const char *Unit="", uint32 Characteristics=0, uint32 Flags=0)
Creates a parameter definition object used by TINOSTaskExCmd templates.
Definition cinostaskextmpl.h:59
uint32 INOS_MCMSG_CODE_TSKEX_CMD_NO_FUNCTION
Definition inoserror.h:1677
uint32 INOS_MCMSG_CODE_TSKEX_CMD_NO_OBJECT
Definition inoserror.h:1677
uint32 INOS_MCMSG_CODE_TSKEX_CMD_NO_TASK
Definition inoserror.h:1677
uint32 INOS_MCMSG_CODE_TSKEX_WRONG_PARAMS
Definition inoserror.h:1677
#define DF_INOS_ASYNCHRONOUS
Definition inosmacro.h:337
#define DF_INOS_SYNCHRONOUS
Definition inosmacro.h:332
Definition cinostaskextmpl.h:1299