15 #define epicsExportSharedSymbols 30 size_t size,
size_t offset)
31 :buf(bb.getBuffer() + bb.getPosition())
32 ,buflen(bb.getRemaining())
48 size_t ilog2(
size_t val)
57 size_t bits2bytes(
size_t val)
71 const size_t len =
std::min(hex.buflen, hex._limit);
74 const size_t addrwidth = bits2bytes(ilog2(len))*2u;
75 size_t nlines = len/hex._perLine;
80 for(
size_t l=0; l<nlines; l++)
82 size_t start = l*hex._perLine;
83 strm<<
"0x"<<
std::hex<<std::setw(addrwidth)<<std::setfill(
'0')<<start;
86 for(
size_t col=0; col<hex._perLine; col++)
88 if(col%hex._groupBy == 0) {
92 strm<<
std::hex<<std::setw(2)<<std::setfill(
'0')<<unsigned(hex.buf[start+col]&0xff);
101 for(
size_t col=0; col<hex._perLine && start+col<len; col++)
103 if(col%hex._groupBy == 0) {
106 char val = hex.buf[start+col]&0xff;
107 if(val>=
' ' && val<=
'~') {
epicsShareFunc friend std::ostream & operator<<(std::ostream &strm, const HexDump &hex)
HexDump(const char *buf, size_t len)
TODO only here because of the Lockable.
This class implements a Bytebuffer that is like the java.nio.ByteBuffer.