diff options
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block.cc | 7 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block.h | 5 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_hier_block2.cc | 7 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_hier_block2.h | 5 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_top_block.cc | 11 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_top_block.h | 5 |
6 files changed, 36 insertions, 4 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index 144b51f45..443ac8f64 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -23,6 +23,9 @@ #include <gr_block.h> #include <boost/foreach.hpp> #include <iostream> +#include <boost/detail/atomic_count.hpp> + +static boost::detail::atomic_count unique_id_pool(0); gr_block::gr_block(void) { @@ -34,7 +37,9 @@ gr_block::gr_block( gr_io_signature_sptr input_signature, gr_io_signature_sptr output_signature ): - gras::Block(name) + gras::Block(name), + _unique_id(++unique_id_pool), + _name(name) { //this initializes private vars, order matters this->set_fixed_rate(false); diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 7a728bc4e..08914f24a 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -54,6 +54,11 @@ struct GR_CORE_API gr_block : gras::Block gr_io_signature_sptr output_signature ); + long unique_id(void) const{return _unique_id;} + std::string name(void) const{return _name;} + long _unique_id; + std::string _name; + virtual ~gr_block(void); gr_io_signature_sptr input_signature(void) const; diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc index 2f92d8c6b..04eb60fc6 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc @@ -25,6 +25,9 @@ #endif #include <gr_hier_block2.h> +#include <boost/detail/atomic_count.hpp> + +static boost::detail::atomic_count unique_id_pool(0); gr_hier_block2::gr_hier_block2(void) @@ -37,7 +40,9 @@ gr_hier_block2::gr_hier_block2( gr_io_signature_sptr input_signature, gr_io_signature_sptr output_signature ): - gras::HierBlock(name) + gras::HierBlock(name), + _unique_id(++unique_id_pool), + _name(name) { this->set_input_signature(input_signature); this->set_output_signature(output_signature); diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.h b/gnuradio-core/src/lib/runtime/gr_hier_block2.h index 61f2e500f..d393c42cb 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2.h +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.h @@ -37,6 +37,11 @@ struct GR_CORE_API gr_hier_block2 : gras::HierBlock gr_io_signature_sptr output_signature ); + long unique_id(void) const{return _unique_id;} + std::string name(void) const{return _name;} + long _unique_id; + std::string _name; + const gr_hier_block2 &self(void) const { return *this; diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.cc b/gnuradio-core/src/lib/runtime/gr_top_block.cc index 1c885be6e..fa090b4ef 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_top_block.cc @@ -26,16 +26,23 @@ #include <unistd.h> #include <gr_top_block.h> +#include <boost/detail/atomic_count.hpp> + +static boost::detail::atomic_count unique_id_pool(0); gr_top_block::gr_top_block(void): //cannot make a null top block, use name constructor - gras::TopBlock("top") + gras::TopBlock("top"), + _unique_id(++unique_id_pool), + _name("top") { //NOP } gr_top_block::gr_top_block(const std::string &name): - gras::TopBlock(name) + gras::TopBlock(name), + _unique_id(++unique_id_pool), + _name(name) { //NOP } diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h index 451f28a7b..4e4becd1f 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block.h @@ -33,6 +33,11 @@ struct GR_CORE_API gr_top_block : gras::TopBlock gr_top_block(const std::string &name); + long unique_id(void) const{return _unique_id;} + std::string name(void) const{return _name;} + long _unique_id; + std::string _name; + void start(const size_t max_items); void run(const size_t max_items); |