<Collection>or a memory structure like this.
<uniqueID ID="100">
<Item itemno="0" desc="coffee" />
<Item itemno="1" desc="tea" />
<Item itemno="2" desc="milk" />
'
'
'
'
</UniqueID>
<uniqueID ID="200">
<Item itemno="0" desc="cup" />
<Item itemno="1" desc="plate" />
<Item itemno="2" desc="spoon" />
'
'
'
'
</UniqueID>
</Collection>
[100]-->[0,Cofee]-->[1,Tea]-->[2,Milk]when ever i receive a message i need to add that message to this kind of formatted memory structure. The message i receive will be in this format.
[200]-->[0,cup]-->[1,Plate]-->[2,Spoon]
for example 1: "100,0,Coffee"
for example 2: "200,1,plate"
for the first time while i run the program for example i receive a message like "100,0,Coffee". then 100 is the UniqueID for that message. so i need to create a header name 100 and put the message (0,Cofee) under that header. after that if i receive a message like "200,0,cup". then 200 is uniqueID for that message. so i need to check whether header 200 is already exist in that memory structure, if not then create a header name 200 and put the message (0,cup) under that header. after that if i receive a message like "100,1,tea". then need to check whether header 100 already exist in that memory structure, if exist then add the message (1,tea) under the uniqueID 100.
so if i receive an item who's UniqueID that's not exist in memory structure, then need to create a new header for that UniqueID and add the items under it. And if i receive an item who's UniqueID that's already exist in memory structure, then need to add that item under that UniqueID header.
so when i need, for example if i call the header 100 then i can access the items i received for header 100 ([0,Cofee], [1,Tea], [2,Milk], ...) will be accessed. so using each UniqueID we can access the entire messages received for that ID.
if you have any idea how to do this, please help me. i'm not getting any idea. if you can provide an example then it will be great help for me. please.
thanks in advance.