CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DebugUtils.cc
Go to the documentation of this file.
2 
3 #include <sstream>
4 #include <iomanip>
5 #include <cstdio>
6 
7 using namespace std;
8 
9 string evf::dumpFrame(unsigned char* data, unsigned int len)
10 {
11 
12  ostringstream out;
13  char left[40];
14  char right[40];
15 
16  // LOG4CPLUS_ERROR(adapter_->getApplicationLogger(),toolbox::toString("Byte 0 1 2 3 4 5 6 7\n"));
17  out << "Byte: 0 1 2 3 4 5 6 7\n";
18 
19  int c = 0;
20  int pos = 0;
21 
22 
23  for (unsigned int i = 0; i < (len/8); i++) {
24  int rpos = 0;
25  c += 7;
26  for (pos = 0; pos < 8*3; pos += 3) {
27  sprintf (&left[pos],"%2.2x ", ((unsigned char*)data)[c]);
28  sprintf (&right[rpos],"%1c", ((data[c] > 32) && (data[c] < 127)) ? data[c]: '.' );
29  rpos += 1;
30  c--;
31  }
32  c += 9;
33  out << setw(4) << setfill('0') << c-8 << ": " << left << " || "
34  << right << endl;
35 
36  }
37  return out.str();
38 }
int i
Definition: DBlmapReader.cc:9
std::string dumpFrame(unsigned char *data, unsigned int len)
Definition: DebugUtils.cc:9
tuple out
Definition: dbtoconf.py:99