What is the best data structure for storing FIX messages?

advertisements

What's the best way to store the following message into a data structure for easy access?

"A=abc,B=156,F=3,G=1,H=10,G=2,H=20,G=3,H=30,X=23.50,Y=xyz"

The above consists of key/value pairs of the following:

A=abc
B=156
F=3
G=1
H=10
G=2
H=20
G=3
H=30
X=23.50
Y=xyz

The tricky part is the keys F, G and H. F indicates the number of items in a group whose item consists of G and H.

For example if F=3, there are three items in this group: Item 1: G=1, H=10 Item 2: G=2, H=20 Item 3: G=3, H=30

In the above example, each item consists of two key/pair values: G and H. I would like the data structure to be flexible such that it can handle if the item increases its key/pair values. As much as possible, I would like to maintain the order it appears in the string.

UPDATE: I would like to store the key/value pairs as strings even though the value often appears as float or other data type, like a map.


May not be what you're looking for, but I'd simply recommend using QuickFIX (quickfixengine.org), which is a very high quality C++ FIX library. It has the type "FIX::Message" which does everything you're looking for, I believe.