aqhome-react: removed uneeded files.

This commit is contained in:
Martin Preuss
2024-04-17 22:29:28 +02:00
parent f4902d5717
commit 02f02b1ad1
11 changed files with 0 additions and 874 deletions

View File

@@ -15,7 +15,6 @@
typedef struct AQHOME_REACT AQHOME_REACT;
#include "aqhome-react/types/unit.h"
#include "aqhome-react/types/unitnet.h"
AQHOME_REACT *AqHomeReact_new();

View File

@@ -13,7 +13,6 @@
#include "./net_read.h"
#include "aqhome-react/aqhome_react_p.h"
#include "aqhome-react/types/unit.h"
#include "aqhome-react/types/unitnet.h"
#include "aqhome-react/units/u_module.h"
#include "aqhome/aqhome.h"

View File

@@ -1,233 +0,0 @@
/****************************************************************************
* This file is part of the project AqHome.
* AqHome (c) by 2024 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
****************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "./inputslot_p.h"
#include "aqhome-react/types/unit.h"
#include <gwenhywfar/list.h>
#include <gwenhywfar/debug.h>
GWEN_LIST_FUNCTIONS(AQHREACT_INPUT_SLOT, AQHREACT_InputSlot);
AQHREACT_INPUT_SLOT *AQHREACT_InputSlot_new()
{
AQHREACT_INPUT_SLOT *inSlot;
GWEN_NEW_OBJECT(AQHREACT_INPUT_SLOT, inSlot);
GWEN_LIST_INIT(AQHREACT_INPUT_SLOT, inSlot);
inSlot->idForUnit=-1;
return inSlot;
}
void AQHREACT_InputSlot_free(AQHREACT_INPUT_SLOT *inSlot)
{
if (inSlot) {
GWEN_LIST_FINI(AQHREACT_INPUT_SLOT, inSlot);
free(inSlot->name);
free(inSlot->description);
AQHREACT_DataObject_free(inSlot->currentDataObject);
GWEN_FREE_OBJECT(inSlot);
}
}
AQHREACT_INPUT_SLOT *AQHREACT_InputSlot_dup(const AQHREACT_INPUT_SLOT *origSlot)
{
if (origSlot) {
AQHREACT_INPUT_SLOT *inSlot;
inSlot=AQHREACT_InputSlot_new();
AQHREACT_InputSlot_SetName(inSlot, origSlot->name);
AQHREACT_InputSlot_SetDescription(inSlot, origSlot->description);
inSlot->idForUnit=origSlot->idForUnit;
inSlot->flags=origSlot->flags & ~AQHREACT_UNIT_FLAGS_MULTI; /* don't copy MULTI flag */
inSlot->acceptedDataType=origSlot->acceptedDataType;
/* don't copy current dataObject */
return inSlot;
}
return NULL;
}
const char *AQHREACT_InputSlot_GetName(const AQHREACT_INPUT_SLOT *inSlot)
{
return inSlot?inSlot->name:NULL;
}
void AQHREACT_InputSlot_SetName(AQHREACT_INPUT_SLOT *inSlot, const char *s)
{
if (inSlot) {
free(inSlot->name);
inSlot->name=s?strdup(s):NULL;
}
}
const char *AQHREACT_InputSlot_GetDescription(const AQHREACT_INPUT_SLOT *inSlot)
{
return inSlot?inSlot->description:NULL;
}
void AQHREACT_InputSlot_SetDescription(AQHREACT_INPUT_SLOT *inSlot, const char *s)
{
if (inSlot) {
free(inSlot->description);
inSlot->description=s?strdup(s):NULL;
}
}
int AQHREACT_InputSlot_GetIdForUnit(const AQHREACT_INPUT_SLOT *inSlot)
{
return inSlot?inSlot->idForUnit:0;
}
void AQHREACT_InputSlot_SetIdForUnit(AQHREACT_INPUT_SLOT *inSlot, int i)
{
if (inSlot)
inSlot->idForUnit=i;
}
uint32_t AQHREACT_InputSlot_GetFlags(const AQHREACT_INPUT_SLOT *inSlot)
{
return inSlot?inSlot->flags:0;
}
void AQHREACT_InputSlot_SetFlags(AQHREACT_INPUT_SLOT *inSlot, uint32_t i)
{
if (inSlot)
inSlot->flags=i;
}
void AQHREACT_InputSlot_AddFlags(AQHREACT_INPUT_SLOT *inSlot, uint32_t i)
{
if (inSlot)
inSlot->flags|=i;
}
void AQHREACT_InputSlot_SubFlags(AQHREACT_INPUT_SLOT *inSlot, uint32_t i)
{
if (inSlot)
inSlot->flags&=~i;
}
int AQHREACT_InputSlot_GetAcceptedDataType(const AQHREACT_INPUT_SLOT *inSlot)
{
return inSlot?inSlot->acceptedDataType:AQHREACT_DATAOBJECTTYPE_UNKNOWN;
}
void AQHREACT_InputSlot_SetAcceptedDataType(AQHREACT_INPUT_SLOT *inSlot, int i)
{
if (inSlot)
inSlot->acceptedDataType=i;
}
AQHREACT_DATAOBJECT *AQHREACT_InputSlot_GetCurrentDataObject(const AQHREACT_INPUT_SLOT *inSlot)
{
return inSlot?inSlot->currentDataObject:NULL;
}
void AQHREACT_InputSlot_SetCurrentDataObject(AQHREACT_INPUT_SLOT *inSlot, AQHREACT_DATAOBJECT *dataObject)
{
if (inSlot) {
AQHREACT_DataObject_free(inSlot->currentDataObject);
inSlot->currentDataObject=dataObject;
}
}
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);
}
}
}

View File

@@ -1,55 +0,0 @@
/****************************************************************************
* This file is part of the project AqHome.
* AqHome (c) by 2024 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
****************************************************************************/
#ifndef AQHOME_REACT_INPUTSLOT_H
#define AQHOME_REACT_INPUTSLOT_H
#include <gwenhywfar/list.h>
typedef struct AQHREACT_INPUT_SLOT AQHREACT_INPUT_SLOT;
GWEN_LIST_FUNCTION_DEFS(AQHREACT_INPUT_SLOT, AQHREACT_InputSlot)
#include "aqhome-react/aqhome_react.h"
#include "aqhome-react/types/dataobject.h"
AQHREACT_INPUT_SLOT *AQHREACT_InputSlot_new();
AQHREACT_INPUT_SLOT *AQHREACT_InputSlot_dup(const AQHREACT_INPUT_SLOT *origSlot);
void AQHREACT_InputSlot_free(AQHREACT_INPUT_SLOT *inSlot);
const char *AQHREACT_InputSlot_GetName(const AQHREACT_INPUT_SLOT *inSlot);
void AQHREACT_InputSlot_SetName(AQHREACT_INPUT_SLOT *inSlot, const char *s);
const char *AQHREACT_InputSlot_GetDescription(const AQHREACT_INPUT_SLOT *inSlot);
void AQHREACT_InputSlot_SetDescription(AQHREACT_INPUT_SLOT *inSlot, const char *s);
int AQHREACT_InputSlot_GetIdForUnit(const AQHREACT_INPUT_SLOT *inSlot);
void AQHREACT_InputSlot_SetIdForUnit(AQHREACT_INPUT_SLOT *inSlot, int i);
uint32_t AQHREACT_InputSlot_GetFlags(const AQHREACT_INPUT_SLOT *inSlot);
void AQHREACT_InputSlot_SetFlags(AQHREACT_INPUT_SLOT *inSlot, uint32_t i);
void AQHREACT_InputSlot_AddFlags(AQHREACT_INPUT_SLOT *inSlot, uint32_t i);
void AQHREACT_InputSlot_SubFlags(AQHREACT_INPUT_SLOT *inSlot, uint32_t i);
int AQHREACT_InputSlot_GetAcceptedDataType(const AQHREACT_INPUT_SLOT *inSlot);
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);
#endif

View File

@@ -1,29 +0,0 @@
/****************************************************************************
* This file is part of the project AqHome.
* AqHome (c) by 2024 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
****************************************************************************/
#ifndef AQHOME_REACT_INPUTSLOT_P_H
#define AQHOME_REACT_INPUTSLOT_P_H
#include "aqhome-react/types/inputslot.h"
struct AQHREACT_INPUT_SLOT {
GWEN_LIST_ELEMENT(AQHREACT_INPUT_SLOT)
char *name;
char *description;
int idForUnit;
uint32_t flags;
int acceptedDataType;
AQHREACT_DATAOBJECT *currentDataObject;
};
#endif

View File

@@ -1,216 +0,0 @@
/****************************************************************************
* This file is part of the project AqHome.
* AqHome (c) by 2024 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
****************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "./outputslot_p.h"
#include "aqhome-react/types/dataobject.h"
#include <gwenhywfar/debug.h>
GWEN_LIST_FUNCTIONS(AQHREACT_OUTPUT_SLOT, AQHREACT_OutputSlot)
AQHREACT_OUTPUT_SLOT *AQHREACT_OutputSlot_new()
{
AQHREACT_OUTPUT_SLOT *outSlot;
GWEN_NEW_OBJECT(AQHREACT_OUTPUT_SLOT, outSlot);
GWEN_LIST_INIT(AQHREACT_OUTPUT_SLOT, outSlot);
outSlot->linkList=AQHREACT_Link_List_new();
outSlot->id=-1;
return outSlot;
}
void AQHREACT_OutputSlot_free(AQHREACT_OUTPUT_SLOT *outSlot)
{
if (outSlot) {
GWEN_LIST_FINI(AQHREACT_OUTPUT_SLOT, outSlot);
free(outSlot->name);
free(outSlot->description);
AQHREACT_Link_List_free(outSlot->linkList);
GWEN_FREE_OBJECT(outSlot);
}
}
int AQHREACT_OutputSlot_GetIdForUnit(const AQHREACT_OUTPUT_SLOT *outSlot)
{
return outSlot?outSlot->id:-1;
}
void AQHREACT_OutputSlot_SetIdForUnit(AQHREACT_OUTPUT_SLOT *outSlot, int i)
{
if (outSlot)
outSlot->id=i;
}
const char *AQHREACT_OutputSlot_GetName(const AQHREACT_OUTPUT_SLOT *outSlot)
{
return outSlot?outSlot->name:NULL;
}
void AQHREACT_OutputSlot_SetName(AQHREACT_OUTPUT_SLOT *outSlot, const char *s)
{
if (outSlot) {
free(outSlot->name);
outSlot->name=s?strdup(s):NULL;
}
}
const char *AQHREACT_OutputSlot_GetDescription(const AQHREACT_OUTPUT_SLOT *outSlot)
{
return outSlot?outSlot->description:NULL;
}
void AQHREACT_OutputSlot_SetDescription(AQHREACT_OUTPUT_SLOT *outSlot, const char *s)
{
if (outSlot) {
free(outSlot->description);
outSlot->description=s?strdup(s):NULL;
}
}
uint32_t AQHREACT_OutputSlot_GetFlags(const AQHREACT_OUTPUT_SLOT *outSlot)
{
return outSlot?outSlot->flags:0;
}
void AQHREACT_OutputSlot_SetFlags(AQHREACT_OUTPUT_SLOT *outSlot, uint32_t f)
{
if (outSlot)
outSlot->flags=f;
}
void AQHREACT_OutputSlot_AddFlags(AQHREACT_OUTPUT_SLOT *outSlot, uint32_t f)
{
if (outSlot)
outSlot->flags|=f;
}
void AQHREACT_OutputSlot_SubFlags(AQHREACT_OUTPUT_SLOT *outSlot, uint32_t f)
{
if (outSlot)
outSlot->flags&=~f;
}
int AQHREACT_OutputSlot_GetEmittedDataType(const AQHREACT_OUTPUT_SLOT *outSlot)
{
return outSlot?outSlot->emittedDataType:AQHREACT_DATAOBJECTTYPE_UNKNOWN;
}
void AQHREACT_OutputSlot_SetEmittedDataType(AQHREACT_OUTPUT_SLOT *outSlot, int i)
{
if (outSlot)
outSlot->emittedDataType=i;
}
AQHREACT_LINK_LIST *AQHREACT_OutputSlot_GetLinkList(const AQHREACT_OUTPUT_SLOT *outSlot)
{
return outSlot?outSlot->linkList:NULL;
}
void AQHREACT_OutputSlot_AddLink(AQHREACT_OUTPUT_SLOT *outSlot, AQHREACT_LINK *lnk)
{
if (outSlot)
AQHREACT_Link_List_Add(lnk, outSlot->linkList);
}
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);
}
}
}

View File

@@ -1,54 +0,0 @@
/****************************************************************************
* This file is part of the project AqHome.
* AqHome (c) by 2024 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
****************************************************************************/
#ifndef AQHOME_REACT_OUTPUTSLOT_H
#define AQHOME_REACT_OUTPUTSLOT_H
#include <gwenhywfar/list.h>
typedef struct AQHREACT_OUTPUT_SLOT AQHREACT_OUTPUT_SLOT;
GWEN_LIST_FUNCTION_DEFS(AQHREACT_OUTPUT_SLOT, AQHREACT_OutputSlot)
#include "aqhome-react/aqhome_react.h"
#include "aqhome-react/types/link.h"
AQHREACT_OUTPUT_SLOT *AQHREACT_OutputSlot_new();
void AQHREACT_OutputSlot_free(AQHREACT_OUTPUT_SLOT *outSlot);
const char *AQHREACT_OutputSlot_GetName(const AQHREACT_OUTPUT_SLOT *outSlot);
void AQHREACT_OutputSlot_SetName(AQHREACT_OUTPUT_SLOT *outSlot, const char *s);
const char *AQHREACT_OutputSlot_GetDescription(const AQHREACT_OUTPUT_SLOT *outSlot);
void AQHREACT_OutputSlot_SetDescription(AQHREACT_OUTPUT_SLOT *outSlot, const char *s);
int AQHREACT_OutputSlot_GetIdForUnit(const AQHREACT_OUTPUT_SLOT *outSlot);
void AQHREACT_OutputSlot_SetIdForUnit(AQHREACT_OUTPUT_SLOT *outSlot, int i);
uint32_t AQHREACT_OutputSlot_GetFlags(const AQHREACT_OUTPUT_SLOT *outSlot);
void AQHREACT_OutputSlot_SetFlags(AQHREACT_OUTPUT_SLOT *outSlot, uint32_t f);
void AQHREACT_OutputSlot_AddFlags(AQHREACT_OUTPUT_SLOT *outSlot, uint32_t f);
void AQHREACT_OutputSlot_SubFlags(AQHREACT_OUTPUT_SLOT *outSlot, uint32_t f);
int AQHREACT_OutputSlot_GetEmittedDataType(const AQHREACT_OUTPUT_SLOT *outSlot);
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

View File

@@ -1,31 +0,0 @@
/****************************************************************************
* This file is part of the project AqHome.
* AqHome (c) by 2024 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
****************************************************************************/
#ifndef AQHOME_REACT_OUTPUTSLOT_P_H
#define AQHOME_REACT_OUTPUTSLOT_P_H
#include "aqhome-react/types/outputslot.h"
struct AQHREACT_OUTPUT_SLOT {
GWEN_LIST_ELEMENT(AQHREACT_OUTPUT_SLOT)
int id;
char *name;
char *description;
int idForUnit;
uint32_t flags;
int emittedDataType;
AQHREACT_LINK_LIST *linkList;
};
#endif

View File

@@ -1,181 +0,0 @@
/****************************************************************************
* This file is part of the project AqHome.
* AqHome (c) by 2024 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
****************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "./unitnet_p.h"
#include <gwenhywfar/debug.h>
GWEN_LIST_FUNCTIONS(AQHREACT_UNIT_NET, AQHREACT_UnitNet)
AQHREACT_UNIT_NET *AQHREACT_UnitNet_new(void)
{
AQHREACT_UNIT_NET *unitNet;
GWEN_NEW_OBJECT(AQHREACT_UNIT_NET, unitNet);
GWEN_LIST_INIT(AQHREACT_UNIT_NET, unitNet);
unitNet->unitList=AQHREACT_Unit_List_new();
unitNet->paramList=AQHREACT_Param_List_new();
return unitNet;
}
void AQHREACT_UnitNet_free(AQHREACT_UNIT_NET *unitNet)
{
if (unitNet) {
GWEN_LIST_FINI(AQHREACT_UNIT_NET, unitNet);
AQHREACT_Param_List_free(unitNet->paramList);
AQHREACT_Unit_List_free(unitNet->unitList);
GWEN_FREE_OBJECT(unitNet);
}
}
const char *AQHREACT_UnitNet_GetName(const AQHREACT_UNIT_NET *unitNet)
{
return unitNet?unitNet->name:NULL;
}
void AQHREACT_UnitNet_SetName(AQHREACT_UNIT_NET *unitNet, const char *s)
{
if (unitNet) {
free(unitNet->name);
unitNet->name=s?strdup(s):NULL;
}
}
AQHREACT_UNIT_LIST *AQHREACT_UnitNet_GetUnitList(const AQHREACT_UNIT_NET *unitNet)
{
return unitNet?unitNet->unitList:NULL;
}
AQHREACT_UNIT *AQHREACT_UnitNet_GetUnitById(const AQHREACT_UNIT_NET *unitNet, const char *s)
{
return (unitNet && s && *s)?AQHREACT_Unit_List_GetById(unitNet->unitList, s):NULL;
}
void AQHREACT_UnitNet_AddUnit(AQHREACT_UNIT_NET *unitNet, AQHREACT_UNIT *unit)
{
if (unitNet && unit)
AQHREACT_Unit_List_Add(unit, unitNet->unitList);
}
AQHREACT_PARAM_LIST *AQHREACT_UnitNet_GetParamList(const AQHREACT_UNIT_NET *unitNet)
{
return unitNet?unitNet->paramList:NULL;
}
void AQHREACT_UnitNet_AddParam(AQHREACT_UNIT_NET *unitNet, AQHREACT_PARAM *param)
{
if (unitNet)
AQHREACT_Param_List_Add(param, unitNet->paramList);
}
AQHREACT_PARAM *AQHREACT_UnitNet_GetParamByName(const AQHREACT_UNIT_NET *unitNet, const char *paramName)
{
if (unitNet && unitNet->paramList && paramName && *paramName) {
AQHREACT_PARAM *param;
param=AQHREACT_Param_List_First(unitNet->paramList);
while(param) {
const char *s;
s=AQHREACT_Param_GetName(param);
if (s && *s && strcasecmp(paramName, s)==0)
return param;
param=AQHREACT_Param_List_Next(param);
}
}
return NULL;
}
AQHREACT_UNIT_NET *AQHREACT_UnitNet_List_GetByName(const AQHREACT_UNIT_NET_LIST *unitNetList, const char *name)
{
if (unitNetList && name && *name) {
AQHREACT_UNIT_NET *unitNet;
unitNet=AQHREACT_UnitNet_List_First(unitNetList);
while(unitNet) {
const char *s;
s=AQHREACT_UnitNet_GetName(unitNet);
if (s && *s && strcasecmp(s, name)==0)
return unitNet;
unitNet=AQHREACT_UnitNet_List_Next(unitNet);
}
}
return NULL;
}
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);
}
}
}

View File

@@ -1,47 +0,0 @@
/****************************************************************************
* This file is part of the project AqHome.
* AqHome (c) by 2024 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
****************************************************************************/
#ifndef AQHOME_REACT_UNIT_NET_H
#define AQHOME_REACT_UNIT_NET_H
#include <gwenhywfar/list.h>
typedef struct AQHREACT_UNIT_NET AQHREACT_UNIT_NET;
GWEN_LIST_FUNCTION_DEFS(AQHREACT_UNIT_NET, AQHREACT_UnitNet)
#include "aqhome-react/aqhome_react.h"
#include "aqhome-react/types/param.h"
AQHREACT_UNIT_NET *AQHREACT_UnitNet_new(void);
void AQHREACT_UnitNet_free(AQHREACT_UNIT_NET *unitNet);
const char *AQHREACT_UnitNet_GetName(const AQHREACT_UNIT_NET *unitNet);
void AQHREACT_UnitNet_SetName(AQHREACT_UNIT_NET *unitNet, const char *s);
AQHREACT_UNIT_LIST *AQHREACT_UnitNet_GetUnitList(const AQHREACT_UNIT_NET *unitNet);
AQHREACT_UNIT *AQHREACT_UnitNet_GetUnitById(const AQHREACT_UNIT_NET *unitNet, const char *s);
void AQHREACT_UnitNet_AddUnit(AQHREACT_UNIT_NET *unitNet, AQHREACT_UNIT *unit);
AQHREACT_PARAM_LIST *AQHREACT_UnitNet_GetParamList(const AQHREACT_UNIT_NET *unitNet);
void AQHREACT_UnitNet_AddParam(AQHREACT_UNIT_NET *unitNet, AQHREACT_PARAM *param);
AQHREACT_PARAM *AQHREACT_UnitNet_GetParamByName(const AQHREACT_UNIT_NET *unitNet, const char *paramName);
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);
#endif

View File

@@ -1,26 +0,0 @@
/****************************************************************************
* This file is part of the project AqHome.
* AqHome (c) by 2024 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
****************************************************************************/
#ifndef AQHOME_REACT_UNIT_NET_P_H
#define AQHOME_REACT_UNIT_NET_P_H
#include "aqhome-react/types/unitnet.h"
struct AQHREACT_UNIT_NET {
GWEN_LIST_ELEMENT(AQHREACT_UNIT_NET)
char *name;
AQHREACT_UNIT_LIST *unitList;
AQHREACT_PARAM_LIST *paramList;
};
#endif