Did some looking and i found some great resources here for doing this but I'm having issues.
my predicament:
I made a program that parses through several files gathering information and storing them in respective structures that look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
struct HardwareInfoStruct {
string DeviceName;
string HardwareType;
string FrameType;
string Timeout[MAX_TIMEOUT];
string HardwareID[MAX_HID];
unsigned short HardwareIDCount;
unsigned short TimeoutCount;
unsigned short ItterationIndex;
} ;//end of hardware information at the start of file
struct PidStruct {
string KeywordValues[NUM_OF_KEYWORD - 1];
string BootFileNames[MAX_BOOTLOADER_FILES];
unsigned short BootFileNamesCount;
string BootFileUsedOn[MAX_BOOTLOADER_FILES];
}; //end of struct for the program identifier
|
where PidStruct gets defined later as an array of structures.
This whole program is base on the concept of my information for one device being wrapped in tags like so:
1 2
|
///</DeviceInfo>
///<DeviceInfo>
|
well so now i need to expand it onto multiple devices and I've been trying to nest the original two structures to not much avail like this:
1 2 3 4
|
struct DevStruct {
HardwareInfoStruct HardwareInfo;
PidStruct PIDS[MAX_PIDS];
}; //end of device structure
|
I've got about 5-6 thousand lines of code into this thing and I'm trying to come up with a way to keep those same structures but then have multiple copies of them.
this is what i have now:
PIDS[PIDSIndex].KeywordValues[PID_STRUCT_INDEX_AUTHOR]
and this is something like what I'm going for:
DevInfo[DevIndex].PIDS[PIDSIndex].KeywordValues[PID_STRUCT_INDEX_AUTHOR]
to elaborate on this a little further, I've got a set of values like this in a text file:
1 2 3 4 5 6 7 8 9 10 11
|
///</DeviceInfo2>
/// <ProgramIdentifier2>
/// <Author>Joe shmo</Author>
/// <ProgTypeIndex>FIRMWARE_TYPE_MICRO</ProgTypeIndex>
/// <UpdateTypeKeyword>MICRO_FIRMWARE_TYPE</UpdateTypeKeyword>
/// <ProgType>0xXXX0</ProgType>
/// <RevIndex>FIRMWARE_REV_MICRO</RevIndex>
/// <UpdateRevKeyword>MICRO_FIRMWARE_REVISION</UpdateRevKeyword>
/// <Revision>0xFFFF</Revision>
/// </ProgIdentifier2>
///</DeviceInfo2>
|
that has multiple program identifiers in it.I'm trying to put another set of the <DeviceInfo> tabs on there below it with more information while trying to keep somewhat of my original nomenclature. the idea would look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
///</DeviceInfo2>
/// <ProgramIdentifier2>
/// <Author>Joe shmo</Author>
/// <ProgTypeIndex>FIRMWARE_TYPE_MICRO</ProgTypeIndex>
/// <UpdateTypeKeyword>MICRO_FIRMWARE_TYPE</UpdateTypeKeyword>
/// <ProgType>0xXXX0</ProgType>
/// <RevIndex>FIRMWARE_REV_MICRO</RevIndex>
/// <UpdateRevKeyword>MICRO_FIRMWARE_REVISION</UpdateRevKeyword>
/// <Revision>0xFFFF</Revision>
/// </ProgIdentifier2>
///</DeviceInfo2>
///
///</DeviceInfo3>
/// <ProgramIdentifier2>
/// <Author>bob james</Author>
/// <ProgTypeIndex>FIRMWARE_TYPE_MICRO</ProgTypeIndex>
/// <UpdateTypeKeyword>MICRO_FIRMWARE_TYPE</UpdateTypeKeyword>
/// <ProgType>0x111X</ProgType>
/// <RevIndex>FIRMWARE_REV_MICRO</RevIndex>
/// <UpdateRevKeyword>MICRO_FIRMWARE_REVISION</UpdateRevKeyword>
/// <Revision>0xXX22</Revision>
/// </ProgIdentifier2>
///</DeviceInfo3>
|
it doesn't necisarily have to be pretty but it does need to work...lol
any ideas guys? do i jsut need to bite the bullet and re-organise my code?