added option to print raw message data in text form for debugging
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 18 Mar 2015 14:57:22 +0000 (15:57 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 18 Mar 2015 14:57:22 +0000 (15:57 +0100)
src/host/messagepayload.cpp
src/host/messagepayload.h

index 4e931ce..a1be197 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <algorithm>
 #include <limits>
+#include <iomanip>
 
 #include <logfunc.hpp>
 
@@ -476,3 +477,11 @@ uint32_t MessagePayload::calc_checksum_part() const
 
     return sum;
 }
+
+void MessagePayload::debug_dump(std::ostream &os) const
+{
+    std::vector<uint8_t>::const_iterator iter = Payload.begin();
+    std::vector<uint8_t>::const_iterator end = Payload.end();
+    while ( iter != end )
+        os << setw(5) << static_cast<uint>(*iter++);
+}
index 74fb41c..c1eb8a1 100644 (file)
@@ -80,6 +80,8 @@ public:
 
     uint32_t calc_checksum_part() const;
 
+    void debug_dump(std::ostream &os) const;
+
 private:
     /// The size of the payload buffer
     std::size_t PayloadSizeInBytes;