I am writing a log file decoder which should be capable of reading many different structures of files. My question is how best to represent this data. I am using C#, but am new to OOP.
An example: The log files have a range of sensor values. One sensor reading can be called A, another B. Obviously, there are many more than 2 entry types. In different log files, they could be stored either as ABABABABAB or AAAAABBBBB.
I was thinking of describing this as blocks of entries. So in the first case, a block would be 'AB', with 5 blocks. In the second case, the first block is 'A', read 5 times. This is followed by a block of 'B', read 5 times.
This is quite a simplification (there are actually 40 different types of log file, each with up to 40 sensor values in a block). No log has more than 300 blocks.
At the moment, I store all of this in a datatable. I have a column for each entry, with a property of how many to read. If this is set to -1, it continues to the next column in the block. If not, it will assume that it has reached the end of the block.
This all seems quite clumsy. Can anyone suggest a better way of doing this?
Very basic and straightforward:
IEnrty
with properties like string EntryBlock, int Count
Entry
and implements IEntry
IEnumerable<IEntry>
Entry
could override ToString()
to return something like [ABAB-2], surely if this is would be helpful whilst serializationIEntry
could provide method void CreateFromRawString(string rawDataFromLog)
if it would be helpful, decide yourselfIf you want more info please share code you are using for serialization/deserializaton