diff options
author | Eric Blossom | 2010-09-25 23:23:17 -0700 |
---|---|---|
committer | Eric Blossom | 2010-09-27 14:56:43 -0700 |
commit | 3339d8dc40a90986f33ea095baa0a861fed32bb6 (patch) | |
tree | 4e6a76ab7cfcf56c58face855f40f26be3d2ca14 /vrt/lib | |
parent | 503931d4e719bbfd74e67d1cbd4a91b9cc812144 (diff) | |
download | gnuradio-3339d8dc40a90986f33ea095baa0a861fed32bb6.tar.gz gnuradio-3339d8dc40a90986f33ea095baa0a861fed32bb6.tar.bz2 gnuradio-3339d8dc40a90986f33ea095baa0a861fed32bb6.zip |
Add ostream output for expanded_header.
Diffstat (limited to 'vrt/lib')
-rw-r--r-- | vrt/lib/expanded_header.cc | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/vrt/lib/expanded_header.cc b/vrt/lib/expanded_header.cc index fc4bfc1c2..1fddac8cb 100644 --- a/vrt/lib/expanded_header.cc +++ b/vrt/lib/expanded_header.cc @@ -24,7 +24,11 @@ #endif #include <vrt/expanded_header.h> #include <gruel/inet.h> -//#include <stdio.h> +#include <boost/format.hpp> + +using boost::format; +using boost::io::group; + namespace vrt { @@ -132,5 +136,41 @@ namespace vrt { return true; } + std::string + pkt_type_name(const vrt::expanded_header *hdr) + { + if (hdr->if_data_p()) + return "IF-Data"; + if (hdr->ext_data_p()) + return "Ext-Data"; + if (hdr->if_context_p()) + return "IF-Context"; + if (hdr->ext_context_p()) + return "Ext-Context"; + else + return "<unknown pkt type>"; + } + + void + expanded_header::write(std::ostream &port) const + { + port << format("%s:\n") % pkt_type_name(this); + if (1) + port << format(" header: 0x%08x\n") % header; + if (stream_id_p()) + port << format(" stream_id: %#10x\n") % stream_id; + if (class_id_p()) + port << format(" class_id: 0x%016llx\n") % class_id; + if (integer_secs_p()) + port << format(" int secs: %10d\n") % integer_secs; + if (fractional_secs_p()) + port << format(" frac secs: %10d\n") % fractional_secs; + } + + std::ostream& operator<<(std::ostream &os, const expanded_header &obj) + { + obj.write(os); + return os; + } }; // vrt |