Go to the documentation of this file.00001 #include "EventFilter/Utilities/interface/DebugUtils.h"
00002
00003 #include <sstream>
00004 #include <iomanip>
00005 #include <cstdio>
00006
00007 using namespace std;
00008
00009 string evf::dumpFrame(unsigned char* data, unsigned int len)
00010 {
00011
00012 ostringstream out;
00013 char left[40];
00014 char right[40];
00015
00016
00017 out << "Byte: 0 1 2 3 4 5 6 7\n";
00018
00019 int c = 0;
00020 int pos = 0;
00021
00022
00023 for (unsigned int i = 0; i < (len/8); i++) {
00024 int rpos = 0;
00025 c += 7;
00026 for (pos = 0; pos < 8*3; pos += 3) {
00027 sprintf (&left[pos],"%2.2x ", ((unsigned char*)data)[c]);
00028 sprintf (&right[rpos],"%1c", ((data[c] > 32) && (data[c] < 127)) ? data[c]: '.' );
00029 rpos += 1;
00030 c--;
00031 }
00032 c += 9;
00033 out << setw(4) << setfill('0') << c-8 << ": " << left << " || "
00034 << right << endl;
00035
00036 }
00037 return out.str();
00038 }