/* * hexDump.cpp * * Created on: Nov 3, 2010 * Author: Miha Vitorovic */ #include "hexDump.h" #include #include using namespace epics::pvData; namespace epics { namespace pvAccess { String toHex(int8); char toAscii(int8); void hexDump(const String name, const int8 *bs, int len) { hexDump(name, bs, 0, len); } void hexDump(const String name, const int8 *bs, int start, int len) { hexDump("", name, bs, start, len); } void hexDump(const String prologue, const String name, const int8 *bs, int start, int len) { std::stringstream header; header<>4)&0x0F; sb += lookup[upper]; int lower = b&0x0F; sb += lookup[lower]; sb += ' '; return sb; } /** * Get ASCII representation of byte, dot if non-readable. * @param b * @return ASCII representation of byte, dot if non-readable. */ char toAscii(int8 b) { if(b>(int8)31&&b<(int8)127) return (char)b; else return '.'; } } }