There is some old code that I would like to reorganize.
There is some data obtained by reading some registers. This data is presented in csv and xml files.
The current path is dirty. There is no separation between data and presentation (XML, CSV). Thus, for each format, data is collected each time.
To give you an image, it looks like this:
A::Timestamp()
{
filehndle << data1 << ","<<data2<<"," << data3;
if( cmd_line_opt1 )
{
filehndle << "," << statdata1 <<","<<statdata2;
}
}
A::PreTimeStamp()
{
filehndle << "start, end, delta";
if( cmd_line_opt1 )
{
filehndle << "," << "statdata1 , statdata2";
}
}
Another class B :: Profile (), which collects data in the same way as A :: Timestamp, but data is dumped as XML.
I would like to reorganize it to collect data in a common place. And use some adapters for csv and xml to take data and dump it in this format.
, . , struct . , csv, .
, say, xmlWriter CsvWriter?