pvAccessCPP  7.1.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
hexDump.h
1 
7 #ifndef HEXDUMP_H_
8 #define HEXDUMP_H_
9 
10 #include <ostream>
11 
12 #ifdef epicsExportSharedSymbols
13 # define hexDumpEpicsExportSharedSymbols
14 # undef epicsExportSharedSymbols
15 #endif
16 
17 #include <pv/pvType.h>
18 
19 #ifdef hexDumpEpicsExportSharedSymbols
20 # define epicsExportSharedSymbols
21 # undef hexDumpEpicsExportSharedSymbols
22 #endif
23 
24 #include <shareLib.h>
25 
26 namespace epics {
27 namespace pvData {
28 class ByteBuffer;
29 }
30 namespace pvAccess {
31 
32 class epicsShareClass HexDump {
33  const char* buf;
34  size_t buflen;
35  size_t _limit;
36  unsigned _groupBy;
37  unsigned _perLine;
38 public:
39  HexDump(const char* buf, size_t len);
40  explicit HexDump(const pvData::ByteBuffer& buf, size_t size=(size_t)-1, size_t offset=0u);
41  ~HexDump();
42 
44  inline HexDump& limit(size_t n=(size_t)-1) { _limit = n; return *this; }
46  inline HexDump& bytesPerGroup(size_t n=(size_t)-1) { _groupBy = n; return *this; }
48  inline HexDump& bytesPerLine(size_t n=(size_t)-1) { _perLine = n; return *this; }
49 
50  epicsShareFunc
51  friend std::ostream& operator<<(std::ostream& strm, const HexDump& hex);
52 };
53 
54 epicsShareFunc
55 std::ostream& operator<<(std::ostream& strm, const HexDump& hex);
56 
57 }
58 }
59 
60 #endif /* HEXDUMP_H_ */
basic_ostream< _CharT, _Traits > & operator<<(basic_ostream< _CharT, _Traits > &__os, const basic_string< _CharT, _Traits, _Alloc > &__str)
size_t size() const