diff options
Diffstat (limited to 'gnuradio-core/src/lib/runtime')
49 files changed, 331 insertions, 121 deletions
diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt new file mode 100644 index 000000000..52cb39c40 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt @@ -0,0 +1,162 @@ +# Copyright 2010-2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## + +######################################################################## +# Append gnuradio-core library sources +######################################################################## +list(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/gr_basic_block.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_flowgraph.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_flat_flowgraph.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_detail.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_executor.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 + ${CMAKE_CURRENT_SOURCE_DIR}/gr_error_handler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_io_signature.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_local_sighandler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_message.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_accepter.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_queue.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_pagesize.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_preferences.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_realtime.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler_sts.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler_tpb.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_single_threaded_scheduler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sptr_magic.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_block.cc + ${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_impl.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_detail.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_thread_body.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_mmap_shm_open.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_mmap_tmpfile.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_createfilemapping.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_sysv_shm.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_select_handler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_tag_info.cc +) + +######################################################################## +# Append gnuradio-core test sources +######################################################################## +list(APPEND test_gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_block.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2_derived.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_buffer.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_flowgraph.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_top_block.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_io_signature.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_vmcircbuf.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_block_tags.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_runtime.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_set_msg_handler.cc +) + +######################################################################## +# Install runtime headers +######################################################################## +install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/gr_basic_block.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_flowgraph.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_flat_flowgraph.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_detail.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_executor.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2_detail.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_buffer.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_complex.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_dispatcher.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_error_handler.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_io_signature.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_local_sighandler.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_message.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_accepter.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_queue.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_pagesize.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_preferences.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_realtime.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_runtime_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler_sts.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler_tpb.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_select_handler.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_single_threaded_scheduler.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sptr_magic.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_block.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_decimator.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_interpolator.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block_impl.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_detail.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_thread_body.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_timer.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sys_paths.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_unittests.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_tag_info.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "core_devel" +) + +######################################################################## +# Install swig headers +######################################################################## +if(ENABLE_PYTHON) +install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/gr_basic_block.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_detail.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_buffer.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_dispatcher.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_error_handler.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_io_signature.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_message.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_queue.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_realtime.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_single_threaded_scheduler.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_block.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_decimator.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_interpolator.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block.i + ${CMAKE_CURRENT_SOURCE_DIR}/runtime.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "core_swig" +) +endif(ENABLE_PYTHON) diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h index 3b0cd51dd..2adca8ccb 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.h +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_BASIC_BLOCK_H #define INCLUDED_GR_BASIC_BLOCK_H +#include <gr_core_api.h> #include <gr_runtime_types.h> #include <gr_sptr_magic.h> #include <boost/enable_shared_from_this.hpp> @@ -41,7 +42,7 @@ * signal processing functions. */ -class gr_basic_block : public gr_msg_accepter, public boost::enable_shared_from_this<gr_basic_block> +class GR_CORE_API gr_basic_block : public gr_msg_accepter, public boost::enable_shared_from_this<gr_basic_block> { typedef boost::function<void(pmt::pmt_t)> msg_handler_t; @@ -158,7 +159,7 @@ inline bool operator<(gr_basic_block_sptr lhs, gr_basic_block_sptr rhs) typedef std::vector<gr_basic_block_sptr> gr_basic_block_vector_t; typedef std::vector<gr_basic_block_sptr>::iterator gr_basic_block_viter_t; -long gr_basic_block_ncurrently_allocated(); +GR_CORE_API long gr_basic_block_ncurrently_allocated(); inline std::ostream &operator << (std::ostream &os, gr_basic_block_sptr basic_block) { diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index fc22f9ea8..2453e97b8 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_BLOCK_H #define INCLUDED_GR_BLOCK_H +#include <gr_core_api.h> #include <gr_basic_block.h> /*! @@ -53,7 +54,7 @@ * It reads the input items and writes the output items. */ -class gr_block : public gr_basic_block { +class GR_CORE_API gr_block : public gr_basic_block { public: @@ -300,7 +301,7 @@ class gr_block : public gr_basic_block { const pmt::pmt_t &key); // These are really only for internal use, but leaving them public avoids - // having to work up an ever-varying list of friends + // having to work up an ever-varying list of friend GR_CORE_APIs public: gr_block_detail_sptr detail () const { return d_detail; } diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index d7ec3b136..633da1b0c 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_BLOCK_DETAIL_H #define INCLUDED_GR_BLOCK_DETAIL_H +#include <gr_core_api.h> #include <gr_runtime_types.h> #include <gr_tpb_detail.h> #include <gr_tag_info.h> @@ -36,7 +37,7 @@ * of almost all users of GNU Radio. This decoupling also means that * we can make changes to the guts without having to recompile everything. */ -class gr_block_detail { +class GR_CORE_API gr_block_detail { public: ~gr_block_detail (); @@ -172,16 +173,16 @@ class gr_block_detail { gr_block_detail (unsigned int ninputs, unsigned int noutputs); - friend class gr_tpb_detail; + friend struct gr_tpb_detail; - friend gr_block_detail_sptr + friend GR_CORE_API gr_block_detail_sptr gr_make_block_detail (unsigned int ninputs, unsigned int noutputs); }; -gr_block_detail_sptr +GR_CORE_API gr_block_detail_sptr gr_make_block_detail (unsigned int ninputs, unsigned int noutputs); -long +GR_CORE_API long gr_block_detail_ncurrently_allocated (); #endif /* INCLUDED_GR_BLOCK_DETAIL_H */ diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index a8d0bc1c8..b3f987f72 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -29,6 +29,7 @@ #include <gr_block_detail.h> #include <gr_buffer.h> #include <boost/thread.hpp> +#include <boost/format.hpp> #include <iostream> #include <limits> #include <assert.h> @@ -165,9 +166,8 @@ gr_block_executor::gr_block_executor (gr_block_sptr block) : d_block(block), d_log(0) { if (ENABLE_LOGGING){ - char name[100]; - snprintf(name, sizeof(name), "sst-%03d.log", which_scheduler++); - d_log = new std::ofstream(name); + std::string name = str(boost::format("sst-%03d.log") % which_scheduler++); + d_log = new std::ofstream(name.c_str()); std::unitbuf(*d_log); // make it unbuffered... *d_log << "gr_block_executor: " << d_block << std::endl; diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.h b/gnuradio-core/src/lib/runtime/gr_block_executor.h index 77ace5522..cd93212e1 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.h +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_BLOCK_EXECUTOR_H #define INCLUDED_GR_BLOCK_EXECUTOR_H +#include <gr_core_api.h> #include <gr_runtime_types.h> #include <fstream> #include <gruel/pmt.h> @@ -36,7 +37,7 @@ * \ingroup internal */ -class gr_block_executor { +class GR_CORE_API gr_block_executor { protected: gr_block_sptr d_block; // The block we're trying to run std::ofstream *d_log; diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index e5725d386..e7c0a06a5 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_BUFFER_H #define INCLUDED_GR_BUFFER_H +#include <gr_core_api.h> #include <gr_runtime_types.h> #include <boost/weak_ptr.hpp> #include <gruel/thread.h> @@ -42,14 +43,14 @@ class gr_vmcircbuf; * \param sizeof_item is the size of an item in bytes. * \param link is the block that writes to this buffer. */ -gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link=gr_block_sptr()); +GR_CORE_API gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link=gr_block_sptr()); /*! * \brief Single writer, multiple reader fifo. * \ingroup internal */ -class gr_buffer { +class GR_CORE_API gr_buffer { public: virtual ~gr_buffer (); @@ -115,8 +116,8 @@ class gr_buffer { private: friend class gr_buffer_reader; - friend gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link); - friend gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link); + friend GR_CORE_API gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link); + friend GR_CORE_API gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link); protected: char *d_base; // base address of buffer @@ -192,11 +193,11 @@ class gr_buffer { * \param nzero_preload -- number of zero items to "preload" into buffer. * \param link is the block that reads from the buffer using this gr_buffer_reader. */ -gr_buffer_reader_sptr +GR_CORE_API gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link=gr_block_sptr()); //! returns # of gr_buffers currently allocated -long gr_buffer_ncurrently_allocated (); +GR_CORE_API long gr_buffer_ncurrently_allocated (); // --------------------------------------------------------------------------- @@ -206,7 +207,7 @@ long gr_buffer_ncurrently_allocated (); * \ingroup internal */ -class gr_buffer_reader { +class GR_CORE_API gr_buffer_reader { public: ~gr_buffer_reader (); @@ -276,7 +277,7 @@ class gr_buffer_reader { private: friend class gr_buffer; - friend gr_buffer_reader_sptr + friend GR_CORE_API gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link); @@ -290,7 +291,7 @@ class gr_buffer_reader { }; //! returns # of gr_buffer_readers currently allocated -long gr_buffer_reader_ncurrently_allocated (); +GR_CORE_API long gr_buffer_reader_ncurrently_allocated (); #endif /* INCLUDED_GR_BUFFER_H */ diff --git a/gnuradio-core/src/lib/runtime/gr_dispatcher.h b/gnuradio-core/src/lib/runtime/gr_dispatcher.h index 34f825102..735974766 100644 --- a/gnuradio-core/src/lib/runtime/gr_dispatcher.h +++ b/gnuradio-core/src/lib/runtime/gr_dispatcher.h @@ -23,14 +23,15 @@ #ifndef INCLUDED_GR_DISPATCHER_H #define INCLUDED_GR_DISPATCHER_H +#include <gr_core_api.h> #include <gr_select_handler.h> #include <vector> class gr_dispatcher; typedef boost::shared_ptr<gr_dispatcher> gr_dispatcher_sptr; -gr_dispatcher_sptr gr_dispatcher_singleton(); -gr_dispatcher_sptr gr_make_dispatcher(); +GR_CORE_API gr_dispatcher_sptr gr_dispatcher_singleton(); +GR_CORE_API gr_dispatcher_sptr gr_make_dispatcher(); /*! * \brief invoke callbacks based on select. @@ -38,10 +39,10 @@ gr_dispatcher_sptr gr_make_dispatcher(); * * \sa gr_select_handler */ -class gr_dispatcher +class GR_CORE_API gr_dispatcher { gr_dispatcher(); - friend gr_dispatcher_sptr gr_make_dispatcher(); + friend GR_CORE_API gr_dispatcher_sptr gr_make_dispatcher(); std::vector<gr_select_handler_sptr> d_handler; int d_max_index; diff --git a/gnuradio-core/src/lib/runtime/gr_error_handler.h b/gnuradio-core/src/lib/runtime/gr_error_handler.h index aedb6f41f..4c30791f2 100644 --- a/gnuradio-core/src/lib/runtime/gr_error_handler.h +++ b/gnuradio-core/src/lib/runtime/gr_error_handler.h @@ -43,6 +43,7 @@ #ifndef INCLUDED_GR_ERROR_HANDLER_H #define INCLUDED_GR_ERROR_HANDLER_H +#include <gr_core_api.h> #include <stdarg.h> #include <string> #include <cstdio> // for FILE @@ -51,7 +52,7 @@ * \brief abstract error handler * \ingroup base */ -class gr_error_handler { +class GR_CORE_API gr_error_handler { public: enum seriousness { ERR_DEBUG = 0x00000000, @@ -90,7 +91,7 @@ protected: }; -class gr_base_error_handler : public gr_error_handler { +class GR_CORE_API gr_base_error_handler : public gr_error_handler { int d_nwarnings; int d_nerrors; @@ -102,7 +103,7 @@ public: void count_error(seriousness s); }; -class gr_file_error_handler : public gr_base_error_handler { +class GR_CORE_API gr_file_error_handler : public gr_base_error_handler { FILE *d_file; int d_fd; public: diff --git a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h index 8e9834337..2cc883686 100644 --- a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h +++ b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h @@ -23,22 +23,23 @@ #ifndef INCLUDED_GR_FLAT_FLOWGRAPH_H #define INCLUDED_GR_FLAT_FLOWGRAPH_H +#include <gr_core_api.h> #include <gr_flowgraph.h> #include <gr_block.h> // Create a shared pointer to a heap allocated gr_flat_flowgraph // (types defined in gr_runtime_types.h) -gr_flat_flowgraph_sptr gr_make_flat_flowgraph(); +GR_CORE_API gr_flat_flowgraph_sptr gr_make_flat_flowgraph(); /*! *\brief Class specializing gr_flat_flowgraph that has all nodes * as gr_blocks, with no hierarchy * \ingroup internal */ -class gr_flat_flowgraph : public gr_flowgraph +class GR_CORE_API gr_flat_flowgraph : public gr_flowgraph { public: - friend gr_flat_flowgraph_sptr gr_make_flat_flowgraph(); + friend GR_CORE_API gr_flat_flowgraph_sptr gr_make_flat_flowgraph(); // Destruct an arbitrary gr_flat_flowgraph ~gr_flat_flowgraph(); diff --git a/gnuradio-core/src/lib/runtime/gr_flowgraph.h b/gnuradio-core/src/lib/runtime/gr_flowgraph.h index 8e988506b..8f9a8ba71 100644 --- a/gnuradio-core/src/lib/runtime/gr_flowgraph.h +++ b/gnuradio-core/src/lib/runtime/gr_flowgraph.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_FLOWGRAPH_H #define INCLUDED_GR_FLOWGRAPH_H +#include <gr_core_api.h> #include <gr_basic_block.h> #include <iostream> @@ -30,7 +31,7 @@ * \brief Class representing a specific input or output graph endpoint * \ingroup internal */ -class gr_endpoint +class GR_CORE_API gr_endpoint { private: gr_basic_block_sptr d_basic_block; @@ -59,7 +60,7 @@ typedef std::vector<gr_endpoint>::iterator gr_endpoint_viter_t; *\brief Class representing a connection between to graph endpoints * */ -class gr_edge +class GR_CORE_API gr_edge { public: gr_edge() : d_src(), d_dst() { }; @@ -81,16 +82,16 @@ typedef std::vector<gr_edge>::iterator gr_edge_viter_t; // Create a shared pointer to a heap allocated flowgraph // (types defined in gr_runtime_types.h) -gr_flowgraph_sptr gr_make_flowgraph(); +GR_CORE_API gr_flowgraph_sptr gr_make_flowgraph(); /*! * \brief Class representing a directed, acyclic graph of basic blocks * \ingroup internal */ -class gr_flowgraph +class GR_CORE_API gr_flowgraph { public: - friend gr_flowgraph_sptr gr_make_flowgraph(); + friend GR_CORE_API gr_flowgraph_sptr gr_make_flowgraph(); // Destruct an arbitrary flowgraph ~gr_flowgraph(); diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.h b/gnuradio-core/src/lib/runtime/gr_hier_block2.h index 0a40c36b7..8687b7d99 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2.h +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_HIER_BLOCK2_H #define INCLUDED_GR_HIER_BLOCK2_H +#include <gr_core_api.h> #include <gr_basic_block.h> /*! * \brief public constructor for gr_hier_block2 */ -gr_hier_block2_sptr gr_make_hier_block2(const std::string &name, +GR_CORE_API gr_hier_block2_sptr gr_make_hier_block2(const std::string &name, gr_io_signature_sptr input_signature, gr_io_signature_sptr output_signature); @@ -40,11 +41,11 @@ class gr_hier_block2_detail; * \ingroup base_blk * */ -class gr_hier_block2 : public gr_basic_block +class GR_CORE_API gr_hier_block2 : public gr_basic_block { private: friend class gr_hier_block2_detail; - friend gr_hier_block2_sptr gr_make_hier_block2(const std::string &name, + friend GR_CORE_API gr_hier_block2_sptr gr_make_hier_block2(const std::string &name, gr_io_signature_sptr input_signature, gr_io_signature_sptr output_signature); diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h b/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h index 6f5384e5a..5a77d6a03 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_HIER_BLOCK2_DETAIL_H #define INCLUDED_GR_HIER_BLOCK2_DETAIL_H +#include <gr_core_api.h> #include <gr_hier_block2.h> #include <gr_flat_flowgraph.h> #include <boost/utility.hpp> @@ -29,7 +30,7 @@ /*! * \ingroup internal */ -class gr_hier_block2_detail : boost::noncopyable +class GR_CORE_API gr_hier_block2_detail : boost::noncopyable { public: gr_hier_block2_detail(gr_hier_block2 *owner); diff --git a/gnuradio-core/src/lib/runtime/gr_io_signature.h b/gnuradio-core/src/lib/runtime/gr_io_signature.h index 5d194cf55..11c6b7f13 100644 --- a/gnuradio-core/src/lib/runtime/gr_io_signature.h +++ b/gnuradio-core/src/lib/runtime/gr_io_signature.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_IO_SIGNATURE_H #define INCLUDED_IO_SIGNATURE_H +#include <gr_core_api.h> #include <gr_runtime_types.h> /*! @@ -33,7 +34,7 @@ * \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite) * \param sizeof_stream_item specify the size of the items in each stream */ -gr_io_signature_sptr +GR_CORE_API gr_io_signature_sptr gr_make_io_signature(int min_streams, int max_streams, int sizeof_stream_item); @@ -45,7 +46,7 @@ gr_make_io_signature(int min_streams, int max_streams, * \param sizeof_stream_item1 specify the size of the items in the first stream * \param sizeof_stream_item2 specify the size of the items in the second and subsequent streams */ -gr_io_signature_sptr +GR_CORE_API gr_io_signature_sptr gr_make_io_signature2(int min_streams, int max_streams, int sizeof_stream_item1, int sizeof_stream_item2 @@ -60,7 +61,7 @@ gr_make_io_signature2(int min_streams, int max_streams, * \param sizeof_stream_item2 specify the size of the items in the second stream * \param sizeof_stream_item3 specify the size of the items in the third and subsequent streams */ -gr_io_signature_sptr +GR_CORE_API gr_io_signature_sptr gr_make_io_signature3(int min_streams, int max_streams, int sizeof_stream_item1, int sizeof_stream_item2, @@ -78,7 +79,7 @@ gr_make_io_signature3(int min_streams, int max_streams, * value of the last entry in sizeof_stream_items is used for the missing values. * sizeof_stream_items must contain at least 1 entry. */ -gr_io_signature_sptr +GR_CORE_API gr_io_signature_sptr gr_make_io_signaturev(int min_streams, int max_streams, const std::vector<int> &sizeof_stream_items); @@ -87,7 +88,7 @@ gr_make_io_signaturev(int min_streams, int max_streams, * \brief i/o signature for input and output ports. * \brief misc */ -class gr_io_signature { +class GR_CORE_API gr_io_signature { int d_min_streams; int d_max_streams; std::vector<int> d_sizeof_stream_item; @@ -95,7 +96,7 @@ class gr_io_signature { gr_io_signature(int min_streams, int max_streams, const std::vector<int> &sizeof_stream_items); - friend gr_io_signature_sptr + friend GR_CORE_API gr_io_signature_sptr gr_make_io_signaturev(int min_streams, int max_streams, const std::vector<int> &sizeof_stream_items); diff --git a/gnuradio-core/src/lib/runtime/gr_local_sighandler.h b/gnuradio-core/src/lib/runtime/gr_local_sighandler.h index 6b60cf09a..9e4eacc47 100644 --- a/gnuradio-core/src/lib/runtime/gr_local_sighandler.h +++ b/gnuradio-core/src/lib/runtime/gr_local_sighandler.h @@ -27,6 +27,7 @@ #include <signal.h> #endif +#include <gr_core_api.h> #include <string> /*! @@ -36,7 +37,7 @@ * Constructor installs new handler, destructor reinstalls * original value. */ -class gr_local_sighandler { +class GR_CORE_API gr_local_sighandler { int d_signum; #ifdef HAVE_SIGACTION struct sigaction d_old_action; @@ -52,7 +53,7 @@ public: /*! * \brief Representation of signal. */ -class gr_signal +class GR_CORE_API gr_signal { int d_signum; public: diff --git a/gnuradio-core/src/lib/runtime/gr_message.h b/gnuradio-core/src/lib/runtime/gr_message.h index 179f7d9bc..ead002616 100644 --- a/gnuradio-core/src/lib/runtime/gr_message.h +++ b/gnuradio-core/src/lib/runtime/gr_message.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_MESSAGE_H #define INCLUDED_GR_MESSAGE_H +#include <gr_core_api.h> #include <gr_types.h> #include <string> @@ -31,10 +32,10 @@ typedef boost::shared_ptr<gr_message> gr_message_sptr; /*! * \brief public constructor for gr_message */ -gr_message_sptr +GR_CORE_API gr_message_sptr gr_make_message(long type = 0, double arg1 = 0, double arg2 = 0, size_t length = 0); -gr_message_sptr +GR_CORE_API gr_message_sptr gr_make_message_from_string(const std::string s, long type = 0, double arg1 = 0, double arg2 = 0); /*! @@ -44,7 +45,7 @@ gr_make_message_from_string(const std::string s, long type = 0, double arg1 = 0, * The ideas and method names for adjustable message length were * lifted from the click modular router "Packet" class. */ -class gr_message { +class GR_CORE_API gr_message { gr_message_sptr d_next; // link field for msg queue long d_type; // type of the message double d_arg1; // optional arg1 @@ -57,10 +58,10 @@ class gr_message { gr_message (long type, double arg1, double arg2, size_t length); - friend gr_message_sptr + friend GR_CORE_API gr_message_sptr gr_make_message (long type, double arg1, double arg2, size_t length); - friend gr_message_sptr + friend GR_CORE_API gr_message_sptr gr_make_message_from_string (const std::string s, long type, double arg1, double arg2); friend class gr_msg_queue; @@ -85,6 +86,6 @@ public: }; -long gr_message_ncurrently_allocated (); +GR_CORE_API long gr_message_ncurrently_allocated (); #endif /* INCLUDED_GR_MESSAGE_H */ diff --git a/gnuradio-core/src/lib/runtime/gr_msg_accepter.h b/gnuradio-core/src/lib/runtime/gr_msg_accepter.h index 79a631f3a..4aec127a9 100644 --- a/gnuradio-core/src/lib/runtime/gr_msg_accepter.h +++ b/gnuradio-core/src/lib/runtime/gr_msg_accepter.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_MSG_ACCEPTER_H #define INCLUDED_GR_MSG_ACCEPTER_H +#include <gr_core_api.h> #include <gruel/msg_accepter.h> #include <gruel/pmt.h> @@ -29,7 +30,7 @@ * \brief Accepts messages and inserts them into a message queue, then notifies * subclass gr_basic_block there is a message pending. */ -class gr_msg_accepter : public gruel::msg_accepter +class GR_CORE_API gr_msg_accepter : public gruel::msg_accepter { public: gr_msg_accepter(); diff --git a/gnuradio-core/src/lib/runtime/gr_msg_handler.h b/gnuradio-core/src/lib/runtime/gr_msg_handler.h index 774dce73e..ebe3ffe37 100644 --- a/gnuradio-core/src/lib/runtime/gr_msg_handler.h +++ b/gnuradio-core/src/lib/runtime/gr_msg_handler.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_MSG_HANDLER_H #define INCLUDED_GR_MSG_HANDLER_H +#include <gr_core_api.h> #include <gr_message.h> class gr_msg_handler; @@ -31,7 +32,7 @@ typedef boost::shared_ptr<gr_msg_handler> gr_msg_handler_sptr; * \brief abstract class of message handlers * \ingroup base */ -class gr_msg_handler { +class GR_CORE_API gr_msg_handler { public: virtual ~gr_msg_handler (); diff --git a/gnuradio-core/src/lib/runtime/gr_msg_queue.h b/gnuradio-core/src/lib/runtime/gr_msg_queue.h index 477b1ddf1..bf7b89882 100644 --- a/gnuradio-core/src/lib/runtime/gr_msg_queue.h +++ b/gnuradio-core/src/lib/runtime/gr_msg_queue.h @@ -22,19 +22,20 @@ #ifndef INCLUDED_GR_MSG_QUEUE_H #define INCLUDED_GR_MSG_QUEUE_H +#include <gr_core_api.h> #include <gr_msg_handler.h> #include <gruel/thread.h> class gr_msg_queue; typedef boost::shared_ptr<gr_msg_queue> gr_msg_queue_sptr; -gr_msg_queue_sptr gr_make_msg_queue(unsigned int limit=0); +GR_CORE_API gr_msg_queue_sptr gr_make_msg_queue(unsigned int limit=0); /*! * \brief thread-safe message queue * \ingroup misc */ -class gr_msg_queue : public gr_msg_handler { +class GR_CORE_API gr_msg_queue : public gr_msg_handler { gruel::mutex d_mutex; gruel::condition_variable d_not_empty; diff --git a/gnuradio-core/src/lib/runtime/gr_pagesize.h b/gnuradio-core/src/lib/runtime/gr_pagesize.h index 3c1b8eb6b..60dad42c9 100644 --- a/gnuradio-core/src/lib/runtime/gr_pagesize.h +++ b/gnuradio-core/src/lib/runtime/gr_pagesize.h @@ -22,11 +22,13 @@ #ifndef _GR_PAGESIZE_H_ #define _GR_PAGESIZE_H_ +#include <gr_core_api.h> + /*! * \brief return the page size in bytes */ -int gr_pagesize (); +GR_CORE_API int gr_pagesize (); -#endif /* _GR_PAGESIZE_H_ */ +#endif /* _GR_PAGESIZE_H_ */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/runtime/gr_preferences.h b/gnuradio-core/src/lib/runtime/gr_preferences.h index 7f2a25e6b..ab4dc0cb0 100644 --- a/gnuradio-core/src/lib/runtime/gr_preferences.h +++ b/gnuradio-core/src/lib/runtime/gr_preferences.h @@ -23,10 +23,12 @@ #ifndef _GR_PREFERENCES_H_ #define _GR_PREFERENCES_H_ -class gr_preferences { +#include <gr_core_api.h> + +class GR_CORE_API gr_preferences { public: static const char *get (const char *key); static void set (const char *key, const char *value); }; -#endif /* _GR_PREFERENCES_H_ */ +#endif /* _GR_PREFERENCES_H_ */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/runtime/gr_realtime.h b/gnuradio-core/src/lib/runtime/gr_realtime.h index 830c201d7..58db83086 100644 --- a/gnuradio-core/src/lib/runtime/gr_realtime.h +++ b/gnuradio-core/src/lib/runtime/gr_realtime.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_REALTIME_H #define INCLUDED_GR_REALTIME_H +#include <gr_core_api.h> #include <gruel/realtime.h> typedef gruel::rt_status_t gr_rt_status_t; @@ -31,6 +32,6 @@ typedef gruel::rt_status_t gr_rt_status_t; * \brief If possible, enable high-priority "real time" scheduling. * \ingroup misc */ -gr_rt_status_t gr_enable_realtime_scheduling(); +GR_CORE_API gr_rt_status_t gr_enable_realtime_scheduling(); #endif /* INCLUDED_GR_REALTIME_H */ diff --git a/gnuradio-core/src/lib/runtime/gr_runtime_types.h b/gnuradio-core/src/lib/runtime/gr_runtime_types.h index 74d2614a8..98f08b417 100644 --- a/gnuradio-core/src/lib/runtime/gr_runtime_types.h +++ b/gnuradio-core/src/lib/runtime/gr_runtime_types.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_RUNTIME_TYPES_H #define INCLUDED_GR_RUNTIME_TYPES_H +#include <gr_core_api.h> #include <gr_types.h> /* diff --git a/gnuradio-core/src/lib/runtime/gr_scheduler.h b/gnuradio-core/src/lib/runtime/gr_scheduler.h index 13bc1ff14..4e97b5881 100644 --- a/gnuradio-core/src/lib/runtime/gr_scheduler.h +++ b/gnuradio-core/src/lib/runtime/gr_scheduler.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_SCHEDULER_H #define INCLUDED_GR_SCHEDULER_H +#include <gr_core_api.h> #include <boost/utility.hpp> #include <gr_block.h> #include <gr_flat_flowgraph.h> @@ -36,7 +37,7 @@ typedef boost::shared_ptr<gr_scheduler> gr_scheduler_sptr; * * Preconditions: details, buffers and buffer readers have been assigned. */ -class gr_scheduler : boost::noncopyable +class GR_CORE_API gr_scheduler : boost::noncopyable { public: diff --git a/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h b/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h index 4cf835156..9b73b68c1 100644 --- a/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h +++ b/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h @@ -21,13 +21,14 @@ #ifndef INCLUDED_GR_SCHEDULER_STS_H #define INCLUDED_GR_SCHEDULER_STS_H +#include <gr_core_api.h> #include <gr_scheduler.h> #include <gruel/thread_group.h> /*! * \brief Concrete scheduler that uses the single_threaded_scheduler */ -class gr_scheduler_sts : public gr_scheduler +class GR_CORE_API gr_scheduler_sts : public gr_scheduler { gruel::thread_group d_threads; diff --git a/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.h b/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.h index 16a0c0204..f97ab2e7f 100644 --- a/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.h +++ b/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.h @@ -21,13 +21,14 @@ #ifndef INCLUDED_GR_SCHEDULER_TPB_H #define INCLUDED_GR_SCHEDULER_TPB_H +#include <gr_core_api.h> #include <gr_scheduler.h> #include <gruel/thread_group.h> /*! * \brief Concrete scheduler that uses a kernel thread-per-block */ -class gr_scheduler_tpb : public gr_scheduler +class GR_CORE_API gr_scheduler_tpb : public gr_scheduler { gruel::thread_group d_threads; diff --git a/gnuradio-core/src/lib/runtime/gr_select_handler.h b/gnuradio-core/src/lib/runtime/gr_select_handler.h index c3808995b..532707a02 100644 --- a/gnuradio-core/src/lib/runtime/gr_select_handler.h +++ b/gnuradio-core/src/lib/runtime/gr_select_handler.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SELECT_HANDLER_H #define INCLUDED_GR_SELECT_HANDLER_H +#include <gr_core_api.h> #include <boost/shared_ptr.hpp> class gr_select_handler; @@ -35,7 +36,7 @@ typedef boost::shared_ptr<gr_select_handler> gr_select_handler_sptr; * * \sa gr_dispatcher */ -class gr_select_handler +class GR_CORE_API gr_select_handler { int d_fd; diff --git a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc index 7f1b40641..ae04e4a65 100644 --- a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc +++ b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc @@ -29,6 +29,7 @@ #include <gr_block_detail.h> #include <gr_buffer.h> #include <boost/thread.hpp> +#include <boost/format.hpp> #include <iostream> #include <limits> #include <assert.h> @@ -57,9 +58,8 @@ gr_single_threaded_scheduler::gr_single_threaded_scheduler ( : d_blocks (blocks), d_enabled (true), d_log(0) { if (ENABLE_LOGGING){ - char name[100]; - snprintf(name, sizeof(name), "sst-%d.log", which_scheduler++); - d_log = new std::ofstream(name); + std::string name = str(boost::format("sst-%d.log") % which_scheduler++); + d_log = new std::ofstream(name.c_str()); *d_log << "gr_single_threaded_scheduler: " << d_blocks.size () << " blocks\n"; diff --git a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h index 060d3017d..17f4a1c54 100644 --- a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h +++ b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H #define INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H +#include <gr_core_api.h> #include <gr_runtime_types.h> #include <fstream> @@ -35,7 +36,7 @@ typedef boost::shared_ptr<gr_single_threaded_scheduler> gr_single_threaded_sched * \ingroup internal */ -class gr_single_threaded_scheduler { +class GR_CORE_API gr_single_threaded_scheduler { public: ~gr_single_threaded_scheduler (); @@ -51,11 +52,11 @@ class gr_single_threaded_scheduler { void main_loop (); - friend gr_single_threaded_scheduler_sptr + friend GR_CORE_API gr_single_threaded_scheduler_sptr gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &blocks); }; -gr_single_threaded_scheduler_sptr +GR_CORE_API gr_single_threaded_scheduler_sptr gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &blocks); #endif /* INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H */ diff --git a/gnuradio-core/src/lib/runtime/gr_sptr_magic.h b/gnuradio-core/src/lib/runtime/gr_sptr_magic.h index 872374ab6..4b7f9899d 100644 --- a/gnuradio-core/src/lib/runtime/gr_sptr_magic.h +++ b/gnuradio-core/src/lib/runtime/gr_sptr_magic.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_GR_SPTR_MAGIC_H #define INCLUDED_GR_SPTR_MAGIC_H +#include <gr_core_api.h> #include <boost/shared_ptr.hpp> class gr_basic_block; @@ -30,7 +31,7 @@ namespace gnuradio { namespace detail { - class sptr_magic { + class GR_CORE_API sptr_magic { public: static boost::shared_ptr<gr_basic_block> fetch_initial_sptr(gr_basic_block *p); static void create_and_stash_initial_sptr(gr_hier_block2 *p); diff --git a/gnuradio-core/src/lib/runtime/gr_sync_block.h b/gnuradio-core/src/lib/runtime/gr_sync_block.h index c5a6a50f1..808c1c18a 100644 --- a/gnuradio-core/src/lib/runtime/gr_sync_block.h +++ b/gnuradio-core/src/lib/runtime/gr_sync_block.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SYNC_BLOCK_H #define INCLUDED_GR_SYNC_BLOCK_H +#include <gr_core_api.h> #include <gr_block.h> /*! @@ -31,7 +32,7 @@ * * Override work to provide the signal processing implementation. */ -class gr_sync_block : public gr_block +class GR_CORE_API gr_sync_block : public gr_block { protected: gr_sync_block (void){} //allows pure virtual interface sub-classes diff --git a/gnuradio-core/src/lib/runtime/gr_sync_decimator.h b/gnuradio-core/src/lib/runtime/gr_sync_decimator.h index 12cd54195..b2ed3c4fe 100644 --- a/gnuradio-core/src/lib/runtime/gr_sync_decimator.h +++ b/gnuradio-core/src/lib/runtime/gr_sync_decimator.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SYNC_DECIMATOR_H #define INCLUDED_GR_SYNC_DECIMATOR_H +#include <gr_core_api.h> #include <gr_sync_block.h> /*! @@ -31,7 +32,7 @@ * * Override work to provide the signal processing implementation. */ -class gr_sync_decimator : public gr_sync_block +class GR_CORE_API gr_sync_decimator : public gr_sync_block { private: unsigned d_decimation; diff --git a/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h b/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h index 0363bc55c..d65b3da1e 100644 --- a/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h +++ b/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SYNC_INTERPOLATOR_H #define INCLUDED_GR_SYNC_INTERPOLATOR_H +#include <gr_core_api.h> #include <gr_sync_block.h> /*! @@ -31,7 +32,7 @@ * * Override work to provide the signal processing implementation. */ -class gr_sync_interpolator : public gr_sync_block +class GR_CORE_API gr_sync_interpolator : public gr_sync_block { private: unsigned d_interpolation; diff --git a/gnuradio-core/src/lib/runtime/gr_sys_paths.h b/gnuradio-core/src/lib/runtime/gr_sys_paths.h index aa8249775..1f1759c36 100644 --- a/gnuradio-core/src/lib/runtime/gr_sys_paths.h +++ b/gnuradio-core/src/lib/runtime/gr_sys_paths.h @@ -22,10 +22,12 @@ #ifndef _GR_SYS_PATHS_H_ #define _GR_SYS_PATHS_H_ +#include <gr_core_api.h> + //! directory to create temporary files -const char *gr_tmp_path(); +GR_CORE_API const char *gr_tmp_path(); //! directory to store application data -const char *gr_appdata_path(); +GR_CORE_API const char *gr_appdata_path(); #endif /* _GR_SYS_PATHS_H_ */ diff --git a/gnuradio-core/src/lib/runtime/gr_timer.h b/gnuradio-core/src/lib/runtime/gr_timer.h index ff14e315d..fa3c06ece 100644 --- a/gnuradio-core/src/lib/runtime/gr_timer.h +++ b/gnuradio-core/src/lib/runtime/gr_timer.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_TIMER_H #define INCLUDED_GR_TIMER_H +#include <gr_core_api.h> #include <gr_types.h> class gr_timer; typedef boost::shared_ptr<gr_timer> gr_timer_sptr; -typedef void (*gr_timer_hook)(gr_timer *, void *); +GR_CORE_API typedef void (*gr_timer_hook)(gr_timer *, void *); /*! * \brief create a timeout. @@ -36,18 +37,18 @@ typedef void (*gr_timer_hook)(gr_timer *, void *); * \ingroup misc * gr_timer_hook is called when timer fires. */ -gr_timer_sptr gr_make_timer (gr_timer_hook, void *); +GR_CORE_API gr_timer_sptr gr_make_timer (gr_timer_hook, void *); /*! * \brief implement timeouts */ -class gr_timer { +class GR_CORE_API gr_timer { double d_expiry; double d_period; gr_timer_hook d_hook; void *d_hook_arg; - friend gr_timer_sptr gr_make_timer (gr_timer_hook, void *); + friend GR_CORE_API gr_timer_sptr gr_make_timer (gr_timer_hook, void *); gr_timer (...); diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h index ed244cb7c..fca68ae71 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block.h @@ -23,21 +23,22 @@ #ifndef INCLUDED_GR_TOP_BLOCK_H #define INCLUDED_GR_TOP_BLOCK_H +#include <gr_core_api.h> #include <gr_hier_block2.h> class gr_top_block_impl; -gr_top_block_sptr gr_make_top_block(const std::string &name); +GR_CORE_API gr_top_block_sptr gr_make_top_block(const std::string &name); /*! *\brief Top-level hierarchical block representing a flowgraph * \ingroup container_blk * */ -class gr_top_block : public gr_hier_block2 +class GR_CORE_API gr_top_block : public gr_hier_block2 { private: - friend gr_top_block_sptr gr_make_top_block(const std::string &name); + friend GR_CORE_API gr_top_block_sptr gr_make_top_block(const std::string &name); gr_top_block_impl *d_impl; diff --git a/gnuradio-core/src/lib/runtime/gr_top_block_impl.h b/gnuradio-core/src/lib/runtime/gr_top_block_impl.h index ef28dd829..904443be5 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block_impl.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block_impl.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_TOP_BLOCK_IMPL_H #define INCLUDED_GR_TOP_BLOCK_IMPL_H +#include <gr_core_api.h> #include <gr_scheduler.h> #include <gruel/thread.h> @@ -34,7 +35,7 @@ * decoupling of changes from dependent classes. * */ -class gr_top_block_impl +class GR_CORE_API gr_top_block_impl { public: gr_top_block_impl(gr_top_block *owner); diff --git a/gnuradio-core/src/lib/runtime/gr_tpb_detail.h b/gnuradio-core/src/lib/runtime/gr_tpb_detail.h index acfa264c7..90908c2f5 100644 --- a/gnuradio-core/src/lib/runtime/gr_tpb_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_tpb_detail.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_GR_TPB_DETAIL_H #define INCLUDED_GR_TPB_DETAIL_H +#include <gr_core_api.h> #include <gruel/thread.h> #include <deque> #include <gruel/pmt.h> @@ -30,7 +31,7 @@ class gr_block_detail; /*! * \brief used by thread-per-block scheduler */ -struct gr_tpb_detail { +struct GR_CORE_API gr_tpb_detail { gruel::mutex mutex; //< protects all vars bool input_changed; diff --git a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.h b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.h index a630b1be9..548cfedfb 100644 --- a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.h +++ b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_GR_TPB_THREAD_BODY_H #define INCLUDED_GR_TPB_THREAD_BODY_H +#include <gr_core_api.h> #include <gr_block_executor.h> #include <gr_block.h> #include <gr_block_detail.h> @@ -33,7 +34,7 @@ * done or is interrupted. */ -class gr_tpb_thread_body { +class GR_CORE_API gr_tpb_thread_body { gr_block_executor d_exec; public: diff --git a/gnuradio-core/src/lib/runtime/gr_types.h b/gnuradio-core/src/lib/runtime/gr_types.h index ad8f145b8..fd5ca7758 100644 --- a/gnuradio-core/src/lib/runtime/gr_types.h +++ b/gnuradio-core/src/lib/runtime/gr_types.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_TYPES_H #define INCLUDED_GR_TYPES_H +#include <gr_core_api.h> #include <boost/shared_ptr.hpp> #include <vector> #include <stddef.h> // size_t diff --git a/gnuradio-core/src/lib/runtime/gr_unittests.h b/gnuradio-core/src/lib/runtime/gr_unittests.h index 59149bb2e..7161b31e7 100644 --- a/gnuradio-core/src/lib/runtime/gr_unittests.h +++ b/gnuradio-core/src/lib/runtime/gr_unittests.h @@ -24,12 +24,14 @@ #include "config.h" #endif +#include <gr_core_api.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> +#include <string> #include <boost/filesystem/operations.hpp> #include <boost/filesystem/path.hpp> diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc index 3b8a6e617..7138605c9 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc @@ -30,6 +30,8 @@ #include <stdio.h> #include <string.h> #include <gr_local_sighandler.h> +#include <vector> +#include <boost/format.hpp> // all the factories we know about #include <gr_vmcircbuf_createfilemapping.h> @@ -130,7 +132,7 @@ init_buffer (gr_vmcircbuf *c, int counter, int size) } static bool -check_mapping (gr_vmcircbuf *c, int counter, int size, char *msg, bool verbose) +check_mapping (gr_vmcircbuf *c, int counter, int size, const char *msg, bool verbose) { bool ok = true; @@ -163,28 +165,28 @@ check_mapping (gr_vmcircbuf *c, int counter, int size, char *msg, bool verbose) return ok; } -static char * +static const char * memsize (int size) { - static char buf[100]; + static std::string buf; if (size >= (1 << 20)){ - snprintf (buf, sizeof (buf), "%dMB", size / (1 << 20)); + buf = str(boost::format("%dMB") % (size / (1 << 20))); } else if (size >= (1 << 10)){ - snprintf (buf, sizeof (buf), "%dKB", size / (1 << 10)); + buf = str(boost::format("%dKB") % (size / (1 << 10))); } else { - snprintf (buf, sizeof (buf), "%d", size); + buf = str(boost::format("%d") % size); } - return buf; + return buf.c_str(); } static bool test_a_bunch (gr_vmcircbuf_factory *factory, int n, int size, int *start_ptr, bool verbose) { bool ok = true; - int counter[n]; - gr_vmcircbuf *c[n]; + std::vector<int> counter(n); + std::vector<gr_vmcircbuf *> c(n); int cum_size = 0; for (int i = 0; i < n; i++){ @@ -202,9 +204,8 @@ test_a_bunch (gr_vmcircbuf_factory *factory, int n, int size, int *start_ptr, bo } for (int i = 0; i < n; i++){ - char msg[100]; - snprintf (msg, sizeof (msg), "test_a_bunch_%dx%s[%d]", n, memsize (size), i); - ok &= check_mapping (c[i], counter[i], size, msg, verbose); + std::string msg = str(boost::format("test_a_bunch_%dx%s[%d]") % n % memsize (size) % i); + ok &= check_mapping (c[i], counter[i], size, msg.c_str(), verbose); } for (int i = 0; i < n; i++){ diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf.h index a73a1559c..0e67d405b 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf.h +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf.h @@ -23,13 +23,14 @@ #ifndef _GR_VMCIRCBUF_H_ #define _GR_VMCIRCBUF_H_ +#include <gr_core_api.h> #include <vector> /*! * \brief abstract class to implement doubly mapped virtual memory circular buffers * \ingroup internal */ -class gr_vmcircbuf { +class GR_CORE_API gr_vmcircbuf { protected: int d_size; char *d_base; @@ -48,7 +49,7 @@ class gr_vmcircbuf { /*! * \brief abstract factory for creating circular buffers */ -class gr_vmcircbuf_factory { +class GR_CORE_API gr_vmcircbuf_factory { protected: gr_vmcircbuf_factory () {}; virtual ~gr_vmcircbuf_factory (); @@ -76,7 +77,7 @@ class gr_vmcircbuf_factory { /* * \brief pulls together all implementations of gr_vmcircbuf */ -class gr_vmcircbuf_sysconfig { +class GR_CORE_API gr_vmcircbuf_sysconfig { public: /* diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc index 42c459484..1b4d9700a 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc @@ -37,6 +37,7 @@ #include <stdio.h> #include <gr_pagesize.h> #include <gr_vmcircbuf_createfilemapping.h> +#include <boost/format.hpp> #ifdef HAVE_CREATEFILEMAPPING // Print Windows error (could/should be global?) @@ -72,23 +73,21 @@ gr_vmcircbuf_createfilemapping::gr_vmcircbuf_createfilemapping (int size) throw std::runtime_error ("gr_vmcircbuf_createfilemapping"); } - char seg_name[1024]; - snprintf (seg_name, sizeof (seg_name), "/gnuradio-%d-%d", getpid (), s_seg_counter); + std::string seg_name = str(boost::format("/gnuradio-%d-%d") % getpid () % s_seg_counter); d_handle = CreateFileMapping(INVALID_HANDLE_VALUE, // use paging file NULL, // default security PAGE_READWRITE, // read/write access 0, // max. object size size, // buffer size - seg_name); // name of mapping object + seg_name.c_str()); // name of mapping object s_seg_counter++; if (d_handle == NULL || d_handle == INVALID_HANDLE_VALUE){ - char msg[1024]; - snprintf( msg, sizeof(msg), - "gr_vmcircbuf_mmap_createfilemapping: CreateFileMapping [%s]", + std::string msg = str(boost::format( + "gr_vmcircbuf_mmap_createfilemapping: CreateFileMapping [%s]") % seg_name ); - werror( msg, GetLastError() ); + werror((char *) msg.c_str(), GetLastError() ); throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping"); } diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.h index 9276ae98b..5ef31f5c6 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.h +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.h @@ -23,6 +23,7 @@ #ifndef _GR_VMCIRCBUF_CREATEFILEMAPPING_H_ #define _GR_VMCIRCBUF_CREATEFILEMAPPING_H_ +#include <gr_core_api.h> #include <gr_vmcircbuf.h> #ifdef HAVE_CREATEFILEMAPPING @@ -32,7 +33,7 @@ * \brief concrete class to implement circular buffers with mmap and shm_open * \ingroup internal */ -class gr_vmcircbuf_createfilemapping : public gr_vmcircbuf +class GR_CORE_API gr_vmcircbuf_createfilemapping : public gr_vmcircbuf { public: // CREATORS @@ -49,7 +50,7 @@ class gr_vmcircbuf_createfilemapping : public gr_vmcircbuf /*! * \brief concrete factory for circular buffers built using mmap and shm_open */ -class gr_vmcircbuf_createfilemapping_factory : public gr_vmcircbuf_factory +class GR_CORE_API gr_vmcircbuf_createfilemapping_factory : public gr_vmcircbuf_factory { private: static gr_vmcircbuf_factory *s_the_factory; diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.h index 238f44414..002f5b434 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.h +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.h @@ -23,13 +23,14 @@ #ifndef _GR_VMCIRCBUF_MMAP_SHM_OPEN_H_ #define _GR_VMCIRCBUF_MMAP_SHM_OPEN_H_ +#include <gr_core_api.h> #include <gr_vmcircbuf.h> /*! * \brief concrete class to implement circular buffers with mmap and shm_open * \ingroup internal */ -class gr_vmcircbuf_mmap_shm_open : public gr_vmcircbuf { +class GR_CORE_API gr_vmcircbuf_mmap_shm_open : public gr_vmcircbuf { public: // CREATORS @@ -41,7 +42,7 @@ class gr_vmcircbuf_mmap_shm_open : public gr_vmcircbuf { /*! * \brief concrete factory for circular buffers built using mmap and shm_open */ -class gr_vmcircbuf_mmap_shm_open_factory : public gr_vmcircbuf_factory { +class GR_CORE_API gr_vmcircbuf_mmap_shm_open_factory : public gr_vmcircbuf_factory { private: static gr_vmcircbuf_factory *s_the_factory; diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.h index e5be52768..a2ed6b87b 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.h +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.h @@ -23,13 +23,14 @@ #ifndef _GR_VMCIRCBUF_MMAP_TMPFILE_H_ #define _GR_VMCIRCBUF_MMAP_TMPFILE_H_ +#include <gr_core_api.h> #include <gr_vmcircbuf.h> /*! * \brief concrete class to implement circular buffers with mmap and shm_open * \ingroup internal */ -class gr_vmcircbuf_mmap_tmpfile : public gr_vmcircbuf { +class GR_CORE_API gr_vmcircbuf_mmap_tmpfile : public gr_vmcircbuf { public: // CREATORS @@ -41,7 +42,7 @@ class gr_vmcircbuf_mmap_tmpfile : public gr_vmcircbuf { /*! * \brief concrete factory for circular buffers built using mmap and shm_open */ -class gr_vmcircbuf_mmap_tmpfile_factory : public gr_vmcircbuf_factory { +class GR_CORE_API gr_vmcircbuf_mmap_tmpfile_factory : public gr_vmcircbuf_factory { private: static gr_vmcircbuf_factory *s_the_factory; diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.h index cc87f8fe6..c7a008581 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.h +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.h @@ -23,13 +23,14 @@ #ifndef _GR_VMCIRCBUF_SYSV_SHM_H_ #define _GR_VMCIRCBUF_SYSV_SHM_H_ +#include <gr_core_api.h> #include <gr_vmcircbuf.h> /*! * \brief concrete class to implement circular buffers with mmap and shm_open * \ingroup internal */ -class gr_vmcircbuf_sysv_shm : public gr_vmcircbuf { +class GR_CORE_API gr_vmcircbuf_sysv_shm : public gr_vmcircbuf { public: // CREATORS @@ -41,7 +42,7 @@ class gr_vmcircbuf_sysv_shm : public gr_vmcircbuf { /*! * \brief concrete factory for circular buffers built using mmap and shm_open */ -class gr_vmcircbuf_sysv_shm_factory : public gr_vmcircbuf_factory { +class GR_CORE_API gr_vmcircbuf_sysv_shm_factory : public gr_vmcircbuf_factory { private: static gr_vmcircbuf_factory *s_the_factory; diff --git a/gnuradio-core/src/lib/runtime/qa_runtime.h b/gnuradio-core/src/lib/runtime/qa_runtime.h index c55208c39..e1038aaf6 100644 --- a/gnuradio-core/src/lib/runtime/qa_runtime.h +++ b/gnuradio-core/src/lib/runtime/qa_runtime.h @@ -23,11 +23,12 @@ #ifndef _QA_RUNTIME_H_ #define _QA_RUNTIME_H_ +#include <gruel/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for the runtime directory -class qa_runtime { +class __GR_ATTR_EXPORT qa_runtime { public: //! return suite of tests for all of runtime directory static CppUnit::TestSuite *suite (); |