diff options
author | Josh Blum | 2013-02-22 00:30:57 -0800 |
---|---|---|
committer | Josh Blum | 2013-02-22 00:30:57 -0800 |
commit | ea42d0aa849bf5adfa0d1768e7b189a60b35e784 (patch) | |
tree | a1a576c7fd551c7e81d6d1ce7b6d2c6722502ec3 /gnuradio-core/src/lib/runtime | |
parent | 7b6594232b5f3f48352cad0e335ad0cdbc3d004b (diff) | |
download | gnuradio-ea42d0aa849bf5adfa0d1768e7b189a60b35e784.tar.gz gnuradio-ea42d0aa849bf5adfa0d1768e7b189a60b35e784.tar.bz2 gnuradio-ea42d0aa849bf5adfa0d1768e7b189a60b35e784.zip |
gras: linker stuff + moving around symbols and shit
Basically there were some issues on OSX linking,
because gras wasnt explicitly specified,
and was technically exposed by the gr wrappers.
As part of this commit, some symbols were moved into the wrappers,
and some of the interfaces which were in gras for backwards compat purposes,
The compile is still going, but this already addresses a few issues.
Now, I don't want to go copying every symbol over,
the real solution is to link in gras into whatever library.
Probably another commit to come...
Diffstat (limited to 'gnuradio-core/src/lib/runtime')
-rw-r--r-- | gnuradio-core/src/lib/runtime/CMakeLists.txt | 4 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block.cc | 35 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block.h | 14 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_hier_block2.cc | 133 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_hier_block2.h | 25 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_top_block.cc | 83 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_top_block.h | 34 |
7 files changed, 112 insertions, 216 deletions
diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt index cec02b360..6092c4f4e 100644 --- a/gnuradio-core/src/lib/runtime/CMakeLists.txt +++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt @@ -55,7 +55,7 @@ list(APPEND gnuradio_core_sources #${CMAKE_CURRENT_SOURCE_DIR}/gr_block_detail.cc #${CMAKE_CURRENT_SOURCE_DIR}/gr_block_executor.cc #${CMAKE_CURRENT_SOURCE_DIR}/gr_block_registry.cc - #${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2.cc #${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2_detail.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_buffer.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_dispatcher.cc @@ -78,7 +78,7 @@ list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_decimator.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_interpolator.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_sys_paths.cc - #${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block.cc #${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block_impl.cc #${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_detail.cc #${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_thread_body.cc diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index 63df6aa18..dae266c87 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -43,6 +43,26 @@ gr_block::gr_block( this->set_output_signature(output_signature); } +void gr_block::notify_active(void) +{ + this->start(); +} + +bool gr_block::start(void) +{ + return true; +} + +void gr_block::notify_inactive(void) +{ + this->stop(); +} + +bool gr_block::stop(void) +{ + return true; +} + void gr_block::notify_topology(const size_t num_inputs, const size_t num_outputs) { _fcast_ninput_items.resize(num_inputs); @@ -57,6 +77,16 @@ bool gr_block::check_topology(int, int) return true; } +const gr_io_signature_sptr &gr_block::input_signature(void) const +{ + return gras::Block::input_signature(); +} + +const gr_io_signature_sptr &gr_block::output_signature(void) const +{ + return gras::Block::output_signature(); +} + void gr_block::work( const InputItems &input_items, const OutputItems &output_items @@ -454,3 +484,8 @@ gras::BufferQueueSptr gr_block::input_buffer_allocator(const size_t, const gras: } return gras::BufferQueueSptr(); } + +gras::BufferQueueSptr gr_block::output_buffer_allocator(const size_t which, const gras::SBufferConfig &config) +{ + return gras::Block::output_buffer_allocator(which, config); +} diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 48bb2fc97..2a57792a0 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -85,6 +85,9 @@ struct GR_CORE_API gr_block : gras::Block gr_vector_void_star &output_items ); + virtual bool start(void); + virtual bool stop(void); + //! Call during work to consume items void consume_each(const int how_many_items); @@ -140,6 +143,10 @@ struct GR_CORE_API gr_block : gras::Block bool is_set_max_noutput_items(void) const; + const gr_io_signature_sptr &input_signature(void) const; + + const gr_io_signature_sptr &output_signature(void) const; + /******************************************************************* * Deal with input and output port configuration ******************************************************************/ @@ -308,12 +315,19 @@ struct GR_CORE_API gr_block : gras::Block //! notifications of new topological commits void notify_topology(const size_t, const size_t); + //! start notification + void notify_active(void); + + //! stop notification + void notify_inactive(void); + //! implements tag_propagation_policy() virtual void propagate_tags(const size_t, const gras::TagIter &); void _update_input_reserve(void); gras::BufferQueueSptr input_buffer_allocator(const size_t, const gras::SBufferConfig &); + gras::BufferQueueSptr output_buffer_allocator(const size_t, const gras::SBufferConfig &); }; diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc index 8c2794c63..c43f903a3 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc @@ -25,129 +25,28 @@ #endif #include <gr_hier_block2.h> -#include <gr_io_signature.h> -#include <gr_hier_block2_detail.h> -#include <iostream> -#define GR_HIER_BLOCK2_DEBUG 0 - -gr_hier_block2_sptr -gr_make_hier_block2(const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature) -{ - return gnuradio::get_initial_sptr(new gr_hier_block2(name, input_signature, output_signature)); -} - -gr_hier_block2::gr_hier_block2(const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature) - : gr_basic_block(name, input_signature, output_signature), - d_detail(new gr_hier_block2_detail(this)), - hier_message_ports_in(pmt::PMT_NIL), - hier_message_ports_out(pmt::PMT_NIL) -{ - // This bit of magic ensures that self() works in the constructors of derived classes. - gnuradio::detail::sptr_magic::create_and_stash_initial_sptr(this); -} - -gr_hier_block2::~gr_hier_block2() -{ - delete d_detail; -} - -gr_hier_block2::opaque_self -gr_hier_block2::self() +gr_hier_block2::gr_hier_block2(void) { - return shared_from_this(); + //NOP } -gr_hier_block2_sptr -gr_hier_block2::to_hier_block2() +gr_hier_block2::gr_hier_block2( + const std::string &name, + gr_io_signature_sptr input_signature, + gr_io_signature_sptr output_signature +): + gras::HierBlock(name) { - return cast_to_hier_block2_sptr(shared_from_this()); + this->set_input_signature(input_signature); + this->set_output_signature(output_signature); } -void -gr_hier_block2::connect(gr_basic_block_sptr block) -{ - d_detail->connect(block); -} - -void -gr_hier_block2::connect(gr_basic_block_sptr src, int src_port, - gr_basic_block_sptr dst, int dst_port) -{ - d_detail->connect(src, src_port, dst, dst_port); -} - -void -gr_hier_block2::msg_connect(gr_basic_block_sptr src, pmt::pmt_t srcport, - gr_basic_block_sptr dst, pmt::pmt_t dstport) -{ - if(!pmt::pmt_is_symbol(srcport)){throw std::runtime_error("bad port id"); } - d_detail->msg_connect(src, srcport, dst, dstport); -} - -void -gr_hier_block2::msg_connect(gr_basic_block_sptr src, std::string srcport, - gr_basic_block_sptr dst, std::string dstport) -{ - d_detail->msg_connect(src, pmt::mp(srcport), dst, pmt::mp(dstport)); -} - -void -gr_hier_block2::msg_disconnect(gr_basic_block_sptr src, pmt::pmt_t srcport, - gr_basic_block_sptr dst, pmt::pmt_t dstport) -{ - if(!pmt::pmt_is_symbol(srcport)){throw std::runtime_error("bad port id"); } - d_detail->msg_disconnect(src, srcport, dst, dstport); -} - -void -gr_hier_block2::msg_disconnect(gr_basic_block_sptr src, std::string srcport, - gr_basic_block_sptr dst, std::string dstport) -{ - d_detail->msg_disconnect(src, pmt::mp(srcport), dst, pmt::mp(dstport)); -} - -void -gr_hier_block2::disconnect(gr_basic_block_sptr block) -{ - d_detail->disconnect(block); -} - -void -gr_hier_block2::disconnect(gr_basic_block_sptr src, int src_port, - gr_basic_block_sptr dst, int dst_port) -{ - d_detail->disconnect(src, src_port, dst, dst_port); -} - -void -gr_hier_block2::disconnect_all() -{ - d_detail->disconnect_all(); -} - -void -gr_hier_block2::lock() -{ - d_detail->lock(); -} - -void -gr_hier_block2::unlock() -{ - d_detail->unlock(); -} - - -gr_flat_flowgraph_sptr -gr_hier_block2::flatten() const -{ - gr_flat_flowgraph_sptr new_ffg = gr_make_flat_flowgraph(); - d_detail->flatten_aux(new_ffg); - return new_ffg; +gr_hier_block2_sptr gr_make_hier_block2( + const std::string &name, + gr_io_signature_sptr input_signature, + gr_io_signature_sptr output_signature +){ + return gr_hier_block2_sptr(new gr_hier_block2(name, input_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 4163557ca..2ab04ac6f 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2.h +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.h @@ -36,7 +36,6 @@ struct GR_CORE_API gr_hier_block2 : gras::HierBlock { return *this; } - }; typedef boost::shared_ptr<gr_hier_block2> gr_hier_block2_sptr; @@ -47,28 +46,4 @@ GR_CORE_API gr_hier_block2_sptr gr_make_hier_block2( gr_io_signature_sptr output_signature ); -inline gr_hier_block2::gr_hier_block2(void) -{ - //NOP -} - -inline gr_hier_block2::gr_hier_block2( - const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature -): - gras::HierBlock(name) -{ - this->set_input_signature(input_signature); - this->set_output_signature(output_signature); -} - -inline gr_hier_block2_sptr gr_make_hier_block2( - const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature -){ - return gr_hier_block2_sptr(new gr_hier_block2(name, input_signature, output_signature)); -} - #endif /*INCLUDED_GNURADIO_GR_HIER_BLOCK2_H*/ diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.cc b/gnuradio-core/src/lib/runtime/gr_top_block.cc index e47473edd..da221c7d5 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_top_block.cc @@ -26,90 +26,65 @@ #include <unistd.h> #include <gr_top_block.h> -#include <gr_top_block_impl.h> -#include <gr_io_signature.h> -#include <iostream> -gr_top_block_sptr -gr_make_top_block(const std::string &name) +gr_top_block::gr_top_block(void): + //cannot make a null top block, use name constructor + gras::TopBlock("top") { - return gnuradio::get_initial_sptr(new gr_top_block(name)); + //NOP } -gr_top_block::gr_top_block(const std::string &name) - : gr_hier_block2(name, - gr_make_io_signature(0,0,0), - gr_make_io_signature(0,0,0)) - -{ - d_impl = new gr_top_block_impl(this); -} - -gr_top_block::~gr_top_block() -{ - stop(); - wait(); - - delete d_impl; -} - -void -gr_top_block::start(int max_noutput_items) +gr_top_block::gr_top_block(const std::string &name): + gras::TopBlock(name) { - d_impl->start(max_noutput_items); + //NOP } -void -gr_top_block::stop() +gr_top_block_sptr gr_make_top_block(const std::string &name) { - d_impl->stop(); + return gr_top_block_sptr(new gr_top_block(name)); } -void -gr_top_block::wait() +void gr_top_block::start(const size_t max_items) { - d_impl->wait(); + this->set_max_noutput_items(max_items); + this->start(); } -void -gr_top_block::run(int max_noutput_items) +void gr_top_block::run(const size_t max_items) { - start(max_noutput_items); - wait(); + this->set_max_noutput_items(max_items); + this->run(); } -void -gr_top_block::lock() +int gr_top_block::max_noutput_items(void) const { - d_impl->lock(); + return this->get_global_config().maximum_output_items; } -void -gr_top_block::unlock() +void gr_top_block::set_max_noutput_items(int max_items) { - d_impl->unlock(); + gras::GlobalBlockConfig config = this->get_global_config(); + config.maximum_output_items = max_items; + this->set_global_config(config); } -void -gr_top_block::dump() +void gr_top_block::run(void) { - d_impl->dump(); + gras::TopBlock::run(); } -int -gr_top_block::max_noutput_items() +void gr_top_block::start(void) { - return d_impl->max_noutput_items(); + gras::TopBlock::start(); } -void -gr_top_block::set_max_noutput_items(int nmax) +void gr_top_block::stop(void) { - d_impl->set_max_noutput_items(nmax); + gras::TopBlock::stop(); } -gr_top_block_sptr -gr_top_block::to_top_block() +void gr_top_block::wait(void) { - return cast_to_top_block_sptr(shared_from_this()); + gras::TopBlock::wait(); } diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h index 0e033f7c1..0126e9215 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block.h @@ -28,28 +28,26 @@ struct GR_CORE_API gr_top_block : gras::TopBlock gr_top_block(const std::string &name); -}; + void start(const size_t max_items); -typedef boost::shared_ptr<gr_top_block> gr_top_block_sptr; + void run(const size_t max_items); -GR_CORE_API gr_top_block_sptr gr_make_top_block(const std::string &name); + int max_noutput_items(void) const; -inline gr_top_block::gr_top_block(void): - //cannot make a null top block, use name constructor - gras::TopBlock("top") -{ - //NOP -} + void set_max_noutput_items(int max_items); -inline gr_top_block::gr_top_block(const std::string &name): - gras::TopBlock(name) -{ - //NOP -} + void run(void); -inline gr_top_block_sptr gr_make_top_block(const std::string &name) -{ - return gr_top_block_sptr(new gr_top_block(name)); -} + virtual void start(void); + + virtual void stop(void); + + virtual void wait(void); + +}; + +typedef boost::shared_ptr<gr_top_block> gr_top_block_sptr; + +GR_CORE_API gr_top_block_sptr gr_make_top_block(const std::string &name); #endif /*INCLUDED_GNURADIO_GR_TOP_BLOCK_H*/ |