diff options
author | Sean Nowlan <sean.nowlan@gtri.gatech.edu> | 2014-03-10 14:48:15 -0400 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2014-04-26 23:31:54 +0200 |
commit | 3e3d20358e88aeba41baf03cae0785936e96bce8 (patch) | |
tree | 23dc1ce648ab44cb16d709c8b5231eb35d8e39f3 /gr-uhd/examples/c++ | |
parent | cdc7c902b7b3de992b49e1ffa5051e2b274481f4 (diff) |
uhd: changed length_tag member variable from string to pmt symbol
Diffstat (limited to 'gr-uhd/examples/c++')
-rw-r--r-- | gr-uhd/examples/c++/tag_source_demo.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gr-uhd/examples/c++/tag_source_demo.h b/gr-uhd/examples/c++/tag_source_demo.h index 904087cf9b..8508c32680 100644 --- a/gr-uhd/examples/c++/tag_source_demo.h +++ b/gr-uhd/examples/c++/tag_source_demo.h @@ -36,7 +36,7 @@ public: const double samp_rate, const double idle_duration, const double burst_duration, - const std::string &length_tag_key = "" + const std::string &length_tag_name = "" ): sync_block( "uhd tag source demo", @@ -50,8 +50,8 @@ public: _cycle_duration(idle_duration + burst_duration), _samps_left_in_burst(1), //immediate EOB _do_new_burst(false), - _firstrun(not length_tag_key.empty()), - _length_tag_key(length_tag_key) + _firstrun(not length_tag_name.empty()), + _length_tag_key(length_tag_name.empty() ? pmt::PMT_NIL : pmt::string_to_symbol(length_tag_name)) { //NOP } @@ -85,12 +85,12 @@ public: void make_length_tag(const uint64_t tag_count, const uint64_t burst_len) { - if (_length_tag_key.empty()){ + if (pmt::is_null(_length_tag_key)) { //no length_tag was specified at initialization; make a tx_sob tag instead this->make_sob_tag(tag_count); return; } - const pmt::pmt_t key = pmt::string_to_symbol(_length_tag_key); + const pmt::pmt_t key = _length_tag_key; const pmt::pmt_t value = pmt::from_long((long)burst_len); const pmt::pmt_t srcid = pmt::string_to_symbol(this->name()); this->add_item_tag(0/*chan0*/, tag_count, key, value, srcid); @@ -103,18 +103,18 @@ public: { //load the output with a constant std::complex<float> *output = reinterpret_cast<std::complex<float> *>(output_items[0]); - for (size_t i = 0; i < size_t(noutput_items); i++){ + for (size_t i = 0; i < size_t(noutput_items); i++) { output[i] = std::complex<float>(0.7, 0.7); } //Handle the start of burst condition. //Tag a start of burst and timestamp. //Increment the time for the next burst. - if (_do_new_burst){ + if (_do_new_burst) { _do_new_burst = false; _samps_left_in_burst = _samps_per_burst; - if (_length_tag_key.empty()) + if (pmt::is_null(_length_tag_key)) this->make_sob_tag(this->nitems_written(0)); else #if 1 @@ -138,7 +138,7 @@ public: //Tag an end of burst and return early. //the next work call will be a start of burst. if (_samps_left_in_burst < size_t(noutput_items)){ - if (_length_tag_key.empty()) + if (pmt::is_null(_length_tag_key)) this->make_eob_tag(this->nitems_written(0) + _samps_left_in_burst - 1); else if (_firstrun){ _firstrun = false; @@ -161,6 +161,6 @@ private: uint64_t _samps_left_in_burst; bool _do_new_burst; bool _firstrun; - const std::string _length_tag_key; + const pmt::pmt_t _length_tag_key; }; |