FACT++  1.0
template<typename T >
static std::string Converter::GetHex ( const void *  dat,
size_t  size,
size_t  col = 0,
bool  prefix = true 
)
inlinestatic

Definition at line 110 of file Converter.h.

References i.

111  {
112  if (size%sizeof(T)!=0)
113  throw std::runtime_error("GetHex: Total not dividable by typesize.");
114 
115  const T *ptr = reinterpret_cast<const T*>(dat);
116 
117  std::ostringstream text;
118  text << std::hex;
119 
120  const size_t w = nearbyint(ceil(log2(size+1)))/4+1;
121 
122  for (size_t i=0; i<size/sizeof(T); i++)
123  {
124  if (prefix && col!=0 && i%col==0)
125  text << std::setfill('0') << std::setw(w) << i << "| ";
126 
127  text << std::setfill('0') << std::setw(2*sizeof(T));
128  text << (unsigned int)ptr[i] << ':';
129 
130  if (col!=0 && i%col==col-1)
131  text << '\n';
132 
133  }
134 
135  return text.str();
136  }
int i
Definition: db_dim_client.c:21
int size
Definition: db_dim_server.c:17