Bitstream Interpretation Library (BIL)  0.1
V5ConfigurationDump.cpp
Go to the documentation of this file.
1 
10 #include <util/HexPrint.hpp>
11 
12 using namespace bil;
13 
14 
15 void bil::dumpConfiguration(const V5Configuration& cfg, std::ostream& cfgOut, std::ostream& indexOut)
16 {
17  // collect list with all frame addresses and their frames
19 
20  // loop over list
21  size_t frameCount = pairs.size();
22  for (size_t i = 0; i < frameCount; ++i)
23  {
24  // get pointer to current pair
25  const V5Configuration::pair_t* pairPtr = pairs[i];
26 
27  // write one line with raw frame address info and frame data offset
28  const V5FrameAddress& address = pairPtr->first;
29  indexOut << toRawAddressString(address) << '\t';
30  printHex(indexOut, cfgOut.tellp());
31  indexOut << "\t(" << toSymbolicString(address) << "):";
32  indexOut << V5CfgColumn::toString(address.columnType()) << '\n';
33  if (!indexOut) throw IOException();
34 
35  // write frame data
36  const V5CfgFrame& frame = pairPtr->second;
37  cfgOut.write(reinterpret_cast<const char*>(frame.data()), V5CfgFrame::WORDCOUNT << 2);
38  if (!cfgOut) throw IOException();
39  }
40 }