C
CptDondo
I have a structure that looks like this:
struct parameterSchedule_t {
uint16_t waterFlow,
uint16_t timerBase,
uint16_t safetyDelay,
uint16_t pressureRiseTimer,
uint16_t stallTimer,
uint8_t autoRestartPower,
uint8_t autoRestartTemp,
uint8_t compassOverride,
uint8_t Group,
uint8_t hmiAddress,
uint8_t plcAddress,
char systemDate[32],
char systemTime[32],
};
This represents the layout in an XML file. I also have an array of XML
elements that looks similar:
char *elements[] = {
"waterFlow",
"timerBase",
"safetyDelay",
"pressureRiseTimer",
"stallTimer",
"autoRestartPower",
"autoRestartTemp",
"compassOverride",
"Group",
"hmiAddress",
"plcAddress",
"systemDate",
"systemTime",
};
What I want to do is to recurse through the XML tree, and somehow look
up the appropriate element in the structure to match the XML element I
just pulled out.... (too much time spent with PHP recently....)
I can't quite figure out how to do that without duplicating a lot of
information. The goal is to be easily maintainable so I am looking for
some what that doesn't require a minor change to touch several header
and code files... Ideally something that can either generate the
structure and array from #defines or something that can be used to get
the correct structure member at runtime....
--Yan
struct parameterSchedule_t {
uint16_t waterFlow,
uint16_t timerBase,
uint16_t safetyDelay,
uint16_t pressureRiseTimer,
uint16_t stallTimer,
uint8_t autoRestartPower,
uint8_t autoRestartTemp,
uint8_t compassOverride,
uint8_t Group,
uint8_t hmiAddress,
uint8_t plcAddress,
char systemDate[32],
char systemTime[32],
};
This represents the layout in an XML file. I also have an array of XML
elements that looks similar:
char *elements[] = {
"waterFlow",
"timerBase",
"safetyDelay",
"pressureRiseTimer",
"stallTimer",
"autoRestartPower",
"autoRestartTemp",
"compassOverride",
"Group",
"hmiAddress",
"plcAddress",
"systemDate",
"systemTime",
};
What I want to do is to recurse through the XML tree, and somehow look
up the appropriate element in the structure to match the XML element I
just pulled out.... (too much time spent with PHP recently....)
I can't quite figure out how to do that without duplicating a lot of
information. The goal is to be easily maintainable so I am looking for
some what that doesn't require a minor change to touch several header
and code files... Ideally something that can either generate the
structure and array from #defines or something that can be used to get
the correct structure member at runtime....
--Yan