aqhome-react: make more functions virtual.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#endif
|
||||
|
||||
#include "./aqhome_react_p.h"
|
||||
#include "aqhome-react/units/u_or.h"
|
||||
#include "aqhome-react/units/u_logical.h"
|
||||
#include "aqhome-react/units/u_valuefilter.h"
|
||||
#include "aqhome-react/units/u_valueset.h"
|
||||
#include "aqhome-react/units/u_stabilize.h"
|
||||
@@ -193,6 +193,10 @@ AQHREACT_UNIT *AqHomeReact_CreateUnitByName(AQHOME_REACT *aqh, const char *unitT
|
||||
if (aqh && unitType && *unitType) {
|
||||
if (strcasecmp(unitType, "or")==0)
|
||||
return AqHomeReact_UnitOr_new(aqh);
|
||||
else if (strcasecmp(unitType, "and")==0)
|
||||
return AqHomeReact_UnitAnd_new(aqh);
|
||||
else if (strcasecmp(unitType, "xor")==0)
|
||||
return AqHomeReact_UnitXor_new(aqh);
|
||||
else if (strcasecmp(unitType, "valueFilter")==0)
|
||||
return AqHomeReact_UnitValueFilter_new(aqh);
|
||||
else if (strcasecmp(unitType, "valueSet")==0)
|
||||
|
||||
@@ -221,7 +221,11 @@ void AQHREACT_Unit_AddParam(AQHREACT_UNIT *unit, AQHREACT_PARAM *param)
|
||||
|
||||
AQHREACT_PARAM *AQHREACT_Unit_GetParamByName(const AQHREACT_UNIT *unit, const char *paramName)
|
||||
{
|
||||
if (unit && unit->paramList && paramName && *paramName) {
|
||||
if (unit) {
|
||||
if (unit->getParamByNameFn)
|
||||
return unit->getParamByNameFn(unit, paramName);
|
||||
else {
|
||||
if (unit->paramList && paramName && *paramName) {
|
||||
AQHREACT_PARAM *param;
|
||||
|
||||
param=AQHREACT_Param_List_First(unit->paramList);
|
||||
@@ -234,6 +238,8 @@ AQHREACT_PARAM *AQHREACT_Unit_GetParamByName(const AQHREACT_UNIT *unit, const ch
|
||||
param=AQHREACT_Param_List_Next(param);
|
||||
}
|
||||
}
|
||||
} /* else */
|
||||
} /* if (unit) */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -335,6 +341,34 @@ AQHREACT_UNIT_INPUTDATA_FN AQHREACT_Unit_SetInputDataFn(AQHREACT_UNIT *unit, AQH
|
||||
|
||||
|
||||
|
||||
AQHREACT_UNIT_OUTPUTDATA_FN AQHREACT_Unit_SetOutputDataFn(AQHREACT_UNIT *unit, AQHREACT_UNIT_OUTPUTDATA_FN f)
|
||||
{
|
||||
if (unit) {
|
||||
AQHREACT_UNIT_OUTPUTDATA_FN oldFn;
|
||||
|
||||
oldFn=unit->outputDataFn;
|
||||
unit->outputDataFn=f;
|
||||
return oldFn;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
AQHREACT_UNIT_GETPARAMBYNAME_FN AQHREACT_Unit_SetGetParamByNameFn(AQHREACT_UNIT *unit, AQHREACT_UNIT_GETPARAMBYNAME_FN f)
|
||||
{
|
||||
if (unit) {
|
||||
AQHREACT_UNIT_GETPARAMBYNAME_FN oldFn;
|
||||
|
||||
oldFn=unit->getParamByNameFn;
|
||||
unit->getParamByNameFn=f;
|
||||
return oldFn;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
AQHREACT_UNIT_PROCESS_FN AQHREACT_Unit_SetProcessFn(AQHREACT_UNIT *unit, AQHREACT_UNIT_PROCESS_FN f)
|
||||
{
|
||||
if (unit) {
|
||||
@@ -351,7 +385,11 @@ AQHREACT_UNIT_PROCESS_FN AQHREACT_Unit_SetProcessFn(AQHREACT_UNIT *unit, AQHREAC
|
||||
|
||||
void AQHREACT_Unit_OutputData(AQHREACT_UNIT *unit, int slotIdForUnit, const AQHREACT_DATAOBJECT *dataObject)
|
||||
{
|
||||
if (unit && unit->outputSlotList) {
|
||||
if (unit) {
|
||||
if (unit->outputDataFn)
|
||||
(unit->outputDataFn)(unit, slotIdForUnit, dataObject);
|
||||
else {
|
||||
if (unit->outputSlotList) {
|
||||
AQHREACT_OUTPUT_SLOT *slot;
|
||||
|
||||
slot=AQHREACT_Unit_GetOutputSlotByIdForUnit(unit, slotIdForUnit);
|
||||
@@ -379,6 +417,8 @@ void AQHREACT_Unit_OutputData(AQHREACT_UNIT *unit, int slotIdForUnit, const AQHR
|
||||
} /* while */
|
||||
} /* if linkList */
|
||||
} /* if slot */
|
||||
} /* if output slot list */
|
||||
} /* else */
|
||||
} /* if unit */
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ GWEN_INHERIT_FUNCTION_DEFS(AQHREACT_UNIT)
|
||||
|
||||
|
||||
typedef void (*AQHREACT_UNIT_INPUTDATA_FN)(AQHREACT_UNIT *unit, int slotIdForUnit, const AQHREACT_DATAOBJECT *dataObject);
|
||||
typedef void (*AQHREACT_UNIT_OUTPUTDATA_FN)(AQHREACT_UNIT *unit, int slotIdForUnit, const AQHREACT_DATAOBJECT *dataObject);
|
||||
typedef AQHREACT_PARAM* (*AQHREACT_UNIT_GETPARAMBYNAME_FN)(const AQHREACT_UNIT *unit, const char *paramName);
|
||||
typedef int (*AQHREACT_UNIT_PROCESS_FN)(AQHREACT_UNIT *unit);
|
||||
|
||||
|
||||
@@ -87,9 +89,9 @@ void AQHREACT_Unit_SetParamValueDouble(AQHREACT_UNIT *unit, const char *paramNam
|
||||
const char *AQHREACT_Unit_GetParamValueString(const AQHREACT_UNIT *unit, const char *paramName, const char *defVal);
|
||||
void AQHREACT_Unit_SetParamValueString(AQHREACT_UNIT *unit, const char *paramName, const char *val);
|
||||
|
||||
void AQHREACT_Unit_OutputData(AQHREACT_UNIT *unit, int slotIndex, const AQHREACT_DATAOBJECT *dataObject);
|
||||
void AQHREACT_Unit_OutputDoubleData(AQHREACT_UNIT *unit, int slotIndex, double data);
|
||||
void AQHREACT_Unit_OutputStringData(AQHREACT_UNIT *unit, int slotIndex, const char *data);
|
||||
void AQHREACT_Unit_OutputData(AQHREACT_UNIT *unit, int slotIdForUnit, const AQHREACT_DATAOBJECT *dataObject);
|
||||
void AQHREACT_Unit_OutputDoubleData(AQHREACT_UNIT *unit, int slotIdForUnit, double data);
|
||||
void AQHREACT_Unit_OutputStringData(AQHREACT_UNIT *unit, int slotIdForUnit, const char *data);
|
||||
|
||||
|
||||
void AQHREACT_Unit_InputData(AQHREACT_UNIT *unit, int slotIdForUnit, const AQHREACT_DATAOBJECT *dataObject);
|
||||
@@ -104,6 +106,8 @@ int AQHREACT_Unit_Process(AQHREACT_UNIT *unit);
|
||||
|
||||
|
||||
AQHREACT_UNIT_INPUTDATA_FN AQHREACT_Unit_SetInputDataFn(AQHREACT_UNIT *unit, AQHREACT_UNIT_INPUTDATA_FN f);
|
||||
AQHREACT_UNIT_OUTPUTDATA_FN AQHREACT_Unit_SetOutputDataFn(AQHREACT_UNIT *unit, AQHREACT_UNIT_OUTPUTDATA_FN f);
|
||||
AQHREACT_UNIT_GETPARAMBYNAME_FN AQHREACT_Unit_SetGetParamByNameFn(AQHREACT_UNIT *unit, AQHREACT_UNIT_GETPARAMBYNAME_FN f);
|
||||
AQHREACT_UNIT_PROCESS_FN AQHREACT_Unit_SetProcessFn(AQHREACT_UNIT *unit, AQHREACT_UNIT_PROCESS_FN f);
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ struct AQHREACT_UNIT {
|
||||
AQHREACT_PARAM_LIST *paramList;
|
||||
|
||||
AQHREACT_UNIT_INPUTDATA_FN inputDataFn;
|
||||
AQHREACT_UNIT_OUTPUTDATA_FN outputDataFn;
|
||||
AQHREACT_UNIT_GETPARAMBYNAME_FN getParamByNameFn;
|
||||
AQHREACT_UNIT_PROCESS_FN processFn;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user