aqhome-react: enable network loading.
This application has now basic functionality.
This commit is contained in:
@@ -188,6 +188,41 @@ void AQHREACT_DataObject_SetStringData(AQHREACT_DATAOBJECT *dataObject, const ch
|
||||
|
||||
|
||||
|
||||
const char *AQHREACT_DataObjectType_toString(int t)
|
||||
{
|
||||
switch(t) {
|
||||
case AQHREACT_DATAOBJECTTYPE_DOUBLE: return "double";
|
||||
case AQHREACT_DATAOBJECTTYPE_STRING: return "string";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQHREACT_DataObject_Dump(const AQHREACT_DATAOBJECT *dataObject, GWEN_BUFFER *buf, int indent)
|
||||
{
|
||||
if (dataObject && buf) {
|
||||
const char *sVarSystemId;
|
||||
|
||||
sVarSystemId=AQHREACT_DataObject_GetSystemValueId(dataObject);
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
|
||||
switch(dataObject->dataType) {
|
||||
case AQHREACT_DATAOBJECTTYPE_DOUBLE:
|
||||
GWEN_Buffer_AppendArgs(buf, "%f (DOUBLE) [%s]\n", AQHREACT_DataObject_GetDoubleData(dataObject), sVarSystemId?sVarSystemId:"");
|
||||
break;
|
||||
case AQHREACT_DATAOBJECTTYPE_STRING:
|
||||
GWEN_Buffer_AppendArgs(buf, "%s (STRING) [%s]\n", AQHREACT_DataObject_GetStringData(dataObject), sVarSystemId?sVarSystemId:"");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -55,6 +55,11 @@ void AQHREACT_DataObject_SetDoubleData(AQHREACT_DATAOBJECT *dataObject, double i
|
||||
const char *AQHREACT_DataObject_GetStringData(const AQHREACT_DATAOBJECT *dataObject);
|
||||
void AQHREACT_DataObject_SetStringData(AQHREACT_DATAOBJECT *dataObject, const char *s);
|
||||
|
||||
void AQHREACT_DataObject_Dump(const AQHREACT_DATAOBJECT *dataObject, GWEN_BUFFER *buf, int indent);
|
||||
|
||||
|
||||
const char *AQHREACT_DataObjectType_toString(int t);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -180,6 +180,52 @@ void AQHREACT_InputSlot_SetCurrentDataObject(AQHREACT_INPUT_SLOT *inSlot, AQHREA
|
||||
|
||||
|
||||
|
||||
void AQHREACT_InputSlot_Dump(const AQHREACT_INPUT_SLOT *inSlot, GWEN_BUFFER *buf, int indent)
|
||||
{
|
||||
if (inSlot && buf) {
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "id................: %d\n", inSlot->idForUnit);
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "name..............: %s\n", (inSlot->name)?(inSlot->name):"<empty>");
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "description.......: %s\n", (inSlot->description)?(inSlot->description):"<empty>");
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "accepted data type: %s\n", AQHREACT_DataObjectType_toString(inSlot->acceptedDataType));
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "flags.............: %08x\n", inSlot->flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQHREACT_InputSlot_List_Dump(const AQHREACT_INPUT_SLOT_LIST *inSlotList, GWEN_BUFFER *buf, int indent, const char *title)
|
||||
{
|
||||
if (inSlotList && buf) {
|
||||
const AQHREACT_INPUT_SLOT *inSlot;
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "%s\n", (title && *title)?title:"Input Slot List:\n");
|
||||
|
||||
inSlot=AQHREACT_InputSlot_List_First(inSlotList);
|
||||
while(inSlot) {
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent+2);
|
||||
GWEN_Buffer_AppendString(buf, "Input Slot:\n");
|
||||
AQHREACT_InputSlot_Dump(inSlot, buf, indent+4);
|
||||
inSlot=AQHREACT_InputSlot_List_Next(inSlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,9 @@ void AQHREACT_InputSlot_SetAcceptedDataType(AQHREACT_INPUT_SLOT *inSlot, int i);
|
||||
AQHREACT_DATAOBJECT *AQHREACT_InputSlot_GetCurrentDataObject(const AQHREACT_INPUT_SLOT *inSlot);
|
||||
void AQHREACT_InputSlot_SetCurrentDataObject(AQHREACT_INPUT_SLOT *inSlot, AQHREACT_DATAOBJECT *dataObject);
|
||||
|
||||
void AQHREACT_InputSlot_Dump(const AQHREACT_INPUT_SLOT *inSlot, GWEN_BUFFER *buf, int indent);
|
||||
void AQHREACT_InputSlot_List_Dump(const AQHREACT_INPUT_SLOT_LIST *inSlotList, GWEN_BUFFER *buf, int indent, const char *title);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -90,4 +90,39 @@ void AQHREACT_Link_SetTargetUnit(AQHREACT_LINK *lnk, AQHREACT_UNIT *unit)
|
||||
|
||||
|
||||
|
||||
void AQHREACT_Link_Dump(const AQHREACT_LINK *lnk, GWEN_BUFFER *buf, int indent)
|
||||
{
|
||||
if (lnk && buf) {
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "target unit id: %s (%s), target slot id: %d\n",
|
||||
(lnk->targetUnitId)?(lnk->targetUnitId):"<empty>",
|
||||
(lnk->targetUnit)?"set":"not set",
|
||||
lnk->targetInputSlotIdForUnit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQHREACT_Link_List_Dump(const AQHREACT_LINK_LIST *lnkList, GWEN_BUFFER *buf, int indent, const char *title)
|
||||
{
|
||||
if (lnkList && buf) {
|
||||
const AQHREACT_LINK *lnk;
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "%s\n", (title && *title)?title:"Link List:\n");
|
||||
|
||||
lnk=AQHREACT_Link_List_First(lnkList);
|
||||
while(lnk) {
|
||||
AQHREACT_Link_Dump(lnk, buf, indent+2);
|
||||
lnk=AQHREACT_Link_List_Next(lnk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ void AQHREACT_Link_SetTargetInputSlotIdForUnit(AQHREACT_LINK *lnk, int i);
|
||||
AQHREACT_UNIT *AQHREACT_Link_GetTargetUnit(const AQHREACT_LINK *lnk);
|
||||
void AQHREACT_Link_SetTargetUnit(AQHREACT_LINK *lnk, AQHREACT_UNIT *unit);
|
||||
|
||||
void AQHREACT_Link_Dump(const AQHREACT_LINK *lnk, GWEN_BUFFER *buf, int indent);
|
||||
void AQHREACT_Link_List_Dump(const AQHREACT_LINK_LIST *lnkList, GWEN_BUFFER *buf, int indent, const char *title);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -157,6 +157,57 @@ void AQHREACT_OutputSlot_AddLink(AQHREACT_OUTPUT_SLOT *outSlot, AQHREACT_LINK *l
|
||||
|
||||
|
||||
|
||||
void AQHREACT_OutputSlot_Dump(const AQHREACT_OUTPUT_SLOT *outSlot, GWEN_BUFFER *buf, int indent)
|
||||
{
|
||||
if (outSlot && buf) {
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "id...............: %d (%d)\n", outSlot->id, outSlot->idForUnit);
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "name.............: %s\n", (outSlot->name)?(outSlot->name):"<empty>");
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "description......: %s\n", (outSlot->description)?(outSlot->description):"<empty>");
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "emitted data type: %s\n", AQHREACT_DataObjectType_toString(outSlot->emittedDataType));
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "flags............: %08x\n", outSlot->flags);
|
||||
|
||||
AQHREACT_Link_List_Dump(outSlot->linkList, buf, indent, "Link List:");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQHREACT_OutputSlot_List_Dump(const AQHREACT_OUTPUT_SLOT_LIST *outSlotList, GWEN_BUFFER *buf, int indent, const char *title)
|
||||
{
|
||||
if (outSlotList && buf) {
|
||||
const AQHREACT_OUTPUT_SLOT *outSlot;
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "%s\n", (title && *title)?title:"Output Slot List:\n");
|
||||
|
||||
outSlot=AQHREACT_OutputSlot_List_First(outSlotList);
|
||||
while(outSlot) {
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent+2);
|
||||
GWEN_Buffer_AppendString(buf, "Output Slot:\n");
|
||||
AQHREACT_OutputSlot_Dump(outSlot, buf, indent+4);
|
||||
outSlot=AQHREACT_OutputSlot_List_Next(outSlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,9 @@ void AQHREACT_OutputSlot_SetEmittedDataType(AQHREACT_OUTPUT_SLOT *outSlot, int i
|
||||
AQHREACT_LINK_LIST *AQHREACT_OutputSlot_GetLinkList(const AQHREACT_OUTPUT_SLOT *outSlot);
|
||||
void AQHREACT_OutputSlot_AddLink(AQHREACT_OUTPUT_SLOT *outSlot, AQHREACT_LINK *lnk);
|
||||
|
||||
void AQHREACT_OutputSlot_Dump(const AQHREACT_OUTPUT_SLOT *outSlot, GWEN_BUFFER *buf, int indent);
|
||||
void AQHREACT_OutputSlot_List_Dump(const AQHREACT_OUTPUT_SLOT_LIST *outSlotList, GWEN_BUFFER *buf, int indent, const char *title);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,12 +14,30 @@
|
||||
#include "./param_p.h"
|
||||
#include "./dataobject.h"
|
||||
|
||||
#include <gwenhywfar/debug.h>
|
||||
#include <gwenhywfar/text.h>
|
||||
|
||||
|
||||
|
||||
GWEN_LIST_FUNCTIONS(AQHREACT_PARAM, AQHREACT_Param)
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* forward declarations
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static void _setDbValueFromParamString(const AQHREACT_PARAM *param, GWEN_DB_NODE *db, uint32_t dbFlags);
|
||||
static void _setDbValueFromParamDouble(const AQHREACT_PARAM *param, GWEN_DB_NODE *db, uint32_t dbFlags);
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* implementations
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
AQHREACT_PARAM *AQHREACT_Param_new()
|
||||
{
|
||||
AQHREACT_PARAM *param;
|
||||
@@ -177,6 +195,100 @@ AQHREACT_PARAM *AQHREACT_Param_List_GetParamByName(const AQHREACT_PARAM_LIST *pa
|
||||
|
||||
|
||||
|
||||
int AQHREACT_Param_List_WriteIntoDb(const AQHREACT_PARAM_LIST *paramList, GWEN_DB_NODE *db, uint32_t dbFlags)
|
||||
{
|
||||
if (paramList && db) {
|
||||
const AQHREACT_PARAM *param;
|
||||
|
||||
param=AQHREACT_Param_List_First(paramList);
|
||||
while(param) {
|
||||
if (param->name) {
|
||||
switch(param->dataType) {
|
||||
case AQHREACT_DATAOBJECTTYPE_STRING:
|
||||
_setDbValueFromParamString(param, db, dbFlags);
|
||||
break;
|
||||
case AQHREACT_DATAOBJECTTYPE_DOUBLE:
|
||||
_setDbValueFromParamDouble(param, db, dbFlags);
|
||||
break;
|
||||
default:
|
||||
DBG_ERROR(NULL, "Unhandled param type %d", param->dataType);
|
||||
return GWEN_ERROR_GENERIC;
|
||||
}
|
||||
}
|
||||
|
||||
param=AQHREACT_Param_List_Next(param);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _setDbValueFromParamString(const AQHREACT_PARAM *param, GWEN_DB_NODE *db, uint32_t dbFlags)
|
||||
{
|
||||
if (param->stringValue)
|
||||
GWEN_DB_SetCharValue(db, dbFlags, param->name, param->stringValue);
|
||||
else
|
||||
GWEN_DB_DeleteVar(db, param->name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _setDbValueFromParamDouble(const AQHREACT_PARAM *param, GWEN_DB_NODE *db, uint32_t dbFlags)
|
||||
{
|
||||
GWEN_BUFFER *buf;
|
||||
int rv;
|
||||
|
||||
buf=GWEN_Buffer_new(0, 32, 0, 1);
|
||||
rv=GWEN_Text_DoubleToBuffer(param->doubleValue, buf);
|
||||
if (rv<0) {
|
||||
DBG_INFO(NULL, "here (%d)", rv);
|
||||
}
|
||||
else
|
||||
GWEN_DB_SetCharValue(db, dbFlags, param->name, GWEN_Buffer_GetStart(buf));
|
||||
GWEN_Buffer_free(buf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQHREACT_Param_Dump(const AQHREACT_PARAM *param, GWEN_BUFFER *buf, int indent)
|
||||
{
|
||||
if (param && buf) {
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
|
||||
switch(param->dataType) {
|
||||
case AQHREACT_DATAOBJECTTYPE_DOUBLE:
|
||||
GWEN_Buffer_AppendArgs(buf, "%s = %f [DOUBLE]\n", (param->name)?(param->name):"<unnamed>", param->doubleValue);
|
||||
break;
|
||||
case AQHREACT_DATAOBJECTTYPE_STRING:
|
||||
GWEN_Buffer_AppendArgs(buf, "%s = %s [STRING]\n", (param->name)?(param->name):"<unnamed>", param->stringValue);
|
||||
break;
|
||||
default:
|
||||
DBG_ERROR(NULL, "Unhandled data type %d", param->dataType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQHREACT_Param_List_Dump(const AQHREACT_PARAM_LIST *paramList, GWEN_BUFFER *buf, int indent, const char *title)
|
||||
{
|
||||
if (paramList && buf) {
|
||||
const AQHREACT_PARAM *param;
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "%s\n", (title && *title)?title:"Parameter List:\n");
|
||||
|
||||
param=AQHREACT_Param_List_First(paramList);
|
||||
while(param) {
|
||||
AQHREACT_Param_Dump(param, buf, indent+2);
|
||||
param=AQHREACT_Param_List_Next(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#define AQHOME_REACT_PARAM_H
|
||||
|
||||
#include <gwenhywfar/list.h>
|
||||
#include <gwenhywfar/db.h>
|
||||
|
||||
|
||||
typedef struct AQHREACT_PARAM AQHREACT_PARAM;
|
||||
@@ -44,6 +45,11 @@ void AQHREACT_Param_SubFlags(AQHREACT_PARAM *param, uint32_t f);
|
||||
|
||||
AQHREACT_PARAM *AQHREACT_Param_List_GetParamByName(const AQHREACT_PARAM_LIST *paramList, const char *paramName);
|
||||
|
||||
int AQHREACT_Param_List_WriteIntoDb(const AQHREACT_PARAM_LIST *paramList, GWEN_DB_NODE *db, uint32_t dbFlags);
|
||||
|
||||
void AQHREACT_Param_Dump(const AQHREACT_PARAM *param, GWEN_BUFFER *buf, int indent);
|
||||
void AQHREACT_Param_List_Dump(const AQHREACT_PARAM_LIST *paramList, GWEN_BUFFER *buf, int indent, const char *title);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -55,6 +55,13 @@ void AQHREACT_Unit_free(AQHREACT_UNIT *unit)
|
||||
|
||||
|
||||
|
||||
AQHOME_REACT *AQHREACT_Unit_GetAqHomeReact(const AQHREACT_UNIT *unit)
|
||||
{
|
||||
return unit?unit->aqHomeReact:NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *AQHREACT_Unit_GetName(const AQHREACT_UNIT *unit)
|
||||
{
|
||||
return unit?unit->name:NULL;
|
||||
@@ -362,8 +369,12 @@ void AQHREACT_Unit_OutputData(AQHREACT_UNIT *unit, int slotIdForUnit, const AQHR
|
||||
|
||||
targetUnit=AQHREACT_Link_GetTargetUnit(lnk);
|
||||
targetSlotIdForUnit=AQHREACT_Link_GetTargetInputSlotIdForUnit(lnk);
|
||||
if (targetUnit && targetSlotIdForUnit>=0)
|
||||
if (targetUnit && targetSlotIdForUnit>=0) {
|
||||
DBG_DEBUG(NULL, "%s: Sending data to %s:%d",
|
||||
AQHREACT_Unit_GetId(unit),
|
||||
AQHREACT_Link_GetTargetUnitId(lnk), AQHREACT_Link_GetTargetInputSlotIdForUnit(lnk));
|
||||
AQHREACT_Unit_InputData(targetUnit, targetSlotIdForUnit, dataObject);
|
||||
}
|
||||
lnk=AQHREACT_Link_List_Next(lnk);
|
||||
} /* while */
|
||||
} /* if linkList */
|
||||
@@ -409,7 +420,18 @@ void AQHREACT_Unit_InputData(AQHREACT_UNIT *unit, int slotIdForUnit, const AQHRE
|
||||
if (unit->inputDataFn)
|
||||
(unit->inputDataFn)(unit, slotIdForUnit, dataObject);
|
||||
else {
|
||||
AQHREACT_Unit_ClearChangeFlagsInUnitAndInputSlots(unit);
|
||||
if (dataObject) {
|
||||
AQHREACT_INPUT_SLOT *inSlot;
|
||||
|
||||
inSlot=AQHREACT_Unit_GetInputSlotByIdForUnit(unit, slotIdForUnit);
|
||||
if (inSlot) {
|
||||
if (AQHREACT_DataObject_GetDataType(dataObject)==AQHREACT_InputSlot_GetAcceptedDataType(inSlot)) {
|
||||
AQHREACT_InputSlot_SetCurrentDataObject(inSlot, AQHREACT_DataObject_dup(dataObject));
|
||||
AQHREACT_InputSlot_AddFlags(inSlot, AQHREACT_UNIT_FLAGS_CHANGED);
|
||||
AQHREACT_Unit_AddFlags(unit, AQHREACT_UNIT_FLAGS_CHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -603,6 +625,57 @@ AQHREACT_UNIT *AQHREACT_Unit_List_GetById(const AQHREACT_UNIT_LIST *unitList, co
|
||||
|
||||
|
||||
|
||||
void AQHREACT_Unit_Dump(const AQHREACT_UNIT *unit, GWEN_BUFFER *buf, int indent)
|
||||
{
|
||||
if (unit && buf) {
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "id.........: %s\n", (unit->id)?(unit->id):"<empty>");
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "name.......: %s\n", (unit->name)?(unit->name):"<empty>");
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "description: %s\n", (unit->description)?(unit->description):"<empty>");
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "flags......: %08x\n", unit->flags);
|
||||
|
||||
AQHREACT_Param_List_Dump(unit->paramList, buf, indent, "Unit Parameter List:");
|
||||
AQHREACT_InputSlot_List_Dump(unit->inputSlotList, buf, indent, "Input Slot List:");
|
||||
AQHREACT_OutputSlot_List_Dump(unit->outputSlotList, buf, indent, "Output Slot List:");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQHREACT_Unit_List_Dump(const AQHREACT_UNIT_LIST *unitList, GWEN_BUFFER *buf, int indent, const char *title)
|
||||
{
|
||||
if (unitList && buf) {
|
||||
const AQHREACT_UNIT *unit;
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "%s\n", (title && *title)?title:"Unit List:\n");
|
||||
|
||||
unit=AQHREACT_Unit_List_First(unitList);
|
||||
while(unit) {
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent+2);
|
||||
GWEN_Buffer_AppendString(buf, "Unit:\n");
|
||||
AQHREACT_Unit_Dump(unit, buf, indent+4);
|
||||
|
||||
unit=AQHREACT_Unit_List_Next(unit);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -109,6 +109,9 @@ AQHREACT_UNIT_PROCESS_FN AQHREACT_Unit_SetProcessFn(AQHREACT_UNIT *unit, AQHREAC
|
||||
|
||||
AQHREACT_UNIT *AQHREACT_Unit_List_GetById(const AQHREACT_UNIT_LIST *unitList, const char *id);
|
||||
|
||||
void AQHREACT_Unit_Dump(const AQHREACT_UNIT *unit, GWEN_BUFFER *buf, int indent);
|
||||
void AQHREACT_Unit_List_Dump(const AQHREACT_UNIT_LIST *unitList, GWEN_BUFFER *buf, int indent, const char *title);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -142,6 +142,39 @@ AQHREACT_UNIT_NET *AQHREACT_UnitNet_List_GetByName(const AQHREACT_UNIT_NET_LIST
|
||||
|
||||
|
||||
|
||||
void AQHREACT_UnitNet_Dump(const AQHREACT_UNIT_NET *unitNet, GWEN_BUFFER *buf, int indent)
|
||||
{
|
||||
if (unitNet && buf) {
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "Network \"%s\"\n", (unitNet->name)?(unitNet->name):"<no name>");
|
||||
AQHREACT_Param_List_Dump(unitNet->paramList, buf, indent, "Network Parameter List:");
|
||||
AQHREACT_Unit_List_Dump(unitNet->unitList, buf, indent, "Unit List:");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQHREACT_UnitNet_List_Dump(const AQHREACT_UNIT_NET_LIST *unitNetList, GWEN_BUFFER *buf, int indent, const char *title)
|
||||
{
|
||||
if (unitNetList && buf) {
|
||||
const AQHREACT_UNIT_NET *unitNet;
|
||||
|
||||
if (indent)
|
||||
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
|
||||
GWEN_Buffer_AppendArgs(buf, "%s\n", (title && *title)?title:"Unit List:\n");
|
||||
|
||||
unitNet=AQHREACT_UnitNet_List_First(unitNetList);
|
||||
while(unitNet) {
|
||||
AQHREACT_UnitNet_Dump(unitNet, buf, indent+2);
|
||||
unitNet=AQHREACT_UnitNet_List_Next(unitNet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ AQHREACT_PARAM *AQHREACT_UnitNet_GetParamByName(const AQHREACT_UNIT_NET *unitNet
|
||||
|
||||
AQHREACT_UNIT_NET *AQHREACT_UnitNet_List_GetByName(const AQHREACT_UNIT_NET_LIST *unitNetList, const char *name);
|
||||
|
||||
void AQHREACT_UnitNet_Dump(const AQHREACT_UNIT_NET *unitNet, GWEN_BUFFER *buf, int indent);
|
||||
void AQHREACT_UnitNet_List_Dump(const AQHREACT_UNIT_NET_LIST *unitNetList, GWEN_BUFFER *buf, int indent, const char *title);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user