summaryrefslogtreecommitdiff
path: root/gnuradio-core
diff options
context:
space:
mode:
authorTom Rondeau2010-11-06 13:18:32 -0400
committerTom Rondeau2010-11-06 13:18:32 -0400
commit6cc6925ec231897a2e46f3d7bfb52ba3aecfc492 (patch)
tree287096f5cd4ff5f92469a8de3709958c718603f8 /gnuradio-core
parentd58d250c82ff8b106aec02f5222cea385b74d729 (diff)
downloadgnuradio-6cc6925ec231897a2e46f3d7bfb52ba3aecfc492.tar.gz
gnuradio-6cc6925ec231897a2e46f3d7bfb52ba3aecfc492.tar.bz2
gnuradio-6cc6925ec231897a2e46f3d7bfb52ba3aecfc492.zip
Better formatting of tag information to make info more readable.
Diffstat (limited to 'gnuradio-core')
-rw-r--r--gnuradio-core/src/lib/runtime/gr_random_annotator.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc
index bd74f5b84..d9ad15a55 100644
--- a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc
+++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc
@@ -28,6 +28,7 @@
#include <gr_io_signature.h>
#include <string.h>
#include <iostream>
+#include <iomanip>
gr_random_annotator_sptr
gr_make_random_annotator (size_t sizeof_stream_item)
@@ -55,18 +56,27 @@ gr_random_annotator::work (int noutput_items,
const float **in = (const float **) &input_items[0];
float **out = (float **) &output_items[0];
+ std::stringstream str;
+ str << name() << unique_id();
+
gr_uint64 abs_N = nitems_written(0);
std::deque<pmt::pmt_t> all_tags = get_tags_in_range(0, (gr_uint64)0, abs_N);
std::deque<pmt::pmt_t>::iterator itr;
std::cout << std::endl << "Found " << all_tags.size() << " tags." << std::endl;
+
+ std::cout.setf(std::ios::left);
+ std::cout << std::setw(25) << "Receiver" << std::setw(25) << "Sender"
+ << std::setw(10) << "nitem" << std::setw(20) << "key"
+ << std::setw(10) << "value" << std::endl;
for(itr = all_tags.begin(); itr != all_tags.end(); itr++) {
gr_uint64 nitem = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0));
std::string srcid = pmt::pmt_symbol_to_string(pmt::pmt_tuple_ref(*itr, 1));
std::string key = pmt::pmt_symbol_to_string(pmt::pmt_tuple_ref(*itr, 2));
gr_uint64 value = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 3));
- std::cout << "Tag at " << nitem << " from " << srcid
- << " with key = \"" << key << "\" had value = " << value << std::endl;
+ std::cout << std::setw(25) << str.str() << std::setw(25) << srcid
+ << std::setw(10) << nitem << std::setw(20) << key
+ << std::setw(10) << value << std::endl;
}
// Work does nothing to the data stream; just copy all inputs to outputs
@@ -76,8 +86,6 @@ gr_random_annotator::work (int noutput_items,
}
// Storing the current noutput_items as the value to the "noutput_items" key
- std::stringstream str;
- str << name() << unique_id();
pmt::pmt_t cur_N = pmt::pmt_from_uint64(noutput_items);
pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str());
pmt::pmt_t key = pmt::pmt_string_to_symbol("noutput_items");