diff options
1729 files changed, 25070 insertions, 25901 deletions
diff --git a/docs/doxygen/other/logger.dox b/docs/doxygen/other/logger.dox index f5228cfc55..2b8919dc78 100644 --- a/docs/doxygen/other/logger.dox +++ b/docs/doxygen/other/logger.dox @@ -83,7 +83,7 @@ data members of d_logger and d_debug_logger of gr_block and pass them to our pre-defined macros: \code - GR_LOG_<level>(<logger>, "<Message to print>"); + gr::LOG_<level>(<logger>, "<Message to print>"); \endcode Where \<level\> is one of the levels as mentioned above, \<logger\> is @@ -93,8 +93,8 @@ message to the standard logger and a WARN level message to the debug logger, it would look like this: \code - GR_LOG_INFO(d_logger, "Some info about the block"); - GR_LOG_WARN(d_debug_logger, "Some warning about the block"); + gr::LOG_INFO(d_logger, "Some info about the block"); + gr::LOG_WARN(d_debug_logger, "Some warning about the block"); \endcode When this is printed to wherever you are directing the output of the @@ -115,15 +115,15 @@ The various logging macros are defined in gr_logger.h. Here are some simple examples of using them: \code - GR_LOG_DEBUG(LOG, "DEBUG message"); - GR_LOG_INFO(LOG, "INFO message"); - GR_LOG_NOTICE(LOG, "NOTICE message"); - GR_LOG_WARN(LOG, "WARNING message"); - GR_LOG_ERROR(LOG, "ERROR message"); - GR_LOG_CRIT(LOG, "CRIT message"); - GR_LOG_ALERT(LOG, "ALERT message"); - GR_LOG_FATAL(LOG, "FATAL message"); - GR_LOG_EMERG(LOG, "EMERG message"); + gr::LOG_DEBUG(LOG, "DEBUG message"); + gr::LOG_INFO(LOG, "INFO message"); + gr::LOG_NOTICE(LOG, "NOTICE message"); + gr::LOG_WARN(LOG, "WARNING message"); + gr::LOG_ERROR(LOG, "ERROR message"); + gr::LOG_CRIT(LOG, "CRIT message"); + gr::LOG_ALERT(LOG, "ALERT message"); + gr::LOG_FATAL(LOG, "FATAL message"); + gr::LOG_EMERG(LOG, "EMERG message"); \endcode If the logger is not enabled, then these macros become nops and do @@ -188,20 +188,20 @@ a singleton in the system, but we need to get a pointer to the right logger and then set it up for our local use. The following code snippet shows how to do this to get access to the standard logger, which has a root of "gr_log." (access to the debug logger is similar -except we would use "gr_log_debug." in the GR_LOG_GETLOGGER call): +except we would use "gr_log_debug." in the gr::LOG_GETLOGGER call): \code - gr_prefs *p = gr_prefs::singleton(); + prefs *p = prefs::singleton(); std::string log_file = p->get_string("LOG", "log_config", ""); std::string log_level = p->get_string("LOG", "log_level", "off"); - GR_CONFIG_LOGGER(log_file); - GR_LOG_GETLOGGER(LOG, "gr_log." + "my_logger_name"); - GR_LOG_SET_LEVEL(LOG, log_level); + gr::CONFIG_LOGGER(log_file); + gr::LOG_GETLOGGER(LOG, "gr_log." + "my_logger_name"); + gr::LOG_SET_LEVEL(LOG, log_level); \endcode This creates a pointer called LOG (which is instantiated as a log4cpp:LoggerPtr in the macro) that we can now use locally as the -input to our logging macros like 'GR_LOG_INFO(LOG, "message")'. +input to our logging macros like 'gr::LOG_INFO(LOG, "message")'. \section logPy Logging from Python diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox index 498e2f5803..397f15b776 100644 --- a/docs/doxygen/other/main_page.dox +++ b/docs/doxygen/other/main_page.dox @@ -376,10 +376,10 @@ Similarly, in C++, we get a reference to the object by explicitly calling for the singleton of the object: \code - gr_prefs *p = gr_prefs::singleton(); + prefs *p = prefs::singleton(); \endcode -The methods associated with this preferences object are (from class gr_prefs): +The methods associated with this preferences object are (from class gr::prefs): \code bool has_section(string section) diff --git a/gnuradio-runtime/apps/gnuradio-config-info.cc b/gnuradio-runtime/apps/gnuradio-config-info.cc index d3e6454fd8..19291f4dae 100644 --- a/gnuradio-runtime/apps/gnuradio-config-info.cc +++ b/gnuradio-runtime/apps/gnuradio-config-info.cc @@ -24,7 +24,7 @@ #include <config.h> #endif -#include <gr_constants.h> +#include <gnuradio/constants.h> #include <boost/program_options.hpp> #include <iostream> @@ -48,25 +48,25 @@ main(int argc, char **argv) po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); - if (vm.size() == 0 || vm.count("help")) { + if(vm.size() == 0 || vm.count("help")) { std::cout << desc << std::endl; return 1; } - if (vm.count("prefix")) - std::cout << gr_prefix() << std::endl; + if(vm.count("prefix")) + std::cout << gr::prefix() << std::endl; - if (vm.count("sysconfdir")) - std::cout << gr_sysconfdir() << std::endl; + if(vm.count("sysconfdir")) + std::cout << gr::sysconfdir() << std::endl; - if (vm.count("prefsdir")) - std::cout << gr_prefsdir() << std::endl; + if(vm.count("prefsdir")) + std::cout << gr::prefsdir() << std::endl; - if (vm.count("builddate")) - std::cout << gr_build_date() << std::endl; + if(vm.count("builddate")) + std::cout << gr::build_date() << std::endl; - if (vm.count("version")) - std::cout << gr_version() << std::endl; + if(vm.count("version")) + std::cout << gr::version() << std::endl; return 0; } diff --git a/gnuradio-runtime/gnuradio-runtime.pc.in b/gnuradio-runtime/gnuradio-runtime.pc.in index 29c7c3ce84..d4488896cb 100644 --- a/gnuradio-runtime/gnuradio-runtime.pc.in +++ b/gnuradio-runtime/gnuradio-runtime.pc.in @@ -8,4 +8,4 @@ Description: GNU Radio core runtime infrastructure Requires: Version: @LIBVER@ Libs: -L${libdir} -lgnuradio-runtime -lgnuradio-pmt -Cflags: -I${includedir} -I${includedir}/gnuradio +Cflags: -I${includedir} diff --git a/gnuradio-runtime/include/CMakeLists.txt b/gnuradio-runtime/include/CMakeLists.txt index 832522f92c..929a673016 100644 --- a/gnuradio-runtime/include/CMakeLists.txt +++ b/gnuradio-runtime/include/CMakeLists.txt @@ -17,84 +17,5 @@ # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -add_subdirectory(messages) add_subdirectory(pmt) -add_subdirectory(thread) - -######################################################################## -# Install header files -######################################################################## -install(FILES - gr_basic_block.h - gr_block_detail.h - gr_block.h - gr_block_registry.h - gr_buffer.h - gr_complex.h - gr_constants.h - gr_dispatcher.h - gr_endianness.h - gr_error_handler.h - gr_expj.h - gr_feval.h - gr_flowgraph.h - gr_fxpt.h - gr_fxpt_nco.h - gr_fxpt_vco.h - gr_hier_block2.h - gr_io_signature.h - gr_logger.h - gr_math.h - gr_message.h - gr_misc.h - gr_msg_accepter.h - gr_msg_handler.h - gr_msg_queue.h - gr_nco.h - gr_preferences.h - gr_prefs.h - gr_py_feval.h - gr_random.h - gr_realtime.h - gr_runtime_api.h - gr_runtime_types.h - gr_select_handler.h - gr_sincos.h - gr_single_threaded_scheduler.h - gr_sptr_magic.h - gr_sync_block.h - gr_sync_decimator.h - gr_sync_interpolator.h - gr_sys_paths.h - gr_tagged_stream_block.h - gr_tags.h - gr_timer.h - gr_top_block.h - gr_tpb_detail.h - gr_types.h - gr_unittests.h - ice_application_base.h - IcePy_Communicator.h - ice_server_template.h - pycallback_object.h - random.h - rpccallbackregister_base.h - rpcmanager_base.h - rpcmanager.h - rpcpmtconverters_ice.h - rpcregisterhelpers.h - rpcserver_aggregator.h - rpcserver_base.h - rpcserver_booter_aggregator.h - rpcserver_booter_base.h - rpcserver_booter_ice.h - rpcserver_ice.h - rpcserver_selector.h - runtime_block_gateway.h - attributes.h - high_res_timer.h - realtime.h - sys_pri.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "runtime_devel" -) +add_subdirectory(gnuradio) diff --git a/gnuradio-runtime/include/gnuradio/CMakeLists.txt b/gnuradio-runtime/include/gnuradio/CMakeLists.txt new file mode 100644 index 0000000000..2d37d5102e --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/CMakeLists.txt @@ -0,0 +1,100 @@ +# Copyright 2013 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. + +add_subdirectory(messages) +add_subdirectory(thread) + +######################################################################## +# Install header files +######################################################################## +install(FILES + api.h + attributes.h + basic_block.h + block.h + block_detail.h + block_gateway.h + block_registry.h + buffer.h + constants.h + endianness.h + expj.h + feval.h + flowgraph.h + fxpt.h + fxpt_nco.h + fxpt_vco.h + gr_complex.h + hier_block2.h + high_res_timer.h + io_signature.h + math.h + message.h + misc.h + msg_accepter.h + msg_handler.h + msg_queue.h + nco.h + prefs.h + py_feval.h + pycallback_object.h + random.h + realtime.h + realtime_impl.h + runtime_types.h + tags.h + tagged_stream_block.h + top_block.h + tpb_detail.h + sincos.h + sptr_magic.h + sync_block.h + sync_decimator.h + sync_interpolator.h + sys_paths.h + types.h + sys_pri.h + unittests.h + ice_application_base.h + IcePy_Communicator.h + ice_server_template.h + rpccallbackregister_base.h + rpcmanager_base.h + rpcmanager.h + rpcpmtconverters_ice.h + rpcregisterhelpers.h + rpcserver_aggregator.h + rpcserver_base.h + rpcserver_booter_aggregator.h + rpcserver_booter_base.h + rpcserver_booter_ice.h + rpcserver_ice.h + rpcserver_selector.h + ${CMAKE_CURRENT_BINARY_DIR}/logger.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "runtime_devel" +) + +########################################################################## +# Configure logger +########################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/logger.h.in + ${CMAKE_CURRENT_BINARY_DIR}/logger.h +) diff --git a/gnuradio-runtime/include/IcePy_Communicator.h b/gnuradio-runtime/include/gnuradio/IcePy_Communicator.h index aae4378229..2dd0cc7bba 100644 --- a/gnuradio-runtime/include/IcePy_Communicator.h +++ b/gnuradio-runtime/include/gnuradio/IcePy_Communicator.h @@ -11,7 +11,7 @@ #define ICEPY_COMMUNICATOR_H #include <Ice/CommunicatorF.h> -#include <gr_runtime_api.h> +#include <gnuradio/api.h> namespace IcePy { diff --git a/gnuradio-runtime/include/gr_runtime_api.h b/gnuradio-runtime/include/gnuradio/api.h index 02ef9ccdcd..1c68b8c8b8 100644 --- a/gnuradio-runtime/include/gr_runtime_api.h +++ b/gnuradio-runtime/include/gnuradio/api.h @@ -19,10 +19,10 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GR_RUNTIME_API_H -#define INCLUDED_GR_RUNTIME_API_H +#ifndef INCLUDED_GR_RUNTIME_RUNTIME_API_H +#define INCLUDED_GR_RUNTIME_RUNTIME_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_runtime_EXPORTS # define GR_RUNTIME_API __GR_ATTR_EXPORT @@ -30,4 +30,4 @@ # define GR_RUNTIME_API __GR_ATTR_IMPORT #endif -#endif /* INCLUDED_GR_RUNTIME_API_H */ +#endif /* INCLUDED_GR_RUNTIME_RUNTIME_API_H */ diff --git a/gnuradio-runtime/include/attributes.h b/gnuradio-runtime/include/gnuradio/attributes.h index 5baa52e7d3..5baa52e7d3 100644 --- a/gnuradio-runtime/include/attributes.h +++ b/gnuradio-runtime/include/gnuradio/attributes.h diff --git a/gnuradio-runtime/include/gnuradio/basic_block.h b/gnuradio-runtime/include/gnuradio/basic_block.h new file mode 100644 index 0000000000..be385465d1 --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/basic_block.h @@ -0,0 +1,354 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2008,2009,2011,2013 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. + */ + +#ifndef INCLUDED_GR_BASIC_BLOCK_H +#define INCLUDED_GR_BASIC_BLOCK_H + +#include <gnuradio/api.h> +#include <gnuradio/sptr_magic.h> +#include <gnuradio/msg_accepter.h> +#include <gnuradio/runtime_types.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/thread/thread.h> +#include <boost/enable_shared_from_this.hpp> +#include <boost/function.hpp> +#include <boost/foreach.hpp> +#include <boost/thread/condition_variable.hpp> +#include <iostream> +#include <string> +#include <deque> +#include <map> + +#ifdef GR_CTRLPORT +#include <gnuradio/rpcregisterhelpers.h> +#endif + +namespace gr { + + /*! + * \brief The abstract base class for all signal processing blocks. + * \ingroup internal + * + * Basic blocks are the bare abstraction of an entity that has a + * name, a set of inputs and outputs, and a message queue. These + * are never instantiated directly; rather, this is the abstract + * parent class of both gr_hier_block, which is a recursive + * container, and block, which implements actual signal + * processing functions. + */ + class GR_RUNTIME_API basic_block : public msg_accepter, + public boost::enable_shared_from_this<basic_block> + { + typedef boost::function<void(pmt::pmt_t)> msg_handler_t; + + private: + //msg_handler_t d_msg_handler; + typedef std::map<pmt::pmt_t , msg_handler_t, pmt::comperator> d_msg_handlers_t; + d_msg_handlers_t d_msg_handlers; + + typedef std::deque<pmt::pmt_t> msg_queue_t; + typedef std::map<pmt::pmt_t, msg_queue_t, pmt::comperator> msg_queue_map_t; + typedef std::map<pmt::pmt_t, msg_queue_t, pmt::comperator>::iterator msg_queue_map_itr; + std::map<pmt::pmt_t, boost::shared_ptr<boost::condition_variable>, pmt::comperator> msg_queue_ready; + + gr::thread::mutex mutex; //< protects all vars + + protected: + friend class flowgraph; + friend class flat_flowgraph; // TODO: will be redundant + friend class tpb_thread_body; + + enum vcolor { WHITE, GREY, BLACK }; + + std::string d_name; + gr::io_signature::sptr d_input_signature; + gr::io_signature::sptr d_output_signature; + long d_unique_id; + long d_symbolic_id; + std::string d_symbol_name; + std::string d_symbol_alias; + vcolor d_color; + bool d_rpc_set; + + msg_queue_map_t msg_queue; + std::vector<boost::any> d_rpc_vars; // container for all RPC variables + + basic_block(void) {} // allows pure virtual interface sub-classes + + //! Protected constructor prevents instantiation by non-derived classes + basic_block(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature); + + //! may only be called during constructor + void set_input_signature(gr::io_signature::sptr iosig) { + d_input_signature = iosig; + } + + //! may only be called during constructor + void set_output_signature(gr::io_signature::sptr iosig) { + d_output_signature = iosig; + } + + /*! + * \brief Allow the flowgraph to set for sorting and partitioning + */ + void set_color(vcolor color) { d_color = color; } + vcolor color() const { return d_color; } + + /*! + * \brief Tests if there is a handler attached to port \p which_port + */ + bool has_msg_handler(pmt::pmt_t which_port) { + return (d_msg_handlers.find(which_port) != d_msg_handlers.end()); + } + + /* + * This function is called by the runtime system to dispatch messages. + * + * The thread-safety guarantees mentioned in set_msg_handler are + * implemented by the callers of this method. + */ + virtual void dispatch_msg(pmt::pmt_t which_port, pmt::pmt_t msg) + { + // AA Update this + if(has_msg_handler(which_port)) { // Is there a handler? + d_msg_handlers[which_port](msg); // Yes, invoke it. + } + } + + // Message passing interface + pmt::pmt_t message_subscribers; + + public: + virtual ~basic_block(); + long unique_id() const { return d_unique_id; } + long symbolic_id() const { return d_symbolic_id; } + std::string name() const { return d_name; } + std::string symbol_name() const { return d_symbol_name; } + gr::io_signature::sptr input_signature() const { return d_input_signature; } + gr::io_signature::sptr output_signature() const { return d_output_signature; } + basic_block_sptr to_basic_block(); // Needed for Python type coercion + bool alias_set() { return !d_symbol_alias.empty(); } + std::string alias(){ return alias_set()?d_symbol_alias:symbol_name(); } + pmt::pmt_t alias_pmt(){ return pmt::intern(alias()); } + void set_block_alias(std::string name); + + // ** Message passing interface ** + void message_port_register_in(pmt::pmt_t port_id); + void message_port_register_out(pmt::pmt_t port_id); + void message_port_pub(pmt::pmt_t port_id, pmt::pmt_t msg); + void message_port_sub(pmt::pmt_t port_id, pmt::pmt_t target); + void message_port_unsub(pmt::pmt_t port_id, pmt::pmt_t target); + + virtual bool message_port_is_hier(pmt::pmt_t port_id) { (void) port_id; std::cout << "is_hier\n"; return false; } + virtual bool message_port_is_hier_in(pmt::pmt_t port_id) { (void) port_id; std::cout << "is_hier_in\n"; return false; } + virtual bool message_port_is_hier_out(pmt::pmt_t port_id) { (void) port_id; std::cout << "is_hier_out\n"; return false; } + + /*! + * \brief Get input message port names. + * + * Returns the available input message ports for a block. The + * return object is a PMT vector that is filled with PMT symbols. + */ + pmt::pmt_t message_ports_in(); + + /*! + * \brief Get output message port names. + * + * Returns the available output message ports for a block. The + * return object is a PMT vector that is filled with PMT symbols. + */ + pmt::pmt_t message_ports_out(); + + /*! + * Accept msg, place in queue, arrange for thread to be awakened if it's not already. + */ + void _post(pmt::pmt_t which_port, pmt::pmt_t msg); + + //! is the queue empty? + //bool empty_p(const pmt::pmt_t &which_port) const { return msg_queue[which_port].empty(); } + bool empty_p(pmt::pmt_t which_port) { + if(msg_queue.find(which_port) == msg_queue.end()) + throw std::runtime_error("port does not exist!"); + return msg_queue[which_port].empty(); + } + bool empty_p() { + bool rv = true; + BOOST_FOREACH(msg_queue_map_t::value_type &i, msg_queue) { + rv &= msg_queue[i.first].empty(); + } + return rv; + } + + //! How many messages in the queue? + size_t nmsgs(pmt::pmt_t which_port) { + if(msg_queue.find(which_port) == msg_queue.end()) + throw std::runtime_error("port does not exist!"); + return msg_queue[which_port].size(); + } + + //| Acquires and release the mutex + void insert_tail( pmt::pmt_t which_port, pmt::pmt_t msg); + /*! + * \returns returns pmt at head of queue or pmt::pmt_t() if empty. + */ + pmt::pmt_t delete_head_nowait( pmt::pmt_t which_port); + + /*! + * \returns returns pmt at head of queue or pmt::pmt_t() if empty. + */ + pmt::pmt_t delete_head_blocking( pmt::pmt_t which_port); + + msg_queue_t::iterator get_iterator(pmt::pmt_t which_port) { + return msg_queue[which_port].begin(); + } + + void erase_msg(pmt::pmt_t which_port, msg_queue_t::iterator it) { + msg_queue[which_port].erase(it); + } + + virtual bool has_msg_port(pmt::pmt_t which_port) { + if(msg_queue.find(which_port) != msg_queue.end()) { + return true; + } + if(pmt::dict_has_key(message_subscribers, which_port)) { + return true; + } + return false; + } + +#ifdef GR_CTRLPORT + /*! + * \brief Add an RPC variable (get or set). + * + * Using controlport, we create new getters/setters and need to + * store them. Each block has a vector to do this, and these never + * need to be accessed again once they are registered with the RPC + * backend. This function takes a + * boost::shared_sptr<rpcbasic_base> so that when the block is + * deleted, all RPC registered variables are cleaned up. + * + * \param s an rpcbasic_sptr of the new RPC variable register to store. + */ + void add_rpc_variable(rpcbasic_sptr s) + { + d_rpc_vars.push_back(s); + } +#endif /* GR_CTRLPORT */ + + /*! + * \brief Set up the RPC registered variables. + * + * This must be overloaded by a block that wants to use + * controlport. This is where rpcbasic_register_{get,set} pointers + * are created, which then get wrapped as shared pointers + * (rpcbasic_sptr(...)) and stored using add_rpc_variable. + */ + virtual void setup_rpc() {}; + + /*! + * \brief Ask if this block has been registered to the RPC. + * + * We can only register a block once, so we use this to protect us + * from calling it multiple times. + */ + bool is_rpc_set() { return d_rpc_set; } + + /*! + * \brief When the block is registered with the RPC, set this. + */ + void rpc_set() { d_rpc_set = true; } + + /*! + * \brief Confirm that ninputs and noutputs is an acceptable combination. + * + * \param ninputs number of input streams connected + * \param noutputs number of output streams connected + * + * \returns true if this is a valid configuration for this block. + * + * This function is called by the runtime system whenever the + * topology changes. Most classes do not need to override this. + * This check is in addition to the constraints specified by the + * input and output gr::io_signatures. + */ + virtual bool check_topology(int ninputs, int noutputs) { + (void)ninputs; + (void)noutputs; + return true; + } + + /*! + * \brief Set the callback that is fired when messages are available. + * + * \p msg_handler can be any kind of function pointer or function object + * that has the signature: + * <pre> + * void msg_handler(pmt::pmt msg); + * </pre> + * + * (You may want to use boost::bind to massage your callable into + * the correct form. See gr::blocks::nop for an example that sets + * up a class method as the callback.) + * + * Blocks that desire to handle messages must call this method in + * their constructors to register the handler that will be invoked + * when messages are available. + * + * If the block inherits from block, the runtime system will + * ensure that msg_handler is called in a thread-safe manner, such + * that work and msg_handler will never be called concurrently. + * This allows msg_handler to update state variables without + * having to worry about thread-safety issues with work, + * general_work or another invocation of msg_handler. + * + * If the block inherits from hier_block2, the runtime system + * will ensure that no reentrant calls are made to msg_handler. + */ + template <typename T> void set_msg_handler(pmt::pmt_t which_port, T msg_handler) { + if(msg_queue.find(which_port) == msg_queue.end()) { + throw std::runtime_error("attempt to set_msg_handler() on bad input message port!"); + } + d_msg_handlers[which_port] = msg_handler_t(msg_handler); + } + }; + + inline bool operator<(basic_block_sptr lhs, basic_block_sptr rhs) + { + return lhs->unique_id() < rhs->unique_id(); + } + + typedef std::vector<basic_block_sptr> basic_block_vector_t; + typedef std::vector<basic_block_sptr>::iterator basic_block_viter_t; + + GR_RUNTIME_API long basic_block_ncurrently_allocated(); + + inline std::ostream &operator << (std::ostream &os, basic_block_sptr basic_block) + { + os << basic_block->name() << "(" << basic_block->unique_id() << ")"; + return os; + } + +} /* namespace gr */ + +#endif /* INCLUDED_GR_BASIC_BLOCK_H */ diff --git a/gnuradio-runtime/include/gnuradio/block.h b/gnuradio-runtime/include/gnuradio/block.h new file mode 100644 index 0000000000..fd6c48c29b --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/block.h @@ -0,0 +1,714 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2007,2009,2010,2013 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. + */ + +#ifndef INCLUDED_GR_RUNTIME_BLOCK_H +#define INCLUDED_GR_RUNTIME_BLOCK_H + +#include <gnuradio/api.h> +#include <gnuradio/basic_block.h> +#include <gnuradio/tags.h> +#include <gnuradio/logger.h> + +namespace gr { + + /*! + * \brief The abstract base class for all 'terminal' processing blocks. + * \ingroup base_blk + * + * A signal processing flow is constructed by creating a tree of + * hierarchical blocks, which at any level may also contain terminal + * nodes that actually implement signal processing functions. This + * is the base class for all such leaf nodes. + * + * Blocks have a set of input streams and output streams. The + * input_signature and output_signature define the number of input + * streams and output streams respectively, and the type of the data + * items in each stream. + * + * Although blocks may consume data on each input stream at a + * different rate, all outputs streams must produce data at the same + * rate. That rate may be different from any of the input rates. + * + * User derived blocks override two methods, forecast and + * general_work, to implement their signal processing + * behavior. forecast is called by the system scheduler to determine + * how many items are required on each input stream in order to + * produce a given number of output items. + * + * general_work is called to perform the signal processing in the + * block. It reads the input items and writes the output items. + */ + class GR_RUNTIME_API block : public basic_block + { + public: + + //! Magic return values from general_work + enum { + WORK_CALLED_PRODUCE = -2, + WORK_DONE = -1 + }; + + enum tag_propagation_policy_t { + TPP_DONT = 0, + TPP_ALL_TO_ALL = 1, + TPP_ONE_TO_ONE = 2 + }; + + virtual ~block(); + + /*! + * Assume block computes y_i = f(x_i, x_i-1, x_i-2, x_i-3...) + * History is the number of x_i's that are examined to produce one y_i. + * This comes in handy for FIR filters, where we use history to + * ensure that our input contains the appropriate "history" for the + * filter. History should be equal to the number of filter taps. + */ + unsigned history() const { return d_history; } + void set_history(unsigned history) { d_history = history; } + + /*! + * \brief Return true if this block has a fixed input to output rate. + * + * If true, then fixed_rate_in_to_out and fixed_rate_out_to_in may be called. + */ + bool fixed_rate() const { return d_fixed_rate; } + + // ---------------------------------------------------------------- + // override these to define your behavior + // ---------------------------------------------------------------- + + /*! + * \brief Estimate input requirements given output request + * + * \param noutput_items number of output items to produce + * \param ninput_items_required number of input items required on each input stream + * + * Given a request to product \p noutput_items, estimate the + * number of data items required on each input stream. The + * estimate doesn't have to be exact, but should be close. + */ + virtual void forecast(int noutput_items, + gr_vector_int &ninput_items_required); + + /*! + * \brief compute output items from input items + * + * \param noutput_items number of output items to write on each output stream + * \param ninput_items number of input items available on each input stream + * \param input_items vector of pointers to the input items, one entry per input stream + * \param output_items vector of pointers to the output items, one entry per output stream + * + * \returns number of items actually written to each output stream, or -1 on EOF. + * It is OK to return a value less than noutput_items. -1 <= return value <= noutput_items + * + * general_work must call consume or consume_each to indicate how + * many items were consumed on each input stream. + */ + virtual int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + /*! + * \brief Called to enable drivers, etc for i/o devices. + * + * This allows a block to enable an associated driver to begin + * transfering data just before we start to execute the scheduler. + * The end result is that this reduces latency in the pipeline + * when dealing with audio devices, usrps, etc. + */ + virtual bool start(); + + /*! + * \brief Called to disable drivers, etc for i/o devices. + */ + virtual bool stop(); + + // ---------------------------------------------------------------- + + /*! + * \brief Constrain the noutput_items argument passed to forecast and general_work + * + * set_output_multiple causes the scheduler to ensure that the + * noutput_items argument passed to forecast and general_work will + * be an integer multiple of \param multiple The default value of + * output multiple is 1. + */ + void set_output_multiple(int multiple); + int output_multiple() const { return d_output_multiple; } + bool output_multiple_set() const { return d_output_multiple_set; } + + /*! + * \brief Constrains buffers to work on a set item alignment (for SIMD) + * + * set_alignment_multiple causes the scheduler to ensure that the + * noutput_items argument passed to forecast and general_work will + * be an integer multiple of \param multiple The default value is + * 1. + * + * This control is similar to the output_multiple setting, except + * that if the number of items passed to the block is less than + * the output_multiple, this value is ignored and the block can + * produce like normal. The d_unaligned value is set to the number + * of items the block is off by. In the next call to general_work, + * the noutput_items is set to d_unaligned or less until + * d_unaligned==0. The buffers are now aligned again and the + * aligned calls can be performed again. + */ + void set_alignment(int multiple); + int alignment() const { return d_output_multiple; } + + void set_unaligned(int na); + int unaligned() const { return d_unaligned; } + void set_is_unaligned(bool u); + bool is_unaligned() const { return d_is_unaligned; } + + /*! + * \brief Tell the scheduler \p how_many_items of input stream \p + * which_input were consumed. + */ + void consume(int which_input, int how_many_items); + + /*! + * \brief Tell the scheduler \p how_many_items were consumed on + * each input stream. + */ + void consume_each(int how_many_items); + + /*! + * \brief Tell the scheduler \p how_many_items were produced on + * output stream \p which_output. + * + * If the block's general_work method calls produce, \p + * general_work must return WORK_CALLED_PRODUCE. + */ + void produce(int which_output, int how_many_items); + + /*! + * \brief Set the approximate output rate / input rate + * + * Provide a hint to the buffer allocator and scheduler. + * The default relative_rate is 1.0 + * + * decimators have relative_rates < 1.0 + * interpolators have relative_rates > 1.0 + */ + void set_relative_rate(double relative_rate); + + /*! + * \brief return the approximate output rate / input rate + */ + double relative_rate() const { return d_relative_rate; } + + /* + * The following two methods provide special case info to the + * scheduler in the event that a block has a fixed input to output + * ratio. sync_block, sync_decimator and + * sync_interpolator override these. If you're fixed rate, + * subclass one of those. + */ + /*! + * \brief Given ninput samples, return number of output samples that will be produced. + * N.B. this is only defined if fixed_rate returns true. + * Generally speaking, you don't need to override this. + */ + virtual int fixed_rate_ninput_to_noutput(int ninput); + + /*! + * \brief Given noutput samples, return number of input samples required to produce noutput. + * N.B. this is only defined if fixed_rate returns true. + * Generally speaking, you don't need to override this. + */ + virtual int fixed_rate_noutput_to_ninput(int noutput); + + /*! + * \brief Return the number of items read on input stream which_input + */ + uint64_t nitems_read(unsigned int which_input); + + /*! + * \brief Return the number of items written on output stream which_output + */ + uint64_t nitems_written(unsigned int which_output); + + /*! + * \brief Asks for the policy used by the scheduler to moved tags downstream. + */ + tag_propagation_policy_t tag_propagation_policy(); + + /*! + * \brief Set the policy by the scheduler to determine how tags are moved downstream. + */ + void set_tag_propagation_policy(tag_propagation_policy_t p); + + /*! + * \brief Return the minimum number of output items this block can + * produce during a call to work. + * + * Should be 0 for most blocks. Useful if we're dealing with + * packets and the block produces one packet per call to work. + */ + int min_noutput_items() const { return d_min_noutput_items; } + + /*! + * \brief Set the minimum number of output items this block can + * produce during a call to work. + * + * \param m the minimum noutput_items this block can produce. + */ + void set_min_noutput_items(int m) { d_min_noutput_items = m; } + + /*! + * \brief Return the maximum number of output items this block will + * handle during a call to work. + */ + int max_noutput_items(); + + /*! + * \brief Set the maximum number of output items this block will + * handle during a call to work. + * + * \param m the maximum noutput_items this block will handle. + */ + void set_max_noutput_items(int m); + + /*! + * \brief Clear the switch for using the max_noutput_items value of this block. + * + * When is_set_max_noutput_items() returns 'true', the scheduler + * will use the value returned by max_noutput_items() to limit the + * size of the number of items possible for this block's work + * function. If is_set_max_notput_items() returns 'false', then + * the scheduler ignores the internal value and uses the value set + * globally in the top_block. + * + * Use this value to clear the 'is_set' flag so the scheduler will + * ignore this. Use the set_max_noutput_items(m) call to both set + * a new value for max_noutput_items and to reenable its use in + * the scheduler. + */ + void unset_max_noutput_items(); + + /*! + * \brief Ask the block if the flag is or is not set to use the + * internal value of max_noutput_items during a call to work. + */ + bool is_set_max_noutput_items(); + + /* + * Used to expand the vectors that hold the min/max buffer sizes. + * + * Specifically, when -1 is used, the vectors are just initialized + * with 1 value; this is used by the flat_flowgraph to expand when + * required to add a new value for new ports on these blocks. + */ + void expand_minmax_buffer(int port) + { + if((size_t)port >= d_max_output_buffer.size()) + set_max_output_buffer(port, -1); + if((size_t)port >= d_min_output_buffer.size()) + set_min_output_buffer(port, -1); + } + + /*! + * \brief Returns max buffer size on output port \p i. + */ + long max_output_buffer(size_t i) + { + if(i >= d_max_output_buffer.size()) + throw std::invalid_argument("basic_block::max_output_buffer: port out of range."); + return d_max_output_buffer[i]; + } + + /*! + * \brief Sets max buffer size on all output ports. + */ + void set_max_output_buffer(long max_output_buffer) + { + for(int i = 0; i < output_signature()->max_streams(); i++) { + set_max_output_buffer(i, max_output_buffer); + } + } + + /*! + * \brief Sets max buffer size on output port \p port. + */ + void set_max_output_buffer(int port, long max_output_buffer) + { + if((size_t)port >= d_max_output_buffer.size()) + d_max_output_buffer.push_back(max_output_buffer); + else + d_max_output_buffer[port] = max_output_buffer; + } + + /*! + * \brief Returns min buffer size on output port \p i. + */ + long min_output_buffer(size_t i) + { + if(i >= d_min_output_buffer.size()) + throw std::invalid_argument("basic_block::min_output_buffer: port out of range."); + return d_min_output_buffer[i]; + } + + /*! + * \brief Sets min buffer size on all output ports. + */ + void set_min_output_buffer(long min_output_buffer) + { + for(int i=0; i<output_signature()->max_streams(); i++) { + set_min_output_buffer(i, min_output_buffer); + } + } + + /*! + * \brief Sets min buffer size on output port \p port. + */ + void set_min_output_buffer(int port, long min_output_buffer) + { + if((size_t)port >= d_min_output_buffer.size()) + d_min_output_buffer.push_back(min_output_buffer); + else + d_min_output_buffer[port] = min_output_buffer; + } + + // --------------- Performance counter functions ------------- + + /*! + * \brief Gets instantaneous noutput_items performance counter. + */ + float pc_noutput_items(); + + /*! + * \brief Gets average noutput_items performance counter. + */ + float pc_noutput_items_avg(); + + /*! + * \brief Gets variance of noutput_items performance counter. + */ + float pc_noutput_items_var(); + + /*! + * \brief Gets instantaneous num items produced performance counter. + */ + float pc_nproduced(); + + /*! + * \brief Gets average num items produced performance counter. + */ + float pc_nproduced_avg(); + + /*! + * \brief Gets variance of num items produced performance counter. + */ + float pc_nproduced_var(); + + /*! + * \brief Gets instantaneous fullness of \p which input buffer. + */ + float pc_input_buffers_full(int which); + + /*! + * \brief Gets average fullness of \p which input buffer. + */ + float pc_input_buffers_full_avg(int which); + + /*! + * \brief Gets variance of fullness of \p which input buffer. + */ + float pc_input_buffers_full_var(int which); + + /*! + * \brief Gets instantaneous fullness of all input buffers. + */ + std::vector<float> pc_input_buffers_full(); + + /*! + * \brief Gets average fullness of all input buffers. + */ + std::vector<float> pc_input_buffers_full_avg(); + + /*! + * \brief Gets variance of fullness of all input buffers. + */ + std::vector<float> pc_input_buffers_full_var(); + + /*! + * \brief Gets instantaneous fullness of \p which input buffer. + */ + float pc_output_buffers_full(int which); + + /*! + * \brief Gets average fullness of \p which input buffer. + */ + float pc_output_buffers_full_avg(int which); + + /*! + * \brief Gets variance of fullness of \p which input buffer. + */ + float pc_output_buffers_full_var(int which); + + /*! + * \brief Gets instantaneous fullness of all output buffers. + */ + std::vector<float> pc_output_buffers_full(); + + /*! + * \brief Gets average fullness of all output buffers. + */ + std::vector<float> pc_output_buffers_full_avg(); + + /*! + * \brief Gets variance of fullness of all output buffers. + */ + std::vector<float> pc_output_buffers_full_var(); + + /*! + * \brief Gets instantaneous clock cycles spent in work. + */ + float pc_work_time(); + + /*! + * \brief Gets average clock cycles spent in work. + */ + float pc_work_time_avg(); + + /*! + * \brief Gets average clock cycles spent in work. + */ + float pc_work_time_var(); + + /*! + * \brief Resets the performance counters + */ + void reset_perf_counters(); + + /*! + * \brief Sets up export of perf. counters to ControlPort. Only + * called by the scheduler. + */ + void setup_pc_rpc(); + + /*! + * \brief Checks if this block is already exporting perf. counters + * to ControlPort. + */ + bool is_pc_rpc_set() { return d_pc_rpc_set; } + + /*! + * \brief If the block calls this in its constructor, it's + * perf. counters will not be exported. + */ + void no_pc_rpc() { d_pc_rpc_set = true; } + + + // ---------------------------------------------------------------------------- + // Functions to handle thread affinity + + /*! + * \brief Set the thread's affinity to processor core \p n. + * + * \param mask a vector of ints of the core numbers available to this block. + */ + void set_processor_affinity(const std::vector<int> &mask); + + /*! + * \brief Remove processor affinity to a specific core. + */ + void unset_processor_affinity(); + + /*! + * \brief Get the current processor affinity. + */ + std::vector<int> processor_affinity() { return d_affinity; } + + // ---------------------------------------------------------------------------- + + private: + int d_output_multiple; + bool d_output_multiple_set; + int d_unaligned; + bool d_is_unaligned; + double d_relative_rate; // approx output_rate / input_rate + block_detail_sptr d_detail; // implementation details + unsigned d_history; + bool d_fixed_rate; + bool d_max_noutput_items_set; // if d_max_noutput_items is valid + int d_max_noutput_items; // value of max_noutput_items for this block + int d_min_noutput_items; + tag_propagation_policy_t d_tag_propagation_policy; // policy for moving tags downstream + std::vector<int> d_affinity; // thread affinity proc. mask + bool d_pc_rpc_set; + + protected: + block(void) {} // allows pure virtual interface sub-classes + block(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature); + + void set_fixed_rate(bool fixed_rate) { d_fixed_rate = fixed_rate; } + + /*! + * \brief Adds a new tag onto the given output buffer. + * + * \param which_output an integer of which output stream to attach the tag + * \param abs_offset a uint64 number of the absolute item number + * assicated with the tag. Can get from nitems_written. + * \param key the tag key as a PMT symbol + * \param value any PMT holding any value for the given key + * \param srcid optional source ID specifier; defaults to PMT_F + */ + inline void add_item_tag(unsigned int which_output, + uint64_t abs_offset, + const pmt::pmt_t &key, + const pmt::pmt_t &value, + const pmt::pmt_t &srcid=pmt::PMT_F) + { + tag_t tag; + tag.offset = abs_offset; + tag.key = key; + tag.value = value; + tag.srcid = srcid; + this->add_item_tag(which_output, tag); + } + + /*! + * \brief Adds a new tag onto the given output buffer. + * + * \param which_output an integer of which output stream to attach the tag + * \param tag the tag object to add + */ + void add_item_tag(unsigned int which_output, const tag_t &tag); + + /*! + * \brief Removes a tag from the given input buffer. + * + * \param which_input an integer of which input stream to remove the tag from + * \param abs_offset a uint64 number of the absolute item number + * assicated with the tag. Can get from nitems_written. + * \param key the tag key as a PMT symbol + * \param value any PMT holding any value for the given key + * \param srcid optional source ID specifier; defaults to PMT_F + * + * If no such tag is found, does nothing. + */ + inline void remove_item_tag(unsigned int which_input, + uint64_t abs_offset, + const pmt::pmt_t &key, + const pmt::pmt_t &value, + const pmt::pmt_t &srcid=pmt::PMT_F) + { + tag_t tag; + tag.offset = abs_offset; + tag.key = key; + tag.value = value; + tag.srcid = srcid; + this->remove_item_tag(which_input, tag); + } + + /*! + * \brief Removes a tag from the given input buffer. + * + * If no such tag is found, does nothing. + * + * \param which_input an integer of which input stream to remove the tag from + * \param tag the tag object to remove + */ + void remove_item_tag(unsigned int which_input, const tag_t &tag); + + /*! + * \brief Given a [start,end), returns a vector of all tags in the range. + * + * Range of counts is from start to end-1. + * + * Tags are tuples of: + * (item count, source id, key, value) + * + * \param v a vector reference to return tags into + * \param which_input an integer of which input stream to pull from + * \param abs_start a uint64 count of the start of the range of interest + * \param abs_end a uint64 count of the end of the range of interest + */ + void get_tags_in_range(std::vector<tag_t> &v, + unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end); + + /*! + * \brief Given a [start,end), returns a vector of all tags in the + * range with a given key. + * + * Range of counts is from start to end-1. + * + * Tags are tuples of: + * (item count, source id, key, value) + * + * \param v a vector reference to return tags into + * \param which_input an integer of which input stream to pull from + * \param abs_start a uint64 count of the start of the range of interest + * \param abs_end a uint64 count of the end of the range of interest + * \param key a PMT symbol key to filter only tags of this key + */ + void get_tags_in_range(std::vector<tag_t> &v, + unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end, + const pmt::pmt_t &key); + + std::vector<long> d_max_output_buffer; + std::vector<long> d_min_output_buffer; + + /*! Used by block's setters and work functions to make + * setting/resetting of parameters thread-safe. + * + * Used by calling gr::thread::scoped_lock l(d_setlock); + */ + gr::thread::mutex d_setlock; + + /*! Used by blocks to access the logger system. + */ + gr::logger_ptr d_logger; + gr::logger_ptr d_debug_logger; + + // These are really only for internal use, but leaving them public avoids + // having to work up an ever-varying list of friend GR_RUNTIME_APIs + + public: + block_detail_sptr detail() const { return d_detail; } + void set_detail(block_detail_sptr detail) { d_detail = detail; } + }; + + typedef std::vector<block_sptr> block_vector_t; + typedef std::vector<block_sptr>::iterator block_viter_t; + + inline block_sptr cast_to_block_sptr(basic_block_sptr p) + { + return boost::dynamic_pointer_cast<block, basic_block>(p); + } + + std::ostream& + operator << (std::ostream& os, const block *m); + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RUNTIME_BLOCK_H */ diff --git a/gnuradio-runtime/include/gnuradio/block_detail.h b/gnuradio-runtime/include/gnuradio/block_detail.h new file mode 100644 index 0000000000..a76874a9be --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/block_detail.h @@ -0,0 +1,266 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2013 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 detail. + * + * 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. + */ + +#ifndef INCLUDED_GR_RUNTIME_BLOCK_DETAIL_H +#define INCLUDED_GR_RUNTIME_BLOCK_DETAIL_H + +#include <gnuradio/api.h> +#include <gnuradio/runtime_types.h> +#include <gnuradio/tpb_detail.h> +#include <gnuradio/tags.h> +#include <gnuradio/high_res_timer.h> +#include <stdexcept> + +namespace gr { + + /*! + * \brief Implementation details to support the signal processing abstraction + * \ingroup internal + * + * This class contains implementation detail that should be "out of + * sight" 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_RUNTIME_API block_detail + { + public: + ~block_detail(); + + int ninputs() const { return d_ninputs; } + int noutputs() const { return d_noutputs; } + bool sink_p() const { return d_noutputs == 0; } + bool source_p() const { return d_ninputs == 0; } + + void set_done(bool done); + bool done() const { return d_done; } + + void set_input(unsigned int which, buffer_reader_sptr reader); + buffer_reader_sptr input(unsigned int which) + { + if(which >= d_ninputs) + throw std::invalid_argument("block_detail::input"); + return d_input[which]; + } + + void set_output(unsigned int which, buffer_sptr buffer); + buffer_sptr output(unsigned int which) + { + if(which >= d_noutputs) + throw std::invalid_argument("block_detail::output"); + return d_output[which]; + } + + /*! + * \brief Tell the scheduler \p how_many_items of input stream \p + * which_input were consumed. + */ + void consume(int which_input, int how_many_items); + + /*! + * \brief Tell the scheduler \p how_many_items were consumed on + * each input stream. + */ + void consume_each(int how_many_items); + + /*! + * \brief Tell the scheduler \p how_many_items were produced on + * output stream \p which_output. + */ + void produce(int which_output, int how_many_items); + + /*! + * \brief Tell the scheduler \p how_many_items were produced on + * each output stream. + */ + void produce_each(int how_many_items); + + // Return the number of items read on input stream which_input + uint64_t nitems_read(unsigned int which_input); + + // Return the number of items written on output stream which_output + uint64_t nitems_written(unsigned int which_output); + + /*! + * \brief Adds a new tag to the given output stream. + * + * Calls gr::buffer::add_item_tag(), + * which appends the tag onto its deque. + * + * \param which_output an integer of which output stream to attach the tag + * \param tag the tag object to add + */ + void add_item_tag(unsigned int which_output, const tag_t &tag); + + /*! + * \brief Removes a tag from the given input stream. + * + * Calls gr::buffer::remove_item_tag(). + * The tag in question will then no longer appear on subsequent calls of get_tags_in_range(). + * + * \param which_input an integer of which input stream to remove the tag from + * \param tag the tag object to add + * \param id The unique block ID (use gr::block::unique_id()) + */ + void remove_item_tag(unsigned int which_input, const tag_t &tag, long id); + + /*! + * \brief Given a [start,end), returns a vector of all tags in the range. + * + * Pass-through function to gr::buffer_reader to get a vector of + * tags in given range. Range of counts is from start to end-1. + * + * Tags are tuples of: + * (item count, source id, key, value) + * + * \param v a vector reference to return tags into + * \param which_input an integer of which input stream to pull from + * \param abs_start a uint64 count of the start of the range of interest + * \param abs_end a uint64 count of the end of the range of interest + * \param id Block ID + */ + void get_tags_in_range(std::vector<tag_t> &v, + unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end, + long id); + + /*! + * \brief Given a [start,end), returns a vector of all tags in the + * range with a given key. + * + * Calls get_tags_in_range(which_input, abs_start, abs_end) to get + * a vector of tags from the buffers. This function then provides + * a secondary filter to the tags to extract only tags with the + * given 'key'. + * + * Tags are tuples of: + * (item count, source id, key, value) + * + * \param v a vector reference to return tags into + * \param which_input an integer of which input stream to pull from + * \param abs_start a uint64 count of the start of the range of interest + * \param abs_end a uint64 count of the end of the range of interest + * \param key a PMT symbol to select only tags of this key + * \param id Block ID + */ + void get_tags_in_range(std::vector<tag_t> &v, + unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end, + const pmt::pmt_t &key, + long id); + + /*! + * \brief Set core affinity of block to the cores in the vector + * mask. + * + * \param mask a vector of ints of the core numbers available to + * this block. + */ + void set_processor_affinity(const std::vector<int> &mask); + + /*! + * \brief Unset core affinity. + */ + void unset_processor_affinity(); + + bool threaded; // set if thread is currently running. + gr::thread::gr_thread_t thread; // portable thread handle + + void start_perf_counters(); + void stop_perf_counters(int noutput_items, int nproduced); + void reset_perf_counters(); + + // Calls to get performance counter items + float pc_noutput_items(); + float pc_nproduced(); + float pc_input_buffers_full(size_t which); + std::vector<float> pc_input_buffers_full(); + float pc_output_buffers_full(size_t which); + std::vector<float> pc_output_buffers_full(); + float pc_work_time(); + + float pc_noutput_items_avg(); + float pc_nproduced_avg(); + float pc_input_buffers_full_avg(size_t which); + std::vector<float> pc_input_buffers_full_avg(); + float pc_output_buffers_full_avg(size_t which); + std::vector<float> pc_output_buffers_full_avg(); + float pc_work_time_avg(); + + float pc_noutput_items_var(); + float pc_nproduced_var(); + float pc_input_buffers_full_var(size_t which); + std::vector<float> pc_input_buffers_full_var(); + float pc_output_buffers_full_var(size_t which); + std::vector<float> pc_output_buffers_full_var(); + float pc_work_time_var(); + + tpb_detail d_tpb; // used by thread-per-block scheduler + int d_produce_or; + + // ---------------------------------------------------------------------------- + + private: + unsigned int d_ninputs; + unsigned int d_noutputs; + std::vector<buffer_reader_sptr> d_input; + std::vector<buffer_sptr> d_output; + bool d_done; + + // Performance counters + float d_ins_noutput_items; + float d_avg_noutput_items; + float d_var_noutput_items; + float d_ins_nproduced; + float d_avg_nproduced; + float d_var_nproduced; + std::vector<float> d_ins_input_buffers_full; + std::vector<float> d_avg_input_buffers_full; + std::vector<float> d_var_input_buffers_full; + std::vector<float> d_ins_output_buffers_full; + std::vector<float> d_avg_output_buffers_full; + std::vector<float> d_var_output_buffers_full; + gr::high_res_timer_type d_start_of_work, d_end_of_work; + float d_ins_work_time; + float d_avg_work_time; + float d_var_work_time; + float d_pc_counter; + + block_detail(unsigned int ninputs, unsigned int noutputs); + + friend struct tpb_detail; + + friend GR_RUNTIME_API block_detail_sptr + make_block_detail(unsigned int ninputs, unsigned int noutputs); + }; + + GR_RUNTIME_API block_detail_sptr + make_block_detail(unsigned int ninputs, unsigned int noutputs); + + GR_RUNTIME_API long + block_detail_ncurrently_allocated(); + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RUNTIME_BLOCK_DETAIL_H */ diff --git a/gnuradio-runtime/include/gnuradio/block_gateway.h b/gnuradio-runtime/include/gnuradio/block_gateway.h new file mode 100644 index 0000000000..0f328de2e5 --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/block_gateway.h @@ -0,0 +1,271 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011-2013 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. + */ + +#ifndef INCLUDED_RUNTIME_BLOCK_GATEWAY_H +#define INCLUDED_RUNTIME_BLOCK_GATEWAY_H + +#include <gnuradio/api.h> +#include <gnuradio/block.h> +#include <gnuradio/feval.h> + +namespace gr { + + /*! + * The work type enum tells the gateway what kind of block to + * implement. The choices are familiar gnuradio block overloads + * (sync, decim, interp). + */ + enum block_gw_work_type { + GR_BLOCK_GW_WORK_GENERAL, + GR_BLOCK_GW_WORK_SYNC, + GR_BLOCK_GW_WORK_DECIM, + GR_BLOCK_GW_WORK_INTERP, + }; + + /*! + * Shared message structure between python and gateway. + * Each action type represents a scheduler-called function. + */ + struct block_gw_message_type { + enum action_type { + ACTION_GENERAL_WORK, //dispatch work + ACTION_WORK, //dispatch work + ACTION_FORECAST, //dispatch forecast + ACTION_START, //dispatch start + ACTION_STOP, //dispatch stop + }; + + action_type action; + + int general_work_args_noutput_items; + std::vector<int> general_work_args_ninput_items; + std::vector<void *> general_work_args_input_items; //TODO this should be const void*, but swig cant int cast it right + std::vector<void *> general_work_args_output_items; + int general_work_args_return_value; + + int work_args_ninput_items; + int work_args_noutput_items; + std::vector<void *> work_args_input_items; //TODO this should be const void*, but swig cant int cast it right + std::vector<void *> work_args_output_items; + int work_args_return_value; + + int forecast_args_noutput_items; + std::vector<int> forecast_args_ninput_items_required; + + bool start_args_return_value; + + bool stop_args_return_value; + }; + + /*! + * The gateway block which performs all the magic. + * + * The gateway provides access to all the gr::block routines. + * The methods prefixed with gr::block__ are renamed + * to class methods without the prefix in python. + */ + class GR_RUNTIME_API block_gateway : virtual public gr::block + { + public: + // gr::block_gateway::sptr + typedef boost::shared_ptr<block_gateway> sptr; + + /*! + * Make a new gateway block. + * \param handler the swig director object with callback + * \param name the name of the block (Ex: "Shirley") + * \param in_sig the input signature for this block + * \param out_sig the output signature for this block + * \param work_type the type of block overload to implement + * \param factor the decimation or interpolation factor + * \return a new gateway block + */ + static sptr make(gr::feval_ll *handler, + const std::string &name, + gr::io_signature::sptr in_sig, + gr::io_signature::sptr out_sig, + const block_gw_work_type work_type, + const unsigned factor); + + //! Provide access to the shared message object + virtual block_gw_message_type &block_message(void) = 0; + + long block__unique_id(void) const { + return gr::block::unique_id(); + } + + std::string block__name(void) const { + return gr::block::name(); + } + + unsigned block__history(void) const { + return gr::block::history(); + } + + void block__set_history(unsigned history) { + return gr::block::set_history(history); + } + + void block__set_fixed_rate(bool fixed_rate) { + return gr::block::set_fixed_rate(fixed_rate); + } + + bool block__fixed_rate(void) const { + return gr::block::fixed_rate(); + } + + void block__set_output_multiple(int multiple) { + return gr::block::set_output_multiple(multiple); + } + + int block__output_multiple(void) const { + return gr::block::output_multiple(); + } + + void block__consume(int which_input, int how_many_items) { + return gr::block::consume(which_input, how_many_items); + } + + void block__consume_each(int how_many_items) { + return gr::block::consume_each(how_many_items); + } + + void block__produce(int which_output, int how_many_items) { + return gr::block::produce(which_output, how_many_items); + } + + void block__set_relative_rate(double relative_rate) { + return gr::block::set_relative_rate(relative_rate); + } + + double block__relative_rate(void) const { + return gr::block::relative_rate(); + } + + uint64_t block__nitems_read(unsigned int which_input) { + return gr::block::nitems_read(which_input); + } + + uint64_t block__nitems_written(unsigned int which_output) { + return gr::block::nitems_written(which_output); + } + + block::tag_propagation_policy_t block__tag_propagation_policy(void) { + return gr::block::tag_propagation_policy(); + } + + void block__set_tag_propagation_policy(block::tag_propagation_policy_t p) { + return gr::block::set_tag_propagation_policy(p); + } + + void block__add_item_tag(unsigned int which_output, + const tag_t &tag) + { + return gr::block::add_item_tag(which_output, tag); + } + + void block__add_item_tag(unsigned int which_output, + uint64_t abs_offset, + const pmt::pmt_t &key, + const pmt::pmt_t &value, + const pmt::pmt_t &srcid=pmt::PMT_F) + { + return gr::block::add_item_tag(which_output, abs_offset, + key, value, srcid); + } + + std::vector<tag_t> block__get_tags_in_range(unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end) + { + std::vector<gr::tag_t> tags; + gr::block::get_tags_in_range(tags, which_input, abs_start, abs_end); + return tags; + } + + std::vector<tag_t> block__get_tags_in_range(unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end, + const pmt::pmt_t &key) + { + std::vector<gr::tag_t> tags; + gr::block::get_tags_in_range(tags, which_input, abs_start, abs_end, key); + return tags; + } + + /* Message passing interface */ + void block__message_port_register_in(pmt::pmt_t port_id) { + gr::basic_block::message_port_register_in(port_id); + } + + void block__message_port_register_out(pmt::pmt_t port_id) { + gr::basic_block::message_port_register_out(port_id); + } + + void block__message_port_pub(pmt::pmt_t port_id, pmt::pmt_t msg) { + gr::basic_block::message_port_pub(port_id, msg); + } + + void block__message_port_sub(pmt::pmt_t port_id, pmt::pmt_t target) { + gr::basic_block::message_port_sub(port_id, target); + } + + void block__message_port_unsub(pmt::pmt_t port_id, pmt::pmt_t target) { + gr::basic_block::message_port_unsub(port_id, target); + } + + pmt::pmt_t block__message_ports_in() { + return gr::basic_block::message_ports_in(); + } + + pmt::pmt_t block__message_ports_out() { + return gr::basic_block::message_ports_out(); + } + + void set_msg_handler_feval(pmt::pmt_t which_port, gr::feval_p *msg_handler) + { + if(msg_queue.find(which_port) == msg_queue.end()) { + throw std::runtime_error("attempt to set_msg_handler_feval() on bad input message port!"); + } + d_msg_handlers_feval[which_port] = msg_handler; + } + + protected: + typedef std::map<pmt::pmt_t, feval_p *, pmt::comperator> msg_handlers_feval_t; + msg_handlers_feval_t d_msg_handlers_feval; + + void dispatch_msg(pmt::pmt_t which_port, pmt::pmt_t msg) + { + // Is there a handler? + if(d_msg_handlers_feval.find(which_port) != d_msg_handlers_feval.end()) { + d_msg_handlers_feval[which_port]->calleval(msg); // Yes, invoke it. + } + else { + // Pass to generic dispatcher if not found + gr::basic_block::dispatch_msg(which_port, msg); + } + } + }; + +} /* namespace gr */ + +#endif /* INCLUDED_RUNTIME_BLOCK_GATEWAY_H */ diff --git a/gnuradio-runtime/include/gnuradio/block_registry.h b/gnuradio-runtime/include/gnuradio/block_registry.h new file mode 100644 index 0000000000..f94be2dafb --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/block_registry.h @@ -0,0 +1,68 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 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. + */ + +#ifndef GR_RUNTIME_BLOCK_REGISTRY_H +#define GR_RUNTIME_BLOCK_REGISTRY_H + +#include <gnuradio/api.h> +#include <gnuradio/basic_block.h> +#include <map> + +namespace gr { + +#ifndef GR_BASIC_BLOCK_H + class basic_block; + class block; +#endif + + class GR_RUNTIME_API block_registry + { + public: + block_registry(); + + long block_register(basic_block* block); + void block_unregister(basic_block* block); + + std::string register_symbolic_name(basic_block* block); + void register_symbolic_name(basic_block* block, std::string name); + + basic_block_sptr block_lookup(pmt::pmt_t symbol); + + void register_primitive(std::string blk, gr::block* ref); + void unregister_primitive(std::string blk); + void notify_blk(std::string blk); + + private: + //typedef std::map< long, basic_block_sptr > blocksubmap_t; + typedef std::map< long, basic_block* > blocksubmap_t; + typedef std::map< std::string, blocksubmap_t > blockmap_t; + + blockmap_t d_map; + pmt::pmt_t d_ref_map; + std::map< std::string, block*> primitive_map; + }; + +} /* namespace gr */ + +GR_RUNTIME_API extern gr::block_registry global_block_registry; + +#endif /* GR_RUNTIME_BLOCK_REGISTRY_H */ diff --git a/gnuradio-runtime/include/gnuradio/buffer.h b/gnuradio-runtime/include/gnuradio/buffer.h new file mode 100644 index 0000000000..adf00d14ac --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/buffer.h @@ -0,0 +1,309 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009-2011,2013 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. + */ + +#ifndef INCLUDED_GR_RUNTIME_BUFFER_H +#define INCLUDED_GR_RUNTIME_BUFFER_H + +#include <gnuradio/api.h> +#include <gnuradio/runtime_types.h> +#include <gnuradio/tags.h> +#include <boost/weak_ptr.hpp> +#include <gnuradio/thread/thread.h> +#include <deque> + +namespace gr { + + class vmcircbuf; + + /*! + * \brief Allocate a buffer that holds at least \p nitems of size \p sizeof_item. + * + * The total size of the buffer will be rounded up to a system + * dependent boundary. This is typically the system page size, but + * under MS windows is 64KB. + * + * \param nitems is the minimum number of items the buffer will hold. + * \param sizeof_item is the size of an item in bytes. + * \param link is the block that writes to this buffer. + */ + GR_RUNTIME_API buffer_sptr make_buffer(int nitems, size_t sizeof_item, + block_sptr link=block_sptr()); + + /*! + * \brief Single writer, multiple reader fifo. + * \ingroup internal + */ + class GR_RUNTIME_API buffer + { + public: + virtual ~buffer(); + + /*! + * \brief return number of items worth of space available for writing + */ + int space_available(); + + /*! + * \brief return size of this buffer in items + */ + int bufsize() const { return d_bufsize; } + + /*! + * \brief return pointer to write buffer. + * + * The return value points at space that can hold at least + * space_available() items. + */ + void *write_pointer(); + + /*! + * \brief tell buffer that we wrote \p nitems into it + */ + void update_write_pointer(int nitems); + + void set_done(bool done); + bool done() const { return d_done; } + + /*! + * \brief Return the block that writes to this buffer. + */ + block_sptr link() { return block_sptr(d_link); } + + size_t nreaders() const { return d_readers.size(); } + buffer_reader* reader(size_t index) { return d_readers[index]; } + + gr::thread::mutex *mutex() { return &d_mutex; } + + uint64_t nitems_written() { return d_abs_write_offset; } + + size_t get_sizeof_item() { return d_sizeof_item; } + + /*! + * \brief Adds a new tag to the buffer. + * + * \param tag the new tag + */ + void add_item_tag(const tag_t &tag); + + /*! + * \brief Removes an existing tag from the buffer. + * + * If no such tag is found, does nothing. + * Note: Doesn't actually physically delete the tag, but + * marks it as deleted. For the user, this has the same effect: + * Any subsequent calls to get_tags_in_range() will not return + * the tag. + * + * \param tag the tag that needs to be removed + * \param id the unique ID of the block calling this function + */ + void remove_item_tag(const tag_t &tag, long id); + + /*! + * \brief Removes all tags before \p max_time from buffer + * + * \param max_time the time (item number) to trim up until. + */ + void prune_tags(uint64_t max_time); + + std::deque<tag_t>::iterator get_tags_begin() { return d_item_tags.begin(); } + std::deque<tag_t>::iterator get_tags_end() { return d_item_tags.end(); } + + // ------------------------------------------------------------------------- + + private: + friend class buffer_reader; + friend GR_RUNTIME_API buffer_sptr make_buffer(int nitems, size_t sizeof_item, block_sptr link); + friend GR_RUNTIME_API buffer_reader_sptr buffer_add_reader(buffer_sptr buf, int nzero_preload, block_sptr link); + + protected: + char *d_base; // base address of buffer + unsigned int d_bufsize; // in items + private: + gr::vmcircbuf *d_vmcircbuf; + size_t d_sizeof_item; // in bytes + std::vector<buffer_reader *> d_readers; + boost::weak_ptr<block> d_link; // block that writes to this buffer + + // + // The mutex protects d_write_index, d_abs_write_offset, d_done, d_item_tags + // and the d_read_index's and d_abs_read_offset's in the buffer readers. + // + gr::thread::mutex d_mutex; + unsigned int d_write_index; // in items [0,d_bufsize) + uint64_t d_abs_write_offset; // num items written since the start + bool d_done; + std::deque<tag_t> d_item_tags; + uint64_t d_last_min_items_read; + + unsigned index_add(unsigned a, unsigned b) + { + unsigned s = a + b; + + if(s >= d_bufsize) + s -= d_bufsize; + + assert(s < d_bufsize); + return s; + } + + unsigned index_sub(unsigned a, unsigned b) + { + int s = a - b; + + if(s < 0) + s += d_bufsize; + + assert((unsigned) s < d_bufsize); + return s; + } + + virtual bool allocate_buffer(int nitems, size_t sizeof_item); + + /*! + * \brief constructor is private. Use gr_make_buffer to create instances. + * + * Allocate a buffer that holds at least \p nitems of size \p sizeof_item. + * + * \param nitems is the minimum number of items the buffer will hold. + * \param sizeof_item is the size of an item in bytes. + * \param link is the block that writes to this buffer. + * + * The total size of the buffer will be rounded up to a system + * dependent boundary. This is typically the system page size, but + * under MS windows is 64KB. + */ + buffer(int nitems, size_t sizeof_item, block_sptr link); + + /*! + * \brief disassociate \p reader from this buffer + */ + void drop_reader(buffer_reader *reader); + }; + + /*! + * \brief Create a new gr::buffer_reader and attach it to buffer \p buf + * \param buf is the buffer the \p gr::buffer_reader reads from. + * \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_RUNTIME_API buffer_reader_sptr + buffer_add_reader(buffer_sptr buf, int nzero_preload, block_sptr link=block_sptr()); + + //! returns # of buffers currently allocated + GR_RUNTIME_API long buffer_ncurrently_allocated(); + + + // --------------------------------------------------------------------------- + + /*! + * \brief How we keep track of the readers of a gr::buffer. + * \ingroup internal + */ + class GR_RUNTIME_API buffer_reader + { + public: + ~buffer_reader(); + + /*! + * \brief Return number of items available for reading. + */ + int items_available() const; + + /*! + * \brief Return buffer this reader reads from. + */ + buffer_sptr buffer() const { return d_buffer; } + + /*! + * \brief Return maximum number of items that could ever be available for reading. + * This is used as a sanity check in the scheduler to avoid looping forever. + */ + int max_possible_items_available() const { return d_buffer->d_bufsize - 1; } + + /*! + * \brief return pointer to read buffer. + * + * The return value points to items_available() number of items + */ + const void *read_pointer(); + + /* + * \brief tell buffer we read \p items from it + */ + void update_read_pointer(int nitems); + + void set_done(bool done) { d_buffer->set_done(done); } + bool done() const { return d_buffer->done(); } + + gr::thread::mutex *mutex() { return d_buffer->mutex(); } + + uint64_t nitems_read() { return d_abs_read_offset; } + + size_t get_sizeof_item() { return d_buffer->get_sizeof_item(); } + + /*! + * \brief Return the block that reads via this reader. + * + */ + block_sptr link() { return block_sptr(d_link); } + + /*! + * \brief Given a [start,end), returns a vector all tags in the range. + * + * Get a vector of tags in given range. Range of counts is from start to end-1. + * + * Tags are tuples of: + * (item count, source id, key, value) + * + * \param v a vector reference to return tags into + * \param abs_start a uint64 count of the start of the range of interest + * \param abs_end a uint64 count of the end of the range of interest + * \param id the unique ID of the block to make sure already deleted tags are not returned + */ + void get_tags_in_range(std::vector<tag_t> &v, + uint64_t abs_start, + uint64_t abs_end, + long id); + + // ------------------------------------------------------------------------- + + private: + friend class buffer; + friend GR_RUNTIME_API buffer_reader_sptr + buffer_add_reader(buffer_sptr buf, int nzero_preload, block_sptr link); + + buffer_sptr d_buffer; + unsigned int d_read_index; // in items [0,d->buffer.d_bufsize) + uint64_t d_abs_read_offset; // num items seen since the start + boost::weak_ptr<block> d_link; // block that reads via this buffer reader + + //! constructor is private. Use gr::buffer::add_reader to create instances + buffer_reader(buffer_sptr buffer, unsigned int read_index, block_sptr link); + }; + + //! returns # of buffer_readers currently allocated + GR_RUNTIME_API long buffer_reader_ncurrently_allocated (); + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RUNTIME_BUFFER_H */ diff --git a/gnuradio-runtime/include/gr_constants.h b/gnuradio-runtime/include/gnuradio/constants.h index 38ad858b20..beba6f2745 100644 --- a/gnuradio-runtime/include/gr_constants.h +++ b/gnuradio-runtime/include/gnuradio/constants.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2009 Free Software Foundation, Inc. + * Copyright 2006,2009,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,35 +19,40 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ + #ifndef INCLUDED_GR_CONSTANTS_H #define INCLUDED_GR_CONSTANTS_H -#include <gr_runtime_api.h> +#include <gnuradio/api.h> #include <string> -/*! - * \brief return CMAKE_INSTALL_PREFIX. Typically /usr/local - */ -GR_RUNTIME_API const std::string gr_prefix(); +namespace gr { -/*! - * \brief return SYSCONFDIR. Typically ${CMAKE_INSTALL_PREFIX}/etc or /etc - */ -GR_RUNTIME_API const std::string gr_sysconfdir(); + /*! + * \brief return SYSCONFDIR. Typically ${CMAKE_INSTALL_PREFIX}/etc or /etc + */ + GR_RUNTIME_API const std::string prefix(); -/*! - * \brief return preferences file directory. Typically ${SYSCONFDIR}/etc/conf.d - */ -GR_RUNTIME_API const std::string gr_prefsdir(); + /*! + * \brief return SYSCONFDIR. Typically ${CMAKE_INSTALL_PREFIX}/etc or /etc + */ + GR_RUNTIME_API const std::string sysconfdir(); -/*! - * \brief return date/time of build, as set when 'cmake' is run - */ -GR_RUNTIME_API const std::string gr_build_date(); + /*! + * \brief return preferences file directory. Typically ${SYSCONFDIR}/etc/conf.d + */ + GR_RUNTIME_API const std::string prefsdir(); -/*! - * \brief return version string defined by cmake (GrVersion.cmake) - */ -GR_RUNTIME_API const std::string gr_version(); + /*! + * \brief return date/time of build, as set when 'cmake' is run + */ + GR_RUNTIME_API const std::string build_date(); + + /*! + * \brief return version string defined by cmake (GrVersion.cmake) + */ + GR_RUNTIME_API const std::string version(); + +} /* namespace gr */ #endif /* INCLUDED_GR_CONSTANTS_H */ diff --git a/gnuradio-runtime/include/gr_endianness.h b/gnuradio-runtime/include/gnuradio/endianness.h index c4ecb1383e..43c21a1c15 100644 --- a/gnuradio-runtime/include/gr_endianness.h +++ b/gnuradio-runtime/include/gnuradio/endianness.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,9 +19,14 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ + #ifndef INCLUDED_GR_ENDIANNESS_H #define INCLUDED_GR_ENDIANNESS_H -typedef enum {GR_MSB_FIRST, GR_LSB_FIRST} gr_endianness_t; +namespace gr { + + typedef enum {GR_MSB_FIRST, GR_LSB_FIRST} endianness_t; + +} /* namespace gr */ #endif /* INCLUDED_GR_ENDIANNESS_H */ diff --git a/gnuradio-runtime/include/gr_expj.h b/gnuradio-runtime/include/gnuradio/expj.h index 56291a0a6a..7556e17011 100644 --- a/gnuradio-runtime/include/gr_expj.h +++ b/gnuradio-runtime/include/gnuradio/expj.h @@ -22,15 +22,15 @@ #ifndef INCLUDED_GR_EXPJ_H #define INCLUDED_GR_EXPJ_H -#include <gr_runtime_api.h> -#include <gr_sincos.h> -#include <gr_types.h> +#include <gnuradio/api.h> +#include <gnuradio/sincos.h> +#include <gnuradio/types.h> static inline gr_complex gr_expj(float phase) { float t_imag, t_real; - gr_sincosf(phase, &t_imag, &t_real); + gr::sincosf(phase, &t_imag, &t_real); return gr_complex(t_real, t_imag); } diff --git a/gnuradio-runtime/include/gnuradio/feval.h b/gnuradio-runtime/include/gnuradio/feval.h new file mode 100644 index 0000000000..40e3ad9a55 --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/feval.h @@ -0,0 +1,187 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2013 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. + */ + +#ifndef INCLUDED_GR_FEVAL_H +#define INCLUDED_GR_FEVAL_H + +#include <gnuradio/api.h> +#include <gnuradio/gr_complex.h> +#include <pmt/pmt.h> + +namespace gr { + + /*! + * \brief base class for evaluating a function: double -> double + * \ingroup misc + * + * This class is designed to be subclassed in Python or C++ and is + * callable from both places. It uses SWIG's "director" feature to + * implement the magic. + * + * It's slow. Don't use it in a performance critical path. + * + * Override eval to define the behavior. + * Use calleval to invoke eval (this kludge is required to allow a + * python specific "shim" to be inserted. + */ + class GR_RUNTIME_API feval_dd + { + protected: + /*! + * \brief override this to define the function + */ + virtual double eval(double x); + + public: + feval_dd() {} + virtual ~feval_dd(); + + virtual double calleval(double x); // invoke "eval" + }; + + /*! + * \brief base class for evaluating a function: complex -> complex + * \ingroup misc + * + * This class is designed to be subclassed in Python or C++ and is + * callable from both places. It uses SWIG's "director" feature to + * implement the magic. + * + * It's slow. Don't use it in a performance critical path. + * + * Override eval to define the behavior. + * Use calleval to invoke eval (this kludge is required to allow a + * python specific "shim" to be inserted. + */ + class GR_RUNTIME_API feval_cc + { + protected: + /*! + * \brief override this to define the function + */ + virtual gr_complex eval(gr_complex x); + + public: + feval_cc() {} + virtual ~feval_cc(); + + virtual gr_complex calleval(gr_complex x); // invoke "eval" + }; + + /*! + * \brief base class for evaluating a function: long -> long + * \ingroup misc + * + * This class is designed to be subclassed in Python or C++ and is + * callable from both places. It uses SWIG's "director" feature to + * implement the magic. + * + * It's slow. Don't use it in a performance critical path. + * + * Override eval to define the behavior. + * Use calleval to invoke eval (this kludge is required to allow a + * python specific "shim" to be inserted. + */ + class GR_RUNTIME_API feval_ll + { + protected: + /*! + * \brief override this to define the function + */ + virtual long eval(long x); + + public: + feval_ll() {} + virtual ~feval_ll(); + + virtual long calleval(long x); // invoke "eval" + }; + + /*! + * \brief base class for evaluating a function: void -> void + * \ingroup misc + * + * This class is designed to be subclassed in Python or C++ and is + * callable from both places. It uses SWIG's "director" feature to + * implement the magic. + * + * It's slow. Don't use it in a performance critical path. + * + * Override eval to define the behavior. + * Use calleval to invoke eval (this kludge is required to allow a + * python specific "shim" to be inserted. + */ + class GR_RUNTIME_API feval + { + protected: + /*! + * \brief override this to define the function + */ + virtual void eval(); + + public: + feval() {} + virtual ~feval(); + + virtual void calleval(); // invoke "eval" + }; + + /*! + * \brief base class for evaluating a function: pmt -> void + * \ingroup misc + * + * This class is designed to be subclassed in Python or C++ and is + * callable from both places. It uses SWIG's "director" feature to + * implement the magic. + * + * It's slow. Don't use it in a performance critical path. + * + * Override eval to define the behavior. + * Use calleval to invoke eval (this kludge is required to allow a + * python specific "shim" to be inserted. + */ + class GR_RUNTIME_API feval_p + { + protected: + /*! + * \brief override this to define the function + */ + virtual void eval(pmt::pmt_t x); + + public: + feval_p() {} + virtual ~feval_p(); + + virtual void calleval(pmt::pmt_t x); // invoke "eval" + }; + + /*! + * \brief trivial examples / test cases showing C++ calling Python code + */ + GR_RUNTIME_API double feval_dd_example(feval_dd *f, double x); + GR_RUNTIME_API gr_complex feval_cc_example(feval_cc *f, gr_complex x); + GR_RUNTIME_API long feval_ll_example(feval_ll *f, long x); + GR_RUNTIME_API void feval_example(feval *f); + +} /* namespace gr */ + +#endif /* INCLUDED_GR_FEVAL_H */ diff --git a/gnuradio-runtime/include/gnuradio/flowgraph.h b/gnuradio-runtime/include/gnuradio/flowgraph.h new file mode 100644 index 0000000000..cfa451f11b --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/flowgraph.h @@ -0,0 +1,256 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2007,2013 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. + */ + +#ifndef INCLUDED_GR_RUNTIME_FLOWGRAPH_H +#define INCLUDED_GR_RUNTIME_FLOWGRAPH_H + +#include <gnuradio/api.h> +#include <gnuradio/basic_block.h> +#include <gnuradio/io_signature.h> +#include <iostream> + +namespace gr { + + /*! + * \brief Class representing a specific input or output graph endpoint + * \ingroup internal + */ + class GR_RUNTIME_API endpoint + { + private: + basic_block_sptr d_basic_block; + int d_port; + + public: + endpoint() : d_basic_block(), d_port(0) { } + endpoint(basic_block_sptr block, int port) { d_basic_block = block; d_port = port; } + basic_block_sptr block() const { return d_basic_block; } + int port() const { return d_port; } + + bool operator==(const endpoint &other) const; + }; + + inline bool endpoint::operator==(const endpoint &other) const + { + return (d_basic_block == other.d_basic_block && + d_port == other.d_port); + } + + class GR_RUNTIME_API msg_endpoint + { + private: + basic_block_sptr d_basic_block; + pmt::pmt_t d_port; + bool d_is_hier; + + public: + msg_endpoint() : d_basic_block(), d_port(pmt::PMT_NIL) { } + msg_endpoint(basic_block_sptr block, pmt::pmt_t port, bool is_hier=false) { + d_basic_block = block; d_port = port; d_is_hier = is_hier; + } + basic_block_sptr block() const { return d_basic_block; } + pmt::pmt_t port() const { return d_port; } + bool is_hier() const { return d_is_hier; } + void set_hier(bool h) { d_is_hier = h; } + + bool operator==(const msg_endpoint &other) const; + }; + + inline bool + msg_endpoint::operator==(const msg_endpoint &other) const + { + return (d_basic_block == other.d_basic_block && + pmt::equal(d_port, other.d_port)); + } + + // Hold vectors of gr::endpoint objects + typedef std::vector<endpoint> endpoint_vector_t; + typedef std::vector<endpoint>::iterator endpoint_viter_t; + + /*! + *\brief Class representing a connection between to graph endpoints + */ + class GR_RUNTIME_API edge + { + public: + edge() : d_src(), d_dst() { }; + edge(const endpoint &src, const endpoint &dst) + : d_src(src), d_dst(dst) { } + ~edge(); + + const endpoint &src() const { return d_src; } + const endpoint &dst() const { return d_dst; } + + private: + endpoint d_src; + endpoint d_dst; + }; + + // Hold vectors of gr::edge objects + typedef std::vector<edge> edge_vector_t; + typedef std::vector<edge>::iterator edge_viter_t; + + + /*! + *\brief Class representing a msg connection between to graph msg endpoints + */ + class GR_RUNTIME_API msg_edge + { + public: + msg_edge() : d_src(), d_dst() { }; + msg_edge(const msg_endpoint &src, const msg_endpoint &dst) + : d_src(src), d_dst(dst) { } + ~msg_edge() {} + + const msg_endpoint &src() const { return d_src; } + const msg_endpoint &dst() const { return d_dst; } + + private: + msg_endpoint d_src; + msg_endpoint d_dst; + }; + + // Hold vectors of gr::msg_edge objects + typedef std::vector<msg_edge> msg_edge_vector_t; + typedef std::vector<msg_edge>::iterator msg_edge_viter_t; + + // Create a shared pointer to a heap allocated flowgraph + // (types defined in runtime_types.h) + GR_RUNTIME_API flowgraph_sptr make_flowgraph(); + + /*! + * \brief Class representing a directed, acyclic graph of basic blocks + * \ingroup internal + */ + class GR_RUNTIME_API flowgraph + { + public: + friend GR_RUNTIME_API flowgraph_sptr make_flowgraph(); + + // Destruct an arbitrary flowgraph + ~flowgraph(); + + // Connect two endpoints + void connect(const endpoint &src, const endpoint &dst); + + // Disconnect two endpoints + void disconnect(const endpoint &src, const endpoint &dst); + + // Connect an output port to an input port (convenience) + void connect(basic_block_sptr src_block, int src_port, + basic_block_sptr dst_block, int dst_port); + + // Disconnect an input port from an output port (convenience) + void disconnect(basic_block_sptr src_block, int src_port, + basic_block_sptr dst_block, int dst_port); + + // Connect two msg endpoints + void connect(const msg_endpoint &src, const msg_endpoint &dst); + + // Disconnect two msg endpoints + void disconnect(const msg_endpoint &src, const msg_endpoint &dst); + + // Validate connectivity, raise exception if invalid + void validate(); + + // Clear existing flowgraph + void clear(); + + // Return vector of edges + const edge_vector_t &edges() const { return d_edges; } + + // Return vector of msg edges + const msg_edge_vector_t &msg_edges() const { return d_msg_edges; } + + // Return vector of connected blocks + basic_block_vector_t calc_used_blocks(); + + // Return toplogically sorted vector of blocks. All the sources come first. + basic_block_vector_t topological_sort(basic_block_vector_t &blocks); + + // Return vector of vectors of disjointly connected blocks, + // topologically sorted. + std::vector<basic_block_vector_t> partition(); + + protected: + basic_block_vector_t d_blocks; + edge_vector_t d_edges; + msg_edge_vector_t d_msg_edges; + + flowgraph(); + std::vector<int> calc_used_ports(basic_block_sptr block, bool check_inputs); + basic_block_vector_t calc_downstream_blocks(basic_block_sptr block, int port); + edge_vector_t calc_upstream_edges(basic_block_sptr block); + bool has_block_p(basic_block_sptr block); + edge calc_upstream_edge(basic_block_sptr block, int port); + + private: + void check_valid_port(gr::io_signature::sptr sig, int port); + void check_valid_port(const msg_endpoint &e); + void check_dst_not_used(const endpoint &dst); + void check_type_match(const endpoint &src, const endpoint &dst); + edge_vector_t calc_connections(basic_block_sptr block, bool check_inputs); // false=use outputs + void check_contiguity(basic_block_sptr block, const std::vector<int> &used_ports, bool check_inputs); + + basic_block_vector_t calc_downstream_blocks(basic_block_sptr block); + basic_block_vector_t calc_reachable_blocks(basic_block_sptr block, basic_block_vector_t &blocks); + void reachable_dfs_visit(basic_block_sptr block, basic_block_vector_t &blocks); + basic_block_vector_t calc_adjacent_blocks(basic_block_sptr block, basic_block_vector_t &blocks); + basic_block_vector_t sort_sources_first(basic_block_vector_t &blocks); + bool source_p(basic_block_sptr block); + void topological_dfs_visit(basic_block_sptr block, basic_block_vector_t &output); + }; + + // Convenience functions + inline + void flowgraph::connect(basic_block_sptr src_block, int src_port, + basic_block_sptr dst_block, int dst_port) + { + connect(endpoint(src_block, src_port), + endpoint(dst_block, dst_port)); + } + + inline + void flowgraph::disconnect(basic_block_sptr src_block, int src_port, + basic_block_sptr dst_block, int dst_port) + { + disconnect(endpoint(src_block, src_port), + endpoint(dst_block, dst_port)); + } + + inline std::ostream& + operator <<(std::ostream &os, const endpoint endp) + { + os << endp.block()->alias() << ":" << endp.port(); + return os; + } + + inline std::ostream& + operator <<(std::ostream &os, const edge edge) + { + os << edge.src() << "->" << edge.dst(); + return os; + } + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RUNTIME_FLOWGRAPH_H */ diff --git a/gnuradio-runtime/include/gnuradio/fxpt.h b/gnuradio-runtime/include/gnuradio/fxpt.h new file mode 100644 index 0000000000..6143acafeb --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/fxpt.h @@ -0,0 +1,108 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 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. + */ + +#ifndef INCLUDED_GR_FXPT_H +#define INCLUDED_GR_FXPT_H + +#include <gnuradio/api.h> +#include <gnuradio/types.h> + +namespace gr { + + /*! + * \brief fixed point sine and cosine and friends. + * \ingroup misc + * + * fixed pt radians + * --------- -------- + * -2**31 -pi + * 0 0 + * 2**31-1 pi - epsilon + */ + class GR_RUNTIME_API fxpt + { + static const int WORDBITS = 32; + static const int NBITS = 10; + static const float s_sine_table[1 << NBITS][2]; + static const float PI; + static const float TWO_TO_THE_31; + + public: + static gr_int32 + float_to_fixed(float x) + { + // Fold x into -PI to PI. + int d = (int)floor(x/2/PI+0.5); + x -= d*2*PI; + // And convert to an integer. + return (gr_int32) ((float) x * TWO_TO_THE_31 / PI); + } + + static float + fixed_to_float (gr_int32 x) + { + return x * (PI / TWO_TO_THE_31); + } + + /*! + * \brief Given a fixed point angle x, return float sine (x) + */ + static float + sin(gr_int32 x) + { + gr_uint32 ux = x; + int index = ux >> (WORDBITS - NBITS); + return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1]; + } + + /* + * \brief Given a fixed point angle x, return float cosine (x) + */ + static float + cos (gr_int32 x) + { + gr_uint32 ux = x + 0x40000000; + int index = ux >> (WORDBITS - NBITS); + return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1]; + } + + /* + * \brief Given a fixedpoint angle x, return float cos(x) and sin (x) + */ + static void sincos(gr_int32 x, float *s, float *c) + { + gr_uint32 ux = x; + int sin_index = ux >> (WORDBITS - NBITS); + *s = s_sine_table[sin_index][0] * (ux >> 1) + s_sine_table[sin_index][1]; + + ux = x + 0x40000000; + int cos_index = ux >> (WORDBITS - NBITS); + *c = s_sine_table[cos_index][0] * (ux >> 1) + s_sine_table[cos_index][1]; + + return; + } + + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_FXPT_H */ diff --git a/gnuradio-runtime/include/gnuradio/fxpt_nco.h b/gnuradio-runtime/include/gnuradio/fxpt_nco.h new file mode 100644 index 0000000000..33a176d9b4 --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/fxpt_nco.h @@ -0,0 +1,160 @@ +/* -*- c++ -*- */ +/* + * Copyright 2002,2004,2013 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. + */ + +#ifndef INCLUDED_GR_FXPT_NCO_H +#define INCLUDED_GR_FXPT_NCO_H + +#include <gnuradio/api.h> +#include <gnuradio/fxpt.h> +#include <gnuradio/gr_complex.h> +#include <stdint.h> + +namespace gr { + + /*! + * \brief Numerically Controlled Oscillator (NCO) + * \ingroup misc + */ + class /*GR_RUNTIME_API*/ fxpt_nco + { + uint32_t d_phase; + int32_t d_phase_inc; + + public: + fxpt_nco() : d_phase(0), d_phase_inc(0) {} + + ~fxpt_nco() {} + + // radians + void set_phase(float angle) { + d_phase = gr::fxpt::float_to_fixed(angle); + } + + void adjust_phase(float delta_phase) { + d_phase += gr::fxpt::float_to_fixed(delta_phase); + } + + // angle_rate is in radians / step + void set_freq(float angle_rate){ + d_phase_inc = gr::fxpt::float_to_fixed(angle_rate); + } + + // angle_rate is a delta in radians / step + void adjust_freq(float delta_angle_rate) + { + d_phase_inc += gr::fxpt::float_to_fixed(delta_angle_rate); + } + + // increment current phase angle + + void step() + { + d_phase += d_phase_inc; + } + + void step(int n) + { + d_phase += d_phase_inc * n; + } + + // units are radians / step + float get_phase() const { return gr::fxpt::fixed_to_float(d_phase); } + float get_freq() const { return gr::fxpt::fixed_to_float(d_phase_inc); } + + // compute sin and cos for current phase angle + void sincos(float *sinx, float *cosx) const + { + *sinx = gr::fxpt::sin(d_phase); + *cosx = gr::fxpt::cos(d_phase); + } + + // compute cos and sin for a block of phase angles + void sincos(gr_complex *output, int noutput_items, double ampl=1.0) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = gr_complex(gr::fxpt::cos(d_phase) * ampl, gr::fxpt::sin(d_phase) * ampl); + step(); + } + } + + // compute sin for a block of phase angles + void sin(float *output, int noutput_items, double ampl=1.0) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = (float)(gr::fxpt::sin(d_phase) * ampl); + step(); + } + } + + // compute cos for a block of phase angles + void cos(float *output, int noutput_items, double ampl=1.0) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = (float)(gr::fxpt::cos(d_phase) * ampl); + step (); + } + } + + // compute sin for a block of phase angles + void sin(short *output, int noutput_items, double ampl=1.0) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = (short)(gr::fxpt::sin(d_phase) * ampl); + step(); + } + } + + // compute cos for a block of phase angles + void cos(short *output, int noutput_items, double ampl=1.0) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = (short)(gr::fxpt::cos(d_phase) * ampl); + step(); + } + } + + // compute sin for a block of phase angles + void sin(int *output, int noutput_items, double ampl=1.0) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = (int)(gr::fxpt::sin(d_phase) * ampl); + step(); + } + } + + // compute cos for a block of phase angles + void cos(int *output, int noutput_items, double ampl=1.0) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = (int)(gr::fxpt::cos(d_phase) * ampl); + step(); + } + } + + // compute cos or sin for current phase angle + float cos() const { return gr::fxpt::cos(d_phase); } + float sin() const { return gr::fxpt::sin(d_phase); } + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_FXPT_NCO_H */ diff --git a/gnuradio-runtime/include/gnuradio/fxpt_vco.h b/gnuradio-runtime/include/gnuradio/fxpt_vco.h new file mode 100644 index 0000000000..77d58677ce --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/fxpt_vco.h @@ -0,0 +1,80 @@ +/* -*- c++ -*- */ +/* + * Copyright 2002,2004,2005,2013 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. + */ + +#ifndef INCLUDED_GR_FXPT_VCO_H +#define INCLUDED_GR_FXPT_VCO_H + +#include <gnuradio/api.h> +#include <gnuradio/fxpt.h> +#include <gnuradio/gr_complex.h> + +namespace gr { + + /*! + * \brief Voltage Controlled Oscillator (VCO) + * \ingroup misc + */ + class /*GR_RUNTIME_API*/ fxpt_vco { + gr_int32 d_phase; + + public: + fxpt_vco () : d_phase(0) {} + + ~fxpt_vco() {} + + // radians + void set_phase(float angle) { + d_phase = fxpt::float_to_fixed(angle); + } + + void adjust_phase(float delta_phase) { + d_phase += fxpt::float_to_fixed(delta_phase); + } + + float get_phase() const { + return fxpt::fixed_to_float(d_phase); + } + + // compute sin and cos for current phase angle + void sincos(float *sinx, float *cosx) const + { + *sinx = fxpt::sin(d_phase); + *cosx = fxpt::cos(d_phase); + } + + // compute a block at a time + void cos(float *output, const float *input, int noutput_items, float k, float ampl = 1.0) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = (float)(fxpt::cos(d_phase) * ampl); + adjust_phase(input[i] * k); + } + } + + // compute cos or sin for current phase angle + float cos() const { return fxpt::cos(d_phase); } + float sin() const { return fxpt::sin(d_phase); } + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_FXPT_VCO_H */ diff --git a/gnuradio-runtime/include/gr_complex.h b/gnuradio-runtime/include/gnuradio/gr_complex.h index 6166c0b142..bd94c0f0f8 100644 --- a/gnuradio-runtime/include/gr_complex.h +++ b/gnuradio-runtime/include/gnuradio/gr_complex.h @@ -19,6 +19,7 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ + #ifndef INCLUDED_GR_COMPLEX_H #define INCLUDED_GR_COMPLEX_H diff --git a/gnuradio-runtime/include/gnuradio/hier_block2.h b/gnuradio-runtime/include/gnuradio/hier_block2.h new file mode 100644 index 0000000000..ff09f9139d --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/hier_block2.h @@ -0,0 +1,221 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006-2009,2013 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. + */ + +#ifndef INCLUDED_GR_RUNTIME_HIER_BLOCK2_H +#define INCLUDED_GR_RUNTIME_HIER_BLOCK2_H + +#include <gnuradio/api.h> +#include <gnuradio/basic_block.h> + +namespace gr { + + /*! + * \brief public constructor for hier_block2 + */ + GR_RUNTIME_API hier_block2_sptr + make_hier_block2(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature); + + class hier_block2_detail; + + /*! + * \brief Hierarchical container class for gr::block's and gr::hier_block2's + * \ingroup container_blk + * \ingroup base_blk + */ + class GR_RUNTIME_API hier_block2 : public basic_block + { + private: + friend class hier_block2_detail; + friend GR_RUNTIME_API hier_block2_sptr + make_hier_block2(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature); + + /*! + * \brief Private implementation details of gr::hier_block2 + */ + hier_block2_detail *d_detail; + + protected: + hier_block2(void) {} // allows pure virtual interface sub-classes + hier_block2(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature); + + public: + virtual ~hier_block2(); + + /*! + * \brief typedef for object returned from self(). + * + * This type is only guaranteed to be passable to connect and + * disconnect. No other assumptions should be made about it. + */ + typedef basic_block_sptr opaque_self; + + /*! + * \brief Return an object, representing the current block, which + * can be passed to connect. + * + * The returned object may only be used as an argument to connect + * or disconnect. Any other use of self() results in unspecified + * (erroneous) behavior. + */ + opaque_self self(); + + /*! + * \brief Add a stand-alone (possibly hierarchical) block to + * internal graph + * + * This adds a gr-block or hierarchical block to the internal + * graph without wiring it to anything else. + */ + void connect(basic_block_sptr block); + + /*! + * \brief Add gr-blocks or hierarchical blocks to internal graph + * and wire together + * + * This adds (if not done earlier by another connect) a pair of + * gr-blocks or hierarchical blocks to the internal flowgraph, and + * wires the specified output port to the specified input port. + */ + void connect(basic_block_sptr src, int src_port, + basic_block_sptr dst, int dst_port); + + /*! + * \brief Add gr-blocks or hierarchical blocks to internal graph + * and wire together + * + * This adds (if not done earlier by another connect) a pair of + * gr-blocks or hierarchical blocks to the internal message port + * subscription + */ + void msg_connect(basic_block_sptr src, pmt::pmt_t srcport, + basic_block_sptr dst, pmt::pmt_t dstport); + void msg_connect(basic_block_sptr src, std::string srcport, + basic_block_sptr dst, std::string dstport); + void msg_disconnect(basic_block_sptr src, pmt::pmt_t srcport, + basic_block_sptr dst, pmt::pmt_t dstport); + void msg_disconnect(basic_block_sptr src, std::string srcport, + basic_block_sptr dst, std::string dstport); + + /*! + * \brief Remove a gr-block or hierarchical block from the + * internal flowgraph. + * + * This removes a gr-block or hierarchical block from the internal + * flowgraph, disconnecting it from other blocks as needed. + */ + void disconnect(basic_block_sptr block); + + /*! + * \brief Disconnect a pair of gr-blocks or hierarchical blocks in + * internal flowgraph. + * + * This disconnects the specified input port from the specified + * output port of a pair of gr-blocks or hierarchical blocks. + */ + void disconnect(basic_block_sptr src, int src_port, + basic_block_sptr dst, int dst_port); + + /*! + * \brief Disconnect all connections in the internal flowgraph. + * + * This call removes all output port to input port connections in + * the internal flowgraph. + */ + void disconnect_all(); + + /*! + * Lock a flowgraph in preparation for reconfiguration. When an + * equal number of calls to lock() and unlock() have occurred, the + * flowgraph will be reconfigured. + * + * N.B. lock() and unlock() may not be called from a flowgraph + * thread (E.g., gr::block::work method) or deadlock will occur + * when reconfiguration happens. + */ + virtual void lock(); + + /*! + * Unlock a flowgraph in preparation for reconfiguration. When an + * equal number of calls to lock() and unlock() have occurred, the + * flowgraph will be reconfigured. + * + * N.B. lock() and unlock() may not be called from a flowgraph + * thread (E.g., gr::block::work method) or deadlock will occur + * when reconfiguration happens. + */ + virtual void unlock(); + + // This is a public method for ease of code organization, but should be + // ignored by the user. + flat_flowgraph_sptr flatten() const; + + hier_block2_sptr to_hier_block2(); // Needed for Python type coercion + + bool has_msg_port(pmt::pmt_t which_port) { + return message_port_is_hier(which_port) || basic_block::has_msg_port(which_port); + } + + bool message_port_is_hier(pmt::pmt_t port_id) { + return message_port_is_hier_in(port_id) || message_port_is_hier_out(port_id); + } + + bool message_port_is_hier_in(pmt::pmt_t port_id) { + return pmt::list_has(hier_message_ports_in, port_id); + } + + bool message_port_is_hier_out(pmt::pmt_t port_id) { + return pmt::list_has(hier_message_ports_out, port_id); + } + + pmt::pmt_t hier_message_ports_in; + pmt::pmt_t hier_message_ports_out; + + void message_port_register_hier_in(pmt::pmt_t port_id) { + if(pmt::list_has(hier_message_ports_in, port_id)) + throw std::invalid_argument("hier msg in port by this name already registered"); + if(msg_queue.find(port_id) != msg_queue.end()) + throw std::invalid_argument("block already has a primitive input port by this name"); + hier_message_ports_in = pmt::list_add(hier_message_ports_in, port_id); + } + + void message_port_register_hier_out(pmt::pmt_t port_id) { + if(pmt::list_has(hier_message_ports_out, port_id)) + throw std::invalid_argument("hier msg out port by this name already registered"); + if(pmt::dict_has_key(message_subscribers, port_id)) + throw std::invalid_argument("block already has a primitive output port by this name"); + hier_message_ports_out = pmt::list_add(hier_message_ports_out, port_id); + } + }; + + inline hier_block2_sptr cast_to_hier_block2_sptr(basic_block_sptr block) { + return boost::dynamic_pointer_cast<hier_block2, basic_block>(block); + } + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RUNTIME_HIER_BLOCK2_H */ diff --git a/gnuradio-runtime/include/high_res_timer.h b/gnuradio-runtime/include/gnuradio/high_res_timer.h index fc7b007c61..fc7b007c61 100644 --- a/gnuradio-runtime/include/high_res_timer.h +++ b/gnuradio-runtime/include/gnuradio/high_res_timer.h diff --git a/gnuradio-runtime/include/ice_application_base.h b/gnuradio-runtime/include/gnuradio/ice_application_base.h index 64ec615e5c..1cb60fbf96 100644 --- a/gnuradio-runtime/include/ice_application_base.h +++ b/gnuradio-runtime/include/gnuradio/ice_application_base.h @@ -28,8 +28,8 @@ #include <sys/time.h> #endif -#include <gr_runtime_api.h> -#include <gr_prefs.h> +#include <gnuradio/api.h> +#include <gnuradio/prefs.h> #include <Ice/Ice.h> #include <boost/thread.hpp> #include <boost/thread/mutex.hpp> @@ -119,7 +119,7 @@ void ice_application_base<TserverBase, TserverClass>::starticeexample() char* argv[2]; argv[0] = (char*)""; - std::string conffile = gr_prefs::singleton()->get_string("ControlPort", "config", ""); + std::string conffile = gr::prefs::singleton()->get_string("ControlPort", "config", ""); if(conffile.size() > 0) { std::stringstream iceconf; diff --git a/gnuradio-runtime/include/ice_server_template.h b/gnuradio-runtime/include/gnuradio/ice_server_template.h index ff411b7f41..45c1756a48 100644 --- a/gnuradio-runtime/include/ice_server_template.h +++ b/gnuradio-runtime/include/gnuradio/ice_server_template.h @@ -23,8 +23,8 @@ #ifndef ICE_SERVER_TEMPLATE_H #define ICE_SERVER_TEMPLATE_H -#include <rpcserver_ice.h> -#include <ice_application_base.h> +#include <gnuradio/rpcserver_ice.h> +#include <gnuradio/ice_application_base.h> #include <iostream> template<typename TserverBase, typename TserverClass, typename TImplClass, typename TIceClass> diff --git a/gnuradio-runtime/include/gnuradio/io_signature.h b/gnuradio-runtime/include/gnuradio/io_signature.h new file mode 100644 index 0000000000..973f93cd98 --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/io_signature.h @@ -0,0 +1,111 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2007 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. + */ + +#ifndef INCLUDED_IO_SIGNATURE_H +#define INCLUDED_IO_SIGNATURE_H + +#include <gnuradio/api.h> +#include <gnuradio/runtime_types.h> + +namespace gr { + + /*! + * \brief i/o signature for input and output ports. + * \brief misc + */ + class GR_RUNTIME_API io_signature + { + int d_min_streams; + int d_max_streams; + std::vector<int> d_sizeof_stream_item; + + io_signature(int min_streams, int max_streams, + const std::vector<int> &sizeof_stream_items); + + public: + typedef boost::shared_ptr<io_signature> sptr; + + static const int IO_INFINITE = -1; + + ~io_signature(); + + /*! + * \brief Create an i/o signature + * + * \ingroup internal + * \param min_streams specify minimum number of streams (>= 0) + * \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 + */ + static sptr make(int min_streams, int max_streams, + int sizeof_stream_item); + + /*! + * \brief Create an i/o signature + * + * \param min_streams specify minimum number of streams (>= 0) + * \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite) + * \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 + */ + static sptr make2(int min_streams, int max_streams, + int sizeof_stream_item1, + int sizeof_stream_item2); + + /*! + * \brief Create an i/o signature + * + * \param min_streams specify minimum number of streams (>= 0) + * \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite) + * \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 stream + * \param sizeof_stream_item3 specify the size of the items in the third and subsequent streams + */ + static sptr make3(int min_streams, int max_streams, + int sizeof_stream_item1, + int sizeof_stream_item2, + int sizeof_stream_item3); + + /*! + * \brief Create an i/o signature + * + * \param min_streams specify minimum number of streams (>= 0) + * \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite) + * \param sizeof_stream_items specify the size of the items in the streams + * + * If there are more streams than there are entries in + * sizeof_stream_items, the value of the last entry in + * sizeof_stream_items is used for the missing values. + * sizeof_stream_items must contain at least 1 entry. + */ + static sptr makev(int min_streams, int max_streams, + const std::vector<int> &sizeof_stream_items); + + int min_streams() const { return d_min_streams; } + int max_streams() const { return d_max_streams; } + int sizeof_stream_item(int index) const; + std::vector<int> sizeof_stream_items() const; + }; + +} /* namespace gr */ + +#endif /* INCLUDED_IO_SIGNATURE_H */ diff --git a/gnuradio-runtime/include/gnuradio/logger.h.in b/gnuradio-runtime/include/gnuradio/logger.h.in new file mode 100644 index 0000000000..c92d9d3ba2 --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/logger.h.in @@ -0,0 +1,751 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 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. + */ + +/******************************************************************************* +* Author: Mark Plett +* Description: +* The gr::logger module wraps the log4cpp library for logging in gnuradio +*******************************************************************************/ + +#ifndef INCLUDED_GR_LOGGER_H +#define INCLUDED_GR_LOGGER_H + +/*! +* \ingroup logging +* \brief GNU Radio logging wrapper for log4cpp library (C++ port of log4j) +* +*/ + +#ifndef ENABLE_GR_LOG +#cmakedefine ENABLE_GR_LOG +#endif +#ifndef HAVE_LOG4CPP +#cmakedefine HAVE_LOG4CPP +#endif + +#ifdef _MSC_VER +typedef unsigned short mode_t; +#endif + +#include <gnuradio/api.h> +#include <assert.h> +#include <iostream> +#include <time.h> +#include <boost/filesystem.hpp> +#include <boost/thread.hpp> +#include <pmt/pmt.h> + +#ifdef ENABLE_GR_LOG + +// We have three configurations... first logging to stdout/stderr +#ifndef HAVE_LOG4CPP + +namespace gr { + //#warning GR logging Enabled and using std::cout + typedef std::string logger_ptr; +} /* namespace gr */ + +#define GR_LOG_DECLARE_LOGPTR(logger) +#define GR_LOG_ASSIGN_LOGPTR(logger,name) +#define GR_CONFIG_LOGGER(config) +#define GR_CONFIG_AND_WATCH_LOGGER(config,period) +#define GR_LOG_GETLOGGER(logger, name) +#define GR_SET_LEVEL(name, level) +#define GR_LOG_SET_LEVEL(logger, level) +#define GR_GET_LEVEL(name, level) +#define GR_LOG_GET_LEVEL(logger, level) +#define GR_ADD_APPENDER(name,appender) +#define GR_LOG_ADD_APPENDER(logger,appender) +#define GR_ADD_CONSOLE_APPENDER(logger,target,pattern) +#define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern) +#define GR_ADD_FILE_APPENDER(name,filename,append,pattern) +#define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern) +#define GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern) +#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern) +#define GR_GET_LOGGER_NAMES(names) +#define GR_RESET_CONFIGURATION() +#define GR_DEBUG(name, msg) std::cout<<"DEBUG: "<<msg<<std::endl +#define GR_INFO(name, msg) std::cout<<"INFO: "<<msg<<std::endl +#define GR_NOTICE(name, msg) std::cout<<"NOTICE: "<<msg<<std::endl +#define GR_WARN(name, msg) std::cerr<<"WARN: "<<msg<<std::endl +#define GR_ERROR(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl +#define GR_ALERT(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl +#define GR_CRIT(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl +#define GR_FATAL(name, msg) std::cerr<<"FATAL: "<<msg<<std::endl +#define GR_EMERG(name, msg) std::cerr<<"EMERG: "<<msg<<std::endl +#define GR_ERRORIF(name, cond, msg) {if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl;} +#define GR_ASSERT(name, cond, msg) {if(!(cond)) std::cerr<<"FATAL: "<<msg<<std::endl; assert(cond);} +#define GR_LOG_DEBUG(logger, msg) std::cout<<"DEBUG: "<<msg<<std::endl +#define GR_LOG_INFO(logger, msg) std::cout<<"INFO: "<<msg<<std::endl +#define GR_LOG_NOTICE(logger, msg) std::cout<<"NOTICE: "<<msg<<std::endl +#define GR_LOG_WARN(logger, msg) std::cerr<<"WARN: "<<msg<<std::endl +#define GR_LOG_ERROR(logger, msg) std::cerr<<"ERROR: "<<msg<<std::endl +#define GR_LOG_ALERT(logger, msg) std::cerr<<"ALERT: "<<msg<<std::endl +#define GR_LOG_CRIT(logger, msg) std::cerr<<"CRIT: "<<msg<<std::endl +#define GR_LOG_FATAL(logger, msg) std::cerr<<"FATAL: "<<msg<<std::endl +#define GR_LOG_EMERG(logger, msg) std::cerr<<"EMERG: "<<msg<<std::endl +#define GR_LOG_ERRORIF(logger, cond, msg) { \ + if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl;} +#define GR_LOG_ASSERT(logger, cond, msg) { \ + if(!(cond)) {std::cerr<<"FATAL: "<<msg<<std::endl; assert(cond);};} + + +#else /* HAVE_LOG4CPP */ + +// Second configuration...logging to log4cpp +#include <log4cpp/Category.hh> +#include <log4cpp/PropertyConfigurator.hh> +#include <log4cpp/FileAppender.hh> +#include <log4cpp/RollingFileAppender.hh> +#include <log4cpp/OstreamAppender.hh> +#include <log4cpp/PatternLayout.hh> + +namespace gr { + + /*! + * \brief GR_LOG macros + * \ingroup logging + * + * These macros wrap the standard LOG4CPP_LEVEL macros. The availablie macros + * are: + * LOG_DEBUG + * LOG_INFO + * LOG_WARN + * LOG_TRACE + * LOG_ERROR + * LOG_ALERT + * LOG_CRIT + * LOG_FATAL + * LOG_EMERG + */ + typedef log4cpp::Category* logger_ptr; + +} /* namespace gr */ + + + /* Macros for Programmatic Configuration */ +#define GR_LOG_DECLARE_LOGPTR(logger) \ + gr::logger_ptr logger; + +#define GR_LOG_ASSIGN_LOGPTR(logger,name) \ + logger = gr::logger_get_logger(name); + +#define GR_CONFIG_LOGGER(config) \ + gr::logger_config::load_config(config) + +#define GR_CONFIG_AND_WATCH_LOGGER(config,period) \ + gr::logger_config::load_config(config,period) + +#define GR_LOG_GETLOGGER(logger, name) \ + gr::logger_ptr logger = gr::logger_get_logger(name); + +#define GR_SET_LEVEL(name, level) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + gr::logger_set_level(logger,level);} + +#define GR_LOG_SET_LEVEL(logger, level) \ + gr::logger_set_level(logger, level); + +#define GR_GET_LEVEL(name, level) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + gr::logger_get_level(logger,level);} + +#define GR_LOG_GET_LEVEL(logger, level) \ + gr::logger_get_level(logger,level); + +#define GR_ADD_APPENDER(name, appender) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + gr::logger_add_appender(logger,appender);} + +#define GR_LOG_ADD_APPENDER(logger, appender) { \ + gr::logger_add_appender(logger, appender);} + +#define GR_ADD_CONSOLE_APPENDER(name, target, pattern) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + gr::logger_add_console_appender(logger,target,pattern);} + +#define GR_LOG_ADD_CONSOLE_APPENDER(logger, target, pattern) { \ + gr::logger_add_console_appender(logger,target,pattern);} + +#define GR_ADD_FILE_APPENDER(name, filename, append, pattern) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + gr::logger_add_file_appender(logger,filename,append,pattern);} + +#define GR_LOG_ADD_FILE_APPENDER(logger, filename, append, pattern) { \ + gr::logger_add_file_appender(logger,filename,append,pattern);} + +#define GR_ADD_ROLLINGFILE_APPENDER(name, filename, filesize, bkup_index, append, mode, pattern) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + gr::logger_add_rollingfile_appender(logger,filename,filesize,bkup_index,append,mode,pattern);} + +#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger, filename, filesize, bkup_index, append, mode, pattern) { \ + gr::logger_add_rollingfile_appender(logger,filename,filesize,bkup_index,append,mode,pattern);} + +#define GR_GET_LOGGER_NAMES(names) { \ + names = gr::logger_get_logger_names();} + +#define GR_RESET_CONFIGURATION() \ + gr::logger_config::reset_config(); + + /* Logger name referenced macros */ +#define GR_DEBUG(name, msg) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + *logger<< log4cpp::Priority::DEBUG << msg << log4cpp::eol;} + +#define GR_INFO(name, msg) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + *logger<< log4cpp::Priority::INFO << msg << log4cpp::eol;} + +#define GR_NOTICE(name, msg) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + *logger << log4cpp::Priority::NOTICE << msg;} + +#define GR_WARN(name, msg) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + *logger<< log4cpp::Priority::WARN << msg << log4cpp::eol;} + +#define GR_ERROR(name, msg) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + *logger<< log4cpp::Priority::ERROR << msg << log4cpp::eol;} + +#define GR_CRIT(name, msg) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + *logger<< log4cpp::Priority::CRIT << msg << log4cpp::eol;} + +#define GR_ALERT(name, msg) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + *logger<< log4cpp::Priority::ALERT << msg << log4cpp::eol;} + +#define GR_FATAL(name, msg) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + *logger<< log4cpp::Priority::FATAL << msg << log4cpp::eol;} + +#define GR_EMERG(name, msg) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + *logger<< log4cpp::Priority::EMERG << msg << log4cpp::eol;} + +#define GR_ERRORIF(name, cond, msg) { \ + if((cond)) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + *logger<< log4cpp::Priority::ERROR << msg << log4cpp::eol;} \ + } + +#define GR_ASSERT(name, cond, msg) { \ + if(!(cond)) { \ + gr::logger_ptr logger = gr::logger_get_logger(name); \ + *logger<< log4cpp::Priority::EMERG << msg << log4cpp::eol;} \ + assert(0); \ + } + + /* LoggerPtr Referenced Macros */ +#define GR_LOG_DEBUG(logger, msg) { \ + *logger << log4cpp::Priority::DEBUG << msg << log4cpp::eol;} + +#define GR_LOG_INFO(logger, msg) { \ + *logger << log4cpp::Priority::INFO << msg << log4cpp::eol;} + +#define GR_LOG_NOTICE(logger, msg) { \ + *logger << log4cpp::Priority::NOTICE << msg << log4cpp::eol;} + +#define GR_LOG_WARN(logger, msg) { \ + *logger << log4cpp::Priority::WARN << msg << log4cpp::eol;} + +#define GR_LOG_ERROR(logger, msg) { \ + *logger << log4cpp::Priority::ERROR << msg << log4cpp::eol;} + +#define GR_LOG_CRIT(logger, msg) { \ + *logger << log4cpp::Priority::CRIT << msg << log4cpp::eol;} + +#define GR_LOG_ALERT(logger, msg) { \ + *logger << log4cpp::Priority::ALERT << msg << log4cpp::eol;} + +#define GR_LOG_FATAL(logger, msg) { \ + *logger << log4cpp::Priority::FATAL << msg << log4cpp::eol;} + +#define GR_LOG_EMERG(logger, msg) { \ + *logger << log4cpp::Priority::EMERG << msg << log4cpp::eol;} + +#define GR_LOG_ERRORIF(logger,cond, msg) { \ + if((cond)) { \ + *logger<< log4cpp::Priority::ERROR << msg << log4cpp::eol;} \ + } + +#define GR_LOG_ASSERT(logger, cond, msg) { \ + if(!(cond)) { \ + *logger<< log4cpp::Priority::EMERG << msg << log4cpp::eol; \ + assert(0);} \ + } + +namespace gr { + + /*! + * \brief Class to control configuration of logger. + * This is a singleton that cna launch a thread to wathc a config file for changes + * \ingroup logging + */ + class logger_config + { + private: + /*! \brief filename of logger config file */ + std::string filename; + /*! \brief Period (seconds) over which watcher thread checks config file for changes */ + unsigned int watch_period; + /*! \brief Pointer to watch thread for config file changes */ + boost::thread *watch_thread; + + /*! \brief Watcher thread method + * /param filename Name of configuration file + * /param watch_period Seconds between checks for changes in config file + */ + static void watch_file(std::string filename,unsigned int watch_period); + + static bool logger_configured; + + logger_config()/*: + rpc_get_filename("logger_config", "filename", &logger_config::get_filename4rpc, + pmt::mp(""), pmt::mp(""), pmt::mp(""), + "", "filename", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP), + rpc_get_watchperiod("logger_config", "watch_period", &logger_config::get_watchperiod4rpc, + pmt::mp(0), pmt::mp(32768), pmt::mp(0), + "", "watch_period", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP), + rpc_get_config("logger_config", "config", &logger_config::get_config4rpc, + pmt::mp(""), pmt::mp(""), pmt::mp(""), + "", "filename", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP), + rpc_set_config("logger_config","config", &logger_config::set_config4rpc, + pmt::mp(""), pmt::mp(""), pmt::mp(""), + "", "filename", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP) + */ + { + } //!< Constructor + + /* + rpcbasic_register_get<logger_config,std::string> rpc_get_filename; + rpcbasic_register_get<logger_config,int> rpc_get_watchperiod; + rpcbasic_register_get<logger_config,std::string> rpc_get_config; + rpcbasic_register_set<logger_config,std::string> rpc_set_config; + */ + + logger_config(logger_config const&); //!<Copy constructor + void operator=(logger_config const&); //!<Assignment Operator + + std::string get_filename4rpc() { + return filename; + } + int get_watchperiod4rpc(){return watch_period;}; + + std::string get_config4rpc() { + return filename; + } + + void set_config4rpc(std::string set) { + printf("Set string was:%s\n", set.c_str()); + } + + /*! \brief destrcutor stops watch thread before exits */ + ~logger_config() { + stop_watch(); + } + + /*! \brief Instance getter for singleton. Only used by class. */ + static logger_config& get_instance(void); + + public: + /*! \brief Getter for config filename */ + static std::string get_filename(); + /*! \brief Getter for watch period */ + static unsigned int get_watch_period(); + /*! \brief Method to load configuration + * /param filename Name of configuration file + * /param watch_period Seconds between checks for changes in config file + */ + static void load_config(std::string filename,unsigned int watch_period=0); + /*! \brief Method to stop watcher thread */ + static void stop_watch(); + /*! \brief method to reset logger configuration */ + static void reset_config(void); + }; + + /*! + * \brief Retrieve a pointer to a logger by name + * + * Retrives a logger pointer + * \p name. + * + * \param name Name of the logger for which a pointer is requested + */ + GR_RUNTIME_API logger_ptr logger_get_logger(std::string name); + + /*! + * \brief Load logger's configuration file. + * + * Initialize the GNU Radio logger by loading the configuration file + * \p config_filename. + * + * \param config_filename The configuration file. Set to "" for the + * basic logger that outputs to the console. + */ + GR_RUNTIME_API bool logger_load_config(const std::string &config_filename=""); + + /*! + * \brief Reset logger's configuration file. + * + * Remove all appenders from loggers + */ + GR_RUNTIME_API void logger_reset_config(void); + + /*! + * \brief Set the logger's output level. + * + * Sets the level of the logger. This takes a string that is + * translated to the standard levels and can be (case insensitive): + * + * \li off , notset + * \li debug + * \li info + * \li notice + * \li warn + * \li error + * \li crit + * \li alert + * \li fatal + * \li emerg + * + * \param logger the logger to set the level of. + * \param level string to set the level to. + */ + GR_RUNTIME_API void logger_set_level(logger_ptr logger, + const std::string &level); + + /*! + * \brief Set the logger's output level. + * + * Sets the level of the logger. This takes the actual Log4cpp::Priority + * data type, which can be: + * + * \li log4cpp::Priority::NOTSET + * \li log4cpp::Priority::DEBUG + * \li log4cpp::Priority::INFO + * \li log4cpp::Priority::NOTICE + * \li log4cpp::Priority::WARN + * \li log4cpp::Priority::ERROR + * \li log4cpp::Priority::CRIT + * \li log4cpp::Priority::ALERT + * \li log4cpp::Priority::FATAL + * \li log4cpp::Priority::EMERG + * + * \param logger the logger to set the level of. + * \param level new logger level of type Log4cpp::Priority + */ + GR_RUNTIME_API void logger_set_level(logger_ptr logger, + log4cpp::Priority::Value level); + + /*! + * \brief Get the logger's output level. + * + * Gets the level of the logger. This returns a string that + * corresponds to the standard levels and can be (case insensitive): + * + * \li notset + * \li debug + * \li info + * \li notice + * \li warn + * \li error + * \li crit + * \li alert + * \li fatal + * \li emerg + * + * \param logger the logger to get the level of. + * \param level string to get the level into. + */ + GR_RUNTIME_API void logger_get_level(logger_ptr logger, std::string &level); + + /*! + * \brief Get the logger's output level. + * + * Gets the level of the logger. This returns the actual Log4cpp::Level + * data type, which can be: + * + * \li log4cpp::Priority::NOTSET + * \li log4cpp::Priority::DEBUG + * \li log4cpp::Priority::INFO + * \li log4cpp::Priority::NOTICE + * \li log4cpp::Priority::WARN + * \li log4cpp::Priority::ERROR + * \li log4cpp::Priority::CRIT + * \li log4cpp::Priority::ALERT + * \li log4cpp::Priority::FATAL + * \li log4cpp::Priority::EMERG + * + * \param logger the logger to get the level of. + * \param level of the logger. + */ + GR_RUNTIME_API void logger_get_level(logger_ptr logger, + log4cpp::Priority::Value &level); + + /*! + * \brief Add console appender to a given logger + * + * Add console appender to a given logger + * + * \param logger Logger to which appender will be added + * \param target Std target to write 'cout' or 'cerr' (default is cout) + * \param pattern Formating pattern for log messages + */ + GR_RUNTIME_API void logger_add_appender(logger_ptr logger, + std::string appender); + + /*! + * \brief Add console appender to a given logger + * + * Add console appender to a given logger + * + * \param logger Logger to which appender will be added + * \param target Std target to write 'cout' or 'cerr' (default is cout) + * \param pattern Formating pattern for log messages + */ + GR_RUNTIME_API void logger_add_console_appender(logger_ptr logger, + std::string target, + std::string pattern); + + /*! + * \brief Add file appender to a given logger + * + * Add file appender to a given logger + * + * \param logger Logger to which appender will be added + * \param filename File to which log will be written + * \param append Overwrite or append to log file + * \param pattern Formating pattern for log messages + */ + GR_RUNTIME_API void logger_add_file_appender(logger_ptr logger, + std::string filename, + bool append, std::string pattern); + + /*! + * \brief Add rolling file appender to a given logger + * + * Add rolling file appender to a given logger + * + * \param logger Logger to which appender will be added + * \param filename File to which log will be written + * \param filesize Sizez of files to write + * \param bkup_index Number of files to write + * \param append Overwrite or append to log file + * \param mode Permissions to set on log file + * \param pattern Formating pattern for log messages + */ + GR_RUNTIME_API void logger_add_rollingfile_appender(logger_ptr logger, std::string filename, + size_t filesize, int bkup_index, bool append, + mode_t mode,std::string pattern); + + /*! + * \brief Add rolling file appender to a given logger + * + * Add rolling file appender to a given logger + * + * \return vector of string names of loggers + */ + GR_RUNTIME_API std::vector<std::string> logger_get_logger_names(void); + +} /* namespace gr */ + +#endif /* HAVE_LOG4CPP */ + + // If Logger disable do nothing +#else /* ENABLE_GR_LOG */ + +namespace gr { + typedef void* logger_ptr; +} /* namespace gr */ + +#define GR_LOG_DECLARE_LOGPTR(logger) +#define GR_LOG_ASSIGN_LOGPTR(logger,name) +#define GR_CONFIG_LOGGER(config) +#define GR_CONFIG_AND_WATCH_LOGGER(config,period) +#define GR_LOG_GETLOGGER(logger, name) +#define GR_SET_LEVEL(name, level) +#define GR_LOG_SET_LEVEL(logger, level) +#define GR_GET_LEVEL(name, level) +#define GR_LOG_GET_LEVEL(logger, level) +#define GR_ADD_APPENDER(name,appender) +#define GR_LOG_ADD_APPENDER(logger,appender) +#define GR_ADD_CONSOLE_APPENDER(logger,target,pattern) +#define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern) +#define GR_ADD_FILE_APPENDER(name,filename,append,pattern) +#define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern) +#define GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern) +#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern) +#define GR_GET_LOGGER_NAMES(names) +#define GR_RESET_CONFIGURATION() +#define GR_DEBUG(name, msg) +#define GR_INFO(name, msg) +#define GR_NOTICE(name, msg) +#define GR_WARN(name, msg) +#define GR_ERROR(name, msg) +#define GR_ALERT(name, msg) +#define GR_CRIT(name, msg) +#define GR_FATAL(name, msg) +#define GR_EMERG(name, msg) +#define GR_ERRORIF(name, cond, msg) +#define GR_ASSERT(name, cond, msg) +#define GR_LOG_DEBUG(logger, msg) +#define GR_LOG_INFO(logger, msg) +#define GR_LOG_NOTICE(logger, msg) +#define GR_LOG_WARN(logger, msg) +#define GR_LOG_ERROR(logger, msg) +#define GR_LOG_ALERT(logger, msg) +#define GR_LOG_CRIT(logger, msg) +#define GR_LOG_FATAL(logger, msg) +#define GR_LOG_EMERG(logger, msg) +#define GR_LOG_ERRORIF(logger, cond, msg) +#define GR_LOG_ASSERT(logger, cond, msg) + +#endif /* ENABLE_GR_LOG */ + +namespace gr { + + // Even if logger is disabled we'll need for methods below to exist in python. + // The macros these call will be disabled if ENABLE_GR_LOG is undefined + + /********************* Start Classes and Methods for Python ******************/ + /*! + * \brief Logger class for referencing loggers in python. Not + * needed in C++ (use macros) Wraps and manipulates loggers for + * python as python has no macros + * \ingroup logging + * + */ + class logger + { + private: + /*! \brief logger pointer to logger associated wiith this wrapper class */ + logger_ptr d_logger; + public: + /*! + * \brief contructor Provide name of logger to associate with this class + * \param logger_name Name of logger associated with class + */ + logger(std::string logger_name) { + GR_LOG_ASSIGN_LOGPTR(d_logger,logger_name); + }; + + /*! \brief Destructor */ + ~logger(){;} + + // Wrappers for logging macros + /*! \brief inline function, wrapper to set the logger level */ + void set_level(std::string level){GR_LOG_SET_LEVEL(d_logger,level);} + + /*! \brief inline function, wrapper to get the logger level */ + void get_level(std::string &level){GR_LOG_GET_LEVEL(d_logger,level);} + + /*! \brief inline function, wrapper for LOG4CPP_DEBUG for DEBUG message */ + void debug(std::string msg){GR_LOG_DEBUG(d_logger,msg);}; + + /*! \brief inline function, wrapper for LOG4CPP_INFO for INFO message */ + void info(std::string msg){GR_LOG_INFO(d_logger,msg);} + + /*! \brief inline function, wrapper for NOTICE message */ + void notice(std::string msg){GR_LOG_NOTICE(d_logger,msg);} + + /*! \brief inline function, wrapper for LOG4CPP_WARN for WARN message */ + void warn(std::string msg){GR_LOG_WARN(d_logger,msg);} + + /*! \brief inline function, wrapper for LOG4CPP_ERROR for ERROR message */ + void error(std::string msg){GR_LOG_ERROR(d_logger,msg);} + + /*! \brief inline function, wrapper for NOTICE message */ + void crit(std::string msg){GR_LOG_CRIT(d_logger,msg);} + + /*! \brief inline function, wrapper for ALERT message */ + void alert(std::string msg){GR_LOG_ALERT(d_logger,msg);} + + /*! \brief inline function, wrapper for FATAL message */ + void fatal(std::string msg){GR_LOG_FATAL(d_logger,msg);} + + /*! \brief inline function, wrapper for EMERG message */ + void emerg(std::string msg){GR_LOG_EMERG(d_logger,msg);} + + /*! \brief inline function, wrapper for LOG4CPP_ASSERT for conditional ERROR message */ + void errorIF(bool cond,std::string msg){GR_LOG_ERRORIF(d_logger,cond,msg);} + + /*! \brief inline function, wrapper for LOG4CPP_ASSERT for conditional ERROR message */ + void log_assert(bool cond,std::string msg){GR_LOG_ASSERT(d_logger,cond,msg);} + + /*! \brief inline function, Method to add appender to logger by + name (define appender in conf file) */ + void add_appender(std::string appender) { + GR_LOG_ADD_APPENDER(d_logger, appender); + } + + /*! \brief inline function, Method to add console appender to logger */ + void add_console_appender(std::string target,std::string pattern) { + GR_LOG_ADD_CONSOLE_APPENDER(d_logger, target, pattern); + } + + /*! \brief inline function, Method to add file appender to logger */ + void add_file_appender(std::string filename, bool append, std::string pattern) { + GR_LOG_ADD_FILE_APPENDER(d_logger, filename, append, pattern); + } + + /*! \brief inline function, Method to add rolling file appender to logger */ + void add_rollingfile_appender(std::string filename, size_t filesize, + int bkup_index, bool append, mode_t mode, + std::string pattern) { + GR_LOG_ADD_ROLLINGFILE_APPENDER(d_logger,filename,filesize, + bkup_index,append,mode,pattern); + } + }; + +} /* namespace gr */ + +/**************** Start Configuration Class and Methods for Python ************/ +/*! + * \brief Function to call configuration macro from python. + * Note: Configuration is only updated if filename or watch_period has changed. + * \param config_filename Name of configuration file + * \param watch_period Seconds to wait between checking for changes in conf file. + * Watch_period defaults to 0 in which case the file is not watched for changes + */ +GR_RUNTIME_API void gr_logger_config(const std::string config_filename, + unsigned int watch_period = 0); + +/*! + * \brief Function to return logger names to python + * \return Vector of name strings + * + */ +GR_RUNTIME_API std::vector<std::string> gr_logger_get_logger_names(void); + +/*! + * \brief Function to reset logger configuration from python + * + */ +GR_RUNTIME_API void gr_logger_reset_config(void); + +#endif /* INCLUDED_GR_LOGGER_H */ diff --git a/gnuradio-runtime/include/gnuradio/math.h b/gnuradio-runtime/include/gnuradio/math.h new file mode 100644 index 0000000000..d611c98c95 --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/math.h @@ -0,0 +1,227 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2005,2008,2013 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. + */ + +/* + * mathematical odds and ends. + */ + +#ifndef _GR_MATH_H_ +#define _GR_MATH_H_ + +#include <cmath> +#include <gnuradio/api.h> +#include <gnuradio/gr_complex.h> + +namespace gr { + + static inline bool + is_power_of_2(long x) + { + return x != 0 && (x & (x-1)) == 0; + } + + /*! + * \brief Fast arc tangent using table lookup and linear interpolation + * \ingroup misc + * + * \param y component of input vector + * \param x component of input vector + * \returns float angle angle of vector (x, y) in radians + * + * This function calculates the angle of the vector (x,y) based on a + * table lookup and linear interpolation. The table uses a 256 point + * table covering -45 to +45 degrees and uses symetry to determine + * the final angle value in the range of -180 to 180 degrees. Note + * that this function uses the small angle approximation for values + * close to zero. This routine calculates the arc tangent with an + * average error of +/- 0.045 degrees. + */ + GR_RUNTIME_API float fast_atan2f(float y, float x); + + static inline float + fast_atan2f(gr_complex z) + { + return fast_atan2f(z.imag(), z.real()); + } + + /* This bounds x by +/- clip without a branch */ + static inline float + branchless_clip(float x, float clip) + { + float x1 = fabsf(x+clip); + float x2 = fabsf(x-clip); + x1 -= x2; + return 0.5*x1; + } + + static inline float + clip(float x, float clip) + { + float y = x; + if(x > clip) + y = clip; + else if(x < -clip) + y = -clip; + return y; + } + + // Slicer Functions + static inline unsigned int + binary_slicer(float x) + { + if(x >= 0) + return 1; + else + return 0; + } + + static inline unsigned int + quad_45deg_slicer(float r, float i) + { + unsigned int ret = 0; + if((r >= 0) && (i >= 0)) + ret = 0; + else if((r < 0) && (i >= 0)) + ret = 1; + else if((r < 0) && (i < 0)) + ret = 2; + else + ret = 3; + return ret; + } + + static inline unsigned int + quad_0deg_slicer(float r, float i) + { + unsigned int ret = 0; + if(fabsf(r) > fabsf(i)) { + if(r > 0) + ret = 0; + else + ret = 2; + } + else { + if(i > 0) + ret = 1; + else + ret = 3; + } + + return ret; + } + + static inline unsigned int + quad_45deg_slicer(gr_complex x) + { + return quad_45deg_slicer(x.real(), x.imag()); + } + + static inline unsigned int + quad_0deg_slicer(gr_complex x) + { + return quad_0deg_slicer(x.real(), x.imag()); + } + + // Branchless Slicer Functions + static inline unsigned int + branchless_binary_slicer(float x) + { + return (x >= 0); + } + + static inline unsigned int + branchless_quad_0deg_slicer(float r, float i) + { + unsigned int ret = 0; + ret = (fabsf(r) > fabsf(i)) * (((r < 0) << 0x1)); // either 0 (00) or 2 (10) + ret |= (fabsf(i) > fabsf(r)) * (((i < 0) << 0x1) | 0x1); // either 1 (01) or 3 (11) + + return ret; + } + + static inline unsigned int + branchless_quad_0deg_slicer(gr_complex x) + { + return branchless_quad_0deg_slicer(x.real(), x.imag()); + } + + static inline unsigned int + branchless_quad_45deg_slicer(float r, float i) + { + char ret = (r <= 0); + ret |= ((i <= 0) << 1); + return (ret ^ ((ret & 0x2) >> 0x1)); + } + + static inline unsigned int + branchless_quad_45deg_slicer(gr_complex x) + { + return branchless_quad_45deg_slicer(x.real(), x.imag()); + } + + /*! + * \param x any value + * \param pow2 must be a power of 2 + * \returns \p x rounded down to a multiple of \p pow2. + */ + static inline size_t + p2_round_down(size_t x, size_t pow2) + { + return x & -pow2; + } + + /*! + * \param x any value + * \param pow2 must be a power of 2 + * \returns \p x rounded up to a multiple of \p pow2. + */ + static inline size_t + p2_round_up(size_t x, size_t pow2) + { + return p2_round_down(x + pow2 - 1, pow2); + } + + /*! + * \param x any value + * \param pow2 must be a power of 2 + * \returns \p x modulo \p pow2. + */ + static inline size_t + p2_modulo(size_t x, size_t pow2) + { + return x & (pow2 - 1); + } + + /*! + * \param x any value + * \param pow2 must be a power of 2 + * \returns \p pow2 - (\p x modulo \p pow2). + */ + static inline size_t + p2_modulo_neg(size_t x, size_t pow2) + { + return pow2 - p2_modulo(x, pow2); + } + +} /* namespace gr */ + +#endif /* _GR_MATH_H_ */ diff --git a/gnuradio-runtime/include/gnuradio/message.h b/gnuradio-runtime/include/gnuradio/message.h new file mode 100644 index 0000000000..0fda2d9c8c --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/message.h @@ -0,0 +1,91 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 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. + */ + +#ifndef INCLUDED_GR_MESSAGE_H +#define INCLUDED_GR_MESSAGE_H + +#include <gnuradio/api.h> +#include <gnuradio/types.h> +#include <string> + +namespace gr { + + /*! + * \brief Message class. + * + * \ingroup misc + * The ideas and method names for adjustable message length were + * lifted from the click modular router "Packet" class. + */ + class GR_RUNTIME_API message + { + public: + typedef boost::shared_ptr<message> sptr; + + private: + sptr d_next; // link field for msg queue + long d_type; // type of the message + double d_arg1; // optional arg1 + double d_arg2; // optional arg2 + + unsigned char *d_buf_start; // start of allocated buffer + unsigned char *d_msg_start; // where the msg starts + unsigned char *d_msg_end; // one beyond end of msg + unsigned char *d_buf_end; // one beyond end of allocated buffer + + message(long type, double arg1, double arg2, size_t length); + + friend class msg_queue; + + unsigned char *buf_data() const { return d_buf_start; } + size_t buf_len() const { return d_buf_end - d_buf_start; } + + public: + /*! + * \brief public constructor for message + */ + static sptr make(long type = 0, double arg1 = 0, double arg2 = 0, size_t length = 0); + + static sptr make_from_string(const std::string s, long type = 0, + double arg1 = 0, double arg2 = 0); + + + ~message(); + + long type() const { return d_type; } + double arg1() const { return d_arg1; } + double arg2() const { return d_arg2; } + + void set_type(long type) { d_type = type; } + void set_arg1(double arg1) { d_arg1 = arg1; } + void set_arg2(double arg2) { d_arg2 = arg2; } + + unsigned char *msg() const { return d_msg_start; } + size_t length() const { return d_msg_end - d_msg_start; } + std::string to_string() const; + }; + + GR_RUNTIME_API long message_ncurrently_allocated(); + +} /* namespace gr */ + +#endif /* INCLUDED_GR_MESSAGE_H */ diff --git a/gnuradio-runtime/include/messages/CMakeLists.txt b/gnuradio-runtime/include/gnuradio/messages/CMakeLists.txt index f79f2bd24f..f79f2bd24f 100644 --- a/gnuradio-runtime/include/messages/CMakeLists.txt +++ b/gnuradio-runtime/include/gnuradio/messages/CMakeLists.txt diff --git a/gnuradio-runtime/include/messages/msg_accepter.h b/gnuradio-runtime/include/gnuradio/messages/msg_accepter.h index d3e89daf74..cd87b21dec 100644 --- a/gnuradio-runtime/include/messages/msg_accepter.h +++ b/gnuradio-runtime/include/gnuradio/messages/msg_accepter.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_MSG_ACCEPTER_H #define INCLUDED_MSG_ACCEPTER_H -#include <gr_runtime_api.h> +#include <gnuradio/api.h> #include <pmt/pmt.h> #include <boost/shared_ptr.hpp> diff --git a/gnuradio-runtime/include/messages/msg_accepter_msgq.h b/gnuradio-runtime/include/gnuradio/messages/msg_accepter_msgq.h index 5d1d4f7e27..ba699b8ee6 100644 --- a/gnuradio-runtime/include/messages/msg_accepter_msgq.h +++ b/gnuradio-runtime/include/gnuradio/messages/msg_accepter_msgq.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_MSG_ACCEPTER_MSGQ_H #define INCLUDED_MSG_ACCEPTER_MSGQ_H -#include <gr_runtime_api.h> -#include <messages/msg_accepter.h> -#include <messages/msg_queue.h> +#include <gnuradio/api.h> +#include <gnuradio/messages/msg_accepter.h> +#include <gnuradio/messages/msg_queue.h> namespace gr { namespace messages { diff --git a/gnuradio-runtime/include/messages/msg_passing.h b/gnuradio-runtime/include/gnuradio/messages/msg_passing.h index 3bfccda339..6ad6c40b08 100644 --- a/gnuradio-runtime/include/messages/msg_passing.h +++ b/gnuradio-runtime/include/gnuradio/messages/msg_passing.h @@ -26,9 +26,9 @@ * \brief Include this header to use the message passing features */ -#include <gr_runtime_api.h> +#include <gnuradio/api.h> #include <pmt/pmt.h> -#include <messages/msg_accepter.h> +#include <gnuradio/messages/msg_accepter.h> namespace gr { namespace messages { diff --git a/gnuradio-runtime/include/messages/msg_producer.h b/gnuradio-runtime/include/gnuradio/messages/msg_producer.h index 3167fc442a..758320fc6a 100644 --- a/gnuradio-runtime/include/messages/msg_producer.h +++ b/gnuradio-runtime/include/gnuradio/messages/msg_producer.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_MSG_PRODUCER_H #define INCLUDED_MSG_PRODUCER_H -#include <gr_runtime_api.h> +#include <gnuradio/api.h> #include <pmt/pmt.h> #include <boost/shared_ptr.hpp> diff --git a/gnuradio-runtime/include/messages/msg_queue.h b/gnuradio-runtime/include/gnuradio/messages/msg_queue.h index 81531afcdf..dfe1ca97be 100644 --- a/gnuradio-runtime/include/messages/msg_queue.h +++ b/gnuradio-runtime/include/gnuradio/messages/msg_queue.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_MSG_QUEUE_H #define INCLUDED_MSG_QUEUE_H -#include <gr_runtime_api.h> -#include <thread/thread.h> +#include <gnuradio/api.h> +#include <gnuradio/thread/thread.h> #include <pmt/pmt.h> #include <deque> @@ -47,7 +47,7 @@ namespace gr { gr::thread::condition_variable d_not_full; unsigned int d_limit; // max # of messages in queue. 0 -> unbounded - std::deque<pmt::pmt_t> d_msgs; + std::deque<pmt::pmt_t> d_msgs; public: msg_queue(unsigned int limit); @@ -69,7 +69,7 @@ namespace gr { /*! * \brief If there's a message in the q, delete it and return it. - * If no message is available, return pmt_t(). + * If no message is available, return pmt::pmt_t(). */ pmt::pmt_t delete_head_nowait(); diff --git a/gnuradio-runtime/include/gr_misc.h b/gnuradio-runtime/include/gnuradio/misc.h index 182ae87de6..290e39b490 100644 --- a/gnuradio-runtime/include/gr_misc.h +++ b/gnuradio-runtime/include/gnuradio/misc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_MISC_H #define INCLUDED_GR_MISC_H -#include <gr_runtime_api.h> -#include <gr_types.h> +#include <gnuradio/api.h> +#include <gnuradio/types.h> GR_RUNTIME_API unsigned int gr_rounduppow2(unsigned int n); diff --git a/gnuradio-runtime/include/gr_msg_accepter.h b/gnuradio-runtime/include/gnuradio/msg_accepter.h index e7feac4686..1f60a9e555 100644 --- a/gnuradio-runtime/include/gr_msg_accepter.h +++ b/gnuradio-runtime/include/gnuradio/msg_accepter.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2009 Free Software Foundation, Inc. + * Copyright 2009,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,25 +19,28 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef INCLUDED_GR_MSG_ACCEPTER_H -#define INCLUDED_GR_MSG_ACCEPTER_H +#ifndef INCLUDED_GR_RUNTIME_MSG_ACCEPTER_H +#define INCLUDED_GR_RUNTIME_MSG_ACCEPTER_H -#include <gr_runtime_api.h> -#include <messages/msg_accepter.h> +#include <gnuradio/api.h> +#include <gnuradio/messages/msg_accepter.h> #include <pmt/pmt.h> -/*! - * \brief Accepts messages and inserts them into a message queue, then notifies - * subclass gr_basic_block there is a message pending. - */ -class GR_RUNTIME_API gr_msg_accepter : public gr::messages::msg_accepter -{ -public: - gr_msg_accepter(); - ~gr_msg_accepter(); +namespace gr { + + /*! + * \brief Accepts messages and inserts them into a message queue, + * then notifies subclass gr::basic_block there is a message pending. + */ + class GR_RUNTIME_API msg_accepter : public gr::messages::msg_accepter + { + public: + msg_accepter(); + ~msg_accepter(); - void post(pmt::pmt_t which_port, pmt::pmt_t msg); + void post(pmt::pmt_t which_port, pmt::pmt_t msg); + }; -}; +} /* namespace gr */ -#endif /* INCLUDED_GR_MSG_ACCEPTER_H */ +#endif /* INCLUDED_GR_RUNTIME_MSG_ACCEPTER_H */ diff --git a/gnuradio-runtime/include/gr_msg_handler.h b/gnuradio-runtime/include/gnuradio/msg_handler.h index 06d583a38b..b37f215616 100644 --- a/gnuradio-runtime/include/gr_msg_handler.h +++ b/gnuradio-runtime/include/gnuradio/msg_handler.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,25 +19,31 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ + #ifndef INCLUDED_GR_MSG_HANDLER_H #define INCLUDED_GR_MSG_HANDLER_H -#include <gr_runtime_api.h> -#include <gr_message.h> +#include <gnuradio/api.h> +#include <gnuradio/message.h> -class gr_msg_handler; -typedef boost::shared_ptr<gr_msg_handler> gr_msg_handler_sptr; +namespace gr { -/*! - * \brief abstract class of message handlers - * \ingroup base - */ -class GR_RUNTIME_API gr_msg_handler { -public: - virtual ~gr_msg_handler (); + class msg_handler; + typedef boost::shared_ptr<msg_handler> msg_handler_sptr; + + /*! + * \brief abstract class of message handlers + * \ingroup base + */ + class GR_RUNTIME_API msg_handler + { + public: + virtual ~msg_handler(); + + //! handle \p msg + virtual void handle(message::sptr msg) = 0; + }; - //! handle \p msg - virtual void handle (gr_message_sptr msg) = 0; -}; +} /* namespace gr */ #endif /* INCLUDED_GR_MSG_HANDLER_H */ diff --git a/gnuradio-runtime/include/gnuradio/msg_queue.h b/gnuradio-runtime/include/gnuradio/msg_queue.h new file mode 100644 index 0000000000..3326cf9a7f --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/msg_queue.h @@ -0,0 +1,95 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2009 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. + */ + +#ifndef INCLUDED_GR_MSG_QUEUE_H +#define INCLUDED_GR_MSG_QUEUE_H + +#include <gnuradio/api.h> +#include <gnuradio/msg_handler.h> +#include <gnuradio/thread/thread.h> + +namespace gr { + + /*! + * \brief thread-safe message queue + * \ingroup misc + */ + class GR_RUNTIME_API msg_queue : public msg_handler + { + gr::thread::mutex d_mutex; + gr::thread::condition_variable d_not_empty; + gr::thread::condition_variable d_not_full; + message::sptr d_head; + message::sptr d_tail; + unsigned int d_count; // # of messages in queue. + unsigned int d_limit; // max # of messages in queue. 0 -> unbounded + + public: + typedef boost::shared_ptr<msg_queue> sptr; + + static sptr make(unsigned int limit=0); + + msg_queue(unsigned int limit); + ~msg_queue(); + + //! Generic msg_handler method: insert the message. + void handle(message::sptr msg) { insert_tail (msg); } + + /*! + * \brief Insert message at tail of queue. + * \param msg message + * + * Block if queue if full. + */ + void insert_tail(message::sptr msg); + + /*! + * \brief Delete message from head of queue and return it. + * Block if no message is available. + */ + message::sptr delete_head(); + + /*! + * \brief If there's a message in the q, delete it and return it. + * If no message is available, return 0. + */ + message::sptr delete_head_nowait(); + + //! Delete all messages from the queue + void flush(); + + //! is the queue empty? + bool empty_p() const { return d_count == 0; } + + //! is the queue full? + bool full_p() const { return d_limit != 0 && d_count >= d_limit; } + + //! return number of messages in queue + unsigned int count() const { return d_count; } + + //! return limit on number of message in queue. 0 -> unbounded + unsigned int limit() const { return d_limit; } + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_MSG_QUEUE_H */ diff --git a/gnuradio-runtime/include/gnuradio/nco.h b/gnuradio-runtime/include/gnuradio/nco.h new file mode 100644 index 0000000000..aff72068b9 --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/nco.h @@ -0,0 +1,199 @@ +/* -*- c++ -*- */ +/* + * Copyright 2002,2013 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. + */ + +#ifndef _GR_NCO_H_ +#define _GR_NCO_H_ + +#include <gnuradio/sincos.h> +#include <gnuradio/gr_complex.h> +#include <vector> +#include <cmath> + +namespace gr { + + /*! + * \brief base class template for Numerically Controlled Oscillator (NCO) + * \ingroup misc + */ + template<class o_type, class i_type> + class nco + { + public: + nco() : phase(0), phase_inc(0) {} + + virtual ~nco() {} + + // radians + void set_phase(double angle) + { + phase = angle; + } + + void adjust_phase(double delta_phase) + { + phase += delta_phase; + } + + // angle_rate is in radians / step + void set_freq(double angle_rate) + { + phase_inc = angle_rate; + } + + // angle_rate is a delta in radians / step + void adjust_freq(double delta_angle_rate) + { + phase_inc += delta_angle_rate; + } + + // increment current phase angle + void step() + { + phase += phase_inc; + if(fabs(phase) > M_PI) { + while(phase > M_PI) + phase -= 2*M_PI; + + while(phase < -M_PI) + phase += 2*M_PI; + } + } + + void step(int n) + { + phase += phase_inc * n; + if(fabs(phase) > M_PI){ + while(phase > M_PI) + phase -= 2*M_PI; + + while(phase < -M_PI) + phase += 2*M_PI; + } + } + + // units are radians / step + double get_phase() const { return phase; } + double get_freq() const { return phase_inc; } + + // compute sin and cos for current phase angle + void sincos(float *sinx, float *cosx) const; + + // compute cos or sin for current phase angle + float cos() const { return std::cos(phase); } + float sin() const { return std::sin(phase); } + + // compute a block at a time + void sin(float *output, int noutput_items, double ampl = 1.0); + void cos(float *output, int noutput_items, double ampl = 1.0); + void sincos(gr_complex *output, int noutput_items, double ampl = 1.0); + void sin(short *output, int noutput_items, double ampl = 1.0); + void cos(short *output, int noutput_items, double ampl = 1.0); + void sin(int *output, int noutput_items, double ampl = 1.0); + void cos(int *output, int noutput_items, double ampl = 1.0); + + protected: + double phase; + double phase_inc; + }; + + template<class o_type, class i_type> + void + nco<o_type,i_type>::sincos(float *sinx, float *cosx) const + { + gr::sincosf(phase, sinx, cosx); + } + + template<class o_type, class i_type> + void + nco<o_type,i_type>::sin(float *output, int noutput_items, double ampl) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = (float)(sin () * ampl); + step(); + } + } + + template<class o_type, class i_type> + void + nco<o_type,i_type>::cos(float *output, int noutput_items, double ampl) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = (float)(cos() * ampl); + step(); + } + } + + template<class o_type, class i_type> + void + nco<o_type,i_type>::sin(short *output, int noutput_items, double ampl) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = (short)(sin() * ampl); + step(); + } + } + + template<class o_type, class i_type> + void + nco<o_type,i_type>::cos(short *output, int noutput_items, double ampl) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = (short)(cos() * ampl); + step(); + } + } + + template<class o_type, class i_type> + void + nco<o_type,i_type>::sin(int *output, int noutput_items, double ampl) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = (int)(sin() * ampl); + step(); + } + } + + template<class o_type, class i_type> + void + nco<o_type,i_type>::cos(int *output, int noutput_items, double ampl) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = (int)(cos() * ampl); + step(); + } + } + + template<class o_type, class i_type> + void + nco<o_type,i_type>::sincos(gr_complex *output, int noutput_items, double ampl) + { + for(int i = 0; i < noutput_items; i++) { + float cosx, sinx; + nco::sincos(&sinx, &cosx); + output[i] = gr_complex(cosx * ampl, sinx * ampl); + step(); + } + } + +} /* namespace gr */ + +#endif /* _NCO_H_ */ diff --git a/gnuradio-runtime/include/gnuradio/prefs.h b/gnuradio-runtime/include/gnuradio/prefs.h new file mode 100644 index 0000000000..b675c83491 --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/prefs.h @@ -0,0 +1,152 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2013 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. + */ + +#ifndef INCLUDED_GR_PREFS_H +#define INCLUDED_GR_PREFS_H + +#include <gnuradio/api.h> +#include <string> +#include <map> +#include <gnuradio/thread/thread.h> + +namespace gr { + + typedef std::map< std::string, std::map<std::string, std::string> > config_map_t; + typedef std::map< std::string, std::map<std::string, std::string> >::iterator config_map_itr; + typedef std::map<std::string, std::string> config_map_elem_t; + typedef std::map<std::string, std::string>::iterator config_map_elem_itr; + + /*! + * \brief Base class for representing user preferences a la windows INI files. + * \ingroup misc + * + * The real implementation is in Python, and is accessable from C++ + * via the magic of SWIG directors. + */ + class GR_RUNTIME_API prefs + { + public: + static prefs *singleton(); + static void set_singleton(prefs *p); + + prefs(); + virtual ~prefs(); + + /*! + * \brief Returns the configuration options as a string. + */ + std::string to_string(); + + /*! + * \brief Saves the configuration settings to + * ${HOME}/.gnuradio/config.conf. + * + * WARNING: this will overwrite your current config.conf file. + */ + void save(); + + /*! + * \brief Does \p section exist? + */ + virtual bool has_section(const std::string §ion); + + /*! + * \brief Does \p option exist? + */ + virtual bool has_option(const std::string §ion, + const std::string &option); + + /*! + * \brief If option exists return associated value; else + * default_val. + */ + virtual const std::string get_string(const std::string §ion, + const std::string &option, + const std::string &default_val); + + /*! + * \brief Set or add a string \p option to \p section with value + * \p val. + */ + virtual void set_string(const std::string §ion, + const std::string &option, + const std::string &val); + + /*! + * \brief If option exists and value can be converted to bool, + * return it; else default_val. + */ + virtual bool get_bool(const std::string §ion, + const std::string &option, + bool default_val); + + /*! + * \brief Set or add a bool \p option to \p section with value \p val. + */ + virtual void set_bool(const std::string §ion, + const std::string &option, + bool val); + + /*! + * \brief If option exists and value can be converted to long, + * return it; else default_val. + */ + virtual long get_long(const std::string §ion, + const std::string &option, + long default_val); + + /*! + * \brief Set or add a long \p option to \p section with value \p val. + */ + virtual void set_long(const std::string §ion, + const std::string &option, + long val); + + /*! + * \brief If option exists and value can be converted to double, + * return it; else default_val. + */ + virtual double get_double(const std::string §ion, + const std::string &option, + double default_val); + + /*! + * \brief Set or add a double \p option to \p section with value \p val. + */ + virtual void set_double(const std::string §ion, + const std::string &option, + double val); + + protected: + virtual std::vector<std::string> _sys_prefs_filenames(); + virtual void _read_files(); + virtual void _convert_to_map(const std::string &conf); + virtual char * option_to_env(std::string section, std::string option); + + private: + gr::thread::mutex d_mutex; + config_map_t d_config_map; + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_PREFS_H */ diff --git a/gnuradio-runtime/include/gnuradio/py_feval.h b/gnuradio-runtime/include/gnuradio/py_feval.h new file mode 100644 index 0000000000..94def79ca1 --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/py_feval.h @@ -0,0 +1,77 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2013 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. + */ + +#include <pmt/pmt.h> + +namespace gr { + + class py_feval_dd : public feval_dd + { + public: + double calleval(double x) + { + ensure_py_gil_state _lock; + return eval(x); + } + }; + + class py_feval_cc : public feval_cc + { + public: + gr_complex calleval(gr_complex x) + { + ensure_py_gil_state _lock; + return eval(x); + } + }; + + class py_feval_ll : public feval_ll + { + public: + long calleval(long x) + { + ensure_py_gil_state _lock; + return eval(x); + } + }; + + class py_feval : public feval + { + public: + void calleval() + { + ensure_py_gil_state _lock; + eval(); + } + }; + + class py_feval_p : public feval_p + { + public: + void calleval(pmt::pmt_t x) + { + ensure_py_gil_state _lock; + eval(x); + } + }; + +} /* namespace gr */ diff --git a/gnuradio-runtime/include/pycallback_object.h b/gnuradio-runtime/include/gnuradio/pycallback_object.h index 23782a42be..de35181c0b 100644 --- a/gnuradio-runtime/include/pycallback_object.h +++ b/gnuradio-runtime/include/gnuradio/pycallback_object.h @@ -21,9 +21,9 @@ */ #include <iostream> -#include <rpcregisterhelpers.h> -#include <ice_application_base.h> -#include <IcePy_Communicator.h> +#include <gnuradio/rpcregisterhelpers.h> +#include <gnuradio/ice_application_base.h> +#include <gnuradio/IcePy_Communicator.h> #include <pythread.h> #include <boost/format.hpp> diff --git a/gnuradio-runtime/include/random.h b/gnuradio-runtime/include/gnuradio/random.h index c643c3e422..e01fcb7be7 100644 --- a/gnuradio-runtime/include/random.h +++ b/gnuradio-runtime/include/gnuradio/random.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003, 2008 Free Software Foundation, Inc. + * Copyright 2002 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,8 +20,11 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _RANDOM_H_ -#define _RANDOM_H_ +#ifndef INCLUDED_GR_RANDOM_H +#define INCLUDED_GR_RANDOM_H + +#include <gnuradio/api.h> +#include <gnuradio/gr_complex.h> // While rand(3) specifies RAND_MAX, random(3) says that the output // ranges from 0 to 2^31-1 but does not specify a macro to denote @@ -35,4 +38,44 @@ static const int RANDOM_MAX = 2147483647; // 2^31-1 #include <stdlib.h> -#endif // _RANDOM_H_ +namespace gr { + + /*! + * \brief pseudo random number generator + * \ingroup math_blk + */ + class GR_RUNTIME_API random + { + protected: + static const int NTAB = 32; + long d_seed; + long d_iy; + long d_iv[NTAB]; + int d_iset; + float d_gset; + + public: + random(long seed=3021); + + void reseed(long seed); + + /*! + * \brief uniform random deviate in the range [0.0, 1.0) + */ + float ran1(); + + /*! + * \brief normally distributed deviate with zero mean and variance 1 + */ + float gasdev(); + + float laplacian(); + float impulse(float factor); + float rayleigh(); + gr_complex rayleigh_complex(); + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RANDOM_H */ + diff --git a/gnuradio-runtime/include/gr_realtime.h b/gnuradio-runtime/include/gnuradio/realtime.h index a1e5af69c4..f3910f8c7d 100644 --- a/gnuradio-runtime/include/gr_realtime.h +++ b/gnuradio-runtime/include/gnuradio/realtime.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,15 +23,19 @@ #ifndef INCLUDED_GR_REALTIME_H #define INCLUDED_GR_REALTIME_H -#include <gr_runtime_api.h> -#include <realtime.h> +#include <gnuradio/api.h> +#include <gnuradio/realtime_impl.h> -typedef gr::rt_status_t gr_rt_status_t; +namespace gr { + + typedef impl::rt_status_t rt_status_t; -/*! - * \brief If possible, enable high-priority "real time" scheduling. - * \ingroup misc - */ -GR_RUNTIME_API gr_rt_status_t gr_enable_realtime_scheduling(); + /*! + * \brief If possible, enable high-priority "real time" scheduling. + * \ingroup misc + */ + GR_RUNTIME_API rt_status_t enable_realtime_scheduling(); + +} /* namespace gr */ #endif /* INCLUDED_GR_REALTIME_H */ diff --git a/gnuradio-runtime/include/gnuradio/realtime_impl.h b/gnuradio-runtime/include/gnuradio/realtime_impl.h new file mode 100644 index 0000000000..82845918ee --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/realtime_impl.h @@ -0,0 +1,97 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2008,2013 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. + */ + +#ifndef INCLUDED_GNURADIO_REALTIME_H +#define INCLUDED_GNURADIO_REALTIME_H + +#include <gnuradio/api.h> +#include <stdexcept> + +/*! + * \brief System independent way to ask for realtime scheduling + * + * \sa sys_pri.h + */ +namespace gr { + namespace impl { + + typedef enum { + RT_OK = 0, + RT_NOT_IMPLEMENTED, + RT_NO_PRIVS, + RT_OTHER_ERROR + } rt_status_t; + + enum rt_sched_policy { + RT_SCHED_RR = 0, // round robin + RT_SCHED_FIFO = 1, // first in first out + }; + + /* + * Define the range for our virtual priorities (don't change + * these) + * + * Processes (or threads) with numerically higher priority values + * are scheduled before processes with numerically lower priority + * values. Thus, the value returned by rt_priority_max() will be + * greater than the value returned by rt_priority_min(). + */ + static inline int rt_priority_min() { return 0; } + static inline int rt_priority_max() { return 15; } + static inline int rt_priority_default() { return 1; } + + struct GR_RUNTIME_API rt_sched_param { + int priority; + rt_sched_policy policy; + + rt_sched_param() + : priority(rt_priority_default()), policy(RT_SCHED_RR){} + + rt_sched_param(int priority_, rt_sched_policy policy_ = RT_SCHED_RR) + { + if(priority_ < rt_priority_min() || priority_ > rt_priority_max()) + throw std::invalid_argument("rt_sched_param: priority out of range"); + + priority = priority_; + policy = policy_; + } + }; + + /*! + * \brief If possible, enable "realtime" scheduling. + * \ingroup misc + * + * In general, this means that the code will be scheduled before + * any non-realtime (normal) processes. Note that if your code + * contains an non-blocking infinite loop and you enable realtime + * scheduling, it's possible to hang the system. + */ + + // NOTE: If you change this, you need to change the code in + // gnuradio-core/src/lib/runtime/gr_realtime.i, see note there. + rt_status_t + GR_RUNTIME_API enable_realtime_scheduling(rt_sched_param = rt_sched_param()); + + } /* namespace impl */ +} /* namespace gr */ + +#endif /* INCLUDED_GNURADIO_REALTIME_H */ diff --git a/gnuradio-runtime/include/rpccallbackregister_base.h b/gnuradio-runtime/include/gnuradio/rpccallbackregister_base.h index f2cd1d8051..3b5b392ec3 100644 --- a/gnuradio-runtime/include/rpccallbackregister_base.h +++ b/gnuradio-runtime/include/gnuradio/rpccallbackregister_base.h @@ -23,8 +23,8 @@ #ifndef RPCCALLBACKREGISTER_BASE_H #define RPCCALLBACKREGISTER_BASE_H -#include <messages/msg_accepter.h> -#include <messages/msg_producer.h> +#include <gnuradio/messages/msg_accepter.h> +#include <gnuradio/messages/msg_producer.h> typedef uint32_t DisplayType; diff --git a/gnuradio-runtime/include/rpcmanager.h b/gnuradio-runtime/include/gnuradio/rpcmanager.h index 6a385c8998..12cf279406 100644 --- a/gnuradio-runtime/include/rpcmanager.h +++ b/gnuradio-runtime/include/gnuradio/rpcmanager.h @@ -23,9 +23,9 @@ #ifndef RPCMANAGER_H #define RPCMANAGER_H -#include <gr_runtime_api.h> -#include <rpcmanager_base.h> -#include <rpcserver_booter_aggregator.h> +#include <gnuradio/api.h> +#include <gnuradio/rpcmanager_base.h> +#include <gnuradio/rpcserver_booter_aggregator.h> #include <memory> #include <iostream> @@ -53,7 +53,7 @@ class GR_RUNTIME_API rpcmanager : public virtual rpcmanager_base static bool make_aggregator; static bool booter_registered; static bool aggregator_registered; - static void rpcserver_booter_base_sptr_dest( rpcserver_booter_base* b) {;} + static void rpcserver_booter_base_sptr_dest(rpcserver_booter_base* b) {;} static rpcserver_booter_base* boot; static std::auto_ptr<rpcserver_booter_aggregator> aggregator; }; diff --git a/gnuradio-runtime/include/rpcmanager_base.h b/gnuradio-runtime/include/gnuradio/rpcmanager_base.h index 60425c4a15..60425c4a15 100644 --- a/gnuradio-runtime/include/rpcmanager_base.h +++ b/gnuradio-runtime/include/gnuradio/rpcmanager_base.h diff --git a/gnuradio-runtime/include/rpcpmtconverters_ice.h b/gnuradio-runtime/include/gnuradio/rpcpmtconverters_ice.h index e592f4cdfb..e592f4cdfb 100644 --- a/gnuradio-runtime/include/rpcpmtconverters_ice.h +++ b/gnuradio-runtime/include/gnuradio/rpcpmtconverters_ice.h diff --git a/gnuradio-runtime/include/rpcregisterhelpers.h b/gnuradio-runtime/include/gnuradio/rpcregisterhelpers.h index b09aae9704..e405f4e1ea 100644 --- a/gnuradio-runtime/include/rpcregisterhelpers.h +++ b/gnuradio-runtime/include/gnuradio/rpcregisterhelpers.h @@ -26,11 +26,11 @@ #include <stdio.h> #include <sstream> #include <iostream> -#include <rpcserver_booter_base.h> -#include <rpcmanager.h> -#include <rpcserver_selector.h> -#include <rpcserver_base.h> -#include <gr_block_registry.h> +#include <gnuradio/rpcserver_booter_base.h> +#include <gnuradio/rpcmanager.h> +#include <gnuradio/rpcserver_selector.h> +#include <gnuradio/rpcserver_base.h> +#include <gnuradio/block_registry.h> // Base classes template<typename T, typename Tto> class rpcextractor_base @@ -325,7 +325,7 @@ typedef boost::shared_ptr<rpcbasic_base> rpcbasic_sptr; template<typename T, typename Tto> struct rpcbasic_register_set : public rpcbasic_base { - // Function used to add a 'set' RPC call using a gr_basic_block's alias. + // Function used to add a 'set' RPC call using a basic_block's alias. rpcbasic_register_set(const std::string& block_alias, const char* functionbase, void (T::*function)(Tto), @@ -426,7 +426,7 @@ template<typename T, typename Tfrom> class rpcbasic_register_get : public rpcbasic_base { public: - // Function used to add a 'set' RPC call using a gr_basic_block's alias. + // Function used to add a 'set' RPC call using a basic_block's alias. // primary constructor to allow for T get() functions rpcbasic_register_get(const std::string& block_alias, const char* functionbase, diff --git a/gnuradio-runtime/include/rpcserver_aggregator.h b/gnuradio-runtime/include/gnuradio/rpcserver_aggregator.h index 050d9bb1e5..cc19d7ff48 100644 --- a/gnuradio-runtime/include/rpcserver_aggregator.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_aggregator.h @@ -25,8 +25,8 @@ #include <vector> #include <string> -#include <rpcserver_base.h> -#include <rpcmanager_base.h> +#include <gnuradio/rpcserver_base.h> +#include <gnuradio/rpcmanager_base.h> class rpcserver_aggregator : public virtual rpcserver_base { diff --git a/gnuradio-runtime/include/rpcserver_base.h b/gnuradio-runtime/include/gnuradio/rpcserver_base.h index bc985c8d53..e2a1f6ef24 100644 --- a/gnuradio-runtime/include/rpcserver_base.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_base.h @@ -23,7 +23,7 @@ #ifndef RPCSERVER_BASE_H #define RPCSERVER_BASE_H -#include <rpccallbackregister_base.h> +#include <gnuradio/rpccallbackregister_base.h> class rpcserver_base : public virtual callbackregister_base { diff --git a/gnuradio-runtime/include/rpcserver_booter_aggregator.h b/gnuradio-runtime/include/gnuradio/rpcserver_booter_aggregator.h index 38739a1b50..aac9ef8de6 100644 --- a/gnuradio-runtime/include/rpcserver_booter_aggregator.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_booter_aggregator.h @@ -23,9 +23,9 @@ #ifndef RPCSERVER_BOOTER_AGGREGATOR #define RPCSERVER_BOOTER_AGGREGATOR -#include <gr_runtime_api.h> -#include <rpcserver_booter_base.h> -#include <rpcserver_aggregator.h> +#include <gnuradio/api.h> +#include <gnuradio/rpcserver_booter_base.h> +#include <gnuradio/rpcserver_aggregator.h> #include <boost/shared_ptr.hpp> #include <string> diff --git a/gnuradio-runtime/include/rpcserver_booter_base.h b/gnuradio-runtime/include/gnuradio/rpcserver_booter_base.h index 682944dada..682944dada 100644 --- a/gnuradio-runtime/include/rpcserver_booter_base.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_booter_base.h diff --git a/gnuradio-runtime/include/rpcserver_booter_ice.h b/gnuradio-runtime/include/gnuradio/rpcserver_booter_ice.h index 69dfcc7602..11095ac433 100644 --- a/gnuradio-runtime/include/rpcserver_booter_ice.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_booter_ice.h @@ -23,8 +23,8 @@ #ifndef RPCSERVER_BOOTER_ICE_H #define RPCSERVER_BOOTER_ICE_H -#include <rpcserver_booter_base.h> -#include <ice_server_template.h> +#include <gnuradio/rpcserver_booter_base.h> +#include <gnuradio/ice_server_template.h> #include <gnuradio.h> class rpcserver_base; diff --git a/gnuradio-runtime/include/rpcserver_ice.h b/gnuradio-runtime/include/gnuradio/rpcserver_ice.h index 2c08f57dc7..c6c9d45717 100644 --- a/gnuradio-runtime/include/rpcserver_ice.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_ice.h @@ -23,8 +23,8 @@ #ifndef RPCSERVER_ICE_H #define RPCSERVER_ICE_H -#include <rpcserver_base.h> -#include <rpcpmtconverters_ice.h> +#include <gnuradio/rpcserver_base.h> +#include <gnuradio/rpcpmtconverters_ice.h> #include <string> #include <sstream> #include <map> diff --git a/gnuradio-runtime/include/rpcserver_selector.h b/gnuradio-runtime/include/gnuradio/rpcserver_selector.h index fa63c9a2dc..fa63c9a2dc 100644 --- a/gnuradio-runtime/include/rpcserver_selector.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_selector.h diff --git a/gnuradio-runtime/include/gnuradio/runtime_types.h b/gnuradio-runtime/include/gnuradio/runtime_types.h new file mode 100644 index 0000000000..f4674c0f0c --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/runtime_types.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2007 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. + */ + +#ifndef INCLUDED_GR_RUNTIME_TYPES_H +#define INCLUDED_GR_RUNTIME_TYPES_H + +#include <gnuradio/api.h> +#include <gnuradio/types.h> + +namespace gr { + + /* + * typedefs for smart pointers we use throughout the runtime system + */ + class basic_block; + class block; + class block_detail; + class buffer; + class buffer_reader; + class hier_block2; + class flat_flowgraph; + class flowgraph; + class top_block; + + typedef boost::shared_ptr<basic_block> basic_block_sptr; + typedef boost::shared_ptr<block> block_sptr; + typedef boost::shared_ptr<block_detail> block_detail_sptr; + typedef boost::shared_ptr<buffer> buffer_sptr; + typedef boost::shared_ptr<buffer_reader> buffer_reader_sptr; + typedef boost::shared_ptr<hier_block2> hier_block2_sptr; + typedef boost::shared_ptr<flat_flowgraph> flat_flowgraph_sptr; + typedef boost::shared_ptr<flowgraph> flowgraph_sptr; + typedef boost::shared_ptr<top_block> top_block_sptr; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RUNTIME_TYPES_H */ diff --git a/gnuradio-runtime/include/gr_sincos.h b/gnuradio-runtime/include/gnuradio/sincos.h index 5a182081de..f162f6e31b 100644 --- a/gnuradio-runtime/include/gr_sincos.h +++ b/gnuradio-runtime/include/gnuradio/sincos.h @@ -23,19 +23,13 @@ #ifndef INCLUDED_GR_SINCOS_H #define INCLUDED_GR_SINCOS_H -#include <gr_runtime_api.h> +#include <gnuradio/api.h> -#ifdef __cplusplus -extern "C" { -#endif +namespace gr { -// compute sine and cosine at the same time - -GR_RUNTIME_API void gr_sincos (double x, double *sin, double *cos); -GR_RUNTIME_API void gr_sincosf (float x, float *sin, float *cos); - -#ifdef __cplusplus -}; -#endif + // compute sine and cosine at the same time + GR_RUNTIME_API void sincos (double x, double *sin, double *cos); + GR_RUNTIME_API void sincosf (float x, float *sin, float *cos); +} #endif /* INCLUDED_GR_SINCOS_H */ diff --git a/gnuradio-runtime/include/gr_sptr_magic.h b/gnuradio-runtime/include/gnuradio/sptr_magic.h index 2a94806d18..898edc87fd 100644 --- a/gnuradio-runtime/include/gr_sptr_magic.h +++ b/gnuradio-runtime/include/gnuradio/sptr_magic.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008 Free Software Foundation, Inc. + * Copyright 2008,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -18,35 +18,40 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef INCLUDED_GR_SPTR_MAGIC_H -#define INCLUDED_GR_SPTR_MAGIC_H -#include <gr_runtime_api.h> +#ifndef INCLUDED_GR_RUNTIME_SPTR_MAGIC_H +#define INCLUDED_GR_RUNTIME_SPTR_MAGIC_H + +#include <gnuradio/api.h> #include <boost/shared_ptr.hpp> -class gr_basic_block; -class gr_hier_block2; +namespace gr { + class basic_block; + class hier_block2; +} namespace gnuradio { - namespace detail { - class GR_RUNTIME_API sptr_magic { + class GR_RUNTIME_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); + 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); }; }; /* - * \brief New! Improved! Standard method to get/create the boost::shared_ptr for a block. + * \brief New! Improved! Standard method to get/create the + * boost::shared_ptr for a block. */ template<class T> boost::shared_ptr<T> get_initial_sptr(T *p) { - return boost::dynamic_pointer_cast<T, gr_basic_block>(detail::sptr_magic::fetch_initial_sptr(p)); + return boost::dynamic_pointer_cast<T, gr::basic_block> + (detail::sptr_magic::fetch_initial_sptr(p)); } -}; +} -#endif /* INCLUDED_GR_SPTR_MAGIC_H */ +#endif /* INCLUDED_GR_RUNTIME_SPTR_MAGIC_H */ diff --git a/gnuradio-runtime/include/gnuradio/sync_block.h b/gnuradio-runtime/include/gnuradio/sync_block.h new file mode 100644 index 0000000000..4b0022ab7e --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/sync_block.h @@ -0,0 +1,69 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 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. + */ + +#ifndef INCLUDED_GR_RUNTIME_SYNC_BLOCK_H +#define INCLUDED_GR_RUNTIME_SYNC_BLOCK_H + +#include <gnuradio/api.h> +#include <gnuradio/block.h> + +namespace gr { + + /*! + * \brief synchronous 1:1 input to output with history + * \ingroup base_blk + * + * Override work to provide the signal processing implementation. + */ + class GR_RUNTIME_API sync_block : public block + { + protected: + sync_block(void) {} // allows pure virtual interface sub-classes + sync_block(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature); + + public: + /*! + * \brief just like gr::block::general_work, only this arranges to + * call consume_each for you + * + * The user must override work to define the signal processing code + */ + virtual int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) = 0; + + // gr::sync_block overrides these to assist work + void forecast(int noutput_items, gr_vector_int &ninput_items_required); + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + int fixed_rate_ninput_to_noutput(int ninput); + int fixed_rate_noutput_to_ninput(int noutput); + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RUNTIME_SYNC_BLOCK_H */ diff --git a/gnuradio-runtime/include/gnuradio/sync_decimator.h b/gnuradio-runtime/include/gnuradio/sync_decimator.h new file mode 100644 index 0000000000..129abdca79 --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/sync_decimator.h @@ -0,0 +1,72 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004, 2013 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. + */ + +#ifndef INCLUDED_GR_RUNTIME_SYNC_DECIMATOR_H +#define INCLUDED_GR_RUNTIME_SYNC_DECIMATOR_H + +#include <gnuradio/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + + /*! + * \brief synchronous N:1 input to output with history + * \ingroup base_blk + * + * Override work to provide the signal processing implementation. + */ + class GR_RUNTIME_API sync_decimator : public sync_block + { + private: + unsigned d_decimation; + + protected: + sync_decimator(void) {} // allows pure virtual interface sub-classes + sync_decimator(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature, + unsigned decimation); + + public: + unsigned decimation() const { return d_decimation; } + void set_decimation(unsigned decimation) + { + d_decimation = decimation; + set_relative_rate(1.0 / decimation); + } + + // gr::sync_decimator overrides these to assist work + void forecast(int noutput_items, gr_vector_int &ninput_items_required); + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + // derived classes should override work + + int fixed_rate_ninput_to_noutput(int ninput); + int fixed_rate_noutput_to_ninput(int noutput); + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RUNTIME_SYNC_DECIMATOR_H */ diff --git a/gnuradio-runtime/include/gnuradio/sync_interpolator.h b/gnuradio-runtime/include/gnuradio/sync_interpolator.h new file mode 100644 index 0000000000..bfe79f902e --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/sync_interpolator.h @@ -0,0 +1,74 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2008,2013 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. + */ + +#ifndef INCLUDED_GR_RUNTIME_SYNC_INTERPOLATOR_H +#define INCLUDED_GR_RUNTIME_SYNC_INTERPOLATOR_H + +#include <gnuradio/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + + /*! + * \brief synchronous 1:N input to output with history + * \ingroup base_blk + * + * Override work to provide the signal processing implementation. + */ + class GR_RUNTIME_API sync_interpolator : public sync_block + { + private: + unsigned d_interpolation; + + protected: + sync_interpolator(void) {} // allows pure virtual interface sub-classes + sync_interpolator(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature, + unsigned interpolation); + + public: + unsigned interpolation() const { return d_interpolation; } + void set_interpolation(unsigned interpolation) + { + d_interpolation = interpolation; + set_relative_rate(1.0 * interpolation); + set_output_multiple(interpolation); + } + + // gr::sync_interpolator overrides these to assist work + void forecast(int noutput_items, + gr_vector_int &ninput_items_required); + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + // derived classes should override work + + int fixed_rate_ninput_to_noutput(int ninput); + int fixed_rate_noutput_to_ninput(int noutput); + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RUNTIME_SYNC_INTERPOLATOR_H */ diff --git a/gnuradio-runtime/include/gr_sys_paths.h b/gnuradio-runtime/include/gnuradio/sys_paths.h index 6235e0e78f..1bd2e0deb7 100644 --- a/gnuradio-runtime/include/gr_sys_paths.h +++ b/gnuradio-runtime/include/gnuradio/sys_paths.h @@ -1,5 +1,5 @@ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,15 +19,19 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _GR_SYS_PATHS_H_ -#define _GR_SYS_PATHS_H_ +#ifndef GR_SYS_PATHS_H +#define GR_SYS_PATHS_H -#include <gr_runtime_api.h> +#include <gnuradio/api.h> -//! directory to create temporary files -GR_RUNTIME_API const char *gr_tmp_path(); +namespace gr { -//! directory to store application data -GR_RUNTIME_API const char *gr_appdata_path(); + //! directory to create temporary files + GR_RUNTIME_API const char *tmp_path(); -#endif /* _GR_SYS_PATHS_H_ */ + //! directory to store application data + GR_RUNTIME_API const char *appdata_path(); + +} /* namespace gr */ + +#endif /* GR_SYS_PATHS_H */ diff --git a/gnuradio-runtime/include/sys_pri.h b/gnuradio-runtime/include/gnuradio/sys_pri.h index 745176e681..adceb91b9d 100644 --- a/gnuradio-runtime/include/sys_pri.h +++ b/gnuradio-runtime/include/gnuradio/sys_pri.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_GNURADIO_SYS_PRI_H #define INCLUDED_GNURADIO_SYS_PRI_H -#include <gr_runtime_api.h> +#include <gnuradio/api.h> #include <realtime.h> /* diff --git a/gnuradio-runtime/include/gnuradio/tagged_stream_block.h b/gnuradio-runtime/include/gnuradio/tagged_stream_block.h new file mode 100644 index 0000000000..1fe92ee25a --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/tagged_stream_block.h @@ -0,0 +1,144 @@ +/* -*- c++ -*- */ +/* + * Copyright 2013 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. + */ + +#ifndef INCLUDED_GR_RUNTIME_TAGGED_STREAM_BLOCK_H +#define INCLUDED_GR_RUNTIME_TAGGED_STREAM_BLOCK_H + +#include <gnuradio/api.h> +#include <gnuradio/block.h> + +namespace gr { + + /*! + * \brief Block that operates on PDUs in form of tagged streams + * \ingroup base_blk + * + * Override work to provide the signal processing implementation. + */ + class GR_RUNTIME_API tagged_stream_block : public block + { + private: + pmt::pmt_t d_length_tag_key; //!< This is the key for the tag that stores the PDU length + gr_vector_int d_n_input_items_reqd; //!< How many input items do I need to process the next PDU? + + protected: + std::string d_length_tag_key_str; + tagged_stream_block(void) {} // allows pure virtual interface sub-classes + tagged_stream_block(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature, + const std::string &length_tag_key); + + /*! + * \brief Parse all tags on the first sample of a PDU, return the + * number of items per input and prune the length tags. + * + * In most cases, you don't need to override this, unless the + * number of items read is not directly coded in one single tag. + * + * Default behaviour: + * - Go through all input ports + * - On every input port, search for the tag with the key specified in \p length_tag_key + * - Copy that value as an int to the corresponding position in \p n_input_items_reqd + * - Remove the length tag. + * + * \param[in] tags All the tags found on the first item of every input port. + * \param[out] n_input_items_reqd Number of items which will be read from every input + */ + virtual void parse_length_tags(const std::vector<std::vector<tag_t> > &tags, + gr_vector_int &n_input_items_reqd); + + /*! + * \brief Calculate the number of output items. + * + * This is basically the inverse function to forecast(): Given a + * number of input items, it returns the maximum number of output + * items. + * + * You most likely need to override this function, unless your + * block is a sync block or integer interpolator/decimator. + */ + virtual int calculate_output_stream_length(const gr_vector_int &ninput_items); + + /*! + * \brief Set the new length tags on the output stream + * + * Default behaviour: Set a tag with key \p length_tag_key and the + * number of produced items on every output port. + * + * For anything else, override this. + * + * \param n_produced Length of the new PDU + * \param n_ports Number of output ports + */ + virtual void update_length_tags(int n_produced, int n_ports); + + public: + /*! \brief Don't override this. + */ + void /* final */ forecast (int noutput_items, gr_vector_int &ninput_items_required); + + /*! + * - Reads the number of input items from the tags using parse_length_tags() + * - Checks there's enough data on the input and output buffers + * - If not, inform the scheduler and do nothing + * - Calls work() with the exact number of items per PDU + * - Updates the tags using update_length_tags() + */ + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + /*! + * \brief Just like gr::block::general_work, but makes sure the input is valid + * + * The user must override work to define the signal processing + * code. Check the documentation for general_work() to see what + * happens here. + * + * Like gr::sync_block, this calls consume() for you (it consumes + * ninput_items[i] items from the i-th port). + * + * A note on tag propagation: The PDU length tags are handled by + * other functions, but all other tags are handled just as in any + * other \p gr::block. So, most likely, you either set the tag + * propagation policy to TPP_DONT and handle the tag propagation + * manually, or you propagate tags through the scheduler and don't + * do anything here. + * + * \param noutput_items The size of the writable output buffer + * \param ninput_items The exact size of the items on every input for this particular PDU. + * These will be consumed if a length tag key is provided! + * \param input_items See gr::block + * \param output_items See gr::block + */ + virtual int work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) = 0; + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RUNTIME_TAGGED_STREAM_BLOCK_H */ + diff --git a/gnuradio-runtime/include/gr_tags.h b/gnuradio-runtime/include/gnuradio/tags.h index 6561a347b4..0bd7b8537f 100644 --- a/gnuradio-runtime/include/gr_tags.h +++ b/gnuradio-runtime/include/gnuradio/tags.h @@ -1,5 +1,6 @@ +/* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,11 +23,13 @@ #ifndef INCLUDED_GR_TAGS_H #define INCLUDED_GR_TAGS_H -#include <gr_runtime_api.h> +#include <gnuradio/api.h> #include <pmt/pmt.h> -struct GR_RUNTIME_API gr_tag_t{ - +namespace gr { + + struct GR_RUNTIME_API tag_t + { //! the item \p tag occurred at (as a uint64_t) uint64_t offset; @@ -42,17 +45,23 @@ struct GR_RUNTIME_API gr_tag_t{ //! Used by gr_buffer to mark a tagged as deleted by a specific block. You can usually ignore this. std::vector<long> marked_deleted; - //! Comparison function to test which tag, \p x or \p y, came first in time - static inline bool offset_compare( - const gr_tag_t &x, const gr_tag_t &y - ){ - return x.offset < y.offset; + /*! + * Comparison function to test which tag, \p x or \p y, came + * first in time + */ + static inline bool offset_compare(const tag_t &x, + const tag_t &y) + { + return x.offset < y.offset; } - inline bool operator == (const gr_tag_t &t) const + inline bool operator == (const tag_t &t) const { - return (t.key == key) && (t.value == value) && (t.srcid == srcid) && (t.offset == offset); + return (t.key == key) && (t.value == value) && \ + (t.srcid == srcid) && (t.offset == offset); } -}; + }; + +} /* namespace gr */ #endif /*INCLUDED_GR_TAGS_H*/ diff --git a/gnuradio-runtime/include/thread/CMakeLists.txt b/gnuradio-runtime/include/gnuradio/thread/CMakeLists.txt index 8ea4bfc66e..8ea4bfc66e 100644 --- a/gnuradio-runtime/include/thread/CMakeLists.txt +++ b/gnuradio-runtime/include/gnuradio/thread/CMakeLists.txt diff --git a/gnuradio-runtime/include/thread/thread.h b/gnuradio-runtime/include/gnuradio/thread/thread.h index 548d76e9a5..04d67d0821 100644 --- a/gnuradio-runtime/include/thread/thread.h +++ b/gnuradio-runtime/include/gnuradio/thread/thread.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_THREAD_H #define INCLUDED_THREAD_H -#include <gr_runtime_api.h> +#include <gnuradio/api.h> #include <boost/thread/thread.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/locks.hpp> diff --git a/gnuradio-runtime/include/thread/thread_body_wrapper.h b/gnuradio-runtime/include/gnuradio/thread/thread_body_wrapper.h index dcf8cff48e..9761d3fbe2 100644 --- a/gnuradio-runtime/include/thread/thread_body_wrapper.h +++ b/gnuradio-runtime/include/gnuradio/thread/thread_body_wrapper.h @@ -22,8 +22,8 @@ #ifndef INCLUDED_THREAD_BODY_WRAPPER_H #define INCLUDED_THREAD_BODY_WRAPPER_H -#include <gr_runtime_api.h> -#include <thread/thread.h> +#include <gnuradio/api.h> +#include <gnuradio/thread/thread.h> #include <exception> #include <iostream> diff --git a/gnuradio-runtime/include/thread/thread_group.h b/gnuradio-runtime/include/gnuradio/thread/thread_group.h index 81b561bd64..830017d11e 100644 --- a/gnuradio-runtime/include/thread/thread_group.h +++ b/gnuradio-runtime/include/gnuradio/thread/thread_group.h @@ -15,8 +15,8 @@ #ifndef INCLUDED_THREAD_GROUP_H #define INCLUDED_THREAD_GROUP_H -#include <gr_runtime_api.h> -#include <thread/thread.h> +#include <gnuradio/api.h> +#include <gnuradio/thread/thread.h> #include <boost/utility.hpp> #include <boost/thread/shared_mutex.hpp> #include <boost/function.hpp> diff --git a/gnuradio-runtime/include/gnuradio/top_block.h b/gnuradio-runtime/include/gnuradio/top_block.h new file mode 100644 index 0000000000..b3692e09e2 --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/top_block.h @@ -0,0 +1,146 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007-2009,2013 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. + */ + +#ifndef INCLUDED_GR_TOP_BLOCK_H +#define INCLUDED_GR_TOP_BLOCK_H + +#include <gnuradio/api.h> +#include <gnuradio/hier_block2.h> + +namespace gr { + + class top_block_impl; + + GR_RUNTIME_API top_block_sptr make_top_block(const std::string &name); + + /*! + *\brief Top-level hierarchical block representing a flowgraph + * \ingroup container_blk + */ + class GR_RUNTIME_API top_block : public hier_block2 + { + private: + friend GR_RUNTIME_API top_block_sptr + make_top_block(const std::string &name); + + top_block_impl *d_impl; + + protected: + top_block(const std::string &name); + + public: + ~top_block(); + + /*! + * \brief The simple interface to running a flowgraph. + * + * Calls start() then wait(). Used to run a flowgraph that will + * stop on its own, or when another thread will call stop(). + * + * \param max_noutput_items the maximum number of output items + * allowed for any block in the flowgraph. This passes through to + * the start function; see that function for more details. + */ + void run(int max_noutput_items=100000000); + + /*! + * Start the contained flowgraph. Creates one or more threads to + * execute the flow graph. Returns to the caller once the threads + * are created. Calling start() on a top_block that is already + * started IS an error. + * + * \param max_noutput_items the maximum number of output items + * allowed for any block in the flowgraph; the noutput_items can + * always be less than this, but this will cap it as a + * maximum. Use this to adjust the maximum latency a flowgraph can + * exhibit. + */ + void start(int max_noutput_items=100000000); + + /*! + * Stop the running flowgraph. Notifies each thread created by the + * scheduler to shutdown, then returns to caller. Calling stop() + * on a top_block that is already stopped IS NOT an error. + */ + void stop(); + + /*! + * Wait for a flowgraph to complete. Flowgraphs complete when + * either (1) all blocks indicate that they are done (typically + * only when using blocks.file_source, or blocks.head, or (2) + * after stop() has been called to request shutdown. Calling wait + * on a top_block that is not running IS NOT an error (wait + * returns w/o blocking). + */ + void wait(); + + /*! + * Lock a flowgraph in preparation for reconfiguration. When an + * equal number of calls to lock() and unlock() have occurred, the + * flowgraph will be reconfigured. + * + * N.B. lock() and unlock() may not be called from a flowgraph + * thread (E.g., block::work method) or deadlock will occur + * when reconfiguration happens. + */ + virtual void lock(); + + /*! + * Unlock a flowgraph in preparation for reconfiguration. When an + * equal number of calls to lock() and unlock() have occurred, the + * flowgraph will be reconfigured. + * + * N.B. lock() and unlock() may not be called from a flowgraph thread + * (E.g., block::work method) or deadlock will occur when + * reconfiguration happens. + */ + virtual void unlock(); + + /*! + * Returns a string that lists the edge connections in the + * flattened flowgraph. + */ + std::string edge_list(); + + /*! + * Displays flattened flowgraph edges and block connectivity + */ + void dump(); + + //! Get the number of max noutput_items in the flowgraph + int max_noutput_items(); + + //! Set the maximum number of noutput_items in the flowgraph + void set_max_noutput_items(int nmax); + + top_block_sptr to_top_block(); // Needed for Python type coercion + + void setup_rpc(); + }; + + inline top_block_sptr cast_to_top_block_sptr(basic_block_sptr block) { + return boost::dynamic_pointer_cast<top_block, basic_block>(block); + } + +} /* namespce gr */ + +#endif /* INCLUDED_GR_TOP_BLOCK_H */ diff --git a/gnuradio-runtime/include/gnuradio/tpb_detail.h b/gnuradio-runtime/include/gnuradio/tpb_detail.h new file mode 100644 index 0000000000..9b7454b508 --- /dev/null +++ b/gnuradio-runtime/include/gnuradio/tpb_detail.h @@ -0,0 +1,93 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,2013 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef INCLUDED_GR_TPB_DETAIL_H +#define INCLUDED_GR_TPB_DETAIL_H + +#include <gnuradio/api.h> +#include <gnuradio/thread/thread.h> +#include <deque> +#include <pmt/pmt.h> + +namespace gr { + + class block_detail; + + /*! + * \brief used by thread-per-block scheduler + */ + struct GR_RUNTIME_API tpb_detail { + gr::thread::mutex mutex; //< protects all vars + bool input_changed; + gr::thread::condition_variable input_cond; + bool output_changed; + gr::thread::condition_variable output_cond; + + public: + tpb_detail() + : input_changed(false), output_changed(false) { } + + //! Called by us to tell all our upstream blocks that their output + //! may have changed. + void notify_upstream(block_detail *d); + + //! Called by us to tell all our downstream blocks that their + //! input may have changed. + void notify_downstream(block_detail *d); + + //! Called by us to notify both upstream and downstream + void notify_neighbors(block_detail *d); + + //! Called by pmt msg posters + void notify_msg() { + input_cond.notify_one(); + output_cond.notify_one(); + } + + //! Called by us + void clear_changed() + { + gr::thread::scoped_lock guard(mutex); + input_changed = false; + output_changed = false; + } + + private: + //! Used by notify_downstream + void set_input_changed() + { + gr::thread::scoped_lock guard(mutex); + input_changed = true; + input_cond.notify_one(); + } + + //! Used by notify_upstream + void set_output_changed() + { + gr::thread::scoped_lock guard(mutex); + output_changed = true; + output_cond.notify_one(); + } + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_TPB_DETAIL_H */ diff --git a/gnuradio-runtime/include/gr_types.h b/gnuradio-runtime/include/gnuradio/types.h index 47e22469b0..6cb0f72834 100644 --- a/gnuradio-runtime/include/gr_types.h +++ b/gnuradio-runtime/include/gnuradio/types.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_GR_TYPES_H #define INCLUDED_GR_TYPES_H -#include <gr_runtime_api.h> +#include <gnuradio/api.h> #include <boost/shared_ptr.hpp> #include <vector> #include <stddef.h> // size_t -#include <gr_complex.h> +#include <gnuradio/gr_complex.h> typedef std::vector<int> gr_vector_int; typedef std::vector<unsigned int> gr_vector_uint; @@ -39,7 +39,7 @@ typedef std::vector<const void *> gr_vector_const_void_star; /* * #include <config.h> must be placed beforehand - * in the source file including gr_types.h for + * in the source file including gnuradio/types.h for * the following to work correctly */ #ifdef HAVE_STDINT_H diff --git a/gnuradio-runtime/include/gr_unittests.h b/gnuradio-runtime/include/gnuradio/unittests.h index d160ba3354..209c3ab32a 100644 --- a/gnuradio-runtime/include/gr_unittests.h +++ b/gnuradio-runtime/include/gnuradio/unittests.h @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_runtime_api.h> +#include <gnuradio/api.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/gnuradio-runtime/include/gr_basic_block.h b/gnuradio-runtime/include/gr_basic_block.h deleted file mode 100644 index beb54dbb6b..0000000000 --- a/gnuradio-runtime/include/gr_basic_block.h +++ /dev/null @@ -1,344 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2008,2009,2011 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. - */ - -#ifndef INCLUDED_GR_BASIC_BLOCK_H -#define INCLUDED_GR_BASIC_BLOCK_H - -#include <gr_runtime_api.h> -#include <gr_runtime_types.h> -#include <gr_sptr_magic.h> -#include <boost/enable_shared_from_this.hpp> -#include <boost/function.hpp> -#include <gr_msg_accepter.h> -#include <string> -#include <deque> -#include <map> -#include <gr_io_signature.h> -#include <thread/thread.h> -#include <boost/foreach.hpp> -#include <boost/thread/condition_variable.hpp> -#include <iostream> - -#ifdef GR_CTRLPORT -#include <rpcregisterhelpers.h> -#endif - -/*! - * \brief The abstract base class for all signal processing blocks. - * \ingroup internal - * - * Basic blocks are the bare abstraction of an entity that has a name, - * a set of inputs and outputs, and a message queue. These are never instantiated - * directly; rather, this is the abstract parent class of both gr_hier_block, - * which is a recursive container, and gr_block, which implements actual - * signal processing functions. - */ - -class GR_RUNTIME_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; - - private: - - //msg_handler_t d_msg_handler; - typedef std::map<pmt::pmt_t , msg_handler_t, pmt::comperator> d_msg_handlers_t; - d_msg_handlers_t d_msg_handlers; - - typedef std::deque<pmt::pmt_t> msg_queue_t; - typedef std::map<pmt::pmt_t, msg_queue_t, pmt::comperator> msg_queue_map_t; - typedef std::map<pmt::pmt_t, msg_queue_t, pmt::comperator>::iterator msg_queue_map_itr; - std::map<pmt::pmt_t, boost::shared_ptr<boost::condition_variable>, pmt::comperator> msg_queue_ready; - - gr::thread::mutex mutex; //< protects all vars - - protected: - friend class gr_flowgraph; - friend class gr_flat_flowgraph; // TODO: will be redundant - friend class gr_tpb_thread_body; - - enum vcolor { WHITE, GREY, BLACK }; - - std::string d_name; - gr_io_signature_sptr d_input_signature; - gr_io_signature_sptr d_output_signature; - long d_unique_id; - long d_symbolic_id; - std::string d_symbol_name; - std::string d_symbol_alias; - vcolor d_color; - bool d_rpc_set; - - msg_queue_map_t msg_queue; - std::vector<boost::any> d_rpc_vars; // container for all RPC variables - - gr_basic_block(void){} //allows pure virtual interface sub-classes - - //! Protected constructor prevents instantiation by non-derived classes - gr_basic_block(const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature); - - //! may only be called during constructor - void set_input_signature(gr_io_signature_sptr iosig) { - d_input_signature = iosig; - } - - //! may only be called during constructor - void set_output_signature(gr_io_signature_sptr iosig) { - d_output_signature = iosig; - } - - /*! - * \brief Allow the flowgraph to set for sorting and partitioning - */ - void set_color(vcolor color) { d_color = color; } - vcolor color() const { return d_color; } - - /*! - * \brief Tests if there is a handler attached to port \p which_port - */ - bool has_msg_handler(pmt::pmt_t which_port) { - return (d_msg_handlers.find(which_port) != d_msg_handlers.end()); - } - - /* - * This function is called by the runtime system to dispatch messages. - * - * The thread-safety guarantees mentioned in set_msg_handler are implemented - * by the callers of this method. - */ - virtual void dispatch_msg(pmt::pmt_t which_port, pmt::pmt_t msg) - { - // AA Update this - if(has_msg_handler(which_port)) { // Is there a handler? - d_msg_handlers[which_port](msg); // Yes, invoke it. - } - } - - // Message passing interface - pmt::pmt_t message_subscribers; - - public: - virtual ~gr_basic_block(); - long unique_id() const { return d_unique_id; } - long symbolic_id() const { return d_symbolic_id; } - std::string name() const { return d_name; } - std::string symbol_name() const { return d_symbol_name; } - gr_io_signature_sptr input_signature() const { return d_input_signature; } - gr_io_signature_sptr output_signature() const { return d_output_signature; } - gr_basic_block_sptr to_basic_block(); // Needed for Python type coercion - bool alias_set() { return !d_symbol_alias.empty(); } - std::string alias(){ return alias_set()?d_symbol_alias:symbol_name(); } - pmt::pmt_t alias_pmt(){ return pmt::intern(alias()); } - void set_block_alias(std::string name); - - // ** Message passing interface ** - void message_port_register_in(pmt::pmt_t port_id); - void message_port_register_out(pmt::pmt_t port_id); - void message_port_pub(pmt::pmt_t port_id, pmt::pmt_t msg); - void message_port_sub(pmt::pmt_t port_id, pmt::pmt_t target); - void message_port_unsub(pmt::pmt_t port_id, pmt::pmt_t target); - - virtual bool message_port_is_hier(pmt::pmt_t port_id) { (void) port_id; std::cout << "is_hier\n"; return false; } - virtual bool message_port_is_hier_in(pmt::pmt_t port_id) { (void) port_id; std::cout << "is_hier_in\n"; return false; } - virtual bool message_port_is_hier_out(pmt::pmt_t port_id) { (void) port_id; std::cout << "is_hier_out\n"; return false; } - - /*! - * \brief Get input message port names. - * - * Returns the available input message ports for a block. The - * return object is a PMT vector that is filled with PMT symbols. - */ - pmt::pmt_t message_ports_in(); - - /*! - * \brief Get output message port names. - * - * Returns the available output message ports for a block. The - * return object is a PMT vector that is filled with PMT symbols. - */ - pmt::pmt_t message_ports_out(); - - /*! - * Accept msg, place in queue, arrange for thread to be awakened if it's not already. - */ - void _post(pmt::pmt_t which_port, pmt::pmt_t msg); - - //! is the queue empty? - //bool empty_p(const pmt::pmt_t &which_port) const { return msg_queue[which_port].empty(); } - bool empty_p(pmt::pmt_t which_port) { - if(msg_queue.find(which_port) == msg_queue.end()) - throw std::runtime_error("port does not exist!"); - return msg_queue[which_port].empty(); - } - bool empty_p() { - bool rv = true; - BOOST_FOREACH(msg_queue_map_t::value_type &i, msg_queue) { - rv &= msg_queue[i.first].empty(); - } - return rv; - } - - //! How many messages in the queue? - size_t nmsgs(pmt::pmt_t which_port) { - if(msg_queue.find(which_port) == msg_queue.end()) - throw std::runtime_error("port does not exist!"); - return msg_queue[which_port].size(); - } - - //| Acquires and release the mutex - void insert_tail( pmt::pmt_t which_port, pmt::pmt_t msg); - /*! - * \returns returns pmt at head of queue or pmt_t() if empty. - */ - pmt::pmt_t delete_head_nowait( pmt::pmt_t which_port); - - /*! - * \returns returns pmt at head of queue or pmt_t() if empty. - */ - pmt::pmt_t delete_head_blocking( pmt::pmt_t which_port); - - msg_queue_t::iterator get_iterator(pmt::pmt_t which_port){ - return msg_queue[which_port].begin(); - } - - void erase_msg(pmt::pmt_t which_port, msg_queue_t::iterator it){ - msg_queue[which_port].erase(it); - } - - virtual bool has_msg_port(pmt::pmt_t which_port){ - if(msg_queue.find(which_port) != msg_queue.end()){ - return true; - } - if(pmt::dict_has_key(message_subscribers, which_port)){ - return true; - } - return false; - } - -#ifdef GR_CTRLPORT - /*! - * \brief Add an RPC variable (get or set). - * - * Using controlport, we create new getters/setters and need to - * store them. Each block has a vector to do this, and these never - * need to be accessed again once they are registered with the RPC - * backend. This function takes a - * boost::shared_sptr<rpcbasic_base> so that when the block is - * deleted, all RPC registered variables are cleaned up. - * - * \param s an rpcbasic_sptr of the new RPC variable register to store. - */ - void add_rpc_variable(rpcbasic_sptr s) - { - d_rpc_vars.push_back(s); - } -#endif /* GR_CTRLPORT */ - - /*! - * \brief Set up the RPC registered variables. - * - * This must be overloaded by a block that wants to use - * controlport. This is where rpcbasic_register_{get,set} pointers - * are created, which then get wrapped as shared pointers - * (rpcbasic_sptr(...)) and stored using add_rpc_variable. - */ - virtual void setup_rpc() {}; - - /*! - * \brief Ask if this block has been registered to the RPC. - * - * We can only register a block once, so we use this to protect us - * from calling it multiple times. - */ - bool is_rpc_set() { return d_rpc_set; } - - /*! - * \brief When the block is registered with the RPC, set this. - */ - void rpc_set() { d_rpc_set = true; } - - /*! - * \brief Confirm that ninputs and noutputs is an acceptable combination. - * - * \param ninputs number of input streams connected - * \param noutputs number of output streams connected - * - * \returns true if this is a valid configuration for this block. - * - * This function is called by the runtime system whenever the - * topology changes. Most classes do not need to override this. - * This check is in addition to the constraints specified by the input - * and output gr_io_signatures. - */ - virtual bool check_topology(int ninputs, int noutputs) { (void) ninputs; (void) noutputs; return true; } - - /*! - * \brief Set the callback that is fired when messages are available. - * - * \p msg_handler can be any kind of function pointer or function object - * that has the signature: - * <pre> - * void msg_handler(pmt::pmt msg); - * </pre> - * - * (You may want to use boost::bind to massage your callable into - * the correct form. See gr::blocks::nop for an example that sets - * up a class method as the callback.) - * - * Blocks that desire to handle messages must call this method in their - * constructors to register the handler that will be invoked when messages - * are available. - * - * If the block inherits from gr_block, the runtime system will ensure that - * msg_handler is called in a thread-safe manner, such that work and - * msg_handler will never be called concurrently. This allows msg_handler - * to update state variables without having to worry about thread-safety - * issues with work, general_work or another invocation of msg_handler. - * - * If the block inherits from gr_hier_block2, the runtime system will - * ensure that no reentrant calls are made to msg_handler. - */ - template <typename T> void set_msg_handler(pmt::pmt_t which_port, T msg_handler){ - if(msg_queue.find(which_port) == msg_queue.end()){ - throw std::runtime_error("attempt to set_msg_handler() on bad input message port!"); } - d_msg_handlers[which_port] = msg_handler_t(msg_handler); - } -}; - -inline bool operator<(gr_basic_block_sptr lhs, gr_basic_block_sptr rhs) -{ - return lhs->unique_id() < rhs->unique_id(); -} - -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; - -GR_RUNTIME_API long gr_basic_block_ncurrently_allocated(); - -inline std::ostream &operator << (std::ostream &os, gr_basic_block_sptr basic_block) -{ - os << basic_block->name() << "(" << basic_block->unique_id() << ")"; - return os; -} - -#endif /* INCLUDED_GR_BASIC_BLOCK_H */ diff --git a/gnuradio-runtime/include/gr_block.h b/gnuradio-runtime/include/gr_block.h deleted file mode 100644 index 77ca3f3f72..0000000000 --- a/gnuradio-runtime/include/gr_block.h +++ /dev/null @@ -1,700 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007,2009,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. - */ - -#ifndef INCLUDED_GR_BLOCK_H -#define INCLUDED_GR_BLOCK_H - -#include <gr_runtime_api.h> -#include <gr_basic_block.h> -#include <gr_tags.h> -#include <gr_logger.h> - -/*! - * \brief The abstract base class for all 'terminal' processing blocks. - * \ingroup base_blk - * - * A signal processing flow is constructed by creating a tree of - * hierarchical blocks, which at any level may also contain terminal nodes - * that actually implement signal processing functions. This is the base - * class for all such leaf nodes. - - * Blocks have a set of input streams and output streams. The - * input_signature and output_signature define the number of input - * streams and output streams respectively, and the type of the data - * items in each stream. - * - * Although blocks may consume data on each input stream at a - * different rate, all outputs streams must produce data at the same - * rate. That rate may be different from any of the input rates. - * - * User derived blocks override two methods, forecast and general_work, - * to implement their signal processing behavior. forecast is called - * by the system scheduler to determine how many items are required on - * each input stream in order to produce a given number of output - * items. - * - * general_work is called to perform the signal processing in the block. - * It reads the input items and writes the output items. - */ - -class GR_RUNTIME_API gr_block : public gr_basic_block { - - public: - - //! Magic return values from general_work - enum { - WORK_CALLED_PRODUCE = -2, - WORK_DONE = -1 - }; - - enum tag_propagation_policy_t { - TPP_DONT = 0, - TPP_ALL_TO_ALL = 1, - TPP_ONE_TO_ONE = 2 - }; - - virtual ~gr_block (); - - /*! - * Assume block computes y_i = f(x_i, x_i-1, x_i-2, x_i-3...) - * History is the number of x_i's that are examined to produce one y_i. - * This comes in handy for FIR filters, where we use history to - * ensure that our input contains the appropriate "history" for the - * filter. History should be equal to the number of filter taps. - */ - unsigned history () const { return d_history; } - void set_history (unsigned history) { d_history = history; } - - /*! - * \brief Return true if this block has a fixed input to output rate. - * - * If true, then fixed_rate_in_to_out and fixed_rate_out_to_in may be called. - */ - bool fixed_rate() const { return d_fixed_rate; } - - // ---------------------------------------------------------------- - // override these to define your behavior - // ---------------------------------------------------------------- - - /*! - * \brief Estimate input requirements given output request - * - * \param noutput_items number of output items to produce - * \param ninput_items_required number of input items required on each input stream - * - * Given a request to product \p noutput_items, estimate the number of - * data items required on each input stream. The estimate doesn't have - * to be exact, but should be close. - */ - virtual void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - - /*! - * \brief compute output items from input items - * - * \param noutput_items number of output items to write on each output stream - * \param ninput_items number of input items available on each input stream - * \param input_items vector of pointers to the input items, one entry per input stream - * \param output_items vector of pointers to the output items, one entry per output stream - * - * \returns number of items actually written to each output stream, or -1 on EOF. - * It is OK to return a value less than noutput_items. -1 <= return value <= noutput_items - * - * general_work must call consume or consume_each to indicate how many items - * were consumed on each input stream. - */ - virtual int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - /*! - * \brief Called to enable drivers, etc for i/o devices. - * - * This allows a block to enable an associated driver to begin - * transfering data just before we start to execute the scheduler. - * The end result is that this reduces latency in the pipeline when - * dealing with audio devices, usrps, etc. - */ - virtual bool start(); - - /*! - * \brief Called to disable drivers, etc for i/o devices. - */ - virtual bool stop(); - - // ---------------------------------------------------------------- - - /*! - * \brief Constrain the noutput_items argument passed to forecast and general_work - * - * set_output_multiple causes the scheduler to ensure that the noutput_items - * argument passed to forecast and general_work will be an integer multiple - * of \param multiple The default value of output multiple is 1. - */ - void set_output_multiple (int multiple); - int output_multiple () const { return d_output_multiple; } - bool output_multiple_set () const { return d_output_multiple_set; } - - /*! - * \brief Constrains buffers to work on a set item alignment (for SIMD) - * - * set_alignment_multiple causes the scheduler to ensure that the noutput_items - * argument passed to forecast and general_work will be an integer multiple - * of \param multiple The default value is 1. - * - * This control is similar to the output_multiple setting, except - * that if the number of items passed to the block is less than the - * output_multiple, this value is ignored and the block can produce - * like normal. The d_unaligned value is set to the number of items - * the block is off by. In the next call to general_work, the - * noutput_items is set to d_unaligned or less until - * d_unaligned==0. The buffers are now aligned again and the aligned - * calls can be performed again. - */ - void set_alignment (int multiple); - int alignment () const { return d_output_multiple; } - - void set_unaligned (int na); - int unaligned () const { return d_unaligned; } - void set_is_unaligned (bool u); - bool is_unaligned () const { return d_is_unaligned; } - - /*! - * \brief Tell the scheduler \p how_many_items of input stream \p which_input were consumed. - */ - void consume (int which_input, int how_many_items); - - /*! - * \brief Tell the scheduler \p how_many_items were consumed on each input stream. - */ - void consume_each (int how_many_items); - - /*! - * \brief Tell the scheduler \p how_many_items were produced on output stream \p which_output. - * - * If the block's general_work method calls produce, \p general_work must return WORK_CALLED_PRODUCE. - */ - void produce (int which_output, int how_many_items); - - /*! - * \brief Set the approximate output rate / input rate - * - * Provide a hint to the buffer allocator and scheduler. - * The default relative_rate is 1.0 - * - * decimators have relative_rates < 1.0 - * interpolators have relative_rates > 1.0 - */ - void set_relative_rate (double relative_rate); - - /*! - * \brief return the approximate output rate / input rate - */ - double relative_rate () const { return d_relative_rate; } - - /* - * The following two methods provide special case info to the - * scheduler in the event that a block has a fixed input to output - * ratio. gr_sync_block, gr_sync_decimator and gr_sync_interpolator - * override these. If you're fixed rate, subclass one of those. - */ - /*! - * \brief Given ninput samples, return number of output samples that will be produced. - * N.B. this is only defined if fixed_rate returns true. - * Generally speaking, you don't need to override this. - */ - virtual int fixed_rate_ninput_to_noutput(int ninput); - - /*! - * \brief Given noutput samples, return number of input samples required to produce noutput. - * N.B. this is only defined if fixed_rate returns true. - * Generally speaking, you don't need to override this. - */ - virtual int fixed_rate_noutput_to_ninput(int noutput); - - /*! - * \brief Return the number of items read on input stream which_input - */ - uint64_t nitems_read(unsigned int which_input); - - /*! - * \brief Return the number of items written on output stream which_output - */ - uint64_t nitems_written(unsigned int which_output); - - /*! - * \brief Asks for the policy used by the scheduler to moved tags downstream. - */ - tag_propagation_policy_t tag_propagation_policy(); - - /*! - * \brief Set the policy by the scheduler to determine how tags are moved downstream. - */ - void set_tag_propagation_policy(tag_propagation_policy_t p); - - /*! - * \brief Return the minimum number of output items this block can - * produce during a call to work. - * - * Should be 0 for most blocks. Useful if we're dealing with packets and - * the block produces one packet per call to work. - */ - int min_noutput_items() const { return d_min_noutput_items; } - - /*! - * \brief Set the minimum number of output items this block can - * produce during a call to work. - * - * \param m the minimum noutput_items this block can produce. - */ - void set_min_noutput_items(int m) { d_min_noutput_items = m; } - - /*! - * \brief Return the maximum number of output items this block will - * handle during a call to work. - */ - int max_noutput_items(); - - /*! - * \brief Set the maximum number of output items this block will - * handle during a call to work. - * - * \param m the maximum noutput_items this block will handle. - */ - void set_max_noutput_items(int m); - - /*! - * \brief Clear the switch for using the max_noutput_items value of this block. - * - * When is_set_max_noutput_items() returns 'true', the scheduler - * will use the value returned by max_noutput_items() to limit the - * size of the number of items possible for this block's work - * function. If is_set_max_notput_items() returns 'false', then the - * scheduler ignores the internal value and uses the value set - * globally in the top_block. - * - * Use this value to clear the 'is_set' flag so the scheduler will - * ignore this. Use the set_max_noutput_items(m) call to both set a - * new value for max_noutput_items and to reenable its use in the - * scheduler. - */ - void unset_max_noutput_items(); - - /*! - * \brief Ask the block if the flag is or is not set to use the - * internal value of max_noutput_items during a call to work. - */ - bool is_set_max_noutput_items(); - - /* - * Used to expand the vectors that hold the min/max buffer sizes. - * - * Specifically, when -1 is used, the vectors are just initialized - * with 1 value; this is used by the flat_flowgraph to expand when - * required to add a new value for new ports on these blocks. - */ - void expand_minmax_buffer(int port) { - if((size_t)port >= d_max_output_buffer.size()) - set_max_output_buffer(port, -1); - if((size_t)port >= d_min_output_buffer.size()) - set_min_output_buffer(port, -1); - } - - /*! - * \brief Returns max buffer size on output port \p i. - */ - long max_output_buffer(size_t i) { - if(i >= d_max_output_buffer.size()) - throw std::invalid_argument("gr_basic_block::max_output_buffer: port out of range."); - return d_max_output_buffer[i]; - } - - /*! - * \brief Sets max buffer size on all output ports. - */ - void set_max_output_buffer(long max_output_buffer) { - for(int i = 0; i < output_signature()->max_streams(); i++) { - set_max_output_buffer(i, max_output_buffer); - } - } - - /*! - * \brief Sets max buffer size on output port \p port. - */ - void set_max_output_buffer(int port, long max_output_buffer) { - if((size_t)port >= d_max_output_buffer.size()) - d_max_output_buffer.push_back(max_output_buffer); - else - d_max_output_buffer[port] = max_output_buffer; - } - - /*! - * \brief Returns min buffer size on output port \p i. - */ - long min_output_buffer(size_t i) { - if(i >= d_min_output_buffer.size()) - throw std::invalid_argument("gr_basic_block::min_output_buffer: port out of range."); - return d_min_output_buffer[i]; - } - - /*! - * \brief Sets min buffer size on all output ports. - */ - void set_min_output_buffer(long min_output_buffer) { - for(int i=0; i<output_signature()->max_streams(); i++) { - set_min_output_buffer(i, min_output_buffer); - } - } - - /*! - * \brief Sets min buffer size on output port \p port. - */ - void set_min_output_buffer(int port, long min_output_buffer) { - if((size_t)port >= d_min_output_buffer.size()) - d_min_output_buffer.push_back(min_output_buffer); - else - d_min_output_buffer[port] = min_output_buffer; - } - - // --------------- Performance counter functions ------------- - - /*! - * \brief Gets instantaneous noutput_items performance counter. - */ - float pc_noutput_items(); - - /*! - * \brief Gets average noutput_items performance counter. - */ - float pc_noutput_items_avg(); - - /*! - * \brief Gets variance of noutput_items performance counter. - */ - float pc_noutput_items_var(); - - /*! - * \brief Gets instantaneous num items produced performance counter. - */ - float pc_nproduced(); - - /*! - * \brief Gets average num items produced performance counter. - */ - float pc_nproduced_avg(); - - /*! - * \brief Gets variance of num items produced performance counter. - */ - float pc_nproduced_var(); - - /*! - * \brief Gets instantaneous fullness of \p which input buffer. - */ - float pc_input_buffers_full(int which); - - /*! - * \brief Gets average fullness of \p which input buffer. - */ - float pc_input_buffers_full_avg(int which); - - /*! - * \brief Gets variance of fullness of \p which input buffer. - */ - float pc_input_buffers_full_var(int which); - - /*! - * \brief Gets instantaneous fullness of all input buffers. - */ - std::vector<float> pc_input_buffers_full(); - - /*! - * \brief Gets average fullness of all input buffers. - */ - std::vector<float> pc_input_buffers_full_avg(); - - /*! - * \brief Gets variance of fullness of all input buffers. - */ - std::vector<float> pc_input_buffers_full_var(); - - /*! - * \brief Gets instantaneous fullness of \p which input buffer. - */ - float pc_output_buffers_full(int which); - - /*! - * \brief Gets average fullness of \p which input buffer. - */ - float pc_output_buffers_full_avg(int which); - - /*! - * \brief Gets variance of fullness of \p which input buffer. - */ - float pc_output_buffers_full_var(int which); - - /*! - * \brief Gets instantaneous fullness of all output buffers. - */ - std::vector<float> pc_output_buffers_full(); - - /*! - * \brief Gets average fullness of all output buffers. - */ - std::vector<float> pc_output_buffers_full_avg(); - - /*! - * \brief Gets variance of fullness of all output buffers. - */ - std::vector<float> pc_output_buffers_full_var(); - - /*! - * \brief Gets instantaneous clock cycles spent in work. - */ - float pc_work_time(); - - /*! - * \brief Gets average clock cycles spent in work. - */ - float pc_work_time_avg(); - - /*! - * \brief Gets average clock cycles spent in work. - */ - float pc_work_time_var(); - - /*! - * \brief Resets the performance counters - */ - void reset_perf_counters(); - - /*! - * \brief Sets up export of perf. counters to ControlPort. Only - * called by the scheduler. - */ - void setup_pc_rpc(); - - /*! - * \brief Checks if this block is already exporting perf. counters - * to ControlPort. - */ - bool is_pc_rpc_set() { return d_pc_rpc_set; } - - /*! - * \brief If the block calls this in its constructor, it's - * perf. counters will not be exported. - */ - void no_pc_rpc() { d_pc_rpc_set = true; } - - - // ---------------------------------------------------------------------------- - // Functions to handle thread affinity - - /*! - * \brief Set the thread's affinity to processor core \p n. - * - * \param mask a vector of ints of the core numbers available to this block. - */ - void set_processor_affinity(const std::vector<int> &mask); - - /*! - * \brief Remove processor affinity to a specific core. - */ - void unset_processor_affinity(); - - /*! - * \brief Get the current processor affinity. - */ - std::vector<int> processor_affinity() { return d_affinity; } - - // ---------------------------------------------------------------------------- - - private: - - int d_output_multiple; - bool d_output_multiple_set; - int d_unaligned; - bool d_is_unaligned; - double d_relative_rate; // approx output_rate / input_rate - gr_block_detail_sptr d_detail; // implementation details - unsigned d_history; - bool d_fixed_rate; - bool d_max_noutput_items_set; // if d_max_noutput_items is valid - int d_max_noutput_items; // value of max_noutput_items for this block - int d_min_noutput_items; - tag_propagation_policy_t d_tag_propagation_policy; // policy for moving tags downstream - std::vector<int> d_affinity; // thread affinity proc. mask - bool d_pc_rpc_set; - - protected: - gr_block (void){} //allows pure virtual interface sub-classes - gr_block (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature); - - void set_fixed_rate(bool fixed_rate){ d_fixed_rate = fixed_rate; } - - - /*! - * \brief Adds a new tag onto the given output buffer. - * - * \param which_output an integer of which output stream to attach the tag - * \param abs_offset a uint64 number of the absolute item number - * assicated with the tag. Can get from nitems_written. - * \param key the tag key as a PMT symbol - * \param value any PMT holding any value for the given key - * \param srcid optional source ID specifier; defaults to PMT_F - */ - inline void add_item_tag(unsigned int which_output, - uint64_t abs_offset, - const pmt::pmt_t &key, - const pmt::pmt_t &value, - const pmt::pmt_t &srcid=pmt::PMT_F) - { - gr_tag_t tag; - tag.offset = abs_offset; - tag.key = key; - tag.value = value; - tag.srcid = srcid; - this->add_item_tag(which_output, tag); - } - - /*! - * \brief Adds a new tag onto the given output buffer. - * - * \param which_output an integer of which output stream to attach the tag - * \param tag the tag object to add - */ - void add_item_tag(unsigned int which_output, const gr_tag_t &tag); - - /*! - * \brief Removes a tag from the given input buffer. - * - * \param which_input an integer of which input stream to remove the tag from - * \param abs_offset a uint64 number of the absolute item number - * assicated with the tag. Can get from nitems_written. - * \param key the tag key as a PMT symbol - * \param value any PMT holding any value for the given key - * \param srcid optional source ID specifier; defaults to PMT_F - * - * If no such tag is found, does nothing. - */ - inline void remove_item_tag(unsigned int which_input, - uint64_t abs_offset, - const pmt::pmt_t &key, - const pmt::pmt_t &value, - const pmt::pmt_t &srcid=pmt::PMT_F) - { - gr_tag_t tag; - tag.offset = abs_offset; - tag.key = key; - tag.value = value; - tag.srcid = srcid; - this->remove_item_tag(which_input, tag); - } - - /*! - * \brief Removes a tag from the given input buffer. - * - * If no such tag is found, does nothing. - * - * \param which_input an integer of which input stream to remove the tag from - * \param tag the tag object to remove - */ - void remove_item_tag(unsigned int which_input, const gr_tag_t &tag); - - /*! - * \brief Given a [start,end), returns a vector of all tags in the range. - * - * Range of counts is from start to end-1. - * - * Tags are tuples of: - * (item count, source id, key, value) - * - * \param v a vector reference to return tags into - * \param which_input an integer of which input stream to pull from - * \param abs_start a uint64 count of the start of the range of interest - * \param abs_end a uint64 count of the end of the range of interest - */ - void get_tags_in_range(std::vector<gr_tag_t> &v, - unsigned int which_input, - uint64_t abs_start, - uint64_t abs_end); - - /*! - * \brief Given a [start,end), returns a vector of all tags in the range - * with a given key. - * - * Range of counts is from start to end-1. - * - * Tags are tuples of: - * (item count, source id, key, value) - * - * \param v a vector reference to return tags into - * \param which_input an integer of which input stream to pull from - * \param abs_start a uint64 count of the start of the range of interest - * \param abs_end a uint64 count of the end of the range of interest - * \param key a PMT symbol key to filter only tags of this key - */ - void get_tags_in_range(std::vector<gr_tag_t> &v, - unsigned int which_input, - uint64_t abs_start, - uint64_t abs_end, - const pmt::pmt_t &key); - - std::vector<long> d_max_output_buffer; - std::vector<long> d_min_output_buffer; - - /*! Used by block's setters and work functions to make - * setting/resetting of parameters thread-safe. - * - * Used by calling gr::thread::scoped_lock l(d_setlock); - */ - gr::thread::mutex d_setlock; - - /*! Used by blocks to access the logger system. - */ - gr_logger_ptr d_logger; - gr_logger_ptr d_debug_logger; - - // These are really only for internal use, but leaving them public avoids - // having to work up an ever-varying list of friend GR_RUNTIME_APIs - - public: - gr_block_detail_sptr detail () const { return d_detail; } - void set_detail (gr_block_detail_sptr detail) { d_detail = detail; } -}; - -typedef std::vector<gr_block_sptr> gr_block_vector_t; -typedef std::vector<gr_block_sptr>::iterator gr_block_viter_t; - -inline gr_block_sptr cast_to_block_sptr(gr_basic_block_sptr p) -{ - return boost::dynamic_pointer_cast<gr_block, gr_basic_block>(p); -} - - -std::ostream& -operator << (std::ostream& os, const gr_block *m); - -#endif /* INCLUDED_GR_BLOCK_H */ diff --git a/gnuradio-runtime/include/gr_block_detail.h b/gnuradio-runtime/include/gr_block_detail.h deleted file mode 100644 index 10586a3974..0000000000 --- a/gnuradio-runtime/include/gr_block_detail.h +++ /dev/null @@ -1,254 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2009,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 detail. - * - * 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. - */ - -#ifndef INCLUDED_GR_BLOCK_DETAIL_H -#define INCLUDED_GR_BLOCK_DETAIL_H - -#include <gr_runtime_api.h> -#include <gr_runtime_types.h> -#include <gr_tpb_detail.h> -#include <gr_tags.h> -#include <high_res_timer.h> -#include <stdexcept> - -/*! - * \brief Implementation details to support the signal processing abstraction - * \ingroup internal - * - * This class contains implementation detail that should be "out of sight" - * 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_RUNTIME_API gr_block_detail { - public: - ~gr_block_detail (); - - int ninputs () const { return d_ninputs; } - int noutputs () const { return d_noutputs; } - bool sink_p () const { return d_noutputs == 0; } - bool source_p () const { return d_ninputs == 0; } - - void set_done (bool done); - bool done () const { return d_done; } - - void set_input (unsigned int which, gr_buffer_reader_sptr reader); - gr_buffer_reader_sptr input (unsigned int which) - { - if (which >= d_ninputs) - throw std::invalid_argument ("gr_block_detail::input"); - return d_input[which]; - } - - void set_output (unsigned int which, gr_buffer_sptr buffer); - gr_buffer_sptr output (unsigned int which) - { - if (which >= d_noutputs) - throw std::invalid_argument ("gr_block_detail::output"); - return d_output[which]; - } - - /*! - * \brief Tell the scheduler \p how_many_items of input stream \p which_input were consumed. - */ - void consume (int which_input, int how_many_items); - - /*! - * \brief Tell the scheduler \p how_many_items were consumed on each input stream. - */ - void consume_each (int how_many_items); - - /*! - * \brief Tell the scheduler \p how_many_items were produced on output stream \p which_output. - */ - void produce (int which_output, int how_many_items); - - /*! - * \brief Tell the scheduler \p how_many_items were produced on each output stream. - */ - void produce_each (int how_many_items); - - // Return the number of items read on input stream which_input - uint64_t nitems_read(unsigned int which_input); - - // Return the number of items written on output stream which_output - uint64_t nitems_written(unsigned int which_output); - - - /*! - * \brief Adds a new tag to the given output stream. - * - * Calls gr_buffer::add_item_tag(), - * which appends the tag onto its deque. - * - * \param which_output an integer of which output stream to attach the tag - * \param tag the tag object to add - */ - void add_item_tag(unsigned int which_output, const gr_tag_t &tag); - - /*! - * \brief Removes a tag from the given input stream. - * - * Calls gr_buffer::remove_item_tag(). - * The tag in question will then no longer appear on subsequent calls of get_tags_in_range(). - * - * \param which_input an integer of which input stream to remove the tag from - * \param tag the tag object to add - * \param id The unique block ID (use gr_block::unique_id()) - */ - void remove_item_tag(unsigned int which_input, const gr_tag_t &tag, long id); - - /*! - * \brief Given a [start,end), returns a vector of all tags in the range. - * - * Pass-through function to gr_buffer_reader to get a vector of tags - * in given range. Range of counts is from start to end-1. - * - * Tags are tuples of: - * (item count, source id, key, value) - * - * \param v a vector reference to return tags into - * \param which_input an integer of which input stream to pull from - * \param abs_start a uint64 count of the start of the range of interest - * \param abs_end a uint64 count of the end of the range of interest - * \param id Block ID - */ - void get_tags_in_range(std::vector<gr_tag_t> &v, - unsigned int which_input, - uint64_t abs_start, - uint64_t abs_end, - long id); - - /*! - * \brief Given a [start,end), returns a vector of all tags in the range - * with a given key. - * - * Calls get_tags_in_range(which_input, abs_start, abs_end) to get a vector of - * tags from the buffers. This function then provides a secondary filter to - * the tags to extract only tags with the given 'key'. - * - * Tags are tuples of: - * (item count, source id, key, value) - * - * \param v a vector reference to return tags into - * \param which_input an integer of which input stream to pull from - * \param abs_start a uint64 count of the start of the range of interest - * \param abs_end a uint64 count of the end of the range of interest - * \param key a PMT symbol to select only tags of this key - * \param id Block ID - */ - void get_tags_in_range(std::vector<gr_tag_t> &v, - unsigned int which_input, - uint64_t abs_start, - uint64_t abs_end, - const pmt::pmt_t &key, - long id); - - /*! - * \brief Set core affinity of block to the cores in the vector mask. - * - * \param mask a vector of ints of the core numbers available to this block. - */ - void set_processor_affinity(const std::vector<int> &mask); - - /*! - * \brief Unset core affinity. - */ - void unset_processor_affinity(); - - bool threaded; // set if thread is currently running. - gr::thread::gr_thread_t thread; // portable thread handle - - void start_perf_counters(); - void stop_perf_counters(int noutput_items, int nproduced); - void reset_perf_counters(); - - // Calls to get performance counter items - float pc_noutput_items(); - float pc_nproduced(); - float pc_input_buffers_full(size_t which); - std::vector<float> pc_input_buffers_full(); - float pc_output_buffers_full(size_t which); - std::vector<float> pc_output_buffers_full(); - float pc_work_time(); - - float pc_noutput_items_avg(); - float pc_nproduced_avg(); - float pc_input_buffers_full_avg(size_t which); - std::vector<float> pc_input_buffers_full_avg(); - float pc_output_buffers_full_avg(size_t which); - std::vector<float> pc_output_buffers_full_avg(); - float pc_work_time_avg(); - - float pc_noutput_items_var(); - float pc_nproduced_var(); - float pc_input_buffers_full_var(size_t which); - std::vector<float> pc_input_buffers_full_var(); - float pc_output_buffers_full_var(size_t which); - std::vector<float> pc_output_buffers_full_var(); - float pc_work_time_var(); - - gr_tpb_detail d_tpb; // used by thread-per-block scheduler - int d_produce_or; - - // ---------------------------------------------------------------------------- - - private: - unsigned int d_ninputs; - unsigned int d_noutputs; - std::vector<gr_buffer_reader_sptr> d_input; - std::vector<gr_buffer_sptr> d_output; - bool d_done; - - // Performance counters - float d_ins_noutput_items; - float d_avg_noutput_items; - float d_var_noutput_items; - float d_ins_nproduced; - float d_avg_nproduced; - float d_var_nproduced; - std::vector<float> d_ins_input_buffers_full; - std::vector<float> d_avg_input_buffers_full; - std::vector<float> d_var_input_buffers_full; - std::vector<float> d_ins_output_buffers_full; - std::vector<float> d_avg_output_buffers_full; - std::vector<float> d_var_output_buffers_full; - gr::high_res_timer_type d_start_of_work, d_end_of_work; - float d_ins_work_time; - float d_avg_work_time; - float d_var_work_time; - float d_pc_counter; - - gr_block_detail (unsigned int ninputs, unsigned int noutputs); - - friend struct gr_tpb_detail; - - friend GR_RUNTIME_API gr_block_detail_sptr - gr_make_block_detail (unsigned int ninputs, unsigned int noutputs); -}; - -GR_RUNTIME_API gr_block_detail_sptr -gr_make_block_detail (unsigned int ninputs, unsigned int noutputs); - -GR_RUNTIME_API long -gr_block_detail_ncurrently_allocated (); - -#endif /* INCLUDED_GR_BLOCK_DETAIL_H */ diff --git a/gnuradio-runtime/include/gr_block_registry.h b/gnuradio-runtime/include/gr_block_registry.h deleted file mode 100644 index 9b038287bc..0000000000 --- a/gnuradio-runtime/include/gr_block_registry.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef GR_BLOCK_REGISTRY_H -#define GR_BLOCK_REGISTRY_H - -#include <gr_runtime_api.h> -#include <map> -#include <gr_basic_block.h> - -#ifndef GR_BASIC_BLOCK_H -class gr_basic_block; -class gr_block; -#endif - -class GR_RUNTIME_API gr_block_registry { - public: - gr_block_registry(); - - long block_register(gr_basic_block* block); - void block_unregister(gr_basic_block* block); - - std::string register_symbolic_name(gr_basic_block* block); - void register_symbolic_name(gr_basic_block* block, std::string name); - - gr_basic_block_sptr block_lookup(pmt::pmt_t symbol); - - void register_primitive(std::string blk, gr_block* ref); - void unregister_primitive(std::string blk); - void notify_blk(std::string blk); - - private: - - //typedef std::map< long, gr_basic_block_sptr > blocksubmap_t; - typedef std::map< long, gr_basic_block* > blocksubmap_t; - typedef std::map< std::string, blocksubmap_t > blockmap_t; - - blockmap_t d_map; - pmt::pmt_t d_ref_map; - std::map< std::string, gr_block*> primitive_map; - -}; - -GR_RUNTIME_API extern gr_block_registry global_block_registry; - -#endif - diff --git a/gnuradio-runtime/include/gr_buffer.h b/gnuradio-runtime/include/gr_buffer.h deleted file mode 100644 index cc6a7a61fe..0000000000 --- a/gnuradio-runtime/include/gr_buffer.h +++ /dev/null @@ -1,316 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2009,2010,2011 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. - */ - -#ifndef INCLUDED_GR_BUFFER_H -#define INCLUDED_GR_BUFFER_H - -#include <gr_runtime_api.h> -#include <gr_runtime_types.h> -#include <boost/weak_ptr.hpp> -#include <thread/thread.h> -#include <gr_tags.h> -#include <deque> - -class gr_vmcircbuf; - -/*! - * \brief Allocate a buffer that holds at least \p nitems of size \p sizeof_item. - * - * The total size of the buffer will be rounded up to a system - * dependent boundary. This is typically the system page size, but - * under MS windows is 64KB. - * - * \param nitems is the minimum number of items the buffer will hold. - * \param sizeof_item is the size of an item in bytes. - * \param link is the block that writes to this buffer. - */ -GR_RUNTIME_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_RUNTIME_API gr_buffer { - public: - - virtual ~gr_buffer (); - - /*! - * \brief return number of items worth of space available for writing - */ - int space_available (); - - /*! - * \brief return size of this buffer in items - */ - int bufsize() const { return d_bufsize; } - - /*! - * \brief return pointer to write buffer. - * - * The return value points at space that can hold at least - * space_available() items. - */ - void *write_pointer (); - - /*! - * \brief tell buffer that we wrote \p nitems into it - */ - void update_write_pointer (int nitems); - - void set_done (bool done); - bool done () const { return d_done; } - - /*! - * \brief Return the block that writes to this buffer. - */ - gr_block_sptr link() { return gr_block_sptr(d_link); } - - size_t nreaders() const { return d_readers.size(); } - gr_buffer_reader* reader(size_t index) { return d_readers[index]; } - - gr::thread::mutex *mutex() { return &d_mutex; } - - uint64_t nitems_written() { return d_abs_write_offset; } - - size_t get_sizeof_item() { return d_sizeof_item; } - - /*! - * \brief Adds a new tag to the buffer. - * - * \param tag the new tag - */ - void add_item_tag(const gr_tag_t &tag); - - /*! - * \brief Removes an existing tag from the buffer. - * - * If no such tag is found, does nothing. - * Note: Doesn't actually physically delete the tag, but - * marks it as deleted. For the user, this has the same effect: - * Any subsequent calls to get_tags_in_range() will not return - * the tag. - * - * \param tag the tag that needs to be removed - * \param id the unique ID of the block calling this function - */ - void remove_item_tag(const gr_tag_t &tag, long id); - - /*! - * \brief Removes all tags before \p max_time from buffer - * - * \param max_time the time (item number) to trim up until. - */ - void prune_tags(uint64_t max_time); - - std::deque<gr_tag_t>::iterator get_tags_begin() { return d_item_tags.begin(); } - std::deque<gr_tag_t>::iterator get_tags_end() { return d_item_tags.end(); } - - // ------------------------------------------------------------------------- - - private: - - friend class gr_buffer_reader; - friend GR_RUNTIME_API gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link); - friend GR_RUNTIME_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 - unsigned int d_bufsize; // in items - private: - gr_vmcircbuf *d_vmcircbuf; - size_t d_sizeof_item; // in bytes - std::vector<gr_buffer_reader *> d_readers; - boost::weak_ptr<gr_block> d_link; // block that writes to this buffer - - // - // The mutex protects d_write_index, d_abs_write_offset, d_done, d_item_tags - // and the d_read_index's and d_abs_read_offset's in the buffer readers. - // - gr::thread::mutex d_mutex; - unsigned int d_write_index; // in items [0,d_bufsize) - uint64_t d_abs_write_offset; // num items written since the start - bool d_done; - std::deque<gr_tag_t> d_item_tags; - uint64_t d_last_min_items_read; - - unsigned - index_add (unsigned a, unsigned b) - { - unsigned s = a + b; - - if (s >= d_bufsize) - s -= d_bufsize; - - assert (s < d_bufsize); - return s; - } - - unsigned - index_sub (unsigned a, unsigned b) - { - int s = a - b; - - if (s < 0) - s += d_bufsize; - - assert ((unsigned) s < d_bufsize); - return s; - } - - virtual bool allocate_buffer (int nitems, size_t sizeof_item); - - /*! - * \brief constructor is private. Use gr_make_buffer to create instances. - * - * Allocate a buffer that holds at least \p nitems of size \p sizeof_item. - * - * \param nitems is the minimum number of items the buffer will hold. - * \param sizeof_item is the size of an item in bytes. - * \param link is the block that writes to this buffer. - * - * The total size of the buffer will be rounded up to a system - * dependent boundary. This is typically the system page size, but - * under MS windows is 64KB. - */ - gr_buffer (int nitems, size_t sizeof_item, gr_block_sptr link); - - /*! - * \brief disassociate \p reader from this buffer - */ - void drop_reader (gr_buffer_reader *reader); - -}; - -/*! - * \brief Create a new gr_buffer_reader and attach it to buffer \p buf - * \param buf is the buffer the \p gr_buffer_reader reads from. - * \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_RUNTIME_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 -GR_RUNTIME_API long gr_buffer_ncurrently_allocated (); - - -// --------------------------------------------------------------------------- - -/*! - * \brief How we keep track of the readers of a gr_buffer. - * \ingroup internal - */ - -class GR_RUNTIME_API gr_buffer_reader { - public: - - ~gr_buffer_reader (); - - /*! - * \brief Return number of items available for reading. - */ - int items_available () const; - - /*! - * \brief Return buffer this reader reads from. - */ - gr_buffer_sptr buffer () const { return d_buffer; } - - - /*! - * \brief Return maximum number of items that could ever be available for reading. - * This is used as a sanity check in the scheduler to avoid looping forever. - */ - int max_possible_items_available () const { return d_buffer->d_bufsize - 1; } - - /*! - * \brief return pointer to read buffer. - * - * The return value points to items_available() number of items - */ - const void *read_pointer (); - - /* - * \brief tell buffer we read \p items from it - */ - void update_read_pointer (int nitems); - - void set_done (bool done) { d_buffer->set_done (done); } - bool done () const { return d_buffer->done (); } - - gr::thread::mutex *mutex() { return d_buffer->mutex(); } - - - uint64_t nitems_read() { return d_abs_read_offset; } - - size_t get_sizeof_item() { return d_buffer->get_sizeof_item(); } - - /*! - * \brief Return the block that reads via this reader. - * - */ - gr_block_sptr link() { return gr_block_sptr(d_link); } - - - /*! - * \brief Given a [start,end), returns a vector all tags in the range. - * - * Get a vector of tags in given range. Range of counts is from start to end-1. - * - * Tags are tuples of: - * (item count, source id, key, value) - * - * \param v a vector reference to return tags into - * \param abs_start a uint64 count of the start of the range of interest - * \param abs_end a uint64 count of the end of the range of interest - * \param id the unique ID of the block to make sure already deleted tags are not returned - */ - void get_tags_in_range(std::vector<gr_tag_t> &v, - uint64_t abs_start, - uint64_t abs_end, - long id); - - // ------------------------------------------------------------------------- - - private: - - friend class gr_buffer; - friend GR_RUNTIME_API gr_buffer_reader_sptr - gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link); - - - gr_buffer_sptr d_buffer; - unsigned int d_read_index; // in items [0,d->buffer.d_bufsize) - uint64_t d_abs_read_offset; // num items seen since the start - boost::weak_ptr<gr_block> d_link; // block that reads via this buffer reader - - //! constructor is private. Use gr_buffer::add_reader to create instances - gr_buffer_reader (gr_buffer_sptr buffer, unsigned int read_index, gr_block_sptr link); -}; - -//! returns # of gr_buffer_readers currently allocated -GR_RUNTIME_API long gr_buffer_reader_ncurrently_allocated (); - - -#endif /* INCLUDED_GR_BUFFER_H */ diff --git a/gnuradio-runtime/include/gr_dispatcher.h b/gnuradio-runtime/include/gr_dispatcher.h deleted file mode 100644 index 7a9e80c9fe..0000000000 --- a/gnuradio-runtime/include/gr_dispatcher.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ - -#ifndef INCLUDED_GR_DISPATCHER_H -#define INCLUDED_GR_DISPATCHER_H - -#include <gr_runtime_api.h> -#include <gr_select_handler.h> -#include <vector> - -class gr_dispatcher; -typedef boost::shared_ptr<gr_dispatcher> gr_dispatcher_sptr; - -GR_RUNTIME_API gr_dispatcher_sptr gr_dispatcher_singleton(); -GR_RUNTIME_API gr_dispatcher_sptr gr_make_dispatcher(); - -/*! - * \brief invoke callbacks based on select. - * \ingroup internal - * - * \sa gr_select_handler - */ -class GR_RUNTIME_API gr_dispatcher -{ - gr_dispatcher(); - friend GR_RUNTIME_API gr_dispatcher_sptr gr_make_dispatcher(); - - std::vector<gr_select_handler_sptr> d_handler; - int d_max_index; - -public: - ~gr_dispatcher(); - - bool add_handler(gr_select_handler_sptr handler); - bool del_handler(gr_select_handler_sptr handler); - bool del_handler(gr_select_handler *handler); - - /*! - * \brief Event dispatching loop. - * - * Enter a polling loop that only terminates after all gr_select_handlers - * have been removed. \p timeout sets the timeout parameter to the select() - * call, measured in seconds. - * - * \param timeout maximum number of seconds to block in select. - */ - void loop(double timeout=10); -}; - -#endif /* INCLUDED_GR_DISPATCHER_H */ diff --git a/gnuradio-runtime/include/gr_error_handler.h b/gnuradio-runtime/include/gr_error_handler.h deleted file mode 100644 index 4d326a6ba1..0000000000 --- a/gnuradio-runtime/include/gr_error_handler.h +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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 code is based on error.hh from the "Click Modular Router". - * Original copyright follows: - */ -/* - * error.{cc,hh} -- flexible classes for error reporting - * Eddie Kohler - * - * Copyright (c) 1999-2000 Massachusetts Institute of Technology - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, subject to the conditions - * listed in the Click LICENSE file. These conditions include: you must - * preserve this copyright notice, and you cannot mention the copyright - * holders in advertising related to the Software without their permission. - * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This - * notice is a summary of the Click LICENSE file; the license in that file is - * legally binding. - */ - -#ifndef INCLUDED_GR_ERROR_HANDLER_H -#define INCLUDED_GR_ERROR_HANDLER_H - -#include <gr_runtime_api.h> -#include <stdarg.h> -#include <string> -#include <cstdio> // for FILE - -/*! - * \brief abstract error handler - * \ingroup base - */ -class GR_RUNTIME_API gr_error_handler { -public: - enum seriousness { - ERR_DEBUG = 0x00000000, - ERR_MESSAGE = 0x00010000, - ERR_WARNING = 0x00020000, - ERR_ERROR = 0x00030000, - ERR_FATAL = 0x00040000 - }; - - gr_error_handler() {} - virtual ~gr_error_handler(); - - static gr_error_handler *default_handler(); - static gr_error_handler *silent_handler(); - - static bool has_default_handler(); - static void set_default_handler(gr_error_handler *errh); - - void debug(const char *format, ...); - void message(const char *format, ...); - void warning(const char *format, ...); - void error(const char *format, ...); - void fatal(const char *format, ...); - - virtual int nwarnings() const = 0; - virtual int nerrors() const = 0; - virtual void reset_counts() = 0; - - void verror(seriousness s, const char *format, va_list); - void verror_text(seriousness s, const std::string &text); - -protected: - virtual void count_error(seriousness s) = 0; - virtual void handle_text(seriousness s, const std::string &str) = 0; - std::string make_text(seriousness s, const char *format, va_list); -}; - - -class GR_RUNTIME_API gr_base_error_handler : public gr_error_handler { - int d_nwarnings; - int d_nerrors; - -public: - gr_base_error_handler() : d_nwarnings(0), d_nerrors(0) {} - int nwarnings() const { return d_nwarnings; } - int nerrors() const { return d_nerrors; } - void reset_counts() { d_nwarnings = d_nerrors = 0; } - void count_error(seriousness s); -}; - -class GR_RUNTIME_API gr_file_error_handler : public gr_base_error_handler { - FILE *d_file; - int d_fd; -public: - gr_file_error_handler(FILE *file); - gr_file_error_handler(int file_descriptor); - ~gr_file_error_handler(); - - void handle_text(seriousness s, const std::string &str); -}; - -#endif /* INCLUDED_GR_ERROR_HANDLER_H */ diff --git a/gnuradio-runtime/include/gr_feval.h b/gnuradio-runtime/include/gr_feval.h deleted file mode 100644 index 07df592e58..0000000000 --- a/gnuradio-runtime/include/gr_feval.h +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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. - */ -#ifndef INCLUDED_GR_FEVAL_H -#define INCLUDED_GR_FEVAL_H - -#include <gr_runtime_api.h> -#include <gr_complex.h> -#include <pmt/pmt.h> - -/*! - * \brief base class for evaluating a function: double -> double - * \ingroup misc - * - * This class is designed to be subclassed in Python or C++ - * and is callable from both places. It uses SWIG's - * "director" feature to implement the magic. - * It's slow. Don't use it in a performance critical path. - * - * Override eval to define the behavior. - * Use calleval to invoke eval (this kludge is required to allow a - * python specific "shim" to be inserted. - */ -class GR_RUNTIME_API gr_feval_dd -{ -protected: - /*! - * \brief override this to define the function - */ - virtual double eval(double x); - -public: - gr_feval_dd() {} - virtual ~gr_feval_dd(); - - virtual double calleval(double x); // invoke "eval" -}; - -/*! - * \brief base class for evaluating a function: complex -> complex - * \ingroup misc - * - * This class is designed to be subclassed in Python or C++ - * and is callable from both places. It uses SWIG's - * "director" feature to implement the magic. - * It's slow. Don't use it in a performance critical path. - * - * Override eval to define the behavior. - * Use calleval to invoke eval (this kludge is required to allow a - * python specific "shim" to be inserted. - */ -class GR_RUNTIME_API gr_feval_cc -{ -protected: - /*! - * \brief override this to define the function - */ - virtual gr_complex eval(gr_complex x); - -public: - gr_feval_cc() {} - virtual ~gr_feval_cc(); - - virtual gr_complex calleval(gr_complex x); // invoke "eval" -}; - -/*! - * \brief base class for evaluating a function: long -> long - * \ingroup misc - * - * This class is designed to be subclassed in Python or C++ - * and is callable from both places. It uses SWIG's - * "director" feature to implement the magic. - * It's slow. Don't use it in a performance critical path. - * - * Override eval to define the behavior. - * Use calleval to invoke eval (this kludge is required to allow a - * python specific "shim" to be inserted. - */ -class GR_RUNTIME_API gr_feval_ll -{ -protected: - /*! - * \brief override this to define the function - */ - virtual long eval(long x); - -public: - gr_feval_ll() {} - virtual ~gr_feval_ll(); - - virtual long calleval(long x); // invoke "eval" -}; - -/*! - * \brief base class for evaluating a function: void -> void - * \ingroup misc - * - * This class is designed to be subclassed in Python or C++ - * and is callable from both places. It uses SWIG's - * "director" feature to implement the magic. - * It's slow. Don't use it in a performance critical path. - * - * Override eval to define the behavior. - * Use calleval to invoke eval (this kludge is required to allow a - * python specific "shim" to be inserted. - */ -class GR_RUNTIME_API gr_feval -{ -protected: - /*! - * \brief override this to define the function - */ - virtual void eval(); - -public: - gr_feval() {} - virtual ~gr_feval(); - - virtual void calleval(); // invoke "eval" -}; - -/*! - * \brief base class for evaluating a function: pmt -> void - * \ingroup misc - * - * This class is designed to be subclassed in Python or C++ - * and is callable from both places. It uses SWIG's - * "director" feature to implement the magic. - * It's slow. Don't use it in a performance critical path. - * - * Override eval to define the behavior. - * Use calleval to invoke eval (this kludge is required to allow a - * python specific "shim" to be inserted. - */ -class GR_RUNTIME_API gr_feval_p -{ -protected: - /*! - * \brief override this to define the function - */ - virtual void eval(pmt::pmt_t x); - -public: - gr_feval_p() {} - virtual ~gr_feval_p(); - - virtual void calleval(pmt::pmt_t x); // invoke "eval" -}; - -/*! - * \brief trivial examples / test cases showing C++ calling Python code - */ -GR_RUNTIME_API double gr_feval_dd_example(gr_feval_dd *f, double x); -GR_RUNTIME_API gr_complex gr_feval_cc_example(gr_feval_cc *f, gr_complex x); -GR_RUNTIME_API long gr_feval_ll_example(gr_feval_ll *f, long x); -GR_RUNTIME_API void gr_feval_example(gr_feval *f); - -#endif /* INCLUDED_GR_FEVAL_H */ diff --git a/gnuradio-runtime/include/gr_flowgraph.h b/gnuradio-runtime/include/gr_flowgraph.h deleted file mode 100644 index 107c50b7b6..0000000000 --- a/gnuradio-runtime/include/gr_flowgraph.h +++ /dev/null @@ -1,251 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007 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. - */ - -#ifndef INCLUDED_GR_FLOWGRAPH_H -#define INCLUDED_GR_FLOWGRAPH_H - -#include <gr_runtime_api.h> -#include <gr_basic_block.h> -#include <iostream> - -/*! - * \brief Class representing a specific input or output graph endpoint - * \ingroup internal - */ -class GR_RUNTIME_API gr_endpoint -{ -private: - gr_basic_block_sptr d_basic_block; - int d_port; - -public: - gr_endpoint() : d_basic_block(), d_port(0) { } - gr_endpoint(gr_basic_block_sptr block, int port) { d_basic_block = block; d_port = port; } - gr_basic_block_sptr block() const { return d_basic_block; } - int port() const { return d_port; } - - bool operator==(const gr_endpoint &other) const; -}; - -inline bool gr_endpoint::operator==(const gr_endpoint &other) const -{ - return (d_basic_block == other.d_basic_block && - d_port == other.d_port); -} - -class GR_RUNTIME_API gr_msg_endpoint -{ -private: - gr_basic_block_sptr d_basic_block; - pmt::pmt_t d_port; - bool d_is_hier; -public: - gr_msg_endpoint() : d_basic_block(), d_port(pmt::PMT_NIL) { } - gr_msg_endpoint(gr_basic_block_sptr block, pmt::pmt_t port, bool is_hier=false){ d_basic_block = block; d_port = port; d_is_hier = is_hier;} - gr_basic_block_sptr block() const { return d_basic_block; } - pmt::pmt_t port() const { return d_port; } - bool is_hier() const { return d_is_hier; } - void set_hier(bool h) { d_is_hier = h; } - - bool operator==(const gr_msg_endpoint &other) const; - -}; - -inline bool gr_msg_endpoint::operator==(const gr_msg_endpoint &other) const -{ - return (d_basic_block == other.d_basic_block && - pmt::equal(d_port, other.d_port)); -} - - -// Hold vectors of gr_endpoint objects -typedef std::vector<gr_endpoint> gr_endpoint_vector_t; -typedef std::vector<gr_endpoint>::iterator gr_endpoint_viter_t; - -/*! - *\brief Class representing a connection between to graph endpoints - * - */ -class GR_RUNTIME_API gr_edge -{ -public: - gr_edge() : d_src(), d_dst() { }; - gr_edge(const gr_endpoint &src, const gr_endpoint &dst) : d_src(src), d_dst(dst) { } - ~gr_edge(); - - const gr_endpoint &src() const { return d_src; } - const gr_endpoint &dst() const { return d_dst; } - -private: - gr_endpoint d_src; - gr_endpoint d_dst; -}; - - -// Hold vectors of gr_edge objects -typedef std::vector<gr_edge> gr_edge_vector_t; -typedef std::vector<gr_edge>::iterator gr_edge_viter_t; - - -/*! - *\brief Class representing a msg connection between to graph msg endpoints - * - */ -class GR_RUNTIME_API gr_msg_edge -{ -public: - gr_msg_edge() : d_src(), d_dst() { }; - gr_msg_edge(const gr_msg_endpoint &src, const gr_msg_endpoint &dst) : d_src(src), d_dst(dst) { } - ~gr_msg_edge() {} - - const gr_msg_endpoint &src() const { return d_src; } - const gr_msg_endpoint &dst() const { return d_dst; } - -private: - gr_msg_endpoint d_src; - gr_msg_endpoint d_dst; -}; - -// Hold vectors of gr_edge objects -typedef std::vector<gr_msg_edge> gr_msg_edge_vector_t; -typedef std::vector<gr_msg_edge>::iterator gr_msg_edge_viter_t; - -// Create a shared pointer to a heap allocated flowgraph -// (types defined in gr_runtime_types.h) -GR_RUNTIME_API gr_flowgraph_sptr gr_make_flowgraph(); - -/*! - * \brief Class representing a directed, acyclic graph of basic blocks - * \ingroup internal - */ -class GR_RUNTIME_API gr_flowgraph -{ -public: - friend GR_RUNTIME_API gr_flowgraph_sptr gr_make_flowgraph(); - - // Destruct an arbitrary flowgraph - ~gr_flowgraph(); - - // Connect two endpoints - void connect(const gr_endpoint &src, const gr_endpoint &dst); - - // Disconnect two endpoints - void disconnect(const gr_endpoint &src, const gr_endpoint &dst); - - // Connect an output port to an input port (convenience) - void connect(gr_basic_block_sptr src_block, int src_port, - gr_basic_block_sptr dst_block, int dst_port); - - // Disconnect an input port from an output port (convenience) - void disconnect(gr_basic_block_sptr src_block, int src_port, - gr_basic_block_sptr dst_block, int dst_port); - - // Connect two msg endpoints - void connect(const gr_msg_endpoint &src, const gr_msg_endpoint &dst); - - // Disconnect two msg endpoints - void disconnect(const gr_msg_endpoint &src, const gr_msg_endpoint &dst); - - // Validate connectivity, raise exception if invalid - void validate(); - - // Clear existing flowgraph - void clear(); - - // Return vector of edges - const gr_edge_vector_t &edges() const { return d_edges; } - - // Return vector of msg edges - const gr_msg_edge_vector_t &msg_edges() const { return d_msg_edges; } - - // Return vector of connected blocks - gr_basic_block_vector_t calc_used_blocks(); - - // Return toplogically sorted vector of blocks. All the sources come first. - gr_basic_block_vector_t topological_sort(gr_basic_block_vector_t &blocks); - - // Return vector of vectors of disjointly connected blocks, topologically - // sorted. - std::vector<gr_basic_block_vector_t> partition(); - -protected: - gr_basic_block_vector_t d_blocks; - gr_edge_vector_t d_edges; - gr_msg_edge_vector_t d_msg_edges; - - gr_flowgraph(); - std::vector<int> calc_used_ports(gr_basic_block_sptr block, bool check_inputs); - gr_basic_block_vector_t calc_downstream_blocks(gr_basic_block_sptr block, int port); - gr_edge_vector_t calc_upstream_edges(gr_basic_block_sptr block); - bool has_block_p(gr_basic_block_sptr block); - gr_edge calc_upstream_edge(gr_basic_block_sptr block, int port); - -private: - - void check_valid_port(gr_io_signature_sptr sig, int port); - void check_valid_port(const gr_msg_endpoint &e); - void check_dst_not_used(const gr_endpoint &dst); - void check_type_match(const gr_endpoint &src, const gr_endpoint &dst); - gr_edge_vector_t calc_connections(gr_basic_block_sptr block, bool check_inputs); // false=use outputs - void check_contiguity(gr_basic_block_sptr block, const std::vector<int> &used_ports, bool check_inputs); - - gr_basic_block_vector_t calc_downstream_blocks(gr_basic_block_sptr block); - gr_basic_block_vector_t calc_reachable_blocks(gr_basic_block_sptr block, gr_basic_block_vector_t &blocks); - void reachable_dfs_visit(gr_basic_block_sptr block, gr_basic_block_vector_t &blocks); - gr_basic_block_vector_t calc_adjacent_blocks(gr_basic_block_sptr block, gr_basic_block_vector_t &blocks); - gr_basic_block_vector_t sort_sources_first(gr_basic_block_vector_t &blocks); - bool source_p(gr_basic_block_sptr block); - void topological_dfs_visit(gr_basic_block_sptr block, gr_basic_block_vector_t &output); -}; - -// Convenience functions -inline -void gr_flowgraph::connect(gr_basic_block_sptr src_block, int src_port, - gr_basic_block_sptr dst_block, int dst_port) -{ - connect(gr_endpoint(src_block, src_port), - gr_endpoint(dst_block, dst_port)); -} - -inline -void gr_flowgraph::disconnect(gr_basic_block_sptr src_block, int src_port, - gr_basic_block_sptr dst_block, int dst_port) -{ - disconnect(gr_endpoint(src_block, src_port), - gr_endpoint(dst_block, dst_port)); -} - -inline std::ostream& -operator <<(std::ostream &os, const gr_endpoint endp) -{ - os << endp.block()->alias() << ":" << endp.port(); - return os; -} - -inline std::ostream& -operator <<(std::ostream &os, const gr_edge edge) -{ - os << edge.src() << "->" << edge.dst(); - return os; -} - -#endif /* INCLUDED_GR_FLOWGRAPH_H */ diff --git a/gnuradio-runtime/include/gr_fxpt.h b/gnuradio-runtime/include/gr_fxpt.h deleted file mode 100644 index b7e3518ffb..0000000000 --- a/gnuradio-runtime/include/gr_fxpt.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ -#ifndef INCLUDED_GR_FXPT_H -#define INCLUDED_GR_FXPT_H - -#include <gr_runtime_api.h> -#include <gr_types.h> - -/*! - * \brief fixed point sine and cosine and friends. - * \ingroup misc - * - * fixed pt radians - * --------- -------- - * -2**31 -pi - * 0 0 - * 2**31-1 pi - epsilon - * - */ -class GR_RUNTIME_API gr_fxpt -{ - static const int WORDBITS = 32; - static const int NBITS = 10; - static const float s_sine_table[1 << NBITS][2]; - static const float PI; - static const float TWO_TO_THE_31; -public: - - static gr_int32 - float_to_fixed (float x) - { - // Fold x into -PI to PI. - int d = (int)floor(x/2/PI+0.5); - x -= d*2*PI; - // And convert to an integer. - return (gr_int32) ((float) x * TWO_TO_THE_31 / PI); - } - - static float - fixed_to_float (gr_int32 x) - { - return x * (PI / TWO_TO_THE_31); - } - - /*! - * \brief Given a fixed point angle x, return float sine (x) - */ - static float - sin (gr_int32 x) - { - gr_uint32 ux = x; - int index = ux >> (WORDBITS - NBITS); - return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1]; - } - - /* - * \brief Given a fixed point angle x, return float cosine (x) - */ - static float - cos (gr_int32 x) - { - gr_uint32 ux = x + 0x40000000; - int index = ux >> (WORDBITS - NBITS); - return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1]; - } - - /* - * \brief Given a fixedpoint angle x, return float cos(x) and sin (x) - */ - static void sincos(gr_int32 x, float *s, float *c) - { - gr_uint32 ux = x; - int sin_index = ux >> (WORDBITS - NBITS); - *s = s_sine_table[sin_index][0] * (ux >> 1) + s_sine_table[sin_index][1]; - - ux = x + 0x40000000; - int cos_index = ux >> (WORDBITS - NBITS); - *c = s_sine_table[cos_index][0] * (ux >> 1) + s_sine_table[cos_index][1]; - - return; - } - -}; - -#endif /* INCLUDED_GR_FXPT_H */ diff --git a/gnuradio-runtime/include/gr_fxpt_nco.h b/gnuradio-runtime/include/gr_fxpt_nco.h deleted file mode 100644 index 36b99ee132..0000000000 --- a/gnuradio-runtime/include/gr_fxpt_nco.h +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2004 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. - */ -#ifndef INCLUDED_GR_FXPT_NCO_H -#define INCLUDED_GR_FXPT_NCO_H - -#include <gr_runtime_api.h> -#include <gr_fxpt.h> -#include <gr_complex.h> - -/*! - * \brief Numerically Controlled Oscillator (NCO) - * \ingroup misc - */ -class /*GR_RUNTIME_API*/ gr_fxpt_nco { - gr_uint32 d_phase; - gr_int32 d_phase_inc; - -public: - gr_fxpt_nco () : d_phase (0), d_phase_inc (0) {} - - ~gr_fxpt_nco () {} - - // radians - void set_phase (float angle) { - d_phase = gr_fxpt::float_to_fixed (angle); - } - - void adjust_phase (float delta_phase) { - d_phase += gr_fxpt::float_to_fixed (delta_phase); - } - - // angle_rate is in radians / step - void set_freq (float angle_rate){ - d_phase_inc = gr_fxpt::float_to_fixed (angle_rate); - } - - // angle_rate is a delta in radians / step - void adjust_freq (float delta_angle_rate) - { - d_phase_inc += gr_fxpt::float_to_fixed (delta_angle_rate); - } - - // increment current phase angle - - void step () - { - d_phase += d_phase_inc; - } - - void step (int n) - { - d_phase += d_phase_inc * n; - } - - // units are radians / step - float get_phase () const { return gr_fxpt::fixed_to_float (d_phase); } - float get_freq () const { return gr_fxpt::fixed_to_float (d_phase_inc); } - - // compute sin and cos for current phase angle - void sincos (float *sinx, float *cosx) const - { - *sinx = gr_fxpt::sin (d_phase); - *cosx = gr_fxpt::cos (d_phase); - } - - // compute cos and sin for a block of phase angles - void sincos (gr_complex *output, int noutput_items, double ampl=1.0) - { - for (int i = 0; i < noutput_items; i++){ - output[i] = gr_complex(gr_fxpt::cos (d_phase) * ampl, gr_fxpt::sin (d_phase) * ampl); - step (); - } - } - - // compute sin for a block of phase angles - void sin (float *output, int noutput_items, double ampl=1.0) - { - for (int i = 0; i < noutput_items; i++){ - output[i] = (float)(gr_fxpt::sin (d_phase) * ampl); - step (); - } - } - - // compute cos for a block of phase angles - void cos (float *output, int noutput_items, double ampl=1.0) - { - for (int i = 0; i < noutput_items; i++){ - output[i] = (float)(gr_fxpt::cos (d_phase) * ampl); - step (); - } - } - - // compute sin for a block of phase angles - void sin (short *output, int noutput_items, double ampl=1.0) - { - for (int i = 0; i < noutput_items; i++){ - output[i] = (short)(gr_fxpt::sin (d_phase) * ampl); - step (); - } - } - - // compute cos for a block of phase angles - void cos (short *output, int noutput_items, double ampl=1.0) - { - for (int i = 0; i < noutput_items; i++){ - output[i] = (short)(gr_fxpt::cos (d_phase) * ampl); - step (); - } - } - - // compute sin for a block of phase angles - void sin (int *output, int noutput_items, double ampl=1.0) - { - for (int i = 0; i < noutput_items; i++){ - output[i] = (int)(gr_fxpt::sin (d_phase) * ampl); - step (); - } - } - - // compute cos for a block of phase angles - void cos (int *output, int noutput_items, double ampl=1.0) - { - for (int i = 0; i < noutput_items; i++){ - output[i] = (int)(gr_fxpt::cos (d_phase) * ampl); - step (); - } - } - - // compute cos or sin for current phase angle - float cos () const { return gr_fxpt::cos (d_phase); } - float sin () const { return gr_fxpt::sin (d_phase); } -}; - -#endif /* INCLUDED_GR_FXPT_NCO_H */ diff --git a/gnuradio-runtime/include/gr_fxpt_vco.h b/gnuradio-runtime/include/gr_fxpt_vco.h deleted file mode 100644 index 15e7327f79..0000000000 --- a/gnuradio-runtime/include/gr_fxpt_vco.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2004,2005 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. - */ -#ifndef INCLUDED_GR_FXPT_VCO_H -#define INCLUDED_GR_FXPT_VCO_H - -#include <gr_runtime_api.h> -#include <gr_fxpt.h> -#include <gr_complex.h> - -/*! - * \brief Voltage Controlled Oscillator (VCO) - * \ingroup misc - */ -class /*GR_RUNTIME_API*/ gr_fxpt_vco { - gr_int32 d_phase; - -public: - gr_fxpt_vco () : d_phase (0) {} - - ~gr_fxpt_vco () {} - - // radians - void set_phase (float angle) { - d_phase = gr_fxpt::float_to_fixed (angle); - } - - void adjust_phase (float delta_phase) { - d_phase += gr_fxpt::float_to_fixed (delta_phase); - } - - float get_phase () const { return gr_fxpt::fixed_to_float (d_phase); } - - // compute sin and cos for current phase angle - void sincos (float *sinx, float *cosx) const - { - *sinx = gr_fxpt::sin (d_phase); - *cosx = gr_fxpt::cos (d_phase); - } - - // compute a block at a time - void cos (float *output, const float *input, int noutput_items, float k, float ampl = 1.0) - { - for (int i = 0; i < noutput_items; i++){ - output[i] = (float)(gr_fxpt::cos (d_phase) * ampl); - adjust_phase(input[i] * k); - } - } - - // compute cos or sin for current phase angle - float cos () const { return gr_fxpt::cos (d_phase); } - float sin () const { return gr_fxpt::sin (d_phase); } -}; - -#endif /* INCLUDED_GR_FXPT_VCO_H */ diff --git a/gnuradio-runtime/include/gr_hier_block2.h b/gnuradio-runtime/include/gr_hier_block2.h deleted file mode 100644 index c39a98f6d7..0000000000 --- a/gnuradio-runtime/include/gr_hier_block2.h +++ /dev/null @@ -1,208 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007,2008,2009 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. - */ -#ifndef INCLUDED_GR_HIER_BLOCK2_H -#define INCLUDED_GR_HIER_BLOCK2_H - -#include <gr_runtime_api.h> -#include <gr_basic_block.h> - -/*! - * \brief public constructor for gr_hier_block2 - - */ -GR_RUNTIME_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); - -class gr_hier_block2_detail; - -/*! - * \brief Hierarchical container class for gr_block's and gr_hier_block2's - * \ingroup container_blk - * \ingroup base_blk - * - */ -class GR_RUNTIME_API gr_hier_block2 : public gr_basic_block -{ -private: - friend class gr_hier_block2_detail; - friend GR_RUNTIME_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); - - /*! - * \brief Private implementation details of gr_hier_block2 - */ - gr_hier_block2_detail *d_detail; - -protected: - gr_hier_block2 (void){} //allows pure virtual interface sub-classes - gr_hier_block2(const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature); - -public: - virtual ~gr_hier_block2(); - - /*! - * \brief typedef for object returned from self(). - * - * This type is only guaranteed to be passable to connect and disconnect. - * No other assumptions should be made about it. - */ - typedef gr_basic_block_sptr opaque_self; - - /*! - * \brief Return an object, representing the current block, which can be passed to connect. - * - * The returned object may only be used as an argument to connect or disconnect. - * Any other use of self() results in unspecified (erroneous) behavior. - */ - opaque_self self(); - - /*! - * \brief Add a stand-alone (possibly hierarchical) block to internal graph - * - * This adds a gr-block or hierarchical block to the internal graph - * without wiring it to anything else. - */ - void connect(gr_basic_block_sptr block); - - /*! - * \brief Add gr-blocks or hierarchical blocks to internal graph and wire together - * - * This adds (if not done earlier by another connect) a pair of gr-blocks or - * hierarchical blocks to the internal flowgraph, and wires the specified output - * port to the specified input port. - */ - void connect(gr_basic_block_sptr src, int src_port, - gr_basic_block_sptr dst, int dst_port); - - /*! - * \brief Add gr-blocks or hierarchical blocks to internal graph and wire together - * - * This adds (if not done earlier by another connect) a pair of gr-blocks or - * hierarchical blocks to the internal message port subscription - */ - void msg_connect(gr_basic_block_sptr src, pmt::pmt_t srcport, - gr_basic_block_sptr dst, pmt::pmt_t dstport); - void msg_connect(gr_basic_block_sptr src, std::string srcport, - gr_basic_block_sptr dst, std::string dstport); - void msg_disconnect(gr_basic_block_sptr src, pmt::pmt_t srcport, - gr_basic_block_sptr dst, pmt::pmt_t dstport); - void msg_disconnect(gr_basic_block_sptr src, std::string srcport, - gr_basic_block_sptr dst, std::string dstport); - - /*! - * \brief Remove a gr-block or hierarchical block from the internal flowgraph. - * - * This removes a gr-block or hierarchical block from the internal flowgraph, - * disconnecting it from other blocks as needed. - * - */ - void disconnect(gr_basic_block_sptr block); - - /*! - * \brief Disconnect a pair of gr-blocks or hierarchical blocks in internal - * flowgraph. - * - * This disconnects the specified input port from the specified output port - * of a pair of gr-blocks or hierarchical blocks. - */ - void disconnect(gr_basic_block_sptr src, int src_port, - gr_basic_block_sptr dst, int dst_port); - - /*! - * \brief Disconnect all connections in the internal flowgraph. - * - * This call removes all output port to input port connections in the internal - * flowgraph. - */ - void disconnect_all(); - - /*! - * Lock a flowgraph in preparation for reconfiguration. When an equal - * number of calls to lock() and unlock() have occurred, the flowgraph - * will be reconfigured. - * - * N.B. lock() and unlock() may not be called from a flowgraph thread - * (E.g., gr_block::work method) or deadlock will occur when - * reconfiguration happens. - */ - virtual void lock(); - - /*! - * Unlock a flowgraph in preparation for reconfiguration. When an equal - * number of calls to lock() and unlock() have occurred, the flowgraph - * will be reconfigured. - * - * N.B. lock() and unlock() may not be called from a flowgraph thread - * (E.g., gr_block::work method) or deadlock will occur when - * reconfiguration happens. - */ - virtual void unlock(); - - // This is a public method for ease of code organization, but should be - // ignored by the user. - gr_flat_flowgraph_sptr flatten() const; - - gr_hier_block2_sptr to_hier_block2(); // Needed for Python type coercion - - bool has_msg_port(pmt::pmt_t which_port){ - return message_port_is_hier(which_port) || gr_basic_block::has_msg_port(which_port); - } - - bool message_port_is_hier(pmt::pmt_t port_id){ - return message_port_is_hier_in(port_id) || message_port_is_hier_out(port_id); - } - bool message_port_is_hier_in(pmt::pmt_t port_id){ - return pmt::list_has(hier_message_ports_in, port_id); - } - bool message_port_is_hier_out(pmt::pmt_t port_id){ - return pmt::list_has(hier_message_ports_out, port_id); - } - - pmt::pmt_t hier_message_ports_in; - pmt::pmt_t hier_message_ports_out; - - void message_port_register_hier_in(pmt::pmt_t port_id){ - if(pmt::list_has(hier_message_ports_in, port_id)) - throw std::invalid_argument("hier msg in port by this name already registered"); - if(msg_queue.find(port_id) != msg_queue.end()) - throw std::invalid_argument("block already has a primitive input port by this name"); - hier_message_ports_in = pmt::list_add(hier_message_ports_in, port_id); - } - void message_port_register_hier_out(pmt::pmt_t port_id){ - if(pmt::list_has(hier_message_ports_out, port_id)) - throw std::invalid_argument("hier msg out port by this name already registered"); - if(pmt::dict_has_key(message_subscribers, port_id)) - throw std::invalid_argument("block already has a primitive output port by this name"); - hier_message_ports_out = pmt::list_add(hier_message_ports_out, port_id); - } - -}; - -inline gr_hier_block2_sptr cast_to_hier_block2_sptr(gr_basic_block_sptr block) { - return boost::dynamic_pointer_cast<gr_hier_block2, gr_basic_block>(block); -} - -#endif /* INCLUDED_GR_HIER_BLOCK2_H */ diff --git a/gnuradio-runtime/include/gr_io_signature.h b/gnuradio-runtime/include/gr_io_signature.h deleted file mode 100644 index 345cd6b9d2..0000000000 --- a/gnuradio-runtime/include/gr_io_signature.h +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007 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. - */ - -#ifndef INCLUDED_IO_SIGNATURE_H -#define INCLUDED_IO_SIGNATURE_H - -#include <gr_runtime_api.h> -#include <gr_runtime_types.h> - -/*! - * \brief Create an i/o signature - * - * \ingroup internal - * \param min_streams specify minimum number of streams (>= 0) - * \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_RUNTIME_API gr_io_signature_sptr -gr_make_io_signature(int min_streams, int max_streams, - int sizeof_stream_item); - -/*! - * \brief Create an i/o signature - * - * \param min_streams specify minimum number of streams (>= 0) - * \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite) - * \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_RUNTIME_API gr_io_signature_sptr -gr_make_io_signature2(int min_streams, int max_streams, - int sizeof_stream_item1, - int sizeof_stream_item2 - ); - -/*! - * \brief Create an i/o signature - * - * \param min_streams specify minimum number of streams (>= 0) - * \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite) - * \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 stream - * \param sizeof_stream_item3 specify the size of the items in the third and subsequent streams - */ -GR_RUNTIME_API gr_io_signature_sptr -gr_make_io_signature3(int min_streams, int max_streams, - int sizeof_stream_item1, - int sizeof_stream_item2, - int sizeof_stream_item3 - ); - -/*! - * \brief Create an i/o signature - * - * \param min_streams specify minimum number of streams (>= 0) - * \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite) - * \param sizeof_stream_items specify the size of the items in the streams - * - * If there are more streams than there are entries in sizeof_stream_items, the - * 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_RUNTIME_API gr_io_signature_sptr -gr_make_io_signaturev(int min_streams, int max_streams, - const std::vector<int> &sizeof_stream_items); - - -/*! - * \brief i/o signature for input and output ports. - * \brief misc - */ -class GR_RUNTIME_API gr_io_signature { - int d_min_streams; - int d_max_streams; - std::vector<int> d_sizeof_stream_item; - - gr_io_signature(int min_streams, int max_streams, - const std::vector<int> &sizeof_stream_items); - - friend GR_RUNTIME_API gr_io_signature_sptr - gr_make_io_signaturev(int min_streams, - int max_streams, - const std::vector<int> &sizeof_stream_items); - - public: - - static const int IO_INFINITE = -1; - - ~gr_io_signature (); - - int min_streams () const { return d_min_streams; } - int max_streams () const { return d_max_streams; } - int sizeof_stream_item (int index) const; - std::vector<int> sizeof_stream_items() const; -}; - - -#endif /* INCLUDED_IO_SIGNATURE_H */ diff --git a/gnuradio-runtime/include/gr_logger.h b/gnuradio-runtime/include/gr_logger.h deleted file mode 100644 index 0e82c5134e..0000000000 --- a/gnuradio-runtime/include/gr_logger.h +++ /dev/null @@ -1,648 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012-2013 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. - */ - -/******************************************************************************* -* Author: Mark Plett -* Description: -* The gr_logger module wraps the log4cpp library for logging in gnuradio -*******************************************************************************/ - -#ifndef INCLUDED_GR_LOGGER_H -#define INCLUDED_GR_LOGGER_H - -/*! -* \file gr_logger.h -* \ingroup logging -* \brief GNURADIO logging wrapper for log4cpp library (C++ port of log4j) -* -*/ - -#include <gr_runtime_api.h> -#include <assert.h> -#include <iostream> -#include <boost/filesystem.hpp> -#include <boost/thread.hpp> -#include <boost/format.hpp> - -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) -typedef int mode_t; -#endif - -#ifdef ENABLE_GR_LOG - -// We have three configurations... first logging to stdout/stderr -#ifndef HAVE_LOG4CPP -//#warning GR logging Enabled and using std::cout - -typedef std::string gr_logger_ptr; - -#define GR_LOG_DECLARE_LOGPTR(logger) -#define GR_LOG_ASSIGN_LOGPTR(logger,name) -#define GR_CONFIG_LOGGER(config) -#define GR_CONFIG_AND_WATCH_LOGGER(config,period) -#define GR_LOG_GETLOGGER(logger, name) -#define GR_SET_LEVEL(name, level) -#define GR_LOG_SET_LEVEL(logger, level) -#define GR_GET_LEVEL(name, level) -#define GR_LOG_GET_LEVEL(logger, level) -#define GR_ADD_CONSOLE_APPENDER(logger,target,pattern) -#define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern) -#define GR_ADD_FILE_APPENDER(name,filename,append,pattern) -#define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern) -#define GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern) -#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern) -#define GR_GET_LOGGER_NAMES(names) -#define GR_RESET_CONFIGURATION() -#define GR_DEBUG(name, msg) std::cout<<"DEBUG: "<<msg<<std::endl -#define GR_INFO(name, msg) std::cout<<"INFO: "<<msg<<std::endl -#define GR_NOTICE(name, msg) std::cout<<"NOTICE: "<<msg<<std::endl -#define GR_WARN(name, msg) std::cerr<<"WARN: "<<msg<<std::endl -#define GR_ERROR(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl -#define GR_ALERT(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl -#define GR_CRIT(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl -#define GR_FATAL(name, msg) std::cerr<<"FATAL: "<<msg<<std::endl -#define GR_EMERG(name, msg) std::cerr<<"EMERG: "<<msg<<std::endl -#define GR_ERRORIF(name, cond, msg) {if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl;} -#define GR_ASSERT(name, cond, msg) {if(!(cond)) std::cerr<<"FATAL: "<<msg<<std::endl; assert(cond);} -#define GR_LOG_DEBUG(logger, msg) std::cout<<"DEBUG: "<<msg<<std::endl -#define GR_LOG_INFO(logger, msg) std::cout<<"INFO: "<<msg<<std::endl -#define GR_LOG_NOTICE(logger, msg) std::cout<<"NOTICE: "<<msg<<std::endl -#define GR_LOG_WARN(logger, msg) std::cerr<<"WARN: "<<msg<<std::endl -#define GR_LOG_ERROR(logger, msg) std::cerr<<"ERROR: "<<msg<<std::endl -#define GR_LOG_ALERT(logger, msg) std::cerr<<"ALERT: "<<msg<<std::endl -#define GR_LOG_CRIT(logger, msg) std::cerr<<"CRIT: "<<msg<<std::endl -#define GR_LOG_FATAL(logger, msg) std::cerr<<"FATAL: "<<msg<<std::endl -#define GR_LOG_EMERG(logger, msg) std::cerr<<"EMERG: "<<msg<<std::endl -#define GR_LOG_ERRORIF(logger, cond, msg) {\ - if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl;} -#define GR_LOG_ASSERT(logger, cond, msg) {\ - if(!(cond)) {std::cerr<<"FATAL: "<<msg<<std::endl; assert(cond);};} - -#else /* HAVE_LOG4CPP */ -// Second configuration...logging to log4cpp - -#include <log4cpp/Category.hh> -#include <log4cpp/PropertyConfigurator.hh> -#include <log4cpp/FileAppender.hh> -#include <log4cpp/RollingFileAppender.hh> -#include <log4cpp/OstreamAppender.hh> -#include <log4cpp/PatternLayout.hh> - -/*! - * \brief GR_LOG macros - * \ingroup logging - * - * These macros wrap the standard LOG4CPP_LEVEL macros. The availablie macros - * are: - * GR_LOG_DEBUG - * GR_LOG_INFO - * GR_LOG_WARN - * GR_LOG_TRACE - * GR_LOG_ERROR - * GR_LOG_ALERT - * GR_LOG_CRIT - * GR_LOG_FATAL - * GR_LOG_EMERG - */ -typedef log4cpp::Category* gr_logger_ptr; - -/* Macros for Programmatic Configuration */ -#define GR_LOG_DECLARE_LOGPTR(logger) \ - gr_logger_ptr logger; - -#define GR_LOG_ASSIGN_LOGPTR(logger,name) \ - logger = logger_get_logger(name); - -#define GR_CONFIG_LOGGER(config) \ - logger_config::load_config(config) - -#define GR_CONFIG_AND_WATCH_LOGGER(config,period) \ - logger_config::load_config(config,period) - -#define GR_LOG_GETLOGGER(logger, name) \ - gr_logger_ptr logger = logger_get_logger(name); - -#define GR_SET_LEVEL(name, level){ \ - gr_logger_ptr logger = logger_get_logger(name);\ - logger_set_level(logger,level);} - -#define GR_LOG_SET_LEVEL(logger, level) \ - logger_set_level(logger, level); - -#define GR_GET_LEVEL(name, level){ \ - gr_logger_ptr logger = logger_get_logger(name);\ - logger_get_level(logger,level);} - -#define GR_LOG_GET_LEVEL(logger, level) \ - logger_get_level(logger,level); - -#define GR_ADD_CONSOLE_APPENDER(name,target,pattern){\ - gr_logger_ptr logger = logger_get_logger(name);\ - logger_add_console_appender(logger,target,pattern);} - -#define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern){\ - logger_add_console_appender(logger,target,pattern);} - -#define GR_ADD_FILE_APPENDER(name,filename,append,pattern){\ - gr_logger_ptr logger = logger_get_logger(name);\ - logger_add_file_appender(logger,filename,append,pattern);} - -#define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern){\ - logger_add_file_appender(logger,filename,append,pattern);} - -#define GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern){\ - gr_logger_ptr logger = logger_get_logger(name);\ - logger_add_rollingfile_appender(logger,filename,filesize,bkup_index,append,mode,pattern);} - -#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern){\ - logger_add_rollingfile_appender(logger,filename,filesize,bkup_index,append,mode,pattern);} - -#define GR_GET_LOGGER_NAMES(names){ \ - names = logger_get_logger_names();} - -#define GR_RESET_CONFIGURATION(){ \ - logger_config::reset_config();} - -/* Logger name referenced macros */ -#define GR_DEBUG(name, msg) { \ - gr_logger_ptr logger = logger_get_logger(name);\ - *logger<< log4cpp::Priority::DEBUG << msg << log4cpp::eol;} - -#define GR_INFO(name, msg) { \ - gr_logger_ptr logger = logger_get_logger(name);\ - *logger<< log4cpp::Priority::INFO << msg << log4cpp::eol;} - -#define GR_NOTICE(name, msg) { \ - gr_logger_ptr logger = logger_get_logger(name);\ - *logger << log4cpp::Priority::NOTICE << msg;} - -#define GR_WARN(name, msg) { \ - gr_logger_ptr logger = logger_get_logger(name);\ - *logger<< log4cpp::Priority::WARN << msg << log4cpp::eol;} - -#define GR_ERROR(name, msg) { \ - gr_logger_ptr logger = logger_get_logger(name);\ - *logger<< log4cpp::Priority::ERROR << msg << log4cpp::eol;} - -#define GR_CRIT(name, msg) { \ - gr_logger_ptr logger = logger_get_logger(name);\ - *logger<< log4cpp::Priority::CRIT << msg << log4cpp::eol;} - -#define GR_ALERT(name, msg) { \ - gr_logger_ptr logger = logger_get_logger(name);\ - *logger<< log4cpp::Priority::ALERT << msg << log4cpp::eol;} - -#define GR_FATAL(name, msg) { \ - gr_logger_ptr logger = logger_get_logger(name);\ - *logger<< log4cpp::Priority::FATAL << msg << log4cpp::eol;} - -#define GR_EMERG(name, msg) { \ - gr_logger_ptr logger = logger_get_logger(name);\ - *logger<< log4cpp::Priority::EMERG << msg << log4cpp::eol;} - -#define GR_ERRORIF(name, cond, msg) { \ -if((cond)){\ - gr_logger_ptr logger = logger_get_logger(name);\ - *logger<< log4cpp::Priority::ERROR << msg << log4cpp::eol;};\ -}; - -#define GR_ASSERT(name, cond, msg) { \ -if(!(cond)){\ - gr_logger_ptr logger = logger_get_logger(name);\ - *logger<< log4cpp::Priority::EMERG << msg << log4cpp::eol;};\ - assert(0);\ -}; - -/* LoggerPtr Referenced Macros */ -#define GR_LOG_DEBUG(logger, msg) { \ - *logger << log4cpp::Priority::DEBUG << msg << log4cpp::eol;} - -#define GR_LOG_INFO(logger, msg) { \ - *logger << log4cpp::Priority::INFO << msg << log4cpp::eol;} - -#define GR_LOG_NOTICE(logger, msg) { \ - *logger << log4cpp::Priority::NOTICE << msg << log4cpp::eol;} - -#define GR_LOG_WARN(logger, msg) { \ - *logger << log4cpp::Priority::WARN << msg << log4cpp::eol;} - -#define GR_LOG_ERROR(logger, msg) { \ - *logger << log4cpp::Priority::ERROR << msg << log4cpp::eol;} - -#define GR_LOG_CRIT(logger, msg) { \ - *logger << log4cpp::Priority::CRIT << msg << log4cpp::eol;} - -#define GR_LOG_ALERT(logger, msg) { \ - *logger << log4cpp::Priority::ALERT << msg << log4cpp::eol;} - -#define GR_LOG_FATAL(logger, msg) { \ - *logger << log4cpp::Priority::FATAL << msg << log4cpp::eol;} - -#define GR_LOG_EMERG(logger, msg) { \ - *logger << log4cpp::Priority::EMERG << msg << log4cpp::eol;} - -#define GR_LOG_ERRORIF(logger,cond, msg) { \ -if((cond)){\ - *logger<< log4cpp::Priority::ERROR << msg << log4cpp::eol;};\ -}; - -#define GR_LOG_ASSERT(logger, cond, msg) { \ -if(!(cond)){\ - *logger<< log4cpp::Priority::EMERG << msg << log4cpp::eol;\ - assert(0);};\ -}; - -/*! - * \brief Class to control configuration of logger. - * This is a singleton that cna launch a thread to wathc a config file for changes - * \ingroup logging - */ -class logger_config { -private: - /*! \brief filename of logger config file */ - std::string filename; - /*! \brief Period (seconds) over which watcher thread checks config file for changes */ - unsigned int watch_period; - /*! \brief Pointer to watch thread for config file changes */ - boost::thread *watch_thread; - - /*! \brief Watcher thread method - * /param filename Name of configuration file - * /param watch_period Seconds between checks for changes in config file - */ - static void watch_file(std::string filename,unsigned int watch_period); - - logger_config(){}; //!< Constructor - logger_config(logger_config const&); //!<Copy constructor - void operator=(logger_config const&); //!<Assignment Operator - - /*! \brief destrcutor stops watch thread before exits */ - ~logger_config(){ - stop_watch(); - }; - - /*! \brief Instance getter for singleton. Only used by class. */ - static logger_config& get_instance(void); - -public: - /*! \brief Getter for config filename */ - static std::string get_filename(); - /*! \brief Getter for watch period */ - static unsigned int get_watch_period(); - /*! \brief Method to load configuration - * /param filename Name of configuration file - * /param watch_period Seconds between checks for changes in config file - */ - static void load_config(std::string filename,unsigned int watch_period=0); - /*! \brief Method to stop watcher thread */ - static void stop_watch(); - /*! \brief method to reset logger configuration */ - static void reset_config(void); -}; - -/*! - * \brief Retrieve a pointer to a logger by name - * - * Retrives a logger pointer - * \p name. - * - * \param name Name of the logger for which a pointer is requested - */ -GR_RUNTIME_API gr_logger_ptr logger_get_logger(std::string name); - -/*! - * \brief Load logger's configuration file. - * - * Initialize the GNU Radio logger by loading the configuration file - * \p config_filename. - * - * \param config_filename The configuration file. Set to "" for the - * basic logger that outputs to the console. - */ -GR_RUNTIME_API void logger_load_config(const std::string &config_filename=""); - -/*! - * \brief Reset logger's configuration file. - * - * Remove all appenders from loggers - */ -GR_RUNTIME_API void logger_reset_config(void); - -GR_RUNTIME_API void logger_load_config_and_watch(const std::string &config_filename, - unsigned int watch_period); - - -/*! - * \brief Set the logger's output level. - * - * Sets the level of the logger. This takes a string that is - * translated to the standard levels and can be (case insensitive): - * - * \li off , notset - * \li debug - * \li info - * \li notice - * \li warn - * \li error - * \li crit - * \li alert - * \li fatal - * \li emerg - * - * \param logger the logger to set the level of. - * \param level string to set the level to. - */ -GR_RUNTIME_API void logger_set_level(gr_logger_ptr logger, const std::string &level); - -/*! - * \brief Set the logger's output level. - * - * Sets the level of the logger. This takes the actual Log4cpp::Priority - * data type, which can be: - * - * \li log4cpp::Priority::NOTSET - * \li log4cpp::Priority::DEBUG - * \li log4cpp::Priority::INFO - * \li log4cpp::Priority::NOTICE - * \li log4cpp::Priority::WARN - * \li log4cpp::Priority::ERROR - * \li log4cpp::Priority::CRIT - * \li log4cpp::Priority::ALERT - * \li log4cpp::Priority::FATAL - * \li log4cpp::Priority::EMERG - * - * \param logger the logger to set the level of. - * \param level new logger level of type Log4cpp::Priority - */ -GR_RUNTIME_API void logger_set_level(gr_logger_ptr logger, log4cpp::Priority::Value level); - - -/*! - * \brief Get the logger's output level. - * - * Gets the level of the logger. This returns a string that - * corresponds to the standard levels and can be (case insensitive): - * - * \li notset - * \li debug - * \li info - * \li notice - * \li warn - * \li error - * \li crit - * \li alert - * \li fatal - * \li emerg - * - * \param logger the logger to get the level of. - * \param level string to get the level into. - */ -GR_RUNTIME_API void logger_get_level(gr_logger_ptr logger, std::string &level); - -/*! - * \brief Get the logger's output level. - * - * Gets the level of the logger. This returns the actual Log4cpp::Level - * data type, which can be: - * - * \li log4cpp::Priority::NOTSET - * \li log4cpp::Priority::DEBUG - * \li log4cpp::Priority::INFO - * \li log4cpp::Priority::NOTICE - * \li log4cpp::Priority::WARN - * \li log4cpp::Priority::ERROR - * \li log4cpp::Priority::CRIT - * \li log4cpp::Priority::ALERT - * \li log4cpp::Priority::FATAL - * \li log4cpp::Priority::EMERG - * - * \param logger the logger to get the level of. - * \param level of the logger. - */ -GR_RUNTIME_API void logger_get_level(gr_logger_ptr logger, log4cpp::Priority::Value &level); - -/*! - * \brief Add console appender to a given logger - * - * Add console appender to a given logger - * - * \param logger Logger to which appender will be added - * \param target Std target to write 'cout' or 'cerr' (default is cout) - * \param pattern Formating pattern for log messages - */ -GR_RUNTIME_API void logger_add_console_appender(gr_logger_ptr logger,std::string target,std::string pattern); - -/*! - * \brief Add file appender to a given logger - * - * Add file appender to a given logger - * - * \param logger Logger to which appender will be added - * \param filename File to which log will be written - * \param append Overwrite or append to log file - * \param pattern Formating pattern for log messages - */ -GR_RUNTIME_API void logger_add_file_appender(gr_logger_ptr logger,std::string filename,bool append,std::string pattern); - -/*! - * \brief Add rolling file appender to a given logger - * - * Add rolling file appender to a given logger - * - * \param logger Logger to which appender will be added - * \param filename File to which log will be written - * \param filesize Sizez of files to write - * \param bkup_index Number of files to write - * \param append Overwrite or append to log file - * \param mode Permissions to set on log file - * \param pattern Formating pattern for log messages - */ -GR_RUNTIME_API void logger_add_rollingfile_appender(gr_logger_ptr logger,std::string filename, - size_t filesize,int bkup_index,bool append,mode_t mode,std::string pattern); - - -/*! - * \brief Add rolling file appender to a given logger - * - * Add rolling file appender to a given logger - * - * \return vector of string names of loggers - */ -GR_RUNTIME_API std::vector<std::string> logger_get_logger_names(void); - -#endif /* HAVE_LOG4CPP */ - - -// If Logger disable do nothing -#else /* ENABLE_GR_LOG */ - -typedef void* gr_logger_ptr; - -#define GR_LOG_DECLARE_LOGPTR(logger) -#define GR_LOG_ASSIGN_LOGPTR(logger,name) -#define GR_CONFIG_LOGGER(config) -#define GR_CONFIG_AND_WATCH_LOGGER(config,period) -#define GR_LOG_GETLOGGER(logger, name) -#define GR_SET_LEVEL(name, level) -#define GR_LOG_SET_LEVEL(logger, level) -#define GR_GET_LEVEL(name, level) -#define GR_LOG_GET_LEVEL(logger, level) -#define GR_ADD_CONSOLE_APPENDER(logger,target,pattern) -#define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern) -#define GR_ADD_FILE_APPENDER(name,filename,append,pattern) -#define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern) -#define GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern) -#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern) -#define GR_GET_LOGGER_NAMES(names) -#define GR_RESET_CONFIGURATION() -#define GR_DEBUG(name, msg) -#define GR_INFO(name, msg) -#define GR_NOTICE(name, msg) -#define GR_WARN(name, msg) -#define GR_ERROR(name, msg) -#define GR_ALERT(name, msg) -#define GR_CRIT(name, msg) -#define GR_FATAL(name, msg) -#define GR_EMERG(name, msg) -#define GR_ERRORIF(name, cond, msg) -#define GR_ASSERT(name, cond, msg) -#define GR_LOG_DEBUG(logger, msg) -#define GR_LOG_INFO(logger, msg) -#define GR_LOG_NOTICE(logger, msg) -#define GR_LOG_WARN(logger, msg) -#define GR_LOG_ERROR(logger, msg) -#define GR_LOG_ALERT(logger, msg) -#define GR_LOG_CRIT(logger, msg) -#define GR_LOG_FATAL(logger, msg) -#define GR_LOG_EMERG(logger, msg) -#define GR_LOG_ERRORIF(logger, cond, msg) -#define GR_LOG_ASSERT(logger, cond, msg) - -#endif /* ENABLE_GR_LOG */ - -// Even if logger is disabled we'll need for methods below to exist in python. -// The macros these call will be disabled if ENABLE_GR_LOG is undefined - -/********************* Start Classes and Methods for Python ******************/ -/*! - * \brief Logger class for referencing loggers in python. Not needed in C++ (use macros) - * Wraps and manipulates loggers for python as python has no macros - * \ingroup logging - * - */ -class gr_logger -{ - private: - /*! \brief logger pointer to logger associated wiith this wrapper class */ - gr_logger_ptr d_logger; - public: - /*! - * \brief contructor Provide name of logger to associate with this class - * \param logger_name Name of logger associated with class - */ - gr_logger(std::string logger_name) { - GR_LOG_ASSIGN_LOGPTR(d_logger,logger_name); - }; - - /*! \brief Destructor */ - ~gr_logger(){;}; - - // Wrappers for logging macros - /*! \brief inline function, wrapper to set the logger level */ - void set_level(std::string level){GR_LOG_SET_LEVEL(d_logger,level);} - - /*! \brief inline function, wrapper to get the logger level */ - void get_level(std::string &level){GR_LOG_GET_LEVEL(d_logger,level);} - - /*! \brief inline function, wrapper for LOG4CPP_DEBUG for DEBUG message */ - void debug(std::string msg){GR_LOG_DEBUG(d_logger,msg);}; - - /*! \brief inline function, wrapper for LOG4CPP_INFO for INFO message */ - void info(std::string msg){GR_LOG_INFO(d_logger,msg);}; - - /*! \brief inline function, wrapper for NOTICE message */ - void notice(std::string msg){GR_LOG_NOTICE(d_logger,msg);}; - - /*! \brief inline function, wrapper for LOG4CPP_WARN for WARN message */ - void warn(std::string msg){GR_LOG_WARN(d_logger,msg);}; - - /*! \brief inline function, wrapper for LOG4CPP_ERROR for ERROR message */ - void error(std::string msg){GR_LOG_ERROR(d_logger,msg);}; - - /*! \brief inline function, wrapper for NOTICE message */ - void crit(std::string msg){GR_LOG_CRIT(d_logger,msg);}; - - /*! \brief inline function, wrapper for ALERT message */ - void alert(std::string msg){GR_LOG_ALERT(d_logger,msg);}; - - /*! \brief inline function, wrapper for FATAL message */ - void fatal(std::string msg){GR_LOG_FATAL(d_logger,msg);}; - - /*! \brief inline function, wrapper for EMERG message */ - void emerg(std::string msg){GR_LOG_EMERG(d_logger,msg);}; - - /*! \brief inline function, wrapper for LOG4CPP_ASSERT for conditional ERROR message */ - void errorIF(bool cond,std::string msg){GR_LOG_ERRORIF(d_logger,cond,msg);}; - - /*! \brief inline function, wrapper for LOG4CPP_ASSERT for conditional ERROR message */ - void log_assert(bool cond,std::string msg){GR_LOG_ASSERT(d_logger,cond,msg);}; - - /*! \brief inline function, Method to add console appender to logger */ - void add_console_appender(std::string target,std::string pattern){ - GR_LOG_ADD_CONSOLE_APPENDER(d_logger,target,pattern); - }; - - /*! \brief inline function, Method to add file appender to logger */ - void add_file_appender(std::string filename,bool append,std::string pattern){ - GR_LOG_ADD_FILE_APPENDER(d_logger,filename,append,pattern); - }; - - /*! \brief inline function, Method to add rolling file appender to logger */ - void add_rollingfile_appender(std::string filename,size_t filesize, - int bkup_index,bool append,mode_t mode,std::string pattern){ - GR_LOG_ADD_ROLLINGFILE_APPENDER(d_logger,filename,filesize, - bkup_index,append,mode,pattern); - }; -}; - -/**************** Start Configuration Class and Methods for Python ************/ -/*! - * \brief Function to call configuration macro from python. - * Note: Configuration is only updated if filename or watch_period has changed. - * \param config_filename Name of configuration file - * \param watch_period Seconds to wait between checking for changes in conf file. - * Watch_period defaults to 0 in which case the file is not watched for changes - */ -GR_RUNTIME_API void gr_logger_config(const std::string config_filename, unsigned int watch_period = 0); -/*! - * \brief Function to return logger names to python - * \return Vector of name strings - * - */ -GR_RUNTIME_API std::vector<std::string> gr_logger_get_logger_names(void); -/*! - * \brief Function to reset logger configuration from python - * - */ -GR_RUNTIME_API void gr_logger_reset_config(void); - -#endif /* INCLUDED_GR_LOGGER_H */ diff --git a/gnuradio-runtime/include/gr_math.h b/gnuradio-runtime/include/gr_math.h deleted file mode 100644 index c7efe8facb..0000000000 --- a/gnuradio-runtime/include/gr_math.h +++ /dev/null @@ -1,209 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2005,2008 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. - */ - -/* - * mathematical odds and ends. - */ - -#ifndef _GR_MATH_H_ -#define _GR_MATH_H_ - -#include <gr_runtime_api.h> -#include <gr_complex.h> - -static inline bool -gr_is_power_of_2(long x) -{ - return x != 0 && (x & (x-1)) == 0; -} - -/*! - * \brief Fast arc tangent using table lookup and linear interpolation - * \ingroup misc - * - * \param y component of input vector - * \param x component of input vector - * \returns float angle angle of vector (x, y) in radians - * - * This function calculates the angle of the vector (x,y) based on a - * table lookup and linear interpolation. The table uses a 256 point - * table covering -45 to +45 degrees and uses symetry to determine the - * final angle value in the range of -180 to 180 degrees. Note that - * this function uses the small angle approximation for values close - * to zero. This routine calculates the arc tangent with an average - * error of +/- 0.045 degrees. - */ -GR_RUNTIME_API float gr_fast_atan2f(float y, float x); - -static inline float gr_fast_atan2f(gr_complex z) -{ - return gr_fast_atan2f(z.imag(), z.real()); -} - -/* This bounds x by +/- clip without a branch */ -static inline float gr_branchless_clip(float x, float clip) -{ - float x1 = fabsf(x+clip); - float x2 = fabsf(x-clip); - x1 -= x2; - return 0.5*x1; -} - -static inline float gr_clip(float x, float clip) -{ - float y = x; - if(x > clip) - y = clip; - else if(x < -clip) - y = -clip; - return y; -} - -// Slicer Functions -static inline unsigned int gr_binary_slicer(float x) -{ - if(x >= 0) - return 1; - else - return 0; -} - -static inline unsigned int gr_quad_45deg_slicer(float r, float i) -{ - unsigned int ret = 0; - if((r >= 0) && (i >= 0)) - ret = 0; - else if((r < 0) && (i >= 0)) - ret = 1; - else if((r < 0) && (i < 0)) - ret = 2; - else - ret = 3; - return ret; -} - -static inline unsigned int gr_quad_0deg_slicer(float r, float i) -{ - unsigned int ret = 0; - if(fabsf(r) > fabsf(i)) { - if(r > 0) - ret = 0; - else - ret = 2; - } - else { - if(i > 0) - ret = 1; - else - ret = 3; - } - - return ret; -} - -static inline unsigned int gr_quad_45deg_slicer(gr_complex x) -{ - return gr_quad_45deg_slicer(x.real(), x.imag()); -} - -static inline unsigned int gr_quad_0deg_slicer(gr_complex x) -{ - return gr_quad_0deg_slicer(x.real(), x.imag()); -} - -// Branchless Slicer Functions -static inline unsigned int gr_branchless_binary_slicer(float x) -{ - return (x >= 0); -} - -static inline unsigned int gr_branchless_quad_0deg_slicer(float r, float i) -{ - unsigned int ret = 0; - ret = (fabsf(r) > fabsf(i)) * (((r < 0) << 0x1)); // either 0 (00) or 2 (10) - ret |= (fabsf(i) > fabsf(r)) * (((i < 0) << 0x1) | 0x1); // either 1 (01) or 3 (11) - - return ret; -} - -static inline unsigned int gr_branchless_quad_0deg_slicer(gr_complex x) -{ - return gr_branchless_quad_0deg_slicer(x.real(), x.imag()); -} - -static inline unsigned int gr_branchless_quad_45deg_slicer(float r, float i) -{ - char ret = (r <= 0); - ret |= ((i <= 0) << 1); - return (ret ^ ((ret & 0x2) >> 0x1)); -} - -static inline unsigned int gr_branchless_quad_45deg_slicer(gr_complex x) -{ - return gr_branchless_quad_45deg_slicer(x.real(), x.imag()); -} - -/*! - * \param x any value - * \param pow2 must be a power of 2 - * \returns \p x rounded down to a multiple of \p pow2. - */ -static inline size_t -gr_p2_round_down(size_t x, size_t pow2) -{ - return x & -pow2; -} - -/*! - * \param x any value - * \param pow2 must be a power of 2 - * \returns \p x rounded up to a multiple of \p pow2. - */ -static inline size_t -gr_p2_round_up(size_t x, size_t pow2) -{ - return gr_p2_round_down(x + pow2 - 1, pow2); -} - -/*! - * \param x any value - * \param pow2 must be a power of 2 - * \returns \p x modulo \p pow2. - */ -static inline size_t -gr_p2_modulo(size_t x, size_t pow2) -{ - return x & (pow2 - 1); -} - -/*! - * \param x any value - * \param pow2 must be a power of 2 - * \returns \p pow2 - (\p x modulo \p pow2). - */ -static inline size_t -gr_p2_modulo_neg(size_t x, size_t pow2) -{ - return pow2 - gr_p2_modulo(x, pow2); -} - -#endif /* _GR_MATH_H_ */ diff --git a/gnuradio-runtime/include/gr_message.h b/gnuradio-runtime/include/gr_message.h deleted file mode 100644 index 941821617b..0000000000 --- a/gnuradio-runtime/include/gr_message.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ -#ifndef INCLUDED_GR_MESSAGE_H -#define INCLUDED_GR_MESSAGE_H - -#include <gr_runtime_api.h> -#include <gr_types.h> -#include <string> - -class gr_message; -typedef boost::shared_ptr<gr_message> gr_message_sptr; - -/*! - * \brief public constructor for gr_message - */ -GR_RUNTIME_API gr_message_sptr -gr_make_message(long type = 0, double arg1 = 0, double arg2 = 0, size_t length = 0); - -GR_RUNTIME_API gr_message_sptr -gr_make_message_from_string(const std::string s, long type = 0, double arg1 = 0, double arg2 = 0); - -/*! - * \brief Message class. - * - * \ingroup misc - * The ideas and method names for adjustable message length were - * lifted from the click modular router "Packet" class. - */ -class GR_RUNTIME_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 - double d_arg2; // optional arg2 - - unsigned char *d_buf_start; // start of allocated buffer - unsigned char *d_msg_start; // where the msg starts - unsigned char *d_msg_end; // one beyond end of msg - unsigned char *d_buf_end; // one beyond end of allocated buffer - - gr_message (long type, double arg1, double arg2, size_t length); - - friend GR_RUNTIME_API gr_message_sptr - gr_make_message (long type, double arg1, double arg2, size_t length); - - friend GR_RUNTIME_API gr_message_sptr - gr_make_message_from_string (const std::string s, long type, double arg1, double arg2); - - friend class gr_msg_queue; - - unsigned char *buf_data() const { return d_buf_start; } - size_t buf_len() const { return d_buf_end - d_buf_start; } - -public: - ~gr_message (); - - long type() const { return d_type; } - double arg1() const { return d_arg1; } - double arg2() const { return d_arg2; } - - void set_type(long type) { d_type = type; } - void set_arg1(double arg1) { d_arg1 = arg1; } - void set_arg2(double arg2) { d_arg2 = arg2; } - - unsigned char *msg() const { return d_msg_start; } - size_t length() const { return d_msg_end - d_msg_start; } - std::string to_string() const; - -}; - -GR_RUNTIME_API long gr_message_ncurrently_allocated (); - -#endif /* INCLUDED_GR_MESSAGE_H */ diff --git a/gnuradio-runtime/include/gr_msg_queue.h b/gnuradio-runtime/include/gr_msg_queue.h deleted file mode 100644 index ac85729c81..0000000000 --- a/gnuradio-runtime/include/gr_msg_queue.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2009 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. - */ -#ifndef INCLUDED_GR_MSG_QUEUE_H -#define INCLUDED_GR_MSG_QUEUE_H - -#include <gr_runtime_api.h> -#include <gr_msg_handler.h> -#include <thread/thread.h> - -class gr_msg_queue; -typedef boost::shared_ptr<gr_msg_queue> gr_msg_queue_sptr; - -GR_RUNTIME_API gr_msg_queue_sptr gr_make_msg_queue(unsigned int limit=0); - -/*! - * \brief thread-safe message queue - * \ingroup misc - */ -class GR_RUNTIME_API gr_msg_queue : public gr_msg_handler { - - gr::thread::mutex d_mutex; - gr::thread::condition_variable d_not_empty; - gr::thread::condition_variable d_not_full; - gr_message_sptr d_head; - gr_message_sptr d_tail; - unsigned int d_count; // # of messages in queue. - unsigned int d_limit; // max # of messages in queue. 0 -> unbounded - -public: - gr_msg_queue(unsigned int limit); - ~gr_msg_queue(); - - //! Generic msg_handler method: insert the message. - void handle(gr_message_sptr msg) { insert_tail (msg); } - - /*! - * \brief Insert message at tail of queue. - * \param msg message - * - * Block if queue if full. - */ - void insert_tail(gr_message_sptr msg); - - /*! - * \brief Delete message from head of queue and return it. - * Block if no message is available. - */ - gr_message_sptr delete_head(); - - /*! - * \brief If there's a message in the q, delete it and return it. - * If no message is available, return 0. - */ - gr_message_sptr delete_head_nowait(); - - //! Delete all messages from the queue - void flush(); - - //! is the queue empty? - bool empty_p() const { return d_count == 0; } - - //! is the queue full? - bool full_p() const { return d_limit != 0 && d_count >= d_limit; } - - //! return number of messages in queue - unsigned int count() const { return d_count; } - - //! return limit on number of message in queue. 0 -> unbounded - unsigned int limit() const { return d_limit; } - -}; - -#endif /* INCLUDED_GR_MSG_QUEUE_H */ diff --git a/gnuradio-runtime/include/gr_nco.h b/gnuradio-runtime/include/gr_nco.h deleted file mode 100644 index fb51106aab..0000000000 --- a/gnuradio-runtime/include/gr_nco.h +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ -#ifndef _GR_NCO_H_ -#define _GR_NCO_H_ - - -#include <vector> -#include <gr_sincos.h> -#include <cmath> -#include <gr_complex.h> - -/*! - * \brief base class template for Numerically Controlled Oscillator (NCO) - * \ingroup misc - */ - - -//FIXME Eventually generalize this to fixed point - -template<class o_type, class i_type> -class gr_nco { -public: - gr_nco () : phase (0), phase_inc(0) {} - - virtual ~gr_nco () {} - - // radians - void set_phase (double angle) { - phase = angle; - } - - void adjust_phase (double delta_phase) { - phase += delta_phase; - } - - - // angle_rate is in radians / step - void set_freq (double angle_rate){ - phase_inc = angle_rate; - } - - // angle_rate is a delta in radians / step - void adjust_freq (double delta_angle_rate) - { - phase_inc += delta_angle_rate; - } - - // increment current phase angle - - void step () - { - phase += phase_inc; - if (fabs (phase) > M_PI){ - - while (phase > M_PI) - phase -= 2*M_PI; - - while (phase < -M_PI) - phase += 2*M_PI; - } - } - - void step (int n) - { - phase += phase_inc * n; - if (fabs (phase) > M_PI){ - - while (phase > M_PI) - phase -= 2*M_PI; - - while (phase < -M_PI) - phase += 2*M_PI; - } - } - - // units are radians / step - double get_phase () const { return phase; } - double get_freq () const { return phase_inc; } - - // compute sin and cos for current phase angle - void sincos (float *sinx, float *cosx) const; - - // compute cos or sin for current phase angle - float cos () const { return std::cos (phase); } - float sin () const { return std::sin (phase); } - - // compute a block at a time - void sin (float *output, int noutput_items, double ampl = 1.0); - void cos (float *output, int noutput_items, double ampl = 1.0); - void sincos (gr_complex *output, int noutput_items, double ampl = 1.0); - void sin (short *output, int noutput_items, double ampl = 1.0); - void cos (short *output, int noutput_items, double ampl = 1.0); - void sin (int *output, int noutput_items, double ampl = 1.0); - void cos (int *output, int noutput_items, double ampl = 1.0); - -protected: - double phase; - double phase_inc; -}; - -template<class o_type, class i_type> -void -gr_nco<o_type,i_type>::sincos (float *sinx, float *cosx) const -{ - gr_sincosf (phase, sinx, cosx); -} - -template<class o_type, class i_type> -void -gr_nco<o_type,i_type>::sin (float *output, int noutput_items, double ampl) -{ - for (int i = 0; i < noutput_items; i++){ - output[i] = (float)(sin () * ampl); - step (); - } -} - -template<class o_type, class i_type> -void -gr_nco<o_type,i_type>::cos (float *output, int noutput_items, double ampl) -{ - for (int i = 0; i < noutput_items; i++){ - output[i] = (float)(cos () * ampl); - step (); - } -} - -template<class o_type, class i_type> -void -gr_nco<o_type,i_type>::sin (short *output, int noutput_items, double ampl) -{ - for (int i = 0; i < noutput_items; i++){ - output[i] = (short)(sin() * ampl); - step (); - } -} - -template<class o_type, class i_type> -void -gr_nco<o_type,i_type>::cos (short *output, int noutput_items, double ampl) -{ - for (int i = 0; i < noutput_items; i++){ - output[i] = (short)(cos () * ampl); - step (); - } -} - -template<class o_type, class i_type> -void -gr_nco<o_type,i_type>::sin (int *output, int noutput_items, double ampl) -{ - for (int i = 0; i < noutput_items; i++){ - output[i] = (int)(sin () * ampl); - step (); - } -} - -template<class o_type, class i_type> -void -gr_nco<o_type,i_type>::cos (int *output, int noutput_items, double ampl) -{ - for (int i = 0; i < noutput_items; i++){ - output[i] = (int)(cos () * ampl); - step (); - } -} - -template<class o_type, class i_type> -void -gr_nco<o_type,i_type>::sincos (gr_complex *output, int noutput_items, double ampl) -{ - for (int i = 0; i < noutput_items; i++){ - float cosx, sinx; - sincos (&sinx, &cosx); - output[i] = gr_complex(cosx * ampl, sinx * ampl); - step (); - } -} -#endif /* _NCO_H_ */ diff --git a/gnuradio-runtime/include/gr_prefs.h b/gnuradio-runtime/include/gr_prefs.h deleted file mode 100644 index 0f82c46fae..0000000000 --- a/gnuradio-runtime/include/gr_prefs.h +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2013 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. - */ - -#ifndef INCLUDED_GR_PREFS_H -#define INCLUDED_GR_PREFS_H - -#include <gr_runtime_api.h> -#include <string> -#include <map> -#include <thread/thread.h> - -typedef std::map< std::string, std::map<std::string, std::string> > gr_config_map_t; -typedef std::map< std::string, std::map<std::string, std::string> >::iterator gr_config_map_itr; -typedef std::map<std::string, std::string> gr_config_map_elem_t; -typedef std::map<std::string, std::string>::iterator gr_config_map_elem_itr; - -/*! - * \brief Base class for representing user preferences a la windows INI files. - * \ingroup misc - * - * The real implementation is in Python, and is accessable from C++ - * via the magic of SWIG directors. - */ - -class GR_RUNTIME_API gr_prefs -{ -public: - static gr_prefs *singleton(); - static void set_singleton(gr_prefs *p); - - gr_prefs(); - virtual ~gr_prefs(); - - /*! - * \brief Returns the configuration options as a string. - */ - std::string to_string(); - - /*! - * \brief Saves the configuration settings to ${HOME}/.gnuradio/config.conf. - * - * WARNING: this will overwrite your current config.conf file. - */ - void save(); - - /*! - * \brief Does \p section exist? - */ - virtual bool has_section(const std::string §ion); - - /*! - * \brief Does \p option exist? - */ - virtual bool has_option(const std::string §ion, const std::string &option); - - /*! - * \brief If option exists return associated value; else default_val. - */ - virtual const std::string get_string(const std::string §ion, - const std::string &option, - const std::string &default_val); - - /*! - * \brief Set or add a string \p option to \p section with value \p val. - */ - virtual void set_string(const std::string §ion, - const std::string &option, - const std::string &val); - - /*! - * \brief If option exists and value can be converted to bool, return it; else default_val. - */ - virtual bool get_bool(const std::string §ion, - const std::string &option, - bool default_val); - - /*! - * \brief Set or add a bool \p option to \p section with value \p val. - */ - virtual void set_bool(const std::string §ion, - const std::string &option, - bool val); - - /*! - * \brief If option exists and value can be converted to long, return it; else default_val. - */ - virtual long get_long(const std::string §ion, - const std::string &option, - long default_val); - - /*! - * \brief Set or add a long \p option to \p section with value \p val. - */ - virtual void set_long(const std::string §ion, - const std::string &option, - long val); - - /*! - * \brief If option exists and value can be converted to double, return it; else default_val. - */ - virtual double get_double(const std::string §ion, - const std::string &option, - double default_val); - - /*! - * \brief Set or add a double \p option to \p section with value \p val. - */ - virtual void set_double(const std::string §ion, - const std::string &option, - double val); - - protected: - virtual std::vector<std::string> _sys_prefs_filenames(); - virtual void _read_files(); - virtual void _convert_to_map(const std::string &conf); - virtual char * option_to_env(std::string section, std::string option); - - private: - gr::thread::mutex d_mutex; - gr_config_map_t d_config_map; -}; - - -#endif /* INCLUDED_GR_PREFS_H */ diff --git a/gnuradio-runtime/include/gr_py_feval.h b/gnuradio-runtime/include/gr_py_feval.h deleted file mode 100644 index f2f6c801a8..0000000000 --- a/gnuradio-runtime/include/gr_py_feval.h +++ /dev/null @@ -1,51 +0,0 @@ -#include <pmt/pmt.h> - -class gr_py_feval_dd : public gr_feval_dd -{ - public: - double calleval(double x) - { - ensure_py_gil_state _lock; - return eval(x); - } -}; - -class gr_py_feval_cc : public gr_feval_cc -{ - public: - gr_complex calleval(gr_complex x) - { - ensure_py_gil_state _lock; - return eval(x); - } -}; - -class gr_py_feval_ll : public gr_feval_ll -{ - public: - long calleval(long x) - { - ensure_py_gil_state _lock; - return eval(x); - } -}; - -class gr_py_feval : public gr_feval -{ - public: - void calleval() - { - ensure_py_gil_state _lock; - eval(); - } -}; - -class gr_py_feval_p : public gr_feval_p -{ - public: - void calleval(pmt::pmt_t x) - { - ensure_py_gil_state _lock; - eval(x); - } -}; diff --git a/gnuradio-runtime/include/gr_random.h b/gnuradio-runtime/include/gr_random.h deleted file mode 100644 index 783c05f920..0000000000 --- a/gnuradio-runtime/include/gr_random.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#ifndef INCLUDED_GR_RANDOM_H -#define INCLUDED_GR_RANDOM_H - -#include <gr_runtime_api.h> -#include <gr_complex.h> - -/*! - * \brief pseudo random number generator - * \ingroup math_blk - */ -class GR_RUNTIME_API gr_random { -protected: - static const int NTAB = 32; - long d_seed; - long d_iy; - long d_iv[NTAB]; - int d_iset; - float d_gset; - - -public: - gr_random (long seed=3021); - - void reseed (long seed); - - /*! - * \brief uniform random deviate in the range [0.0, 1.0) - */ - float ran1 (); - - /*! - * \brief normally distributed deviate with zero mean and variance 1 - */ - float gasdev (); - - float laplacian (); - float impulse (float factor); - float rayleigh (); - gr_complex rayleigh_complex (); -}; - -#endif /* INCLUDED_GR_RANDOM_H */ - diff --git a/gnuradio-runtime/include/gr_runtime_types.h b/gnuradio-runtime/include/gr_runtime_types.h deleted file mode 100644 index 9af745b3fa..0000000000 --- a/gnuradio-runtime/include/gr_runtime_types.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007 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. - */ - -#ifndef INCLUDED_GR_RUNTIME_TYPES_H -#define INCLUDED_GR_RUNTIME_TYPES_H - -#include <gr_runtime_api.h> -#include <gr_types.h> - -/* - * typedefs for smart pointers we use throughout the runtime system - */ - -class gr_basic_block; -class gr_block; -class gr_block_detail; -class gr_hier_block2; -class gr_io_signature; -class gr_buffer; -class gr_buffer_reader; -class gr_flowgraph; -class gr_flat_flowgraph; -class gr_top_block; -class gr_top_block_detail; - -typedef boost::shared_ptr<gr_basic_block> gr_basic_block_sptr; -typedef boost::shared_ptr<gr_block> gr_block_sptr; -typedef boost::shared_ptr<gr_block_detail> gr_block_detail_sptr; -typedef boost::shared_ptr<gr_hier_block2> gr_hier_block2_sptr; -typedef boost::shared_ptr<gr_io_signature> gr_io_signature_sptr; -typedef boost::shared_ptr<gr_buffer> gr_buffer_sptr; -typedef boost::shared_ptr<gr_buffer_reader> gr_buffer_reader_sptr; -typedef boost::shared_ptr<gr_flowgraph> gr_flowgraph_sptr; -typedef boost::shared_ptr<gr_flat_flowgraph> gr_flat_flowgraph_sptr; -typedef boost::shared_ptr<gr_top_block> gr_top_block_sptr; - -#endif /* INCLUDED_GR_RUNTIME_TYPES_H */ diff --git a/gnuradio-runtime/include/gr_select_handler.h b/gnuradio-runtime/include/gr_select_handler.h deleted file mode 100644 index ae4b9dfdb1..0000000000 --- a/gnuradio-runtime/include/gr_select_handler.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ - -#ifndef INCLUDED_GR_SELECT_HANDLER_H -#define INCLUDED_GR_SELECT_HANDLER_H - -#include <gr_runtime_api.h> -#include <boost/shared_ptr.hpp> - -class gr_select_handler; -typedef boost::shared_ptr<gr_select_handler> gr_select_handler_sptr; - - -/*! - * \brief Abstract handler for select based notification. - * \ingroup base - * - * \sa gr_dispatcher - */ -class GR_RUNTIME_API gr_select_handler -{ - int d_fd; - -protected: - gr_select_handler(int file_descriptor); - -public: - virtual ~gr_select_handler(); - - int fd() const { return d_fd; } - int file_descriptor() const { return d_fd; } - - /*! - * \brief Called when file_descriptor is readable. - * - * Called when the dispatcher detects that file_descriptor can - * be read without blocking. - */ - virtual void handle_read() = 0; - - /*! - * \brief Called when file_descriptor is writable. - * - * Called when dispatcher detects that file descriptor can be - * written without blocking. - */ - virtual void handle_write() = 0; - - /*! - * Called each time around the dispatcher loop to determine whether - * this handler's file descriptor should be added to the list on which - * read events can occur. The default method returns true, indicating - * that by default, all handlers are interested in read events. - */ - virtual bool readable() { return true; } - - /*! - * Called each time around the dispatcher loop to determine whether - * this handler's file descriptor should be added to the list on which - * write events can occur. The default method returns true, indicating - * that by default, all handlers are interested in write events. - */ - virtual bool writable() { return true; } -}; - -#endif /* INCLUDED_GR_SELECT_HANDLER_H */ diff --git a/gnuradio-runtime/include/gr_sync_block.h b/gnuradio-runtime/include/gr_sync_block.h deleted file mode 100644 index 01eb646143..0000000000 --- a/gnuradio-runtime/include/gr_sync_block.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifndef INCLUDED_GR_SYNC_BLOCK_H -#define INCLUDED_GR_SYNC_BLOCK_H - -#include <gr_runtime_api.h> -#include <gr_block.h> - -/*! - * \brief synchronous 1:1 input to output with history - * \ingroup base_blk - * - * Override work to provide the signal processing implementation. - */ -class GR_RUNTIME_API gr_sync_block : public gr_block -{ - protected: - gr_sync_block (void){} //allows pure virtual interface sub-classes - gr_sync_block (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature); - - public: - - /*! - * \brief just like gr_block::general_work, only this arranges to call consume_each for you - * - * The user must override work to define the signal processing code - */ - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) = 0; - - - // gr_sync_block overrides these to assist work - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - int fixed_rate_ninput_to_noutput(int ninput); - int fixed_rate_noutput_to_ninput(int noutput); -}; - -#endif /* INCLUDED_GR_SYNC_BLOCK_H */ diff --git a/gnuradio-runtime/include/gr_sync_decimator.h b/gnuradio-runtime/include/gr_sync_decimator.h deleted file mode 100644 index c799ee0f7c..0000000000 --- a/gnuradio-runtime/include/gr_sync_decimator.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifndef INCLUDED_GR_SYNC_DECIMATOR_H -#define INCLUDED_GR_SYNC_DECIMATOR_H - -#include <gr_runtime_api.h> -#include <gr_sync_block.h> - -/*! - * \brief synchronous N:1 input to output with history - * \ingroup base_blk - * - * Override work to provide the signal processing implementation. - */ -class GR_RUNTIME_API gr_sync_decimator : public gr_sync_block -{ - private: - unsigned d_decimation; - - protected: - gr_sync_decimator (void){} //allows pure virtual interface sub-classes - gr_sync_decimator (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - unsigned decimation); - public: - - unsigned decimation () const { return d_decimation; } - void set_decimation (unsigned decimation) - { - d_decimation = decimation; - set_relative_rate (1.0 / decimation); - } - - // gr_sync_decimator overrides these to assist work - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - // derived classes should override work - - int fixed_rate_ninput_to_noutput(int ninput); - int fixed_rate_noutput_to_ninput(int noutput); -}; - - -#endif /* INCLUDED_GR_SYNC_DECIMATOR_H */ diff --git a/gnuradio-runtime/include/gr_sync_interpolator.h b/gnuradio-runtime/include/gr_sync_interpolator.h deleted file mode 100644 index f219916743..0000000000 --- a/gnuradio-runtime/include/gr_sync_interpolator.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008 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. - */ - -#ifndef INCLUDED_GR_SYNC_INTERPOLATOR_H -#define INCLUDED_GR_SYNC_INTERPOLATOR_H - -#include <gr_runtime_api.h> -#include <gr_sync_block.h> - -/*! - * \brief synchronous 1:N input to output with history - * \ingroup base_blk - * - * Override work to provide the signal processing implementation. - */ -class GR_RUNTIME_API gr_sync_interpolator : public gr_sync_block -{ - private: - unsigned d_interpolation; - - protected: - gr_sync_interpolator (void){} //allows pure virtual interface sub-classes - gr_sync_interpolator (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - unsigned interpolation); - public: - - unsigned interpolation () const { return d_interpolation; } - void set_interpolation (unsigned interpolation) - { - d_interpolation = interpolation; - set_relative_rate (1.0 * interpolation); - set_output_multiple (interpolation); - } - - // gr_sync_interpolator overrides these to assist work - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - // derived classes should override work - - int fixed_rate_ninput_to_noutput(int ninput); - int fixed_rate_noutput_to_ninput(int noutput); -}; - - -#endif /* INCLUDED_GR_SYNC_INTERPOLATOR_H */ diff --git a/gnuradio-runtime/include/gr_tagged_stream_block.h b/gnuradio-runtime/include/gr_tagged_stream_block.h deleted file mode 100644 index 67b144fb66..0000000000 --- a/gnuradio-runtime/include/gr_tagged_stream_block.h +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2013 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. - */ - -#ifndef INCLUDED_GR_TAGGED_STREAM_BLOCK_H -#define INCLUDED_GR_TAGGED_STREAM_BLOCK_H - -#include <gr_runtime_api.h> -#include <gr_block.h> - -/*! - * \brief Block that operates on PDUs in form of tagged streams - * \ingroup base_blk - * - * Override work to provide the signal processing implementation. - */ -class GR_RUNTIME_API gr_tagged_stream_block : public gr_block -{ - private: - pmt::pmt_t d_length_tag_key; //!< This is the key for the tag that stores the PDU length - gr_vector_int d_n_input_items_reqd; //!< How many input items do I need to process the next PDU? - - protected: - std::string d_length_tag_key_str; - gr_tagged_stream_block (void){} //allows pure virtual interface sub-classes - gr_tagged_stream_block (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - const std::string &length_tag_key); - - /*! - * \brief Parse all tags on the first sample of a PDU, return the number of items per input - * and prune the length tags. - * - * In most cases, you don't need to override this, unless the number of items read - * is not directly coded in one single tag. - * - * Default behaviour: - * - Go through all input ports - * - On every input port, search for the tag with the key specified in \p length_tag_key - * - Copy that value as an int to the corresponding position in \p n_input_items_reqd - * - Remove the length tag. - * - * \param[in] tags All the tags found on the first item of every input port. - * \param[out] n_input_items_reqd Number of items which will be read from every input - */ - virtual void parse_length_tags( - const std::vector<std::vector<gr_tag_t> > &tags, - gr_vector_int &n_input_items_reqd - ); - - /*! - * \brief Calculate the number of output items. - * - * This is basically the inverse function to forecast(): Given a number of input - * items, it returns the maximum number of output items. - * - * You most likely need to override this function, unless your block is a sync - * block or integer interpolator/decimator. - * - */ - virtual int calculate_output_stream_length(const gr_vector_int &ninput_items); - - /*! - * \brief Set the new length tags on the output stream - * - * Default behaviour: Set a tag with key \p length_tag_key and - * the number of produced items on every output port. - * - * For anything else, override this. - * - * \param n_produced Length of the new PDU - * \param n_ports Number of output ports - */ - virtual void update_length_tags(int n_produced, int n_ports); - - public: - - /*! \brief Don't override this. - */ - void /* final */ forecast (int noutput_items, gr_vector_int &ninput_items_required); - - /*! - * - Reads the number of input items from the tags using parse_length_tags() - * - Checks there's enough data on the input and output buffers - * - If not, inform the scheduler and do nothing - * - Calls work() with the exact number of items per PDU - * - Updates the tags using update_length_tags() - */ - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - /*! - * \brief Just like gr_block::general_work, but makes sure the input is valid - * - * The user must override work to define the signal processing code. - * Check the documentation for general_work() to see what happens here. - * - * Like gr_sync_block, this calls consume() for you (it consumes ninput_items[i] - * items from the i-th port). - * - * A note on tag propagation: The PDU length tags are handled by other functions, - * but all other tags are handled just as in any other \p gr_block. So, most likely, - * you either set the tag propagation policy to TPP_DONT and handle the tag - * propagation manually, or you propagate tags through the scheduler and don't - * do anything here. - * - * \param noutput_items The size of the writable output buffer - * \param ninput_items The exact size of the items on every input for this particular PDU. - * These will be consumed if a length tag key is provided! - * \param input_items See gr_block - * \param output_items See gr_block - */ - virtual int work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) = 0; - -}; - -#endif /* INCLUDED_GR_TAGGED_STREAM_BLOCK_H */ - diff --git a/gnuradio-runtime/include/gr_timer.h b/gnuradio-runtime/include/gr_timer.h deleted file mode 100644 index 45b663b368..0000000000 --- a/gnuradio-runtime/include/gr_timer.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ -#ifndef INCLUDED_GR_TIMER_H -#define INCLUDED_GR_TIMER_H - -#include <gr_runtime_api.h> -#include <gr_types.h> - -class gr_timer; - -typedef boost::shared_ptr<gr_timer> gr_timer_sptr; - -GR_RUNTIME_API typedef void (*gr_timer_hook)(gr_timer *, void *); - -/*! - * \brief create a timeout. - * - * \ingroup misc - * gr_timer_hook is called when timer fires. - */ -GR_RUNTIME_API gr_timer_sptr gr_make_timer (gr_timer_hook, void *); - -/*! - * \brief implement timeouts - */ -class GR_RUNTIME_API gr_timer { - double d_expiry; - double d_period; - gr_timer_hook d_hook; - void *d_hook_arg; - - friend GR_RUNTIME_API gr_timer_sptr gr_make_timer (gr_timer_hook, void *); - - gr_timer (...); - -public: - ~gr_timer (); - - //! return absolute current time (seconds since the epoc). - static double now (); - - /*! - * \brief schedule timer to fire at abs_when - * \param abs_when absolute time in seconds since the epoc. - */ - void schedule_at (double abs_when); - - /*! - * \brief schedule timer to fire rel_when seconds from now. - * \param rel_when relative time in seconds from now. - */ - void schedule_after (double rel_when); // relative time in seconds - - /*! - * \brief schedule a periodic timeout. - * \param abs_when absolute time to fire first time - * \param period time between firings - */ - void schedule_periodic (double abs_when, double period); - - //! cancel timer - void unschedule (); -}; - -#endif /* INCLUDED_GR_TIMER_H */ diff --git a/gnuradio-runtime/include/gr_top_block.h b/gnuradio-runtime/include/gr_top_block.h deleted file mode 100644 index f523442cd0..0000000000 --- a/gnuradio-runtime/include/gr_top_block.h +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007-2009 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. - */ - -#ifndef INCLUDED_GR_TOP_BLOCK_H -#define INCLUDED_GR_TOP_BLOCK_H - -#include <gr_runtime_api.h> -#include <gr_hier_block2.h> - -class gr_top_block_impl; - -GR_RUNTIME_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_RUNTIME_API gr_top_block : public gr_hier_block2 -{ -private: - friend GR_RUNTIME_API gr_top_block_sptr gr_make_top_block(const std::string &name); - - gr_top_block_impl *d_impl; - -protected: - gr_top_block(const std::string &name); - -public: - ~gr_top_block(); - - /*! - * \brief The simple interface to running a flowgraph. - * - * Calls start() then wait(). Used to run a flowgraph that will stop - * on its own, or when another thread will call stop(). - * - * \param max_noutput_items the maximum number of output items - * allowed for any block in the flowgraph. This passes through to - * the start function; see that function for more details. - */ - void run(int max_noutput_items=100000000); - - /*! - * Start the contained flowgraph. Creates one or more threads to - * execute the flow graph. Returns to the caller once the threads - * are created. Calling start() on a top_block that is already - * started IS an error. - * - * \param max_noutput_items the maximum number of output items - * allowed for any block in the flowgraph; the noutput_items can - * always be less than this, but this will cap it as a maximum. Use - * this to adjust the maximum latency a flowgraph can exhibit. - */ - void start(int max_noutput_items=100000000); - - /*! - * Stop the running flowgraph. Notifies each thread created by the - * scheduler to shutdown, then returns to caller. Calling stop() on - * a top_block that is already stopped IS NOT an error. - */ - void stop(); - - /*! - * Wait for a flowgraph to complete. Flowgraphs complete when - * either (1) all blocks indicate that they are done (typically only - * when using blocks.file_source, or blocks.head, or (2) after stop() has been - * called to request shutdown. Calling wait on a top_block that is - * not running IS NOT an error (wait returns w/o blocking). - */ - void wait(); - - /*! - * Lock a flowgraph in preparation for reconfiguration. When an equal - * number of calls to lock() and unlock() have occurred, the flowgraph - * will be reconfigured. - * - * N.B. lock() and unlock() may not be called from a flowgraph thread - * (E.g., gr_block::work method) or deadlock will occur when - * reconfiguration happens. - */ - virtual void lock(); - - /*! - * Unlock a flowgraph in preparation for reconfiguration. When an equal - * number of calls to lock() and unlock() have occurred, the flowgraph - * will be reconfigured. - * - * N.B. lock() and unlock() may not be called from a flowgraph thread - * (E.g., gr_block::work method) or deadlock will occur when - * reconfiguration happens. - */ - virtual void unlock(); - - /*! - * Returns a string that lists the edge connections in the flattened - * flowgraph. - */ - std::string edge_list(); - - /*! - * Displays flattened flowgraph edges and block connectivity - */ - void dump(); - - //! Get the number of max noutput_items in the flowgraph - int max_noutput_items(); - - //! Set the maximum number of noutput_items in the flowgraph - void set_max_noutput_items(int nmax); - - gr_top_block_sptr to_top_block(); // Needed for Python type coercion - - void setup_rpc(); -}; - -inline gr_top_block_sptr cast_to_top_block_sptr(gr_basic_block_sptr block) { - return boost::dynamic_pointer_cast<gr_top_block, gr_basic_block>(block); -} - - -#endif /* INCLUDED_GR_TOP_BLOCK_H */ diff --git a/gnuradio-runtime/include/gr_tpb_detail.h b/gnuradio-runtime/include/gr_tpb_detail.h deleted file mode 100644 index f6f20917c9..0000000000 --- a/gnuradio-runtime/include/gr_tpb_detail.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_GR_TPB_DETAIL_H -#define INCLUDED_GR_TPB_DETAIL_H - -#include <gr_runtime_api.h> -#include <thread/thread.h> -#include <deque> -#include <pmt/pmt.h> - -class gr_block_detail; - -/*! - * \brief used by thread-per-block scheduler - */ -struct GR_RUNTIME_API gr_tpb_detail { - - gr::thread::mutex mutex; //< protects all vars - bool input_changed; - gr::thread::condition_variable input_cond; - bool output_changed; - gr::thread::condition_variable output_cond; - -public: - gr_tpb_detail() - : input_changed(false), output_changed(false) { } - - //! Called by us to tell all our upstream blocks that their output may have changed. - void notify_upstream(gr_block_detail *d); - - //! Called by us to tell all our downstream blocks that their input may have changed. - void notify_downstream(gr_block_detail *d); - - //! Called by us to notify both upstream and downstream - void notify_neighbors(gr_block_detail *d); - - //! Called by pmt msg posters - void notify_msg(){ - input_cond.notify_one(); - output_cond.notify_one(); - } - - //! Called by us - void clear_changed() - { - gr::thread::scoped_lock guard(mutex); - input_changed = false; - output_changed = false; - } - -private: - - //! Used by notify_downstream - void set_input_changed() - { - gr::thread::scoped_lock guard(mutex); - input_changed = true; - input_cond.notify_one(); - } - - //! Used by notify_upstream - void set_output_changed() - { - gr::thread::scoped_lock guard(mutex); - output_changed = true; - output_cond.notify_one(); - } - -}; - -#endif /* INCLUDED_GR_TPB_DETAIL_H */ diff --git a/gnuradio-runtime/include/pmt/api.h b/gnuradio-runtime/include/pmt/api.h index 96f1f8c26b..69674dbd77 100644 --- a/gnuradio-runtime/include/pmt/api.h +++ b/gnuradio-runtime/include/pmt/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_PMT_API_H #define INCLUDED_PMT_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_pmt_EXPORTS # define PMT_API __GR_ATTR_EXPORT diff --git a/gnuradio-runtime/include/pmt/pmt_sugar.h b/gnuradio-runtime/include/pmt/pmt_sugar.h index 09c9a5e3e4..870b81902e 100644 --- a/gnuradio-runtime/include/pmt/pmt_sugar.h +++ b/gnuradio-runtime/include/pmt/pmt_sugar.h @@ -27,7 +27,7 @@ * shorthand for making pmt objects */ -#include <messages/msg_accepter.h> +#include <gnuradio/messages/msg_accepter.h> namespace pmt { diff --git a/gnuradio-runtime/include/realtime.h b/gnuradio-runtime/include/realtime.h deleted file mode 100644 index 9a51a6ba1d..0000000000 --- a/gnuradio-runtime/include/realtime.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2008,2013 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. - */ - -#ifndef INCLUDED_GNURADIO_REALTIME_H -#define INCLUDED_GNURADIO_REALTIME_H - -#include <gr_runtime_api.h> -#include <stdexcept> - -/*! - * \brief System independent way to ask for realtime scheduling - * - * \sa sys_pri.h - */ - -namespace gr { - - typedef enum { - RT_OK = 0, - RT_NOT_IMPLEMENTED, - RT_NO_PRIVS, - RT_OTHER_ERROR - } rt_status_t; - - - enum rt_sched_policy { - RT_SCHED_RR = 0, // round robin - RT_SCHED_FIFO = 1, // first in first out - }; - - /* - * Define the range for our virtual priorities (don't change these) - * - * Processes (or threads) with numerically higher priority values - * are scheduled before processes with numerically lower priority - * values. Thus, the value returned by rt_priority_max() will be - * greater than the value returned by rt_priority_min(). - */ - static inline int rt_priority_min() { return 0; } - static inline int rt_priority_max() { return 15; } - static inline int rt_priority_default() { return 1; } - - struct GR_RUNTIME_API rt_sched_param { - int priority; - rt_sched_policy policy; - - rt_sched_param() - : priority(rt_priority_default()), policy(RT_SCHED_RR){} - - rt_sched_param(int priority_, rt_sched_policy policy_ = RT_SCHED_RR) - { - if (priority_ < rt_priority_min() || priority_ > rt_priority_max()) - throw std::invalid_argument("rt_sched_param: priority out of range"); - - priority = priority_; - policy = policy_; - } - }; - - /*! - * \brief If possible, enable "realtime" scheduling. - * \ingroup misc - * - * In general, this means that the code will be scheduled before any - * non-realtime (normal) processes. Note that if your code contains - * an non-blocking infinite loop and you enable realtime scheduling, - * it's possible to hang the system. - */ - - // NOTE: If you change this, you need to change the code in - // gnuradio-core/src/lib/runtime/gr_realtime.i, see note there. - rt_status_t - GR_RUNTIME_API enable_realtime_scheduling(rt_sched_param = rt_sched_param()); - -} // namespace gr - -#endif /* INCLUDED_GNURADIO_REALTIME_H */ diff --git a/gnuradio-runtime/include/runtime_block_gateway.h b/gnuradio-runtime/include/runtime_block_gateway.h deleted file mode 100644 index 390864376f..0000000000 --- a/gnuradio-runtime/include/runtime_block_gateway.h +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright 2011-2012 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. - */ - -#ifndef INCLUDED_RUNTIME_BLOCK_GATEWAY_H -#define INCLUDED_RUNTIME_BLOCK_GATEWAY_H - -#include <gr_runtime_api.h> -#include <gr_block.h> -#include <gr_feval.h> - -/*! - * The work type enum tells the gateway what kind of block to implement. - * The choices are familiar gnuradio block overloads (sync, decim, interp). - */ -enum gr_block_gw_work_type{ - GR_BLOCK_GW_WORK_GENERAL, - GR_BLOCK_GW_WORK_SYNC, - GR_BLOCK_GW_WORK_DECIM, - GR_BLOCK_GW_WORK_INTERP, -}; - -/*! - * Shared message structure between python and gateway. - * Each action type represents a scheduler-called function. - */ -struct gr_block_gw_message_type{ - enum action_type{ - ACTION_GENERAL_WORK, //dispatch work - ACTION_WORK, //dispatch work - ACTION_FORECAST, //dispatch forecast - ACTION_START, //dispatch start - ACTION_STOP, //dispatch stop - }; - - action_type action; - - int general_work_args_noutput_items; - std::vector<int> general_work_args_ninput_items; - std::vector<void *> general_work_args_input_items; //TODO this should be const void*, but swig cant int cast it right - std::vector<void *> general_work_args_output_items; - int general_work_args_return_value; - - int work_args_ninput_items; - int work_args_noutput_items; - std::vector<void *> work_args_input_items; //TODO this should be const void*, but swig cant int cast it right - std::vector<void *> work_args_output_items; - int work_args_return_value; - - int forecast_args_noutput_items; - std::vector<int> forecast_args_ninput_items_required; - - bool start_args_return_value; - - bool stop_args_return_value; -}; - -/*! - * The gateway block which performs all the magic. - * - * The gateway provides access to all the gr_block routines. - * The methods prefixed with gr_block__ are renamed - * to class methods without the prefix in python. - */ -class GR_RUNTIME_API runtime_block_gateway : virtual public gr_block{ -public: - //! Provide access to the shared message object - virtual gr_block_gw_message_type &gr_block_message(void) = 0; - - long gr_block__unique_id(void) const{ - return gr_block::unique_id(); - } - - std::string gr_block__name(void) const{ - return gr_block::name(); - } - - unsigned gr_block__history(void) const{ - return gr_block::history(); - } - - void gr_block__set_history(unsigned history){ - return gr_block::set_history(history); - } - - void gr_block__set_fixed_rate(bool fixed_rate){ - return gr_block::set_fixed_rate(fixed_rate); - } - - bool gr_block__fixed_rate(void) const{ - return gr_block::fixed_rate(); - } - - void gr_block__set_output_multiple(int multiple){ - return gr_block::set_output_multiple(multiple); - } - - int gr_block__output_multiple(void) const{ - return gr_block::output_multiple(); - } - - void gr_block__consume(int which_input, int how_many_items){ - return gr_block::consume(which_input, how_many_items); - } - - void gr_block__consume_each(int how_many_items){ - return gr_block::consume_each(how_many_items); - } - - void gr_block__produce(int which_output, int how_many_items){ - return gr_block::produce(which_output, how_many_items); - } - - void gr_block__set_relative_rate(double relative_rate){ - return gr_block::set_relative_rate(relative_rate); - } - - double gr_block__relative_rate(void) const{ - return gr_block::relative_rate(); - } - - uint64_t gr_block__nitems_read(unsigned int which_input){ - return gr_block::nitems_read(which_input); - } - - uint64_t gr_block__nitems_written(unsigned int which_output){ - return gr_block::nitems_written(which_output); - } - - gr_block::tag_propagation_policy_t gr_block__tag_propagation_policy(void){ - return gr_block::tag_propagation_policy(); - } - - void gr_block__set_tag_propagation_policy(gr_block::tag_propagation_policy_t p){ - return gr_block::set_tag_propagation_policy(p); - } - - void gr_block__add_item_tag( - unsigned int which_output, const gr_tag_t &tag - ){ - return gr_block::add_item_tag(which_output, tag); - } - - void gr_block__add_item_tag( - unsigned int which_output, - uint64_t abs_offset, - const pmt::pmt_t &key, - const pmt::pmt_t &value, - const pmt::pmt_t &srcid=pmt::PMT_F - ){ - return gr_block::add_item_tag(which_output, abs_offset, key, value, srcid); - } - - std::vector<gr_tag_t> gr_block__get_tags_in_range( - unsigned int which_input, - uint64_t abs_start, - uint64_t abs_end - ){ - std::vector<gr_tag_t> tags; - gr_block::get_tags_in_range(tags, which_input, abs_start, abs_end); - return tags; - } - - std::vector<gr_tag_t> gr_block__get_tags_in_range( - unsigned int which_input, - uint64_t abs_start, - uint64_t abs_end, - const pmt::pmt_t &key - ){ - std::vector<gr_tag_t> tags; - gr_block::get_tags_in_range(tags, which_input, abs_start, abs_end, key); - return tags; - } - - /* Message passing interface */ - void gr_block__message_port_register_in(pmt::pmt_t port_id){ - gr_basic_block::message_port_register_in(port_id); - } - - void gr_block__message_port_register_out(pmt::pmt_t port_id){ - gr_basic_block::message_port_register_out(port_id); - } - - void gr_block__message_port_pub(pmt::pmt_t port_id, pmt::pmt_t msg){ - gr_basic_block::message_port_pub(port_id, msg); - } - - void gr_block__message_port_sub(pmt::pmt_t port_id, pmt::pmt_t target){ - gr_basic_block::message_port_sub(port_id, target); - } - - void gr_block__message_port_unsub(pmt::pmt_t port_id, pmt::pmt_t target){ - gr_basic_block::message_port_unsub(port_id, target); - } - - pmt::pmt_t gr_block__message_ports_in(){ - return gr_basic_block::message_ports_in(); - } - - pmt::pmt_t gr_block__message_ports_out(){ - return gr_basic_block::message_ports_out(); - } - - void set_msg_handler_feval(pmt::pmt_t which_port, gr_feval_p *msg_handler) - { - if(msg_queue.find(which_port) == msg_queue.end()){ - throw std::runtime_error("attempt to set_msg_handler_feval() on bad input message port!"); - } - d_msg_handlers_feval[which_port] = msg_handler; - } - -protected: - typedef std::map<pmt::pmt_t, gr_feval_p *, pmt::comperator> msg_handlers_feval_t; - msg_handlers_feval_t d_msg_handlers_feval; - - void dispatch_msg(pmt::pmt_t which_port, pmt::pmt_t msg){ - // Is there a handler? - if (d_msg_handlers_feval.find(which_port) != d_msg_handlers_feval.end()){ - d_msg_handlers_feval[which_port]->calleval(msg); // Yes, invoke it. - } - else { - // Pass to generic dispatcher if not found - gr_basic_block::dispatch_msg(which_port, msg); - } - } -}; - -/*! - * Make a new gateway block. - * \param handler the swig director object with callback - * \param name the name of the block (Ex: "Shirley") - * \param in_sig the input signature for this block - * \param out_sig the output signature for this block - * \param work_type the type of block overload to implement - * \param factor the decimation or interpolation factor - * \return a new gateway block - */ -GR_RUNTIME_API boost::shared_ptr<runtime_block_gateway> -runtime_make_block_gateway( - gr_feval_ll *handler, - const std::string &name, - gr_io_signature_sptr in_sig, - gr_io_signature_sptr out_sig, - const gr_block_gw_work_type work_type, - const unsigned factor -); - -#endif /* INCLUDED_RUNTIME_BLOCK_GATEWAY_H */ diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt index 1cde8ce323..a87141cb92 100644 --- a/gnuradio-runtime/lib/CMakeLists.txt +++ b/gnuradio-runtime/lib/CMakeLists.txt @@ -27,8 +27,8 @@ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import time;print time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime())" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE ) -message(STATUS "Loading build date ${BUILD_DATE} into gr_constants...") -message(STATUS "Loading version ${VERSION} into gr_constants...") +message(STATUS "Loading build date ${BUILD_DATE} into constants...") +message(STATUS "Loading version ${VERSION} into constants...") #double escape for windows backslash path separators string(REPLACE "\\" "\\\\" prefix ${prefix}) @@ -36,11 +36,11 @@ string(REPLACE "\\" "\\\\" SYSCONFDIR ${SYSCONFDIR}) string(REPLACE "\\" "\\\\" GR_PREFSDIR ${GR_PREFSDIR}) configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.cc.in - ${CMAKE_CURRENT_BINARY_DIR}/gr_constants.cc + ${CMAKE_CURRENT_SOURCE_DIR}/constants.cc.in + ${CMAKE_CURRENT_BINARY_DIR}/constants.cc @ONLY) -list(APPEND gnuradio_runtime_sources ${CMAKE_CURRENT_BINARY_DIR}/gr_constants.cc) +list(APPEND gnuradio_runtime_sources ${CMAKE_CURRENT_BINARY_DIR}/constants.cc) ######################################################################## # Include subdirs rather to populate to the sources lists. @@ -60,71 +60,62 @@ include_directories(${GNURADIO_RUNTIME_INCLUDE_DIRS} ######################################################################## # Include subdirs rather to populate to the sources lists. ######################################################################## -GR_INCLUDE_SUBDIRECTORY(pmt) +add_subdirectory(pmt) GR_INCLUDE_SUBDIRECTORY(messages) GR_INCLUDE_SUBDIRECTORY(thread) +GR_INCLUDE_SUBDIRECTORY(math) ######################################################################## # Setup library ######################################################################## list(APPEND gnuradio_runtime_sources + basic_block.cc + block.cc + block_detail.cc + block_executor.cc + block_gateway_impl.cc + block_registry.cc + buffer.cc + circular_file.cc complex_vec_test.cc - gr_basic_block.cc - gr_block.cc - gr_block_detail.cc - gr_block_executor.cc - gr_block_registry.cc - gr_buffer.cc - gr_circular_file.cc - gr_dispatcher.cc - gr_error_handler.cc - gr_fast_atan2f.cc - gr_feval.cc - gr_flat_flowgraph.cc - gr_flowgraph.cc - gr_fxpt.cc - gr_hier_block2.cc - gr_hier_block2_detail.cc - gri_debugger_hook.cc - gr_io_signature.cc - gr_local_sighandler.cc - gr_logger.cc - gr_message.cc - gr_misc.cc - gr_msg_accepter.cc - gr_msg_handler.cc - gr_msg_queue.cc - gr_pagesize.cc - gr_preferences.cc - gr_prefs.cc - gr_random.cc - gr_realtime.cc - gr_reverse.cc - gr_scheduler.cc - gr_scheduler_sts.cc - gr_scheduler_tpb.cc - gr_select_handler.cc - gr_sincos.c - gr_single_threaded_scheduler.cc - gr_sptr_magic.cc - gr_sync_block.cc - gr_sync_decimator.cc - gr_sync_interpolator.cc - gr_sys_paths.cc - gr_tagged_stream_block.cc - gr_test.cc - gr_top_block.cc - gr_top_block_impl.cc - gr_tpb_detail.cc - gr_tpb_thread_body.cc - gr_vmcircbuf.cc - gr_vmcircbuf_createfilemapping.cc - gr_vmcircbuf_mmap_shm_open.cc - gr_vmcircbuf_mmap_tmpfile.cc - gr_vmcircbuf_sysv_shm.cc + feval.cc + flat_flowgraph.cc + flowgraph.cc + hier_block2.cc + hier_block2_detail.cc + io_signature.cc + local_sighandler.cc + logger.cc malloc16.c + message.cc + misc.cc + msg_accepter.cc + msg_handler.cc + msg_queue.cc + pagesize.cc + prefs.cc realtime.cc - runtime_block_gateway.cc + scheduler.cc + scheduler_sts.cc + scheduler_tpb.cc + single_threaded_scheduler.cc + sptr_magic.cc + sync_block.cc + sync_decimator.cc + sync_interpolator.cc + sys_paths.cc + tagged_stream_block.cc + test.cc + top_block.cc + top_block_impl.cc + tpb_detail.cc + tpb_thread_body.cc + vmcircbuf.cc + vmcircbuf_createfilemapping.cc + vmcircbuf_mmap_shm_open.cc + vmcircbuf_mmap_tmpfile.cc + vmcircbuf_prefs.cc + vmcircbuf_sysv_shm.cc ) # PowerPC workaround for posix_memalign @@ -155,50 +146,7 @@ if(LINUX) list(APPEND gnuradio_runtime_libs rt) endif() -if(ENABLE_GR_CTRLPORT) - -include_directories(${ICE_INCLUDE_DIR}) - -# Add definition so we can compile in ControlPort to the blocks. -ADD_DEFINITIONS(-DGR_CTRLPORT) - -######################################################################## -# Run ICE To compile Slice files -######################################################################## -EXECUTE_PROCESS( - COMMAND "${ICE_SLICE2CPP}" "-I${CMAKE_CURRENT_SOURCE_DIR}" - "--output-dir=${CMAKE_CURRENT_BINARY_DIR}" - "${CMAKE_CURRENT_SOURCE_DIR}/gnuradio.ice" - ) - -list(APPEND gnuradio_runtime_sources - ice_application_base.cc - rpcmanager.cc - rpcpmtconverters_ice.cc - rpcserver_aggregator.cc - rpcserver_booter_aggregator.cc - rpcserver_booter_ice.cc - rpcserver_ice.cc - rpcserver_selector.cc - rpcpmtconverters_ice.cc -) - -# Append generated file in build directory -list(APPEND gnuradio_runtime_sources - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio.cpp -) - -######################################################################## -# Add controlport stuff to gnuradio-runtime -######################################################################## - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -list(APPEND gnuradio_runtime_libs - ${ICE_LIBRARIES} -) - -endif(ENABLE_GR_CTRLPORT) +GR_INCLUDE_SUBDIRECTORY(controlport) ######################################################################## # Add DLL resource file when using MSVC @@ -258,23 +206,20 @@ include(GrTest) # Append gnuradio-runtime test sources ######################################################################## list(APPEND test_gnuradio_runtime_sources - qa_gr_buffer.cc - qa_gr_circular_file.cc - qa_gr_fxpt.cc - qa_gr_fxpt_nco.cc - qa_gr_fxpt_vco.cc - qa_gr_io_signature.cc - qa_gr_logger.cc - qa_gr_math.cc - qa_gr_vmcircbuf.cc + math/qa_fxpt.cc + math/qa_fxpt_nco.cc + math/qa_fxpt_vco.cc + math/qa_math.cc + math/qa_sincos.cc + qa_buffer.cc + qa_io_signature.cc + qa_circular_file.cc + qa_logger.cc + qa_vmcircbuf.cc qa_runtime.cc - qa_sincos.cc - pmt/qa_pmt.cc - pmt/qa_pmt_prims.cc - ${CMAKE_CURRENT_BINARY_DIR}/pmt/qa_pmt_unv.cc ) -include_directories(${CPPUNIT_INCLUDE_DIRS}) +include_directories(${CPPUNIT_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/math) link_directories(${CPPUNIT_LIBRARY_DIRS}) add_library(test-gnuradio-runtime SHARED ${test_gnuradio_runtime_sources}) diff --git a/gnuradio-runtime/lib/basic_block.cc b/gnuradio-runtime/lib/basic_block.cc new file mode 100644 index 0000000000..8060c5355c --- /dev/null +++ b/gnuradio-runtime/lib/basic_block.cc @@ -0,0 +1,233 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012-2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/basic_block.h> +#include <gnuradio/block_registry.h> +#include <stdexcept> +#include <sstream> +#include <iostream> + +namespace gr { + + static long s_next_id = 0; + static long s_ncurrently_allocated = 0; + + long + basic_block_ncurrently_allocated() + { + return s_ncurrently_allocated; + } + + basic_block::basic_block(const std::string &name, + io_signature::sptr input_signature, + io_signature::sptr output_signature) + : d_name(name), + d_input_signature(input_signature), + d_output_signature(output_signature), + d_unique_id(s_next_id++), + d_symbolic_id(global_block_registry.block_register(this)), + d_symbol_name(global_block_registry.register_symbolic_name(this)), + d_color(WHITE), + d_rpc_set(false), + message_subscribers(pmt::make_dict()) + { + s_ncurrently_allocated++; + } + + basic_block::~basic_block() + { + s_ncurrently_allocated--; + global_block_registry.block_unregister(this); + } + + basic_block_sptr + basic_block::to_basic_block() + { + return shared_from_this(); + } + + void + basic_block::set_block_alias(std::string name) + { + global_block_registry.register_symbolic_name(this, name); + } + + // ** Message passing interface ** + + // - register a new input message port + void + basic_block::message_port_register_in(pmt::pmt_t port_id) + { + if(!pmt::is_symbol(port_id)) { + throw std::runtime_error("message_port_register_in: bad port id"); + } + msg_queue[port_id] = msg_queue_t(); + msg_queue_ready[port_id] = boost::shared_ptr<boost::condition_variable>(new boost::condition_variable()); + } + + pmt::pmt_t + basic_block::message_ports_in() + { + pmt::pmt_t port_names = pmt::make_vector(msg_queue.size(), pmt::PMT_NIL); + msg_queue_map_itr itr = msg_queue.begin(); + for(size_t i = 0; i < msg_queue.size(); i++) { + pmt::vector_set(port_names, i, (*itr).first); + itr++; + } + return port_names; + } + + // - register a new output message port + void + basic_block::message_port_register_out(pmt::pmt_t port_id) + { + if(!pmt::is_symbol(port_id)) { + throw std::runtime_error("message_port_register_out: bad port id"); + } + if(pmt::dict_has_key(message_subscribers, port_id)) { + throw std::runtime_error("message_port_register_out: port already in use"); + } + message_subscribers = pmt::dict_add(message_subscribers, port_id, pmt::PMT_NIL); + } + + pmt::pmt_t + basic_block::message_ports_out() + { + size_t len = pmt::length(message_subscribers); + pmt::pmt_t port_names = pmt::make_vector(len, pmt::PMT_NIL); + pmt::pmt_t keys = pmt::dict_keys(message_subscribers); + for(size_t i = 0; i < len; i++) { + pmt::vector_set(port_names, i, pmt::nth(i, keys)); + } + return port_names; + } + + // - publish a message on a message port + void basic_block::message_port_pub(pmt::pmt_t port_id, pmt::pmt_t msg) + { + if(!pmt::dict_has_key(message_subscribers, port_id)) { + throw std::runtime_error("port does not exist"); + } + + pmt::pmt_t currlist = pmt::dict_ref(message_subscribers, port_id, pmt::PMT_NIL); + // iterate through subscribers on port + while(pmt::is_pair(currlist)) { + pmt::pmt_t target = pmt::car(currlist); + + pmt::pmt_t block = pmt::car(target); + pmt::pmt_t port = pmt::cdr(target); + + currlist = pmt::cdr(currlist); + basic_block_sptr blk = global_block_registry.block_lookup(block); + //blk->post(msg); + blk->post(port, msg); + } + } + + // - subscribe to a message port + void + basic_block::message_port_sub(pmt::pmt_t port_id, pmt::pmt_t target){ + if(!pmt::dict_has_key(message_subscribers, port_id)){ + std::stringstream ss; + ss << "Port does not exist: \"" << pmt::write_string(port_id) << "\" on block: " + << pmt::write_string(target) << std::endl; + throw std::runtime_error(ss.str()); + } + pmt::pmt_t currlist = pmt::dict_ref(message_subscribers,port_id,pmt::PMT_NIL); + + // ignore re-adds of the same target + if(!pmt::list_has(currlist, target)) + message_subscribers = pmt::dict_add(message_subscribers,port_id,pmt::list_add(currlist,target)); + } + + void + basic_block::message_port_unsub(pmt::pmt_t port_id, pmt::pmt_t target) + { + if(!pmt::dict_has_key(message_subscribers, port_id)) { + std::stringstream ss; + ss << "Port does not exist: \"" << pmt::write_string(port_id) << "\" on block: " + << pmt::write_string(target) << std::endl; + throw std::runtime_error(ss.str()); + } + + // ignore unsubs of unknown targets + pmt::pmt_t currlist = pmt::dict_ref(message_subscribers,port_id,pmt::PMT_NIL); + message_subscribers = pmt::dict_add(message_subscribers,port_id,pmt::list_rm(currlist,target)); + } + + void + basic_block::_post(pmt::pmt_t which_port, pmt::pmt_t msg) + { + insert_tail(which_port, msg); + } + + void + basic_block::insert_tail(pmt::pmt_t which_port, pmt::pmt_t msg) + { + gr::thread::scoped_lock guard(mutex); + + if((msg_queue.find(which_port) == msg_queue.end()) || (msg_queue_ready.find(which_port) == msg_queue_ready.end())) { + std::cout << "target port = " << pmt::symbol_to_string(which_port) << std::endl; + throw std::runtime_error("attempted to insert_tail on invalid queue!"); + } + + msg_queue[which_port].push_back(msg); + msg_queue_ready[which_port]->notify_one(); + + // wake up thread if BLKD_IN or BLKD_OUT + global_block_registry.notify_blk(alias()); + } + + pmt::pmt_t + basic_block::delete_head_nowait(pmt::pmt_t which_port) + { + gr::thread::scoped_lock guard(mutex); + + if(empty_p(which_port)) { + return pmt::pmt_t(); + } + + pmt::pmt_t m(msg_queue[which_port].front()); + msg_queue[which_port].pop_front(); + + return m; + } + + pmt::pmt_t + basic_block::delete_head_blocking(pmt::pmt_t which_port) + { + gr::thread::scoped_lock guard(mutex); + + while(empty_p(which_port)) { + msg_queue_ready[which_port]->wait(guard); + } + + pmt::pmt_t m(msg_queue[which_port].front()); + msg_queue[which_port].pop_front(); + return m; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/block.cc b/gnuradio-runtime/lib/block.cc new file mode 100644 index 0000000000..4246180d80 --- /dev/null +++ b/gnuradio-runtime/lib/block.cc @@ -0,0 +1,689 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/block.h> +#include <gnuradio/block_registry.h> +#include <gnuradio/block_detail.h> +#include <gnuradio/prefs.h> +#include <stdexcept> +#include <iostream> + +namespace gr { + + block::block(const std::string &name, + io_signature::sptr input_signature, + io_signature::sptr output_signature) + : basic_block(name, input_signature, output_signature), + d_output_multiple (1), + d_output_multiple_set(false), + d_unaligned(0), + d_is_unaligned(false), + d_relative_rate (1.0), + d_history(1), + d_fixed_rate(false), + d_max_noutput_items_set(false), + d_max_noutput_items(0), + d_min_noutput_items(0), + d_tag_propagation_policy(TPP_ALL_TO_ALL), + d_pc_rpc_set(false), + d_max_output_buffer(std::max(output_signature->max_streams(),1), -1), + d_min_output_buffer(std::max(output_signature->max_streams(),1), -1) + { + global_block_registry.register_primitive(alias(), this); + +#ifdef ENABLE_GR_LOG +#ifdef HAVE_LOG4CPP + prefs *p = prefs::singleton(); + std::string config_file = p->get_string("LOG", "log_config", ""); + std::string log_level = p->get_string("LOG", "log_level", "off"); + std::string log_file = p->get_string("LOG", "log_file", ""); + std::string debug_level = p->get_string("LOG", "debug_level", "off"); + std::string debug_file = p->get_string("LOG", "debug_file", ""); + + GR_CONFIG_LOGGER(config_file); + + GR_LOG_GETLOGGER(LOG, "gr_log." + alias()); + GR_LOG_SET_LEVEL(LOG, log_level); + if(log_file.size() > 0) { + if(log_file == "stdout") { + GR_LOG_ADD_CONSOLE_APPENDER(LOG, "cout","gr::log :%p: %c{1} - %m%n"); + } + else if(log_file == "stderr") { + GR_LOG_ADD_CONSOLE_APPENDER(LOG, "cerr","gr::log :%p: %c{1} - %m%n"); + } + else { + GR_LOG_ADD_FILE_APPENDER(LOG, log_file , true,"%r :%p: %c{1} - %m%n"); + } + } + d_logger = LOG; + + GR_LOG_GETLOGGER(DLOG, "gr_log_debug." + alias()); + GR_LOG_SET_LEVEL(DLOG, debug_level); + if(debug_file.size() > 0) { + if(debug_file == "stdout") { + GR_LOG_ADD_CONSOLE_APPENDER(DLOG, "cout","gr::debug :%p: %c{1} - %m%n"); + } + else if(debug_file == "stderr") { + GR_LOG_ADD_CONSOLE_APPENDER(DLOG, "cerr", "gr::debug :%p: %c{1} - %m%n"); + } + else { + GR_LOG_ADD_FILE_APPENDER(DLOG, debug_file, true, "%r :%p: %c{1} - %m%n"); + } + } + d_debug_logger = DLOG; +#endif /* HAVE_LOG4CPP */ +#else /* ENABLE_GR_LOG */ + d_logger = NULL; + d_debug_logger = NULL; +#endif /* ENABLE_GR_LOG */ + } + + block::~block() + { + global_block_registry.unregister_primitive(alias()); + } + + // stub implementation: 1:1 + + void + block::forecast(int noutput_items, gr_vector_int &ninput_items_required) + { + unsigned ninputs = ninput_items_required.size (); + for(unsigned i = 0; i < ninputs; i++) + ninput_items_required[i] = noutput_items + history() - 1; + } + + // default implementation + + bool + block::start() + { + return true; + } + + bool + block::stop() + { + return true; + } + + void + block::set_output_multiple(int multiple) + { + if(multiple < 1) + throw std::invalid_argument("block::set_output_multiple"); + + d_output_multiple_set = true; + d_output_multiple = multiple; + } + + void + block::set_alignment(int multiple) + { + if(multiple < 1) + throw std::invalid_argument("block::set_alignment_multiple"); + + d_output_multiple = multiple; + } + + void + block::set_unaligned(int na) + { + // unaligned value must be less than 0 and it doesn't make sense + // that it's larger than the alignment value. + if((na < 0) || (na > d_output_multiple)) + throw std::invalid_argument("block::set_unaligned"); + + d_unaligned = na; + } + + void + block::set_is_unaligned(bool u) + { + d_is_unaligned = u; + } + + void + block::set_relative_rate(double relative_rate) + { + if(relative_rate < 0.0) + throw std::invalid_argument("block::set_relative_rate"); + + d_relative_rate = relative_rate; + } + + void + block::consume(int which_input, int how_many_items) + { + d_detail->consume(which_input, how_many_items); + } + + void + block::consume_each(int how_many_items) + { + d_detail->consume_each(how_many_items); + } + + void + block::produce(int which_output, int how_many_items) + { + d_detail->produce(which_output, how_many_items); + } + + int + block::fixed_rate_ninput_to_noutput(int ninput) + { + throw std::runtime_error("Unimplemented"); + } + + int + block::fixed_rate_noutput_to_ninput(int noutput) + { + throw std::runtime_error("Unimplemented"); + } + + uint64_t + block::nitems_read(unsigned int which_input) + { + if(d_detail) { + return d_detail->nitems_read(which_input); + } + else { + //throw std::runtime_error("No block_detail associated with block yet"); + return 0; + } + } + + uint64_t + block::nitems_written(unsigned int which_output) + { + if(d_detail) { + return d_detail->nitems_written(which_output); + } + else { + //throw std::runtime_error("No block_detail associated with block yet"); + return 0; + } + } + + void + block::add_item_tag(unsigned int which_output, + const tag_t &tag) + { + d_detail->add_item_tag(which_output, tag); + } + + void + block::remove_item_tag(unsigned int which_input, + const tag_t &tag) + { + d_detail->remove_item_tag(which_input, tag, unique_id()); + } + + void + block::get_tags_in_range(std::vector<tag_t> &v, + unsigned int which_output, + uint64_t start, uint64_t end) + { + d_detail->get_tags_in_range(v, which_output, start, end, unique_id()); + } + + void + block::get_tags_in_range(std::vector<tag_t> &v, + unsigned int which_output, + uint64_t start, uint64_t end, + const pmt::pmt_t &key) + { + d_detail->get_tags_in_range(v, which_output, start, end, key, unique_id()); + } + + block::tag_propagation_policy_t + block::tag_propagation_policy() + { + return d_tag_propagation_policy; + } + + void + block::set_tag_propagation_policy(tag_propagation_policy_t p) + { + d_tag_propagation_policy = p; + } + + int + block::max_noutput_items() + { + return d_max_noutput_items; + } + + void + block::set_max_noutput_items(int m) + { + if(m <= 0) + throw std::runtime_error("block::set_max_noutput_items: value for max_noutput_items must be greater than 0.\n"); + + d_max_noutput_items = m; + d_max_noutput_items_set = true; + } + + void + block::unset_max_noutput_items() + { + d_max_noutput_items_set = false; + } + + bool + block::is_set_max_noutput_items() + { + return d_max_noutput_items_set; + } + + void + block::set_processor_affinity(const std::vector<int> &mask) + { + d_affinity = mask; + if(d_detail) { + d_detail->set_processor_affinity(d_affinity); + } + } + + void + block::unset_processor_affinity() + { + d_affinity.clear(); + if(d_detail) { + d_detail->unset_processor_affinity(); + } + } + + float + block::pc_noutput_items() + { + if(d_detail) { + return d_detail->pc_noutput_items(); + } + else { + return 0; + } + } + + float + block::pc_noutput_items_avg() + { + if(d_detail) { + return d_detail->pc_noutput_items_avg(); + } + else { + return 0; + } + } + + float + block::pc_noutput_items_var() + { + if(d_detail) { + return d_detail->pc_noutput_items_var(); + } + else { + return 0; + } + } + + float + block::pc_nproduced() + { + if(d_detail) { + return d_detail->pc_nproduced(); + } + else { + return 0; + } + } + + float + block::pc_nproduced_avg() + { + if(d_detail) { + return d_detail->pc_nproduced_avg(); + } + else { + return 0; + } + } + + float + block::pc_nproduced_var() + { + if(d_detail) { + return d_detail->pc_nproduced_var(); + } + else { + return 0; + } + } + + float + block::pc_input_buffers_full(int which) + { + if(d_detail) { + return d_detail->pc_input_buffers_full(static_cast<size_t>(which)); + } + else { + return 0; + } + } + + float + block::pc_input_buffers_full_avg(int which) + { + if(d_detail) { + return d_detail->pc_input_buffers_full_avg(static_cast<size_t>(which)); + } + else { + return 0; + } + } + + float + block::pc_input_buffers_full_var(int which) + { + if(d_detail) { + return d_detail->pc_input_buffers_full_var(static_cast<size_t>(which)); + } + else { + return 0; + } + } + + std::vector<float> + block::pc_input_buffers_full() + { + if(d_detail) { + return d_detail->pc_input_buffers_full(); + } + else { + return std::vector<float>(1,0); + } + } + + std::vector<float> + block::pc_input_buffers_full_avg() + { + if(d_detail) { + return d_detail->pc_input_buffers_full_avg(); + } + else { + return std::vector<float>(1,0); + } + } + + std::vector<float> + block::pc_input_buffers_full_var() + { + if(d_detail) { + return d_detail->pc_input_buffers_full_var(); + } + else { + return std::vector<float>(1,0); + } + } + + float + block::pc_output_buffers_full(int which) + { + if(d_detail) { + return d_detail->pc_output_buffers_full(static_cast<size_t>(which)); + } + else { + return 0; + } + } + + float + block::pc_output_buffers_full_avg(int which) + { + if(d_detail) { + return d_detail->pc_output_buffers_full_avg(static_cast<size_t>(which)); + } + else { + return 0; + } + } + + float + block::pc_output_buffers_full_var(int which) + { + if(d_detail) { + return d_detail->pc_output_buffers_full_var(static_cast<size_t>(which)); + } + else { + return 0; + } + } + + std::vector<float> + block::pc_output_buffers_full() + { + if(d_detail) { + return d_detail->pc_output_buffers_full(); + } + else { + return std::vector<float>(1,0); + } + } + + std::vector<float> + block::pc_output_buffers_full_avg() + { + if(d_detail) { + return d_detail->pc_output_buffers_full_avg(); + } + else { + return std::vector<float>(1,0); + } + } + + std::vector<float> + block::pc_output_buffers_full_var() + { + if(d_detail) { + return d_detail->pc_output_buffers_full_var(); + } + else { + return std::vector<float>(1,0); + } + } + + float + block::pc_work_time() + { + if(d_detail) { + return d_detail->pc_work_time(); + } + else { + return 0; + } + } + + float + block::pc_work_time_avg() + { + if(d_detail) { + return d_detail->pc_work_time_avg(); + } + else { + return 0; + } + } + + float + block::pc_work_time_var() + { + if(d_detail) { + return d_detail->pc_work_time_var(); + } + else { + return 0; + } + } + + void + block::reset_perf_counters() + { + if(d_detail) { + d_detail->reset_perf_counters(); + } + } + + void + block::setup_pc_rpc() + { + d_pc_rpc_set = true; +#ifdef GR_CTRLPORT + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, float>( + alias(), "noutput_items", &block::pc_noutput_items, + pmt::mp(0), pmt::mp(32768), pmt::mp(0), + "", "noutput items", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, float>( + alias(), "avg noutput_items", &block::pc_noutput_items_avg, + pmt::mp(0), pmt::mp(32768), pmt::mp(0), + "", "Average noutput items", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, float>( + alias(), "var noutput_items", &block::pc_noutput_items_var, + pmt::mp(0), pmt::mp(32768), pmt::mp(0), + "", "Var. noutput items", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, float>( + alias(), "nproduced", &block::pc_nproduced, + pmt::mp(0), pmt::mp(32768), pmt::mp(0), + "", "items produced", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, float>( + alias(), "avg nproduced", &block::pc_nproduced_avg, + pmt::mp(0), pmt::mp(32768), pmt::mp(0), + "", "Average items produced", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, float>( + alias(), "var nproduced", &block::pc_nproduced_var, + pmt::mp(0), pmt::mp(32768), pmt::mp(0), + "", "Var. items produced", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, float>( + alias(), "work time", &block::pc_work_time, + pmt::mp(0), pmt::mp(1e9), pmt::mp(0), + "", "clock cycles in call to work", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, float>( + alias(), "avg work time", &block::pc_work_time_avg, + pmt::mp(0), pmt::mp(1e9), pmt::mp(0), + "", "Average clock cycles in call to work", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, float>( + alias(), "var work time", &block::pc_work_time_var, + pmt::mp(0), pmt::mp(1e9), pmt::mp(0), + "", "Var. clock cycles in call to work", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, std::vector<float> >( + alias(), "input \% full", &block::pc_input_buffers_full, + pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), + "", "how full input buffers are", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, std::vector<float> >( + alias(), "avg input \% full", &block::pc_input_buffers_full_avg, + pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), + "", "Average of how full input buffers are", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, std::vector<float> >( + alias(), "var input \% full", &block::pc_input_buffers_full_var, + pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), + "", "Var. of how full input buffers are", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, std::vector<float> >( + alias(), "output \% full", &block::pc_output_buffers_full, + pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), + "", "how full output buffers are", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, std::vector<float> >( + alias(), "avg output \% full", &block::pc_output_buffers_full_avg, + pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), + "", "Average of how full output buffers are", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<block, std::vector<float> >( + alias(), "var output \% full", &block::pc_output_buffers_full_var, + pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), + "", "Var. of how full output buffers are", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); +#endif /* GR_CTRLPORT */ + } + + std::ostream& + operator << (std::ostream& os, const block *m) + { + os << "<block " << m->name() << " (" << m->unique_id() << ")>"; + return os; + } + + int + block::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + throw std::runtime_error("block::general_work() not implemented"); + return 0; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/block_detail.cc b/gnuradio-runtime/lib/block_detail.cc new file mode 100644 index 0000000000..293412f513 --- /dev/null +++ b/gnuradio-runtime/lib/block_detail.cc @@ -0,0 +1,478 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/block_detail.h> +#include <gnuradio/buffer.h> +#include <iostream> + +namespace gr { + + static long s_ncurrently_allocated = 0; + + long + block_detail_ncurrently_allocated() + { + return s_ncurrently_allocated; + } + + block_detail::block_detail(unsigned int ninputs, unsigned int noutputs) + : d_produce_or(0), + d_ninputs(ninputs), d_noutputs(noutputs), + d_input(ninputs), d_output(noutputs), + d_done(false), + d_ins_noutput_items(0), + d_avg_noutput_items(0), + d_var_noutput_items(0), + d_ins_nproduced(0), + d_avg_nproduced(0), + d_var_nproduced(0), + d_ins_input_buffers_full(ninputs, 0), + d_avg_input_buffers_full(ninputs, 0), + d_var_input_buffers_full(ninputs, 0), + d_ins_output_buffers_full(noutputs, 0), + d_avg_output_buffers_full(noutputs, 0), + d_var_output_buffers_full(noutputs, 0), + d_ins_work_time(0), + d_avg_work_time(0), + d_var_work_time(0), + d_pc_counter(0) + { + s_ncurrently_allocated++; + } + + block_detail::~block_detail() + { + // should take care of itself + s_ncurrently_allocated--; + } + + void + block_detail::set_input(unsigned int which, buffer_reader_sptr reader) + { + if(which >= d_ninputs) + throw std::invalid_argument("block_detail::set_input"); + + d_input[which] = reader; + } + + void + block_detail::set_output(unsigned int which, buffer_sptr buffer) + { + if(which >= d_noutputs) + throw std::invalid_argument("block_detail::set_output"); + + d_output[which] = buffer; + } + + block_detail_sptr + make_block_detail(unsigned int ninputs, unsigned int noutputs) + { + return block_detail_sptr (new block_detail(ninputs, noutputs)); + } + + void + block_detail::set_done(bool done) + { + d_done = done; + for(unsigned int i = 0; i < d_noutputs; i++) + d_output[i]->set_done(done); + + for(unsigned int i = 0; i < d_ninputs; i++) + d_input[i]->set_done(done); + } + + void + block_detail::consume(int which_input, int how_many_items) + { + if(how_many_items > 0) { + input(which_input)->update_read_pointer(how_many_items); + } + } + + void + block_detail::consume_each(int how_many_items) + { + if(how_many_items > 0) { + for(int i = 0; i < ninputs (); i++) { + d_input[i]->update_read_pointer(how_many_items); + } + } + } + + void + block_detail::produce(int which_output, int how_many_items) + { + if(how_many_items > 0) { + d_output[which_output]->update_write_pointer(how_many_items); + d_produce_or |= how_many_items; + } + } + + void + block_detail::produce_each(int how_many_items) + { + if(how_many_items > 0) { + for(int i = 0; i < noutputs (); i++) { + d_output[i]->update_write_pointer (how_many_items); + } + d_produce_or |= how_many_items; + } + } + + uint64_t + block_detail::nitems_read(unsigned int which_input) + { + if(which_input >= d_ninputs) + throw std::invalid_argument ("block_detail::n_input_items"); + return d_input[which_input]->nitems_read(); + } + + uint64_t + block_detail::nitems_written(unsigned int which_output) + { + if(which_output >= d_noutputs) + throw std::invalid_argument ("block_detail::n_output_items"); + return d_output[which_output]->nitems_written(); + } + + void + block_detail::add_item_tag(unsigned int which_output, const tag_t &tag) + { + if(!pmt::is_symbol(tag.key)) { + throw pmt::wrong_type("block_detail::add_item_tag key", tag.key); + } + else { + // Add tag to gr_buffer's deque tags + d_output[which_output]->add_item_tag(tag); + } + } + + void + block_detail::remove_item_tag(unsigned int which_input, const tag_t &tag, long id) + { + if(!pmt::is_symbol(tag.key)) { + throw pmt::wrong_type("block_detail::add_item_tag key", tag.key); + } + else { + // Add tag to gr_buffer's deque tags + d_input[which_input]->buffer()->remove_item_tag(tag, id); + } + } + + void + block_detail::get_tags_in_range(std::vector<tag_t> &v, + unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end, + long id) + { + // get from gr_buffer_reader's deque of tags + d_input[which_input]->get_tags_in_range(v, abs_start, abs_end, id); + } + + void + block_detail::get_tags_in_range(std::vector<tag_t> &v, + unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end, + const pmt::pmt_t &key, + long id) + { + std::vector<tag_t> found_items; + + v.resize(0); + + // get from gr_buffer_reader's deque of tags + d_input[which_input]->get_tags_in_range(found_items, abs_start, abs_end, id); + + // Filter further by key name + pmt::pmt_t itemkey; + std::vector<tag_t>::iterator itr; + for(itr = found_items.begin(); itr != found_items.end(); itr++) { + itemkey = (*itr).key; + if(pmt::eqv(key, itemkey)) { + v.push_back(*itr); + } + } + } + + void + block_detail::set_processor_affinity(const std::vector<int> &mask) + { + if(threaded) { + try { + gr::thread::thread_bind_to_processor(thread, mask); + } + catch (std::runtime_error e) { + std::cerr << "set_processor_affinity: invalid mask." << std::endl;; + } + } + } + + void + block_detail::unset_processor_affinity() + { + if(threaded) { + gr::thread::thread_unbind(thread); + } + } + + void + block_detail::start_perf_counters() + { + d_start_of_work = gr::high_res_timer_now(); + } + + void + block_detail::stop_perf_counters(int noutput_items, int nproduced) + { + d_end_of_work = gr::high_res_timer_now(); + gr::high_res_timer_type diff = d_end_of_work - d_start_of_work; + + if(d_pc_counter == 0) { + d_ins_work_time = diff; + d_avg_work_time = diff; + d_var_work_time = 0; + d_ins_nproduced = nproduced; + d_avg_nproduced = nproduced; + d_var_nproduced = 0; + d_ins_noutput_items = noutput_items; + d_avg_noutput_items = noutput_items; + d_var_noutput_items = 0; + for(size_t i=0; i < d_input.size(); i++) { + gr::thread::scoped_lock guard(*d_output[i]->mutex()); + float pfull = static_cast<float>(d_input[i]->items_available()) / + static_cast<float>(d_input[i]->max_possible_items_available()); + d_ins_input_buffers_full[i] = pfull; + d_avg_input_buffers_full[i] = pfull; + d_var_input_buffers_full[i] = 0; + } + for(size_t i=0; i < d_output.size(); i++) { + gr::thread::scoped_lock guard(*d_output[i]->mutex()); + float pfull = 1.0f - static_cast<float>(d_output[i]->space_available()) / + static_cast<float>(d_output[i]->bufsize()); + d_ins_output_buffers_full[i] = pfull; + d_avg_output_buffers_full[i] = pfull; + d_var_output_buffers_full[i] = 0; + } + } + else { + float d = diff - d_avg_work_time; + d_ins_work_time = diff; + d_avg_work_time = d_avg_work_time + d/d_pc_counter; + d_var_work_time = d_var_work_time + d*d; + + d = nproduced - d_avg_nproduced; + d_ins_nproduced = nproduced; + d_avg_nproduced = d_avg_nproduced + d/d_pc_counter; + d_var_nproduced = d_var_nproduced + d*d; + + d = noutput_items - d_avg_noutput_items; + d_ins_noutput_items = noutput_items; + d_avg_noutput_items = d_avg_noutput_items + d/d_pc_counter; + d_var_noutput_items = d_var_noutput_items + d*d; + + for(size_t i=0; i < d_input.size(); i++) { + float pfull = static_cast<float>(d_input[i]->items_available()) / + static_cast<float>(d_input[i]->max_possible_items_available()); + + d = pfull - d_avg_input_buffers_full[i]; + d_ins_input_buffers_full[i] = pfull; + d_avg_input_buffers_full[i] = d_avg_input_buffers_full[i] + d/d_pc_counter; + d_var_input_buffers_full[i] = d_var_input_buffers_full[i] + d*d; + } + + for(size_t i=0; i < d_output.size(); i++) { + float pfull = 1.0f - static_cast<float>(d_output[i]->space_available()) / + static_cast<float>(d_output[i]->bufsize()); + + d = pfull - d_avg_output_buffers_full[i]; + d_ins_output_buffers_full[i] = pfull; + d_avg_output_buffers_full[i] = d_avg_output_buffers_full[i] + d/d_pc_counter; + d_var_output_buffers_full[i] = d_var_output_buffers_full[i] + d*d; + } + } + + d_pc_counter++; + } + + void + block_detail::reset_perf_counters() + { + d_pc_counter = 0; + } + + float + block_detail::pc_noutput_items() + { + return d_ins_noutput_items; + } + + float + block_detail::pc_nproduced() + { + return d_ins_nproduced; + } + + float + block_detail::pc_input_buffers_full(size_t which) + { + if(which < d_ins_input_buffers_full.size()) + return d_ins_input_buffers_full[which]; + else + return 0; + } + + std::vector<float> + block_detail::pc_input_buffers_full() + { + return d_ins_input_buffers_full; + } + + float + block_detail::pc_output_buffers_full(size_t which) + { + if(which < d_ins_output_buffers_full.size()) + return d_ins_output_buffers_full[which]; + else + return 0; + } + + std::vector<float> + block_detail::pc_output_buffers_full() + { + return d_ins_output_buffers_full; + } + + float + block_detail::pc_work_time() + { + return d_ins_work_time; + } + + float + block_detail::pc_noutput_items_avg() + { + return d_avg_noutput_items; + } + + float + block_detail::pc_nproduced_avg() + { + return d_avg_nproduced; + } + + float + block_detail::pc_input_buffers_full_avg(size_t which) + { + if(which < d_avg_input_buffers_full.size()) + return d_avg_input_buffers_full[which]; + else + return 0; + } + + std::vector<float> + block_detail::pc_input_buffers_full_avg() + { + return d_avg_input_buffers_full; + } + + float + block_detail::pc_output_buffers_full_avg(size_t which) + { + if(which < d_avg_output_buffers_full.size()) + return d_avg_output_buffers_full[which]; + else + return 0; + } + + std::vector<float> + block_detail::pc_output_buffers_full_avg() + { + return d_avg_output_buffers_full; + } + + float + block_detail::pc_work_time_avg() + { + return d_avg_work_time; + } + + float + block_detail::pc_noutput_items_var() + { + return d_var_noutput_items/(d_pc_counter-1); + } + + float + block_detail::pc_nproduced_var() + { + return d_var_nproduced/(d_pc_counter-1); + } + + float + block_detail::pc_input_buffers_full_var(size_t which) + { + if(which < d_avg_input_buffers_full.size()) + return d_var_input_buffers_full[which]/(d_pc_counter-1); + else + return 0; + } + + std::vector<float> + block_detail::pc_input_buffers_full_var() + { + std::vector<float> var(d_avg_input_buffers_full.size(), 0); + for(size_t i = 0; i < d_avg_input_buffers_full.size(); i++) + var[i] = d_avg_input_buffers_full[i]/(d_pc_counter-1); + return var; + } + + float + block_detail::pc_output_buffers_full_var(size_t which) + { + if(which < d_avg_output_buffers_full.size()) + return d_var_output_buffers_full[which]/(d_pc_counter-1); + else + return 0; + } + + std::vector<float> + block_detail::pc_output_buffers_full_var() + { + std::vector<float> var(d_avg_output_buffers_full.size(), 0); + for(size_t i = 0; i < d_avg_output_buffers_full.size(); i++) + var[i] = d_avg_output_buffers_full[i]/(d_pc_counter-1); + return var; + } + + float + block_detail::pc_work_time_var() + { + return d_var_work_time/(d_pc_counter-1); + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/block_executor.cc b/gnuradio-runtime/lib/block_executor.cc new file mode 100644 index 0000000000..b0eb2eccee --- /dev/null +++ b/gnuradio-runtime/lib/block_executor.cc @@ -0,0 +1,489 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2008-2010,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <block_executor.h> +#include <gnuradio/block.h> +#include <gnuradio/block_detail.h> +#include <gnuradio/buffer.h> +#include <gnuradio/prefs.h> +#include <boost/thread.hpp> +#include <boost/format.hpp> +#include <iostream> +#include <limits> +#include <assert.h> +#include <stdio.h> + +namespace gr { + +// must be defined to either 0 or 1 +#define ENABLE_LOGGING 0 + +#if (ENABLE_LOGGING) +#define LOG(x) do { x; } while(0) +#else +#define LOG(x) do {;} while(0) +#endif + + static int which_scheduler = 0; + + inline static unsigned int + round_up(unsigned int n, unsigned int multiple) + { + return ((n + multiple - 1) / multiple) * multiple; + } + + inline static unsigned int + round_down(unsigned int n, unsigned int multiple) + { + return (n / multiple) * multiple; + } + + // + // Return minimum available write space in all our downstream + // buffers or -1 if we're output blocked and the output we're + // blocked on is done. + // + static int + min_available_space(block_detail *d, int output_multiple, int min_noutput_items) + { + int min_space = std::numeric_limits<int>::max(); + if(min_noutput_items == 0) + min_noutput_items = 1; + for(int i = 0; i < d->noutputs (); i++) { + gr::thread::scoped_lock guard(*d->output(i)->mutex()); + int avail_n = round_down(d->output(i)->space_available(), output_multiple); + int best_n = round_down(d->output(i)->bufsize()/2, output_multiple); + if(best_n < min_noutput_items) + throw std::runtime_error("Buffer too small for min_noutput_items"); + int n = std::min(avail_n, best_n); + if(n < min_noutput_items){ // We're blocked on output. + if(d->output(i)->done()){ // Downstream is done, therefore we're done. + return -1; + } + return 0; + } + min_space = std::min(min_space, n); + } + return min_space; + } + + static bool + propagate_tags(block::tag_propagation_policy_t policy, block_detail *d, + const std::vector<uint64_t> &start_nitems_read, double rrate, + std::vector<tag_t> &rtags, long block_id) + { + // Move tags downstream + // if a sink, we don't need to move downstream + if(d->sink_p()) { + return true; + } + + switch(policy) { + case block::TPP_DONT: + return true; + break; + case block::TPP_ALL_TO_ALL: + // every tag on every input propogates to everyone downstream + for(int i = 0; i < d->ninputs(); i++) { + d->get_tags_in_range(rtags, i, start_nitems_read[i], + d->nitems_read(i), block_id); + + std::vector<tag_t>::iterator t; + if(rrate == 1.0) { + for(t = rtags.begin(); t != rtags.end(); t++) { + for(int o = 0; o < d->noutputs(); o++) + d->output(o)->add_item_tag(*t); + } + } + else { + for(t = rtags.begin(); t != rtags.end(); t++) { + tag_t new_tag = *t; + new_tag.offset *= rrate; + for(int o = 0; o < d->noutputs(); o++) + d->output(o)->add_item_tag(new_tag); + } + } + } + break; + case block::TPP_ONE_TO_ONE: + // tags from input i only go to output i + // this requires d->ninputs() == d->noutputs; this is checked when this + // type of tag-propagation system is selected in block_detail + if(d->ninputs() == d->noutputs()) { + for(int i = 0; i < d->ninputs(); i++) { + d->get_tags_in_range(rtags, i, start_nitems_read[i], + d->nitems_read(i), block_id); + + std::vector<tag_t>::iterator t; + for(t = rtags.begin(); t != rtags.end(); t++) { + tag_t new_tag = *t; + new_tag.offset *= rrate; + d->output(i)->add_item_tag(new_tag); + } + } + } + else { + std::cerr << "Error: block_executor: propagation_policy 'ONE-TO-ONE' requires ninputs == noutputs" << std::endl; + return false; + } + + break; + default: + return true; + } + return true; + } + + block_executor::block_executor(block_sptr block, int max_noutput_items) + : d_block(block), d_log(0), d_max_noutput_items(max_noutput_items) + { + if(ENABLE_LOGGING) { + 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 << "block_executor: " + << d_block << std::endl; + } + +#ifdef GR_PERFORMANCE_COUNTERS + prefs *prefs = prefs::singleton(); + d_use_pc = prefs->get_bool("PerfCounters", "on", false); +#endif /* GR_PERFORMANCE_COUNTERS */ + + d_block->start(); // enable any drivers, etc. + } + + block_executor::~block_executor() + { + if(ENABLE_LOGGING) + delete d_log; + + d_block->stop(); // stop any drivers, etc. + } + + block_executor::state + block_executor::run_one_iteration() + { + int noutput_items; + int max_items_avail; + int max_noutput_items = d_max_noutput_items; + int new_alignment = 0; + int alignment_state = -1; + + block *m = d_block.get(); + block_detail *d = m->detail().get(); + + LOG(*d_log << std::endl << m); + + if(d->done()){ + assert(0); + return DONE; + } + + if(d->source_p ()) { + d_ninput_items_required.resize(0); + d_ninput_items.resize(0); + d_input_items.resize(0); + d_input_done.resize(0); + d_output_items.resize(d->noutputs()); + d_start_nitems_read.resize(0); + + // determine the minimum available output space + noutput_items = min_available_space(d, m->output_multiple (), m->min_noutput_items ()); + noutput_items = std::min(noutput_items, max_noutput_items); + LOG(*d_log << " source\n noutput_items = " << noutput_items << std::endl); + if(noutput_items == -1) // we're done + goto were_done; + + if(noutput_items == 0){ // we're output blocked + LOG(*d_log << " BLKD_OUT\n"); + return BLKD_OUT; + } + + goto setup_call_to_work; // jump to common code + } + + else if(d->sink_p ()) { + d_ninput_items_required.resize(d->ninputs ()); + d_ninput_items.resize(d->ninputs ()); + d_input_items.resize(d->ninputs ()); + d_input_done.resize(d->ninputs()); + d_output_items.resize (0); + d_start_nitems_read.resize(d->ninputs()); + LOG(*d_log << " sink\n"); + + max_items_avail = 0; + for(int i = 0; i < d->ninputs (); i++) { + { + /* + * Acquire the mutex and grab local copies of items_available and done. + */ + gr::thread::scoped_lock guard(*d->input(i)->mutex()); + d_ninput_items[i] = d->input(i)->items_available(); + d_input_done[i] = d->input(i)->done(); + } + + LOG(*d_log << " d_ninput_items[" << i << "] = " << d_ninput_items[i] << std::endl); + LOG(*d_log << " d_input_done[" << i << "] = " << d_input_done[i] << std::endl); + + if (d_ninput_items[i] < m->output_multiple() && d_input_done[i]) + goto were_done; + + max_items_avail = std::max (max_items_avail, d_ninput_items[i]); + } + + // take a swag at how much output we can sink + noutput_items = (int)(max_items_avail * m->relative_rate ()); + noutput_items = round_down(noutput_items, m->output_multiple ()); + noutput_items = std::min(noutput_items, max_noutput_items); + LOG(*d_log << " max_items_avail = " << max_items_avail << std::endl); + LOG(*d_log << " noutput_items = " << noutput_items << std::endl); + + if(noutput_items == 0) { // we're blocked on input + LOG(*d_log << " BLKD_IN\n"); + return BLKD_IN; + } + + goto try_again; // Jump to code shared with regular case. + } + + else { + // do the regular thing + d_ninput_items_required.resize (d->ninputs ()); + d_ninput_items.resize (d->ninputs ()); + d_input_items.resize (d->ninputs ()); + d_input_done.resize(d->ninputs()); + d_output_items.resize (d->noutputs ()); + d_start_nitems_read.resize(d->ninputs()); + + max_items_avail = 0; + for(int i = 0; i < d->ninputs (); i++) { + { + /* + * Acquire the mutex and grab local copies of items_available and done. + */ + gr::thread::scoped_lock guard(*d->input(i)->mutex()); + d_ninput_items[i] = d->input(i)->items_available (); + d_input_done[i] = d->input(i)->done(); + } + max_items_avail = std::max(max_items_avail, d_ninput_items[i]); + } + + // determine the minimum available output space + noutput_items = min_available_space(d, m->output_multiple(), m->min_noutput_items()); + if(ENABLE_LOGGING) { + *d_log << " regular "; + if(m->relative_rate() >= 1.0) + *d_log << "1:" << m->relative_rate() << std::endl; + else + *d_log << 1.0/m->relative_rate() << ":1\n"; + *d_log << " max_items_avail = " << max_items_avail << std::endl; + *d_log << " noutput_items = " << noutput_items << std::endl; + } + if(noutput_items == -1) // we're done + goto were_done; + + if(noutput_items == 0) { // we're output blocked + LOG(*d_log << " BLKD_OUT\n"); + return BLKD_OUT; + } + + try_again: + if(m->fixed_rate()) { + // try to work it forward starting with max_items_avail. + // We want to try to consume all the input we've got. + int reqd_noutput_items = m->fixed_rate_ninput_to_noutput(max_items_avail); + + // only test this if we specifically set the output_multiple + if(m->output_multiple_set()) + reqd_noutput_items = round_down(reqd_noutput_items, m->output_multiple()); + + if(reqd_noutput_items > 0 && reqd_noutput_items <= noutput_items) + noutput_items = reqd_noutput_items; + + // if we need this many outputs, overrule the max_noutput_items setting + max_noutput_items = std::max(m->output_multiple(), max_noutput_items); + } + noutput_items = std::min(noutput_items, max_noutput_items); + + // Check if we're still unaligned; use up items until we're + // aligned again. Otherwise, make sure we set the alignment + // requirement. + if(!m->output_multiple_set()) { + if(m->is_unaligned()) { + // When unaligned, don't just set noutput_items to the remaining + // samples to meet alignment; this causes too much overhead in + // requiring a premature call back here. Set the maximum amount + // of samples to handle unalignment and get us back aligned. + if(noutput_items >= m->unaligned()) { + noutput_items = round_up(noutput_items, m->alignment()) \ + - (m->alignment() - m->unaligned()); + new_alignment = 0; + } + else { + new_alignment = m->unaligned() - noutput_items; + } + alignment_state = 0; + } + else if(noutput_items < m->alignment()) { + // if we don't have enough for an aligned call, keep track of + // misalignment, set unaligned flag, and proceed. + new_alignment = m->alignment() - noutput_items; + m->set_unaligned(new_alignment); + m->set_is_unaligned(true); + alignment_state = 1; + } + else { + // enough to round down to the nearest alignment and process. + noutput_items = round_down(noutput_items, m->alignment()); + m->set_is_unaligned(false); + alignment_state = 2; + } + } + + // ask the block how much input they need to produce noutput_items + m->forecast (noutput_items, d_ninput_items_required); + + // See if we've got sufficient input available + int i; + for(i = 0; i < d->ninputs (); i++) + if(d_ninput_items_required[i] > d_ninput_items[i]) // not enough + break; + + if(i < d->ninputs()) { // not enough input on input[i] + // if we can, try reducing the size of our output request + if(noutput_items > m->output_multiple()) { + noutput_items /= 2; + noutput_items = round_up(noutput_items, m->output_multiple()); + goto try_again; + } + + // We're blocked on input + LOG(*d_log << " BLKD_IN\n"); + if(d_input_done[i]) // If the upstream block is done, we're done + goto were_done; + + // Is it possible to ever fulfill this request? + if(d_ninput_items_required[i] > d->input(i)->max_possible_items_available()) { + // Nope, never going to happen... + std::cerr << "\nsched: <block " << m->name() + << " (" << m->unique_id() << ")>" + << " is requesting more input data\n" + << " than we can provide.\n" + << " ninput_items_required = " + << d_ninput_items_required[i] << "\n" + << " max_possible_items_available = " + << d->input(i)->max_possible_items_available() << "\n" + << " If this is a filter, consider reducing the number of taps.\n"; + goto were_done; + } + + // If we were made unaligned in this round but return here without + // processing; reset the unalignment claim before next entry. + if(alignment_state == 1) { + m->set_unaligned(0); + m->set_is_unaligned(false); + } + return BLKD_IN; + } + + // We've got enough data on each input to produce noutput_items. + // Finish setting up the call to work. + for(int i = 0; i < d->ninputs (); i++) + d_input_items[i] = d->input(i)->read_pointer(); + + setup_call_to_work: + + d->d_produce_or = 0; + for(int i = 0; i < d->noutputs (); i++) + d_output_items[i] = d->output(i)->write_pointer(); + + // determine where to start looking for new tags + for(int i = 0; i < d->ninputs(); i++) + d_start_nitems_read[i] = d->nitems_read(i); + +#ifdef GR_PERFORMANCE_COUNTERS + if(d_use_pc) + d->start_perf_counters(); +#endif /* GR_PERFORMANCE_COUNTERS */ + + // Do the actual work of the block + int n = m->general_work(noutput_items, d_ninput_items, + d_input_items, d_output_items); + +#ifdef GR_PERFORMANCE_COUNTERS + if(d_use_pc) + d->stop_perf_counters(noutput_items, n); +#endif /* GR_PERFORMANCE_COUNTERS */ + + LOG(*d_log << " general_work: noutput_items = " << noutput_items + << " result = " << n << std::endl); + + // Adjust number of unaligned items left to process + if(m->is_unaligned()) { + m->set_unaligned(new_alignment); + m->set_is_unaligned(m->unaligned() != 0); + } + + if(!propagate_tags(m->tag_propagation_policy(), d, + d_start_nitems_read, m->relative_rate(), + d_returned_tags, m->unique_id())) + goto were_done; + + if(n == block::WORK_DONE) + goto were_done; + + if(n != block::WORK_CALLED_PRODUCE) + d->produce_each (n); // advance write pointers + + if(d->d_produce_or > 0) // block produced something + return READY; + + // We didn't produce any output even though we called general_work. + // We have (most likely) consumed some input. + + /* + // If this is a source, it's broken. + if(d->source_p()) { + std::cerr << "block_executor: source " << m + << " produced no output. We're marking it DONE.\n"; + // FIXME maybe we ought to raise an exception... + goto were_done; + } + */ + + // Have the caller try again... + return READY_NO_OUTPUT; + } + assert(0); + + were_done: + LOG(*d_log << " were_done\n"); + d->set_done (true); + return DONE; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/block_executor.h b/gnuradio-runtime/lib/block_executor.h new file mode 100644 index 0000000000..4e1d2f1602 --- /dev/null +++ b/gnuradio-runtime/lib/block_executor.h @@ -0,0 +1,78 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2008,2013 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. + */ + +#ifndef INCLUDED_GR_RUNTIME_BLOCK_EXECUTOR_H +#define INCLUDED_GR_RUNTIME_BLOCK_EXECUTOR_H + +#include <gnuradio/api.h> +#include <gnuradio/runtime_types.h> +#include <gnuradio/tags.h> +#include <fstream> + +namespace gr { + + /*! + * \brief Manage the execution of a single block. + * \ingroup internal + */ + class GR_RUNTIME_API block_executor + { + protected: + block_sptr d_block; // The block we're trying to run + std::ofstream *d_log; + + // These are allocated here so we don't have to on each iteration + + gr_vector_int d_ninput_items_required; + gr_vector_int d_ninput_items; + gr_vector_const_void_star d_input_items; + std::vector<bool> d_input_done; + gr_vector_void_star d_output_items; + std::vector<uint64_t> d_start_nitems_read; //stores where tag counts are before work + std::vector<tag_t> d_returned_tags; + int d_max_noutput_items; + +#ifdef GR_PERFORMANCE_COUNTERS + bool d_use_pc; +#endif /* GR_PERFORMANCE_COUNTERS */ + + public: + block_executor(block_sptr block, int max_noutput_items=100000); + ~block_executor(); + + enum state { + READY, // We made progress; everything's cool. + READY_NO_OUTPUT, // We consumed some input, but produced no output. + BLKD_IN, // no progress; we're blocked waiting for input data. + BLKD_OUT, // no progress; we're blocked waiting for output buffer space. + DONE, // we're done; don't call me again. + }; + + /* + * \brief Run one iteration. + */ + state run_one_iteration(); + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RUNTIME_BLOCK_EXECUTOR_H */ diff --git a/gnuradio-runtime/lib/block_gateway_impl.cc b/gnuradio-runtime/lib/block_gateway_impl.cc new file mode 100644 index 0000000000..13f4326d7e --- /dev/null +++ b/gnuradio-runtime/lib/block_gateway_impl.cc @@ -0,0 +1,186 @@ +/* + * Copyright 2011-2013 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. + */ + +#include "block_gateway_impl.h" +#include <gnuradio/io_signature.h> +#include <iostream> +#include <boost/bind.hpp> + +namespace gr { + + /*********************************************************************** + * Helper routines + **********************************************************************/ + template <typename OutType, typename InType> + void + copy_pointers(OutType &out, const InType &in) + { + out.resize(in.size()); + for(size_t i = 0; i < in.size(); i++) { + out[i] = (void *)(in[i]); + } + } + + + block_gateway::sptr + block_gateway::make(feval_ll *handler, + const std::string &name, + gr::io_signature::sptr in_sig, + gr::io_signature::sptr out_sig, + const block_gw_work_type work_type, + const unsigned factor) + { + return block_gateway::sptr + (new block_gateway_impl(handler, name, in_sig, out_sig, + work_type, factor)); + } + + block_gateway_impl::block_gateway_impl(feval_ll *handler, + const std::string &name, + gr::io_signature::sptr in_sig, + gr::io_signature::sptr out_sig, + const block_gw_work_type work_type, + const unsigned factor) + : block(name, in_sig, out_sig), + _handler(handler), + _work_type(work_type) + { + switch(_work_type) { + case GR_BLOCK_GW_WORK_GENERAL: + _decim = 1; //not relevant, but set anyway + _interp = 1; //not relevant, but set anyway + break; + + case GR_BLOCK_GW_WORK_SYNC: + _decim = 1; + _interp = 1; + this->set_fixed_rate(true); + break; + + case GR_BLOCK_GW_WORK_DECIM: + _decim = factor; + _interp = 1; + break; + + case GR_BLOCK_GW_WORK_INTERP: + _decim = 1; + _interp = factor; + this->set_output_multiple(_interp); + break; + } + } + + void + block_gateway_impl::forecast(int noutput_items, + gr_vector_int &ninput_items_required) + { + switch(_work_type) { + case GR_BLOCK_GW_WORK_GENERAL: + _message.action = block_gw_message_type::ACTION_FORECAST; + _message.forecast_args_noutput_items = noutput_items; + _message.forecast_args_ninput_items_required = ninput_items_required; + _handler->calleval(0); + ninput_items_required = _message.forecast_args_ninput_items_required; + return; + + default: + unsigned ninputs = ninput_items_required.size(); + for(unsigned i = 0; i < ninputs; i++) + ninput_items_required[i] = fixed_rate_noutput_to_ninput(noutput_items); + return; + } + } + + int + block_gateway_impl::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + switch(_work_type) { + case GR_BLOCK_GW_WORK_GENERAL: + _message.action = block_gw_message_type::ACTION_GENERAL_WORK; + _message.general_work_args_noutput_items = noutput_items; + _message.general_work_args_ninput_items = ninput_items; + copy_pointers(_message.general_work_args_input_items, input_items); + _message.general_work_args_output_items = output_items; + _handler->calleval(0); + return _message.general_work_args_return_value; + + default: + int r = work (noutput_items, input_items, output_items); + if(r > 0) + consume_each(r*_decim/_interp); + return r; + } + } + + int + block_gateway_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + _message.action = block_gw_message_type::ACTION_WORK; + _message.work_args_ninput_items = fixed_rate_noutput_to_ninput(noutput_items); + if(_message.work_args_ninput_items == 0) + return -1; + _message.work_args_noutput_items = noutput_items; + copy_pointers(_message.work_args_input_items, input_items); + _message.work_args_output_items = output_items; + _handler->calleval(0); + return _message.work_args_return_value; + } + + int + block_gateway_impl::fixed_rate_noutput_to_ninput(int noutput_items) + { + return (noutput_items*_decim/_interp) + history() - 1; + } + + int + block_gateway_impl::fixed_rate_ninput_to_noutput(int ninput_items) + { + return std::max(0, ninput_items - (int)history() + 1)*_interp/_decim; + } + + bool + block_gateway_impl::start(void) + { + _message.action = block_gw_message_type::ACTION_START; + _handler->calleval(0); + return _message.start_args_return_value; + } + + bool + block_gateway_impl::stop(void) + { + _message.action = block_gw_message_type::ACTION_STOP; + _handler->calleval(0); + return _message.stop_args_return_value; + } + + block_gw_message_type& + block_gateway_impl::block_message(void) + { + return _message; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/block_gateway_impl.h b/gnuradio-runtime/lib/block_gateway_impl.h new file mode 100644 index 0000000000..1707ecf1c8 --- /dev/null +++ b/gnuradio-runtime/lib/block_gateway_impl.h @@ -0,0 +1,75 @@ +/* -*- c++ -*- */ +/* + * Copyright 2013 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. + */ + +#ifndef INCLUDED_RUNTIME_BLOCK_GATEWAY_IMPL_H +#define INCLUDED_RUNTIME_BLOCK_GATEWAY_IMPL_H + +#include <gnuradio/block_gateway.h> + +namespace gr { + + /*********************************************************************** + * The gr::block gateway implementation class + **********************************************************************/ + class block_gateway_impl : public block_gateway + { + public: + block_gateway_impl(feval_ll *handler, + const std::string &name, + gr::io_signature::sptr in_sig, + gr::io_signature::sptr out_sig, + const block_gw_work_type work_type, + const unsigned factor); + + /******************************************************************* + * Overloads for various scheduler-called functions + ******************************************************************/ + void forecast(int noutput_items, + gr_vector_int &ninput_items_required); + + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + int fixed_rate_noutput_to_ninput(int noutput_items); + int fixed_rate_ninput_to_noutput(int ninput_items); + + bool start(void); + bool stop(void); + + block_gw_message_type& block_message(void); + + private: + feval_ll *_handler; + block_gw_message_type _message; + const block_gw_work_type _work_type; + unsigned _decim, _interp; + }; + +} /* namespace gr */ + +#endif /* INCLUDED_RUNTIME_BLOCK_GATEWAY_H */ diff --git a/gnuradio-runtime/lib/block_registry.cc b/gnuradio-runtime/lib/block_registry.cc new file mode 100644 index 0000000000..f17e3e4af9 --- /dev/null +++ b/gnuradio-runtime/lib/block_registry.cc @@ -0,0 +1,120 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 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. + */ + +#include <gnuradio/basic_block.h> +#include <gnuradio/block.h> +#include <gnuradio/block_detail.h> +#include <gnuradio/block_registry.h> +#include <gnuradio/tpb_detail.h> +#include <stdio.h> + +gr::block_registry global_block_registry; + +namespace gr { + + block_registry::block_registry() + { + d_ref_map = pmt::make_dict(); + } + + long + block_registry::block_register(basic_block* block) + { + if(d_map.find(block->name()) == d_map.end()) { + d_map[block->name()] = blocksubmap_t(); + d_map[block->name()][0] = block; + return 0; + } + else { + for(size_t i=0; i<=d_map[block->name()].size(); i++){ + if(d_map[block->name()].find(i) == d_map[block->name()].end()){ + d_map[block->name()][i] = block; + return i; + } + } + } + throw std::runtime_error("should not reach this"); + } + + void + block_registry::block_unregister(basic_block* block) + { + d_map[block->name()].erase( d_map[block->name()].find(block->symbolic_id())); + d_ref_map = pmt::dict_delete(d_ref_map, pmt::intern(block->symbol_name())); + if(block->alias_set()) { + d_ref_map = pmt::dict_delete(d_ref_map, pmt::intern(block->alias())); + } + } + + std::string + block_registry::register_symbolic_name(basic_block* block) + { + std::stringstream ss; + ss << block->name() << block->symbolic_id(); + //std::cout << "register_symbolic_name: " << ss.str() << std::endl; + register_symbolic_name(block, ss.str()); + return ss.str(); + } + + void + block_registry::register_symbolic_name(basic_block* block, std::string name) + { + if(pmt::dict_has_key(d_ref_map, pmt::intern(name))) { + throw std::runtime_error("symbol already exists, can not re-use!"); + } + d_ref_map = pmt::dict_add(d_ref_map, pmt::intern(name), pmt::make_any(block)); + } + + basic_block_sptr + block_registry::block_lookup(pmt::pmt_t symbol) + { + pmt::pmt_t ref = pmt::dict_ref(d_ref_map, symbol, pmt::PMT_NIL); + if(pmt::eq(ref, pmt::PMT_NIL)) { + throw std::runtime_error("block lookup failed! block not found!"); + } + basic_block* blk = boost::any_cast<basic_block*>(pmt::any_ref(ref)); + return blk->shared_from_this(); + } + + void + block_registry::register_primitive(std::string blk, block* ref) + { + primitive_map[blk] = ref; + } + + void + block_registry::unregister_primitive(std::string blk) + { + primitive_map.erase(primitive_map.find(blk)); + } + + void + block_registry::notify_blk(std::string blk) + { + if(primitive_map.find(blk) == primitive_map.end()) { + return; + } + if(primitive_map[blk]->detail().get()) + primitive_map[blk]->detail()->d_tpb.notify_msg(); + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/buffer.cc b/gnuradio-runtime/lib/buffer.cc new file mode 100644 index 0000000000..cd6feefe34 --- /dev/null +++ b/gnuradio-runtime/lib/buffer.cc @@ -0,0 +1,348 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/buffer.h> +#include <gnuradio/math.h> +#include "vmcircbuf.h" +#include <stdexcept> +#include <iostream> +#include <assert.h> +#include <algorithm> +#include <boost/math/common_factor_rt.hpp> + +namespace gr { + + static long s_buffer_count = 0; // counts for debugging storage mgmt + static long s_buffer_reader_count = 0; + + /* ---------------------------------------------------------------------------- + Notes on storage management + + Pretty much all the fundamental classes are now using the + shared_ptr stuff for automatic reference counting. To ensure that + no mistakes are made, we make the constructors for classes private, + and then provide a free factory function that returns a smart + pointer to the desired class. + + gr::buffer and gr::buffer_reader are no exceptions. However, they + both want pointers to each other, and unless we do something, we'll + never delete any of them because of the circular structure. + They'll always have a reference count of at least one. We could + use boost::weak_ptr's from gr::buffer to gr::buffer_reader but that + introduces it's own problems. (gr::buffer_reader's destructor needs + to call gr::buffer::drop_reader, but has no easy way to get a + shared_ptr to itself.) + + Instead, we solve this problem by having gr::buffer hold a raw + pointer to gr::buffer_reader in its d_reader vector. + gr::buffer_reader's destructor calls gr::buffer::drop_reader, so + we're never left with an dangling pointer. gr::buffer_reader still + has a shared_ptr to the buffer ensuring that the buffer doesn't go + away under it. However, when the reference count of a + gr::buffer_reader goes to zero, we can successfully reclaim it. + ---------------------------------------------------------------------------- */ + + /* + * Compute the minimum number of buffer items that work (i.e., + * address space wrap-around works). To work is to satisfy this + * contraint for integer buffer_size and k: + * + * type_size * nitems == k * page_size + */ + static long + minimum_buffer_items(long type_size, long page_size) + { + return page_size / boost::math::gcd (type_size, page_size); + } + + + buffer::buffer(int nitems, size_t sizeof_item, block_sptr link) + : d_base(0), d_bufsize(0), d_vmcircbuf(0), + d_sizeof_item(sizeof_item), d_link(link), + d_write_index(0), d_abs_write_offset(0), d_done(false), + d_last_min_items_read(0) + { + if(!allocate_buffer (nitems, sizeof_item)) + throw std::bad_alloc (); + + s_buffer_count++; + } + + buffer_sptr + make_buffer(int nitems, size_t sizeof_item, block_sptr link) + { + return buffer_sptr(new buffer(nitems, sizeof_item, link)); + } + + buffer::~buffer() + { + delete d_vmcircbuf; + assert(d_readers.size() == 0); + s_buffer_count--; + } + + /*! + * sets d_vmcircbuf, d_base, d_bufsize. + * returns true iff successful. + */ + bool + buffer::allocate_buffer(int nitems, size_t sizeof_item) + { + int orig_nitems = nitems; + + // Any buffersize we come up with must be a multiple of min_nitems. + int granularity = gr::vmcircbuf_sysconfig::granularity(); + int min_nitems = minimum_buffer_items(sizeof_item, granularity); + + // Round-up nitems to a multiple of min_nitems. + if(nitems % min_nitems != 0) + nitems = ((nitems / min_nitems) + 1) * min_nitems; + + // If we rounded-up a whole bunch, give the user a heads up. + // This only happens if sizeof_item is not a power of two. + + if(nitems > 2 * orig_nitems && nitems * (int) sizeof_item > granularity){ + std::cerr << "gr::buffer::allocate_buffer: warning: tried to allocate\n" + << " " << orig_nitems << " items of size " + << sizeof_item << ". Due to alignment requirements\n" + << " " << nitems << " were allocated. If this isn't OK, consider padding\n" + << " your structure to a power-of-two bytes.\n" + << " On this platform, our allocation granularity is " << granularity << " bytes.\n"; + } + + d_bufsize = nitems; + d_vmcircbuf = gr::vmcircbuf_sysconfig::make(d_bufsize * d_sizeof_item); + if(d_vmcircbuf == 0){ + std::cerr << "gr::buffer::allocate_buffer: failed to allocate buffer of size " + << d_bufsize * d_sizeof_item / 1024 << " KB\n"; + return false; + } + + d_base = (char*)d_vmcircbuf->pointer_to_first_copy(); + return true; + } + + int + buffer::space_available() + { + if(d_readers.empty()) + return d_bufsize - 1; // See comment below + + else { + // Find out the maximum amount of data available to our readers + + int most_data = d_readers[0]->items_available(); + uint64_t min_items_read = d_readers[0]->nitems_read(); + for(size_t i = 1; i < d_readers.size (); i++) { + most_data = std::max(most_data, d_readers[i]->items_available()); + min_items_read = std::min(min_items_read, d_readers[i]->nitems_read()); + } + + if(min_items_read != d_last_min_items_read) { + prune_tags(d_last_min_items_read); + d_last_min_items_read = min_items_read; + } + + // The -1 ensures that the case d_write_index == d_read_index is + // unambiguous. It indicates that there is no data for the reader + return d_bufsize - most_data - 1; + } + } + + void * + buffer::write_pointer() + { + return &d_base[d_write_index * d_sizeof_item]; + } + + void + buffer::update_write_pointer(int nitems) + { + gr::thread::scoped_lock guard(*mutex()); + d_write_index = index_add(d_write_index, nitems); + d_abs_write_offset += nitems; + } + + void + buffer::set_done(bool done) + { + gr::thread::scoped_lock guard(*mutex()); + d_done = done; + } + + buffer_reader_sptr + buffer_add_reader(buffer_sptr buf, int nzero_preload, block_sptr link) + { + if(nzero_preload < 0) + throw std::invalid_argument("buffer_add_reader: nzero_preload must be >= 0"); + + buffer_reader_sptr r(new buffer_reader(buf, + buf->index_sub(buf->d_write_index, + nzero_preload), + link)); + buf->d_readers.push_back(r.get ()); + + return r; + } + + void + buffer::drop_reader(buffer_reader *reader) + { + std::vector<buffer_reader *>::iterator result = + std::find(d_readers.begin(), d_readers.end(), reader); + + if(result == d_readers.end()) + throw std::invalid_argument("buffer::drop_reader"); // we didn't find it... + + d_readers.erase(result); + } + + void + buffer::add_item_tag(const tag_t &tag) + { + gr::thread::scoped_lock guard(*mutex()); + d_item_tags.push_back(tag); + } + + void + buffer::remove_item_tag(const tag_t &tag, long id) + { + gr::thread::scoped_lock guard(*mutex()); + for(std::deque<tag_t>::iterator it = d_item_tags.begin(); it != d_item_tags.end(); ++it) { + if(*it == tag) { + (*it).marked_deleted.push_back(id); + } + } + } + + void + buffer::prune_tags(uint64_t max_time) + { + /* NOTE: this function _should_ lock the mutex before editing + d_item_tags. In practice, this function is only called at + runtime by min_available_space in block_executor.cc, which + locks the mutex itself. + + If this function is used elsewhere, remember to lock the + buffer's mutex al la the scoped_lock line below. + */ + //gr::thread::scoped_lock guard(*mutex()); + std::deque<tag_t>::iterator itr = d_item_tags.begin(); + + uint64_t item_time; + + // Since tags are not guarenteed to be in any particular order, we + // need to erase here instead of pop_front. An erase in the middle + // invalidates all iterators; so this resets the iterator to find + // more. Mostly, we wil be erasing from the front and + // therefore lose little time this way. + while(itr != d_item_tags.end()) { + item_time = (*itr).offset; + if(item_time < max_time) { + d_item_tags.erase(itr); + itr = d_item_tags.begin(); + } + else + itr++; + } + } + + long + buffer_ncurrently_allocated() + { + return s_buffer_count; + } + + // ---------------------------------------------------------------------------- + + buffer_reader::buffer_reader(buffer_sptr buffer, unsigned int read_index, + block_sptr link) + : d_buffer(buffer), d_read_index(read_index), d_abs_read_offset(0), d_link(link) + { + s_buffer_reader_count++; + } + + buffer_reader::~buffer_reader() + { + d_buffer->drop_reader(this); + s_buffer_reader_count--; + } + + int + buffer_reader::items_available() const + { + return d_buffer->index_sub(d_buffer->d_write_index, d_read_index); + } + + const void * + buffer_reader::read_pointer() + { + return &d_buffer->d_base[d_read_index * d_buffer->d_sizeof_item]; + } + + void + buffer_reader::update_read_pointer(int nitems) + { + gr::thread::scoped_lock guard(*mutex()); + d_read_index = d_buffer->index_add (d_read_index, nitems); + d_abs_read_offset += nitems; + } + + void + buffer_reader::get_tags_in_range(std::vector<tag_t> &v, + uint64_t abs_start, + uint64_t abs_end, + long id) + { + gr::thread::scoped_lock guard(*mutex()); + + v.resize(0); + std::deque<tag_t>::iterator itr = d_buffer->get_tags_begin(); + + uint64_t item_time; + while(itr != d_buffer->get_tags_end()) { + item_time = (*itr).offset; + + if((item_time >= abs_start) && (item_time < abs_end)) { + std::vector<long>::iterator id_itr; + id_itr = std::find(itr->marked_deleted.begin(), itr->marked_deleted.end(), id); + if (id_itr == itr->marked_deleted.end()) { // If id is not in the vector of marked blocks + v.push_back(*itr); + v.back().marked_deleted.clear(); + } + } + + itr++; + } + } + + long + buffer_reader_ncurrently_allocated() + { + return s_buffer_reader_count; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/circular_file.cc b/gnuradio-runtime/lib/circular_file.cc new file mode 100644 index 0000000000..4d7d06082a --- /dev/null +++ b/gnuradio-runtime/lib/circular_file.cc @@ -0,0 +1,208 @@ +/* -*- c++ -*- */ +/* + * Copyright 2002,2010,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "circular_file.h" + +#include <unistd.h> +#ifdef HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif + +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <fcntl.h> +#include <stdio.h> +#include <assert.h> +#include <stdlib.h> + +#include <algorithm> +#include <stdio.h> +#include <string.h> + +#ifdef HAVE_IO_H +#include <io.h> +#endif + +namespace gr { + + static const int HEADER_SIZE = 4096; + static const int HEADER_MAGIC = 0xEB021026; + + static const int HD_MAGIC = 0; + static const int HD_HEADER_SIZE = 1; // integer offsets into header + static const int HD_BUFFER_SIZE = 2; + static const int HD_BUFFER_BASE = 3; + static const int HD_BUFFER_CURRENT = 4; + + circular_file::circular_file(const char *filename, + bool writable, int size) + : d_fd(-1), d_header(0), d_buffer(0), d_mapped_size(0), d_bytes_read(0) + { + int mm_prot; + if(writable) { +#ifdef HAVE_MMAP + mm_prot = PROT_READ | PROT_WRITE; +#endif + d_fd = open(filename, O_CREAT | O_RDWR | O_TRUNC, 0664); + if(d_fd < 0) { + perror(filename); + exit(1); + } +#ifdef HAVE_MMAP /* FIXME */ + if(ftruncate(d_fd, size + HEADER_SIZE) != 0) { + perror(filename); + exit(1); + } +#endif + } + else { +#ifdef HAVE_MMAP + mm_prot = PROT_READ; +#endif + d_fd = open (filename, O_RDONLY); + if(d_fd < 0) { + perror(filename); + exit(1); + } + } + + struct stat statbuf; + if(fstat (d_fd, &statbuf) < 0) { + perror(filename); + exit(1); + } + + if(statbuf.st_size < HEADER_SIZE) { + fprintf(stderr, "%s: file too small to be circular buffer\n", filename); + exit(1); + } + + d_mapped_size = statbuf.st_size; +#ifdef HAVE_MMAP + void *p = mmap (0, d_mapped_size, mm_prot, MAP_SHARED, d_fd, 0); + if(p == MAP_FAILED) { + perror("gr::circular_file: mmap failed"); + exit(1); + } + + d_header = (int*)p; +#else + perror("gr::circular_file: mmap unsupported by this system"); + exit(1); +#endif + + if(writable) { // init header + + if(size < 0) { + fprintf(stderr, "gr::circular_buffer: size must be > 0 when writable\n"); + exit(1); + } + + d_header[HD_MAGIC] = HEADER_MAGIC; + d_header[HD_HEADER_SIZE] = HEADER_SIZE; + d_header[HD_BUFFER_SIZE] = size; + d_header[HD_BUFFER_BASE] = HEADER_SIZE; // right after header + d_header[HD_BUFFER_CURRENT] = 0; + } + + // sanity check (the asserts are a bit unforgiving...) + + assert(d_header[HD_MAGIC] == HEADER_MAGIC); + assert(d_header[HD_HEADER_SIZE] == HEADER_SIZE); + assert(d_header[HD_BUFFER_SIZE] > 0); + assert(d_header[HD_BUFFER_BASE] >= d_header[HD_HEADER_SIZE]); + assert(d_header[HD_BUFFER_BASE] + d_header[HD_BUFFER_SIZE] <= d_mapped_size); + assert(d_header[HD_BUFFER_CURRENT] >= 0 && + d_header[HD_BUFFER_CURRENT] < d_header[HD_BUFFER_SIZE]); + + d_bytes_read = 0; + d_buffer = (unsigned char*)d_header + d_header[HD_BUFFER_BASE]; + } + + circular_file::~circular_file() + { +#ifdef HAVE_MMAP + if(munmap ((char *) d_header, d_mapped_size) < 0) { + perror("gr::circular_file: munmap"); + exit(1); + } +#endif + close(d_fd); + } + + bool + circular_file::write(void *vdata, int nbytes) + { + unsigned char *data = (unsigned char*)vdata; + int buffer_size = d_header[HD_BUFFER_SIZE]; + int buffer_current = d_header[HD_BUFFER_CURRENT]; + + while(nbytes > 0) { + int n = std::min(nbytes, buffer_size - buffer_current); + memcpy(d_buffer + buffer_current, data, n); + + buffer_current += n; + if(buffer_current >= buffer_size) + buffer_current = 0; + + data += n; + nbytes -= n; + } + + d_header[HD_BUFFER_CURRENT] = buffer_current; + return true; + } + + int + circular_file::read(void *vdata, int nbytes) + { + unsigned char *data = (unsigned char *) vdata; + int buffer_current = d_header[HD_BUFFER_CURRENT]; + int buffer_size = d_header[HD_BUFFER_SIZE]; + int total = 0; + + nbytes = std::min(nbytes, buffer_size - d_bytes_read); + + while(nbytes > 0) { + int offset = (buffer_current + d_bytes_read) % buffer_size; + int n = std::min (nbytes, buffer_size - offset); + memcpy(data, d_buffer + offset, n); + data += n; + d_bytes_read += n; + total += n; + nbytes -= n; + } + return total; + } + + void + circular_file::reset_read_pointer() + { + d_bytes_read = 0; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/circular_file.h b/gnuradio-runtime/lib/circular_file.h new file mode 100644 index 0000000000..1dc431d69a --- /dev/null +++ b/gnuradio-runtime/lib/circular_file.h @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2002,2013 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. + */ + +#ifndef GR_CIRCULAR_FILE_H +#define GR_CIRCULAR_FILE_H + +#include <gnuradio/api.h> + +namespace gr { + + /* + * writes input data into a circular buffer on disk. + * + * the file contains a fixed header: + * 0x0000: int32 magic (0xEB021026) + * 0x0004: int32 size in bytes of header (constant 4096) + * 0x0008: int32 size in bytes of circular buffer (not including header) + * 0x000C: int32 file offset to beginning of circular buffer + * 0x0010: int32 byte offset from beginning of circular buffer to + * current start of data + */ + class GR_RUNTIME_API circular_file + { + private: + int d_fd; + int *d_header; + unsigned char *d_buffer; + int d_mapped_size; + int d_bytes_read; + + public: + circular_file(const char *filename, bool writable = false, int size = 0); + ~circular_file(); + + bool write(void *data, int nbytes); + + // returns # of bytes actually read or 0 if end of buffer, or -1 on error. + int read(void *data, int nbytes); + + // reset read pointer to beginning of buffer. + void reset_read_pointer(); + }; + +} /* namespace gr */ + +#endif /* GR_CIRCULAR_FILE_H */ diff --git a/gnuradio-runtime/lib/complex_vec_test.h b/gnuradio-runtime/lib/complex_vec_test.h index bcfa732f41..d69d523374 100644 --- a/gnuradio-runtime/lib/complex_vec_test.h +++ b/gnuradio-runtime/lib/complex_vec_test.h @@ -1,4 +1,26 @@ -#include <gr_runtime_api.h> +/* -*- c++ -*- */ +/* + * Copyright 2013 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. + */ + +#include <gnuradio/api.h> #include <vector> #include <complex> diff --git a/gnuradio-runtime/lib/gr_constants.cc.in b/gnuradio-runtime/lib/constants.cc.in index b94f254d66..828c4397f7 100644 --- a/gnuradio-runtime/lib/gr_constants.cc.in +++ b/gnuradio-runtime/lib/constants.cc.in @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2009 Free Software Foundation, Inc. + * Copyright 2006,2009,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,34 +24,38 @@ #include <config.h> #endif -#include <gr_constants.h> - -const std::string -gr_prefix() -{ - return "@prefix@"; -} - -const std::string -gr_sysconfdir() -{ - return "@SYSCONFDIR@"; -} - -const std::string -gr_prefsdir() -{ - return "@GR_PREFSDIR@"; -} - -const std::string -gr_build_date() -{ - return "@BUILD_DATE@"; -} - -const std::string -gr_version() -{ - return "@VERSION@"; -} +#include <gnuradio/constants.h> + +namespace gr { + + const std::string + prefix() + { + return "@prefix@"; + } + + const std::string + sysconfdir() + { + return "@SYSCONFDIR@"; + } + + const std::string + prefsdir() + { + return "@GR_PREFSDIR@"; + } + + const std::string + build_date() + { + return "@BUILD_DATE@"; + } + + const std::string + version() + { + return "@VERSION@"; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/controlport/CMakeLists.txt b/gnuradio-runtime/lib/controlport/CMakeLists.txt new file mode 100644 index 0000000000..c05a82bf4f --- /dev/null +++ b/gnuradio-runtime/lib/controlport/CMakeLists.txt @@ -0,0 +1,62 @@ +# Copyright 2013 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. + +if(ENABLE_GR_CTRLPORT) + +include_directories(${ICE_INCLUDE_DIR}) + +# Add definition so we can compile in ControlPort to the blocks. +ADD_DEFINITIONS(-DGR_CTRLPORT) + +######################################################################## +# Run ICE To compile Slice files +######################################################################## +EXECUTE_PROCESS( + COMMAND "${ICE_SLICE2CPP}" "-I${CMAKE_CURRENT_SOURCE_DIR}" + "--output-dir=${CMAKE_CURRENT_BINARY_DIR}/" + "${CMAKE_CURRENT_SOURCE_DIR}/gnuradio.ice" + ) + +list(APPEND gnuradio_runtime_sources + ${CMAKE_CURRENT_SOURCE_DIR}/ice_application_base.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcmanager.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcpmtconverters_ice.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_aggregator.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_aggregator.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_ice.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_ice.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_selector.cc +) + +# Append generated file in build directory +list(APPEND gnuradio_runtime_sources + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio.cpp +) + +######################################################################## +# Add controlport stuff to gnuradio-runtime +######################################################################## + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +list(APPEND gnuradio_runtime_libs + ${ICE_LIBRARIES} +) + +endif(ENABLE_GR_CTRLPORT) diff --git a/gnuradio-runtime/lib/ICE_LICENSE b/gnuradio-runtime/lib/controlport/ICE_LICENSE index 43ea7572d9..43ea7572d9 100644 --- a/gnuradio-runtime/lib/ICE_LICENSE +++ b/gnuradio-runtime/lib/controlport/ICE_LICENSE diff --git a/gnuradio-runtime/lib/frontend.ice b/gnuradio-runtime/lib/controlport/frontend.ice index 50d056df72..50d056df72 100644 --- a/gnuradio-runtime/lib/frontend.ice +++ b/gnuradio-runtime/lib/controlport/frontend.ice diff --git a/gnuradio-runtime/lib/gnuradio.ice b/gnuradio-runtime/lib/controlport/gnuradio.ice index 731cbea956..731cbea956 100644 --- a/gnuradio-runtime/lib/gnuradio.ice +++ b/gnuradio-runtime/lib/controlport/gnuradio.ice diff --git a/gnuradio-runtime/lib/ice_application_base.cc b/gnuradio-runtime/lib/controlport/ice_application_base.cc index 88db6056c1..b390c77c84 100644 --- a/gnuradio-runtime/lib/ice_application_base.cc +++ b/gnuradio-runtime/lib/controlport/ice_application_base.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <ice_application_base.h> +#include <gnuradio/ice_application_base.h> int ice_application_common::d_reacquire_attributes(0); bool ice_application_common::d_main_called(false); diff --git a/gnuradio-runtime/lib/rpcmanager.cc b/gnuradio-runtime/lib/controlport/rpcmanager.cc index 4d164b63f3..59ec518960 100644 --- a/gnuradio-runtime/lib/rpcmanager.cc +++ b/gnuradio-runtime/lib/controlport/rpcmanager.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <rpcmanager.h> +#include <gnuradio/rpcmanager.h> #include <iostream> #include <stdexcept> diff --git a/gnuradio-runtime/lib/rpcpmtconverters_ice.cc b/gnuradio-runtime/lib/controlport/rpcpmtconverters_ice.cc index 7c8b6041e9..18b73faeba 100644 --- a/gnuradio-runtime/lib/rpcpmtconverters_ice.cc +++ b/gnuradio-runtime/lib/controlport/rpcpmtconverters_ice.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <rpcpmtconverters_ice.h> +#include <gnuradio/rpcpmtconverters_ice.h> #include <Ice/Ice.h> #include <gnuradio.h> diff --git a/gnuradio-runtime/lib/rpcserver_aggregator.cc b/gnuradio-runtime/lib/controlport/rpcserver_aggregator.cc index d750d64905..3ff553af69 100644 --- a/gnuradio-runtime/lib/rpcserver_aggregator.cc +++ b/gnuradio-runtime/lib/controlport/rpcserver_aggregator.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <rpcserver_aggregator.h> -#include <rpcserver_booter_base.h> +#include <gnuradio/rpcserver_aggregator.h> +#include <gnuradio/rpcserver_booter_base.h> #include <iostream> #include <sstream> #include <stdexcept> diff --git a/gnuradio-runtime/lib/rpcserver_booter_aggregator.cc b/gnuradio-runtime/lib/controlport/rpcserver_booter_aggregator.cc index c4c1b03c15..e86306910d 100644 --- a/gnuradio-runtime/lib/rpcserver_booter_aggregator.cc +++ b/gnuradio-runtime/lib/controlport/rpcserver_booter_aggregator.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <rpcserver_booter_aggregator.h> +#include <gnuradio/rpcserver_booter_aggregator.h> rpcserver_booter_aggregator::rpcserver_booter_aggregator() : d_type(std::string("aggregator")), server(new rpcserver_aggregator()) diff --git a/gnuradio-runtime/lib/rpcserver_booter_ice.cc b/gnuradio-runtime/lib/controlport/rpcserver_booter_ice.cc index 7cc8cc8938..cffa268a6d 100644 --- a/gnuradio-runtime/lib/rpcserver_booter_ice.cc +++ b/gnuradio-runtime/lib/controlport/rpcserver_booter_ice.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <rpcserver_ice.h> -#include <rpcserver_booter_ice.h> +#include <gnuradio/rpcserver_ice.h> +#include <gnuradio/rpcserver_booter_ice.h> namespace { static const char* const CONTROL_PORT_CLASS("ice"); diff --git a/gnuradio-runtime/lib/rpcserver_ice.cc b/gnuradio-runtime/lib/controlport/rpcserver_ice.cc index 2454bf2580..045d7ba4f1 100644 --- a/gnuradio-runtime/lib/rpcserver_ice.cc +++ b/gnuradio-runtime/lib/controlport/rpcserver_ice.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <rpcserver_ice.h> +#include <gnuradio/rpcserver_ice.h> #include <IceUtil/IceUtil.h> #include <Ice/Ice.h> #include <iostream> diff --git a/gnuradio-runtime/lib/rpcserver_selector.cc b/gnuradio-runtime/lib/controlport/rpcserver_selector.cc index 362d5f060a..697ec497b1 100644 --- a/gnuradio-runtime/lib/rpcserver_selector.cc +++ b/gnuradio-runtime/lib/controlport/rpcserver_selector.cc @@ -20,14 +20,14 @@ * Boston, MA 02110-1301, USA. */ -#include <rpcserver_booter_aggregator.h> -#include <rpcmanager.h> -#include <rpcserver_selector.h> +#include <gnuradio/rpcserver_booter_aggregator.h> +#include <gnuradio/rpcmanager.h> +#include <gnuradio/rpcserver_selector.h> bool rpcmanager::make_aggregator(false); #ifdef RPCSERVER_ICE - #include <rpcserver_booter_ice.h> + #include <gnuradio/rpcserver_booter_ice.h> rpcmanager::rpcserver_booter_register_helper<rpcserver_booter_ice> boot_ice; #endif diff --git a/gnuradio-runtime/lib/feval.cc b/gnuradio-runtime/lib/feval.cc new file mode 100644 index 0000000000..93976c8ac7 --- /dev/null +++ b/gnuradio-runtime/lib/feval.cc @@ -0,0 +1,136 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gnuradio/feval.h> + +namespace gr { + + feval_dd::~feval_dd(){} + + double + feval_dd::eval(double x) + { + return 0; + } + + double + feval_dd::calleval(double x) + { + return eval(x); + } + + // ---------------------------------------------------------------- + + feval_cc::~feval_cc(){} + + gr_complex + feval_cc::eval(gr_complex x) + { + return 0; + } + + gr_complex + feval_cc::calleval(gr_complex x) + { + return eval(x); + } + + // ---------------------------------------------------------------- + + feval_ll::~feval_ll(){} + + long + feval_ll::eval(long x) + { + return 0; + } + + long + feval_ll::calleval(long x) + { + return eval(x); + } + + // ---------------------------------------------------------------- + + feval::~feval(){} + + void + feval::eval(void) + { + // nop + } + + void + feval::calleval(void) + { + eval(); + } + + // ---------------------------------------------------------------- + + feval_p::~feval_p(){} + + void + feval_p::eval(pmt::pmt_t x) + { + // nop + } + + void + feval_p::calleval(pmt::pmt_t x) + { + eval(x); + } + + /* + * Trivial examples showing C++ (transparently) calling Python + */ + double + feval_dd_example(feval_dd *f, double x) + { + return f->calleval(x); + } + + gr_complex + feval_cc_example(feval_cc *f, gr_complex x) + { + return f->calleval(x); + } + + long + feval_ll_example(feval_ll *f, long x) + { + return f->calleval(x); + } + + void + feval_example(feval *f) + { + f->calleval(); + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/flat_flowgraph.cc b/gnuradio-runtime/lib/flat_flowgraph.cc new file mode 100644 index 0000000000..8b188799a5 --- /dev/null +++ b/gnuradio-runtime/lib/flat_flowgraph.cc @@ -0,0 +1,436 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "flat_flowgraph.h" +#include <gnuradio/block_detail.h> +#include <gnuradio/buffer.h> +#include <gnuradio/prefs.h> +#include <volk/volk.h> +#include <iostream> +#include <map> +#include <boost/format.hpp> + +namespace gr { + +#define FLAT_FLOWGRAPH_DEBUG 0 + +// 32Kbyte buffer size between blocks +#define GR_FIXED_BUFFER_SIZE (32*(1L<<10)) + + static const unsigned int s_fixed_buffer_size = GR_FIXED_BUFFER_SIZE; + + flat_flowgraph_sptr + make_flat_flowgraph() + { + return flat_flowgraph_sptr(new flat_flowgraph()); + } + + flat_flowgraph::flat_flowgraph() + { + } + + flat_flowgraph::~flat_flowgraph() + { + } + + void + flat_flowgraph::setup_connections() + { + basic_block_vector_t blocks = calc_used_blocks(); + + // Assign block details to blocks + for(basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) + cast_to_block_sptr(*p)->set_detail(allocate_block_detail(*p)); + + // Connect inputs to outputs for each block + for(basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) { + connect_block_inputs(*p); + + block_sptr block = cast_to_block_sptr(*p); + block->set_unaligned(0); + block->set_is_unaligned(false); + } + + // Connect message ports connetions + for(msg_edge_viter_t i = d_msg_edges.begin(); i != d_msg_edges.end(); i++) { + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << boost::format("flat_fg connecting msg primitives: (%s, %s)->(%s, %s)\n") % + i->src().block() % i->src().port() % + i->dst().block() % i->dst().port(); + i->src().block()->message_port_sub(i->src().port(), pmt::cons(i->dst().block()->alias_pmt(), i->dst().port())); + } + } + + block_detail_sptr + flat_flowgraph::allocate_block_detail(basic_block_sptr block) + { + int ninputs = calc_used_ports(block, true).size(); + int noutputs = calc_used_ports(block, false).size(); + block_detail_sptr detail = make_block_detail(ninputs, noutputs); + + block_sptr grblock = cast_to_block_sptr(block); + if(!grblock) + throw std::runtime_error("allocate_block_detail found non-gr::block"); + + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << "Creating block detail for " << block << std::endl; + + for(int i = 0; i < noutputs; i++) { + grblock->expand_minmax_buffer(i); + + buffer_sptr buffer = allocate_buffer(block, i); + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << "Allocated buffer for output " << block << ":" << i << std::endl; + detail->set_output(i, buffer); + + // Update the block's max_output_buffer based on what was actually allocated. + grblock->set_max_output_buffer(i, buffer->bufsize()); + } + + return detail; + } + + buffer_sptr + flat_flowgraph::allocate_buffer(basic_block_sptr block, int port) + { + block_sptr grblock = cast_to_block_sptr(block); + if(!grblock) + throw std::runtime_error("allocate_buffer found non-gr::block"); + int item_size = block->output_signature()->sizeof_stream_item(port); + + // *2 because we're now only filling them 1/2 way in order to + // increase the available parallelism when using the TPB scheduler. + // (We're double buffering, where we used to single buffer) + int nitems = s_fixed_buffer_size * 2 / item_size; + + // Make sure there are at least twice the output_multiple no. of items + if(nitems < 2*grblock->output_multiple()) // Note: this means output_multiple() + nitems = 2*grblock->output_multiple(); // can't be changed by block dynamically + + // If any downstream blocks are decimators and/or have a large output_multiple, + // ensure we have a buffer at least twice their decimation factor*output_multiple + basic_block_vector_t blocks = calc_downstream_blocks(block, port); + + // limit buffer size if indicated + if(grblock->max_output_buffer(port) > 0) { + //std::cout << "constraining output items to " << block->max_output_buffer(port) << "\n"; + nitems = std::min((long)nitems, (long)grblock->max_output_buffer(port)); + nitems -= nitems%grblock->output_multiple(); + if(nitems < 1) + throw std::runtime_error("problems allocating a buffer with the given max output buffer constraint!"); + } + else if(grblock->min_output_buffer(port) > 0) { + nitems = std::max((long)nitems, (long)grblock->min_output_buffer(port)); + nitems -= nitems%grblock->output_multiple(); + if(nitems < 1) + throw std::runtime_error("problems allocating a buffer with the given min output buffer constraint!"); + } + + for(basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) { + block_sptr dgrblock = cast_to_block_sptr(*p); + if(!dgrblock) + throw std::runtime_error("allocate_buffer found non-gr::block"); + + double decimation = (1.0/dgrblock->relative_rate()); + int multiple = dgrblock->output_multiple(); + int history = dgrblock->history(); + nitems = std::max(nitems, static_cast<int>(2*(decimation*multiple+history))); + } + + // std::cout << "make_buffer(" << nitems << ", " << item_size << ", " << grblock << "\n"; + return make_buffer(nitems, item_size, grblock); + } + + void + flat_flowgraph::connect_block_inputs(basic_block_sptr block) + { + block_sptr grblock = cast_to_block_sptr(block); + if (!grblock) + throw std::runtime_error("connect_block_inputs found non-gr::block"); + + // Get its detail and edges that feed into it + block_detail_sptr detail = grblock->detail(); + edge_vector_t in_edges = calc_upstream_edges(block); + + // For each edge that feeds into it + for(edge_viter_t e = in_edges.begin(); e != in_edges.end(); e++) { + // Set the buffer reader on the destination port to the output + // buffer on the source port + int dst_port = e->dst().port(); + int src_port = e->src().port(); + basic_block_sptr src_block = e->src().block(); + block_sptr src_grblock = cast_to_block_sptr(src_block); + if(!src_grblock) + throw std::runtime_error("connect_block_inputs found non-gr::block"); + buffer_sptr src_buffer = src_grblock->detail()->output(src_port); + + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << "Setting input " << dst_port << " from edge " << (*e) << std::endl; + + detail->set_input(dst_port, buffer_add_reader(src_buffer, grblock->history()-1, grblock)); + } + } + + void + flat_flowgraph::merge_connections(flat_flowgraph_sptr old_ffg) + { + // Allocate block details if needed. Only new blocks that aren't pruned out + // by flattening will need one; existing blocks still in the new flowgraph will + // already have one. + for(basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) { + block_sptr block = cast_to_block_sptr(*p); + + if(!block->detail()) { + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << "merge: allocating new detail for block " << (*p) << std::endl; + block->set_detail(allocate_block_detail(block)); + } + else + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << "merge: reusing original detail for block " << (*p) << std::endl; + } + + // Calculate the old edges that will be going away, and clear the + // buffer readers on the RHS. + for(edge_viter_t old_edge = old_ffg->d_edges.begin(); old_edge != old_ffg->d_edges.end(); old_edge++) { + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << "merge: testing old edge " << (*old_edge) << "..."; + + edge_viter_t new_edge; + for(new_edge = d_edges.begin(); new_edge != d_edges.end(); new_edge++) + if(new_edge->src() == old_edge->src() && + new_edge->dst() == old_edge->dst()) + break; + + if(new_edge == d_edges.end()) { // not found in new edge list + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << "not in new edge list" << std::endl; + // zero the buffer reader on RHS of old edge + block_sptr block(cast_to_block_sptr(old_edge->dst().block())); + int port = old_edge->dst().port(); + block->detail()->set_input(port, buffer_reader_sptr()); + } + else { + if (FLAT_FLOWGRAPH_DEBUG) + std::cout << "found in new edge list" << std::endl; + } + } + + // Now connect inputs to outputs, reusing old buffer readers if they exist + for(basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) { + block_sptr block = cast_to_block_sptr(*p); + + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << "merge: merging " << (*p) << "..."; + + if(old_ffg->has_block_p(*p)) { + // Block exists in old flow graph + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << "used in old flow graph" << std::endl; + block_detail_sptr detail = block->detail(); + + // Iterate through the inputs and see what needs to be done + int ninputs = calc_used_ports(block, true).size(); // Might be different now + for(int i = 0; i < ninputs; i++) { + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << "Checking input " << block << ":" << i << "..."; + edge edge = calc_upstream_edge(*p, i); + + // Fish out old buffer reader and see if it matches correct buffer from edge list + block_sptr src_block = cast_to_block_sptr(edge.src().block()); + block_detail_sptr src_detail = src_block->detail(); + buffer_sptr src_buffer = src_detail->output(edge.src().port()); + buffer_reader_sptr old_reader; + if(i < detail->ninputs()) // Don't exceed what the original detail has + old_reader = detail->input(i); + + // If there's a match, use it + if(old_reader && (src_buffer == old_reader->buffer())) { + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << "matched, reusing" << std::endl; + } + else { + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << "needs a new reader" << std::endl; + + // Create new buffer reader and assign + detail->set_input(i, buffer_add_reader(src_buffer, block->history()-1, block)); + } + } + } + else { + // Block is new, it just needs buffer readers at this point + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << "new block" << std::endl; + connect_block_inputs(block); + + // Make sure all buffers are aligned + setup_buffer_alignment(block); + } + + // Now deal with the fact that the block details might have + // changed numbers of inputs and outputs vs. in the old + // flowgraph. + } + } + + void + flat_flowgraph::setup_buffer_alignment(block_sptr block) + { + const int alignment = volk_get_alignment(); + for(int i = 0; i < block->detail()->ninputs(); i++) { + void *r = (void*)block->detail()->input(i)->read_pointer(); + unsigned long int ri = (unsigned long int)r % alignment; + //std::cerr << "reader: " << r << " alignment: " << ri << std::endl; + if(ri != 0) { + size_t itemsize = block->detail()->input(i)->get_sizeof_item(); + block->detail()->input(i)->update_read_pointer(alignment-ri/itemsize); + } + block->set_unaligned(0); + block->set_is_unaligned(false); + } + + for(int i = 0; i < block->detail()->noutputs(); i++) { + void *w = (void*)block->detail()->output(i)->write_pointer(); + unsigned long int wi = (unsigned long int)w % alignment; + //std::cerr << "writer: " << w << " alignment: " << wi << std::endl; + if(wi != 0) { + size_t itemsize = block->detail()->output(i)->get_sizeof_item(); + block->detail()->output(i)->update_write_pointer(alignment-wi/itemsize); + } + block->set_unaligned(0); + block->set_is_unaligned(false); + } + } + + std::string + flat_flowgraph::edge_list() + { + std::stringstream s; + for(edge_viter_t e = d_edges.begin(); e != d_edges.end(); e++) + s << (*e) << std::endl; + return s.str(); + } + + void flat_flowgraph::dump() + { + for(edge_viter_t e = d_edges.begin(); e != d_edges.end(); e++) + std::cout << " edge: " << (*e) << std::endl; + + for(basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) { + std::cout << " block: " << (*p) << std::endl; + block_detail_sptr detail = cast_to_block_sptr(*p)->detail(); + std::cout << " detail @" << detail << ":" << std::endl; + + int ni = detail->ninputs(); + int no = detail->noutputs(); + for(int i = 0; i < no; i++) { + buffer_sptr buffer = detail->output(i); + std::cout << " output " << i << ": " << buffer << std::endl; + } + + for(int i = 0; i < ni; i++) { + buffer_reader_sptr reader = detail->input(i); + std::cout << " reader " << i << ": " << reader + << " reading from buffer=" << reader->buffer() << std::endl; + } + } + } + + block_vector_t + flat_flowgraph::make_block_vector(basic_block_vector_t &blocks) + { + block_vector_t result; + for(basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) { + result.push_back(cast_to_block_sptr(*p)); + } + + return result; + } + + void + flat_flowgraph::clear_endpoint(const msg_endpoint &e, bool is_src) + { + for(size_t i=0; i<d_msg_edges.size(); i++) { + if(is_src) { + if(d_msg_edges[i].src() == e) { + d_msg_edges.erase(d_msg_edges.begin() + i); + i--; + } + } + else { + if(d_msg_edges[i].dst() == e) { + d_msg_edges.erase(d_msg_edges.begin() + i); + i--; + } + } + } + } + + void + flat_flowgraph::replace_endpoint(const msg_endpoint &e, const msg_endpoint &r, bool is_src) + { + size_t n_replr(0); + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << boost::format("flat_flowgraph::replace_endpoint( %s, %s, %d )\n") % e.block()% r.block()% is_src; + for(size_t i=0; i<d_msg_edges.size(); i++) { + if(is_src) { + if(d_msg_edges[i].src() == e) { + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << boost::format("flat_flowgraph::replace_endpoint() flattening to ( %s, %s )\n") \ + % r.block()% d_msg_edges[i].dst().block(); + d_msg_edges.push_back( msg_edge(r, d_msg_edges[i].dst() ) ); + n_replr++; + } + } + else { + if(d_msg_edges[i].dst() == e) { + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << boost::format("flat_flowgraph::replace_endpoint() flattening to ( %s, %s )\n") \ + % r.block()% d_msg_edges[i].dst().block(); + d_msg_edges.push_back( msg_edge(d_msg_edges[i].src(), r ) ); + n_replr++; + } + } + } + } + + void + flat_flowgraph::enable_pc_rpc() + { +#ifdef GR_PERFORMANCE_COUNTERS + if(prefs::singleton()->get_bool("PerfCounters", "on", false)) { + basic_block_viter_t p; + for(p = d_blocks.begin(); p != d_blocks.end(); p++) { + block_sptr block = cast_to_block_sptr(*p); + if(!block->is_pc_rpc_set()) + block->setup_pc_rpc(); + } + } +#endif /* GR_PERFORMANCE_COUNTERS */ + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/flat_flowgraph.h b/gnuradio-runtime/lib/flat_flowgraph.h new file mode 100644 index 0000000000..fe43969b6f --- /dev/null +++ b/gnuradio-runtime/lib/flat_flowgraph.h @@ -0,0 +1,93 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2007,2013 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. + */ + +#ifndef INCLUDED_GR_RUNTIME_FLAT_FLOWGRAPH_H +#define INCLUDED_GR_RUNTIME_FLAT_FLOWGRAPH_H + +#include <gnuradio/api.h> +#include <gnuradio/flowgraph.h> +#include <gnuradio/block.h> + +namespace gr { + + // Create a shared pointer to a heap allocated gr::flat_flowgraph + // (types defined in gr_runtime_types.h) + GR_RUNTIME_API flat_flowgraph_sptr make_flat_flowgraph(); + + /*! + *\brief Class specializing gr_flat_flowgraph that has all nodes + * as blocks, with no hierarchy + * \ingroup internal + */ + class GR_RUNTIME_API flat_flowgraph : public flowgraph + { + public: + friend GR_RUNTIME_API flat_flowgraph_sptr make_flat_flowgraph(); + + // Destruct an arbitrary gr::flat_flowgraph + ~flat_flowgraph(); + + // Wire list of gr::block together in new flat_flowgraph + void setup_connections(); + + // Merge applicable connections from existing flat flowgraph + void merge_connections(flat_flowgraph_sptr sfg); + + // Return a string list of edges + std::string edge_list(); + + void dump(); + + /*! + * Make a vector of gr::block from a vector of gr::basic_block + */ + static block_vector_t make_block_vector(basic_block_vector_t &blocks); + + void replace_endpoint(const msg_endpoint &e, const msg_endpoint &r, bool is_src); + void clear_endpoint(const msg_endpoint &e, bool is_src); + + /*! + * Enables export of perf. counters to ControlPort on all blocks in + * the flowgraph. + */ + void enable_pc_rpc(); + + private: + flat_flowgraph(); + + block_detail_sptr allocate_block_detail(basic_block_sptr block); + buffer_sptr allocate_buffer(basic_block_sptr block, int port); + void connect_block_inputs(basic_block_sptr block); + + /* When reusing a flowgraph's blocks, this call makes sure all of + * the buffer's are aligned at the machine's alignment boundary + * and tells the blocks that they are aligned. + * + * Called from both setup_connections and merge_connections for + * start and restarts. + */ + void setup_buffer_alignment(block_sptr block); + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RUNTIME_FLAT_FLOWGRAPH_H */ diff --git a/gnuradio-runtime/lib/flowgraph.cc b/gnuradio-runtime/lib/flowgraph.cc new file mode 100644 index 0000000000..0b0285088b --- /dev/null +++ b/gnuradio-runtime/lib/flowgraph.cc @@ -0,0 +1,519 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/flowgraph.h> +#include <stdexcept> +#include <sstream> +#include <iterator> + +namespace gr { + +#define FLOWGRAPH_DEBUG 0 + + edge::~edge() + { + } + + flowgraph_sptr make_flowgraph() + { + return flowgraph_sptr(new flowgraph()); + } + + flowgraph::flowgraph() + { + } + + flowgraph::~flowgraph() + { + } + + template<class T> + static + std::vector<T> + unique_vector(std::vector<T> v) + { + std::vector<T> result; + std::insert_iterator<std::vector<T> > inserter(result, result.begin()); + + sort(v.begin(), v.end()); + unique_copy(v.begin(), v.end(), inserter); + return result; + } + + void + flowgraph::connect(const endpoint &src, const endpoint &dst) + { + check_valid_port(src.block()->output_signature(), src.port()); + check_valid_port(dst.block()->input_signature(), dst.port()); + check_dst_not_used(dst); + check_type_match(src, dst); + + // All ist klar, Herr Kommisar + d_edges.push_back(edge(src,dst)); + } + + void + flowgraph::disconnect(const endpoint &src, const endpoint &dst) + { + for(edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) { + if(src == p->src() && dst == p->dst()) { + d_edges.erase(p); + return; + } + } + + std::stringstream msg; + msg << "cannot disconnect edge " << edge(src, dst) << ", not found"; + throw std::invalid_argument(msg.str()); + } + + void + flowgraph::validate() + { + d_blocks = calc_used_blocks(); + + for(basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) { + std::vector<int> used_ports; + int ninputs, noutputs; + + if(FLOWGRAPH_DEBUG) + std::cout << "Validating block: " << (*p) << std::endl; + + used_ports = calc_used_ports(*p, true); // inputs + ninputs = used_ports.size(); + check_contiguity(*p, used_ports, true); // inputs + + used_ports = calc_used_ports(*p, false); // outputs + noutputs = used_ports.size(); + check_contiguity(*p, used_ports, false); // outputs + + if(!((*p)->check_topology(ninputs, noutputs))) { + std::stringstream msg; + msg << "check topology failed on " << (*p) + << " using ninputs=" << ninputs + << ", noutputs=" << noutputs; + throw std::runtime_error(msg.str()); + } + } + } + + void + flowgraph::clear() + { + // Boost shared pointers will deallocate as needed + d_blocks.clear(); + d_edges.clear(); + } + + void + flowgraph::check_valid_port(gr::io_signature::sptr sig, int port) + { + std::stringstream msg; + + if(port < 0) { + msg << "negative port number " << port << " is invalid"; + throw std::invalid_argument(msg.str()); + } + + int max = sig->max_streams(); + if(max != io_signature::IO_INFINITE && port >= max) { + msg << "port number " << port << " exceeds max of "; + if(max == 0) + msg << "(none)"; + else + msg << max-1; + throw std::invalid_argument(msg.str()); + } + } + + void + flowgraph::check_valid_port(const msg_endpoint &e) + { + if(FLOWGRAPH_DEBUG) + std::cout << "check_valid_port( " << e.block() << ", " << e.port() << ")\n"; + + if(!e.block()->has_msg_port(e.port())) + throw std::invalid_argument("invalid msg port in connect() or disconnect()"); + } + + void + flowgraph::check_dst_not_used(const endpoint &dst) + { + // A destination is in use if it is already on the edge list + for(edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) + if(p->dst() == dst) { + std::stringstream msg; + msg << "destination already in use by edge " << (*p); + throw std::invalid_argument(msg.str()); + } + } + + void + flowgraph::check_type_match(const endpoint &src, const endpoint &dst) + { + int src_size = src.block()->output_signature()->sizeof_stream_item(src.port()); + int dst_size = dst.block()->input_signature()->sizeof_stream_item(dst.port()); + + if(src_size != dst_size) { + std::stringstream msg; + msg << "itemsize mismatch: " << src << " using " << src_size + << ", " << dst << " using " << dst_size; + throw std::invalid_argument(msg.str()); + } + } + + basic_block_vector_t + flowgraph::calc_used_blocks() + { + basic_block_vector_t tmp; + + // make sure free standing message blocks are included + for(msg_edge_viter_t p = d_msg_edges.begin(); p != d_msg_edges.end(); p++) { + //for now only blocks receiving messages get a thread context - uncomment to allow senders to also obtain one + // tmp.push_back(p->src().block()); + tmp.push_back(p->dst().block()); + } + + // Collect all blocks in the edge list + for(edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) { + tmp.push_back(p->src().block()); + tmp.push_back(p->dst().block()); + } + + return unique_vector<basic_block_sptr>(tmp); + } + + std::vector<int> + flowgraph::calc_used_ports(basic_block_sptr block, bool check_inputs) + { + std::vector<int> tmp; + + // Collect all seen ports + edge_vector_t edges = calc_connections(block, check_inputs); + for(edge_viter_t p = edges.begin(); p != edges.end(); p++) { + if(check_inputs == true) + tmp.push_back(p->dst().port()); + else + tmp.push_back(p->src().port()); + } + + return unique_vector<int>(tmp); + } + + edge_vector_t + flowgraph::calc_connections(basic_block_sptr block, bool check_inputs) + { + edge_vector_t result; + + for(edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) { + if(check_inputs) { + if(p->dst().block() == block) + result.push_back(*p); + } + else { + if(p->src().block() == block) + result.push_back(*p); + } + } + + return result; // assumes no duplicates + } + + void + flowgraph::check_contiguity(basic_block_sptr block, + const std::vector<int> &used_ports, + bool check_inputs) + { + std::stringstream msg; + + gr::io_signature::sptr sig = + check_inputs ? block->input_signature() : block->output_signature(); + + int nports = used_ports.size(); + int min_ports = sig->min_streams(); + int max_ports = sig->max_streams(); + + if(nports == 0 && min_ports == 0) + return; + + if(nports < min_ports) { + msg << block << ": insufficient connected " + << (check_inputs ? "input ports " : "output ports ") + << "(" << min_ports << " needed, " << nports << " connected)"; + throw std::runtime_error(msg.str()); + } + + if(nports > max_ports && max_ports != io_signature::IO_INFINITE) { + msg << block << ": too many connected " + << (check_inputs ? "input ports " : "output ports ") + << "(" << max_ports << " allowed, " << nports << " connected)"; + throw std::runtime_error(msg.str()); + } + + if(used_ports[nports-1]+1 != nports) { + for(int i = 0; i < nports; i++) { + if(used_ports[i] != i) { + msg << block << ": missing connection " + << (check_inputs ? "to input port " : "from output port ") + << i; + throw std::runtime_error(msg.str()); + } + } + } + } + + basic_block_vector_t + flowgraph::calc_downstream_blocks(basic_block_sptr block, int port) + { + basic_block_vector_t tmp; + + for(edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) + if(p->src() == endpoint(block, port)) + tmp.push_back(p->dst().block()); + + return unique_vector<basic_block_sptr>(tmp); + } + + basic_block_vector_t + flowgraph::calc_downstream_blocks(basic_block_sptr block) + { + basic_block_vector_t tmp; + + for(edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) + if(p->src().block() == block) + tmp.push_back(p->dst().block()); + + return unique_vector<basic_block_sptr>(tmp); + } + + edge_vector_t + flowgraph::calc_upstream_edges(basic_block_sptr block) + { + edge_vector_t result; + + for(edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) + if(p->dst().block() == block) + result.push_back(*p); + + return result; // Assume no duplicates + } + + bool + flowgraph::has_block_p(basic_block_sptr block) + { + basic_block_viter_t result; + result = std::find(d_blocks.begin(), d_blocks.end(), block); + return (result != d_blocks.end()); + } + + edge + flowgraph::calc_upstream_edge(basic_block_sptr block, int port) + { + edge result; + + for(edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) { + if(p->dst() == endpoint(block, port)) { + result = (*p); + break; + } + } + + return result; + } + + std::vector<basic_block_vector_t> + flowgraph::partition() + { + std::vector<basic_block_vector_t> result; + basic_block_vector_t blocks = calc_used_blocks(); + basic_block_vector_t graph; + + while(blocks.size() > 0) { + graph = calc_reachable_blocks(blocks[0], blocks); + assert(graph.size()); + result.push_back(topological_sort(graph)); + + for(basic_block_viter_t p = graph.begin(); p != graph.end(); p++) + blocks.erase(find(blocks.begin(), blocks.end(), *p)); + } + + return result; + } + + basic_block_vector_t + flowgraph::calc_reachable_blocks(basic_block_sptr block, basic_block_vector_t &blocks) + { + basic_block_vector_t result; + + // Mark all blocks as unvisited + for(basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) + (*p)->set_color(basic_block::WHITE); + + // Recursively mark all reachable blocks + reachable_dfs_visit(block, blocks); + + // Collect all the blocks that have been visited + for(basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) + if((*p)->color() == basic_block::BLACK) + result.push_back(*p); + + return result; + } + + // Recursively mark all reachable blocks from given block and block list + void + flowgraph::reachable_dfs_visit(basic_block_sptr block, basic_block_vector_t &blocks) + { + // Mark the current one as visited + block->set_color(basic_block::BLACK); + + // Recurse into adjacent vertices + basic_block_vector_t adjacent = calc_adjacent_blocks(block, blocks); + + for(basic_block_viter_t p = adjacent.begin(); p != adjacent.end(); p++) + if((*p)->color() == basic_block::WHITE) + reachable_dfs_visit(*p, blocks); + } + + // Return a list of block adjacent to a given block along any edge + basic_block_vector_t + flowgraph::calc_adjacent_blocks(basic_block_sptr block, basic_block_vector_t &blocks) + { + basic_block_vector_t tmp; + + // Find any blocks that are inputs or outputs + for(edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) { + if(p->src().block() == block) + tmp.push_back(p->dst().block()); + if(p->dst().block() == block) + tmp.push_back(p->src().block()); + } + + return unique_vector<basic_block_sptr>(tmp); + } + + basic_block_vector_t + flowgraph::topological_sort(basic_block_vector_t &blocks) + { + basic_block_vector_t tmp; + basic_block_vector_t result; + tmp = sort_sources_first(blocks); + + // Start 'em all white + for(basic_block_viter_t p = tmp.begin(); p != tmp.end(); p++) + (*p)->set_color(basic_block::WHITE); + + for(basic_block_viter_t p = tmp.begin(); p != tmp.end(); p++) { + if((*p)->color() == basic_block::WHITE) + topological_dfs_visit(*p, result); + } + + reverse(result.begin(), result.end()); + return result; + } + + basic_block_vector_t + flowgraph::sort_sources_first(basic_block_vector_t &blocks) + { + basic_block_vector_t sources, nonsources, result; + + for(basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) { + if(source_p(*p)) + sources.push_back(*p); + else + nonsources.push_back(*p); + } + + for(basic_block_viter_t p = sources.begin(); p != sources.end(); p++) + result.push_back(*p); + + for(basic_block_viter_t p = nonsources.begin(); p != nonsources.end(); p++) + result.push_back(*p); + + return result; + } + + bool + flowgraph::source_p(basic_block_sptr block) + { + return (calc_upstream_edges(block).size() == 0); + } + + void + flowgraph::topological_dfs_visit(basic_block_sptr block, basic_block_vector_t &output) + { + block->set_color(basic_block::GREY); + basic_block_vector_t blocks(calc_downstream_blocks(block)); + + for(basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) { + switch((*p)->color()) { + case basic_block::WHITE: + topological_dfs_visit(*p, output); + break; + + case basic_block::GREY: + throw std::runtime_error("flow graph has loops!"); + + case basic_block::BLACK: + continue; + + default: + throw std::runtime_error("invalid color on block!"); + } + } + + block->set_color(basic_block::BLACK); + output.push_back(block); + } + + void + flowgraph::connect(const msg_endpoint &src, const msg_endpoint &dst) + { + check_valid_port(src); + check_valid_port(dst); + for(msg_edge_viter_t p = d_msg_edges.begin(); p != d_msg_edges.end(); p++) { + if(p->src() == src && p->dst() == dst){ + throw std::runtime_error("connect called on already connected edge!"); + } + } + d_msg_edges.push_back(msg_edge(src,dst)); + } + + void + flowgraph::disconnect(const msg_endpoint &src, const msg_endpoint &dst) + { + check_valid_port(src); + check_valid_port(dst); + for(msg_edge_viter_t p = d_msg_edges.begin(); p != d_msg_edges.end(); p++) { + if(p->src() == src && p->dst() == dst){ + d_msg_edges.erase(p); + return; + } + } + throw std::runtime_error("disconnect called on non-connected edge!"); + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/gr_basic_block.cc b/gnuradio-runtime/lib/gr_basic_block.cc deleted file mode 100644 index 83f6c07c87..0000000000 --- a/gnuradio-runtime/lib/gr_basic_block.cc +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2012 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_basic_block.h> -#include <gr_block_registry.h> -#include <stdexcept> -#include <sstream> -#include <iostream> - -static long s_next_id = 0; -static long s_ncurrently_allocated = 0; - -long -gr_basic_block_ncurrently_allocated() -{ - return s_ncurrently_allocated; -} - -gr_basic_block::gr_basic_block(const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature) - : d_name(name), - d_input_signature(input_signature), - d_output_signature(output_signature), - d_unique_id(s_next_id++), - d_symbolic_id(global_block_registry.block_register(this)), - d_symbol_name(global_block_registry.register_symbolic_name(this)), - d_color(WHITE), - d_rpc_set(false), - message_subscribers(pmt::make_dict()) -{ - s_ncurrently_allocated++; -} - -gr_basic_block::~gr_basic_block() -{ - s_ncurrently_allocated--; - global_block_registry.block_unregister(this); -} - -gr_basic_block_sptr -gr_basic_block::to_basic_block() -{ - return shared_from_this(); -} - -void -gr_basic_block::set_block_alias(std::string name) -{ - global_block_registry.register_symbolic_name(this, name); -} - -// ** Message passing interface ** - -// - register a new input message port -void -gr_basic_block::message_port_register_in(pmt::pmt_t port_id) -{ - if(!pmt::is_symbol(port_id)) { - throw std::runtime_error("message_port_register_in: bad port id"); - } - msg_queue[port_id] = msg_queue_t(); - msg_queue_ready[port_id] = boost::shared_ptr<boost::condition_variable>(new boost::condition_variable()); -} - -pmt::pmt_t -gr_basic_block::message_ports_in() -{ - pmt::pmt_t port_names = pmt::make_vector(msg_queue.size(), pmt::PMT_NIL); - msg_queue_map_itr itr = msg_queue.begin(); - for(size_t i = 0; i < msg_queue.size(); i++) { - pmt::vector_set(port_names, i, (*itr).first); - itr++; - } - return port_names; -} - -// - register a new output message port -void -gr_basic_block::message_port_register_out(pmt::pmt_t port_id) -{ - if(!pmt::is_symbol(port_id)) { - throw std::runtime_error("message_port_register_out: bad port id"); - } - if(pmt::dict_has_key(message_subscribers, port_id)) { - throw std::runtime_error("message_port_register_out: port already in use"); - } - message_subscribers = pmt::dict_add(message_subscribers, port_id, pmt::PMT_NIL); -} - -pmt::pmt_t -gr_basic_block::message_ports_out() -{ - size_t len = pmt::length(message_subscribers); - pmt::pmt_t port_names = pmt::make_vector(len, pmt::PMT_NIL); - pmt::pmt_t keys = pmt::dict_keys(message_subscribers); - for(size_t i = 0; i < len; i++) { - pmt::vector_set(port_names, i, pmt::nth(i, keys)); - } - return port_names; -} - -// - publish a message on a message port -void gr_basic_block::message_port_pub(pmt::pmt_t port_id, pmt::pmt_t msg) -{ - if(!pmt::dict_has_key(message_subscribers, port_id)) { - throw std::runtime_error("port does not exist"); - } - - pmt::pmt_t currlist = pmt::dict_ref(message_subscribers, port_id, pmt::PMT_NIL); - // iterate through subscribers on port - while(pmt::is_pair(currlist)) { - pmt::pmt_t target = pmt::car(currlist); - - pmt::pmt_t block = pmt::car(target); - pmt::pmt_t port = pmt::cdr(target); - - currlist = pmt::cdr(currlist); - gr_basic_block_sptr blk = global_block_registry.block_lookup(block); - //blk->post(msg); - blk->post(port, msg); - } -} - -// - subscribe to a message port -void -gr_basic_block::message_port_sub(pmt::pmt_t port_id, pmt::pmt_t target){ - if(!pmt::dict_has_key(message_subscribers, port_id)){ - std::stringstream ss; - ss << "Port does not exist: \"" << pmt::write_string(port_id) << "\" on block: " << pmt::write_string(target) << std::endl; - throw std::runtime_error(ss.str()); - } - pmt::pmt_t currlist = pmt::dict_ref(message_subscribers,port_id,pmt::PMT_NIL); - - // ignore re-adds of the same target - if(!pmt::list_has(currlist, target)) - message_subscribers = pmt::dict_add(message_subscribers,port_id,pmt::list_add(currlist,target)); -} - -void -gr_basic_block::message_port_unsub(pmt::pmt_t port_id, pmt::pmt_t target){ - if(!pmt::dict_has_key(message_subscribers, port_id)){ - std::stringstream ss; - ss << "Port does not exist: \"" << pmt::write_string(port_id) << "\" on block: " << pmt::write_string(target) << std::endl; - throw std::runtime_error(ss.str()); - } - - // ignore unsubs of unknown targets - pmt::pmt_t currlist = pmt::dict_ref(message_subscribers,port_id,pmt::PMT_NIL); - message_subscribers = pmt::dict_add(message_subscribers,port_id,pmt::list_rm(currlist,target)); -} - -void -gr_basic_block::_post(pmt::pmt_t which_port, pmt::pmt_t msg) -{ - insert_tail(which_port, msg); -} - -void -gr_basic_block::insert_tail(pmt::pmt_t which_port, pmt::pmt_t msg) -{ - gr::thread::scoped_lock guard(mutex); - - if( (msg_queue.find(which_port) == msg_queue.end()) || (msg_queue_ready.find(which_port) == msg_queue_ready.end())){ - std::cout << "target port = " << pmt::symbol_to_string(which_port) << std::endl; - throw std::runtime_error("attempted to insert_tail on invalid queue!"); - } - - msg_queue[which_port].push_back(msg); - msg_queue_ready[which_port]->notify_one(); - - // wake up thread if BLKD_IN or BLKD_OUT - global_block_registry.notify_blk(alias()); -} - -pmt::pmt_t -gr_basic_block::delete_head_nowait(pmt::pmt_t which_port) -{ - gr::thread::scoped_lock guard(mutex); - - if (empty_p(which_port)){ - return pmt::pmt_t(); - } - - pmt::pmt_t m(msg_queue[which_port].front()); - msg_queue[which_port].pop_front(); - - return m; -} - -pmt::pmt_t -gr_basic_block::delete_head_blocking(pmt::pmt_t which_port) -{ - gr::thread::scoped_lock guard(mutex); - - while (empty_p(which_port)){ - msg_queue_ready[which_port]->wait(guard); - } - - pmt::pmt_t m(msg_queue[which_port].front()); - msg_queue[which_port].pop_front(); - return m; -} diff --git a/gnuradio-runtime/lib/gr_block.cc b/gnuradio-runtime/lib/gr_block.cc deleted file mode 100644 index 187cb9530c..0000000000 --- a/gnuradio-runtime/lib/gr_block.cc +++ /dev/null @@ -1,687 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2009,2010,2013 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_block.h> -#include <gr_block_detail.h> -#include <stdexcept> -#include <iostream> -#include <gr_block_registry.h> -#include <gr_prefs.h> - -gr_block::gr_block (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_output_multiple (1), - d_output_multiple_set(false), - d_unaligned(0), - d_is_unaligned(false), - d_relative_rate (1.0), - d_history(1), - d_fixed_rate(false), - d_max_noutput_items_set(false), - d_max_noutput_items(0), - d_min_noutput_items(0), - d_tag_propagation_policy(TPP_ALL_TO_ALL), - d_pc_rpc_set(false), - d_max_output_buffer(std::max(output_signature->max_streams(),1), -1), - d_min_output_buffer(std::max(output_signature->max_streams(),1), -1) -{ - global_block_registry.register_primitive(alias(), this); - -#ifdef ENABLE_GR_LOG -#ifdef HAVE_LOG4CPP - gr_prefs *p = gr_prefs::singleton(); - std::string config_file = p->get_string("LOG", "log_config", ""); - std::string log_level = p->get_string("LOG", "log_level", "off"); - std::string log_file = p->get_string("LOG", "log_file", ""); - std::string debug_level = p->get_string("LOG", "debug_level", "off"); - std::string debug_file = p->get_string("LOG", "debug_file", ""); - - GR_CONFIG_LOGGER(config_file); - - GR_LOG_GETLOGGER(LOG, "gr_log." + alias()); - GR_LOG_SET_LEVEL(LOG, log_level); - if(log_file.size() > 0) { - if(log_file == "stdout") { - GR_LOG_ADD_CONSOLE_APPENDER(LOG, "cout","gr::log :%p: %c{1} - %m%n"); - } - else if(log_file == "stderr") { - GR_LOG_ADD_CONSOLE_APPENDER(LOG, "cerr","gr::log :%p: %c{1} - %m%n"); - } - else { - GR_LOG_ADD_FILE_APPENDER(LOG, log_file , true,"%r :%p: %c{1} - %m%n"); - } - } - d_logger = LOG; - - GR_LOG_GETLOGGER(DLOG, "gr_log_debug." + alias()); - GR_LOG_SET_LEVEL(DLOG, debug_level); - if(debug_file.size() > 0) { - if(debug_file == "stdout") { - GR_LOG_ADD_CONSOLE_APPENDER(DLOG, "cout","gr::debug :%p: %c{1} - %m%n"); - } - else if(debug_file == "stderr") { - GR_LOG_ADD_CONSOLE_APPENDER(DLOG, "cerr", "gr::debug :%p: %c{1} - %m%n"); - } - else { - GR_LOG_ADD_FILE_APPENDER(DLOG, debug_file, true, "%r :%p: %c{1} - %m%n"); - } - } - d_debug_logger = DLOG; -#endif /* HAVE_LOG4CPP */ -#else /* ENABLE_GR_LOG */ - d_logger = NULL; - d_debug_logger = NULL; -#endif /* ENABLE_GR_LOG */ -} - -gr_block::~gr_block () -{ - global_block_registry.unregister_primitive(alias()); -} - -// stub implementation: 1:1 - -void -gr_block::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size (); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = noutput_items + history() - 1; -} - -// default implementation - -bool -gr_block::start() -{ - return true; -} - -bool -gr_block::stop() -{ - return true; -} - -void -gr_block::set_output_multiple (int multiple) -{ - if (multiple < 1) - throw std::invalid_argument ("gr_block::set_output_multiple"); - - d_output_multiple_set = true; - d_output_multiple = multiple; -} - -void -gr_block::set_alignment (int multiple) -{ - if (multiple < 1) - throw std::invalid_argument ("gr_block::set_alignment_multiple"); - - d_output_multiple = multiple; -} - -void -gr_block::set_unaligned (int na) -{ - // unaligned value must be less than 0 and it doesn't make sense - // that it's larger than the alignment value. - if ((na < 0) || (na > d_output_multiple)) - throw std::invalid_argument ("gr_block::set_unaligned"); - - d_unaligned = na; -} - -void -gr_block::set_is_unaligned (bool u) -{ - d_is_unaligned = u; -} - -void -gr_block::set_relative_rate (double relative_rate) -{ - if (relative_rate < 0.0) - throw std::invalid_argument ("gr_block::set_relative_rate"); - - d_relative_rate = relative_rate; -} - - -void -gr_block::consume (int which_input, int how_many_items) -{ - d_detail->consume (which_input, how_many_items); -} - -void -gr_block::consume_each (int how_many_items) -{ - d_detail->consume_each (how_many_items); -} - -void -gr_block::produce (int which_output, int how_many_items) -{ - d_detail->produce (which_output, how_many_items); -} - -int -gr_block::fixed_rate_ninput_to_noutput(int ninput) -{ - throw std::runtime_error("Unimplemented"); -} - -int -gr_block::fixed_rate_noutput_to_ninput(int noutput) -{ - throw std::runtime_error("Unimplemented"); -} - -uint64_t -gr_block::nitems_read(unsigned int which_input) -{ - if(d_detail) { - return d_detail->nitems_read(which_input); - } - else { - //throw std::runtime_error("No block_detail associated with block yet"); - return 0; - } -} - -uint64_t -gr_block::nitems_written(unsigned int which_output) -{ - if(d_detail) { - return d_detail->nitems_written(which_output); - } - else { - //throw std::runtime_error("No block_detail associated with block yet"); - return 0; - } -} - -void -gr_block::add_item_tag(unsigned int which_output, - const gr_tag_t &tag) -{ - d_detail->add_item_tag(which_output, tag); -} - -void -gr_block::remove_item_tag(unsigned int which_input, - const gr_tag_t &tag) -{ - d_detail->remove_item_tag(which_input, tag, unique_id()); -} - -void -gr_block::get_tags_in_range(std::vector<gr_tag_t> &v, - unsigned int which_output, - uint64_t start, uint64_t end) -{ - d_detail->get_tags_in_range(v, which_output, start, end, unique_id()); -} - -void -gr_block::get_tags_in_range(std::vector<gr_tag_t> &v, - unsigned int which_output, - uint64_t start, uint64_t end, - const pmt::pmt_t &key) -{ - d_detail->get_tags_in_range(v, which_output, start, end, key, unique_id()); -} - -gr_block::tag_propagation_policy_t -gr_block::tag_propagation_policy() -{ - return d_tag_propagation_policy; -} - -void -gr_block::set_tag_propagation_policy(tag_propagation_policy_t p) -{ - d_tag_propagation_policy = p; -} - - -int -gr_block::max_noutput_items() -{ - return d_max_noutput_items; -} - -void -gr_block::set_max_noutput_items(int m) -{ - if(m <= 0) - throw std::runtime_error("gr_block::set_max_noutput_items: value for max_noutput_items must be greater than 0.\n"); - - d_max_noutput_items = m; - d_max_noutput_items_set = true; -} - -void -gr_block::unset_max_noutput_items() -{ - d_max_noutput_items_set = false; -} - -bool -gr_block::is_set_max_noutput_items() -{ - return d_max_noutput_items_set; -} - -void -gr_block::set_processor_affinity(const std::vector<int> &mask) -{ - d_affinity = mask; - if(d_detail) { - d_detail->set_processor_affinity(d_affinity); - } -} - -void -gr_block::unset_processor_affinity() -{ - d_affinity.clear(); - if(d_detail) { - d_detail->unset_processor_affinity(); - } -} - -float -gr_block::pc_noutput_items() -{ - if(d_detail) { - return d_detail->pc_noutput_items(); - } - else { - return 0; - } -} - -float -gr_block::pc_noutput_items_avg() -{ - if(d_detail) { - return d_detail->pc_noutput_items_avg(); - } - else { - return 0; - } -} - -float -gr_block::pc_noutput_items_var() -{ - if(d_detail) { - return d_detail->pc_noutput_items_var(); - } - else { - return 0; - } -} - -float -gr_block::pc_nproduced() -{ - if(d_detail) { - return d_detail->pc_nproduced(); - } - else { - return 0; - } -} - -float -gr_block::pc_nproduced_avg() -{ - if(d_detail) { - return d_detail->pc_nproduced_avg(); - } - else { - return 0; - } -} - -float -gr_block::pc_nproduced_var() -{ - if(d_detail) { - return d_detail->pc_nproduced_var(); - } - else { - return 0; - } -} - -float -gr_block::pc_input_buffers_full(int which) -{ - if(d_detail) { - return d_detail->pc_input_buffers_full(static_cast<size_t>(which)); - } - else { - return 0; - } -} - -float -gr_block::pc_input_buffers_full_avg(int which) -{ - if(d_detail) { - return d_detail->pc_input_buffers_full_avg(static_cast<size_t>(which)); - } - else { - return 0; - } -} - -float -gr_block::pc_input_buffers_full_var(int which) -{ - if(d_detail) { - return d_detail->pc_input_buffers_full_var(static_cast<size_t>(which)); - } - else { - return 0; - } -} - -std::vector<float> -gr_block::pc_input_buffers_full() -{ - if(d_detail) { - return d_detail->pc_input_buffers_full(); - } - else { - return std::vector<float>(1,0); - } -} - -std::vector<float> -gr_block::pc_input_buffers_full_avg() -{ - if(d_detail) { - return d_detail->pc_input_buffers_full_avg(); - } - else { - return std::vector<float>(1,0); - } -} - -std::vector<float> -gr_block::pc_input_buffers_full_var() -{ - if(d_detail) { - return d_detail->pc_input_buffers_full_var(); - } - else { - return std::vector<float>(1,0); - } -} - -float -gr_block::pc_output_buffers_full(int which) -{ - if(d_detail) { - return d_detail->pc_output_buffers_full(static_cast<size_t>(which)); - } - else { - return 0; - } -} - -float -gr_block::pc_output_buffers_full_avg(int which) -{ - if(d_detail) { - return d_detail->pc_output_buffers_full_avg(static_cast<size_t>(which)); - } - else { - return 0; - } -} - -float -gr_block::pc_output_buffers_full_var(int which) -{ - if(d_detail) { - return d_detail->pc_output_buffers_full_var(static_cast<size_t>(which)); - } - else { - return 0; - } -} - -std::vector<float> -gr_block::pc_output_buffers_full() -{ - if(d_detail) { - return d_detail->pc_output_buffers_full(); - } - else { - return std::vector<float>(1,0); - } -} - -std::vector<float> -gr_block::pc_output_buffers_full_avg() -{ - if(d_detail) { - return d_detail->pc_output_buffers_full_avg(); - } - else { - return std::vector<float>(1,0); - } -} - -std::vector<float> -gr_block::pc_output_buffers_full_var() -{ - if(d_detail) { - return d_detail->pc_output_buffers_full_var(); - } - else { - return std::vector<float>(1,0); - } -} - -float -gr_block::pc_work_time() -{ - if(d_detail) { - return d_detail->pc_work_time(); - } - else { - return 0; - } -} - -float -gr_block::pc_work_time_avg() -{ - if(d_detail) { - return d_detail->pc_work_time_avg(); - } - else { - return 0; - } -} - -float -gr_block::pc_work_time_var() -{ - if(d_detail) { - return d_detail->pc_work_time_var(); - } - else { - return 0; - } -} - -void -gr_block::reset_perf_counters() -{ - if(d_detail) { - d_detail->reset_perf_counters(); - } -} - -void -gr_block::setup_pc_rpc() -{ - d_pc_rpc_set = true; -#ifdef GR_CTRLPORT - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, float>( - alias(), "noutput_items", &gr_block::pc_noutput_items, - pmt::mp(0), pmt::mp(32768), pmt::mp(0), - "", "noutput items", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, float>( - alias(), "avg noutput_items", &gr_block::pc_noutput_items_avg, - pmt::mp(0), pmt::mp(32768), pmt::mp(0), - "", "Average noutput items", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, float>( - alias(), "var noutput_items", &gr_block::pc_noutput_items_var, - pmt::mp(0), pmt::mp(32768), pmt::mp(0), - "", "Var. noutput items", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, float>( - alias(), "nproduced", &gr_block::pc_nproduced, - pmt::mp(0), pmt::mp(32768), pmt::mp(0), - "", "items produced", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, float>( - alias(), "avg nproduced", &gr_block::pc_nproduced_avg, - pmt::mp(0), pmt::mp(32768), pmt::mp(0), - "", "Average items produced", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, float>( - alias(), "var nproduced", &gr_block::pc_nproduced_var, - pmt::mp(0), pmt::mp(32768), pmt::mp(0), - "", "Var. items produced", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, float>( - alias(), "work time", &gr_block::pc_work_time, - pmt::mp(0), pmt::mp(1e9), pmt::mp(0), - "", "clock cycles in call to work", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, float>( - alias(), "avg work time", &gr_block::pc_work_time_avg, - pmt::mp(0), pmt::mp(1e9), pmt::mp(0), - "", "Average clock cycles in call to work", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, float>( - alias(), "var work time", &gr_block::pc_work_time_var, - pmt::mp(0), pmt::mp(1e9), pmt::mp(0), - "", "Var. clock cycles in call to work", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, std::vector<float> >( - alias(), "input \% full", &gr_block::pc_input_buffers_full, - pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), - "", "how full input buffers are", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, std::vector<float> >( - alias(), "avg input \% full", &gr_block::pc_input_buffers_full_avg, - pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), - "", "Average of how full input buffers are", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, std::vector<float> >( - alias(), "var input \% full", &gr_block::pc_input_buffers_full_var, - pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), - "", "Var. of how full input buffers are", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, std::vector<float> >( - alias(), "output \% full", &gr_block::pc_output_buffers_full, - pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), - "", "how full output buffers are", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, std::vector<float> >( - alias(), "avg output \% full", &gr_block::pc_output_buffers_full_avg, - pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), - "", "Average of how full output buffers are", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_block, std::vector<float> >( - alias(), "var output \% full", &gr_block::pc_output_buffers_full_var, - pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), - "", "Var. of how full output buffers are", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); -#endif /* GR_CTRLPORT */ -} - -std::ostream& -operator << (std::ostream& os, const gr_block *m) -{ - os << "<gr_block " << m->name() << " (" << m->unique_id() << ")>"; - return os; -} - -int -gr_block::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - throw std::runtime_error("gr_block::general_work() not implemented"); - return 0; -} diff --git a/gnuradio-runtime/lib/gr_block_detail.cc b/gnuradio-runtime/lib/gr_block_detail.cc deleted file mode 100644 index 0b12b1728b..0000000000 --- a/gnuradio-runtime/lib/gr_block_detail.cc +++ /dev/null @@ -1,477 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2009,2010,2013 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_block_detail.h> -#include <gr_buffer.h> -#include <iostream> - -static long s_ncurrently_allocated = 0; - -long -gr_block_detail_ncurrently_allocated () -{ - return s_ncurrently_allocated; -} - -gr_block_detail::gr_block_detail (unsigned int ninputs, unsigned int noutputs) - : d_produce_or(0), - d_ninputs (ninputs), d_noutputs (noutputs), - d_input (ninputs), d_output (noutputs), - d_done (false), - d_ins_noutput_items(0), - d_avg_noutput_items(0), - d_var_noutput_items(0), - d_ins_nproduced(0), - d_avg_nproduced(0), - d_var_nproduced(0), - d_ins_input_buffers_full(ninputs, 0), - d_avg_input_buffers_full(ninputs, 0), - d_var_input_buffers_full(ninputs, 0), - d_ins_output_buffers_full(noutputs, 0), - d_avg_output_buffers_full(noutputs, 0), - d_var_output_buffers_full(noutputs, 0), - d_ins_work_time(0), - d_avg_work_time(0), - d_var_work_time(0), - d_pc_counter(0) -{ - s_ncurrently_allocated++; -} - -gr_block_detail::~gr_block_detail () -{ - // should take care of itself - s_ncurrently_allocated--; -} - -void -gr_block_detail::set_input (unsigned int which, gr_buffer_reader_sptr reader) -{ - if (which >= d_ninputs) - throw std::invalid_argument ("gr_block_detail::set_input"); - - d_input[which] = reader; -} - -void -gr_block_detail::set_output (unsigned int which, gr_buffer_sptr buffer) -{ - if (which >= d_noutputs) - throw std::invalid_argument ("gr_block_detail::set_output"); - - d_output[which] = buffer; -} - -gr_block_detail_sptr -gr_make_block_detail (unsigned int ninputs, unsigned int noutputs) -{ - return gr_block_detail_sptr (new gr_block_detail (ninputs, noutputs)); -} - -void -gr_block_detail::set_done (bool done) -{ - d_done = done; - for (unsigned int i = 0; i < d_noutputs; i++) - d_output[i]->set_done (done); - - for (unsigned int i = 0; i < d_ninputs; i++) - d_input[i]->set_done (done); -} - -void -gr_block_detail::consume (int which_input, int how_many_items) -{ - if (how_many_items > 0) { - input (which_input)->update_read_pointer (how_many_items); - } -} - - -void -gr_block_detail::consume_each (int how_many_items) -{ - if (how_many_items > 0) { - for (int i = 0; i < ninputs (); i++) { - d_input[i]->update_read_pointer (how_many_items); - } - } -} - -void -gr_block_detail::produce (int which_output, int how_many_items) -{ - if (how_many_items > 0){ - d_output[which_output]->update_write_pointer (how_many_items); - d_produce_or |= how_many_items; - } -} - -void -gr_block_detail::produce_each (int how_many_items) -{ - if (how_many_items > 0) { - for (int i = 0; i < noutputs (); i++) { - d_output[i]->update_write_pointer (how_many_items); - } - d_produce_or |= how_many_items; - } -} - - -uint64_t -gr_block_detail::nitems_read(unsigned int which_input) -{ - if(which_input >= d_ninputs) - throw std::invalid_argument ("gr_block_detail::n_input_items"); - return d_input[which_input]->nitems_read(); -} - -uint64_t -gr_block_detail::nitems_written(unsigned int which_output) -{ - if(which_output >= d_noutputs) - throw std::invalid_argument ("gr_block_detail::n_output_items"); - return d_output[which_output]->nitems_written(); -} - -void -gr_block_detail::add_item_tag(unsigned int which_output, const gr_tag_t &tag) -{ - if(!pmt::is_symbol(tag.key)) { - throw pmt::wrong_type("gr_block_detail::add_item_tag key", tag.key); - } - else { - // Add tag to gr_buffer's deque tags - d_output[which_output]->add_item_tag(tag); - } -} - -void -gr_block_detail::remove_item_tag(unsigned int which_input, const gr_tag_t &tag, long id) -{ - if(!pmt::is_symbol(tag.key)) { - throw pmt::wrong_type("gr_block_detail::add_item_tag key", tag.key); - } - else { - // Add tag to gr_buffer's deque tags - d_input[which_input]->buffer()->remove_item_tag(tag, id); - } -} - -void -gr_block_detail::get_tags_in_range(std::vector<gr_tag_t> &v, - unsigned int which_input, - uint64_t abs_start, - uint64_t abs_end, - long id) -{ - // get from gr_buffer_reader's deque of tags - d_input[which_input]->get_tags_in_range(v, abs_start, abs_end, id); -} - -void -gr_block_detail::get_tags_in_range(std::vector<gr_tag_t> &v, - unsigned int which_input, - uint64_t abs_start, - uint64_t abs_end, - const pmt::pmt_t &key, - long id) -{ - std::vector<gr_tag_t> found_items; - - v.resize(0); - - // get from gr_buffer_reader's deque of tags - d_input[which_input]->get_tags_in_range(found_items, abs_start, abs_end, id); - - // Filter further by key name - pmt::pmt_t itemkey; - std::vector<gr_tag_t>::iterator itr; - for(itr = found_items.begin(); itr != found_items.end(); itr++) { - itemkey = (*itr).key; - if(pmt::eqv(key, itemkey)) { - v.push_back(*itr); - } - } -} - -void -gr_block_detail::set_processor_affinity(const std::vector<int> &mask) -{ - if(threaded) { - try { - gr::thread::thread_bind_to_processor(thread, mask); - } - catch (std::runtime_error e) { - std::cerr << "set_processor_affinity: invalid mask." << std::endl;; - } - } -} - -void -gr_block_detail::unset_processor_affinity() -{ - if(threaded) { - gr::thread::thread_unbind(thread); - } -} - -void -gr_block_detail::start_perf_counters() -{ - d_start_of_work = gr::high_res_timer_now(); -} - -void -gr_block_detail::stop_perf_counters(int noutput_items, int nproduced) -{ - d_end_of_work = gr::high_res_timer_now(); - gr::high_res_timer_type diff = d_end_of_work - d_start_of_work; - - if(d_pc_counter == 0) { - d_ins_work_time = diff; - d_avg_work_time = diff; - d_var_work_time = 0; - d_ins_nproduced = nproduced; - d_avg_nproduced = nproduced; - d_var_nproduced = 0; - d_ins_noutput_items = noutput_items; - d_avg_noutput_items = noutput_items; - d_var_noutput_items = 0; - for(size_t i=0; i < d_input.size(); i++) { - float pfull = static_cast<float>(d_input[i]->items_available()) / - static_cast<float>(d_input[i]->max_possible_items_available()); - d_ins_input_buffers_full[i] = pfull; - d_avg_input_buffers_full[i] = pfull; - d_var_input_buffers_full[i] = 0; - } - for(size_t i=0; i < d_output.size(); i++) { - gr::thread::scoped_lock guard(*d_output[i]->mutex()); - float pfull = 1.0f - static_cast<float>(d_output[i]->space_available()) / - static_cast<float>(d_output[i]->bufsize()); - d_ins_output_buffers_full[i] = pfull; - d_avg_output_buffers_full[i] = pfull; - d_var_output_buffers_full[i] = 0; - } - } - else { - float d = diff - d_avg_work_time; - d_ins_work_time = diff; - d_avg_work_time = d_avg_work_time + d/d_pc_counter; - d_var_work_time = d_var_work_time + d*d; - - d = nproduced - d_avg_nproduced; - d_ins_nproduced = nproduced; - d_avg_nproduced = d_avg_nproduced + d/d_pc_counter; - d_var_nproduced = d_var_nproduced + d*d; - - d = noutput_items - d_avg_noutput_items; - d_ins_noutput_items = noutput_items; - d_avg_noutput_items = d_avg_noutput_items + d/d_pc_counter; - d_var_noutput_items = d_var_noutput_items + d*d; - - for(size_t i=0; i < d_input.size(); i++) { - float pfull = static_cast<float>(d_input[i]->items_available()) / - static_cast<float>(d_input[i]->max_possible_items_available()); - - d = pfull - d_avg_input_buffers_full[i]; - d_ins_input_buffers_full[i] = pfull; - d_avg_input_buffers_full[i] = d_avg_input_buffers_full[i] + d/d_pc_counter; - d_var_input_buffers_full[i] = d_var_input_buffers_full[i] + d*d; - } - - for(size_t i=0; i < d_output.size(); i++) { - gr::thread::scoped_lock guard(*d_output[i]->mutex()); - float pfull = 1.0f - static_cast<float>(d_output[i]->space_available()) / - static_cast<float>(d_output[i]->bufsize()); - - d = pfull - d_avg_output_buffers_full[i]; - d_ins_output_buffers_full[i] = pfull; - d_avg_output_buffers_full[i] = d_avg_output_buffers_full[i] + d/d_pc_counter; - d_var_output_buffers_full[i] = d_var_output_buffers_full[i] + d*d; - } - } - - d_pc_counter++; -} - -void -gr_block_detail::reset_perf_counters() -{ - d_pc_counter = 0; -} - -float -gr_block_detail::pc_noutput_items() -{ - return d_ins_noutput_items; -} - -float -gr_block_detail::pc_nproduced() -{ - return d_ins_nproduced; -} - -float -gr_block_detail::pc_input_buffers_full(size_t which) -{ - if(which < d_ins_input_buffers_full.size()) - return d_ins_input_buffers_full[which]; - else - return 0; -} - -std::vector<float> -gr_block_detail::pc_input_buffers_full() -{ - return d_ins_input_buffers_full; -} - -float -gr_block_detail::pc_output_buffers_full(size_t which) -{ - if(which < d_ins_output_buffers_full.size()) - return d_ins_output_buffers_full[which]; - else - return 0; -} - -std::vector<float> -gr_block_detail::pc_output_buffers_full() -{ - return d_ins_output_buffers_full; -} - -float -gr_block_detail::pc_work_time() -{ - return d_ins_work_time; -} - -float -gr_block_detail::pc_noutput_items_avg() -{ - return d_avg_noutput_items; -} - -float -gr_block_detail::pc_nproduced_avg() -{ - return d_avg_nproduced; -} - -float -gr_block_detail::pc_input_buffers_full_avg(size_t which) -{ - if(which < d_avg_input_buffers_full.size()) - return d_avg_input_buffers_full[which]; - else - return 0; -} - -std::vector<float> -gr_block_detail::pc_input_buffers_full_avg() -{ - return d_avg_input_buffers_full; -} - -float -gr_block_detail::pc_output_buffers_full_avg(size_t which) -{ - if(which < d_avg_output_buffers_full.size()) - return d_avg_output_buffers_full[which]; - else - return 0; -} - -std::vector<float> -gr_block_detail::pc_output_buffers_full_avg() -{ - return d_avg_output_buffers_full; -} - -float -gr_block_detail::pc_work_time_avg() -{ - return d_avg_work_time; -} - - -float -gr_block_detail::pc_noutput_items_var() -{ - return d_var_noutput_items/(d_pc_counter-1); -} - -float -gr_block_detail::pc_nproduced_var() -{ - return d_var_nproduced/(d_pc_counter-1); -} - -float -gr_block_detail::pc_input_buffers_full_var(size_t which) -{ - if(which < d_avg_input_buffers_full.size()) - return d_var_input_buffers_full[which]/(d_pc_counter-1); - else - return 0; -} - -std::vector<float> -gr_block_detail::pc_input_buffers_full_var() -{ - std::vector<float> var(d_avg_input_buffers_full.size(), 0); - for(size_t i = 0; i < d_avg_input_buffers_full.size(); i++) - var[i] = d_avg_input_buffers_full[i]/(d_pc_counter-1); - return var; -} - -float -gr_block_detail::pc_output_buffers_full_var(size_t which) -{ - if(which < d_avg_output_buffers_full.size()) - return d_var_output_buffers_full[which]/(d_pc_counter-1); - else - return 0; -} - -std::vector<float> -gr_block_detail::pc_output_buffers_full_var() -{ - std::vector<float> var(d_avg_output_buffers_full.size(), 0); - for(size_t i = 0; i < d_avg_output_buffers_full.size(); i++) - var[i] = d_avg_output_buffers_full[i]/(d_pc_counter-1); - return var; -} - -float -gr_block_detail::pc_work_time_var() -{ - return d_var_work_time/(d_pc_counter-1); -} diff --git a/gnuradio-runtime/lib/gr_block_executor.cc b/gnuradio-runtime/lib/gr_block_executor.cc deleted file mode 100644 index bb781c90a1..0000000000 --- a/gnuradio-runtime/lib/gr_block_executor.cc +++ /dev/null @@ -1,487 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008,2009,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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_block_executor.h> -#include <gr_block.h> -#include <gr_block_detail.h> -#include <gr_buffer.h> -#include <gr_prefs.h> -#include <boost/thread.hpp> -#include <boost/format.hpp> -#include <iostream> -#include <limits> -#include <assert.h> -#include <stdio.h> - -// must be defined to either 0 or 1 -#define ENABLE_LOGGING 0 - -#if (ENABLE_LOGGING) -#define LOG(x) do { x; } while(0) -#else -#define LOG(x) do {;} while(0) -#endif - -static int which_scheduler = 0; - -inline static unsigned int -round_up (unsigned int n, unsigned int multiple) -{ - return ((n + multiple - 1) / multiple) * multiple; -} - -inline static unsigned int -round_down (unsigned int n, unsigned int multiple) -{ - return (n / multiple) * multiple; -} - -// -// Return minimum available write space in all our downstream buffers -// or -1 if we're output blocked and the output we're blocked -// on is done. -// -static int -min_available_space (gr_block_detail *d, int output_multiple, int min_noutput_items) -{ - int min_space = std::numeric_limits<int>::max(); - if (min_noutput_items == 0) - min_noutput_items = 1; - for (int i = 0; i < d->noutputs (); i++){ - gr::thread::scoped_lock guard(*d->output(i)->mutex()); - int avail_n = round_down(d->output(i)->space_available(), output_multiple); - int best_n = round_down(d->output(i)->bufsize()/2, output_multiple); - if (best_n < min_noutput_items) - throw std::runtime_error("Buffer too small for min_noutput_items"); - int n = std::min(avail_n, best_n); - if (n < min_noutput_items){ // We're blocked on output. - if (d->output(i)->done()){ // Downstream is done, therefore we're done. - return -1; - } - return 0; - } - min_space = std::min (min_space, n); - } - return min_space; -} - -static bool -propagate_tags(gr_block::tag_propagation_policy_t policy, gr_block_detail *d, - const std::vector<uint64_t> &start_nitems_read, double rrate, - std::vector<gr_tag_t> &rtags, long block_id) -{ - // Move tags downstream - // if a sink, we don't need to move downstream - if(d->sink_p()) { - return true; - } - - switch(policy) { - case gr_block::TPP_DONT: - return true; - break; - case gr_block::TPP_ALL_TO_ALL: - // every tag on every input propogates to everyone downstream - for(int i = 0; i < d->ninputs(); i++) { - d->get_tags_in_range(rtags, i, start_nitems_read[i], - d->nitems_read(i), block_id); - - std::vector<gr_tag_t>::iterator t; - if(rrate == 1.0) { - for(t = rtags.begin(); t != rtags.end(); t++) { - for(int o = 0; o < d->noutputs(); o++) - d->output(o)->add_item_tag(*t); - } - } - else { - for(t = rtags.begin(); t != rtags.end(); t++) { - gr_tag_t new_tag = *t; - new_tag.offset *= rrate; - for(int o = 0; o < d->noutputs(); o++) - d->output(o)->add_item_tag(new_tag); - } - } - } - break; - case gr_block::TPP_ONE_TO_ONE: - // tags from input i only go to output i - // this requires d->ninputs() == d->noutputs; this is checked when this - // type of tag-propagation system is selected in gr_block_detail - if(d->ninputs() == d->noutputs()) { - for(int i = 0; i < d->ninputs(); i++) { - d->get_tags_in_range(rtags, i, start_nitems_read[i], - d->nitems_read(i), block_id); - - std::vector<gr_tag_t>::iterator t; - for(t = rtags.begin(); t != rtags.end(); t++) { - gr_tag_t new_tag = *t; - new_tag.offset *= rrate; - d->output(i)->add_item_tag(new_tag); - } - } - } - else { - std::cerr << "Error: gr_block_executor: propagation_policy 'ONE-TO-ONE' requires ninputs == noutputs" << std::endl; - return false; - } - - break; - default: - return true; - } - return true; -} - -gr_block_executor::gr_block_executor (gr_block_sptr block, int max_noutput_items) - : d_block(block), d_log(0), d_max_noutput_items(max_noutput_items) -{ - if (ENABLE_LOGGING){ - 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; - } - -#ifdef GR_PERFORMANCE_COUNTERS - gr_prefs *prefs = gr_prefs::singleton(); - d_use_pc = prefs->get_bool("PerfCounters", "on", false); -#endif /* GR_PERFORMANCE_COUNTERS */ - - d_block->start(); // enable any drivers, etc. -} - -gr_block_executor::~gr_block_executor () -{ - if (ENABLE_LOGGING) - delete d_log; - - d_block->stop(); // stop any drivers, etc. -} - -gr_block_executor::state -gr_block_executor::run_one_iteration() -{ - int noutput_items; - int max_items_avail; - int max_noutput_items = d_max_noutput_items; - int new_alignment=0; - int alignment_state=-1; - - gr_block *m = d_block.get(); - gr_block_detail *d = m->detail().get(); - - LOG(*d_log << std::endl << m); - - if (d->done()){ - assert(0); - return DONE; - } - - if (d->source_p ()){ - d_ninput_items_required.resize (0); - d_ninput_items.resize (0); - d_input_items.resize (0); - d_input_done.resize(0); - d_output_items.resize (d->noutputs ()); - d_start_nitems_read.resize(0); - - // determine the minimum available output space - noutput_items = min_available_space (d, m->output_multiple (), m->min_noutput_items ()); - noutput_items = std::min(noutput_items, max_noutput_items); - LOG(*d_log << " source\n noutput_items = " << noutput_items << std::endl); - if (noutput_items == -1) // we're done - goto were_done; - - if (noutput_items == 0){ // we're output blocked - LOG(*d_log << " BLKD_OUT\n"); - return BLKD_OUT; - } - - goto setup_call_to_work; // jump to common code - } - - else if (d->sink_p ()){ - d_ninput_items_required.resize (d->ninputs ()); - d_ninput_items.resize (d->ninputs ()); - d_input_items.resize (d->ninputs ()); - d_input_done.resize(d->ninputs()); - d_output_items.resize (0); - d_start_nitems_read.resize(d->ninputs()); - LOG(*d_log << " sink\n"); - - max_items_avail = 0; - for (int i = 0; i < d->ninputs (); i++){ - { - /* - * Acquire the mutex and grab local copies of items_available and done. - */ - gr::thread::scoped_lock guard(*d->input(i)->mutex()); - d_ninput_items[i] = d->input(i)->items_available(); - d_input_done[i] = d->input(i)->done(); - } - - LOG(*d_log << " d_ninput_items[" << i << "] = " << d_ninput_items[i] << std::endl); - LOG(*d_log << " d_input_done[" << i << "] = " << d_input_done[i] << std::endl); - - if (d_ninput_items[i] < m->output_multiple() && d_input_done[i]) - goto were_done; - - max_items_avail = std::max (max_items_avail, d_ninput_items[i]); - } - - // take a swag at how much output we can sink - noutput_items = (int) (max_items_avail * m->relative_rate ()); - noutput_items = round_down (noutput_items, m->output_multiple ()); - noutput_items = std::min(noutput_items, max_noutput_items); - LOG(*d_log << " max_items_avail = " << max_items_avail << std::endl); - LOG(*d_log << " noutput_items = " << noutput_items << std::endl); - - if (noutput_items == 0){ // we're blocked on input - LOG(*d_log << " BLKD_IN\n"); - return BLKD_IN; - } - - goto try_again; // Jump to code shared with regular case. - } - - else { - // do the regular thing - d_ninput_items_required.resize (d->ninputs ()); - d_ninput_items.resize (d->ninputs ()); - d_input_items.resize (d->ninputs ()); - d_input_done.resize(d->ninputs()); - d_output_items.resize (d->noutputs ()); - d_start_nitems_read.resize(d->ninputs()); - - max_items_avail = 0; - for (int i = 0; i < d->ninputs (); i++){ - { - /* - * Acquire the mutex and grab local copies of items_available and done. - */ - gr::thread::scoped_lock guard(*d->input(i)->mutex()); - d_ninput_items[i] = d->input(i)->items_available (); - d_input_done[i] = d->input(i)->done(); - } - max_items_avail = std::max (max_items_avail, d_ninput_items[i]); - } - - // determine the minimum available output space - noutput_items = min_available_space (d, m->output_multiple (), m->min_noutput_items ()); - if (ENABLE_LOGGING){ - *d_log << " regular "; - if (m->relative_rate() >= 1.0) - *d_log << "1:" << m->relative_rate() << std::endl; - else - *d_log << 1.0/m->relative_rate() << ":1\n"; - *d_log << " max_items_avail = " << max_items_avail << std::endl; - *d_log << " noutput_items = " << noutput_items << std::endl; - } - if (noutput_items == -1) // we're done - goto were_done; - - if (noutput_items == 0){ // we're output blocked - LOG(*d_log << " BLKD_OUT\n"); - return BLKD_OUT; - } - - try_again: - if (m->fixed_rate()){ - // try to work it forward starting with max_items_avail. - // We want to try to consume all the input we've got. - int reqd_noutput_items = m->fixed_rate_ninput_to_noutput(max_items_avail); - - // only test this if we specifically set the output_multiple - if(m->output_multiple_set()) - reqd_noutput_items = round_down(reqd_noutput_items, m->output_multiple()); - - if (reqd_noutput_items > 0 && reqd_noutput_items <= noutput_items) - noutput_items = reqd_noutput_items; - - // if we need this many outputs, overrule the max_noutput_items setting - max_noutput_items = std::max(m->output_multiple(), max_noutput_items); - } - noutput_items = std::min(noutput_items, max_noutput_items); - - // Check if we're still unaligned; use up items until we're - // aligned again. Otherwise, make sure we set the alignment - // requirement. - if(!m->output_multiple_set()) { - if(m->is_unaligned()) { - // When unaligned, don't just set noutput_items to the remaining - // samples to meet alignment; this causes too much overhead in - // requiring a premature call back here. Set the maximum amount - // of samples to handle unalignment and get us back aligned. - if(noutput_items >= m->unaligned()) { - noutput_items = round_up(noutput_items, m->alignment()) \ - - (m->alignment() - m->unaligned()); - new_alignment = 0; - } - else { - new_alignment = m->unaligned() - noutput_items; - } - alignment_state = 0; - } - else if(noutput_items < m->alignment()) { - // if we don't have enough for an aligned call, keep track of - // misalignment, set unaligned flag, and proceed. - new_alignment = m->alignment() - noutput_items; - m->set_unaligned(new_alignment); - m->set_is_unaligned(true); - alignment_state = 1; - } - else { - // enough to round down to the nearest alignment and process. - noutput_items = round_down(noutput_items, m->alignment()); - m->set_is_unaligned(false); - alignment_state = 2; - } - } - - // ask the block how much input they need to produce noutput_items - m->forecast (noutput_items, d_ninput_items_required); - - // See if we've got sufficient input available - - int i; - for (i = 0; i < d->ninputs (); i++) - if (d_ninput_items_required[i] > d_ninput_items[i]) // not enough - break; - - if (i < d->ninputs ()){ // not enough input on input[i] - // if we can, try reducing the size of our output request - if (noutput_items > m->output_multiple ()){ - noutput_items /= 2; - noutput_items = round_up (noutput_items, m->output_multiple ()); - goto try_again; - } - - // We're blocked on input - LOG(*d_log << " BLKD_IN\n"); - if (d_input_done[i]) // If the upstream block is done, we're done - goto were_done; - - // Is it possible to ever fulfill this request? - if (d_ninput_items_required[i] > d->input(i)->max_possible_items_available ()){ - // Nope, never going to happen... - std::cerr << "\nsched: <gr_block " << m->name() - << " (" << m->unique_id() << ")>" - << " is requesting more input data\n" - << " than we can provide.\n" - << " ninput_items_required = " - << d_ninput_items_required[i] << "\n" - << " max_possible_items_available = " - << d->input(i)->max_possible_items_available() << "\n" - << " If this is a filter, consider reducing the number of taps.\n"; - goto were_done; - } - - // If we were made unaligned in this round but return here without - // processing; reset the unalignment claim before next entry. - if(alignment_state == 1) { - m->set_unaligned(0); - m->set_is_unaligned(false); - } - return BLKD_IN; - } - - // We've got enough data on each input to produce noutput_items. - // Finish setting up the call to work. - - for (int i = 0; i < d->ninputs (); i++) - d_input_items[i] = d->input(i)->read_pointer(); - - setup_call_to_work: - - d->d_produce_or = 0; - for (int i = 0; i < d->noutputs (); i++) - d_output_items[i] = d->output(i)->write_pointer(); - - // determine where to start looking for new tags - for (int i = 0; i < d->ninputs(); i++) - d_start_nitems_read[i] = d->nitems_read(i); - -#ifdef GR_PERFORMANCE_COUNTERS - if(d_use_pc) - d->start_perf_counters(); -#endif /* GR_PERFORMANCE_COUNTERS */ - - // Do the actual work of the block - int n = m->general_work (noutput_items, d_ninput_items, - d_input_items, d_output_items); - -#ifdef GR_PERFORMANCE_COUNTERS - if(d_use_pc) - d->stop_perf_counters(noutput_items, n); -#endif /* GR_PERFORMANCE_COUNTERS */ - - LOG(*d_log << " general_work: noutput_items = " << noutput_items - << " result = " << n << std::endl); - - // Adjust number of unaligned items left to process - if(m->is_unaligned()) { - m->set_unaligned(new_alignment); - m->set_is_unaligned(m->unaligned() != 0); - } - - if(!propagate_tags(m->tag_propagation_policy(), d, - d_start_nitems_read, m->relative_rate(), - d_returned_tags, m->unique_id())) - goto were_done; - - if (n == gr_block::WORK_DONE) - goto were_done; - - if (n != gr_block::WORK_CALLED_PRODUCE) - d->produce_each (n); // advance write pointers - - if (d->d_produce_or > 0) // block produced something - return READY; - - // We didn't produce any output even though we called general_work. - // We have (most likely) consumed some input. - - /* - // If this is a source, it's broken. - if (d->source_p()){ - std::cerr << "gr_block_executor: source " << m - << " produced no output. We're marking it DONE.\n"; - // FIXME maybe we ought to raise an exception... - goto were_done; - } - */ - - // Have the caller try again... - return READY_NO_OUTPUT; - } - assert (0); - - were_done: - LOG(*d_log << " were_done\n"); - d->set_done (true); - return DONE; -} diff --git a/gnuradio-runtime/lib/gr_block_executor.h b/gnuradio-runtime/lib/gr_block_executor.h deleted file mode 100644 index 7d5c4949a3..0000000000 --- a/gnuradio-runtime/lib/gr_block_executor.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008 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. - */ - -#ifndef INCLUDED_GR_BLOCK_EXECUTOR_H -#define INCLUDED_GR_BLOCK_EXECUTOR_H - -#include <gr_runtime_api.h> -#include <gr_runtime_types.h> -#include <fstream> -#include <gr_tags.h> - -//class gr_block_executor; -//typedef boost::shared_ptr<gr_block_executor> gr_block_executor_sptr; - - -/*! - * \brief Manage the execution of a single block. - * \ingroup internal - */ - -class GR_RUNTIME_API gr_block_executor { -protected: - gr_block_sptr d_block; // The block we're trying to run - std::ofstream *d_log; - - // These are allocated here so we don't have to on each iteration - - gr_vector_int d_ninput_items_required; - gr_vector_int d_ninput_items; - gr_vector_const_void_star d_input_items; - std::vector<bool> d_input_done; - gr_vector_void_star d_output_items; - std::vector<uint64_t> d_start_nitems_read; //stores where tag counts are before work - std::vector<gr_tag_t> d_returned_tags; - int d_max_noutput_items; - -#ifdef GR_PERFORMANCE_COUNTERS - bool d_use_pc; -#endif /* GR_PERFORMANCE_COUNTERS */ - - public: - gr_block_executor(gr_block_sptr block, int max_noutput_items=100000); - ~gr_block_executor (); - - enum state { - READY, // We made progress; everything's cool. - READY_NO_OUTPUT, // We consumed some input, but produced no output. - BLKD_IN, // no progress; we're blocked waiting for input data. - BLKD_OUT, // no progress; we're blocked waiting for output buffer space. - DONE, // we're done; don't call me again. - }; - - /* - * \brief Run one iteration. - */ - state run_one_iteration(); -}; - -#endif /* INCLUDED_GR_BLOCK_EXECUTOR_H */ diff --git a/gnuradio-runtime/lib/gr_block_registry.cc b/gnuradio-runtime/lib/gr_block_registry.cc deleted file mode 100644 index a80673691a..0000000000 --- a/gnuradio-runtime/lib/gr_block_registry.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012-2013 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. - */ - -#include <gr_basic_block.h> -#include <gr_block_registry.h> -#include <gr_tpb_detail.h> -#include <gr_block_detail.h> -#include <gr_block.h> -#include <stdio.h> - -gr_block_registry global_block_registry; - -gr_block_registry::gr_block_registry(){ - d_ref_map = pmt::make_dict(); -} - -long gr_block_registry::block_register(gr_basic_block* block){ - if(d_map.find(block->name()) == d_map.end()){ - d_map[block->name()] = blocksubmap_t(); - d_map[block->name()][0] = block; - return 0; - } else { - for(size_t i=0; i<=d_map[block->name()].size(); i++){ - if(d_map[block->name()].find(i) == d_map[block->name()].end()){ - d_map[block->name()][i] = block; - return i; - } - } - } - throw std::runtime_error("should not reach this"); -} - -void gr_block_registry::block_unregister(gr_basic_block* block){ - d_map[block->name()].erase( d_map[block->name()].find(block->symbolic_id())); - d_ref_map = pmt::dict_delete(d_ref_map, pmt::intern(block->symbol_name())); - if(block->alias_set()){ - d_ref_map = pmt::dict_delete(d_ref_map, pmt::intern(block->alias())); - } -} - -std::string gr_block_registry::register_symbolic_name(gr_basic_block* block){ - std::stringstream ss; - ss << block->name() << block->symbolic_id(); - //std::cout << "register_symbolic_name: " << ss.str() << std::endl; - register_symbolic_name(block, ss.str()); - return ss.str(); -} - -void gr_block_registry::register_symbolic_name(gr_basic_block* block, std::string name){ - if(pmt::dict_has_key(d_ref_map, pmt::intern(name))){ - throw std::runtime_error("symbol already exists, can not re-use!"); - } - d_ref_map = pmt::dict_add(d_ref_map, pmt::intern(name), pmt::make_any(block)); -} - -gr_basic_block_sptr gr_block_registry::block_lookup(pmt::pmt_t symbol){ - pmt::pmt_t ref = pmt::dict_ref(d_ref_map, symbol, pmt::PMT_NIL); - if(pmt::eq(ref, pmt::PMT_NIL)){ - throw std::runtime_error("block lookup failed! block not found!"); - } - gr_basic_block* blk = boost::any_cast<gr_basic_block*>( pmt::any_ref(ref) ); - return blk->shared_from_this(); -} - - -void gr_block_registry::register_primitive(std::string blk, gr_block* ref){ - primitive_map[blk] = ref; -} - -void gr_block_registry::unregister_primitive(std::string blk){ - primitive_map.erase(primitive_map.find(blk)); -} - -void gr_block_registry::notify_blk(std::string blk){ - if(primitive_map.find(blk) == primitive_map.end()){ return; } - if(primitive_map[blk]->detail().get()) - primitive_map[blk]->detail()->d_tpb.notify_msg(); -} - diff --git a/gnuradio-runtime/lib/gr_buffer.cc b/gnuradio-runtime/lib/gr_buffer.cc deleted file mode 100644 index 8e325490fc..0000000000 --- a/gnuradio-runtime/lib/gr_buffer.cc +++ /dev/null @@ -1,352 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2009,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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_buffer.h> -#include <gr_vmcircbuf.h> -#include <gr_math.h> -#include <stdexcept> -#include <iostream> -#include <assert.h> -#include <algorithm> -#include <boost/math/common_factor_rt.hpp> - -static long s_buffer_count = 0; // counts for debugging storage mgmt -static long s_buffer_reader_count = 0; - -// ---------------------------------------------------------------------------- -// Notes on storage management -// -// Pretty much all the fundamental classes are now using the -// shared_ptr stuff for automatic reference counting. To ensure that -// no mistakes are made, we make the constructors for classes private, -// and then provide a free factory function that returns a smart -// pointer to the desired class. -// -// gr_buffer and gr_buffer_reader are no exceptions. However, they -// both want pointers to each other, and unless we do something, we'll -// never delete any of them because of the circular structure. -// They'll always have a reference count of at least one. We could -// use boost::weak_ptr's from gr_buffer to gr_buffer_reader but that -// introduces it's own problems. (gr_buffer_reader's destructor needs -// to call gr_buffer::drop_reader, but has no easy way to get a -// shared_ptr to itself.) -// -// Instead, we solve this problem by having gr_buffer hold a raw -// pointer to gr_buffer_reader in its d_reader vector. -// gr_buffer_reader's destructor calls gr_buffer::drop_reader, so -// we're never left with an dangling pointer. gr_buffer_reader still -// has a shared_ptr to the buffer ensuring that the buffer doesn't go -// away under it. However, when the reference count of a -// gr_buffer_reader goes to zero, we can successfully reclaim it. -// ---------------------------------------------------------------------------- - - -/* - * Compute the minimum number of buffer items that work (i.e., - * address space wrap-around works). To work is to satisfy this - * contraint for integer buffer_size and k: - * - * type_size * nitems == k * page_size - */ -static long -minimum_buffer_items (long type_size, long page_size) -{ - return page_size / boost::math::gcd (type_size, page_size); -} - - -gr_buffer::gr_buffer (int nitems, size_t sizeof_item, gr_block_sptr link) - : d_base (0), d_bufsize (0), d_vmcircbuf (0), - d_sizeof_item (sizeof_item), d_link(link), - d_write_index (0), d_abs_write_offset(0), d_done (false), - d_last_min_items_read(0) -{ - if (!allocate_buffer (nitems, sizeof_item)) - throw std::bad_alloc (); - - s_buffer_count++; -} - -gr_buffer_sptr -gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link) -{ - return gr_buffer_sptr (new gr_buffer (nitems, sizeof_item, link)); -} - -gr_buffer::~gr_buffer () -{ - delete d_vmcircbuf; - assert (d_readers.size() == 0); - s_buffer_count--; -} - -/*! - * sets d_vmcircbuf, d_base, d_bufsize. - * returns true iff successful. - */ -bool -gr_buffer::allocate_buffer (int nitems, size_t sizeof_item) -{ - int orig_nitems = nitems; - - // Any buffersize we come up with must be a multiple of min_nitems. - - int granularity = gr_vmcircbuf_sysconfig::granularity (); - int min_nitems = minimum_buffer_items (sizeof_item, granularity); - - // Round-up nitems to a multiple of min_nitems. - - if (nitems % min_nitems != 0) - nitems = ((nitems / min_nitems) + 1) * min_nitems; - - // If we rounded-up a whole bunch, give the user a heads up. - // This only happens if sizeof_item is not a power of two. - - if (nitems > 2 * orig_nitems && nitems * (int) sizeof_item > granularity){ - std::cerr << "gr_buffer::allocate_buffer: warning: tried to allocate\n" - << " " << orig_nitems << " items of size " - << sizeof_item << ". Due to alignment requirements\n" - << " " << nitems << " were allocated. If this isn't OK, consider padding\n" - << " your structure to a power-of-two bytes.\n" - << " On this platform, our allocation granularity is " << granularity << " bytes.\n"; - } - - d_bufsize = nitems; - d_vmcircbuf = gr_vmcircbuf_sysconfig::make (d_bufsize * d_sizeof_item); - if (d_vmcircbuf == 0){ - std::cerr << "gr_buffer::allocate_buffer: failed to allocate buffer of size " - << d_bufsize * d_sizeof_item / 1024 << " KB\n"; - return false; - } - - d_base = (char *) d_vmcircbuf->pointer_to_first_copy (); - return true; -} - - -int -gr_buffer::space_available () -{ - if (d_readers.empty ()) - return d_bufsize - 1; // See comment below - - else { - - // Find out the maximum amount of data available to our readers - - int most_data = d_readers[0]->items_available (); - uint64_t min_items_read = d_readers[0]->nitems_read(); - for (size_t i = 1; i < d_readers.size (); i++) { - most_data = std::max (most_data, d_readers[i]->items_available ()); - min_items_read = std::min(min_items_read, d_readers[i]->nitems_read()); - } - - if(min_items_read != d_last_min_items_read) { - prune_tags(d_last_min_items_read); - d_last_min_items_read = min_items_read; - } - - // The -1 ensures that the case d_write_index == d_read_index is - // unambiguous. It indicates that there is no data for the reader - - return d_bufsize - most_data - 1; - } -} - -void * -gr_buffer::write_pointer () -{ - return &d_base[d_write_index * d_sizeof_item]; -} - -void -gr_buffer::update_write_pointer (int nitems) -{ - gr::thread::scoped_lock guard(*mutex()); - d_write_index = index_add (d_write_index, nitems); - d_abs_write_offset += nitems; -} - -void -gr_buffer::set_done (bool done) -{ - gr::thread::scoped_lock guard(*mutex()); - d_done = done; -} - -gr_buffer_reader_sptr -gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link) -{ - if (nzero_preload < 0) - throw std::invalid_argument("gr_buffer_add_reader: nzero_preload must be >= 0"); - - gr_buffer_reader_sptr r (new gr_buffer_reader (buf, - buf->index_sub(buf->d_write_index, - nzero_preload), - link)); - buf->d_readers.push_back (r.get ()); - - return r; -} - -void -gr_buffer::drop_reader (gr_buffer_reader *reader) -{ - // isn't C++ beautiful... GAG! - - std::vector<gr_buffer_reader *>::iterator result = - std::find (d_readers.begin (), d_readers.end (), reader); - - if (result == d_readers.end ()) - throw std::invalid_argument ("gr_buffer::drop_reader"); // we didn't find it... - - d_readers.erase (result); -} - -void -gr_buffer::add_item_tag(const gr_tag_t &tag) -{ - gr::thread::scoped_lock guard(*mutex()); - d_item_tags.push_back(tag); -} - -void -gr_buffer::remove_item_tag(const gr_tag_t &tag, long id) -{ - gr::thread::scoped_lock guard(*mutex()); - for (std::deque<gr_tag_t>::iterator it = d_item_tags.begin(); it != d_item_tags.end(); ++it) { - if (*it == tag) { - (*it).marked_deleted.push_back(id); - } - } -} - -void -gr_buffer::prune_tags(uint64_t max_time) -{ - /* NOTE: this function _should_ lock the mutex before editing - d_item_tags. In practice, this function is only called at - runtime by min_available_space in gr_block_executor.cc, - which locks the mutex itself. - - If this function is used elsewhere, remember to lock the - buffer's mutex al la the scoped_lock line below. - */ - //gr::thread::scoped_lock guard(*mutex()); - std::deque<gr_tag_t>::iterator itr = d_item_tags.begin(); - - uint64_t item_time; - - // Since tags are not guarenteed to be in any particular order, - // we need to erase here instead of pop_front. An erase in the - // middle invalidates all iterators; so this resets the iterator - // to find more. Mostly, we wil be erasing from the front and - // therefore lose little time this way. - while(itr != d_item_tags.end()) { - item_time = (*itr).offset; - if(item_time < max_time) { - d_item_tags.erase(itr); - itr = d_item_tags.begin(); - } - else - itr++; - } -} - -long -gr_buffer_ncurrently_allocated () -{ - return s_buffer_count; -} - -// ---------------------------------------------------------------------------- - -gr_buffer_reader::gr_buffer_reader(gr_buffer_sptr buffer, unsigned int read_index, - gr_block_sptr link) - : d_buffer(buffer), d_read_index(read_index), d_abs_read_offset(0), d_link(link) -{ - s_buffer_reader_count++; -} - -gr_buffer_reader::~gr_buffer_reader () -{ - d_buffer->drop_reader(this); - s_buffer_reader_count--; -} - -int -gr_buffer_reader::items_available () const -{ - return d_buffer->index_sub (d_buffer->d_write_index, d_read_index); -} - -const void * -gr_buffer_reader::read_pointer () -{ - return &d_buffer->d_base[d_read_index * d_buffer->d_sizeof_item]; -} - -void -gr_buffer_reader::update_read_pointer (int nitems) -{ - gr::thread::scoped_lock guard(*mutex()); - d_read_index = d_buffer->index_add (d_read_index, nitems); - d_abs_read_offset += nitems; -} - -void -gr_buffer_reader::get_tags_in_range(std::vector<gr_tag_t> &v, - uint64_t abs_start, - uint64_t abs_end, - long id) -{ - gr::thread::scoped_lock guard(*mutex()); - - v.resize(0); - std::deque<gr_tag_t>::iterator itr = d_buffer->get_tags_begin(); - - uint64_t item_time; - while(itr != d_buffer->get_tags_end()) { - item_time = (*itr).offset; - - if((item_time >= abs_start) && (item_time < abs_end)) { - std::vector<long>::iterator id_itr; - id_itr = std::find(itr->marked_deleted.begin(), itr->marked_deleted.end(), id); - if (id_itr == itr->marked_deleted.end()) { // If id is not in the vector of marked blocks - v.push_back(*itr); - v.back().marked_deleted.clear(); - } - } - - itr++; - } -} - -long -gr_buffer_reader_ncurrently_allocated () -{ - return s_buffer_reader_count; -} diff --git a/gnuradio-runtime/lib/gr_circular_file.cc b/gnuradio-runtime/lib/gr_circular_file.cc deleted file mode 100644 index 6f710c49b1..0000000000 --- a/gnuradio-runtime/lib/gr_circular_file.cc +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_circular_file.h> - -#include <unistd.h> -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <fcntl.h> -#include <stdio.h> -#include <assert.h> -#include <stdlib.h> - -#include <algorithm> -#include <stdio.h> -#include <string.h> - -#ifdef HAVE_IO_H -#include <io.h> -#endif - -static const int HEADER_SIZE = 4096; -static const int HEADER_MAGIC = 0xEB021026; - -static const int HD_MAGIC = 0; -static const int HD_HEADER_SIZE = 1; // integer offsets into header -static const int HD_BUFFER_SIZE = 2; -static const int HD_BUFFER_BASE = 3; -static const int HD_BUFFER_CURRENT = 4; - -gr_circular_file::gr_circular_file (const char *filename, - bool writable, int size) - : d_fd (-1), d_header (0), d_buffer (0), d_mapped_size (0), d_bytes_read (0) -{ - int mm_prot; - if (writable){ -#ifdef HAVE_MMAP - mm_prot = PROT_READ | PROT_WRITE; -#endif - d_fd = open (filename, O_CREAT | O_RDWR | O_TRUNC, 0664); - if (d_fd < 0){ - perror (filename); - exit (1); - } -#ifdef HAVE_MMAP /* FIXME */ - if(ftruncate (d_fd, size + HEADER_SIZE) != 0) { - perror (filename); - exit (1); - } -#endif - } - else { -#ifdef HAVE_MMAP - mm_prot = PROT_READ; -#endif - d_fd = open (filename, O_RDONLY); - if (d_fd < 0){ - perror (filename); - exit (1); - } - } - - struct stat statbuf; - if (fstat (d_fd, &statbuf) < 0){ - perror (filename); - exit (1); - } - - if (statbuf.st_size < HEADER_SIZE){ - fprintf (stderr, "%s: file too small to be circular buffer\n", filename); - exit (1); - } - - d_mapped_size = statbuf.st_size; -#ifdef HAVE_MMAP - void *p = mmap (0, d_mapped_size, mm_prot, MAP_SHARED, d_fd, 0); - if (p == MAP_FAILED){ - perror ("gr_circular_file: mmap failed"); - exit (1); - } - - d_header = (int *) p; -#else - perror ("gr_circular_file: mmap unsupported by this system"); - exit (1); -#endif - - if (writable){ // init header - - if (size < 0){ - fprintf (stderr, "gr_circular_buffer: size must be > 0 when writable\n"); - exit (1); - } - - d_header[HD_MAGIC] = HEADER_MAGIC; - d_header[HD_HEADER_SIZE] = HEADER_SIZE; - d_header[HD_BUFFER_SIZE] = size; - d_header[HD_BUFFER_BASE] = HEADER_SIZE; // right after header - d_header[HD_BUFFER_CURRENT] = 0; - } - - // sanity check (the asserts are a bit unforgiving...) - - assert (d_header[HD_MAGIC] == HEADER_MAGIC); - assert (d_header[HD_HEADER_SIZE] == HEADER_SIZE); - assert (d_header[HD_BUFFER_SIZE] > 0); - assert (d_header[HD_BUFFER_BASE] >= d_header[HD_HEADER_SIZE]); - assert (d_header[HD_BUFFER_BASE] + d_header[HD_BUFFER_SIZE] <= d_mapped_size); - assert (d_header[HD_BUFFER_CURRENT] >= 0 && - d_header[HD_BUFFER_CURRENT] < d_header[HD_BUFFER_SIZE]); - - d_bytes_read = 0; - d_buffer = (unsigned char *) d_header + d_header[HD_BUFFER_BASE]; -} - -gr_circular_file::~gr_circular_file () -{ -#ifdef HAVE_MMAP - if (munmap ((char *) d_header, d_mapped_size) < 0){ - perror ("gr_circular_file: munmap"); - exit (1); - } -#endif - close (d_fd); -} - -bool -gr_circular_file::write (void *vdata, int nbytes) -{ - unsigned char *data = (unsigned char *) vdata; - int buffer_size = d_header[HD_BUFFER_SIZE]; - int buffer_current = d_header[HD_BUFFER_CURRENT]; - - while (nbytes > 0){ - int n = std::min (nbytes, buffer_size - buffer_current); - memcpy (d_buffer + buffer_current, data, n); - - buffer_current += n; - if (buffer_current >= buffer_size) - buffer_current = 0; - - data += n; - nbytes -= n; - } - - d_header[HD_BUFFER_CURRENT] = buffer_current; - return true; -} - -int -gr_circular_file::read (void *vdata, int nbytes) -{ - unsigned char *data = (unsigned char *) vdata; - int buffer_current = d_header[HD_BUFFER_CURRENT]; - int buffer_size = d_header[HD_BUFFER_SIZE]; - int total = 0; - - nbytes = std::min (nbytes, buffer_size - d_bytes_read); - - while (nbytes > 0){ - int offset = (buffer_current + d_bytes_read) % buffer_size; - int n = std::min (nbytes, buffer_size - offset); - memcpy (data, d_buffer + offset, n); - data += n; - d_bytes_read += n; - total += n; - nbytes -= n; - } - return total; -} - -void -gr_circular_file::reset_read_pointer () -{ - d_bytes_read = 0; -} diff --git a/gnuradio-runtime/lib/gr_circular_file.h b/gnuradio-runtime/lib/gr_circular_file.h deleted file mode 100644 index 2b61bf2711..0000000000 --- a/gnuradio-runtime/lib/gr_circular_file.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#ifndef _GR_CIRCULAR_FILE_H_ -#define _GR_CIRCULAR_FILE_H_ - -#include <gr_runtime_api.h> - -/* - * writes input data into a circular buffer on disk. - * - * the file contains a fixed header: - * 0x0000: int32 magic (0xEB021026) - * 0x0004: int32 size in bytes of header (constant 4096) - * 0x0008: int32 size in bytes of circular buffer (not including header) - * 0x000C: int32 file offset to beginning of circular buffer - * 0x0010: int32 byte offset from beginning of circular buffer to - * current start of data - * - */ -class GR_RUNTIME_API gr_circular_file { - int d_fd; - int *d_header; - unsigned char *d_buffer; - int d_mapped_size; - int d_bytes_read; - -public: - gr_circular_file (const char *filename, bool writable = false, int size = 0); - ~gr_circular_file (); - - bool write (void *data, int nbytes); - - // returns # of bytes actually read or 0 if end of buffer, or -1 on error. - int read (void *data, int nbytes); - - // reset read pointer to beginning of buffer. - void reset_read_pointer (); -}; - -#endif /* _GR_CIRCULAR_FILE_H_ */
\ No newline at end of file diff --git a/gnuradio-runtime/lib/gr_dispatcher.cc b/gnuradio-runtime/lib/gr_dispatcher.cc deleted file mode 100644 index 96ebe9ad8b..0000000000 --- a/gnuradio-runtime/lib/gr_dispatcher.cc +++ /dev/null @@ -1,193 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_dispatcher.h> -#include <math.h> -#include <errno.h> -#include <stdio.h> - -#ifdef HAVE_SELECT -# ifdef HAVE_SYS_SELECT_H -# include <sys/select.h> -# else -# ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -# endif -# ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> -# endif -# ifdef HAVE_UNISTD_H -# include <unistd.h> -# endif -# endif -#endif - - -static gr_dispatcher_sptr s_singleton; - -gr_dispatcher_sptr -gr_make_dispatcher() -{ - return gr_dispatcher_sptr(new gr_dispatcher()); -} - -gr_dispatcher_sptr -gr_dispatcher_singleton() -{ - if (s_singleton) - return s_singleton; - - s_singleton = gr_make_dispatcher(); - return s_singleton; -} - -#if !defined(HAVE_SELECT) // Stub it out - -gr_dispatcher::gr_dispatcher() -{ -} - -gr_dispatcher::~gr_dispatcher() -{ -} - -bool -gr_dispatcher::add_handler(gr_select_handler_sptr handler) -{ - return true; -} - -bool -gr_dispatcher::del_handler(gr_select_handler_sptr handler) -{ - return true; -} - -bool -gr_dispatcher::del_handler(gr_select_handler *handler) -{ - return true; -} - -void -gr_dispatcher::loop(double timeout) -{ -} - -#else // defined(HAVE_SELECT) - -gr_dispatcher::gr_dispatcher() - : d_handler(FD_SETSIZE), d_max_index(-1) -{ -} - -gr_dispatcher::~gr_dispatcher() -{ -} - -bool -gr_dispatcher::add_handler(gr_select_handler_sptr handler) -{ - int fd = handler->fd(); - if (fd < 0 || fd >= FD_SETSIZE) - return false; - - d_max_index = std::max(d_max_index, fd); - d_handler[fd] = handler; - return true; -} - -bool -gr_dispatcher::del_handler(gr_select_handler_sptr handler) -{ - return del_handler(handler.get()); -} - -bool -gr_dispatcher::del_handler(gr_select_handler *handler) -{ - int fd = handler->fd(); - if (fd < 0 || fd >= FD_SETSIZE) - return false; - - d_handler[fd].reset(); - - if (fd == d_max_index){ - int i; - for (i = fd - 1; i >= 0 && !d_handler[i]; i--) - ; - d_max_index = i; - } - return true; -} - - -void -gr_dispatcher::loop(double timeout) -{ - struct timeval master; - struct timeval tmp; - fd_set rd_set; - fd_set wr_set; - - double secs = floor (timeout); - master.tv_sec = (long) secs; - master.tv_usec = (long) ((timeout - secs) * 1e6); - - while (d_max_index >= 0){ - FD_ZERO(&rd_set); - FD_ZERO(&wr_set); - - for (int i = 0; i <= d_max_index; i++){ - if (d_handler[i] && d_handler[i]->readable()) - FD_SET(i, &rd_set); - if (d_handler[i] && d_handler[i]->writable()) - FD_SET(i, &wr_set); - } - - tmp = master; - int retval = select(d_max_index+1, &rd_set, &wr_set, 0, &tmp); - if (retval == 0) // timed out with nothing ready - continue; - if (retval < 0){ - if (errno == EINTR) - continue; - perror ("gr_dispatcher/select"); - return; - } - - for (int i = 0; i <= d_max_index; i++){ - if (FD_ISSET(i, &rd_set)) - if (d_handler[i]) - d_handler[i]->handle_read(); - if (FD_ISSET(i, &wr_set)) - if (d_handler[i]) - d_handler[i]->handle_write(); - } - } -} - -#endif diff --git a/gnuradio-runtime/lib/gr_error_handler.cc b/gnuradio-runtime/lib/gr_error_handler.cc deleted file mode 100644 index 448682966e..0000000000 --- a/gnuradio-runtime/lib/gr_error_handler.cc +++ /dev/null @@ -1,244 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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 code is based on error.cc from the "Click Modular Router". - * Original copyright follows: - */ -/* - * error.{cc,hh} -- flexible classes for error reporting - * Eddie Kohler - * - * Copyright (c) 1999-2000 Massachusetts Institute of Technology - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, subject to the conditions - * listed in the Click LICENSE file. These conditions include: you must - * preserve this copyright notice, and you cannot mention the copyright - * holders in advertising related to the Software without their permission. - * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This - * notice is a summary of the Click LICENSE file; the license in that file is - * legally binding. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_error_handler.h> -#include <assert.h> -#include <stdexcept> -#include <unistd.h> - -#ifdef HAVE_IO_H -#include <io.h> -#endif - -static gr_error_handler *s_default_handler = 0; -static gr_error_handler *s_silent_handler = 0; - -bool -gr_error_handler::has_default_handler() -{ - return s_default_handler != 0; -} - -void -gr_error_handler::set_default_handler(gr_error_handler *errh) -{ - s_default_handler = errh; -} - -gr_error_handler * -gr_error_handler::default_handler() -{ - assert (s_default_handler != 0); - return s_default_handler; -} - -gr_error_handler * -gr_error_handler::silent_handler() -{ - assert (s_silent_handler != 0); - return s_silent_handler; -} - -// ---------------------------------------------------------------- - -gr_error_handler::~gr_error_handler() -{ - // nop -} - -void -gr_error_handler::debug(const char *format, ...) -{ - va_list val; - va_start(val, format); - verror(ERR_DEBUG, format, val); - va_end(val); -} - -void -gr_error_handler::message(const char *format, ...) -{ - va_list val; - va_start(val, format); - verror(ERR_MESSAGE, format, val); - va_end(val); -} - -void -gr_error_handler::warning(const char *format, ...) -{ - va_list val; - va_start(val, format); - verror(ERR_WARNING, format, val); - va_end(val); -} - -void -gr_error_handler::error(const char *format, ...) -{ - va_list val; - va_start(val, format); - verror(ERR_ERROR, format, val); - va_end(val); -} - -void -gr_error_handler::fatal(const char *format, ...) -{ - va_list val; - va_start(val, format); - verror(ERR_FATAL, format, val); - va_end(val); -} - -void -gr_error_handler::verror(seriousness s, const char *format, va_list val) -{ - std::string text = make_text(s, format, val); - handle_text(s, text); - count_error(s); -} - -void -gr_error_handler::verror_text(seriousness s, const std::string &text) -{ - // text is already made - handle_text(s, text); - count_error(s); -} - -std::string -gr_error_handler::make_text(seriousness s, const char *format, va_list val) -{ - char text_buf[4096]; - vsnprintf(text_buf, sizeof(text_buf), format, val); - text_buf[sizeof(text_buf)-1] = 0; - return text_buf; -} - -// ---------------------------------------------------------------- - -void -gr_base_error_handler::count_error(seriousness s) -{ - if (s < ERR_WARNING) - /* do nothing */; - else if (s < ERR_ERROR) - d_nwarnings++; - else - d_nerrors++; -} - -// ---------------------------------------------------------------- - -gr_file_error_handler::gr_file_error_handler(FILE *file) - : d_file(file), d_fd(-1) -{ -} - -gr_file_error_handler::gr_file_error_handler(int file_descriptor) -{ - d_fd = dup(file_descriptor); // so we can fclose it - if (d_fd == -1){ - perror("gr_file_error_handler:dup"); - throw std::invalid_argument("gr_file_error_handler:dup"); - } - d_file = fdopen(d_fd, "w"); - if (d_file == 0){ - perror("gr_file_error_handler:fdopen"); - throw std::invalid_argument("gr_file_error_handler:fdopen"); - } -} - -gr_file_error_handler::~gr_file_error_handler() -{ - if (d_fd != -1){ - fclose(d_file); - } -} - -void -gr_file_error_handler::handle_text(seriousness s, const std::string &text) -{ - if (text.length() <= 0) - return; - - fwrite(text.data(), 1, text.length(), d_file); - if (text[text.length()-1] != '\n') - fwrite("\n", 1, 1, d_file); - - if (d_fd != -1) - fflush(d_file); // keep synced with any other users of fd -} - - -// ---------------------------------------------------------------- -// static error handlers -// - -class gr_silent_error_handler : public gr_base_error_handler -{ -public: - gr_silent_error_handler() {} - void handle_text(seriousness s, const std::string &str); -}; - -void -gr_silent_error_handler::handle_text(seriousness s, const std::string &str) -{ - // nop -} - -class force_init { -public: - force_init() - { - s_default_handler = new gr_file_error_handler(stdout); - s_silent_handler = new gr_silent_error_handler(); - } -}; - -static force_init kludge; diff --git a/gnuradio-runtime/lib/gr_fast_atan2f.cc b/gnuradio-runtime/lib/gr_fast_atan2f.cc deleted file mode 100644 index 8b7bfea12e..0000000000 --- a/gnuradio-runtime/lib/gr_fast_atan2f.cc +++ /dev/null @@ -1,199 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ - -#include <gr_math.h> // declaration is in here -#include <cmath> - -#define REAL float - -/***************************************************************************/ -/* Constant definitions */ -/***************************************************************************/ - -#define TAN_MAP_RES 0.003921569 /* (smallest non-zero value in table) */ -#define RAD_PER_DEG 0.017453293 -#define TAN_MAP_SIZE 256 - -/* arctangents from 0 to pi/4 radians */ -static REAL -fast_atan_table[257] = { - 0.000000e+00, 3.921549e-03, 7.842976e-03, 1.176416e-02, - 1.568499e-02, 1.960533e-02, 2.352507e-02, 2.744409e-02, - 3.136226e-02, 3.527947e-02, 3.919560e-02, 4.311053e-02, - 4.702413e-02, 5.093629e-02, 5.484690e-02, 5.875582e-02, - 6.266295e-02, 6.656816e-02, 7.047134e-02, 7.437238e-02, - 7.827114e-02, 8.216752e-02, 8.606141e-02, 8.995267e-02, - 9.384121e-02, 9.772691e-02, 1.016096e-01, 1.054893e-01, - 1.093658e-01, 1.132390e-01, 1.171087e-01, 1.209750e-01, - 1.248376e-01, 1.286965e-01, 1.325515e-01, 1.364026e-01, - 1.402496e-01, 1.440924e-01, 1.479310e-01, 1.517652e-01, - 1.555948e-01, 1.594199e-01, 1.632403e-01, 1.670559e-01, - 1.708665e-01, 1.746722e-01, 1.784728e-01, 1.822681e-01, - 1.860582e-01, 1.898428e-01, 1.936220e-01, 1.973956e-01, - 2.011634e-01, 2.049255e-01, 2.086818e-01, 2.124320e-01, - 2.161762e-01, 2.199143e-01, 2.236461e-01, 2.273716e-01, - 2.310907e-01, 2.348033e-01, 2.385093e-01, 2.422086e-01, - 2.459012e-01, 2.495869e-01, 2.532658e-01, 2.569376e-01, - 2.606024e-01, 2.642600e-01, 2.679104e-01, 2.715535e-01, - 2.751892e-01, 2.788175e-01, 2.824383e-01, 2.860514e-01, - 2.896569e-01, 2.932547e-01, 2.968447e-01, 3.004268e-01, - 3.040009e-01, 3.075671e-01, 3.111252e-01, 3.146752e-01, - 3.182170e-01, 3.217506e-01, 3.252758e-01, 3.287927e-01, - 3.323012e-01, 3.358012e-01, 3.392926e-01, 3.427755e-01, - 3.462497e-01, 3.497153e-01, 3.531721e-01, 3.566201e-01, - 3.600593e-01, 3.634896e-01, 3.669110e-01, 3.703234e-01, - 3.737268e-01, 3.771211e-01, 3.805064e-01, 3.838825e-01, - 3.872494e-01, 3.906070e-01, 3.939555e-01, 3.972946e-01, - 4.006244e-01, 4.039448e-01, 4.072558e-01, 4.105574e-01, - 4.138496e-01, 4.171322e-01, 4.204054e-01, 4.236689e-01, - 4.269229e-01, 4.301673e-01, 4.334021e-01, 4.366272e-01, - 4.398426e-01, 4.430483e-01, 4.462443e-01, 4.494306e-01, - 4.526070e-01, 4.557738e-01, 4.589307e-01, 4.620778e-01, - 4.652150e-01, 4.683424e-01, 4.714600e-01, 4.745676e-01, - 4.776654e-01, 4.807532e-01, 4.838312e-01, 4.868992e-01, - 4.899573e-01, 4.930055e-01, 4.960437e-01, 4.990719e-01, - 5.020902e-01, 5.050985e-01, 5.080968e-01, 5.110852e-01, - 5.140636e-01, 5.170320e-01, 5.199904e-01, 5.229388e-01, - 5.258772e-01, 5.288056e-01, 5.317241e-01, 5.346325e-01, - 5.375310e-01, 5.404195e-01, 5.432980e-01, 5.461666e-01, - 5.490251e-01, 5.518738e-01, 5.547124e-01, 5.575411e-01, - 5.603599e-01, 5.631687e-01, 5.659676e-01, 5.687566e-01, - 5.715357e-01, 5.743048e-01, 5.770641e-01, 5.798135e-01, - 5.825531e-01, 5.852828e-01, 5.880026e-01, 5.907126e-01, - 5.934128e-01, 5.961032e-01, 5.987839e-01, 6.014547e-01, - 6.041158e-01, 6.067672e-01, 6.094088e-01, 6.120407e-01, - 6.146630e-01, 6.172755e-01, 6.198784e-01, 6.224717e-01, - 6.250554e-01, 6.276294e-01, 6.301939e-01, 6.327488e-01, - 6.352942e-01, 6.378301e-01, 6.403565e-01, 6.428734e-01, - 6.453808e-01, 6.478788e-01, 6.503674e-01, 6.528466e-01, - 6.553165e-01, 6.577770e-01, 6.602282e-01, 6.626701e-01, - 6.651027e-01, 6.675261e-01, 6.699402e-01, 6.723452e-01, - 6.747409e-01, 6.771276e-01, 6.795051e-01, 6.818735e-01, - 6.842328e-01, 6.865831e-01, 6.889244e-01, 6.912567e-01, - 6.935800e-01, 6.958943e-01, 6.981998e-01, 7.004964e-01, - 7.027841e-01, 7.050630e-01, 7.073330e-01, 7.095943e-01, - 7.118469e-01, 7.140907e-01, 7.163258e-01, 7.185523e-01, - 7.207701e-01, 7.229794e-01, 7.251800e-01, 7.273721e-01, - 7.295557e-01, 7.317307e-01, 7.338974e-01, 7.360555e-01, - 7.382053e-01, 7.403467e-01, 7.424797e-01, 7.446045e-01, - 7.467209e-01, 7.488291e-01, 7.509291e-01, 7.530208e-01, - 7.551044e-01, 7.571798e-01, 7.592472e-01, 7.613064e-01, - 7.633576e-01, 7.654008e-01, 7.674360e-01, 7.694633e-01, - 7.714826e-01, 7.734940e-01, 7.754975e-01, 7.774932e-01, - 7.794811e-01, 7.814612e-01, 7.834335e-01, 7.853983e-01, - 7.853983e-01 - }; - - -/***************************************************************************** -Function: Arc tangent - -Syntax: angle = fast_atan2(y, x); -REAL y y component of input vector -REAL x x component of input vector -REAL angle angle of vector (x, y) in radians - -Description: This function calculates the angle of the vector (x,y) based -on a table lookup and linear interpolation. The table uses -a 256 point table covering -45 to +45 degrees and uses -symetry to determine the final angle value in the range of --180 to 180 degrees. Note that this function uses the small -angle approximation for values close to zero. This routine -calculates the arc tangent with an average error of -+/- 0.045 degrees. -*****************************************************************************/ - -REAL -gr_fast_atan2f(REAL y, REAL x) -{ - REAL x_abs, y_abs, z; - REAL alpha, angle, base_angle; - int index; - - /* don't divide by zero! */ // FIXME could get hosed with -0.0 - if ((y == 0.0) && (x == 0.0)) - return 0.0; - - /* normalize to +/- 45 degree range */ - y_abs = fabs(y); - x_abs = fabs(x); - //z = (y_abs < x_abs ? y_abs / x_abs : x_abs / y_abs); - if (y_abs < x_abs) - z = y_abs / x_abs; - else - z = x_abs / y_abs; - - /* when ratio approaches the table resolution, the angle is */ - /* best approximated with the argument itself... */ - if (z < TAN_MAP_RES) - base_angle = z; - else { - /* find index and interpolation value */ - alpha = z * (REAL) TAN_MAP_SIZE - .5; - index = (int) alpha; - alpha -= (REAL) index; - /* determine base angle based on quadrant and */ - /* add or subtract table value from base angle based on quadrant */ - base_angle = fast_atan_table[index]; - base_angle += - (fast_atan_table[index + 1] - fast_atan_table[index]) * alpha; - } - - if (x_abs > y_abs) { /* -45 -> 45 or 135 -> 225 */ - if (x >= 0.0) { /* -45 -> 45 */ - if (y >= 0.0) - angle = base_angle; /* 0 -> 45, angle OK */ - else - angle = -base_angle; /* -45 -> 0, angle = -angle */ - } else { /* 135 -> 180 or 180 -> -135 */ - angle = 3.14159265358979323846; - if (y >= 0.0) - angle -= base_angle; /* 135 -> 180, angle = 180 - angle */ - else - angle = base_angle - angle; /* 180 -> -135, angle = angle - 180 */ - } - } else { /* 45 -> 135 or -135 -> -45 */ - if (y >= 0.0) { /* 45 -> 135 */ - angle = 1.57079632679489661923; - if (x >= 0.0) - angle -= base_angle; /* 45 -> 90, angle = 90 - angle */ - else - angle += base_angle; /* 90 -> 135, angle = 90 + angle */ - } else { /* -135 -> -45 */ - angle = -1.57079632679489661923; - if (x >= 0.0) - angle += base_angle; /* -90 -> -45, angle = -90 + angle */ - else - angle -= base_angle; /* -135 -> -90, angle = -90 - angle */ - } - } - -#ifdef ZERO_TO_TWOPI - if (angle < 0) - return (angle + TWOPI); - else - return (angle); -#else - return (angle); -#endif -} - diff --git a/gnuradio-runtime/lib/gr_feval.cc b/gnuradio-runtime/lib/gr_feval.cc deleted file mode 100644 index 89f09984cf..0000000000 --- a/gnuradio-runtime/lib/gr_feval.cc +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_feval.h> - -gr_feval_dd::~gr_feval_dd(){} - -double -gr_feval_dd::eval(double x) -{ - return 0; -} - -double -gr_feval_dd::calleval(double x) -{ - return eval(x); -} - -// ---------------------------------------------------------------- - -gr_feval_cc::~gr_feval_cc(){} - -gr_complex -gr_feval_cc::eval(gr_complex x) -{ - return 0; -} - -gr_complex -gr_feval_cc::calleval(gr_complex x) -{ - return eval(x); -} - -// ---------------------------------------------------------------- - -gr_feval_ll::~gr_feval_ll(){} - -long -gr_feval_ll::eval(long x) -{ - return 0; -} - -long -gr_feval_ll::calleval(long x) -{ - return eval(x); -} - -// ---------------------------------------------------------------- - -gr_feval::~gr_feval(){} - -void -gr_feval::eval(void) -{ - // nop -} - -void -gr_feval::calleval(void) -{ - eval(); -} - -// ---------------------------------------------------------------- - -gr_feval_p::~gr_feval_p(){} - -void -gr_feval_p::eval(pmt::pmt_t x) -{ - // nop -} - -void -gr_feval_p::calleval(pmt::pmt_t x) -{ - eval(x); -} - -/* - * Trivial examples showing C++ (transparently) calling Python - */ -double -gr_feval_dd_example(gr_feval_dd *f, double x) -{ - return f->calleval(x); -} - -gr_complex -gr_feval_cc_example(gr_feval_cc *f, gr_complex x) -{ - return f->calleval(x); -} - -long -gr_feval_ll_example(gr_feval_ll *f, long x) -{ - return f->calleval(x); -} - -void -gr_feval_example(gr_feval *f) -{ - f->calleval(); -} diff --git a/gnuradio-runtime/lib/gr_flat_flowgraph.cc b/gnuradio-runtime/lib/gr_flat_flowgraph.cc deleted file mode 100644 index de1e227ef0..0000000000 --- a/gnuradio-runtime/lib/gr_flat_flowgraph.cc +++ /dev/null @@ -1,427 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_flat_flowgraph.h> -#include <gr_block_detail.h> -#include <gr_io_signature.h> -#include <gr_buffer.h> -#include <gr_prefs.h> -#include <volk/volk.h> -#include <iostream> -#include <map> -#include <boost/format.hpp> - -#define GR_FLAT_FLOWGRAPH_DEBUG 0 - -// 32Kbyte buffer size between blocks -#define GR_FIXED_BUFFER_SIZE (32*(1L<<10)) - -static const unsigned int s_fixed_buffer_size = GR_FIXED_BUFFER_SIZE; - -gr_flat_flowgraph_sptr -gr_make_flat_flowgraph() -{ - return gr_flat_flowgraph_sptr(new gr_flat_flowgraph()); -} - -gr_flat_flowgraph::gr_flat_flowgraph() -{ -} - -gr_flat_flowgraph::~gr_flat_flowgraph() -{ -} - -void -gr_flat_flowgraph::setup_connections() -{ - gr_basic_block_vector_t blocks = calc_used_blocks(); - - // Assign block details to blocks - for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) - cast_to_block_sptr(*p)->set_detail(allocate_block_detail(*p)); - - // Connect inputs to outputs for each block - for(gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) { - connect_block_inputs(*p); - - gr_block_sptr block = cast_to_block_sptr(*p); - block->set_unaligned(0); - block->set_is_unaligned(false); - } - - // Connect message ports connetions - for(gr_msg_edge_viter_t i = d_msg_edges.begin(); i != d_msg_edges.end(); i++){ - if(GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << boost::format("flat_fg connecting msg primitives: (%s, %s)->(%s, %s)\n") % - i->src().block() % i->src().port() % - i->dst().block() % i->dst().port(); - i->src().block()->message_port_sub( i->src().port(), pmt::cons(i->dst().block()->alias_pmt(), i->dst().port()) ); - } - -} - -gr_block_detail_sptr -gr_flat_flowgraph::allocate_block_detail(gr_basic_block_sptr block) -{ - int ninputs = calc_used_ports(block, true).size(); - int noutputs = calc_used_ports(block, false).size(); - gr_block_detail_sptr detail = gr_make_block_detail(ninputs, noutputs); - - gr_block_sptr grblock = cast_to_block_sptr(block); - if(!grblock) - throw std::runtime_error("allocate_block_detail found non-gr_block"); - - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "Creating block detail for " << block << std::endl; - - for (int i = 0; i < noutputs; i++) { - grblock->expand_minmax_buffer(i); - - gr_buffer_sptr buffer = allocate_buffer(block, i); - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "Allocated buffer for output " << block << ":" << i << std::endl; - detail->set_output(i, buffer); - - // Update the block's max_output_buffer based on what was actually allocated. - grblock->set_max_output_buffer(i, buffer->bufsize()); - } - - return detail; -} - -gr_buffer_sptr -gr_flat_flowgraph::allocate_buffer(gr_basic_block_sptr block, int port) -{ - gr_block_sptr grblock = cast_to_block_sptr(block); - if (!grblock) - throw std::runtime_error("allocate_buffer found non-gr_block"); - int item_size = block->output_signature()->sizeof_stream_item(port); - - // *2 because we're now only filling them 1/2 way in order to - // increase the available parallelism when using the TPB scheduler. - // (We're double buffering, where we used to single buffer) - int nitems = s_fixed_buffer_size * 2 / item_size; - - // Make sure there are at least twice the output_multiple no. of items - if (nitems < 2*grblock->output_multiple()) // Note: this means output_multiple() - nitems = 2*grblock->output_multiple(); // can't be changed by block dynamically - - // If any downstream blocks are decimators and/or have a large output_multiple, - // ensure we have a buffer at least twice their decimation factor*output_multiple - gr_basic_block_vector_t blocks = calc_downstream_blocks(block, port); - - // limit buffer size if indicated - if(grblock->max_output_buffer(port) > 0) { -// std::cout << "constraining output items to " << block->max_output_buffer(port) << "\n"; - nitems = std::min((long)nitems, (long)grblock->max_output_buffer(port)); - nitems -= nitems%grblock->output_multiple(); - if( nitems < 1 ) - throw std::runtime_error("problems allocating a buffer with the given max output buffer constraint!"); - } - else if(grblock->min_output_buffer(port) > 0) { - nitems = std::max((long)nitems, (long)grblock->min_output_buffer(port)); - nitems -= nitems%grblock->output_multiple(); - if( nitems < 1 ) - throw std::runtime_error("problems allocating a buffer with the given min output buffer constraint!"); - } - - for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) { - gr_block_sptr dgrblock = cast_to_block_sptr(*p); - if (!dgrblock) - throw std::runtime_error("allocate_buffer found non-gr_block"); - - double decimation = (1.0/dgrblock->relative_rate()); - int multiple = dgrblock->output_multiple(); - int history = dgrblock->history(); - nitems = std::max(nitems, static_cast<int>(2*(decimation*multiple+history))); - } - -// std::cout << "gr_make_buffer(" << nitems << ", " << item_size << ", " << grblock << "\n"; - return gr_make_buffer(nitems, item_size, grblock); -} - -void -gr_flat_flowgraph::connect_block_inputs(gr_basic_block_sptr block) -{ - gr_block_sptr grblock = cast_to_block_sptr(block); - if (!grblock) - throw std::runtime_error("connect_block_inputs found non-gr_block"); - - // Get its detail and edges that feed into it - gr_block_detail_sptr detail = grblock->detail(); - gr_edge_vector_t in_edges = calc_upstream_edges(block); - - // For each edge that feeds into it - for (gr_edge_viter_t e = in_edges.begin(); e != in_edges.end(); e++) { - // Set the buffer reader on the destination port to the output - // buffer on the source port - int dst_port = e->dst().port(); - int src_port = e->src().port(); - gr_basic_block_sptr src_block = e->src().block(); - gr_block_sptr src_grblock = cast_to_block_sptr(src_block); - if (!src_grblock) - throw std::runtime_error("connect_block_inputs found non-gr_block"); - gr_buffer_sptr src_buffer = src_grblock->detail()->output(src_port); - - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "Setting input " << dst_port << " from edge " << (*e) << std::endl; - - detail->set_input(dst_port, gr_buffer_add_reader(src_buffer, grblock->history()-1, grblock)); - } -} - -void -gr_flat_flowgraph::merge_connections(gr_flat_flowgraph_sptr old_ffg) -{ - // Allocate block details if needed. Only new blocks that aren't pruned out - // by flattening will need one; existing blocks still in the new flowgraph will - // already have one. - for (gr_basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) { - gr_block_sptr block = cast_to_block_sptr(*p); - - if (!block->detail()) { - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "merge: allocating new detail for block " << (*p) << std::endl; - block->set_detail(allocate_block_detail(block)); - } - else - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "merge: reusing original detail for block " << (*p) << std::endl; - } - - // Calculate the old edges that will be going away, and clear the buffer readers - // on the RHS. - for (gr_edge_viter_t old_edge = old_ffg->d_edges.begin(); old_edge != old_ffg->d_edges.end(); old_edge++) { - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "merge: testing old edge " << (*old_edge) << "..."; - - gr_edge_viter_t new_edge; - for (new_edge = d_edges.begin(); new_edge != d_edges.end(); new_edge++) - if (new_edge->src() == old_edge->src() && - new_edge->dst() == old_edge->dst()) - break; - - if (new_edge == d_edges.end()) { // not found in new edge list - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "not in new edge list" << std::endl; - // zero the buffer reader on RHS of old edge - gr_block_sptr block(cast_to_block_sptr(old_edge->dst().block())); - int port = old_edge->dst().port(); - block->detail()->set_input(port, gr_buffer_reader_sptr()); - } - else { - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "found in new edge list" << std::endl; - } - } - - // Now connect inputs to outputs, reusing old buffer readers if they exist - for (gr_basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) { - gr_block_sptr block = cast_to_block_sptr(*p); - - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "merge: merging " << (*p) << "..."; - - if (old_ffg->has_block_p(*p)) { - // Block exists in old flow graph - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "used in old flow graph" << std::endl; - gr_block_detail_sptr detail = block->detail(); - - // Iterate through the inputs and see what needs to be done - int ninputs = calc_used_ports(block, true).size(); // Might be different now - for (int i = 0; i < ninputs; i++) { - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "Checking input " << block << ":" << i << "..."; - gr_edge edge = calc_upstream_edge(*p, i); - - // Fish out old buffer reader and see if it matches correct buffer from edge list - gr_block_sptr src_block = cast_to_block_sptr(edge.src().block()); - gr_block_detail_sptr src_detail = src_block->detail(); - gr_buffer_sptr src_buffer = src_detail->output(edge.src().port()); - gr_buffer_reader_sptr old_reader; - if (i < detail->ninputs()) // Don't exceed what the original detail has - old_reader = detail->input(i); - - // If there's a match, use it - if (old_reader && (src_buffer == old_reader->buffer())) { - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "matched, reusing" << std::endl; - } - else { - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "needs a new reader" << std::endl; - - // Create new buffer reader and assign - detail->set_input(i, gr_buffer_add_reader(src_buffer, block->history()-1, block)); - } - } - } - else { - // Block is new, it just needs buffer readers at this point - if (GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << "new block" << std::endl; - connect_block_inputs(block); - - // Make sure all buffers are aligned - setup_buffer_alignment(block); - } - - // Now deal with the fact that the block details might have changed numbers of - // inputs and outputs vs. in the old flowgraph. - } -} - -void -gr_flat_flowgraph::setup_buffer_alignment(gr_block_sptr block) -{ - const int alignment = volk_get_alignment(); - for(int i = 0; i < block->detail()->ninputs(); i++) { - void *r = (void*)block->detail()->input(i)->read_pointer(); - unsigned long int ri = (unsigned long int)r % alignment; - //std::cerr << "reader: " << r << " alignment: " << ri << std::endl; - if(ri != 0) { - size_t itemsize = block->detail()->input(i)->get_sizeof_item(); - block->detail()->input(i)->update_read_pointer(alignment-ri/itemsize); - } - block->set_unaligned(0); - block->set_is_unaligned(false); - } - - for(int i = 0; i < block->detail()->noutputs(); i++) { - void *w = (void*)block->detail()->output(i)->write_pointer(); - unsigned long int wi = (unsigned long int)w % alignment; - //std::cerr << "writer: " << w << " alignment: " << wi << std::endl; - if(wi != 0) { - size_t itemsize = block->detail()->output(i)->get_sizeof_item(); - block->detail()->output(i)->update_write_pointer(alignment-wi/itemsize); - } - block->set_unaligned(0); - block->set_is_unaligned(false); - } -} - -std::string -gr_flat_flowgraph::edge_list() -{ - std::stringstream s; - for(gr_edge_viter_t e = d_edges.begin(); e != d_edges.end(); e++) - s << (*e) << std::endl; - return s.str(); -} - -void gr_flat_flowgraph::dump() -{ - for (gr_edge_viter_t e = d_edges.begin(); e != d_edges.end(); e++) - std::cout << " edge: " << (*e) << std::endl; - - for (gr_basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) { - std::cout << " block: " << (*p) << std::endl; - gr_block_detail_sptr detail = cast_to_block_sptr(*p)->detail(); - std::cout << " detail @" << detail << ":" << std::endl; - - int ni = detail->ninputs(); - int no = detail->noutputs(); - for (int i = 0; i < no; i++) { - gr_buffer_sptr buffer = detail->output(i); - std::cout << " output " << i << ": " << buffer << std::endl; - } - - for (int i = 0; i < ni; i++) { - gr_buffer_reader_sptr reader = detail->input(i); - std::cout << " reader " << i << ": " << reader - << " reading from buffer=" << reader->buffer() << std::endl; - } - } - -} - -gr_block_vector_t -gr_flat_flowgraph::make_block_vector(gr_basic_block_vector_t &blocks) -{ - gr_block_vector_t result; - for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) { - result.push_back(cast_to_block_sptr(*p)); - } - - return result; -} - - -void gr_flat_flowgraph::clear_endpoint(const gr_msg_endpoint &e, bool is_src){ - for(size_t i=0; i<d_msg_edges.size(); i++){ - if(is_src){ - if(d_msg_edges[i].src() == e){ - d_msg_edges.erase(d_msg_edges.begin() + i); - i--; - } - } else { - if(d_msg_edges[i].dst() == e){ - d_msg_edges.erase(d_msg_edges.begin() + i); - i--; - } - } - } -} - -void gr_flat_flowgraph::replace_endpoint(const gr_msg_endpoint &e, const gr_msg_endpoint &r, bool is_src){ - size_t n_replr(0); - if(GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << boost::format("gr_flat_flowgraph::replace_endpoint( %s, %s, %d )\n") % e.block()% r.block()% is_src; - for(size_t i=0; i<d_msg_edges.size(); i++){ - if(is_src){ - if(d_msg_edges[i].src() == e){ - if(GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << boost::format("gr_flat_flowgraph::replace_endpoint() flattening to ( %s, %s )\n") % r.block()% d_msg_edges[i].dst().block(); - d_msg_edges.push_back( gr_msg_edge(r, d_msg_edges[i].dst() ) ); - n_replr++; - } - } else { - if(d_msg_edges[i].dst() == e){ - if(GR_FLAT_FLOWGRAPH_DEBUG) - std::cout << boost::format("gr_flat_flowgraph::replace_endpoint() flattening to ( %s, %s )\n") % r.block()% d_msg_edges[i].dst().block(); - d_msg_edges.push_back( gr_msg_edge(d_msg_edges[i].src(), r ) ); - n_replr++; - } - } - } -} - -void -gr_flat_flowgraph::enable_pc_rpc() -{ -#ifdef GR_PERFORMANCE_COUNTERS - if(gr_prefs::singleton()->get_bool("PerfCounters", "on", false)) { - gr_basic_block_viter_t p; - for(p = d_blocks.begin(); p != d_blocks.end(); p++) { - gr_block_sptr block = cast_to_block_sptr(*p); - if(!block->is_pc_rpc_set()) - block->setup_pc_rpc(); - } - } -#endif /* GR_PERFORMANCE_COUNTERS */ -} diff --git a/gnuradio-runtime/lib/gr_flat_flowgraph.h b/gnuradio-runtime/lib/gr_flat_flowgraph.h deleted file mode 100644 index 9c47a77e23..0000000000 --- a/gnuradio-runtime/lib/gr_flat_flowgraph.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007 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. - */ - -#ifndef INCLUDED_GR_FLAT_FLOWGRAPH_H -#define INCLUDED_GR_FLAT_FLOWGRAPH_H - -#include <gr_runtime_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_RUNTIME_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_RUNTIME_API gr_flat_flowgraph : public gr_flowgraph -{ -public: - friend GR_RUNTIME_API gr_flat_flowgraph_sptr gr_make_flat_flowgraph(); - - // Destruct an arbitrary gr_flat_flowgraph - ~gr_flat_flowgraph(); - - // Wire gr_blocks together in new flat_flowgraph - void setup_connections(); - - // Merge applicable connections from existing flat flowgraph - void merge_connections(gr_flat_flowgraph_sptr sfg); - - // Return a string list of edges - std::string edge_list(); - - void dump(); - - /*! - * Make a vector of gr_block from a vector of gr_basic_block - */ - static gr_block_vector_t make_block_vector(gr_basic_block_vector_t &blocks); - - void replace_endpoint(const gr_msg_endpoint &e, const gr_msg_endpoint &r, bool is_src); - void clear_endpoint(const gr_msg_endpoint &e, bool is_src); - - /*! - * Enables export of perf. counters to ControlPort on all blocks in - * the flowgraph. - */ - void enable_pc_rpc(); - -private: - gr_flat_flowgraph(); - - gr_block_detail_sptr allocate_block_detail(gr_basic_block_sptr block); - gr_buffer_sptr allocate_buffer(gr_basic_block_sptr block, int port); - void connect_block_inputs(gr_basic_block_sptr block); - - /* When reusing a flowgraph's blocks, this call makes sure all of the - * buffer's are aligned at the machine's alignment boundary and tells - * the blocks that they are aligned. - * - * Called from both setup_connections and merge_connections for - * start and restarts. - */ - void setup_buffer_alignment(gr_block_sptr block); -}; - -#endif /* INCLUDED_GR_FLAT_FLOWGRAPH_H */ diff --git a/gnuradio-runtime/lib/gr_flowgraph.cc b/gnuradio-runtime/lib/gr_flowgraph.cc deleted file mode 100644 index 28cd693171..0000000000 --- a/gnuradio-runtime/lib/gr_flowgraph.cc +++ /dev/null @@ -1,514 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_flowgraph.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <sstream> -#include <iterator> - -#define GR_FLOWGRAPH_DEBUG 0 - -gr_edge::~gr_edge() -{ -} - -gr_flowgraph_sptr gr_make_flowgraph() -{ - return gr_flowgraph_sptr(new gr_flowgraph()); -} - -gr_flowgraph::gr_flowgraph() -{ -} - -gr_flowgraph::~gr_flowgraph() -{ -} - -template<class T> -static -std::vector<T> -unique_vector(std::vector<T> v) -{ - std::vector<T> result; - std::insert_iterator<std::vector<T> > inserter(result, result.begin()); - - sort(v.begin(), v.end()); - unique_copy(v.begin(), v.end(), inserter); - return result; -} - -void -gr_flowgraph::connect(const gr_endpoint &src, const gr_endpoint &dst) -{ - check_valid_port(src.block()->output_signature(), src.port()); - check_valid_port(dst.block()->input_signature(), dst.port()); - check_dst_not_used(dst); - check_type_match(src, dst); - - // All ist klar, Herr Kommisar - d_edges.push_back(gr_edge(src,dst)); -} - -void -gr_flowgraph::disconnect(const gr_endpoint &src, const gr_endpoint &dst) -{ - for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) { - if (src == p->src() && dst == p->dst()) { - d_edges.erase(p); - return; - } - } - - std::stringstream msg; - msg << "cannot disconnect edge " << gr_edge(src, dst) << ", not found"; - throw std::invalid_argument(msg.str()); -} - -void -gr_flowgraph::validate() -{ - d_blocks = calc_used_blocks(); - - for (gr_basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) { - std::vector<int> used_ports; - int ninputs, noutputs; - - if (GR_FLOWGRAPH_DEBUG) - std::cout << "Validating block: " << (*p) << std::endl; - - used_ports = calc_used_ports(*p, true); // inputs - ninputs = used_ports.size(); - check_contiguity(*p, used_ports, true); // inputs - - used_ports = calc_used_ports(*p, false); // outputs - noutputs = used_ports.size(); - check_contiguity(*p, used_ports, false); // outputs - - if (!((*p)->check_topology(ninputs, noutputs))) { - std::stringstream msg; - msg << "check topology failed on " << (*p) - << " using ninputs=" << ninputs - << ", noutputs=" << noutputs; - throw std::runtime_error(msg.str()); - } - } -} - -void -gr_flowgraph::clear() -{ - // Boost shared pointers will deallocate as needed - d_blocks.clear(); - d_edges.clear(); -} - -void -gr_flowgraph::check_valid_port(gr_io_signature_sptr sig, int port) -{ - std::stringstream msg; - - if (port < 0) { - msg << "negative port number " << port << " is invalid"; - throw std::invalid_argument(msg.str()); - } - - int max = sig->max_streams(); - if (max != gr_io_signature::IO_INFINITE && port >= max) { - msg << "port number " << port << " exceeds max of "; - if (max == 0) - msg << "(none)"; - else - msg << max-1; - throw std::invalid_argument(msg.str()); - } -} - -void -gr_flowgraph::check_valid_port(const gr_msg_endpoint &e) -{ - if (GR_FLOWGRAPH_DEBUG) - std::cout << "check_valid_port( " << e.block() << ", " << e.port() << ")\n"; - - if(!e.block()->has_msg_port(e.port())) - throw std::invalid_argument("invalid msg port in connect() or disconnect()"); -} - -void -gr_flowgraph::check_dst_not_used(const gr_endpoint &dst) -{ - // A destination is in use if it is already on the edge list - for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) - if (p->dst() == dst) { - std::stringstream msg; - msg << "destination already in use by edge " << (*p); - throw std::invalid_argument(msg.str()); - } -} - -void -gr_flowgraph::check_type_match(const gr_endpoint &src, const gr_endpoint &dst) -{ - int src_size = src.block()->output_signature()->sizeof_stream_item(src.port()); - int dst_size = dst.block()->input_signature()->sizeof_stream_item(dst.port()); - - if (src_size != dst_size) { - std::stringstream msg; - msg << "itemsize mismatch: " << src << " using " << src_size - << ", " << dst << " using " << dst_size; - throw std::invalid_argument(msg.str()); - } -} - -gr_basic_block_vector_t -gr_flowgraph::calc_used_blocks() -{ - gr_basic_block_vector_t tmp; - - // make sure free standing message blocks are included - for (gr_msg_edge_viter_t p = d_msg_edges.begin(); p != d_msg_edges.end(); p++) { -// for now only blocks receiving messages get a thread context - uncomment to allow senders to also obtain one -// tmp.push_back(p->src().block()); - tmp.push_back(p->dst().block()); - } - - // Collect all blocks in the edge list - for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) { - tmp.push_back(p->src().block()); - tmp.push_back(p->dst().block()); - } - - return unique_vector<gr_basic_block_sptr>(tmp); -} - -std::vector<int> -gr_flowgraph::calc_used_ports(gr_basic_block_sptr block, bool check_inputs) -{ - std::vector<int> tmp; - - // Collect all seen ports - gr_edge_vector_t edges = calc_connections(block, check_inputs); - for (gr_edge_viter_t p = edges.begin(); p != edges.end(); p++) { - if (check_inputs == true) - tmp.push_back(p->dst().port()); - else - tmp.push_back(p->src().port()); - } - - return unique_vector<int>(tmp); -} - -gr_edge_vector_t -gr_flowgraph::calc_connections(gr_basic_block_sptr block, bool check_inputs) -{ - gr_edge_vector_t result; - - for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) { - if (check_inputs) { - if (p->dst().block() == block) - result.push_back(*p); - } - else { - if (p->src().block() == block) - result.push_back(*p); - } - } - - return result; // assumes no duplicates -} - -void -gr_flowgraph::check_contiguity(gr_basic_block_sptr block, - const std::vector<int> &used_ports, - bool check_inputs) -{ - std::stringstream msg; - - gr_io_signature_sptr sig = - check_inputs ? block->input_signature() : block->output_signature(); - - int nports = used_ports.size(); - int min_ports = sig->min_streams(); - int max_ports = sig->max_streams(); - - if (nports == 0 && min_ports == 0) - return; - - if (nports < min_ports) { - msg << block << ": insufficient connected " - << (check_inputs ? "input ports " : "output ports ") - << "(" << min_ports << " needed, " << nports << " connected)"; - throw std::runtime_error(msg.str()); - } - - if (nports > max_ports && max_ports != gr_io_signature::IO_INFINITE) { - msg << block << ": too many connected " - << (check_inputs ? "input ports " : "output ports ") - << "(" << max_ports << " allowed, " << nports << " connected)"; - throw std::runtime_error(msg.str()); - } - - if (used_ports[nports-1]+1 != nports) { - for (int i = 0; i < nports; i++) { - if (used_ports[i] != i) { - msg << block << ": missing connection " - << (check_inputs ? "to input port " : "from output port ") - << i; - throw std::runtime_error(msg.str()); - } - } - } -} - -gr_basic_block_vector_t -gr_flowgraph::calc_downstream_blocks(gr_basic_block_sptr block, int port) -{ - gr_basic_block_vector_t tmp; - - for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) - if (p->src() == gr_endpoint(block, port)) - tmp.push_back(p->dst().block()); - - return unique_vector<gr_basic_block_sptr>(tmp); -} - -gr_basic_block_vector_t -gr_flowgraph::calc_downstream_blocks(gr_basic_block_sptr block) -{ - gr_basic_block_vector_t tmp; - - for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) - if (p->src().block() == block) - tmp.push_back(p->dst().block()); - - return unique_vector<gr_basic_block_sptr>(tmp); -} - -gr_edge_vector_t -gr_flowgraph::calc_upstream_edges(gr_basic_block_sptr block) -{ - gr_edge_vector_t result; - - for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) - if (p->dst().block() == block) - result.push_back(*p); - - return result; // Assume no duplicates -} - -bool -gr_flowgraph::has_block_p(gr_basic_block_sptr block) -{ - gr_basic_block_viter_t result; - result = std::find(d_blocks.begin(), d_blocks.end(), block); - return (result != d_blocks.end()); -} - -gr_edge -gr_flowgraph::calc_upstream_edge(gr_basic_block_sptr block, int port) -{ - gr_edge result; - - for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) { - if (p->dst() == gr_endpoint(block, port)) { - result = (*p); - break; - } - } - - return result; -} - -std::vector<gr_basic_block_vector_t> -gr_flowgraph::partition() -{ - std::vector<gr_basic_block_vector_t> result; - gr_basic_block_vector_t blocks = calc_used_blocks(); - gr_basic_block_vector_t graph; - - while (blocks.size() > 0) { - graph = calc_reachable_blocks(blocks[0], blocks); - assert(graph.size()); - result.push_back(topological_sort(graph)); - - for (gr_basic_block_viter_t p = graph.begin(); p != graph.end(); p++) - blocks.erase(find(blocks.begin(), blocks.end(), *p)); - } - - return result; -} - -gr_basic_block_vector_t -gr_flowgraph::calc_reachable_blocks(gr_basic_block_sptr block, gr_basic_block_vector_t &blocks) -{ - gr_basic_block_vector_t result; - - // Mark all blocks as unvisited - for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) - (*p)->set_color(gr_basic_block::WHITE); - - // Recursively mark all reachable blocks - reachable_dfs_visit(block, blocks); - - // Collect all the blocks that have been visited - for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) - if ((*p)->color() == gr_basic_block::BLACK) - result.push_back(*p); - - return result; -} - -// Recursively mark all reachable blocks from given block and block list -void -gr_flowgraph::reachable_dfs_visit(gr_basic_block_sptr block, gr_basic_block_vector_t &blocks) -{ - // Mark the current one as visited - block->set_color(gr_basic_block::BLACK); - - // Recurse into adjacent vertices - gr_basic_block_vector_t adjacent = calc_adjacent_blocks(block, blocks); - - for (gr_basic_block_viter_t p = adjacent.begin(); p != adjacent.end(); p++) - if ((*p)->color() == gr_basic_block::WHITE) - reachable_dfs_visit(*p, blocks); -} - -// Return a list of block adjacent to a given block along any edge -gr_basic_block_vector_t -gr_flowgraph::calc_adjacent_blocks(gr_basic_block_sptr block, gr_basic_block_vector_t &blocks) -{ - gr_basic_block_vector_t tmp; - - // Find any blocks that are inputs or outputs - for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) { - if (p->src().block() == block) - tmp.push_back(p->dst().block()); - if (p->dst().block() == block) - tmp.push_back(p->src().block()); - } - - return unique_vector<gr_basic_block_sptr>(tmp); -} - -gr_basic_block_vector_t -gr_flowgraph::topological_sort(gr_basic_block_vector_t &blocks) -{ - gr_basic_block_vector_t tmp; - gr_basic_block_vector_t result; - tmp = sort_sources_first(blocks); - - // Start 'em all white - for (gr_basic_block_viter_t p = tmp.begin(); p != tmp.end(); p++) - (*p)->set_color(gr_basic_block::WHITE); - - for (gr_basic_block_viter_t p = tmp.begin(); p != tmp.end(); p++) { - if ((*p)->color() == gr_basic_block::WHITE) - topological_dfs_visit(*p, result); - } - - reverse(result.begin(), result.end()); - return result; -} - -gr_basic_block_vector_t -gr_flowgraph::sort_sources_first(gr_basic_block_vector_t &blocks) -{ - gr_basic_block_vector_t sources, nonsources, result; - - for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) { - if (source_p(*p)) - sources.push_back(*p); - else - nonsources.push_back(*p); - } - - for (gr_basic_block_viter_t p = sources.begin(); p != sources.end(); p++) - result.push_back(*p); - - for (gr_basic_block_viter_t p = nonsources.begin(); p != nonsources.end(); p++) - result.push_back(*p); - - return result; -} - -bool -gr_flowgraph::source_p(gr_basic_block_sptr block) -{ - return (calc_upstream_edges(block).size() == 0); -} - -void -gr_flowgraph::topological_dfs_visit(gr_basic_block_sptr block, gr_basic_block_vector_t &output) -{ - block->set_color(gr_basic_block::GREY); - gr_basic_block_vector_t blocks(calc_downstream_blocks(block)); - - for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) { - switch ((*p)->color()) { - case gr_basic_block::WHITE: - topological_dfs_visit(*p, output); - break; - - case gr_basic_block::GREY: - throw std::runtime_error("flow graph has loops!"); - - case gr_basic_block::BLACK: - continue; - - default: - throw std::runtime_error("invalid color on block!"); - } - } - - block->set_color(gr_basic_block::BLACK); - output.push_back(block); -} - -void gr_flowgraph::connect(const gr_msg_endpoint &src, const gr_msg_endpoint &dst){ - check_valid_port(src); - check_valid_port(dst); - for (gr_msg_edge_viter_t p = d_msg_edges.begin(); p != d_msg_edges.end(); p++) { - if(p->src() == src && p->dst() == dst){ - throw std::runtime_error("connect called on already connected edge!"); - } - } - d_msg_edges.push_back(gr_msg_edge(src,dst)); -} - -void gr_flowgraph::disconnect(const gr_msg_endpoint &src, const gr_msg_endpoint &dst){ - check_valid_port(src); - check_valid_port(dst); - for (gr_msg_edge_viter_t p = d_msg_edges.begin(); p != d_msg_edges.end(); p++) { - if(p->src() == src && p->dst() == dst){ - d_msg_edges.erase(p); - return; - } - } - throw std::runtime_error("disconnect called on non-connected edge!"); -} - - diff --git a/gnuradio-runtime/lib/gr_hier_block2.cc b/gnuradio-runtime/lib/gr_hier_block2.cc deleted file mode 100644 index 9e924fdaf5..0000000000 --- a/gnuradio-runtime/lib/gr_hier_block2.cc +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007,2008 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#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() -{ - return shared_from_this(); -} - -gr_hier_block2_sptr -gr_hier_block2::to_hier_block2() -{ - return cast_to_hier_block2_sptr(shared_from_this()); -} - -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::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::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; -} diff --git a/gnuradio-runtime/lib/gr_hier_block2_detail.cc b/gnuradio-runtime/lib/gr_hier_block2_detail.cc deleted file mode 100644 index c8564f6698..0000000000 --- a/gnuradio-runtime/lib/gr_hier_block2_detail.cc +++ /dev/null @@ -1,641 +0,0 @@ -/* - * Copyright 2006,2007,2009 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_hier_block2_detail.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> -#include <stdexcept> -#include <sstream> -#include <boost/format.hpp> - -#define GR_HIER_BLOCK2_DETAIL_DEBUG 0 - -gr_hier_block2_detail::gr_hier_block2_detail(gr_hier_block2 *owner) : - d_owner(owner), - d_parent_detail(0), - d_fg(gr_make_flowgraph()) -{ - int min_inputs = owner->input_signature()->min_streams(); - int max_inputs = owner->input_signature()->max_streams(); - int min_outputs = owner->output_signature()->min_streams(); - int max_outputs = owner->output_signature()->max_streams(); - - if (max_inputs == gr_io_signature::IO_INFINITE || - max_outputs == gr_io_signature::IO_INFINITE || - (min_inputs != max_inputs) ||(min_outputs != max_outputs) ) { - std::stringstream msg; - msg << "Hierarchical blocks do not yet support arbitrary or" - << " variable numbers of inputs or outputs (" << d_owner->name() << ")"; - throw std::runtime_error(msg.str()); - } - - d_inputs = std::vector<gr_endpoint_vector_t>(max_inputs); - d_outputs = gr_endpoint_vector_t(max_outputs); -} - - -gr_hier_block2_detail::~gr_hier_block2_detail() -{ - d_owner = 0; // Don't use delete, we didn't allocate -} - -void -gr_hier_block2_detail::connect(gr_basic_block_sptr block) -{ - std::stringstream msg; - - // Check if duplicate - if (std::find(d_blocks.begin(), d_blocks.end(), block) != d_blocks.end()) { - msg << "Block " << block << " already connected."; - throw std::invalid_argument(msg.str()); - } - - // Check if has inputs or outputs - if (block->input_signature()->max_streams() != 0 || - block->output_signature()->max_streams() != 0) { - msg << "Block " << block << " must not have any input or output ports"; - throw std::invalid_argument(msg.str()); - } - - gr_hier_block2_sptr hblock(cast_to_hier_block2_sptr(block)); - - if (hblock && hblock.get() != d_owner) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "connect: block is hierarchical, setting parent to " << this << std::endl; - hblock->d_detail->d_parent_detail = this; - } - - d_blocks.push_back(block); -} - -void -gr_hier_block2_detail::connect(gr_basic_block_sptr src, int src_port, - gr_basic_block_sptr dst, int dst_port) -{ - std::stringstream msg; - - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "connecting: " << gr_endpoint(src, src_port) - << " -> " << gr_endpoint(dst, dst_port) << std::endl; - - if (src.get() == dst.get()) - throw std::invalid_argument("connect: src and destination blocks cannot be the same"); - - gr_hier_block2_sptr src_block(cast_to_hier_block2_sptr(src)); - gr_hier_block2_sptr dst_block(cast_to_hier_block2_sptr(dst)); - - if (src_block && src.get() != d_owner) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "connect: src is hierarchical, setting parent to " << this << std::endl; - src_block->d_detail->d_parent_detail = this; - } - - if (dst_block && dst.get() != d_owner) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "connect: dst is hierarchical, setting parent to " << this << std::endl; - dst_block->d_detail->d_parent_detail = this; - } - - // Connections to block inputs or outputs - int max_port; - if (src.get() == d_owner) { - max_port = src->input_signature()->max_streams(); - if ((max_port != -1 && (src_port >= max_port)) || src_port < 0) { - msg << "source port " << src_port << " out of range for " << src; - throw std::invalid_argument(msg.str()); - } - - return connect_input(src_port, dst_port, dst); - } - - if (dst.get() == d_owner) { - max_port = dst->output_signature()->max_streams(); - if ((max_port != -1 && (dst_port >= max_port)) || dst_port < 0) { - msg << "destination port " << dst_port << " out of range for " << dst; - throw std::invalid_argument(msg.str()); - } - - return connect_output(dst_port, src_port, src); - } - - // Internal connections - d_fg->connect(src, src_port, dst, dst_port); - - // TODO: connects to NC -} - -void -gr_hier_block2_detail::msg_connect(gr_basic_block_sptr src, pmt::pmt_t srcport, - gr_basic_block_sptr dst, pmt::pmt_t dstport) -{ - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "connecting message port..." << std::endl; - - // register the subscription -// this is done later... -// src->message_port_sub(srcport, pmt::cons(dst->alias_pmt(), dstport)); - - // add block uniquely to list to internal blocks - if (std::find(d_blocks.begin(), d_blocks.end(), dst) == d_blocks.end()){ - d_blocks.push_back(src); - d_blocks.push_back(dst); - } - - bool hier_out = (d_owner == src.get()) && src->message_port_is_hier_out(srcport);; - bool hier_in = (d_owner == dst.get()) && dst->message_port_is_hier_in(dstport); - - gr_hier_block2_sptr src_block(cast_to_hier_block2_sptr(src)); - gr_hier_block2_sptr dst_block(cast_to_hier_block2_sptr(dst)); - - if (src_block && src.get() != d_owner) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "connect: src is hierarchical, setting parent to " << this << std::endl; - src_block->d_detail->d_parent_detail = this; - } - - if (dst_block && dst.get() != d_owner) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "connect: dst is hierarchical, setting parent to " << this << std::endl; - dst_block->d_detail->d_parent_detail = this; - } - - // add edge for this message connection - if(GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << boost::format("connect( (%s, %s, %d), (%s, %s, %d) )\n") % - src % srcport % hier_out % - dst % dstport % hier_in; - d_fg->connect( gr_msg_endpoint(src, srcport, hier_out), gr_msg_endpoint(dst, dstport, hier_in)); -} - -void -gr_hier_block2_detail::msg_disconnect(gr_basic_block_sptr src, pmt::pmt_t srcport, - gr_basic_block_sptr dst, pmt::pmt_t dstport) -{ - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "disconnecting message port..." << std::endl; - - // unregister the subscription - if already subscribed - src->message_port_unsub(srcport, pmt::cons(dst->alias_pmt(), dstport)); - - // remove edge for this message connection - bool hier_out = (d_owner == src.get()) && src->message_port_is_hier_out(srcport);; - bool hier_in = (d_owner == dst.get()) && dst->message_port_is_hier_in(dstport); - d_fg->disconnect( gr_msg_endpoint(src, srcport, hier_out), gr_msg_endpoint(dst, dstport, hier_in)); -} - -void -gr_hier_block2_detail::disconnect(gr_basic_block_sptr block) -{ - // Check on singleton list - for (gr_basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) { - if (*p == block) { - d_blocks.erase(p); - - gr_hier_block2_sptr hblock(cast_to_hier_block2_sptr(block)); - if (block && block.get() != d_owner) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "disconnect: block is hierarchical, clearing parent" << std::endl; - hblock->d_detail->d_parent_detail = 0; - } - - return; - } - } - - // Otherwise find all edges containing block - gr_edge_vector_t edges, tmp = d_fg->edges(); - gr_edge_vector_t::iterator p; - for (p = tmp.begin(); p != tmp.end(); p++) { - if ((*p).src().block() == block || (*p).dst().block() == block) { - edges.push_back(*p); - - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "disconnect: block found in edge " << (*p) << std::endl; - } - } - - if (edges.size() == 0) { - std::stringstream msg; - msg << "cannot disconnect block " << block << ", not found"; - throw std::invalid_argument(msg.str()); - } - - for (p = edges.begin(); p != edges.end(); p++) { - disconnect((*p).src().block(), (*p).src().port(), - (*p).dst().block(), (*p).dst().port()); - } -} - -void -gr_hier_block2_detail::disconnect(gr_basic_block_sptr src, int src_port, - gr_basic_block_sptr dst, int dst_port) -{ - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "disconnecting: " << gr_endpoint(src, src_port) - << " -> " << gr_endpoint(dst, dst_port) << std::endl; - - if (src.get() == dst.get()) - throw std::invalid_argument("disconnect: source and destination blocks cannot be the same"); - - gr_hier_block2_sptr src_block(cast_to_hier_block2_sptr(src)); - gr_hier_block2_sptr dst_block(cast_to_hier_block2_sptr(dst)); - - if (src_block && src.get() != d_owner) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "disconnect: src is hierarchical, clearing parent" << std::endl; - src_block->d_detail->d_parent_detail = 0; - } - - if (dst_block && dst.get() != d_owner) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "disconnect: dst is hierarchical, clearing parent" << std::endl; - dst_block->d_detail->d_parent_detail = 0; - } - - if (src.get() == d_owner) - return disconnect_input(src_port, dst_port, dst); - - if (dst.get() == d_owner) - return disconnect_output(dst_port, src_port, src); - - // Internal connections - d_fg->disconnect(src, src_port, dst, dst_port); -} - -void -gr_hier_block2_detail::connect_input(int my_port, int port, gr_basic_block_sptr block) -{ - std::stringstream msg; - - if (my_port < 0 || my_port >= (signed)d_inputs.size()) { - msg << "input port " << my_port << " out of range for " << block; - throw std::invalid_argument(msg.str()); - } - - gr_endpoint_vector_t &endps = d_inputs[my_port]; - gr_endpoint endp(block, port); - - gr_endpoint_viter_t p = std::find(endps.begin(), endps.end(), endp); - if (p != endps.end()) { - msg << "external input port " << my_port << " already wired to " << endp; - throw std::invalid_argument(msg.str()); - } - - endps.push_back(endp); -} - -void -gr_hier_block2_detail::connect_output(int my_port, int port, gr_basic_block_sptr block) -{ - std::stringstream msg; - - if (my_port < 0 || my_port >= (signed)d_outputs.size()) { - msg << "output port " << my_port << " out of range for " << block; - throw std::invalid_argument(msg.str()); - } - - if (d_outputs[my_port].block()) { - msg << "external output port " << my_port << " already connected from " - << d_outputs[my_port]; - throw std::invalid_argument(msg.str()); - } - - d_outputs[my_port] = gr_endpoint(block, port); -} - -void -gr_hier_block2_detail::disconnect_input(int my_port, int port, gr_basic_block_sptr block) -{ - std::stringstream msg; - - if (my_port < 0 || my_port >= (signed)d_inputs.size()) { - msg << "input port number " << my_port << " out of range for " << block; - throw std::invalid_argument(msg.str()); - } - - gr_endpoint_vector_t &endps = d_inputs[my_port]; - gr_endpoint endp(block, port); - - gr_endpoint_viter_t p = std::find(endps.begin(), endps.end(), endp); - if (p == endps.end()) { - msg << "external input port " << my_port << " not connected to " << endp; - throw std::invalid_argument(msg.str()); - } - - endps.erase(p); -} - -void -gr_hier_block2_detail::disconnect_output(int my_port, int port, gr_basic_block_sptr block) -{ - std::stringstream msg; - - if (my_port < 0 || my_port >= (signed)d_outputs.size()) { - msg << "output port number " << my_port << " out of range for " << block; - throw std::invalid_argument(msg.str()); - } - - if (d_outputs[my_port].block() != block) { - msg << "block " << block << " not assigned to output " - << my_port << ", can't disconnect"; - throw std::invalid_argument(msg.str()); - } - - d_outputs[my_port] = gr_endpoint(); -} - -gr_endpoint_vector_t -gr_hier_block2_detail::resolve_port(int port, bool is_input) -{ - std::stringstream msg; - - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "Resolving port " << port << " as an " - << (is_input ? "input" : "output") - << " of " << d_owner->name() << std::endl; - - gr_endpoint_vector_t result; - - if (is_input) { - if (port < 0 || port >= (signed)d_inputs.size()) { - msg << "resolve_port: hierarchical block '" << d_owner->name() - << "': input " << port << " is out of range"; - throw std::runtime_error(msg.str()); - } - - if (d_inputs[port].empty()) { - msg << "resolve_port: hierarchical block '" << d_owner->name() - << "': input " << port << " is not connected internally"; - throw std::runtime_error(msg.str()); - } - - gr_endpoint_vector_t &endps = d_inputs[port]; - gr_endpoint_viter_t p; - for (p = endps.begin(); p != endps.end(); p++) { - gr_endpoint_vector_t tmp = resolve_endpoint(*p, true); - std::copy(tmp.begin(), tmp.end(), back_inserter(result)); - } - } - else { - if (port < 0 || port >= (signed)d_outputs.size()) { - msg << "resolve_port: hierarchical block '" << d_owner->name() - << "': output " << port << " is out of range"; - throw std::runtime_error(msg.str()); - } - - if (d_outputs[port] == gr_endpoint()) { - msg << "resolve_port: hierarchical block '" << d_owner->name() - << "': output " << port << " is not connected internally"; - throw std::runtime_error(msg.str()); - } - - result = resolve_endpoint(d_outputs[port], false); - } - - if (result.empty()) { - msg << "resolve_port: hierarchical block '" << d_owner->name() - << "': unable to resolve " - << (is_input ? "input port " : "output port ") - << port; - throw std::runtime_error(msg.str()); - } - - return result; -} - -void -gr_hier_block2_detail::disconnect_all() -{ - d_fg->clear(); - d_blocks.clear(); - d_inputs.clear(); - d_outputs.clear(); -} - -gr_endpoint_vector_t -gr_hier_block2_detail::resolve_endpoint(const gr_endpoint &endp, bool is_input) const -{ - std::stringstream msg; - gr_endpoint_vector_t result; - - // Check if endpoint is a leaf node - if (cast_to_block_sptr(endp.block())) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "Block " << endp.block() << " is a leaf node, returning." << std::endl; - result.push_back(endp); - return result; - } - - // Check if endpoint is a hierarchical block - gr_hier_block2_sptr hier_block2(cast_to_hier_block2_sptr(endp.block())); - if (hier_block2) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "Resolving endpoint " << endp << " as an " - << (is_input ? "input" : "output") - << ", recursing" << std::endl; - return hier_block2->d_detail->resolve_port(endp.port(), is_input); - } - - msg << "unable to resolve" << (is_input ? " input " : " output ") - << "endpoint " << endp; - throw std::runtime_error(msg.str()); -} - -void -gr_hier_block2_detail::flatten_aux(gr_flat_flowgraph_sptr sfg) const -{ - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << " ** Flattening " << d_owner->name() << std::endl; - - // Add my edges to the flow graph, resolving references to actual endpoints - gr_edge_vector_t edges = d_fg->edges(); - gr_msg_edge_vector_t msg_edges = d_fg->msg_edges(); - gr_edge_viter_t p; - gr_msg_edge_viter_t q,u; - - // Only run setup_rpc if ControlPort config param is enabled. - bool ctrlport_on = gr_prefs::singleton()->get_bool("ControlPort", "on", false); - - // For every block (gr_block and gr_hier_block2), set up the RPC - // interface. - for(p = edges.begin(); p != edges.end(); p++) { - gr_basic_block_sptr b; - b = p->src().block(); - - if(ctrlport_on) { - if(!b->is_rpc_set()) { - b->setup_rpc(); - b->rpc_set(); - } - } - - b = p->dst().block(); - if(ctrlport_on) { - if(!b->is_rpc_set()) { - b->setup_rpc(); - b->rpc_set(); - } - } - } - - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "Flattening stream connections: " << std::endl; - - for (p = edges.begin(); p != edges.end(); p++) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "Flattening edge " << (*p) << std::endl; - - gr_endpoint_vector_t src_endps = resolve_endpoint(p->src(), false); - gr_endpoint_vector_t dst_endps = resolve_endpoint(p->dst(), true); - - gr_endpoint_viter_t s, d; - for (s = src_endps.begin(); s != src_endps.end(); s++) { - for (d = dst_endps.begin(); d != dst_endps.end(); d++) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << (*s) << "->" << (*d) << std::endl; - sfg->connect(*s, *d); - } - } - } - - // loop through flattening hierarchical connections - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "Flattening msg connections: " << std::endl; - - - std::vector<std::pair<gr_msg_endpoint, bool> > resolved_endpoints; - for(q = msg_edges.begin(); q != msg_edges.end(); q++) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << boost::format(" flattening edge ( %s, %s, %d) -> ( %s, %s, %d)\n") % q->src().block() % q->src().port() % q->src().is_hier() % q->dst().block() % q->dst().port() % q->dst().is_hier(); - - bool normal_connection = true; - - // resolve existing connections to hier ports - if(q->dst().is_hier()){ - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << boost::format(" resolve hier output (%s, %s)") % q->dst().block() % q->dst().port() << std::endl; - sfg->replace_endpoint( q->dst(), q->src(), true ); - resolved_endpoints.push_back(std::pair<gr_msg_endpoint, bool>(q->dst(),true)); - normal_connection = false; - } - - if(q->src().is_hier()){ - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << boost::format(" resolve hier input (%s, %s)") % q->src().block() % q->src().port() << std::endl; - sfg->replace_endpoint( q->src(), q->dst(), false ); - resolved_endpoints.push_back(std::pair<gr_msg_endpoint, bool>(q->src(),false)); - normal_connection = false; - } - - // propogate non hier connections through - if(normal_connection){ - sfg->connect( q->src(), q->dst() ); - } - } - for(std::vector<std::pair<gr_msg_endpoint, bool> >::iterator it = resolved_endpoints.begin(); it != resolved_endpoints.end(); it++){ - sfg->clear_endpoint( (*it).first, (*it).second ); - } - -/* // connect primitive edges in the new fg - for(q = msg_edges.begin(); q != msg_edges.end(); q++) { - if( (!q->src().is_hier()) && (!q->dst().is_hier()) ){ - sfg->connect( q->src(), q->dst() ); - } else { - std::cout << "not connecting hier connection!" << std::endl; - } - }*/ - - // Construct unique list of blocks used either in edges, inputs, - // outputs, or by themselves. I still hate STL. - gr_basic_block_vector_t blocks; // unique list of used blocks - gr_basic_block_vector_t tmp = d_fg->calc_used_blocks(); - - // First add the list of singleton blocks - std::vector<gr_basic_block_sptr>::const_iterator b; // Because flatten_aux is const - for (b = d_blocks.begin(); b != d_blocks.end(); b++) - tmp.push_back(*b); - - // Now add the list of connected input blocks - std::stringstream msg; - for (unsigned int i = 0; i < d_inputs.size(); i++) { - if (d_inputs[i].size() == 0) { - msg << "In hierarchical block " << d_owner->name() << ", input " << i - << " is not connected internally"; - throw std::runtime_error(msg.str()); - } - - for (unsigned int j = 0; j < d_inputs[i].size(); j++) - tmp.push_back(d_inputs[i][j].block()); - } - - for (unsigned int i = 0; i < d_outputs.size(); i++) { - gr_basic_block_sptr blk = d_outputs[i].block(); - if (!blk) { - msg << "In hierarchical block " << d_owner->name() << ", output " << i - << " is not connected internally"; - throw std::runtime_error(msg.str()); - } - tmp.push_back(blk); - } - sort(tmp.begin(), tmp.end()); - - std::insert_iterator<gr_basic_block_vector_t> inserter(blocks, blocks.begin()); - unique_copy(tmp.begin(), tmp.end(), inserter); - - // Recurse hierarchical children - for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) { - gr_hier_block2_sptr hier_block2(cast_to_hier_block2_sptr(*p)); - if (hier_block2 && (hier_block2.get() != d_owner)) { - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "flatten_aux: recursing into hierarchical block " << hier_block2 << std::endl; - hier_block2->d_detail->flatten_aux(sfg); - } - } -} - -void -gr_hier_block2_detail::lock() -{ - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "lock: entered in " << this << std::endl; - - if (d_parent_detail) - d_parent_detail->lock(); - else - d_owner->lock(); -} - -void -gr_hier_block2_detail::unlock() -{ - if (GR_HIER_BLOCK2_DETAIL_DEBUG) - std::cout << "unlock: entered in " << this << std::endl; - - if (d_parent_detail) - d_parent_detail->unlock(); - else - d_owner->unlock(); -} - diff --git a/gnuradio-runtime/lib/gr_hier_block2_detail.h b/gnuradio-runtime/lib/gr_hier_block2_detail.h deleted file mode 100644 index d08fe20ac0..0000000000 --- a/gnuradio-runtime/lib/gr_hier_block2_detail.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007,2009 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. - */ -#ifndef INCLUDED_GR_HIER_BLOCK2_DETAIL_H -#define INCLUDED_GR_HIER_BLOCK2_DETAIL_H - -#include <gr_runtime_api.h> -#include <gr_hier_block2.h> -#include <gr_flat_flowgraph.h> -#include <boost/utility.hpp> - -/*! - * \ingroup internal - */ -class GR_RUNTIME_API gr_hier_block2_detail : boost::noncopyable -{ -public: - gr_hier_block2_detail(gr_hier_block2 *owner); - ~gr_hier_block2_detail(); - - void connect(gr_basic_block_sptr block); - void connect(gr_basic_block_sptr src, int src_port, - gr_basic_block_sptr dst, int dst_port); - void msg_connect(gr_basic_block_sptr src, pmt::pmt_t srcport, - gr_basic_block_sptr dst, pmt::pmt_t dstport); - void msg_disconnect(gr_basic_block_sptr src, pmt::pmt_t srcport, - gr_basic_block_sptr dst, pmt::pmt_t dstport); - void disconnect(gr_basic_block_sptr block); - void disconnect(gr_basic_block_sptr, int src_port, - gr_basic_block_sptr, int dst_port); - void disconnect_all(); - void lock(); - void unlock(); - void flatten_aux(gr_flat_flowgraph_sptr sfg) const; - -private: - - // Private implementation data - gr_hier_block2 *d_owner; - gr_hier_block2_detail *d_parent_detail; - gr_flowgraph_sptr d_fg; - std::vector<gr_endpoint_vector_t> d_inputs; // Multiple internal endpoints per external input - gr_endpoint_vector_t d_outputs; // Single internal endpoint per external output - gr_basic_block_vector_t d_blocks; - - - void connect_input(int my_port, int port, gr_basic_block_sptr block); - void connect_output(int my_port, int port, gr_basic_block_sptr block); - void disconnect_input(int my_port, int port, gr_basic_block_sptr block); - void disconnect_output(int my_port, int port, gr_basic_block_sptr block); - - gr_endpoint_vector_t resolve_port(int port, bool is_input); - gr_endpoint_vector_t resolve_endpoint(const gr_endpoint &endp, bool is_input) const; -}; - -#endif /* INCLUDED_GR_HIER_BLOCK2_DETAIL_H */ diff --git a/gnuradio-runtime/lib/gr_io_signature.cc b/gnuradio-runtime/lib/gr_io_signature.cc deleted file mode 100644 index 6ac9acd17d..0000000000 --- a/gnuradio-runtime/lib/gr_io_signature.cc +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> - -gr_io_signature_sptr -gr_make_io_signaturev(int min_streams, int max_streams, - const std::vector<int> &sizeof_stream_items) -{ - return gr_io_signature_sptr (new gr_io_signature (min_streams, max_streams, - sizeof_stream_items)); -} - -gr_io_signature_sptr -gr_make_io_signature(int min_streams, int max_streams, - int sizeof_stream_item) -{ - std::vector<int> sizeof_items(1); - sizeof_items[0] = sizeof_stream_item; - return gr_make_io_signaturev(min_streams, max_streams, sizeof_items); -} - -gr_io_signature_sptr -gr_make_io_signature2(int min_streams, int max_streams, - int sizeof_stream_item1, - int sizeof_stream_item2) -{ - std::vector<int> sizeof_items(2); - sizeof_items[0] = sizeof_stream_item1; - sizeof_items[1] = sizeof_stream_item2; - return gr_make_io_signaturev(min_streams, max_streams, sizeof_items); -} - -gr_io_signature_sptr -gr_make_io_signature3(int min_streams, int max_streams, - int sizeof_stream_item1, - int sizeof_stream_item2, - int sizeof_stream_item3) -{ - std::vector<int> sizeof_items(3); - sizeof_items[0] = sizeof_stream_item1; - sizeof_items[1] = sizeof_stream_item2; - sizeof_items[2] = sizeof_stream_item3; - return gr_make_io_signaturev(min_streams, max_streams, sizeof_items); -} - -// ------------------------------------------------------------------------ - - -gr_io_signature::gr_io_signature (int min_streams, int max_streams, - const std::vector<int> &sizeof_stream_items) -{ - if (min_streams < 0 - || (max_streams != IO_INFINITE && max_streams < min_streams)) - throw std::invalid_argument ("gr_io_signature(1)"); - - if (sizeof_stream_items.size() < 1) - throw std::invalid_argument("gr_io_signature(2)"); - - for (size_t i = 0; i < sizeof_stream_items.size(); i++){ - if (max_streams != 0 && sizeof_stream_items[i] < 1) - throw std::invalid_argument("gr_io_signature(3)"); - } - - d_min_streams = min_streams; - d_max_streams = max_streams; - d_sizeof_stream_item = sizeof_stream_items; -} - -gr_io_signature::~gr_io_signature () -{ -} - -int -gr_io_signature::sizeof_stream_item (int _index) const -{ - if (_index < 0) - throw std::invalid_argument ("gr_io_signature::sizeof_stream_item"); - - size_t index = _index; - return d_sizeof_stream_item[std::min(index, d_sizeof_stream_item.size() - 1)]; -} - -std::vector<int> -gr_io_signature::sizeof_stream_items() const -{ - return d_sizeof_stream_item; -} diff --git a/gnuradio-runtime/lib/gr_local_sighandler.cc b/gnuradio-runtime/lib/gr_local_sighandler.cc deleted file mode 100644 index fb31742e13..0000000000 --- a/gnuradio-runtime/lib/gr_local_sighandler.cc +++ /dev/null @@ -1,187 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_local_sighandler.h> -#include <stdexcept> -#include <stdio.h> -#include <string.h> - - -gr_local_sighandler::gr_local_sighandler (int signum, - void (*new_handler)(int)) - : d_signum (signum) -{ -#ifdef HAVE_SIGACTION - struct sigaction new_action; - memset (&new_action, 0, sizeof (new_action)); - - new_action.sa_handler = new_handler; - sigemptyset (&new_action.sa_mask); - new_action.sa_flags = 0; - - if (sigaction (d_signum, &new_action, &d_old_action) < 0){ - perror ("sigaction (install new)"); - throw std::runtime_error ("sigaction"); - } -#endif -} - -gr_local_sighandler::~gr_local_sighandler () -{ -#ifdef HAVE_SIGACTION - if (sigaction (d_signum, &d_old_action, 0) < 0){ - perror ("sigaction (restore old)"); - throw std::runtime_error ("sigaction"); - } -#endif -} - -void -gr_local_sighandler::throw_signal (int signum) -{ - throw gr_signal (signum); -} - -/* - * Semi-hideous way to may a signal number into a signal name - */ - -#define SIGNAME(x) case x: return #x - -std::string -gr_signal::name () const -{ - char tmp[128]; - - switch (signal ()){ -#ifdef SIGHUP - SIGNAME (SIGHUP); -#endif -#ifdef SIGINT - SIGNAME (SIGINT); -#endif -#ifdef SIGQUIT - SIGNAME (SIGQUIT); -#endif -#ifdef SIGILL - SIGNAME (SIGILL); -#endif -#ifdef SIGTRAP - SIGNAME (SIGTRAP); -#endif -#ifdef SIGABRT - SIGNAME (SIGABRT); -#endif -#ifdef SIGBUS - SIGNAME (SIGBUS); -#endif -#ifdef SIGFPE - SIGNAME (SIGFPE); -#endif -#ifdef SIGKILL - SIGNAME (SIGKILL); -#endif -#ifdef SIGUSR1 - SIGNAME (SIGUSR1); -#endif -#ifdef SIGSEGV - SIGNAME (SIGSEGV); -#endif -#ifdef SIGUSR2 - SIGNAME (SIGUSR2); -#endif -#ifdef SIGPIPE - SIGNAME (SIGPIPE); -#endif -#ifdef SIGALRM - SIGNAME (SIGALRM); -#endif -#ifdef SIGTERM - SIGNAME (SIGTERM); -#endif -#ifdef SIGSTKFLT - SIGNAME (SIGSTKFLT); -#endif -#ifdef SIGCHLD - SIGNAME (SIGCHLD); -#endif -#ifdef SIGCONT - SIGNAME (SIGCONT); -#endif -#ifdef SIGSTOP - SIGNAME (SIGSTOP); -#endif -#ifdef SIGTSTP - SIGNAME (SIGTSTP); -#endif -#ifdef SIGTTIN - SIGNAME (SIGTTIN); -#endif -#ifdef SIGTTOU - SIGNAME (SIGTTOU); -#endif -#ifdef SIGURG - SIGNAME (SIGURG); -#endif -#ifdef SIGXCPU - SIGNAME (SIGXCPU); -#endif -#ifdef SIGXFSZ - SIGNAME (SIGXFSZ); -#endif -#ifdef SIGVTALRM - SIGNAME (SIGVTALRM); -#endif -#ifdef SIGPROF - SIGNAME (SIGPROF); -#endif -#ifdef SIGWINCH - SIGNAME (SIGWINCH); -#endif -#ifdef SIGIO - SIGNAME (SIGIO); -#endif -#ifdef SIGPWR - SIGNAME (SIGPWR); -#endif -#ifdef SIGSYS - SIGNAME (SIGSYS); -#endif - default: -#if defined (HAVE_SNPRINTF) -#if defined (SIGRTMIN) && defined (SIGRTMAX) - if (signal () >= SIGRTMIN && signal () <= SIGRTMAX){ - snprintf (tmp, sizeof (tmp), "SIGRTMIN + %d", signal ()); - return tmp; - } -#endif - snprintf (tmp, sizeof (tmp), "SIGNAL %d", signal ()); - return tmp; -#else - return "Unknown signal"; -#endif - } -} diff --git a/gnuradio-runtime/lib/gr_logger.cc b/gnuradio-runtime/lib/gr_logger.cc deleted file mode 100644 index 6da4a6d914..0000000000 --- a/gnuradio-runtime/lib/gr_logger.cc +++ /dev/null @@ -1,295 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 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. - */ - -/******************************************************************************* -* Author: Mark Plett -* Description: -* The gr_log module wraps the log4cpp library for logging in gnuradio. -*******************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_logger.h> -#include <stdexcept> -#include <algorithm> - -#ifdef ENABLE_GR_LOG -#ifdef HAVE_LOG4CPP - -/**************************** BEGIN LOG4CPP HELPERS ***************************/ -/* Logger config class. This is a singleton that controls how log4cpp is configured - * If watch_period>0 a thread is started to watch teh config file for changes. - */ - -// Getters of logger_config -logger_config& -logger_config::get_instance(void){ - static logger_config instance; - return instance; -}; - -std::string -logger_config::get_filename(){ - logger_config& in=get_instance(); - return in.filename; -}; - -unsigned int -logger_config::get_watch_period(){ - logger_config& in=get_instance(); - return in.watch_period; -}; - -// Method to watch config file for changes -void logger_config::watch_file(std::string filename,unsigned int watch_period){ - std::time_t last_write(boost::filesystem::last_write_time(filename)); - std::time_t current_time(0); - while(true){ - try{ - current_time = boost::filesystem::last_write_time(filename); - if(current_time>last_write){ - std::cout<<"GNURadio Reloading logger configuration:"<<filename<<std::endl; - last_write = current_time; -// Should we wipe out all old configuration or just add the new? Just adding... -// logger_reset_config(); - logger_load_config(filename); - }; - boost::this_thread::sleep(boost::posix_time::time_duration(0,0,watch_period,0)); - } - catch(const boost::thread_interrupted&){ - std::cout<<"GNURadio leaving logger config file watch."<<std::endl; - break; - }; - }; -}; - -// Method to load the confifuration. It only loads if the filename or watch has changed -void logger_config::load_config(std::string filename,unsigned int watch_period){ - logger_config& instance = get_instance(); -// Only reconfigure if filename or watch has changed - if(instance.filename!=filename || watch_period!=instance.watch_period){ - instance.filename = filename; - instance.watch_period = watch_period; -// Stop any file watching thread - if(instance.watch_thread!=NULL) stop_watch(); -// Load configuration - std::cout<<"GNURadio Loading logger configuration:"<<instance.filename<<std::endl; - logger_load_config(instance.filename); -// Start watch if required - if(instance.watch_period>0){ - instance.watch_thread = new boost::thread(watch_file,instance.filename,instance.watch_period); - } - }; -}; - -// Method to stop the watcher thread -void logger_config::stop_watch(){ - logger_config& instance = get_instance(); - if(instance.watch_thread){ - instance.watch_thread->interrupt(); - instance.watch_thread->join(); - delete(instance.watch_thread); - instance.watch_thread=NULL; - }; -}; - -// Method to reset logger configuration -void -logger_config::reset_config(void){ - logger_config& instance = get_instance(); - stop_watch(); - std::vector<log4cpp::Category*> *loggers = log4cpp::Category::getCurrentCategories(); - std::vector<log4cpp::Category*>::iterator logger = loggers->begin(); -// We can't destroy categories but we can neuter them by removing all appenders. - for (;logger!=loggers->end();logger++){ - (*logger)->removeAllAppenders(); - }; - instance.filename=std::string(""); - instance.watch_period=0; -} - -/***************** Functions to call log4cpp methods *************************/ - -gr_logger_ptr -logger_get_logger(std::string name) -{ - if(log4cpp::Category::exists(name)){ - gr_logger_ptr logger = &log4cpp::Category::getInstance(name); - return logger; - } - else - { - gr_logger_ptr logger = &log4cpp::Category::getInstance(name); - logger->setPriority(log4cpp::Priority::NOTSET); - return logger; - }; -}; - -void -logger_load_config(const std::string &config_filename) -{ - if(config_filename.size() != 0) { - try - { - log4cpp::PropertyConfigurator::configure(config_filename); - } - catch( log4cpp::ConfigureFailure &e ) - { - std::cout << "Logger config failed :" << e.what() << std::endl; - } - }; -} - -void -logger_set_level(gr_logger_ptr logger, const std::string &level) -{ - std::string nocase = level; - std::transform(level.begin(), level.end(), nocase.begin(), ::tolower); - - if(nocase == "off" || nocase == "notset") - logger_set_level(logger, log4cpp::Priority::NOTSET); - else if(nocase == "all" || nocase == "debug") - logger_set_level(logger, log4cpp::Priority::DEBUG); - else if(nocase == "info") - logger_set_level(logger, log4cpp::Priority::INFO); - else if(nocase == "notice") - logger_set_level(logger, log4cpp::Priority::NOTICE); - else if(nocase == "warn") - logger_set_level(logger, log4cpp::Priority::WARN); - else if(nocase == "error") - logger_set_level(logger, log4cpp::Priority::ERROR); - else if(nocase == "crit") - logger_set_level(logger, log4cpp::Priority::CRIT); - else if(nocase == "alert") - logger_set_level(logger, log4cpp::Priority::ALERT); - else if(nocase=="fatal") - logger_set_level(logger, log4cpp::Priority::FATAL); - else if(nocase == "emerg") - logger_set_level(logger, log4cpp::Priority::EMERG); - else - throw std::runtime_error("logger_set_level: Bad level type.\n"); -} - -void -logger_set_level(gr_logger_ptr logger, log4cpp::Priority::Value level) -{ - logger->setPriority(level); -} - -void -logger_get_level(gr_logger_ptr logger, std::string &level) -{ - log4cpp::Priority::Value levelPtr = logger->getPriority(); - if(levelPtr == log4cpp::Priority::NOTSET) level = "noset"; - if(levelPtr == log4cpp::Priority::DEBUG) level = "debug"; - if(levelPtr == log4cpp::Priority::INFO) level = "info"; - if(levelPtr == log4cpp::Priority::NOTICE) level = "notice"; - if(levelPtr == log4cpp::Priority::WARN) level = "warn"; - if(levelPtr == log4cpp::Priority::ERROR) level = "error"; - if(levelPtr == log4cpp::Priority::CRIT) level = "crit"; - if(levelPtr == log4cpp::Priority::ALERT) level = "alert"; - if(levelPtr == log4cpp::Priority::FATAL) level = "fatal"; - if(levelPtr == log4cpp::Priority::EMERG) level = "emerg"; -}; - -void -logger_get_level(gr_logger_ptr logger,log4cpp::Priority::Value level) -{ - level = logger->getPriority(); -} - -void -logger_add_console_appender(gr_logger_ptr logger,std::string target,std::string pattern) -{ - - log4cpp::PatternLayout* layout = new log4cpp::PatternLayout(); - log4cpp::Appender* app; - if(target=="stdout") - app = new log4cpp::OstreamAppender("ConsoleAppender::",&std::cout); - else - app = new log4cpp::OstreamAppender("ConsoleAppender::",&std::cerr); - - layout->setConversionPattern(pattern); - app->setLayout(layout); - logger->setAppender(app); - -} - -void -logger_add_file_appender(gr_logger_ptr logger,std::string filename,bool append,std::string pattern) -{ - - log4cpp::PatternLayout* layout = new log4cpp::PatternLayout(); - log4cpp::Appender* app = new - log4cpp::FileAppender("FileAppender::"+filename, - filename); - layout->setConversionPattern(pattern); - app->setLayout(layout); - logger->setAppender(app); - -} - -void -logger_add_rollingfile_appender(gr_logger_ptr logger,std::string filename, - size_t filesize,int bkup_index,bool append,mode_t mode,std::string pattern) -{ - log4cpp::PatternLayout* layout = new log4cpp::PatternLayout(); - log4cpp::Appender* app = new - log4cpp::RollingFileAppender("RollFileAppender::"+filename,filename,filesize,bkup_index,append,mode); - layout->setConversionPattern(pattern); - app->setLayout(layout); - logger->setAppender(app); -} - -std::vector<std::string> -logger_get_logger_names(void){ - std::vector<std::string> names; - std::vector<log4cpp::Category*> *loggers = log4cpp::Category::getCurrentCategories(); - std::vector<log4cpp::Category*>::iterator logger = loggers->begin(); - - for (;logger!=loggers->end();logger++){ - names.push_back((*logger)->getName()); - }; - return names; - -} - -#endif /* HAVE_LOG4CPP */ - -/****** Start Methods to provide Python the capabilities of the macros ********/ -void gr_logger_config(const std::string config_filename, unsigned int watch_period){ - GR_CONFIG_AND_WATCH_LOGGER(config_filename,watch_period); -}; -std::vector<std::string> gr_logger_get_logger_names(void){ - std::vector<std::string> names; - GR_GET_LOGGER_NAMES(names); - return names; -}; -void gr_logger_reset_config(void){ - GR_RESET_CONFIGURATION(); -}; - -// Remaining capability provided by gr_logger class in gr_logger.h - -#endif /* ENABLE_GR_LOGGER */ diff --git a/gnuradio-runtime/lib/gr_message.cc b/gnuradio-runtime/lib/gr_message.cc deleted file mode 100644 index a99dcd7653..0000000000 --- a/gnuradio-runtime/lib/gr_message.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <gr_message.h> -#include <assert.h> -#include <string.h> - -static long s_ncurrently_allocated = 0; - -gr_message_sptr -gr_make_message (long type, double arg1, double arg2, size_t length) -{ - return gr_message_sptr (new gr_message (type, arg1, arg2, length)); -} - -gr_message_sptr -gr_make_message_from_string(const std::string s, long type, double arg1, double arg2) -{ - gr_message_sptr m = gr_make_message(type, arg1, arg2, s.size()); - memcpy(m->msg(), s.data(), s.size()); - return m; -} - - -gr_message::gr_message (long type, double arg1, double arg2, size_t length) - : d_type(type), d_arg1(arg1), d_arg2(arg2) -{ - if (length == 0) - d_buf_start = d_msg_start = d_msg_end = d_buf_end = 0; - else { - d_buf_start = new unsigned char [length]; - d_msg_start = d_buf_start; - d_msg_end = d_buf_end = d_buf_start + length; - } - s_ncurrently_allocated++; -} - -gr_message::~gr_message () -{ - assert (d_next == 0); - delete [] d_buf_start; - d_msg_start = d_msg_end = d_buf_end = 0; - s_ncurrently_allocated--; -} - -std::string -gr_message::to_string() const -{ - return std::string((char *)d_msg_start, length()); -} - -long -gr_message_ncurrently_allocated () -{ - return s_ncurrently_allocated; -} diff --git a/gnuradio-runtime/lib/gr_misc.cc b/gnuradio-runtime/lib/gr_misc.cc deleted file mode 100644 index 1ed2a03d7f..0000000000 --- a/gnuradio-runtime/lib/gr_misc.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <gr_misc.h> - -unsigned int -gr_rounduppow2(unsigned int n) -{ - int i; - for (i=0;((n-1)>>i) != 0;i++) - ; - return 1<<i; -} - -// ---------------------------------------------------------------- - -void -gr_zero_vector(std::vector<float> &v) -{ - for(unsigned int i=0; i < v.size(); i++) - v[i] = 0; -} - -void -gr_zero_vector(std::vector<double> &v) -{ - for(unsigned int i=0; i < v.size(); i++) - v[i] = 0; -} - -void -gr_zero_vector(std::vector<int> &v) -{ - for(unsigned int i=0; i < v.size(); i++) - v[i] = 0; -} - -void -gr_zero_vector(std::vector<gr_complex> &v) -{ - for(unsigned int i=0; i < v.size(); i++) - v[i] = 0; -} diff --git a/gnuradio-runtime/lib/gr_msg_queue.cc b/gnuradio-runtime/lib/gr_msg_queue.cc deleted file mode 100644 index 03bbe046a4..0000000000 --- a/gnuradio-runtime/lib/gr_msg_queue.cc +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2009 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <gr_msg_queue.h> -#include <stdexcept> - -gr_msg_queue_sptr -gr_make_msg_queue(unsigned int limit) -{ - return gr_msg_queue_sptr (new gr_msg_queue(limit)); -} - -gr_msg_queue::gr_msg_queue(unsigned int limit) - : d_not_empty(), d_not_full(), - /*d_head(0), d_tail(0),*/ d_count(0), d_limit(limit) -{ -} - -gr_msg_queue::~gr_msg_queue() -{ - flush (); -} - -void -gr_msg_queue::insert_tail(gr_message_sptr msg) -{ - if (msg->d_next) - throw std::invalid_argument("gr_msg_queue::insert_tail: msg already in queue"); - - gr::thread::scoped_lock guard(d_mutex); - - while (full_p()) - d_not_full.wait(guard); - - if (d_tail == 0){ - d_tail = d_head = msg; - //msg->d_next = 0; - msg->d_next.reset(); - } - else { - d_tail->d_next = msg; - d_tail = msg; - //msg->d_next = 0; - msg->d_next.reset(); - } - d_count++; - d_not_empty.notify_one(); -} - -gr_message_sptr -gr_msg_queue::delete_head() -{ - gr::thread::scoped_lock guard(d_mutex); - gr_message_sptr m; - - while ((m = d_head) == 0) - d_not_empty.wait(guard); - - d_head = m->d_next; - if (d_head == 0){ - //d_tail = 0; - d_tail.reset(); - } - - d_count--; - // m->d_next = 0; - m->d_next.reset(); - d_not_full.notify_one(); - return m; -} - -gr_message_sptr -gr_msg_queue::delete_head_nowait() -{ - gr::thread::scoped_lock guard(d_mutex); - gr_message_sptr m; - - if ((m = d_head) == 0){ - //return 0; - return gr_message_sptr(); - } - - d_head = m->d_next; - if (d_head == 0){ - //d_tail = 0; - d_tail.reset(); - } - - d_count--; - //m->d_next = 0; - m->d_next.reset(); - d_not_full.notify_one(); - return m; -} - -void -gr_msg_queue::flush() -{ - gr_message_sptr m; - - while ((m = delete_head_nowait ()) != 0) - ; -} diff --git a/gnuradio-runtime/lib/gr_preferences.cc b/gnuradio-runtime/lib/gr_preferences.cc deleted file mode 100644 index a0f5616603..0000000000 --- a/gnuradio-runtime/lib/gr_preferences.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2010,2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_preferences.h> -#include <gr_sys_paths.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <string.h> - -#include <boost/filesystem/operations.hpp> -#include <boost/filesystem/path.hpp> -namespace fs = boost::filesystem; - -/* - * The simplest thing that could possibly work: - * the key is the filename; the value is the file contents. - */ - -static const char * -pathname (const char *key) -{ - static fs::path path; - path = fs::path(gr_appdata_path()) / ".gnuradio" / "prefs" / key; - return path.string().c_str(); -} - -static void -ensure_dir_path () -{ - fs::path path = fs::path(gr_appdata_path()) / ".gnuradio"; - if (!fs::is_directory(path)) fs::create_directory(path); - - path = path / "prefs"; - if (!fs::is_directory(path)) fs::create_directory(path); -} - -const char * -gr_preferences::get (const char *key) -{ - static char buf[1024]; - - FILE *fp = fopen (pathname (key), "r"); - if (fp == 0) { - perror (pathname (key)); - return 0; - } - - memset (buf, 0, sizeof (buf)); - size_t ret = fread (buf, 1, sizeof (buf) - 1, fp); - if(ret == 0) { - if(ferror(fp) != 0) { - perror (pathname (key)); - fclose (fp); - return 0; - } - } - fclose (fp); - return buf; -} - -void -gr_preferences::set (const char *key, const char *value) -{ - ensure_dir_path (); - - FILE *fp = fopen (pathname (key), "w"); - if (fp == 0){ - perror (pathname (key)); - return; - } - - size_t ret = fwrite (value, 1, strlen (value), fp); - if(ret == 0) { - if(ferror(fp) != 0) { - perror (pathname (key)); - fclose (fp); - return; - } - } - fclose (fp); -}; diff --git a/gnuradio-runtime/lib/gr_prefs.cc b/gnuradio-runtime/lib/gr_prefs.cc deleted file mode 100644 index 8a79c3335f..0000000000 --- a/gnuradio-runtime/lib/gr_prefs.cc +++ /dev/null @@ -1,391 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2013 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_prefs.h> -#include <gr_sys_paths.h> -#include <gr_constants.h> -#include <algorithm> - -#include <boost/filesystem/operations.hpp> -#include <boost/filesystem/path.hpp> -#include <boost/filesystem/fstream.hpp> -namespace fs = boost::filesystem; - -/* - * Stub implementations - */ - -static gr_prefs s_default_singleton; -static gr_prefs *s_singleton = &s_default_singleton; - -gr_prefs * -gr_prefs::singleton() -{ - return s_singleton; -} - -void -gr_prefs::set_singleton(gr_prefs *p) -{ - s_singleton = p; -} - -gr_prefs::gr_prefs() -{ - _read_files(); -} - -gr_prefs::~gr_prefs() -{ - // nop -} - -std::vector<std::string> -gr_prefs::_sys_prefs_filenames() -{ - std::vector<std::string> fnames; - - fs::path dir = gr_prefsdir(); - if(!fs::is_directory(dir)) - return fnames; - - fs::directory_iterator diritr(dir); - while(diritr != fs::directory_iterator()) { - fs::path p = *diritr++; - if(p.extension() != ".swp") - fnames.push_back(p.string()); - } - std::sort(fnames.begin(), fnames.end()); - - // Find if there is a ~/.gnuradio/config.conf file and add this to - // the end of the file list to override any preferences in the - // installed path config files. - fs::path homedir = fs::path(gr_appdata_path()); - homedir = homedir/".gnuradio/config.conf"; - if(fs::exists(homedir)) { - fnames.push_back(homedir.string()); - } - - return fnames; -} - -void -gr_prefs::_read_files() -{ - std::string config; - - std::vector<std::string> filenames = _sys_prefs_filenames(); - std::vector<std::string>::iterator sitr; - char tmp[1024]; - for(sitr = filenames.begin(); sitr != filenames.end(); sitr++) { - fs::ifstream fin(*sitr); - while(!fin.eof()) { - fin.getline(tmp, 1024); - std::string t(tmp); - // ignore empty lines or lines of just comments - if((t.size() > 0) && (t[0] != '#')) { - // remove any comments in the line - size_t hash = t.find("#"); - - // Use hash marks at the end of each segment as a delimiter - config += t.substr(0, hash) + '#'; - } - } - fin.close(); - } - - // Remove all whitespace. - config.erase(std::remove_if(config.begin(), config.end(), ::isspace), config.end()); - - // Convert the string into a map - _convert_to_map(config); -} - -void -gr_prefs::_convert_to_map(const std::string &conf) -{ - // Convert the string into an map of maps - // Map is structured as {section name: map of options} - // And options map is simply: {option name: option value} - std::string sub = conf; - size_t sec_start = sub.find("["); - while(sec_start != std::string::npos) { - sub = sub.substr(sec_start); - - size_t sec_end = sub.find("]"); - if(sec_end == std::string::npos) - throw std::runtime_error("Config file error: Mismatched section label.\n"); - - std::string sec = sub.substr(1, sec_end-1); - size_t next_sec_start = sub.find("[", sec_end); - std::string subsec = sub.substr(sec_end+1, next_sec_start-sec_end-2); - - std::transform(sec.begin(), sec.end(), sec.begin(), ::tolower); - - std::map<std::string, std::string> options_map = d_config_map[sec]; - size_t next_opt = 0; - size_t next_val = 0; - next_opt = subsec.find("#"); - while(next_opt < subsec.size()-1) { - next_val = subsec.find("=", next_opt); - std::string option = subsec.substr(next_opt+1, next_val-next_opt-1); - - next_opt = subsec.find("#", next_val); - std::string value = subsec.substr(next_val+1, next_opt-next_val-1); - - std::transform(option.begin(), option.end(), option.begin(), ::tolower); - options_map[option] = value; - } - - d_config_map[sec] = options_map; - - sec_start = sub.find("[", sec_end); - } -} - -std::string -gr_prefs::to_string() -{ - gr_config_map_itr sections; - gr_config_map_elem_itr options; - std::stringstream s; - - for(sections = d_config_map.begin(); sections != d_config_map.end(); sections++) { - s << "[" << sections->first << "]" << std::endl; - for(options = sections->second.begin(); options != sections->second.end(); options++) { - s << options->first << " = " << options->second << std::endl; - } - s << std::endl; - } - - return s.str(); -} - -void -gr_prefs::save() -{ - std::string conf = to_string(); - - fs::path homedir = fs::path(gr_appdata_path()); - homedir = homedir/".gnuradio/config.conf"; - fs::ofstream fout(homedir); - fout << conf; - fout.close(); -} - -char * -gr_prefs::option_to_env(std::string section, std::string option) -{ - std::stringstream envname; - std::string secname=section, optname=option; - - std::transform(section.begin(), section.end(), secname.begin(), ::toupper); - std::transform(option.begin(), option.end(), optname.begin(), ::toupper); - envname << "GR_CONF_" << secname << "_" << optname; - - return getenv(envname.str().c_str()); -} - -bool -gr_prefs::has_section(const std::string §ion) -{ - std::string s = section; - std::transform(section.begin(), section.end(), s.begin(), ::tolower); - return d_config_map.count(s) > 0; -} - -bool -gr_prefs::has_option(const std::string §ion, const std::string &option) -{ - if(option_to_env(section, option)) - return true; - - if(has_section(section)) { - std::string s = section; - std::transform(section.begin(), section.end(), s.begin(), ::tolower); - - std::string o = option; - std::transform(option.begin(), option.end(), o.begin(), ::tolower); - - gr_config_map_itr sec = d_config_map.find(s); - return sec->second.count(o) > 0; - } - else { - return false; - } -} - -const std::string -gr_prefs::get_string(const std::string §ion, const std::string &option, - const std::string &default_val) -{ - char *env = option_to_env(section, option); - if(env) - return std::string(env); - - if(has_option(section, option)) { - std::string s = section; - std::transform(section.begin(), section.end(), s.begin(), ::tolower); - - std::string o = option; - std::transform(option.begin(), option.end(), o.begin(), ::tolower); - - gr_config_map_itr sec = d_config_map.find(s); - gr_config_map_elem_itr opt = sec->second.find(o); - return opt->second; - } - else { - return default_val; - } -} - -void -gr_prefs::set_string(const std::string §ion, const std::string &option, - const std::string &val) -{ - std::string s = section; - std::transform(section.begin(), section.end(), s.begin(), ::tolower); - - std::string o = option; - std::transform(option.begin(), option.end(), o.begin(), ::tolower); - - std::map<std::string, std::string> opt_map = d_config_map[s]; - - opt_map[o] = val; - - d_config_map[s] = opt_map; -} - -bool -gr_prefs::get_bool(const std::string §ion, const std::string &option, bool default_val) -{ - if(has_option(section, option)) { - std::string str = get_string(section, option, ""); - if(str == "") { - return default_val; - } - std::transform(str.begin(), str.end(), str.begin(), ::tolower); - if((str == "true") || (str == "on") || (str == "1")) - return true; - else if((str == "false") || (str == "off") || (str == "0")) - return false; - else - return default_val; - } - else { - return default_val; - } -} - -void -gr_prefs::set_bool(const std::string §ion, const std::string &option, bool val) -{ - std::string s = section; - std::transform(section.begin(), section.end(), s.begin(), ::tolower); - - std::string o = option; - std::transform(option.begin(), option.end(), o.begin(), ::tolower); - - std::map<std::string, std::string> opt_map = d_config_map[s]; - - std::stringstream sstr; - sstr << (val == true); - opt_map[o] = sstr.str(); - - d_config_map[s] = opt_map; -} - -long -gr_prefs::get_long(const std::string §ion, const std::string &option, long default_val) -{ - if(has_option(section, option)) { - std::string str = get_string(section, option, ""); - if(str == "") { - return default_val; - } - std::stringstream sstr(str); - long n; - sstr >> n; - return n; - } - else { - return default_val; - } -} - -void -gr_prefs::set_long(const std::string §ion, const std::string &option, long val) -{ - std::string s = section; - std::transform(section.begin(), section.end(), s.begin(), ::tolower); - - std::string o = option; - std::transform(option.begin(), option.end(), o.begin(), ::tolower); - - std::map<std::string, std::string> opt_map = d_config_map[s]; - - std::stringstream sstr; - sstr << val; - opt_map[o] = sstr.str(); - - d_config_map[s] = opt_map; -} - -double -gr_prefs::get_double(const std::string §ion, const std::string &option, double default_val) -{ - if(has_option(section, option)) { - std::string str = get_string(section, option, ""); - if(str == "") { - return default_val; - } - std::stringstream sstr(str); - double n; - sstr >> n; - return n; - } - else { - return default_val; - } -} - -void -gr_prefs::set_double(const std::string §ion, const std::string &option, double val) -{ - std::string s = section; - std::transform(section.begin(), section.end(), s.begin(), ::tolower); - - std::string o = option; - std::transform(option.begin(), option.end(), o.begin(), ::tolower); - - std::map<std::string, std::string> opt_map = d_config_map[s]; - - std::stringstream sstr; - sstr << val; - opt_map[o] = sstr.str(); - - d_config_map[s] = opt_map; -} diff --git a/gnuradio-runtime/lib/gr_random.cc b/gnuradio-runtime/lib/gr_random.cc deleted file mode 100644 index 323839acc7..0000000000 --- a/gnuradio-runtime/lib/gr_random.cc +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -/* - * Copyright 1997 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <math.h> -#include <gr_random.h> - -#define IA 16807 -#define IM 2147483647 -#define AM (1.0/IM) -#define IQ 127773 -#define IR 2836 -#define NDIV (1+(IM-1)/NTAB) -#define EPS 1.2e-7 -#define RNMX (1.0-EPS) - - -gr_random::gr_random (long seed) -{ - reseed (seed); -} - -void -gr_random::reseed (long seed) -{ - d_seed = seed; - d_iy = 0; - for (int i = 0; i < NTAB; i++) - d_iv[i] = 0; - d_iset = 0; - d_gset = 0; -} - -/* - * This looks like it returns a uniform random deviate between 0.0 and 1.0 - * It looks similar to code from "Numerical Recipes in C". - */ -float gr_random::ran1() -{ - int j; - long k; - float temp; - - if (d_seed <= 0 || !d_iy) { - if (-d_seed < 1) - d_seed=1; - else - d_seed = -d_seed; - for (j=NTAB+7;j>=0;j--) { - k=d_seed/IQ; - d_seed=IA*(d_seed-k*IQ)-IR*k; - if (d_seed < 0) - d_seed += IM; - if (j < NTAB) - d_iv[j] = d_seed; - } - d_iy=d_iv[0]; - } - k=(d_seed)/IQ; - d_seed=IA*(d_seed-k*IQ)-IR*k; - if (d_seed < 0) - d_seed += IM; - j=d_iy/NDIV; - d_iy=d_iv[j]; - d_iv[j] = d_seed; - temp=AM * d_iy; - if (temp > RNMX) - temp = RNMX; - return temp; -} - -/* - * Returns a normally distributed deviate with zero mean and variance 1. - * Also looks like it's from "Numerical Recipes in C". - */ -float gr_random::gasdev() -{ - float fac,rsq,v1,v2; - d_iset = 1 - d_iset; - if (d_iset) { - do { - v1=2.0*ran1()-1.0; - v2=2.0*ran1()-1.0; - rsq=v1*v1+v2*v2; - } while (rsq >= 1.0 || rsq == 0.0); - fac= sqrt(-2.0*log(rsq)/rsq); - d_gset=v1*fac; - return v2*fac; - } - return d_gset; -} - -/* - * Copied from The KC7WW / OH2BNS Channel Simulator - * FIXME Need to check how good this is at some point - */ - -float gr_random::laplacian() -{ - float z = ran1(); - if (z < 0.5) - return log(2.0 * z) / M_SQRT2; - else - return -log(2.0 * (1.0 - z)) / M_SQRT2; -} - -/* - * Copied from The KC7WW / OH2BNS Channel Simulator - * FIXME Need to check how good this is at some point - */ - - // 5 => scratchy, 8 => Geiger - -float gr_random::impulse(float factor = 5) -{ - float z = -M_SQRT2 * log(ran1()); - if (fabsf(z) <= factor) - return 0.0; - else - return z; -} - -/* - * Complex rayleigh is really gaussian I and gaussian Q - * It can also be generated by real rayleigh magnitude and - * uniform random angle - * Adapted from The KC7WW / OH2BNS Channel Simulator - * FIXME Need to check how good this is at some point - */ - -gr_complex gr_random::rayleigh_complex() -{ - return gr_complex(gasdev(),gasdev()); -} - -/* Other option - mag = rayleigh(); - ang = 2.0 * M_PI * RNG(); - *Rx = rxx * cos(z); - *Iy = rxx * sin(z); -*/ - - -float gr_random::rayleigh() -{ - return sqrt(-2.0 * log(ran1())); -} diff --git a/gnuradio-runtime/lib/gr_random.h b/gnuradio-runtime/lib/gr_random.h deleted file mode 100644 index 783c05f920..0000000000 --- a/gnuradio-runtime/lib/gr_random.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#ifndef INCLUDED_GR_RANDOM_H -#define INCLUDED_GR_RANDOM_H - -#include <gr_runtime_api.h> -#include <gr_complex.h> - -/*! - * \brief pseudo random number generator - * \ingroup math_blk - */ -class GR_RUNTIME_API gr_random { -protected: - static const int NTAB = 32; - long d_seed; - long d_iy; - long d_iv[NTAB]; - int d_iset; - float d_gset; - - -public: - gr_random (long seed=3021); - - void reseed (long seed); - - /*! - * \brief uniform random deviate in the range [0.0, 1.0) - */ - float ran1 (); - - /*! - * \brief normally distributed deviate with zero mean and variance 1 - */ - float gasdev (); - - float laplacian (); - float impulse (float factor); - float rayleigh (); - gr_complex rayleigh_complex (); -}; - -#endif /* INCLUDED_GR_RANDOM_H */ - diff --git a/gnuradio-runtime/lib/gr_realtime.cc b/gnuradio-runtime/lib/gr_realtime.cc deleted file mode 100644 index 9977718a5d..0000000000 --- a/gnuradio-runtime/lib/gr_realtime.cc +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007,2008 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_realtime.h> -#include <realtime.h> - -gr_rt_status_t -gr_enable_realtime_scheduling() -{ - return gr::enable_realtime_scheduling(); -} diff --git a/gnuradio-runtime/lib/gr_reverse.h b/gnuradio-runtime/lib/gr_reverse.h deleted file mode 100644 index aa8619619f..0000000000 --- a/gnuradio-runtime/lib/gr_reverse.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ -#ifndef INCLUDED_GR_REVERSE_H -#define INCLUDED_GR_REVERSE_H - -#include <gr_runtime_api.h> -#include <vector> -#include <gr_complex.h> - -// reverse the order of taps -std::vector<float> gr_reverse (const std::vector<float> &taps); -std::vector<gr_complex> gr_reverse (const std::vector<gr_complex> &taps); - - -#endif /* INCLUDED_GR_REVERSE_H */ diff --git a/gnuradio-runtime/lib/gr_scheduler.h b/gnuradio-runtime/lib/gr_scheduler.h deleted file mode 100644 index 097f575c21..0000000000 --- a/gnuradio-runtime/lib/gr_scheduler.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef INCLUDED_GR_SCHEDULER_H -#define INCLUDED_GR_SCHEDULER_H - -#include <gr_runtime_api.h> -#include <boost/utility.hpp> -#include <gr_block.h> -#include <gr_flat_flowgraph.h> - - -class gr_scheduler; -typedef boost::shared_ptr<gr_scheduler> gr_scheduler_sptr; - - -/*! - * \brief Abstract scheduler that takes a flattened flow graph and runs it. - * - * Preconditions: details, buffers and buffer readers have been assigned. - */ -class GR_RUNTIME_API gr_scheduler : boost::noncopyable -{ - -public: - /*! - * \brief Construct a scheduler and begin evaluating the graph. - * - * The scheduler will continue running until all blocks until they - * report that they are done or the stop method is called. - */ - gr_scheduler(gr_flat_flowgraph_sptr ffg, int max_noutput_items); - - virtual ~gr_scheduler(); - - /*! - * \brief Tell the scheduler to stop executing. - */ - virtual void stop() = 0; - - /*! - * \brief Block until the graph is done. - */ - virtual void wait() = 0; -}; - -#endif /* INCLUDED_GR_SCHEDULER_H */ diff --git a/gnuradio-runtime/lib/gr_scheduler_sts.cc b/gnuradio-runtime/lib/gr_scheduler_sts.cc deleted file mode 100644 index 10f01edaf6..0000000000 --- a/gnuradio-runtime/lib/gr_scheduler_sts.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_scheduler_sts.h> -#include <gr_single_threaded_scheduler.h> -#include <thread/thread_body_wrapper.h> - -class sts_container -{ - gr_block_vector_t d_blocks; - -public: - - sts_container(gr_block_vector_t blocks) - : d_blocks(blocks) {} - - void operator()() - { - gr_make_single_threaded_scheduler(d_blocks)->run(); - } -}; - - -gr_scheduler_sptr -gr_scheduler_sts::make(gr_flat_flowgraph_sptr ffg, int max_noutput_items) -{ - return gr_scheduler_sptr(new gr_scheduler_sts(ffg, max_noutput_items)); -} - -gr_scheduler_sts::gr_scheduler_sts(gr_flat_flowgraph_sptr ffg, int max_noutput_items) - : gr_scheduler(ffg, max_noutput_items) -{ - // Split the flattened flow graph into discrete partitions, each - // of which is topologically sorted. - - std::vector<gr_basic_block_vector_t> graphs = ffg->partition(); - - // For each partition, create a thread to evaluate it using - // an instance of the gr_single_threaded_scheduler - - for (std::vector<gr_basic_block_vector_t>::iterator p = graphs.begin(); - p != graphs.end(); p++) { - - gr_block_vector_t blocks = gr_flat_flowgraph::make_block_vector(*p); - d_threads.create_thread( - gr::thread::thread_body_wrapper<sts_container>(sts_container(blocks), - "single-threaded-scheduler")); - } -} - -gr_scheduler_sts::~gr_scheduler_sts() -{ - stop(); -} - -void -gr_scheduler_sts::stop() -{ - d_threads.interrupt_all(); -} - -void -gr_scheduler_sts::wait() -{ - d_threads.join_all(); -} diff --git a/gnuradio-runtime/lib/gr_scheduler_sts.h b/gnuradio-runtime/lib/gr_scheduler_sts.h deleted file mode 100644 index af98c6d8ba..0000000000 --- a/gnuradio-runtime/lib/gr_scheduler_sts.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_GR_SCHEDULER_STS_H -#define INCLUDED_GR_SCHEDULER_STS_H - -#include <gr_runtime_api.h> -#include <gr_scheduler.h> -#include <thread/thread_group.h> - -/*! - * \brief Concrete scheduler that uses the single_threaded_scheduler - */ -class GR_RUNTIME_API gr_scheduler_sts : public gr_scheduler -{ - gr::thread::thread_group d_threads; - -protected: - /*! - * \brief Construct a scheduler and begin evaluating the graph. - * - * The scheduler will continue running until all blocks until they - * report that they are done or the stop method is called. - */ - gr_scheduler_sts(gr_flat_flowgraph_sptr ffg, int max_noutput_items); - -public: - static gr_scheduler_sptr make(gr_flat_flowgraph_sptr ffg, int max_noutput_items); - - ~gr_scheduler_sts(); - - /*! - * \brief Tell the scheduler to stop executing. - */ - void stop(); - - /*! - * \brief Block until the graph is done. - */ - void wait(); -}; - - - - -#endif /* INCLUDED_GR_SCHEDULER_STS_H */ diff --git a/gnuradio-runtime/lib/gr_scheduler_tpb.cc b/gnuradio-runtime/lib/gr_scheduler_tpb.cc deleted file mode 100644 index e67078632f..0000000000 --- a/gnuradio-runtime/lib/gr_scheduler_tpb.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_scheduler_tpb.h> -#include <gr_tpb_thread_body.h> -#include <thread/thread_body_wrapper.h> -#include <sstream> - -/* - * You know, a lambda expression would be sooo much easier... - */ -class tpb_container -{ - gr_block_sptr d_block; - int d_max_noutput_items; - -public: - tpb_container(gr_block_sptr block, int max_noutput_items) - : d_block(block), d_max_noutput_items(max_noutput_items) {} - - void operator()() - { - gr_tpb_thread_body body(d_block, d_max_noutput_items); - } -}; - - -gr_scheduler_sptr -gr_scheduler_tpb::make(gr_flat_flowgraph_sptr ffg, int max_noutput_items) -{ - return gr_scheduler_sptr(new gr_scheduler_tpb(ffg, max_noutput_items)); -} - -gr_scheduler_tpb::gr_scheduler_tpb(gr_flat_flowgraph_sptr ffg, int max_noutput_items) - : gr_scheduler(ffg, max_noutput_items) -{ - // Get a topologically sorted vector of all the blocks in use. - // Being topologically sorted probably isn't going to matter, but - // there's a non-zero chance it might help... - - gr_basic_block_vector_t used_blocks = ffg->calc_used_blocks(); - used_blocks = ffg->topological_sort(used_blocks); - gr_block_vector_t blocks = gr_flat_flowgraph::make_block_vector(used_blocks); - - // Ensure that the done flag is clear on all blocks - - for (size_t i = 0; i < blocks.size(); i++){ - blocks[i]->detail()->set_done(false); - } - - // Fire off a thead for each block - - for (size_t i = 0; i < blocks.size(); i++){ - std::stringstream name; - name << "thread-per-block[" << i << "]: " << blocks[i]; - - // If set, use internal value instead of global value - if(blocks[i]->is_set_max_noutput_items()) - max_noutput_items = blocks[i]->max_noutput_items(); - - d_threads.create_thread( - gr::thread::thread_body_wrapper<tpb_container>(tpb_container(blocks[i], max_noutput_items), - name.str())); - } -} - -gr_scheduler_tpb::~gr_scheduler_tpb() -{ - stop(); -} - -void -gr_scheduler_tpb::stop() -{ - d_threads.interrupt_all(); -} - -void -gr_scheduler_tpb::wait() -{ - d_threads.join_all(); -} diff --git a/gnuradio-runtime/lib/gr_scheduler_tpb.h b/gnuradio-runtime/lib/gr_scheduler_tpb.h deleted file mode 100644 index 4ab7bb16d2..0000000000 --- a/gnuradio-runtime/lib/gr_scheduler_tpb.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_GR_SCHEDULER_TPB_H -#define INCLUDED_GR_SCHEDULER_TPB_H - -#include <gr_runtime_api.h> -#include <gr_scheduler.h> -#include <thread/thread_group.h> - -/*! - * \brief Concrete scheduler that uses a kernel thread-per-block - */ -class GR_RUNTIME_API gr_scheduler_tpb : public gr_scheduler -{ - gr::thread::thread_group d_threads; - -protected: - /*! - * \brief Construct a scheduler and begin evaluating the graph. - * - * The scheduler will continue running until all blocks until they - * report that they are done or the stop method is called. - */ - gr_scheduler_tpb(gr_flat_flowgraph_sptr ffg, int max_noutput_items); - -public: - static gr_scheduler_sptr make(gr_flat_flowgraph_sptr ffg, int max_noutput_items=100000); - - ~gr_scheduler_tpb(); - - /*! - * \brief Tell the scheduler to stop executing. - */ - void stop(); - - /*! - * \brief Block until the graph is done. - */ - void wait(); -}; - - -#endif /* INCLUDED_GR_SCHEDULER_TPB_H */ diff --git a/gnuradio-runtime/lib/gr_single_threaded_scheduler.cc b/gnuradio-runtime/lib/gr_single_threaded_scheduler.cc deleted file mode 100644 index 1bb9e9b0a8..0000000000 --- a/gnuradio-runtime/lib/gr_single_threaded_scheduler.cc +++ /dev/null @@ -1,364 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_single_threaded_scheduler.h> -#include <gr_block.h> -#include <gr_block_detail.h> -#include <gr_buffer.h> -#include <boost/thread.hpp> -#include <boost/format.hpp> -#include <iostream> -#include <limits> -#include <assert.h> -#include <stdio.h> - -// must be defined to either 0 or 1 -#define ENABLE_LOGGING 0 - -#if (ENABLE_LOGGING) -#define LOG(x) do { x; } while(0) -#else -#define LOG(x) do {;} while(0) -#endif - -static int which_scheduler = 0; - -gr_single_threaded_scheduler_sptr -gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &blocks) -{ - return - gr_single_threaded_scheduler_sptr (new gr_single_threaded_scheduler (blocks)); -} - -gr_single_threaded_scheduler::gr_single_threaded_scheduler ( - const std::vector<gr_block_sptr> &blocks) - : d_blocks (blocks), d_enabled (true), d_log(0) -{ - if (ENABLE_LOGGING){ - 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"; - } -} - -gr_single_threaded_scheduler::~gr_single_threaded_scheduler () -{ - if (ENABLE_LOGGING) - delete d_log; -} - -void -gr_single_threaded_scheduler::run () -{ - // d_enabled = true; // KLUDGE - main_loop (); -} - -void -gr_single_threaded_scheduler::stop () -{ - if (0) - std::cout << "gr_singled_threaded_scheduler::stop() " - << this << std::endl; - d_enabled = false; -} - -inline static unsigned int -round_up (unsigned int n, unsigned int multiple) -{ - return ((n + multiple - 1) / multiple) * multiple; -} - -inline static unsigned int -round_down (unsigned int n, unsigned int multiple) -{ - return (n / multiple) * multiple; -} - -// -// Return minimum available write space in all our downstream buffers -// or -1 if we're output blocked and the output we're blocked -// on is done. -// -static int -min_available_space (gr_block_detail *d, int output_multiple) -{ - int min_space = std::numeric_limits<int>::max(); - - for (int i = 0; i < d->noutputs (); i++){ - int n = round_down (d->output(i)->space_available (), output_multiple); - if (n == 0){ // We're blocked on output. - if (d->output(i)->done()){ // Downstream is done, therefore we're done. - return -1; - } - return 0; - } - min_space = std::min (min_space, n); - } - return min_space; -} - -void -gr_single_threaded_scheduler::main_loop () -{ - static const int DEFAULT_CAPACITY = 16; - - int noutput_items; - gr_vector_int ninput_items_required (DEFAULT_CAPACITY); - gr_vector_int ninput_items (DEFAULT_CAPACITY); - gr_vector_const_void_star input_items (DEFAULT_CAPACITY); - gr_vector_void_star output_items (DEFAULT_CAPACITY); - unsigned int bi; - unsigned int nalive; - int max_items_avail; - bool made_progress_last_pass; - bool making_progress; - - for (unsigned i = 0; i < d_blocks.size (); i++) - d_blocks[i]->detail()->set_done (false); // reset any done flags - - for (unsigned i = 0; i < d_blocks.size (); i++) // enable any drivers, etc. - d_blocks[i]->start(); - - - bi = 0; - made_progress_last_pass = true; - making_progress = false; - - // Loop while there are still blocks alive - - nalive = d_blocks.size (); - while (d_enabled && nalive > 0){ - - if (boost::this_thread::interruption_requested()) - break; - - gr_block *m = d_blocks[bi].get (); - gr_block_detail *d = m->detail().get (); - - LOG(*d_log << std::endl << m); - - if (d->done ()) - goto next_block; - - if (d->source_p ()){ - // Invoke sources as a last resort. As long as the previous pass - // made progress, don't call a source. - if (made_progress_last_pass){ - LOG(*d_log << " Skipping source\n"); - goto next_block; - } - - ninput_items_required.resize (0); - ninput_items.resize (0); - input_items.resize (0); - output_items.resize (d->noutputs ()); - - // determine the minimum available output space - noutput_items = min_available_space (d, m->output_multiple ()); - LOG(*d_log << " source\n noutput_items = " << noutput_items << std::endl); - if (noutput_items == -1) // we're done - goto were_done; - - if (noutput_items == 0){ // we're output blocked - LOG(*d_log << " BLKD_OUT\n"); - goto next_block; - } - - goto setup_call_to_work; // jump to common code - } - - else if (d->sink_p ()){ - ninput_items_required.resize (d->ninputs ()); - ninput_items.resize (d->ninputs ()); - input_items.resize (d->ninputs ()); - output_items.resize (0); - LOG(*d_log << " sink\n"); - - max_items_avail = 0; - for (int i = 0; i < d->ninputs (); i++){ - ninput_items[i] = d->input(i)->items_available(); - //if (ninput_items[i] == 0 && d->input(i)->done()) - if (ninput_items[i] < m->output_multiple() && d->input(i)->done()) - goto were_done; - - max_items_avail = std::max (max_items_avail, ninput_items[i]); - } - - // take a swag at how much output we can sink - noutput_items = (int) (max_items_avail * m->relative_rate ()); - noutput_items = round_down (noutput_items, m->output_multiple ()); - LOG(*d_log << " max_items_avail = " << max_items_avail << std::endl); - LOG(*d_log << " noutput_items = " << noutput_items << std::endl); - - if (noutput_items == 0){ // we're blocked on input - LOG(*d_log << " BLKD_IN\n"); - goto next_block; - } - - goto try_again; // Jump to code shared with regular case. - } - - else { - // do the regular thing - ninput_items_required.resize (d->ninputs ()); - ninput_items.resize (d->ninputs ()); - input_items.resize (d->ninputs ()); - output_items.resize (d->noutputs ()); - - max_items_avail = 0; - for (int i = 0; i < d->ninputs (); i++){ - ninput_items[i] = d->input(i)->items_available (); - max_items_avail = std::max (max_items_avail, ninput_items[i]); - } - - // determine the minimum available output space - noutput_items = min_available_space (d, m->output_multiple ()); - if (ENABLE_LOGGING){ - *d_log << " regular "; - if (m->relative_rate() >= 1.0) - *d_log << "1:" << m->relative_rate() << std::endl; - else - *d_log << 1.0/m->relative_rate() << ":1\n"; - *d_log << " max_items_avail = " << max_items_avail << std::endl; - *d_log << " noutput_items = " << noutput_items << std::endl; - } - if (noutput_items == -1) // we're done - goto were_done; - - if (noutput_items == 0){ // we're output blocked - LOG(*d_log << " BLKD_OUT\n"); - goto next_block; - } - -#if 0 - // Compute best estimate of noutput_items that we can really use. - noutput_items = - std::min ((unsigned) noutput_items, - std::max ((unsigned) m->output_multiple(), - round_up ((unsigned) (max_items_avail * m->relative_rate()), - m->output_multiple ()))); - - LOG(*d_log << " revised noutput_items = " << noutput_items << std::endl); -#endif - - try_again: - if (m->fixed_rate()){ - // try to work it forward starting with max_items_avail. - // We want to try to consume all the input we've got. - int reqd_noutput_items = m->fixed_rate_ninput_to_noutput(max_items_avail); - reqd_noutput_items = round_up(reqd_noutput_items, m->output_multiple()); - if (reqd_noutput_items > 0 && reqd_noutput_items <= noutput_items) - noutput_items = reqd_noutput_items; - } - - // ask the block how much input they need to produce noutput_items - m->forecast (noutput_items, ninput_items_required); - - // See if we've got sufficient input available - - int i; - for (i = 0; i < d->ninputs (); i++) - if (ninput_items_required[i] > ninput_items[i]) // not enough - break; - - if (i < d->ninputs ()){ // not enough input on input[i] - // if we can, try reducing the size of our output request - if (noutput_items > m->output_multiple ()){ - noutput_items /= 2; - noutput_items = round_up (noutput_items, m->output_multiple ()); - goto try_again; - } - - // We're blocked on input - LOG(*d_log << " BLKD_IN\n"); - if (d->input(i)->done()) // If the upstream block is done, we're done - goto were_done; - - // Is it possible to ever fulfill this request? - if (ninput_items_required[i] > d->input(i)->max_possible_items_available ()){ - // Nope, never going to happen... - std::cerr << "\nsched: <gr_block " << m->name() - << " (" << m->unique_id() << ")>" - << " is requesting more input data\n" - << " than we can provide.\n" - << " ninput_items_required = " - << ninput_items_required[i] << "\n" - << " max_possible_items_available = " - << d->input(i)->max_possible_items_available() << "\n" - << " If this is a filter, consider reducing the number of taps.\n"; - goto were_done; - } - - goto next_block; - } - - // We've got enough data on each input to produce noutput_items. - // Finish setting up the call to work. - - for (int i = 0; i < d->ninputs (); i++) - input_items[i] = d->input(i)->read_pointer(); - - setup_call_to_work: - - for (int i = 0; i < d->noutputs (); i++) - output_items[i] = d->output(i)->write_pointer(); - - // Do the actual work of the block - int n = m->general_work (noutput_items, ninput_items, - input_items, output_items); - LOG(*d_log << " general_work: noutput_items = " << noutput_items - << " result = " << n << std::endl); - - if (n == -1) // block is done - goto were_done; - - d->produce_each (n); // advance write pointers - if (n > 0) - making_progress = true; - - goto next_block; - } - assert (0); - - were_done: - LOG(*d_log << " were_done\n"); - d->set_done (true); - nalive--; - - next_block: - if (++bi >= d_blocks.size ()){ - bi = 0; - made_progress_last_pass = making_progress; - making_progress = false; - } - } - - for (unsigned i = 0; i < d_blocks.size (); i++) // disable any drivers, etc. - d_blocks[i]->stop(); -} diff --git a/gnuradio-runtime/lib/gr_sync_block.cc b/gnuradio-runtime/lib/gr_sync_block.cc deleted file mode 100644 index 94efcdc8ee..0000000000 --- a/gnuradio-runtime/lib/gr_sync_block.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_sync_block.h> - -gr_sync_block::gr_sync_block (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature) - : gr_block(name, input_signature, output_signature) -{ - set_fixed_rate(true); -} - - -void -gr_sync_block::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = fixed_rate_noutput_to_ninput (noutput_items); -} - -int -gr_sync_block::fixed_rate_noutput_to_ninput(int noutput_items) -{ - return noutput_items + history() - 1; -} - -int -gr_sync_block::fixed_rate_ninput_to_noutput(int ninput_items) -{ - return std::max(0, ninput_items - (int)history() + 1); -} - -int -gr_sync_block::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int r = work (noutput_items, input_items, output_items); - if (r > 0) - consume_each (r); - return r; -} diff --git a/gnuradio-runtime/lib/gr_sync_decimator.cc b/gnuradio-runtime/lib/gr_sync_decimator.cc deleted file mode 100644 index a0f907db53..0000000000 --- a/gnuradio-runtime/lib/gr_sync_decimator.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_sync_decimator.h> - -gr_sync_decimator::gr_sync_decimator (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - unsigned decimation) - : gr_sync_block (name, input_signature, output_signature) -{ - set_decimation (decimation); -} - -void -gr_sync_decimator::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size (); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = fixed_rate_noutput_to_ninput(noutput_items); -} - -int -gr_sync_decimator::fixed_rate_noutput_to_ninput(int noutput_items) -{ - return noutput_items * decimation() + history() - 1; -} - -int -gr_sync_decimator::fixed_rate_ninput_to_noutput(int ninput_items) -{ - return std::max(0, ninput_items - (int)history() + 1) / decimation(); -} - -int -gr_sync_decimator::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int r = work (noutput_items, input_items, output_items); - if (r > 0) - consume_each (r * decimation ()); - return r; -} - diff --git a/gnuradio-runtime/lib/gr_sync_interpolator.cc b/gnuradio-runtime/lib/gr_sync_interpolator.cc deleted file mode 100644 index ece873c14a..0000000000 --- a/gnuradio-runtime/lib/gr_sync_interpolator.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_sync_interpolator.h> - -gr_sync_interpolator::gr_sync_interpolator (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - unsigned interpolation) - : gr_sync_block (name, input_signature, output_signature) -{ - set_interpolation (interpolation); -} - -void -gr_sync_interpolator::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size (); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = fixed_rate_noutput_to_ninput(noutput_items); -} - -int -gr_sync_interpolator::fixed_rate_noutput_to_ninput(int noutput_items) -{ - return noutput_items / interpolation() + history() - 1; -} - -int -gr_sync_interpolator::fixed_rate_ninput_to_noutput(int ninput_items) -{ - return std::max(0, ninput_items - (int)history() + 1) * interpolation(); -} - -int -gr_sync_interpolator::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int r = work (noutput_items, input_items, output_items); - if (r > 0) - consume_each (r / interpolation ()); - return r; -} - - diff --git a/gnuradio-runtime/lib/gr_tagged_stream_block.cc b/gnuradio-runtime/lib/gr_tagged_stream_block.cc deleted file mode 100644 index a60515f481..0000000000 --- a/gnuradio-runtime/lib/gr_tagged_stream_block.cc +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2013 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <boost/format.hpp> -#include <gr_tagged_stream_block.h> - -gr_tagged_stream_block::gr_tagged_stream_block (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - const std::string &length_tag_key) - : gr_block(name, input_signature, output_signature), - d_length_tag_key(pmt::string_to_symbol(length_tag_key)), - d_n_input_items_reqd(input_signature->min_streams(), 0), - d_length_tag_key_str(length_tag_key) -{ -} - - -// This is evil hackery: We trick the scheduler into creating the right number of input items -void -gr_tagged_stream_block::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i = 0; i < ninputs; i++) { - if (i < d_n_input_items_reqd.size() && d_n_input_items_reqd[i] != 0) { - ninput_items_required[i] = d_n_input_items_reqd[i]; - } else { - // If there's no item, there's no tag--so there must at least be one! - ninput_items_required[i] = std::max(1, (int) std::floor((double) noutput_items / relative_rate() + 0.5)); - } - } -} - - -void -gr_tagged_stream_block::parse_length_tags( - const std::vector<std::vector<gr_tag_t> > &tags, - gr_vector_int &n_input_items_reqd -){ - for (unsigned i = 0; i < tags.size(); i++) { - for (unsigned k = 0; k < tags[i].size(); k++) { - if (tags[i][k].key == d_length_tag_key) { - n_input_items_reqd[i] = pmt::to_long(tags[i][k].value); - remove_item_tag(i, tags[i][k]); - } - } - } -} - - -int -gr_tagged_stream_block::calculate_output_stream_length(const gr_vector_int &ninput_items) -{ - int noutput_items = *std::max_element(ninput_items.begin(), ninput_items.end()); - return (int) std::floor(relative_rate() * noutput_items + 0.5); -} - - -void -gr_tagged_stream_block::update_length_tags(int n_produced, int n_ports) -{ - for (int i = 0; i < n_ports; i++) { - add_item_tag(i, nitems_written(i), - d_length_tag_key, - pmt::from_long(n_produced) - ); - } - return; -} - - -int -gr_tagged_stream_block::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - if (d_length_tag_key_str.empty()) { - return work(noutput_items, ninput_items, input_items, output_items); - } - - if (d_n_input_items_reqd[0] == 0) { // Otherwise, it's already set from a previous call - std::vector<std::vector<gr_tag_t> > tags(input_items.size(), std::vector<gr_tag_t>()); - for (unsigned i = 0; i < input_items.size(); i++) { - get_tags_in_range(tags[i], i, nitems_read(i), nitems_read(i)+1); - } - d_n_input_items_reqd.assign(input_items.size(), -1); - parse_length_tags(tags, d_n_input_items_reqd); - } - for (unsigned i = 0; i < input_items.size(); i++) { - if (d_n_input_items_reqd[i] == -1) { - GR_LOG_FATAL(d_logger, boost::format("Missing a required length tag on port %1% at item #%2%") % i % nitems_read(i)); - throw std::runtime_error("Missing length tag."); - } - if (d_n_input_items_reqd[i] > ninput_items[i]) { - return 0; - } - } - - int min_output_size = calculate_output_stream_length(d_n_input_items_reqd); - if (noutput_items < min_output_size) { - set_min_noutput_items(min_output_size); - return 0; - } - set_min_noutput_items(1); - - // WORK CALLED HERE // - int n_produced = work(noutput_items, d_n_input_items_reqd, input_items, output_items); - ////////////////////// - - if (n_produced == WORK_DONE) { - return n_produced; - } - for (int i = 0; i < (int) d_n_input_items_reqd.size(); i++) { - consume(i, d_n_input_items_reqd[i]); - } - update_length_tags(n_produced, output_items.size()); - - d_n_input_items_reqd.assign(input_items.size(), 0); - - return n_produced; -} - diff --git a/gnuradio-runtime/lib/gr_test.cc b/gnuradio-runtime/lib/gr_test.cc deleted file mode 100644 index cd5ef83611..0000000000 --- a/gnuradio-runtime/lib/gr_test.cc +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2008,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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_test.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> -#include <string.h> - -gr_test_sptr gr_make_test (const std::string &name, - int min_inputs, int max_inputs, unsigned int sizeof_input_item, - int min_outputs, int max_outputs, unsigned int sizeof_output_item, - unsigned int history,unsigned int output_multiple,double relative_rate, - bool fixed_rate,gr_consume_type_t cons_type, gr_produce_type_t prod_type) -{ - return gnuradio::get_initial_sptr(new gr_test (name, min_inputs,max_inputs,sizeof_input_item, - min_outputs,max_outputs,sizeof_output_item, - history,output_multiple,relative_rate,fixed_rate,cons_type, prod_type)); -} - - gr_test::gr_test (const std::string &name,int min_inputs, int max_inputs, unsigned int sizeof_input_item, - int min_outputs, int max_outputs, unsigned int sizeof_output_item, - unsigned int history,unsigned int output_multiple,double relative_rate, - bool fixed_rate,gr_consume_type_t cons_type, gr_produce_type_t prod_type): gr_block (name, - gr_make_io_signature (min_inputs, max_inputs, sizeof_input_item), - gr_make_io_signature (min_outputs, max_outputs, sizeof_output_item)), - d_sizeof_input_item(sizeof_input_item), - d_sizeof_output_item(sizeof_output_item), - d_check_topology(true), - d_consume_type(cons_type), - d_min_consume(0), - d_max_consume(0), - d_produce_type(prod_type), - d_min_produce(0), - d_max_produce(0) - { - set_history(history); - set_output_multiple(output_multiple); - set_relative_rate(relative_rate); - set_fixed_rate(fixed_rate); - } - -int -gr_test::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - //touch all inputs and outputs to detect segfaults - unsigned ninputs = input_items.size (); - unsigned noutputs= output_items.size(); - for (unsigned i = 0; i < ninputs; i++) - { - char * in=(char *)input_items[i]; - if (ninput_items[i]< (int)(noutput_items+history())) - { - std::cerr << "ERROR: ninput_items[" << i << "] < noutput_items+history()" << std::endl; - std::cerr << "ninput_items[" << i << "] = " << ninput_items[i] << std::endl; - std::cerr << "noutput_items+history() = " << noutput_items+history() << std::endl; - std::cerr << "noutput_items = " << noutput_items << std::endl; - std::cerr << "history() = " << history() << std::endl; - throw std::runtime_error ("gr_test"); - } else - { - for (int j=0;j<ninput_items[i];j++) - { - //Touch every available input_item - //We use a class variable to avoid the compiler to optimize this away - for(unsigned int k=0;k<d_sizeof_input_item;k++) - d_temp= in[j*d_sizeof_input_item+k]; - } - switch (d_consume_type) - { - case CONSUME_NOUTPUT_ITEMS: - consume(i,noutput_items); - break; - case CONSUME_NOUTPUT_ITEMS_LIMIT_MAX: - consume(i,std::min(noutput_items,d_max_consume)); - break; - case CONSUME_NOUTPUT_ITEMS_LIMIT_MIN: - consume(i,std::min(std::max(noutput_items,d_min_consume),ninput_items[i])); - break; - case CONSUME_ALL_AVAILABLE: - consume(i,ninput_items[i]); - break; - case CONSUME_ALL_AVAILABLE_LIMIT_MAX: - consume(i,std::min(ninput_items[i],d_max_consume)); - break; -/* //This could result in segfault, uncomment if you want to test this - case CONSUME_ALL_AVAILABLE_LIMIT_MIN: - consume(i,std::max(ninput_items[i],d_max_consume)); - break;*/ - case CONSUME_ZERO: - consume(i,0); - break; - case CONSUME_ONE: - consume(i,1); - break; - case CONSUME_MINUS_ONE: - consume(i,-1); - break; - default: - consume(i,noutput_items); - } - } - } - for (unsigned i = 0; i < noutputs; i++) - { - char * out=(char *)output_items[i]; - { - for (int j=0;j<noutput_items;j++) - { - //Touch every available output_item - for(unsigned int k=0;k<d_sizeof_output_item;k++) - out[j*d_sizeof_input_item+k]=0; - } - } - } - //Now copy input to output until max ninputs or max noutputs is reached - int common_nports=std::min(ninputs,noutputs); - if(d_sizeof_output_item==d_sizeof_input_item) - for (int i = 0; i < common_nports; i++) - { - memcpy(output_items[i],input_items[i],noutput_items*d_sizeof_input_item); - } - int noutput_items_produced=0; - switch (d_produce_type){ - case PRODUCE_NOUTPUT_ITEMS: - noutput_items_produced=noutput_items; - break; - case PRODUCE_NOUTPUT_ITEMS_LIMIT_MAX: - noutput_items_produced=std::min(noutput_items,d_max_produce); - break; -/* //This could result in segfault, uncomment if you want to test this - case PRODUCE_NOUTPUT_ITEMS_LIMIT_MIN: - noutput_items_produced=std::max(noutput_items,d_min_produce); - break;*/ - case PRODUCE_ZERO: - noutput_items_produced=0; - break; - case PRODUCE_ONE: - noutput_items_produced=1; - break; - case PRODUCE_MINUS_ONE: - noutput_items_produced=-1; - break; - default: - noutput_items_produced=noutput_items; - } - return noutput_items_produced; - } - - - diff --git a/gnuradio-runtime/lib/gr_test.h b/gnuradio-runtime/lib/gr_test.h deleted file mode 100644 index 2276ab1967..0000000000 --- a/gnuradio-runtime/lib/gr_test.h +++ /dev/null @@ -1,195 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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. - */ - -#ifndef INCLUDED_GR_TEST_H -#define INCLUDED_GR_TEST_H - -#include <gr_runtime_api.h> -#include <gr_block.h> -#include <string> -#include "gr_test_types.h" - -class gr_test; -typedef boost::shared_ptr<gr_test> gr_test_sptr; - -// public constructor -GR_RUNTIME_API gr_test_sptr gr_make_test (const std::string &name=std::string("gr_test"), - int min_inputs=1, int max_inputs=1, unsigned int sizeof_input_item=1, - int min_outputs=1, int max_outputs=1, unsigned int sizeof_output_item=1, - unsigned int history=1,unsigned int output_multiple=1,double relative_rate=1.0, - bool fixed_rate=true,gr_consume_type_t cons_type=CONSUME_NOUTPUT_ITEMS, gr_produce_type_t prod_type=PRODUCE_NOUTPUT_ITEMS); - -/*! - * \brief Test class for testing runtime system (setting up buffers and such.) - * \ingroup misc - * - * This block does not do any usefull actual data processing. - * It just exposes setting all standard block parameters using the contructor or public methods. - * - * This block can be usefull when testing the runtime system. - * You can force this block to have a large history, decimation - * factor and/or large output_multiple. - * The runtime system should detect this and create large enough buffers - * all through the signal chain. - */ -class GR_RUNTIME_API gr_test : public gr_block { - - public: - - ~gr_test (){} - -int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - // ---------------------------------------------------------------- - // override these to define your behavior - // ---------------------------------------------------------------- - - /*! - * \brief Estimate input requirements given output request - * - * \param noutput_items number of output items to produce - * \param ninput_items_required number of input items required on each input stream - * - * Given a request to product \p noutput_items, estimate the number of - * data items required on each input stream. The estimate doesn't have - * to be exact, but should be close. - */ - void forecast (int noutput_items, - gr_vector_int &ninput_items_required) - { - unsigned ninputs = ninput_items_required.size (); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = (int)((double)noutput_items / relative_rate()) + (int)history(); - } - - - /*! - * \brief Force check topology to return true or false. - * - * \param check_topology value to return when check_topology is called (true or false) - * default check_topology returns true - * - */ - void set_check_topology (bool check_topology){ d_check_topology=check_topology;} - - /*! - * \brief Confirm that ninputs and noutputs is an acceptable combination. - * - * \param ninputs number of input streams connected - * \param noutputs number of output streams connected - * - * \returns true if this is a valid configuration for this block. - * - * This function is called by the runtime system whenever the - * topology changes. Most classes do not need to override this. - * This check is in addition to the constraints specified by the input - * and output gr_io_signatures. - */ - bool check_topology (int ninputs, int noutputs) { return d_check_topology;} - - // ---------------------------------------------------------------- - /* - * The following two methods provide special case info to the - * scheduler in the event that a block has a fixed input to output - * ratio. gr_sync_block, gr_sync_decimator and gr_sync_interpolator - * override these. If you're fixed rate, subclass one of those. - */ - /*! - * \brief Given ninput samples, return number of output samples that will be produced. - * N.B. this is only defined if fixed_rate returns true. - * Generally speaking, you don't need to override this. - */ - int fixed_rate_ninput_to_noutput(int ninput) { return (int)((double)ninput/relative_rate()); } - - /*! - * \brief Given noutput samples, return number of input samples required to produce noutput. - * N.B. this is only defined if fixed_rate returns true. - */ - int fixed_rate_noutput_to_ninput(int noutput) { return (int)((double)noutput*relative_rate()); } - - /*! - * \brief Set if fixed rate should return true. - * N.B. This is normally a private method but we make it available here as public. - */ - void set_fixed_rate_public(bool fixed_rate){ set_fixed_rate(fixed_rate);} - - /*! - * \brief Set the consume pattern. - * - * \param cons_type which consume pattern to use - */ - void set_consume_type (gr_consume_type_t cons_type) { d_consume_type=cons_type;} - - /*! - * \brief Set the consume limit. - * - * \param limit min or maximum items to consume (depending on consume_type) - */ - void set_consume_limit (unsigned int limit) { d_min_consume=limit; d_max_consume=limit;} - - /*! - * \brief Set the produce pattern. - * - * \param prod_type which produce pattern to use - */ - void set_produce_type (gr_produce_type_t prod_type) { d_produce_type=prod_type;} - - /*! - * \brief Set the produce limit. - * - * \param limit min or maximum items to produce (depending on produce_type) - */ - void set_produce_limit (unsigned int limit) { d_min_produce=limit; d_max_produce=limit;} - - // ---------------------------------------------------------------------------- - - - - protected: - unsigned int d_sizeof_input_item; - unsigned int d_sizeof_output_item; - bool d_check_topology; - char d_temp; - gr_consume_type_t d_consume_type; - int d_min_consume; - int d_max_consume; - gr_produce_type_t d_produce_type; - int d_min_produce; - int d_max_produce; - gr_test (const std::string &name,int min_inputs, int max_inputs, unsigned int sizeof_input_item, - int min_outputs, int max_outputs, unsigned int sizeof_output_item, - unsigned int history,unsigned int output_multiple,double relative_rate, - bool fixed_rate,gr_consume_type_t cons_type, gr_produce_type_t prod_type); - - - - friend GR_RUNTIME_API gr_test_sptr gr_make_test (const std::string &name,int min_inputs, int max_inputs, unsigned int sizeof_input_item, - int min_outputs, int max_outputs, unsigned int sizeof_output_item, - unsigned int history,unsigned int output_multiple,double relative_rate, - bool fixed_rate,gr_consume_type_t cons_type, gr_produce_type_t prod_type); -}; - - - -#endif /* INCLUDED_GR_TEST_H */ diff --git a/gnuradio-runtime/lib/gr_top_block.cc b/gnuradio-runtime/lib/gr_top_block.cc deleted file mode 100644 index 362057aadb..0000000000 --- a/gnuradio-runtime/lib/gr_top_block.cc +++ /dev/null @@ -1,162 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <unistd.h> -#include <gr_top_block.h> -#include <gr_top_block_impl.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> -#include <iostream> - -gr_top_block_sptr -gr_make_top_block(const std::string &name) -{ - return gnuradio::get_initial_sptr(new gr_top_block(name)); -} - -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) -{ - d_impl->start(max_noutput_items); - - if(gr_prefs::singleton()->get_bool("ControlPort", "on", false)) { - setup_rpc(); - } -} - -void -gr_top_block::stop() -{ - d_impl->stop(); -} - -void -gr_top_block::wait() -{ - d_impl->wait(); -} - -void -gr_top_block::run(int max_noutput_items) -{ - start(max_noutput_items); - wait(); -} - -void -gr_top_block::lock() -{ - d_impl->lock(); -} - -void -gr_top_block::unlock() -{ - d_impl->unlock(); -} - -std::string -gr_top_block::edge_list() -{ - return d_impl->edge_list(); -} - -void -gr_top_block::dump() -{ - d_impl->dump(); -} - -int -gr_top_block::max_noutput_items() -{ - return d_impl->max_noutput_items(); -} - -void -gr_top_block::set_max_noutput_items(int nmax) -{ - d_impl->set_max_noutput_items(nmax); -} - -gr_top_block_sptr -gr_top_block::to_top_block() -{ - return cast_to_top_block_sptr(shared_from_this()); -} - -void -gr_top_block::setup_rpc() -{ -#ifdef GR_CTRLPORT - if(is_rpc_set()) return; - // Getters - add_rpc_variable( - rpcbasic_sptr(new rpcbasic_register_get<gr_top_block, int>( - alias(), "max noutput_items", - &gr_top_block::max_noutput_items, - pmt::mp(0), pmt::mp(8192), pmt::mp(8192), - "items", "Max number of output items", - RPC_PRIVLVL_MIN, DISPNULL))); - - if(gr_prefs::singleton()->get_bool("ControlPort", "edges_list", false)) { - add_rpc_variable( - rpcbasic_sptr(new rpcbasic_register_get<gr_top_block, std::string>( - alias(), "edge list", - &gr_top_block::edge_list, - pmt::mp(""), pmt::mp(""), pmt::mp(""), - "edges", "List of edges in the graph", - RPC_PRIVLVL_MIN, DISPNULL))); - } - - // Setters - add_rpc_variable( - rpcbasic_sptr(new rpcbasic_register_set<gr_top_block, int>( - alias(), "max noutput_items", - &gr_top_block::set_max_noutput_items, - pmt::mp(0), pmt::mp(8192), pmt::mp(8192), - "items", "Max number of output items", - RPC_PRIVLVL_MIN, DISPNULL))); - rpc_set(); -#endif /* GR_CTRLPORT */ -} diff --git a/gnuradio-runtime/lib/gr_top_block_impl.cc b/gnuradio-runtime/lib/gr_top_block_impl.cc deleted file mode 100644 index ef645ea57d..0000000000 --- a/gnuradio-runtime/lib/gr_top_block_impl.cc +++ /dev/null @@ -1,211 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_top_block.h> -#include <gr_top_block_impl.h> -#include <gr_flat_flowgraph.h> -#include <gr_scheduler_sts.h> -#include <gr_scheduler_tpb.h> -#include <gr_prefs.h> - -#include <stdexcept> -#include <iostream> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> - -#define GR_TOP_BLOCK_IMPL_DEBUG 0 - - -typedef gr_scheduler_sptr (*scheduler_maker)(gr_flat_flowgraph_sptr ffg, - int max_noutput_items); - -static struct scheduler_table { - const char *name; - scheduler_maker f; -} scheduler_table[] = { - { "TPB", gr_scheduler_tpb::make }, // first entry is default - { "STS", gr_scheduler_sts::make } -}; - -static gr_scheduler_sptr -make_scheduler(gr_flat_flowgraph_sptr ffg, int max_noutput_items) -{ - static scheduler_maker factory = 0; - - if (factory == 0){ - char *v = getenv("GR_SCHEDULER"); - if (!v) - factory = scheduler_table[0].f; // use default - else { - for (size_t i = 0; i < sizeof(scheduler_table)/sizeof(scheduler_table[0]); i++){ - if (strcmp(v, scheduler_table[i].name) == 0){ - factory = scheduler_table[i].f; - break; - } - } - if (factory == 0){ - std::cerr << "warning: Invalid GR_SCHEDULER environment variable value \"" - << v << "\". Using \"" << scheduler_table[0].name << "\"\n"; - factory = scheduler_table[0].f; - } - } - } - return factory(ffg, max_noutput_items); -} - - -gr_top_block_impl::gr_top_block_impl(gr_top_block *owner) - : d_owner(owner), d_ffg(), - d_state(IDLE), d_lock_count(0) -{ -} - -gr_top_block_impl::~gr_top_block_impl() -{ - d_owner = 0; -} - -void -gr_top_block_impl::start(int max_noutput_items) -{ - gr::thread::scoped_lock l(d_mutex); - - d_max_noutput_items = max_noutput_items; - - if (d_state != IDLE) - throw std::runtime_error("top_block::start: top block already running or wait() not called after previous stop()"); - - if (d_lock_count > 0) - throw std::runtime_error("top_block::start: can't start with flow graph locked"); - - // Create new flat flow graph by flattening hierarchy - d_ffg = d_owner->flatten(); - - // Validate new simple flow graph and wire it up - d_ffg->validate(); - d_ffg->setup_connections(); - - // Only export perf. counters if ControlPort config param is enabled - // and if the PerfCounter option 'export' is turned on. - gr_prefs *p = gr_prefs::singleton(); - if(p->get_bool("ControlPort", "on", false) && p->get_bool("PerfCounters", "export", false)) - d_ffg->enable_pc_rpc(); - - d_scheduler = make_scheduler(d_ffg, d_max_noutput_items); - d_state = RUNNING; -} - -void -gr_top_block_impl::stop() -{ - if (d_scheduler) - d_scheduler->stop(); -} - - -void -gr_top_block_impl::wait() -{ - if (d_scheduler) - d_scheduler->wait(); - - d_state = IDLE; -} - -// N.B. lock() and unlock() cannot be called from a flow graph thread or -// deadlock will occur when reconfiguration happens -void -gr_top_block_impl::lock() -{ - gr::thread::scoped_lock lock(d_mutex); - d_lock_count++; -} - -void -gr_top_block_impl::unlock() -{ - gr::thread::scoped_lock lock(d_mutex); - - if (d_lock_count <= 0){ - d_lock_count = 0; // fix it, then complain - throw std::runtime_error("unpaired unlock() call"); - } - - d_lock_count--; - if (d_lock_count > 0 || d_state == IDLE) // nothing to do - return; - - restart(); -} - -/* - * restart is called with d_mutex held - */ -void -gr_top_block_impl::restart() -{ - stop(); // Stop scheduler and wait for completion - wait(); - - // Create new simple flow graph - gr_flat_flowgraph_sptr new_ffg = d_owner->flatten(); - new_ffg->validate(); // check consistency, sanity, etc - new_ffg->merge_connections(d_ffg); // reuse buffers, etc - d_ffg = new_ffg; - - // Create a new scheduler to execute it - d_scheduler = make_scheduler(d_ffg, d_max_noutput_items); - d_state = RUNNING; -} - -std::string -gr_top_block_impl::edge_list() -{ - if(d_ffg) - return d_ffg->edge_list(); - else - return ""; -} - -void -gr_top_block_impl::dump() -{ - if (d_ffg) - d_ffg->dump(); -} - -int -gr_top_block_impl::max_noutput_items() -{ - return d_max_noutput_items; -} - -void -gr_top_block_impl::set_max_noutput_items(int nmax) -{ - d_max_noutput_items = nmax; -} diff --git a/gnuradio-runtime/lib/gr_top_block_impl.h b/gnuradio-runtime/lib/gr_top_block_impl.h deleted file mode 100644 index 345a33152f..0000000000 --- a/gnuradio-runtime/lib/gr_top_block_impl.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008 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. - */ - -#ifndef INCLUDED_GR_TOP_BLOCK_IMPL_H -#define INCLUDED_GR_TOP_BLOCK_IMPL_H - -#include <gr_runtime_api.h> -#include <gr_scheduler.h> -#include <thread/thread.h> - -/*! - *\brief Abstract implementation details of gr_top_block - * \ingroup internal - * - * The actual implementation of gr_top_block. Separate class allows - * decoupling of changes from dependent classes. - * - */ -class GR_RUNTIME_API gr_top_block_impl -{ -public: - gr_top_block_impl(gr_top_block *owner); - ~gr_top_block_impl(); - - // Create and start scheduler threads - void start(int max_noutput_items=100000000); - - // Signal scheduler threads to stop - void stop(); - - // Wait for scheduler threads to exit - void wait(); - - // Lock the top block to allow reconfiguration - void lock(); - - // Unlock the top block at end of reconfiguration - void unlock(); - - // Return a string list of edges - std::string edge_list(); - - // Dump the flowgraph to stdout - void dump(); - - // Get the number of max noutput_items in the flowgraph - int max_noutput_items(); - - // Set the maximum number of noutput_items in the flowgraph - void set_max_noutput_items(int nmax); - -protected: - - enum tb_state { IDLE, RUNNING }; - - gr_top_block *d_owner; - gr_flat_flowgraph_sptr d_ffg; - gr_scheduler_sptr d_scheduler; - - gr::thread::mutex d_mutex; // protects d_state and d_lock_count - tb_state d_state; - int d_lock_count; - int d_max_noutput_items; - -private: - void restart(); -}; - -#endif /* INCLUDED_GR_TOP_BLOCK_IMPL_H */ diff --git a/gnuradio-runtime/lib/gr_tpb_detail.cc b/gnuradio-runtime/lib/gr_tpb_detail.cc deleted file mode 100644 index 46eb6bbe0d..0000000000 --- a/gnuradio-runtime/lib/gr_tpb_detail.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_tpb_detail.h> -#include <gr_block.h> -#include <gr_block_detail.h> -#include <gr_buffer.h> - -using namespace pmt; - -/* - * We assume that no worker threads are ever running when the - * graph structure is being manipulated, thus it's safe for us to poke - * around in our neighbors w/o holding any locks. - */ - -void -gr_tpb_detail::notify_upstream(gr_block_detail *d) -{ - // For each of our inputs, tell the guy upstream that we've consumed - // some input, and that he most likely has more output buffer space - // available. - - for (size_t i = 0; i < d->d_input.size(); i++){ - // Can you say, "pointer chasing?" - d->d_input[i]->buffer()->link()->detail()->d_tpb.set_output_changed(); - } -} - -void -gr_tpb_detail::notify_downstream(gr_block_detail *d) -{ - // For each of our outputs, tell the guys downstream that they have - // new input available. - - for (size_t i = 0; i < d->d_output.size(); i++){ - gr_buffer_sptr buf = d->d_output[i]; - for (size_t j = 0, k = buf->nreaders(); j < k; j++) - buf->reader(j)->link()->detail()->d_tpb.set_input_changed(); - } -} - -void -gr_tpb_detail::notify_neighbors(gr_block_detail *d) -{ - notify_downstream(d); - notify_upstream(d); -} - diff --git a/gnuradio-runtime/lib/gr_tpb_thread_body.cc b/gnuradio-runtime/lib/gr_tpb_thread_body.cc deleted file mode 100644 index 11934dbf09..0000000000 --- a/gnuradio-runtime/lib/gr_tpb_thread_body.cc +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009,2011 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_tpb_thread_body.h> -#include <gr_prefs.h> -#include <iostream> -#include <boost/thread.hpp> -#include <pmt/pmt.h> -#include <boost/foreach.hpp> - -using namespace pmt; - -gr_tpb_thread_body::gr_tpb_thread_body(gr_block_sptr block, int max_noutput_items) - : d_exec(block, max_noutput_items) -{ - //std::cerr << "gr_tpb_thread_body: " << block << std::endl; - - gr_block_detail *d = block->detail().get(); - gr_block_executor::state s; - pmt_t msg; - - d->threaded = true; - d->thread = gr::thread::get_current_thread_id(); - - gr_prefs *p = gr_prefs::singleton(); - size_t max_nmsgs = static_cast<size_t>(p->get_long("DEFAULT", "max_messages", 100)); - - // Set thread affinity if it was set before fg was started. - if(block->processor_affinity().size() > 0) { - gr::thread::thread_bind_to_processor(d->thread, block->processor_affinity()); - } - - while (1){ - boost::this_thread::interruption_point(); - - // handle any queued up messages - //BOOST_FOREACH( pmt::pmt_t port, block->msg_queue.keys() ) - - BOOST_FOREACH( gr_basic_block::msg_queue_map_t::value_type &i, block->msg_queue ) - { - // Check if we have a message handler attached before getting - // any messages. This is mostly a protection for the unknown - // startup sequence of the threads. - if(block->has_msg_handler(i.first)) { - while ((msg = block->delete_head_nowait(i.first))){ - block->dispatch_msg(i.first,msg); - } - } - else { - // If we don't have a handler but are building up messages, - // prune the queue from the front to keep memory in check. - if(block->nmsgs(i.first) > max_nmsgs) - msg = block->delete_head_nowait(i.first); - } - } - - d->d_tpb.clear_changed(); - // run one iteration if we are a connected stream block - if(d->noutputs() >0 || d->ninputs()>0){ - s = d_exec.run_one_iteration(); - } else { - s = gr_block_executor::BLKD_IN; - } - - switch(s){ - case gr_block_executor::READY: // Tell neighbors we made progress. - d->d_tpb.notify_neighbors(d); - break; - - case gr_block_executor::READY_NO_OUTPUT: // Notify upstream only - d->d_tpb.notify_upstream(d); - break; - - case gr_block_executor::DONE: // Game over. - d->d_tpb.notify_neighbors(d); - return; - - case gr_block_executor::BLKD_IN: // Wait for input. - { - gr::thread::scoped_lock guard(d->d_tpb.mutex); - while (!d->d_tpb.input_changed){ - - // wait for input or message - while(!d->d_tpb.input_changed && block->empty_p()) - d->d_tpb.input_cond.wait(guard); - - // handle all pending messages - BOOST_FOREACH( gr_basic_block::msg_queue_map_t::value_type &i, block->msg_queue ) - { - while ((msg = block->delete_head_nowait(i.first))){ - guard.unlock(); // release lock while processing msg - block->dispatch_msg(i.first, msg); - guard.lock(); - } - } - } - } - break; - - - case gr_block_executor::BLKD_OUT: // Wait for output buffer space. - { - gr::thread::scoped_lock guard(d->d_tpb.mutex); - while (!d->d_tpb.output_changed){ - - // wait for output room or message - while(!d->d_tpb.output_changed && block->empty_p()) - d->d_tpb.output_cond.wait(guard); - - // handle all pending messages - BOOST_FOREACH( gr_basic_block::msg_queue_map_t::value_type &i, block->msg_queue ) - { - while ((msg = block->delete_head_nowait(i.first))){ - guard.unlock(); // release lock while processing msg - block->dispatch_msg(i.first,msg); - guard.lock(); - } - } - } - } - break; - - default: - assert(0); - } - } -} - -gr_tpb_thread_body::~gr_tpb_thread_body() -{ -} diff --git a/gnuradio-runtime/lib/gr_vco.h b/gnuradio-runtime/lib/gr_vco.h deleted file mode 100644 index 3ceaf15dd4..0000000000 --- a/gnuradio-runtime/lib/gr_vco.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ -#ifndef _GR_VCO_H_ -#define _GR_VCO_H_ - - -#include <vector> -#include <gr_sincos.h> -#include <cmath> -#include <gr_complex.h> - -/*! - * \brief base class template for Voltage Controlled Oscillator (VCO) - * \ingroup misc - */ - -//FIXME Eventually generalize this to fixed point - -template<class o_type, class i_type> -class gr_vco { -public: - gr_vco () : d_phase (0) {} - - virtual ~gr_vco () {} - - // radians - void set_phase (double angle) { - d_phase = angle; - } - - void adjust_phase (double delta_phase) { - d_phase += delta_phase; - if (fabs (d_phase) > M_PI){ - - while (d_phase > M_PI) - d_phase -= 2*M_PI; - - while (d_phase < -M_PI) - d_phase += 2*M_PI; - } - } - - double get_phase () const { return d_phase; } - - // compute sin and cos for current phase angle - void sincos (float *sinx, float *cosx) const; - - // compute cos or sin for current phase angle - float cos () const { return std::cos (d_phase); } - float sin () const { return std::sin (d_phase); } - - // compute a block at a time - void cos (float *output, const float *input, int noutput_items, double k, double ampl = 1.0); - -protected: - double d_phase; -}; - -template<class o_type, class i_type> -void -gr_vco<o_type,i_type>::sincos (float *sinx, float *cosx) const -{ - gr_sincosf (d_phase, sinx, cosx); -} - -template<class o_type, class i_type> -void -gr_vco<o_type,i_type>::cos (float *output, const float *input, int noutput_items, double k, double ampl) -{ - for (int i = 0; i < noutput_items; i++){ - output[i] = cos() * ampl; - adjust_phase(input[i] * k); - } -} -#endif /* _GR_VCO_H_ */ diff --git a/gnuradio-runtime/lib/gr_vmcircbuf.cc b/gnuradio-runtime/lib/gr_vmcircbuf.cc deleted file mode 100644 index 522d9515d0..0000000000 --- a/gnuradio-runtime/lib/gr_vmcircbuf.cc +++ /dev/null @@ -1,295 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <gr_vmcircbuf.h> -#include <assert.h> -#include <stdexcept> -#include <gr_preferences.h> -#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> -#include <gr_vmcircbuf_sysv_shm.h> -#include <gr_vmcircbuf_mmap_shm_open.h> -#include <gr_vmcircbuf_mmap_tmpfile.h> - -static const char *FACTORY_PREF_KEY = "gr_vmcircbuf_default_factory"; - -gr_vmcircbuf::~gr_vmcircbuf () -{ -} - -gr_vmcircbuf_factory::~gr_vmcircbuf_factory () -{ -} - -// ---------------------------------------------------------------- - -static gr_vmcircbuf_factory *s_default_factory = 0; - -gr_vmcircbuf_factory * -gr_vmcircbuf_sysconfig::get_default_factory () -{ - if (s_default_factory) - return s_default_factory; - - bool verbose = false; - - std::vector<gr_vmcircbuf_factory *> all = all_factories (); - - const char *name = gr_preferences::get (FACTORY_PREF_KEY); - - if (name){ - for (unsigned int i = 0; i < all.size (); i++){ - if (strcmp (name, all[i]->name ()) == 0){ - s_default_factory = all[i]; - if (verbose) - fprintf (stderr, "gr_vmcircbuf_sysconfig: using %s\n", - s_default_factory->name ()); - return s_default_factory; - } - } - } - - // either we don't have a default, or the default named is not in our - // list of factories. Find the first factory that works. - - if (verbose) - fprintf (stderr, "gr_vmcircbuf_sysconfig: finding a working factory...\n"); - - for (unsigned int i = 0; i < all.size (); i++){ - if (test_factory (all[i], verbose)){ - set_default_factory (all[i]); - return s_default_factory; - } - } - - // We're screwed! - - fprintf (stderr, "gr_vmcircbuf_sysconfig: unable to find a working factory!\n"); - throw std::runtime_error ("gr_vmcircbuf_sysconfig"); -} - -std::vector<gr_vmcircbuf_factory *> -gr_vmcircbuf_sysconfig::all_factories () -{ - std::vector<gr_vmcircbuf_factory *> result; - - result.push_back (gr_vmcircbuf_createfilemapping_factory::singleton ()); -#ifdef TRY_SHM_VMCIRCBUF - result.push_back (gr_vmcircbuf_sysv_shm_factory::singleton ()); - result.push_back (gr_vmcircbuf_mmap_shm_open_factory::singleton ()); -#endif - result.push_back (gr_vmcircbuf_mmap_tmpfile_factory::singleton ()); - - return result; -} - -void -gr_vmcircbuf_sysconfig::set_default_factory (gr_vmcircbuf_factory *f) -{ - gr_preferences::set (FACTORY_PREF_KEY, f->name ()); - s_default_factory = f; -} - - -// ------------------------------------------------------------------------ -// test code for vmcircbuf factories -// ------------------------------------------------------------------------ - -static void -init_buffer (gr_vmcircbuf *c, int counter, int size) -{ - unsigned int *p = (unsigned int *) c->pointer_to_first_copy (); - for (unsigned int i = 0; i < size / sizeof (int); i++) - p[i] = counter + i; -} - -static bool -check_mapping (gr_vmcircbuf *c, int counter, int size, const char *msg, bool verbose) -{ - bool ok = true; - - if (verbose) - fprintf (stderr, "... %s", msg); - - unsigned int *p1 = (unsigned int *) c->pointer_to_first_copy (); - unsigned int *p2 = (unsigned int *) c->pointer_to_second_copy (); - - // fprintf (stderr, "p1 = %p, p2 = %p\n", p1, p2); - - for (unsigned int i = 0; i < size / sizeof (int); i++){ - if (p1[i] != counter + i){ - ok = false; - if (verbose) - fprintf (stderr, " p1[%d] == %u, expected %u\n", i, p1[i], counter + i); - break; - } - if (p2[i] != counter + i){ - if (verbose) - fprintf (stderr, " p2[%d] == %u, expected %u\n", i, p2[i], counter + i); - ok = false; - break; - } - } - - if (ok && verbose){ - fprintf (stderr, " OK\n"); - } - return ok; -} - -static const char * -memsize (int size) -{ - static std::string buf; - if (size >= (1 << 20)){ - buf = str(boost::format("%dMB") % (size / (1 << 20))); - } - else if (size >= (1 << 10)){ - buf = str(boost::format("%dKB") % (size / (1 << 10))); - } - else { - buf = str(boost::format("%d") % size); - } - 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; - std::vector<int> counter(n); - std::vector<gr_vmcircbuf *> c(n); - int cum_size = 0; - - for (int i = 0; i < n; i++){ - counter[i] = *start_ptr; - *start_ptr += size; - if ((c[i] = factory->make (size)) == 0){ - if (verbose) - fprintf (stderr, - "Failed to allocate gr_vmcircbuf number %d of size %d (cum = %s)\n", - i + 1, size, memsize (cum_size)); - return false; - } - init_buffer (c[i], counter[i], size); - cum_size += size; - } - - for (int i = 0; i < n; i++){ - 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++){ - delete c[i]; - c[i] = 0; - } - - return ok; -} - -static bool -standard_tests (gr_vmcircbuf_factory *f, int verbose) -{ - if (verbose >= 1) - fprintf (stderr, "Testing %s...\n", f->name ()); - - bool v = verbose >= 2; - int granularity = f->granularity (); - int start = 0; - bool ok = true; - - ok &= test_a_bunch (f, 1, 1 * granularity, &start, v); // 1 x 4KB = 4KB - - if (ok){ - ok &= test_a_bunch (f, 64, 4 * granularity, &start, v); // 64 x 16KB = 1MB - ok &= test_a_bunch (f, 4, 4 * (1L << 20), &start, v); // 4 x 4MB = 16MB -// ok &= test_a_bunch (f, 256, 256 * (1L << 10), &start, v); // 256 x 256KB = 64MB - } - - if (verbose >= 1) - fprintf (stderr, "....... %s: %s", f->name (), ok ? "OK\n" : "Doesn't work\n"); - - return ok; -} - -bool -gr_vmcircbuf_sysconfig::test_factory (gr_vmcircbuf_factory *f, int verbose) -{ - // Install local signal handlers for SIGSEGV and SIGBUS. - // If something goes wrong, these signals may be invoked. - -#ifdef SIGSEGV - gr_local_sighandler sigsegv (SIGSEGV, gr_local_sighandler::throw_signal); -#endif -#ifdef SIGBUS - gr_local_sighandler sigbus (SIGBUS, gr_local_sighandler::throw_signal); -#endif -#ifdef SIGSYS - gr_local_sighandler sigsys (SIGSYS, gr_local_sighandler::throw_signal); -#endif - - try { - return standard_tests (f, verbose); - } - catch (gr_signal &sig){ - if (verbose){ - fprintf (stderr, "....... %s: %s", f->name (), "Doesn't work\n"); - fprintf (stderr, - "gr_vmcircbuf_factory::test_factory (%s): caught %s\n", - f->name (), sig.name().c_str()); - return false; - } - } - catch (...){ - if (verbose){ - fprintf (stderr, "....... %s: %s", f->name (), "Doesn't work\n"); - fprintf (stderr, - "gr_vmcircbuf_factory::test_factory (%s): some kind of uncaught exception\n", - f->name ()); - } - return false; - } - return false; // never gets here. shut compiler up. -} - -bool -gr_vmcircbuf_sysconfig::test_all_factories (int verbose) -{ - bool ok = false; - - std::vector<gr_vmcircbuf_factory *> all = all_factories (); - - for (unsigned int i = 0; i < all.size (); i++) - ok |= test_factory (all[i], verbose); - - return ok; -} diff --git a/gnuradio-runtime/lib/gr_vmcircbuf.h b/gnuradio-runtime/lib/gr_vmcircbuf.h deleted file mode 100644 index e7f492a8bd..0000000000 --- a/gnuradio-runtime/lib/gr_vmcircbuf.h +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -#ifndef _GR_VMCIRCBUF_H_ -#define _GR_VMCIRCBUF_H_ - -#include <gr_runtime_api.h> -#include <vector> - -/*! - * \brief abstract class to implement doubly mapped virtual memory circular buffers - * \ingroup internal - */ -class GR_RUNTIME_API gr_vmcircbuf { - protected: - int d_size; - char *d_base; - - // CREATORS - gr_vmcircbuf (int size) : d_size (size), d_base (0) {}; - - public: - virtual ~gr_vmcircbuf (); - - // ACCESSORS - void *pointer_to_first_copy () const { return d_base; } - void *pointer_to_second_copy () const { return d_base + d_size; } -}; - -/*! - * \brief abstract factory for creating circular buffers - */ -class GR_RUNTIME_API gr_vmcircbuf_factory { - protected: - gr_vmcircbuf_factory () {}; - virtual ~gr_vmcircbuf_factory (); - - public: - - /*! - * \brief return name of this factory - */ - virtual const char *name () const = 0; - - /*! - * \brief return granularity of mapping, typically equal to page size - */ - virtual int granularity () = 0; - - /*! - * \brief return a gr_vmcircbuf, or 0 if unable. - * - * Call this to create a doubly mapped circular buffer. - */ - virtual gr_vmcircbuf *make (int size) = 0; -}; - -/* - * \brief pulls together all implementations of gr_vmcircbuf - */ -class GR_RUNTIME_API gr_vmcircbuf_sysconfig { - public: - - /* - * \brief return the single instance of the default factory. - * - * returns the default factory to use if it's already defined, - * else find the first working factory and use it. - */ - static gr_vmcircbuf_factory *get_default_factory (); - - - static int granularity () { return get_default_factory()->granularity(); } - static gr_vmcircbuf *make (int size) { return get_default_factory()->make(size); } - - - // N.B. not all factories are guaranteed to work. - // It's too hard to check everything at config time, so we check at runtime - static std::vector<gr_vmcircbuf_factory *> all_factories (); - - // make this factory the default - static void set_default_factory (gr_vmcircbuf_factory *f); - - /*! - * \brief Does this factory really work? - * - * verbose = 0: silent - * verbose = 1: names of factories tested and results - * verbose = 2: all intermediate results - */ - static bool test_factory (gr_vmcircbuf_factory *f, int verbose); - - /*! - * \brief Test all factories, return true if at least one of them works - * verbose = 0: silent - * verbose = 1: names of factories tested and results - * verbose = 2: all intermediate results - */ - static bool test_all_factories (int verbose); -}; - - -#endif /* _GR_VMCIRCBUF_H_ */ diff --git a/gnuradio-runtime/lib/gr_vmcircbuf_createfilemapping.cc b/gnuradio-runtime/lib/gr_vmcircbuf_createfilemapping.cc deleted file mode 100644 index 1b4d9700a5..0000000000 --- a/gnuradio-runtime/lib/gr_vmcircbuf_createfilemapping.cc +++ /dev/null @@ -1,204 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2005,2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <stdexcept> -#include <assert.h> -#include <unistd.h> -#include <fcntl.h> -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif -#include <errno.h> -#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?) -static void -werror( char *where, DWORD last_error ) -{ - char buf[1024]; - - FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - last_error, - 0, // default language - buf, - sizeof(buf)/sizeof(TCHAR), // buffer size - NULL ); - fprintf( stderr, "%s: Error %d: %s", where, last_error, buf ); - return; -} -#endif - - -gr_vmcircbuf_createfilemapping::gr_vmcircbuf_createfilemapping (int size) - : gr_vmcircbuf (size) -{ -#if !defined(HAVE_CREATEFILEMAPPING) - fprintf (stderr, "%s: createfilemapping is not available\n",__FUNCTION__); - throw std::runtime_error ("gr_vmcircbuf_createfilemapping"); -#else - static int s_seg_counter = 0; - - if (size <= 0 || (size % gr_pagesize ()) != 0){ - fprintf (stderr, "gr_vmcircbuf_createfilemapping: invalid size = %d\n", size); - throw std::runtime_error ("gr_vmcircbuf_createfilemapping"); - } - - 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.c_str()); // name of mapping object - - s_seg_counter++; - if (d_handle == NULL || d_handle == INVALID_HANDLE_VALUE){ - std::string msg = str(boost::format( - "gr_vmcircbuf_mmap_createfilemapping: CreateFileMapping [%s]") % - seg_name ); - werror((char *) msg.c_str(), GetLastError() ); - throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping"); - } - - // Allocate virtual memory of the needed size, then free it so we can use it - LPVOID first_tmp; - first_tmp = VirtualAlloc( NULL, 2*size, MEM_RESERVE, PAGE_NOACCESS ); - if (first_tmp == NULL){ - werror( "gr_vmcircbuf_mmap_createfilemapping: VirtualAlloc", GetLastError()); - CloseHandle(d_handle); // cleanup - throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping"); - } - - if (VirtualFree(first_tmp, 0, MEM_RELEASE) == 0){ - werror( "gr_vmcircbuf_mmap_createfilemapping: VirtualFree", GetLastError()); - CloseHandle(d_handle); // cleanup - throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping"); - } - - d_first_copy = MapViewOfFileEx((HANDLE)d_handle, // handle to map object - FILE_MAP_WRITE, // read/write permission - 0, - 0, - size, - first_tmp); - if (d_first_copy != first_tmp){ - werror( "gr_vmcircbuf_mmap_createfilemapping: MapViewOfFileEx(1)", GetLastError()); - CloseHandle(d_handle); // cleanup - throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping"); - } - - d_second_copy = MapViewOfFileEx((HANDLE)d_handle, // handle to map object - FILE_MAP_WRITE, // read/write permission - 0, - 0, - size, - (char *)first_tmp + size);//(LPVOID) ((char *)d_first_copy + size)); - - if (d_second_copy != (char *)first_tmp + size){ - werror( "gr_vmcircbuf_mmap_createfilemapping: MapViewOfFileEx(2)", GetLastError()); - UnmapViewOfFile(d_first_copy); - CloseHandle(d_handle); // cleanup - throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping"); - } - -#ifdef DEBUG - fprintf (stderr,"gr_vmcircbuf_mmap_createfilemapping: contiguous? mmap %p %p %p %p\n", - (char *)d_first_copy, (char *)d_second_copy, size, (char *)d_first_copy + size); -#endif - - // Now remember the important stuff - d_base = (char *) d_first_copy; - d_size = size; -#endif /*HAVE_CREATEFILEMAPPING*/ -} - -gr_vmcircbuf_createfilemapping::~gr_vmcircbuf_createfilemapping () -{ -#ifdef HAVE_CREATEFILEMAPPING - if (UnmapViewOfFile(d_first_copy) == 0) - { - werror("gr_vmcircbuf_createfilemapping: UnmapViewOfFile(d_first_copy)", GetLastError()); - } - d_base=NULL; - if (UnmapViewOfFile(d_second_copy) == 0) - { - werror("gr_vmcircbuf_createfilemapping: UnmapViewOfFile(d_second_copy)", GetLastError()); - } - //d_second=NULL; - CloseHandle(d_handle); -#endif -} - -// ---------------------------------------------------------------- -// The factory interface -// ---------------------------------------------------------------- - - -gr_vmcircbuf_factory *gr_vmcircbuf_createfilemapping_factory::s_the_factory = 0; - -gr_vmcircbuf_factory * -gr_vmcircbuf_createfilemapping_factory::singleton () -{ - if (s_the_factory) - return s_the_factory; - s_the_factory = new gr_vmcircbuf_createfilemapping_factory (); - return s_the_factory; -} - -int -gr_vmcircbuf_createfilemapping_factory::granularity () -{ -#ifdef HAVE_CREATEFILEMAPPING - // return 65536;//TODO, check, is this needed or can we just use gr_pagesize() - SYSTEM_INFO system_info; - GetSystemInfo(&system_info); - //fprintf(stderr,"win32 AllocationGranularity %p\n",(int)system_info.dwAllocationGranularity); - return (int)system_info.dwAllocationGranularity; -#else - return gr_pagesize (); -#endif -} - -gr_vmcircbuf * -gr_vmcircbuf_createfilemapping_factory::make (int size) -{ - try - { - return new gr_vmcircbuf_createfilemapping (size); - } - catch (...) - { - return 0; - } -} diff --git a/gnuradio-runtime/lib/gr_vmcircbuf_createfilemapping.h b/gnuradio-runtime/lib/gr_vmcircbuf_createfilemapping.h deleted file mode 100644 index a4bb5cbe92..0000000000 --- a/gnuradio-runtime/lib/gr_vmcircbuf_createfilemapping.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2005 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. - */ - -#ifndef _GR_VMCIRCBUF_CREATEFILEMAPPING_H_ -#define _GR_VMCIRCBUF_CREATEFILEMAPPING_H_ - -#include <gr_runtime_api.h> -#include <gr_vmcircbuf.h> - -#ifdef HAVE_CREATEFILEMAPPING -#include <windows.h> -#endif -/*! - * \brief concrete class to implement circular buffers with mmap and shm_open - * \ingroup internal - */ -class GR_RUNTIME_API gr_vmcircbuf_createfilemapping : public gr_vmcircbuf -{ - public: - // CREATORS - gr_vmcircbuf_createfilemapping (int size); - virtual ~gr_vmcircbuf_createfilemapping (); -#ifdef HAVE_CREATEFILEMAPPING - private: - HANDLE d_handle; - LPVOID d_first_copy; - LPVOID d_second_copy; -#endif -}; - -/*! - * \brief concrete factory for circular buffers built using mmap and shm_open - */ -class GR_RUNTIME_API gr_vmcircbuf_createfilemapping_factory : public gr_vmcircbuf_factory -{ - private: - static gr_vmcircbuf_factory *s_the_factory; - - public: - static gr_vmcircbuf_factory *singleton (); - - virtual const char *name () const { return "gr_vmcircbuf_createfilemapping_factory"; } - - /*! - * \brief return granularity of mapping, typically equal to page size - */ - virtual int granularity (); - - /*! - * \brief return a gr_vmcircbuf, or 0 if unable. - * - * Call this to create a doubly mapped circular buffer. - */ - virtual gr_vmcircbuf *make (int size); -}; - -#endif /* _GR_VMCIRCBUF_CREATEFILEMAPPING_H_ */ diff --git a/gnuradio-runtime/lib/gr_vmcircbuf_mmap_shm_open.cc b/gnuradio-runtime/lib/gr_vmcircbuf_mmap_shm_open.cc deleted file mode 100644 index 3d170081d0..0000000000 --- a/gnuradio-runtime/lib/gr_vmcircbuf_mmap_shm_open.cc +++ /dev/null @@ -1,205 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <gr_vmcircbuf_mmap_shm_open.h> -#include <stdexcept> -#include <assert.h> -#include <unistd.h> -#include <fcntl.h> -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif -#include <errno.h> -#include <stdio.h> -#include <gr_pagesize.h> -#include <gr_sys_paths.h> - - -gr_vmcircbuf_mmap_shm_open::gr_vmcircbuf_mmap_shm_open (int size) - : gr_vmcircbuf (size) -{ -#if !defined(HAVE_MMAP) || !defined(HAVE_SHM_OPEN) - fprintf (stderr, "gr_vmcircbuf_mmap_shm_open: mmap or shm_open is not available\n"); - throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open"); -#else - static int s_seg_counter = 0; - - if (size <= 0 || (size % gr_pagesize ()) != 0){ - fprintf (stderr, "gr_vmcircbuf_mmap_shm_open: invalid size = %d\n", size); - throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open"); - } - - int shm_fd = -1; - char seg_name[1024]; - static bool portable_format = true; - - // open a new named shared memory segment - - while (1){ - if (portable_format){ - - // This is the POSIX recommended "portable format". - // Of course the "portable format" doesn't work on some systems... - - snprintf (seg_name, sizeof (seg_name), - "/gnuradio-%d-%d", getpid (), s_seg_counter); - } - else { - - // Where the "portable format" doesn't work, we try building - // a full filesystem pathname pointing into a suitable temporary directory. - - snprintf (seg_name, sizeof (seg_name), - "%s/gnuradio-%d-%d", gr_tmp_path (), getpid (), s_seg_counter); - } - - shm_fd = shm_open (seg_name, O_RDWR | O_CREAT | O_EXCL, 0600); - if (shm_fd == -1 && errno == EACCES && portable_format){ - portable_format = false; - continue; // try again using "non-portable format" - } - - s_seg_counter++; - - if (shm_fd == -1){ - if (errno == EEXIST) // Named segment already exists (shouldn't happen). Try again - continue; - - char msg[1024]; - snprintf (msg, sizeof (msg), "gr_vmcircbuf_mmap_shm_open: shm_open [%s]", seg_name); - perror (msg); - throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open"); - } - break; - } - - // We've got a new shared memory segment fd open. - // Now set it's length to 2x what we really want and mmap it in. - - if (ftruncate (shm_fd, (off_t) 2 * size) == -1){ - close (shm_fd); // cleanup - perror ("gr_vmcircbuf_mmap_shm_open: ftruncate (1)"); - throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open"); - } - - void *first_copy = mmap (0, 2 * size, - PROT_READ | PROT_WRITE, MAP_SHARED, - shm_fd, (off_t) 0); - - if (first_copy == MAP_FAILED){ - close (shm_fd); // cleanup - perror ("gr_vmcircbuf_mmap_shm_open: mmap (1)"); - throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open"); - } - - // unmap the 2nd half - if (munmap ((char *) first_copy + size, size) == -1){ - close (shm_fd); // cleanup - perror ("gr_vmcircbuf_mmap_shm_open: munmap (1)"); - throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open"); - } - - // map the first half into the now available hole where the - // second half used to be. - - void *second_copy = mmap ((char *) first_copy + size, size, - PROT_READ | PROT_WRITE, MAP_SHARED, - shm_fd, (off_t) 0); - - if (second_copy == MAP_FAILED){ - close (shm_fd); // cleanup - perror ("gr_vmcircbuf_mmap_shm_open: mmap (2)"); - throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open"); - } - -#if 0 // OS/X doesn't allow you to resize the segment - - // cut the shared memory segment down to size - if (ftruncate (shm_fd, (off_t) size) == -1){ - close (shm_fd); // cleanup - perror ("gr_vmcircbuf_mmap_shm_open: ftruncate (2)"); - throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open"); - } -#endif - - close (shm_fd); // fd no longer needed. The mapping is retained. - - if (shm_unlink (seg_name) == -1){ // unlink the seg_name. - perror ("gr_vmcircbuf_mmap_shm_open: shm_unlink"); - throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open"); - } - - // Now remember the important stuff - - d_base = (char *) first_copy; - d_size = size; -#endif -} - -gr_vmcircbuf_mmap_shm_open::~gr_vmcircbuf_mmap_shm_open () -{ -#if defined(HAVE_MMAP) - if (munmap (d_base, 2 * d_size) == -1){ - perror ("gr_vmcircbuf_mmap_shm_open: munmap (2)"); - } -#endif -} - -// ---------------------------------------------------------------- -// The factory interface -// ---------------------------------------------------------------- - - -gr_vmcircbuf_factory *gr_vmcircbuf_mmap_shm_open_factory::s_the_factory = 0; - -gr_vmcircbuf_factory * -gr_vmcircbuf_mmap_shm_open_factory::singleton () -{ - if (s_the_factory) - return s_the_factory; - - s_the_factory = new gr_vmcircbuf_mmap_shm_open_factory (); - return s_the_factory; -} - -int -gr_vmcircbuf_mmap_shm_open_factory::granularity () -{ - return gr_pagesize (); -} - -gr_vmcircbuf * -gr_vmcircbuf_mmap_shm_open_factory::make (int size) -{ - try { - return new gr_vmcircbuf_mmap_shm_open (size); - } - catch (...){ - return 0; - } -} diff --git a/gnuradio-runtime/lib/gr_vmcircbuf_mmap_shm_open.h b/gnuradio-runtime/lib/gr_vmcircbuf_mmap_shm_open.h deleted file mode 100644 index d35df80839..0000000000 --- a/gnuradio-runtime/lib/gr_vmcircbuf_mmap_shm_open.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -#ifndef _GR_VMCIRCBUF_MMAP_SHM_OPEN_H_ -#define _GR_VMCIRCBUF_MMAP_SHM_OPEN_H_ - -#include <gr_runtime_api.h> -#include <gr_vmcircbuf.h> - -/*! - * \brief concrete class to implement circular buffers with mmap and shm_open - * \ingroup internal - */ -class GR_RUNTIME_API gr_vmcircbuf_mmap_shm_open : public gr_vmcircbuf { - public: - - // CREATORS - - gr_vmcircbuf_mmap_shm_open (int size); - virtual ~gr_vmcircbuf_mmap_shm_open (); -}; - -/*! - * \brief concrete factory for circular buffers built using mmap and shm_open - */ -class GR_RUNTIME_API gr_vmcircbuf_mmap_shm_open_factory : public gr_vmcircbuf_factory { - private: - static gr_vmcircbuf_factory *s_the_factory; - - public: - static gr_vmcircbuf_factory *singleton (); - - virtual const char *name () const { return "gr_vmcircbuf_mmap_shm_open_factory"; } - - /*! - * \brief return granularity of mapping, typically equal to page size - */ - virtual int granularity (); - - /*! - * \brief return a gr_vmcircbuf, or 0 if unable. - * - * Call this to create a doubly mapped circular buffer. - */ - virtual gr_vmcircbuf *make (int size); -}; - -#endif /* _GR_VMCIRCBUF_MMAP_SHM_OPEN_H_ */ diff --git a/gnuradio-runtime/lib/gr_vmcircbuf_mmap_tmpfile.cc b/gnuradio-runtime/lib/gr_vmcircbuf_mmap_tmpfile.cc deleted file mode 100644 index 35de64699e..0000000000 --- a/gnuradio-runtime/lib/gr_vmcircbuf_mmap_tmpfile.cc +++ /dev/null @@ -1,197 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2011 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <gr_vmcircbuf_mmap_tmpfile.h> -#include <stdexcept> -#include <assert.h> -#include <unistd.h> -#include <stdlib.h> -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif -#include <fcntl.h> -#include <errno.h> -#include <stdio.h> -#include <string.h> -#include <gr_pagesize.h> -#include <gr_sys_paths.h> - -gr_vmcircbuf_mmap_tmpfile::gr_vmcircbuf_mmap_tmpfile (int size) - : gr_vmcircbuf (size) -{ -#if !defined(HAVE_MMAP) - fprintf (stderr, "gr_vmcircbuf_mmap_tmpfile: mmap or mkstemp is not available\n"); - throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile"); -#else - - if (size <= 0 || (size % gr_pagesize ()) != 0){ - fprintf (stderr, "gr_vmcircbuf_mmap_tmpfile: invalid size = %d\n", size); - throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile"); - } - - int seg_fd = -1; - char seg_name[1024]; - - static int s_seg_counter = 0; - - - // open a temporary file that we'll map in a bit later - - while (1){ - snprintf (seg_name, sizeof (seg_name), - "%s/gnuradio-%d-%d-XXXXXX", gr_tmp_path (), getpid (), s_seg_counter); - s_seg_counter++; - - seg_fd = open (seg_name, O_RDWR | O_CREAT | O_EXCL, 0600); - if (seg_fd == -1){ - if (errno == EEXIST) // File already exists (shouldn't happen). Try again - continue; - - char msg[1024]; - snprintf (msg, sizeof (msg), - "gr_vmcircbuf_mmap_tmpfile: open [%s]", seg_name); - perror (msg); - throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile"); - } - break; - } - - if (unlink (seg_name) == -1){ - perror ("gr_vmcircbuf_mmap_tmpfile: unlink"); - throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile"); - } - - // We've got a valid file descriptor to a tmp file. - // Now set it's length to 2x what we really want and mmap it in. - - if (ftruncate (seg_fd, (off_t) 2 * size) == -1){ - close (seg_fd); // cleanup - perror ("gr_vmcircbuf_mmap_tmpfile: ftruncate (1)"); - throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile"); - } - - void *first_copy = mmap (0, 2 * size, - PROT_READ | PROT_WRITE, MAP_SHARED, - seg_fd, (off_t) 0); - - if (first_copy == MAP_FAILED){ - close (seg_fd); // cleanup - perror ("gr_vmcircbuf_mmap_tmpfile: mmap (1)"); - throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile"); - } - - // unmap the 2nd half - if (munmap ((char *) first_copy + size, size) == -1){ - close (seg_fd); // cleanup - perror ("gr_vmcircbuf_mmap_tmpfile: munmap (1)"); - throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile"); - } - - // map the first half into the now available hole where the - // second half used to be. - - void *second_copy = mmap ((char *) first_copy + size, size, - PROT_READ | PROT_WRITE, MAP_SHARED, - seg_fd, (off_t) 0); - - if (second_copy == MAP_FAILED){ - munmap(first_copy, size); // cleanup - close (seg_fd); - perror ("gr_vmcircbuf_mmap_tmpfile: mmap (2)"); - throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile"); - } - - // check for contiguity - if ((char *) second_copy != (char *) first_copy + size){ - munmap(first_copy, size); // cleanup - munmap(second_copy, size); - close (seg_fd); - perror ("gr_vmcircbuf_mmap_tmpfile: non-contiguous second copy"); - throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile"); - } - - // cut the tmp file down to size - if (ftruncate (seg_fd, (off_t) size) == -1){ - munmap(first_copy, size); // cleanup - munmap(second_copy, size); - close (seg_fd); - perror ("gr_vmcircbuf_mmap_tmpfile: ftruncate (2)"); - throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile"); - } - - close (seg_fd); // fd no longer needed. The mapping is retained. - - // Now remember the important stuff - - d_base = (char *) first_copy; - d_size = size; -#endif -} - -gr_vmcircbuf_mmap_tmpfile::~gr_vmcircbuf_mmap_tmpfile () -{ -#if defined(HAVE_MMAP) - if (munmap (d_base, 2 * d_size) == -1){ - perror ("gr_vmcircbuf_mmap_tmpfile: munmap (2)"); - } -#endif -} - -// ---------------------------------------------------------------- -// The factory interface -// ---------------------------------------------------------------- - - -gr_vmcircbuf_factory *gr_vmcircbuf_mmap_tmpfile_factory::s_the_factory = 0; - -gr_vmcircbuf_factory * -gr_vmcircbuf_mmap_tmpfile_factory::singleton () -{ - if (s_the_factory) - return s_the_factory; - - s_the_factory = new gr_vmcircbuf_mmap_tmpfile_factory (); - return s_the_factory; -} - -int -gr_vmcircbuf_mmap_tmpfile_factory::granularity () -{ - return gr_pagesize (); -} - -gr_vmcircbuf * -gr_vmcircbuf_mmap_tmpfile_factory::make (int size) -{ - try { - return new gr_vmcircbuf_mmap_tmpfile (size); - } - catch (...){ - return 0; - } -} diff --git a/gnuradio-runtime/lib/gr_vmcircbuf_mmap_tmpfile.h b/gnuradio-runtime/lib/gr_vmcircbuf_mmap_tmpfile.h deleted file mode 100644 index cd865734f2..0000000000 --- a/gnuradio-runtime/lib/gr_vmcircbuf_mmap_tmpfile.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -#ifndef _GR_VMCIRCBUF_MMAP_TMPFILE_H_ -#define _GR_VMCIRCBUF_MMAP_TMPFILE_H_ - -#include <gr_runtime_api.h> -#include <gr_vmcircbuf.h> - -/*! - * \brief concrete class to implement circular buffers with mmap and shm_open - * \ingroup internal - */ -class GR_RUNTIME_API gr_vmcircbuf_mmap_tmpfile : public gr_vmcircbuf { - public: - - // CREATORS - - gr_vmcircbuf_mmap_tmpfile (int size); - virtual ~gr_vmcircbuf_mmap_tmpfile (); -}; - -/*! - * \brief concrete factory for circular buffers built using mmap and shm_open - */ -class GR_RUNTIME_API gr_vmcircbuf_mmap_tmpfile_factory : public gr_vmcircbuf_factory { - private: - static gr_vmcircbuf_factory *s_the_factory; - - public: - static gr_vmcircbuf_factory *singleton (); - - virtual const char *name () const { return "gr_vmcircbuf_mmap_tmpfile_factory"; } - - /*! - * \brief return granularity of mapping, typically equal to page size - */ - virtual int granularity (); - - /*! - * \brief return a gr_vmcircbuf, or 0 if unable. - * - * Call this to create a doubly mapped circular buffer. - */ - virtual gr_vmcircbuf *make (int size); -}; - -#endif /* _GR_VMCIRCBUF_MMAP_TMPFILE_H_ */ diff --git a/gnuradio-runtime/lib/gr_vmcircbuf_sysv_shm.cc b/gnuradio-runtime/lib/gr_vmcircbuf_sysv_shm.cc deleted file mode 100644 index d9cf75e70f..0000000000 --- a/gnuradio-runtime/lib/gr_vmcircbuf_sysv_shm.cc +++ /dev/null @@ -1,194 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <gr_vmcircbuf_sysv_shm.h> -#include <stdexcept> -#include <assert.h> -#include <unistd.h> -#include <stdlib.h> -#include <fcntl.h> -#ifdef HAVE_SYS_IPC_H -#include <sys/ipc.h> -#endif -#ifdef HAVE_SYS_SHM_H -#include <sys/shm.h> -#endif -#include <errno.h> -#include <stdio.h> -#include <gr_pagesize.h> - - -gr_vmcircbuf_sysv_shm::gr_vmcircbuf_sysv_shm (int size) - : gr_vmcircbuf (size) -{ -#if !defined(HAVE_SYS_SHM_H) - fprintf (stderr, "gr_vmcircbuf_sysv_shm: sysv shared memory is not available\n"); - throw std::runtime_error ("gr_vmcircbuf_sysv_shm"); -#else - - int pagesize = gr_pagesize(); - - if (size <= 0 || (size % pagesize) != 0){ - fprintf (stderr, "gr_vmcircbuf_sysv_shm: invalid size = %d\n", size); - throw std::runtime_error ("gr_vmcircbuf_sysv_shm"); - } - - int shmid_guard = -1; - int shmid1 = -1; - int shmid2 = -1; - - // We use this as a guard page. We'll map it read-only on both ends of the buffer. - // Ideally we'd map it no access, but I don't think that's possible with SysV - if ((shmid_guard = shmget (IPC_PRIVATE, pagesize, IPC_CREAT | 0400)) == -1){ - perror ("gr_vmcircbuf_sysv_shm: shmget (0)"); - throw std::runtime_error ("gr_vmcircbuf_sysv_shm"); - } - - if ((shmid2 = shmget (IPC_PRIVATE, 2 * size + 2 * pagesize, IPC_CREAT | 0700)) == -1){ - perror ("gr_vmcircbuf_sysv_shm: shmget (1)"); - shmctl (shmid_guard, IPC_RMID, 0); - throw std::runtime_error ("gr_vmcircbuf_sysv_shm"); - } - - if ((shmid1 = shmget (IPC_PRIVATE, size, IPC_CREAT | 0700)) == -1){ - perror ("gr_vmcircbuf_sysv_shm: shmget (2)"); - shmctl (shmid_guard, IPC_RMID, 0); - shmctl (shmid2, IPC_RMID, 0); - throw std::runtime_error ("gr_vmcircbuf_sysv_shm"); - } - - void *first_copy = shmat (shmid2, 0, 0); - if (first_copy == (void *) -1){ - perror ("gr_vmcircbuf_sysv_shm: shmat (1)"); - shmctl (shmid_guard, IPC_RMID, 0); - shmctl (shmid2, IPC_RMID, 0); - shmctl (shmid1, IPC_RMID, 0); - throw std::runtime_error ("gr_vmcircbuf_sysv_shm"); - } - - shmctl (shmid2, IPC_RMID, 0); - - // There may be a race between our detach and attach. - // - // If the system allocates all shared memory segments at the same - // virtual addresses in all processes and if the system allocates - // some other segment to first_copy or first_copoy + size between - // our detach and attach, the attaches below could fail [I've never - // seen it fail for this reason]. - - shmdt (first_copy); - - // first read-only guard page - if (shmat (shmid_guard, first_copy, SHM_RDONLY) == (void *) -1){ - perror ("gr_vmcircbuf_sysv_shm: shmat (2)"); - shmctl (shmid_guard, IPC_RMID, 0); - shmctl (shmid1, IPC_RMID, 0); - throw std::runtime_error ("gr_vmcircbuf_sysv_shm"); - } - - // first copy - if (shmat (shmid1, (char *) first_copy + pagesize, 0) == (void *) -1){ - perror ("gr_vmcircbuf_sysv_shm: shmat (3)"); - shmctl (shmid_guard, IPC_RMID, 0); - shmctl (shmid1, IPC_RMID, 0); - shmdt (first_copy); - throw std::runtime_error ("gr_vmcircbuf_sysv_shm"); - } - - // second copy - if (shmat (shmid1, (char *) first_copy + pagesize + size, 0) == (void *) -1){ - perror ("gr_vmcircbuf_sysv_shm: shmat (4)"); - shmctl (shmid_guard, IPC_RMID, 0); - shmctl (shmid1, IPC_RMID, 0); - shmdt ((char *)first_copy + pagesize); - throw std::runtime_error ("gr_vmcircbuf_sysv_shm"); - } - - // second read-only guard page - if (shmat (shmid_guard, (char *) first_copy + pagesize + 2 * size, SHM_RDONLY) == (void *) -1){ - perror ("gr_vmcircbuf_sysv_shm: shmat (5)"); - shmctl (shmid_guard, IPC_RMID, 0); - shmctl (shmid1, IPC_RMID, 0); - shmdt (first_copy); - shmdt ((char *)first_copy + pagesize); - shmdt ((char *)first_copy + pagesize + size); - throw std::runtime_error ("gr_vmcircbuf_sysv_shm"); - } - - shmctl (shmid1, IPC_RMID, 0); - shmctl (shmid_guard, IPC_RMID, 0); - - // Now remember the important stuff - - d_base = (char *) first_copy + pagesize; - d_size = size; -#endif -} - -gr_vmcircbuf_sysv_shm::~gr_vmcircbuf_sysv_shm () -{ -#if defined(HAVE_SYS_SHM_H) - if (shmdt (d_base - gr_pagesize()) == -1 - || shmdt (d_base) == -1 - || shmdt (d_base + d_size) == -1 - || shmdt (d_base + 2 * d_size) == -1){ - perror ("gr_vmcircbuf_sysv_shm: shmdt (2)"); - } -#endif -} - -// ---------------------------------------------------------------- -// The factory interface -// ---------------------------------------------------------------- - - -gr_vmcircbuf_factory *gr_vmcircbuf_sysv_shm_factory::s_the_factory = 0; - -gr_vmcircbuf_factory * -gr_vmcircbuf_sysv_shm_factory::singleton () -{ - if (s_the_factory) - return s_the_factory; - - s_the_factory = new gr_vmcircbuf_sysv_shm_factory (); - return s_the_factory; -} - -int -gr_vmcircbuf_sysv_shm_factory::granularity () -{ - return gr_pagesize (); -} - -gr_vmcircbuf * -gr_vmcircbuf_sysv_shm_factory::make (int size) -{ - try { - return new gr_vmcircbuf_sysv_shm (size); - } - catch (...){ - return 0; - } -} diff --git a/gnuradio-runtime/lib/gr_vmcircbuf_sysv_shm.h b/gnuradio-runtime/lib/gr_vmcircbuf_sysv_shm.h deleted file mode 100644 index abebd93f1c..0000000000 --- a/gnuradio-runtime/lib/gr_vmcircbuf_sysv_shm.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -#ifndef _GR_VMCIRCBUF_SYSV_SHM_H_ -#define _GR_VMCIRCBUF_SYSV_SHM_H_ - -#include <gr_runtime_api.h> -#include <gr_vmcircbuf.h> - -/*! - * \brief concrete class to implement circular buffers with mmap and shm_open - * \ingroup internal - */ -class GR_RUNTIME_API gr_vmcircbuf_sysv_shm : public gr_vmcircbuf { - public: - - // CREATORS - - gr_vmcircbuf_sysv_shm (int size); - virtual ~gr_vmcircbuf_sysv_shm (); -}; - -/*! - * \brief concrete factory for circular buffers built using mmap and shm_open - */ -class GR_RUNTIME_API gr_vmcircbuf_sysv_shm_factory : public gr_vmcircbuf_factory { - private: - static gr_vmcircbuf_factory *s_the_factory; - - public: - static gr_vmcircbuf_factory *singleton (); - - virtual const char *name () const { return "gr_vmcircbuf_sysv_shm_factory"; } - - /*! - * \brief return granularity of mapping, typically equal to page size - */ - virtual int granularity (); - - /*! - * \brief return a gr_vmcircbuf, or 0 if unable. - * - * Call this to create a doubly mapped circular buffer. - */ - virtual gr_vmcircbuf *make (int size); -}; - -#endif /* _GR_VMCIRCBUF_SYSV_SHM_H_ */ diff --git a/gnuradio-runtime/lib/gri_debugger_hook.cc b/gnuradio-runtime/lib/gri_debugger_hook.cc deleted file mode 100644 index d9270c435f..0000000000 --- a/gnuradio-runtime/lib/gri_debugger_hook.cc +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#include <gri_debugger_hook.h> - -void -gri_debugger_hook () -{ - // nop. set a breakpoint here -} diff --git a/gnuradio-runtime/lib/gri_debugger_hook.h b/gnuradio-runtime/lib/gri_debugger_hook.h deleted file mode 100644 index 6d31ed1b2c..0000000000 --- a/gnuradio-runtime/lib/gri_debugger_hook.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifndef INCLUDED_GRI_DEBUGGER_HOOK_H -#define INCLUDED_GRI_DEBUGGER_HOOK_H - -#include <gr_runtime_api.h> - -GR_RUNTIME_API void gri_debugger_hook (); - -#endif /* INCLUDED_GRI_DEBUGGER_HOOK_H */
\ No newline at end of file diff --git a/gnuradio-runtime/lib/hier_block2.cc b/gnuradio-runtime/lib/hier_block2.cc new file mode 100644 index 0000000000..f26da18e54 --- /dev/null +++ b/gnuradio-runtime/lib/hier_block2.cc @@ -0,0 +1,160 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006-2008,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/hier_block2.h> +#include <gnuradio/io_signature.h> +#include "hier_block2_detail.h" +#include <iostream> + +namespace gr { + +#define GR_HIER_BLOCK2_DEBUG 0 + + hier_block2_sptr + 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 hier_block2(name, input_signature, output_signature)); + } + + hier_block2::hier_block2(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature) + : basic_block(name, input_signature, output_signature), + d_detail(new 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); + } + + hier_block2::~hier_block2() + { + delete d_detail; + } + + hier_block2::opaque_self + hier_block2::self() + { + return shared_from_this(); + } + + hier_block2_sptr + hier_block2::to_hier_block2() + { + return cast_to_hier_block2_sptr(shared_from_this()); + } + + void + hier_block2::connect(basic_block_sptr block) + { + d_detail->connect(block); + } + + void + hier_block2::connect(basic_block_sptr src, int src_port, + basic_block_sptr dst, int dst_port) + { + d_detail->connect(src, src_port, dst, dst_port); + } + + void + hier_block2::msg_connect(basic_block_sptr src, pmt::pmt_t srcport, + basic_block_sptr dst, pmt::pmt_t dstport) + { + if(!pmt::is_symbol(srcport)) { + throw std::runtime_error("bad port id"); + } + d_detail->msg_connect(src, srcport, dst, dstport); + } + + void + hier_block2::msg_connect(basic_block_sptr src, std::string srcport, + basic_block_sptr dst, std::string dstport) + { + d_detail->msg_connect(src, pmt::mp(srcport), dst, pmt::mp(dstport)); + } + + void + hier_block2::msg_disconnect(basic_block_sptr src, pmt::pmt_t srcport, + basic_block_sptr dst, pmt::pmt_t dstport) + { + if(!pmt::is_symbol(srcport)) { + throw std::runtime_error("bad port id"); + } + d_detail->msg_disconnect(src, srcport, dst, dstport); + } + + void + hier_block2::msg_disconnect(basic_block_sptr src, std::string srcport, + basic_block_sptr dst, std::string dstport) + { + d_detail->msg_disconnect(src, pmt::mp(srcport), dst, pmt::mp(dstport)); + } + + void + hier_block2::disconnect(basic_block_sptr block) + { + d_detail->disconnect(block); + } + + void + hier_block2::disconnect(basic_block_sptr src, int src_port, + basic_block_sptr dst, int dst_port) + { + d_detail->disconnect(src, src_port, dst, dst_port); + } + + void + hier_block2::disconnect_all() + { + d_detail->disconnect_all(); + } + + void + hier_block2::lock() + { + d_detail->lock(); + } + + void + hier_block2::unlock() + { + d_detail->unlock(); + } + + flat_flowgraph_sptr + hier_block2::flatten() const + { + flat_flowgraph_sptr new_ffg = make_flat_flowgraph(); + d_detail->flatten_aux(new_ffg); + return new_ffg; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/hier_block2_detail.cc b/gnuradio-runtime/lib/hier_block2_detail.cc new file mode 100644 index 0000000000..83207d978c --- /dev/null +++ b/gnuradio-runtime/lib/hier_block2_detail.cc @@ -0,0 +1,657 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2007,2009,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "hier_block2_detail.h" +#include <gnuradio/io_signature.h> +#include <gnuradio/prefs.h> +#include <stdexcept> +#include <sstream> +#include <boost/format.hpp> + +namespace gr { + +#define HIER_BLOCK2_DETAIL_DEBUG 0 + + hier_block2_detail::hier_block2_detail(hier_block2 *owner) + : d_owner(owner), + d_parent_detail(0), + d_fg(make_flowgraph()) + { + int min_inputs = owner->input_signature()->min_streams(); + int max_inputs = owner->input_signature()->max_streams(); + int min_outputs = owner->output_signature()->min_streams(); + int max_outputs = owner->output_signature()->max_streams(); + + if(max_inputs == io_signature::IO_INFINITE || + max_outputs == io_signature::IO_INFINITE || + (min_inputs != max_inputs) ||(min_outputs != max_outputs) ) { + std::stringstream msg; + msg << "Hierarchical blocks do not yet support arbitrary or" + << " variable numbers of inputs or outputs (" << d_owner->name() << ")"; + throw std::runtime_error(msg.str()); + } + + d_inputs = std::vector<endpoint_vector_t>(max_inputs); + d_outputs = endpoint_vector_t(max_outputs); + } + + hier_block2_detail::~hier_block2_detail() + { + d_owner = 0; // Don't use delete, we didn't allocate + } + + void + hier_block2_detail::connect(basic_block_sptr block) + { + std::stringstream msg; + + // Check if duplicate + if(std::find(d_blocks.begin(), d_blocks.end(), block) != d_blocks.end()) { + msg << "Block " << block << " already connected."; + throw std::invalid_argument(msg.str()); + } + + // Check if has inputs or outputs + if(block->input_signature()->max_streams() != 0 || + block->output_signature()->max_streams() != 0) { + msg << "Block " << block << " must not have any input or output ports"; + throw std::invalid_argument(msg.str()); + } + + hier_block2_sptr hblock(cast_to_hier_block2_sptr(block)); + + if(hblock && hblock.get() != d_owner) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "connect: block is hierarchical, setting parent to " << this << std::endl; + hblock->d_detail->d_parent_detail = this; + } + + d_blocks.push_back(block); + } + + void + hier_block2_detail::connect(basic_block_sptr src, int src_port, + basic_block_sptr dst, int dst_port) + { + std::stringstream msg; + + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "connecting: " << endpoint(src, src_port) + << " -> " << endpoint(dst, dst_port) << std::endl; + + if(src.get() == dst.get()) + throw std::invalid_argument("connect: src and destination blocks cannot be the same"); + + hier_block2_sptr src_block(cast_to_hier_block2_sptr(src)); + hier_block2_sptr dst_block(cast_to_hier_block2_sptr(dst)); + + if(src_block && src.get() != d_owner) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "connect: src is hierarchical, setting parent to " << this << std::endl; + src_block->d_detail->d_parent_detail = this; + } + + if(dst_block && dst.get() != d_owner) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "connect: dst is hierarchical, setting parent to " << this << std::endl; + dst_block->d_detail->d_parent_detail = this; + } + + // Connections to block inputs or outputs + int max_port; + if(src.get() == d_owner) { + max_port = src->input_signature()->max_streams(); + if((max_port != -1 && (src_port >= max_port)) || src_port < 0) { + msg << "source port " << src_port << " out of range for " << src; + throw std::invalid_argument(msg.str()); + } + + return connect_input(src_port, dst_port, dst); + } + + if(dst.get() == d_owner) { + max_port = dst->output_signature()->max_streams(); + if((max_port != -1 && (dst_port >= max_port)) || dst_port < 0) { + msg << "destination port " << dst_port << " out of range for " << dst; + throw std::invalid_argument(msg.str()); + } + + return connect_output(dst_port, src_port, src); + } + + // Internal connections + d_fg->connect(src, src_port, dst, dst_port); + + // TODO: connects to NC + } + + void + hier_block2_detail::msg_connect(basic_block_sptr src, pmt::pmt_t srcport, + basic_block_sptr dst, pmt::pmt_t dstport) + { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "connecting message port..." << std::endl; + + // register the subscription + // this is done later... + // src->message_port_sub(srcport, pmt::cons(dst->alias_pmt(), dstport)); + + // add block uniquely to list to internal blocks + if(std::find(d_blocks.begin(), d_blocks.end(), dst) == d_blocks.end()){ + d_blocks.push_back(src); + d_blocks.push_back(dst); + } + + bool hier_out = (d_owner == src.get()) && src->message_port_is_hier_out(srcport);; + bool hier_in = (d_owner == dst.get()) && dst->message_port_is_hier_in(dstport); + + hier_block2_sptr src_block(cast_to_hier_block2_sptr(src)); + hier_block2_sptr dst_block(cast_to_hier_block2_sptr(dst)); + + if(src_block && src.get() != d_owner) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "connect: src is hierarchical, setting parent to " << this << std::endl; + src_block->d_detail->d_parent_detail = this; + } + + if(dst_block && dst.get() != d_owner) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "connect: dst is hierarchical, setting parent to " << this << std::endl; + dst_block->d_detail->d_parent_detail = this; + } + + // add edge for this message connection + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << boost::format("connect( (%s, %s, %d), (%s, %s, %d) )\n") % \ + src % srcport % hier_out % + dst % dstport % hier_in; + d_fg->connect(msg_endpoint(src, srcport, hier_out), msg_endpoint(dst, dstport, hier_in)); + } + + void + hier_block2_detail::msg_disconnect(basic_block_sptr src, pmt::pmt_t srcport, + basic_block_sptr dst, pmt::pmt_t dstport) + { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "disconnecting message port..." << std::endl; + + // unregister the subscription - if already subscribed + src->message_port_unsub(srcport, pmt::cons(dst->alias_pmt(), dstport)); + + // remove edge for this message connection + bool hier_out = (d_owner == src.get()) && src->message_port_is_hier_out(srcport);; + bool hier_in = (d_owner == dst.get()) && dst->message_port_is_hier_in(dstport); + d_fg->disconnect(msg_endpoint(src, srcport, hier_out), msg_endpoint(dst, dstport, hier_in)); + } + + void + hier_block2_detail::disconnect(basic_block_sptr block) + { + // Check on singleton list + for(basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) { + if(*p == block) { + d_blocks.erase(p); + + hier_block2_sptr hblock(cast_to_hier_block2_sptr(block)); + if(block && block.get() != d_owner) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "disconnect: block is hierarchical, clearing parent" << std::endl; + hblock->d_detail->d_parent_detail = 0; + } + + return; + } + } + + // Otherwise find all edges containing block + edge_vector_t edges, tmp = d_fg->edges(); + edge_vector_t::iterator p; + for(p = tmp.begin(); p != tmp.end(); p++) { + if((*p).src().block() == block || (*p).dst().block() == block) { + edges.push_back(*p); + + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "disconnect: block found in edge " << (*p) << std::endl; + } + } + + if(edges.size() == 0) { + std::stringstream msg; + msg << "cannot disconnect block " << block << ", not found"; + throw std::invalid_argument(msg.str()); + } + + for(p = edges.begin(); p != edges.end(); p++) { + disconnect((*p).src().block(), (*p).src().port(), + (*p).dst().block(), (*p).dst().port()); + } + } + + void + hier_block2_detail::disconnect(basic_block_sptr src, int src_port, + basic_block_sptr dst, int dst_port) + { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "disconnecting: " << endpoint(src, src_port) + << " -> " << endpoint(dst, dst_port) << std::endl; + + if(src.get() == dst.get()) + throw std::invalid_argument("disconnect: source and destination blocks cannot be the same"); + + hier_block2_sptr src_block(cast_to_hier_block2_sptr(src)); + hier_block2_sptr dst_block(cast_to_hier_block2_sptr(dst)); + + if(src_block && src.get() != d_owner) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "disconnect: src is hierarchical, clearing parent" << std::endl; + src_block->d_detail->d_parent_detail = 0; + } + + if(dst_block && dst.get() != d_owner) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "disconnect: dst is hierarchical, clearing parent" << std::endl; + dst_block->d_detail->d_parent_detail = 0; + } + + if(src.get() == d_owner) + return disconnect_input(src_port, dst_port, dst); + + if(dst.get() == d_owner) + return disconnect_output(dst_port, src_port, src); + + // Internal connections + d_fg->disconnect(src, src_port, dst, dst_port); + } + + void + hier_block2_detail::connect_input(int my_port, int port, + basic_block_sptr block) + { + std::stringstream msg; + + if(my_port < 0 || my_port >= (signed)d_inputs.size()) { + msg << "input port " << my_port << " out of range for " << block; + throw std::invalid_argument(msg.str()); + } + + endpoint_vector_t &endps = d_inputs[my_port]; + endpoint endp(block, port); + + endpoint_viter_t p = std::find(endps.begin(), endps.end(), endp); + if(p != endps.end()) { + msg << "external input port " << my_port << " already wired to " << endp; + throw std::invalid_argument(msg.str()); + } + + endps.push_back(endp); + } + + void + hier_block2_detail::connect_output(int my_port, int port, + basic_block_sptr block) + { + std::stringstream msg; + + if(my_port < 0 || my_port >= (signed)d_outputs.size()) { + msg << "output port " << my_port << " out of range for " << block; + throw std::invalid_argument(msg.str()); + } + + if(d_outputs[my_port].block()) { + msg << "external output port " << my_port << " already connected from " + << d_outputs[my_port]; + throw std::invalid_argument(msg.str()); + } + + d_outputs[my_port] = endpoint(block, port); + } + + void + hier_block2_detail::disconnect_input(int my_port, int port, + basic_block_sptr block) + { + std::stringstream msg; + + if(my_port < 0 || my_port >= (signed)d_inputs.size()) { + msg << "input port number " << my_port << " out of range for " << block; + throw std::invalid_argument(msg.str()); + } + + endpoint_vector_t &endps = d_inputs[my_port]; + endpoint endp(block, port); + + endpoint_viter_t p = std::find(endps.begin(), endps.end(), endp); + if(p == endps.end()) { + msg << "external input port " << my_port << " not connected to " << endp; + throw std::invalid_argument(msg.str()); + } + + endps.erase(p); + } + + void + hier_block2_detail::disconnect_output(int my_port, int port, + basic_block_sptr block) + { + std::stringstream msg; + + if(my_port < 0 || my_port >= (signed)d_outputs.size()) { + msg << "output port number " << my_port << " out of range for " << block; + throw std::invalid_argument(msg.str()); + } + + if(d_outputs[my_port].block() != block) { + msg << "block " << block << " not assigned to output " + << my_port << ", can't disconnect"; + throw std::invalid_argument(msg.str()); + } + + d_outputs[my_port] = endpoint(); + } + + endpoint_vector_t + hier_block2_detail::resolve_port(int port, bool is_input) + { + std::stringstream msg; + + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "Resolving port " << port << " as an " + << (is_input ? "input" : "output") + << " of " << d_owner->name() << std::endl; + + endpoint_vector_t result; + + if(is_input) { + if(port < 0 || port >= (signed)d_inputs.size()) { + msg << "resolve_port: hierarchical block '" << d_owner->name() + << "': input " << port << " is out of range"; + throw std::runtime_error(msg.str()); + } + + if(d_inputs[port].empty()) { + msg << "resolve_port: hierarchical block '" << d_owner->name() + << "': input " << port << " is not connected internally"; + throw std::runtime_error(msg.str()); + } + + endpoint_vector_t &endps = d_inputs[port]; + endpoint_viter_t p; + for(p = endps.begin(); p != endps.end(); p++) { + endpoint_vector_t tmp = resolve_endpoint(*p, true); + std::copy(tmp.begin(), tmp.end(), back_inserter(result)); + } + } + else { + if(port < 0 || port >= (signed)d_outputs.size()) { + msg << "resolve_port: hierarchical block '" << d_owner->name() + << "': output " << port << " is out of range"; + throw std::runtime_error(msg.str()); + } + + if(d_outputs[port] == endpoint()) { + msg << "resolve_port: hierarchical block '" << d_owner->name() + << "': output " << port << " is not connected internally"; + throw std::runtime_error(msg.str()); + } + + result = resolve_endpoint(d_outputs[port], false); + } + + if(result.empty()) { + msg << "resolve_port: hierarchical block '" << d_owner->name() + << "': unable to resolve " + << (is_input ? "input port " : "output port ") + << port; + throw std::runtime_error(msg.str()); + } + + return result; + } + + void + hier_block2_detail::disconnect_all() + { + d_fg->clear(); + d_blocks.clear(); + d_inputs.clear(); + d_outputs.clear(); + } + + endpoint_vector_t + hier_block2_detail::resolve_endpoint(const endpoint &endp, bool is_input) const + { + std::stringstream msg; + endpoint_vector_t result; + + // Check if endpoint is a leaf node + if(cast_to_block_sptr(endp.block())) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "Block " << endp.block() << " is a leaf node, returning." << std::endl; + result.push_back(endp); + return result; + } + + // Check if endpoint is a hierarchical block + hier_block2_sptr hier_block2(cast_to_hier_block2_sptr(endp.block())); + if(hier_block2) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "Resolving endpoint " << endp << " as an " + << (is_input ? "input" : "output") + << ", recursing" << std::endl; + return hier_block2->d_detail->resolve_port(endp.port(), is_input); + } + + msg << "unable to resolve" << (is_input ? " input " : " output ") + << "endpoint " << endp; + throw std::runtime_error(msg.str()); + } + + void + hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const + { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << " ** Flattening " << d_owner->name() << std::endl; + + // Add my edges to the flow graph, resolving references to actual endpoints + edge_vector_t edges = d_fg->edges(); + msg_edge_vector_t msg_edges = d_fg->msg_edges(); + edge_viter_t p; + msg_edge_viter_t q,u; + + // Only run setup_rpc if ControlPort config param is enabled. + bool ctrlport_on = prefs::singleton()->get_bool("ControlPort", "on", false); + + // For every block (gr::block and gr::hier_block2), set up the RPC + // interface. + for(p = edges.begin(); p != edges.end(); p++) { + basic_block_sptr b; + b = p->src().block(); + + if(ctrlport_on) { + if(!b->is_rpc_set()) { + b->setup_rpc(); + b->rpc_set(); + } + } + + b = p->dst().block(); + if(ctrlport_on) { + if(!b->is_rpc_set()) { + b->setup_rpc(); + b->rpc_set(); + } + } + } + + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "Flattening stream connections: " << std::endl; + + for(p = edges.begin(); p != edges.end(); p++) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "Flattening edge " << (*p) << std::endl; + + endpoint_vector_t src_endps = resolve_endpoint(p->src(), false); + endpoint_vector_t dst_endps = resolve_endpoint(p->dst(), true); + + endpoint_viter_t s, d; + for(s = src_endps.begin(); s != src_endps.end(); s++) { + for(d = dst_endps.begin(); d != dst_endps.end(); d++) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << (*s) << "->" << (*d) << std::endl; + sfg->connect(*s, *d); + } + } + } + + // loop through flattening hierarchical connections + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "Flattening msg connections: " << std::endl; + + std::vector<std::pair<msg_endpoint, bool> > resolved_endpoints; + for(q = msg_edges.begin(); q != msg_edges.end(); q++) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << boost::format(" flattening edge ( %s, %s, %d) -> ( %s, %s, %d)\n") % \ + q->src().block() % q->src().port() % q->src().is_hier() % q->dst().block() % \ + q->dst().port() % q->dst().is_hier(); + + bool normal_connection = true; + + // resolve existing connections to hier ports + if(q->dst().is_hier()) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << boost::format(" resolve hier output (%s, %s)") % \ + q->dst().block() % q->dst().port() << std::endl; + sfg->replace_endpoint( q->dst(), q->src(), true ); + resolved_endpoints.push_back(std::pair<msg_endpoint, bool>(q->dst(),true)); + normal_connection = false; + } + + if(q->src().is_hier()) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << boost::format(" resolve hier input (%s, %s)") % \ + q->src().block() % q->src().port() << std::endl; + sfg->replace_endpoint( q->src(), q->dst(), false ); + resolved_endpoints.push_back(std::pair<msg_endpoint, bool>(q->src(),false)); + normal_connection = false; + } + + // propogate non hier connections through + if(normal_connection){ + sfg->connect( q->src(), q->dst() ); + } + } + + for(std::vector<std::pair<msg_endpoint, bool> >::iterator it = resolved_endpoints.begin(); + it != resolved_endpoints.end(); it++) { + sfg->clear_endpoint((*it).first, (*it).second); + } + + /* + // connect primitive edges in the new fg + for(q = msg_edges.begin(); q != msg_edges.end(); q++) { + if((!q->src().is_hier()) && (!q->dst().is_hier())) { + sfg->connect(q->src(), q->dst()); + } + else { + std::cout << "not connecting hier connection!" << std::endl; + } + } + */ + + // Construct unique list of blocks used either in edges, inputs, + // outputs, or by themselves. I still hate STL. + basic_block_vector_t blocks; // unique list of used blocks + basic_block_vector_t tmp = d_fg->calc_used_blocks(); + + // First add the list of singleton blocks + std::vector<basic_block_sptr>::const_iterator b; // Because flatten_aux is const + for(b = d_blocks.begin(); b != d_blocks.end(); b++) + tmp.push_back(*b); + + // Now add the list of connected input blocks + std::stringstream msg; + for(unsigned int i = 0; i < d_inputs.size(); i++) { + if(d_inputs[i].size() == 0) { + msg << "In hierarchical block " << d_owner->name() << ", input " << i + << " is not connected internally"; + throw std::runtime_error(msg.str()); + } + + for(unsigned int j = 0; j < d_inputs[i].size(); j++) + tmp.push_back(d_inputs[i][j].block()); + } + + for(unsigned int i = 0; i < d_outputs.size(); i++) { + basic_block_sptr blk = d_outputs[i].block(); + if(!blk) { + msg << "In hierarchical block " << d_owner->name() << ", output " << i + << " is not connected internally"; + throw std::runtime_error(msg.str()); + } + tmp.push_back(blk); + } + sort(tmp.begin(), tmp.end()); + + std::insert_iterator<basic_block_vector_t> inserter(blocks, blocks.begin()); + unique_copy(tmp.begin(), tmp.end(), inserter); + + // Recurse hierarchical children + for(basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) { + hier_block2_sptr hier_block2(cast_to_hier_block2_sptr(*p)); + if(hier_block2 && (hier_block2.get() != d_owner)) { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "flatten_aux: recursing into hierarchical block " + << hier_block2 << std::endl; + hier_block2->d_detail->flatten_aux(sfg); + } + } + } + + void + hier_block2_detail::lock() + { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "lock: entered in " << this << std::endl; + + if(d_parent_detail) + d_parent_detail->lock(); + else + d_owner->lock(); + } + + void + hier_block2_detail::unlock() + { + if(HIER_BLOCK2_DETAIL_DEBUG) + std::cout << "unlock: entered in " << this << std::endl; + + if(d_parent_detail) + d_parent_detail->unlock(); + else + d_owner->unlock(); + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/hier_block2_detail.h b/gnuradio-runtime/lib/hier_block2_detail.h new file mode 100644 index 0000000000..99bf6e8ef1 --- /dev/null +++ b/gnuradio-runtime/lib/hier_block2_detail.h @@ -0,0 +1,77 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2007,2009,2013 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. + */ + +#ifndef INCLUDED_GR_RUNTIME_HIER_BLOCK2_DETAIL_H +#define INCLUDED_GR_RUNTIME_HIER_BLOCK2_DETAIL_H + +#include <gnuradio/api.h> +#include <gnuradio/hier_block2.h> +#include <flat_flowgraph.h> +#include <boost/utility.hpp> + +namespace gr { + + /*! + * \ingroup internal + */ + class GR_RUNTIME_API hier_block2_detail : boost::noncopyable + { + public: + hier_block2_detail(hier_block2 *owner); + ~hier_block2_detail(); + + void connect(basic_block_sptr block); + void connect(basic_block_sptr src, int src_port, + basic_block_sptr dst, int dst_port); + void msg_connect(basic_block_sptr src, pmt::pmt_t srcport, + basic_block_sptr dst, pmt::pmt_t dstport); + void msg_disconnect(basic_block_sptr src, pmt::pmt_t srcport, + basic_block_sptr dst, pmt::pmt_t dstport); + void disconnect(basic_block_sptr block); + void disconnect(basic_block_sptr, int src_port, + basic_block_sptr, int dst_port); + void disconnect_all(); + void lock(); + void unlock(); + void flatten_aux(flat_flowgraph_sptr sfg) const; + + private: + // Private implementation data + hier_block2 *d_owner; + hier_block2_detail *d_parent_detail; + flowgraph_sptr d_fg; + std::vector<endpoint_vector_t> d_inputs; // Multiple internal endpoints per external input + endpoint_vector_t d_outputs; // Single internal endpoint per external output + basic_block_vector_t d_blocks; + + void connect_input(int my_port, int port, basic_block_sptr block); + void connect_output(int my_port, int port, basic_block_sptr block); + void disconnect_input(int my_port, int port, basic_block_sptr block); + void disconnect_output(int my_port, int port, basic_block_sptr block); + + endpoint_vector_t resolve_port(int port, bool is_input); + endpoint_vector_t resolve_endpoint(const endpoint &endp, bool is_input) const; + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_RUNTIME_HIER_BLOCK2_DETAIL_H */ diff --git a/gnuradio-runtime/lib/io_signature.cc b/gnuradio-runtime/lib/io_signature.cc new file mode 100644 index 0000000000..ccfdf3c06b --- /dev/null +++ b/gnuradio-runtime/lib/io_signature.cc @@ -0,0 +1,117 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2007,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gnuradio/io_signature.h> +#include <stdexcept> +#include <iostream> + +namespace gr { + + gr::io_signature::sptr + io_signature::makev(int min_streams, int max_streams, + const std::vector<int> &sizeof_stream_items) + { + return gr::io_signature::sptr + (new io_signature(min_streams, max_streams, + sizeof_stream_items)); + } + + gr::io_signature::sptr + io_signature::make(int min_streams, int max_streams, + int sizeof_stream_item) + { + std::vector<int> sizeof_items(1); + sizeof_items[0] = sizeof_stream_item; + return io_signature::makev(min_streams, max_streams, sizeof_items); + } + + gr::io_signature::sptr + io_signature::make2(int min_streams, int max_streams, + int sizeof_stream_item1, + int sizeof_stream_item2) + { + std::vector<int> sizeof_items(2); + sizeof_items[0] = sizeof_stream_item1; + sizeof_items[1] = sizeof_stream_item2; + return io_signature::makev(min_streams, max_streams, sizeof_items); + } + + gr::io_signature::sptr + io_signature::make3(int min_streams, int max_streams, + int sizeof_stream_item1, + int sizeof_stream_item2, + int sizeof_stream_item3) + { + std::vector<int> sizeof_items(3); + sizeof_items[0] = sizeof_stream_item1; + sizeof_items[1] = sizeof_stream_item2; + sizeof_items[2] = sizeof_stream_item3; + return io_signature::makev(min_streams, max_streams, sizeof_items); + } + + // ------------------------------------------------------------------------ + + io_signature::io_signature(int min_streams, int max_streams, + const std::vector<int> &sizeof_stream_items) + { + if(min_streams < 0 + || (max_streams != IO_INFINITE && max_streams < min_streams)) + throw std::invalid_argument ("gr::io_signature(1)"); + + if(sizeof_stream_items.size() < 1) + throw std::invalid_argument("gr::io_signature(2)"); + + for(size_t i = 0; i < sizeof_stream_items.size(); i++) { + if(max_streams != 0 && sizeof_stream_items[i] < 1) + throw std::invalid_argument("gr::io_signature(3)"); + } + + d_min_streams = min_streams; + d_max_streams = max_streams; + d_sizeof_stream_item = sizeof_stream_items; + } + + io_signature::~io_signature() + { + } + + int + io_signature::sizeof_stream_item(int _index) const + { + if(_index < 0) + throw std::invalid_argument("gr::io_signature::sizeof_stream_item"); + + size_t index = _index; + return d_sizeof_stream_item[std::min(index, d_sizeof_stream_item.size() - 1)]; + } + + std::vector<int> + io_signature::sizeof_stream_items() const + { + return d_sizeof_stream_item; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/local_sighandler.cc b/gnuradio-runtime/lib/local_sighandler.cc new file mode 100644 index 0000000000..ebd9bb1362 --- /dev/null +++ b/gnuradio-runtime/lib/local_sighandler.cc @@ -0,0 +1,189 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "local_sighandler.h" +#include <stdexcept> +#include <stdio.h> +#include <string.h> + +namespace gr { + + local_sighandler::local_sighandler(int signum, + void (*new_handler)(int)) + : d_signum(signum) + { +#ifdef HAVE_SIGACTION + struct sigaction new_action; + memset(&new_action, 0, sizeof(new_action)); + + new_action.sa_handler = new_handler; + sigemptyset(&new_action.sa_mask); + new_action.sa_flags = 0; + + if(sigaction (d_signum, &new_action, &d_old_action) < 0) { + perror("sigaction (install new)"); + throw std::runtime_error("sigaction"); + } +#endif + } + + local_sighandler::~local_sighandler() + { +#ifdef HAVE_SIGACTION + if(sigaction (d_signum, &d_old_action, 0) < 0) { + perror("sigaction (restore old)"); + throw std::runtime_error("sigaction"); + } +#endif + } + + void + local_sighandler::throw_signal(int signum) + { + throw signal(signum); + } + + /* + * Semi-hideous way to may a signal number into a signal name + */ + #define SIGNAME(x) case x: return #x + + std::string + signal::name() const + { + char tmp[128]; + + switch(signum()) { +#ifdef SIGHUP + SIGNAME(SIGHUP); +#endif +#ifdef SIGINT + SIGNAME(SIGINT); +#endif +#ifdef SIGQUIT + SIGNAME(SIGQUIT); +#endif +#ifdef SIGILL + SIGNAME(SIGILL); +#endif +#ifdef SIGTRAP + SIGNAME(SIGTRAP); +#endif +#ifdef SIGABRT + SIGNAME(SIGABRT); +#endif +#ifdef SIGBUS + SIGNAME(SIGBUS); +#endif +#ifdef SIGFPE + SIGNAME(SIGFPE); +#endif +#ifdef SIGKILL + SIGNAME(SIGKILL); +#endif +#ifdef SIGUSR1 + SIGNAME(SIGUSR1); +#endif +#ifdef SIGSEGV + SIGNAME(SIGSEGV); +#endif +#ifdef SIGUSR2 + SIGNAME(SIGUSR2); +#endif +#ifdef SIGPIPE + SIGNAME(SIGPIPE); +#endif +#ifdef SIGALRM + SIGNAME(SIGALRM); +#endif +#ifdef SIGTERM + SIGNAME(SIGTERM); +#endif +#ifdef SIGSTKFLT + SIGNAME(SIGSTKFLT); +#endif +#ifdef SIGCHLD + SIGNAME(SIGCHLD); +#endif +#ifdef SIGCONT + SIGNAME(SIGCONT); +#endif +#ifdef SIGSTOP + SIGNAME(SIGSTOP); +#endif +#ifdef SIGTSTP + SIGNAME(SIGTSTP); +#endif +#ifdef SIGTTIN + SIGNAME(SIGTTIN); +#endif +#ifdef SIGTTOU + SIGNAME(SIGTTOU); +#endif +#ifdef SIGURG + SIGNAME(SIGURG); +#endif +#ifdef SIGXCPU + SIGNAME(SIGXCPU); +#endif +#ifdef SIGXFSZ + SIGNAME(SIGXFSZ); +#endif +#ifdef SIGVTALRM + SIGNAME(SIGVTALRM); +#endif +#ifdef SIGPROF + SIGNAME(SIGPROF); +#endif +#ifdef SIGWINCH + SIGNAME(SIGWINCH); +#endif +#ifdef SIGIO + SIGNAME(SIGIO); +#endif +#ifdef SIGPWR + SIGNAME(SIGPWR); +#endif +#ifdef SIGSYS + SIGNAME(SIGSYS); +#endif + default: +#if defined (HAVE_SNPRINTF) +#if defined (SIGRTMIN) && defined (SIGRTMAX) + if(signum() >= SIGRTMIN && signum() <= SIGRTMAX) { + snprintf(tmp, sizeof(tmp), "SIGRTMIN + %d", signum()); + return tmp; + } +#endif + snprintf(tmp, sizeof(tmp), "SIGNAL %d", signum()); + return tmp; +#else + return "Unknown signal"; +#endif + } + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/gr_local_sighandler.h b/gnuradio-runtime/lib/local_sighandler.h index a49ee031ca..bd322e5b00 100644 --- a/gnuradio-runtime/lib/gr_local_sighandler.h +++ b/gnuradio-runtime/lib/local_sighandler.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -27,39 +27,48 @@ #include <signal.h> #endif -#include <gr_runtime_api.h> +#include <gnuradio/api.h> #include <string> -/*! - * \brief Get and set signal handler. - * - * \ingroup internal - * Constructor installs new handler, destructor reinstalls - * original value. - */ -class GR_RUNTIME_API gr_local_sighandler { - int d_signum; +namespace gr { + + /*! + * \brief Get and set signal handler. + * + * \ingroup internal + * Constructor installs new handler, destructor reinstalls + * original value. + */ + class GR_RUNTIME_API local_sighandler + { + private: + int d_signum; #ifdef HAVE_SIGACTION - struct sigaction d_old_action; + struct sigaction d_old_action; #endif -public: - gr_local_sighandler (int signum, void (*new_handler)(int)); - ~gr_local_sighandler (); - /* throw gr_signal (signum) */ - static void throw_signal (int signum); -}; + public: + local_sighandler(int signum, void (*new_handler)(int)); + ~local_sighandler(); -/*! - * \brief Representation of signal. - */ -class GR_RUNTIME_API gr_signal -{ - int d_signum; -public: - gr_signal (int signum) : d_signum (signum) {} - int signal () const { return d_signum; } - std::string name () const; -}; + /* throw gr_signal (signum) */ + static void throw_signal(int signum); + }; + + /*! + * \brief Representation of signal. + */ + class GR_RUNTIME_API signal + { + private: + int d_signum; + + public: + signal(int signum) : d_signum(signum) {} + int signum() const { return d_signum; } + std::string name() const; + }; + +} /* namespace gr */ #endif /* INCLUDED_GR_LOCAL_SIGHANDLER_H */ diff --git a/gnuradio-runtime/lib/logger.cc b/gnuradio-runtime/lib/logger.cc new file mode 100644 index 0000000000..ce14abdd3f --- /dev/null +++ b/gnuradio-runtime/lib/logger.cc @@ -0,0 +1,323 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 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. + */ + +/******************************************************************************* +* Author: Mark Plett +* Description: +* The gr_log module wraps the log4cpp library for logging in gnuradio. +*******************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/logger.h> +#include <stdexcept> +#include <algorithm> + + +#ifdef ENABLE_GR_LOG +#ifdef HAVE_LOG4CPP + +namespace gr { + + bool logger_config::logger_configured(false); + + /************************ BEGIN LOG4CPP HELPERS ***********************/ + /* Logger config class. This is a singleton that controls how + * log4cpp is configured If watch_period>0 a thread is started to + * watch teh config file for changes. + */ + + // Getters of logger_config + logger_config& + logger_config::get_instance(void) + { + static logger_config instance; + return instance; + } + + std::string + logger_config::get_filename() + { + logger_config& in=get_instance(); + return in.filename; + } + + unsigned int + logger_config::get_watch_period() + { + logger_config& in=get_instance(); + return in.watch_period; + } + + // Method to watch config file for changes + void + logger_config::watch_file(std::string filename, unsigned int watch_period) + { + std::time_t last_write(boost::filesystem::last_write_time(filename)); + std::time_t current_time(0); + while(true) { + try { + current_time = boost::filesystem::last_write_time(filename); + if(current_time>last_write) { + //std::cout<<"GNURadio Reloading logger configuration:"<<filename<<std::endl; + last_write = current_time; + // Should we wipe out all old configuration or just add the + // new? Just adding... logger_reset_config(); + logger_configured = logger_load_config(filename); + } + boost::this_thread::sleep(boost::posix_time::time_duration(0,0,watch_period,0)); + } + catch(const boost::thread_interrupted&) { + std::cout<<"GNURadio leaving logger config file watch."<<std::endl; + break; + } + } + } + + // Method to load the confifuration. It only loads if the filename + // or watch has changed + void + logger_config::load_config(std::string filename,unsigned int watch_period) + { + logger_config& instance = get_instance(); + // Only reconfigure if filename or watch has changed + if(!logger_configured) { + instance.filename = filename; + instance.watch_period = watch_period; + // Stop any file watching thread + if(instance.watch_thread!=NULL) + stop_watch(); + // Load configuration + //std::cout<<"GNURadio Loading logger configuration:"<<instance.filename<<std::endl; + logger_configured = logger_load_config(instance.filename); + // Start watch if required + if(instance.watch_period>0) { + instance.watch_thread = new boost::thread(watch_file, instance.filename, + instance.watch_period); + } + } + } + + // Method to stop the watcher thread + void + logger_config::stop_watch() + { + logger_config& instance = get_instance(); + if(instance.watch_thread) { + instance.watch_thread->interrupt(); + instance.watch_thread->join(); + delete(instance.watch_thread); + instance.watch_thread=NULL; + } + } + + // Method to reset logger configuration + void + logger_config::reset_config(void) + { + logger_config& instance = get_instance(); + stop_watch(); + std::vector<log4cpp::Category*> *loggers = log4cpp::Category::getCurrentCategories(); + std::vector<log4cpp::Category*>::iterator logger = loggers->begin(); + // We can't destroy categories but we can neuter them by removing all appenders. + for(;logger!=loggers->end();logger++) { + (*logger)->removeAllAppenders(); + } + instance.filename = std::string(""); + instance.watch_period = 0; + logger_configured = false; + } + + /***************** Functions to call log4cpp methods *************************/ + + logger_ptr + logger_get_logger(std::string name) + { + if(log4cpp::Category::exists(name)) { + logger_ptr logger = &log4cpp::Category::getInstance(name); + return logger; + } + else { + logger_ptr logger = &log4cpp::Category::getInstance(name); + logger->setPriority(log4cpp::Priority::NOTSET); + return logger; + } + } + + bool + logger_load_config(const std::string &config_filename) + { + if(config_filename.size() != 0) { + try { + log4cpp::PropertyConfigurator::configure(config_filename); + return true; + } + catch(log4cpp::ConfigureFailure &e) { + std::cerr << "Logger config failed :" << e.what() << std::endl; + } + } + return false; + } + + void + logger_set_level(logger_ptr logger, const std::string &level) + { + std::string nocase = level; + std::transform(level.begin(), level.end(), nocase.begin(), ::tolower); + + if(nocase == "off" || nocase == "notset") + logger_set_level(logger, log4cpp::Priority::NOTSET); + else if(nocase == "all" || nocase == "debug") + logger_set_level(logger, log4cpp::Priority::DEBUG); + else if(nocase == "info") + logger_set_level(logger, log4cpp::Priority::INFO); + else if(nocase == "notice") + logger_set_level(logger, log4cpp::Priority::NOTICE); + else if(nocase == "warn") + logger_set_level(logger, log4cpp::Priority::WARN); + else if(nocase == "error") + logger_set_level(logger, log4cpp::Priority::ERROR); + else if(nocase == "crit") + logger_set_level(logger, log4cpp::Priority::CRIT); + else if(nocase == "alert") + logger_set_level(logger, log4cpp::Priority::ALERT); + else if(nocase=="fatal") + logger_set_level(logger, log4cpp::Priority::FATAL); + else if(nocase == "emerg") + logger_set_level(logger, log4cpp::Priority::EMERG); + else + throw std::runtime_error("logger_set_level: Bad level type.\n"); + } + + void + logger_set_level(logger_ptr logger, log4cpp::Priority::Value level) + { + logger->setPriority(level); + } + + void + logger_get_level(logger_ptr logger, std::string &level) + { + log4cpp::Priority::Value levelPtr = logger->getPriority(); + if(levelPtr == log4cpp::Priority::NOTSET) level = "noset"; + if(levelPtr == log4cpp::Priority::DEBUG) level = "debug"; + if(levelPtr == log4cpp::Priority::INFO) level = "info"; + if(levelPtr == log4cpp::Priority::NOTICE) level = "notice"; + if(levelPtr == log4cpp::Priority::WARN) level = "warn"; + if(levelPtr == log4cpp::Priority::ERROR) level = "error"; + if(levelPtr == log4cpp::Priority::CRIT) level = "crit"; + if(levelPtr == log4cpp::Priority::ALERT) level = "alert"; + if(levelPtr == log4cpp::Priority::FATAL) level = "fatal"; + if(levelPtr == log4cpp::Priority::EMERG) level = "emerg"; + } + + void + logger_get_level(logger_ptr logger,log4cpp::Priority::Value level) + { + level = logger->getPriority(); + } + + void + logger_add_console_appender(logger_ptr logger, std::string target, std::string pattern) + { + log4cpp::PatternLayout* layout = new log4cpp::PatternLayout(); + log4cpp::Appender* app; + if(target=="stdout") + app = new log4cpp::OstreamAppender("ConsoleAppender::",&std::cout); + else + app = new log4cpp::OstreamAppender("ConsoleAppender::",&std::cerr); + + layout->setConversionPattern(pattern); + app->setLayout(layout); + logger->setAppender(*app); + } + + void + logger_add_file_appender(logger_ptr logger, std::string filename, + bool append, std::string pattern) + { + log4cpp::PatternLayout* layout = new log4cpp::PatternLayout(); + log4cpp::Appender* app = new + log4cpp::FileAppender("FileAppender::"+filename, + filename); + layout->setConversionPattern(pattern); + app->setLayout(layout); + logger->setAppender(app); + } + + void + logger_add_rollingfile_appender(logger_ptr logger, std::string filename, + size_t filesize, int bkup_index, bool append, + mode_t mode, std::string pattern) + { + log4cpp::PatternLayout* layout = new log4cpp::PatternLayout(); + log4cpp::Appender* app = new + log4cpp::RollingFileAppender("RollFileAppender::" + filename, filename, + filesize, bkup_index, append, mode); + layout->setConversionPattern(pattern); + app->setLayout(layout); + logger->setAppender(app); + } + + std::vector<std::string> + logger_get_logger_names(void) + { + std::vector<std::string> names; + std::vector<log4cpp::Category*> *loggers = log4cpp::Category::getCurrentCategories(); + std::vector<log4cpp::Category*>::iterator logger = loggers->begin(); + + for(;logger!=loggers->end();logger++) { + names.push_back((*logger)->getName()); + } + return names; + } + +} /* namespace gr */ + +#endif /* HAVE_LOG4CPP */ + +/****** Start Methods to provide Python the capabilities of the macros ********/ +void +gr_logger_config(const std::string config_filename, unsigned int watch_period) +{ + GR_CONFIG_AND_WATCH_LOGGER(config_filename, watch_period); +} + +std::vector<std::string> +gr_logger_get_logger_names(void) +{ + std::vector<std::string> names; + GR_GET_LOGGER_NAMES(names); + return names; +} + +void +gr_logger_reset_config(void) +{ + GR_RESET_CONFIGURATION(); +} + +// Remaining capability provided by gr::logger class in gnuradio/logger.h + +#endif /* ENABLE_GR_LOGGER */ diff --git a/gnuradio-runtime/lib/malloc16.h b/gnuradio-runtime/lib/malloc16.h index 90d1eca77a..05f80cbf4f 100644 --- a/gnuradio-runtime/lib/malloc16.h +++ b/gnuradio-runtime/lib/malloc16.h @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_runtime_api.h> +#include <gnuradio/api.h> #ifdef __cplusplus extern "C" { diff --git a/gnuradio-runtime/lib/math/CMakeLists.txt b/gnuradio-runtime/lib/math/CMakeLists.txt new file mode 100644 index 0000000000..c95c84cecb --- /dev/null +++ b/gnuradio-runtime/lib/math/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright 2010,2013 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 +######################################################################## + +list(APPEND gnuradio_runtime_sources + ${CMAKE_CURRENT_SOURCE_DIR}/fast_atan2f.cc + ${CMAKE_CURRENT_SOURCE_DIR}/fxpt.cc + ${CMAKE_CURRENT_SOURCE_DIR}/random.cc + ${CMAKE_CURRENT_SOURCE_DIR}/sincos.cc +) diff --git a/gnuradio-runtime/lib/math/fast_atan2f.cc b/gnuradio-runtime/lib/math/fast_atan2f.cc new file mode 100644 index 0000000000..3555cf50ec --- /dev/null +++ b/gnuradio-runtime/lib/math/fast_atan2f.cc @@ -0,0 +1,202 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 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. + */ + +#include <gnuradio/math.h> // declaration is in here +#include <cmath> + +namespace gr { + + /***************************************************************************/ + /* Constant definitions */ + /***************************************************************************/ + + #define TAN_MAP_RES 0.003921569 /* (smallest non-zero value in table) */ + #define RAD_PER_DEG 0.017453293 + #define TAN_MAP_SIZE 256 + + /* arctangents from 0 to pi/4 radians */ + static float + fast_atan_table[257] = { + 0.000000e+00, 3.921549e-03, 7.842976e-03, 1.176416e-02, + 1.568499e-02, 1.960533e-02, 2.352507e-02, 2.744409e-02, + 3.136226e-02, 3.527947e-02, 3.919560e-02, 4.311053e-02, + 4.702413e-02, 5.093629e-02, 5.484690e-02, 5.875582e-02, + 6.266295e-02, 6.656816e-02, 7.047134e-02, 7.437238e-02, + 7.827114e-02, 8.216752e-02, 8.606141e-02, 8.995267e-02, + 9.384121e-02, 9.772691e-02, 1.016096e-01, 1.054893e-01, + 1.093658e-01, 1.132390e-01, 1.171087e-01, 1.209750e-01, + 1.248376e-01, 1.286965e-01, 1.325515e-01, 1.364026e-01, + 1.402496e-01, 1.440924e-01, 1.479310e-01, 1.517652e-01, + 1.555948e-01, 1.594199e-01, 1.632403e-01, 1.670559e-01, + 1.708665e-01, 1.746722e-01, 1.784728e-01, 1.822681e-01, + 1.860582e-01, 1.898428e-01, 1.936220e-01, 1.973956e-01, + 2.011634e-01, 2.049255e-01, 2.086818e-01, 2.124320e-01, + 2.161762e-01, 2.199143e-01, 2.236461e-01, 2.273716e-01, + 2.310907e-01, 2.348033e-01, 2.385093e-01, 2.422086e-01, + 2.459012e-01, 2.495869e-01, 2.532658e-01, 2.569376e-01, + 2.606024e-01, 2.642600e-01, 2.679104e-01, 2.715535e-01, + 2.751892e-01, 2.788175e-01, 2.824383e-01, 2.860514e-01, + 2.896569e-01, 2.932547e-01, 2.968447e-01, 3.004268e-01, + 3.040009e-01, 3.075671e-01, 3.111252e-01, 3.146752e-01, + 3.182170e-01, 3.217506e-01, 3.252758e-01, 3.287927e-01, + 3.323012e-01, 3.358012e-01, 3.392926e-01, 3.427755e-01, + 3.462497e-01, 3.497153e-01, 3.531721e-01, 3.566201e-01, + 3.600593e-01, 3.634896e-01, 3.669110e-01, 3.703234e-01, + 3.737268e-01, 3.771211e-01, 3.805064e-01, 3.838825e-01, + 3.872494e-01, 3.906070e-01, 3.939555e-01, 3.972946e-01, + 4.006244e-01, 4.039448e-01, 4.072558e-01, 4.105574e-01, + 4.138496e-01, 4.171322e-01, 4.204054e-01, 4.236689e-01, + 4.269229e-01, 4.301673e-01, 4.334021e-01, 4.366272e-01, + 4.398426e-01, 4.430483e-01, 4.462443e-01, 4.494306e-01, + 4.526070e-01, 4.557738e-01, 4.589307e-01, 4.620778e-01, + 4.652150e-01, 4.683424e-01, 4.714600e-01, 4.745676e-01, + 4.776654e-01, 4.807532e-01, 4.838312e-01, 4.868992e-01, + 4.899573e-01, 4.930055e-01, 4.960437e-01, 4.990719e-01, + 5.020902e-01, 5.050985e-01, 5.080968e-01, 5.110852e-01, + 5.140636e-01, 5.170320e-01, 5.199904e-01, 5.229388e-01, + 5.258772e-01, 5.288056e-01, 5.317241e-01, 5.346325e-01, + 5.375310e-01, 5.404195e-01, 5.432980e-01, 5.461666e-01, + 5.490251e-01, 5.518738e-01, 5.547124e-01, 5.575411e-01, + 5.603599e-01, 5.631687e-01, 5.659676e-01, 5.687566e-01, + 5.715357e-01, 5.743048e-01, 5.770641e-01, 5.798135e-01, + 5.825531e-01, 5.852828e-01, 5.880026e-01, 5.907126e-01, + 5.934128e-01, 5.961032e-01, 5.987839e-01, 6.014547e-01, + 6.041158e-01, 6.067672e-01, 6.094088e-01, 6.120407e-01, + 6.146630e-01, 6.172755e-01, 6.198784e-01, 6.224717e-01, + 6.250554e-01, 6.276294e-01, 6.301939e-01, 6.327488e-01, + 6.352942e-01, 6.378301e-01, 6.403565e-01, 6.428734e-01, + 6.453808e-01, 6.478788e-01, 6.503674e-01, 6.528466e-01, + 6.553165e-01, 6.577770e-01, 6.602282e-01, 6.626701e-01, + 6.651027e-01, 6.675261e-01, 6.699402e-01, 6.723452e-01, + 6.747409e-01, 6.771276e-01, 6.795051e-01, 6.818735e-01, + 6.842328e-01, 6.865831e-01, 6.889244e-01, 6.912567e-01, + 6.935800e-01, 6.958943e-01, 6.981998e-01, 7.004964e-01, + 7.027841e-01, 7.050630e-01, 7.073330e-01, 7.095943e-01, + 7.118469e-01, 7.140907e-01, 7.163258e-01, 7.185523e-01, + 7.207701e-01, 7.229794e-01, 7.251800e-01, 7.273721e-01, + 7.295557e-01, 7.317307e-01, 7.338974e-01, 7.360555e-01, + 7.382053e-01, 7.403467e-01, 7.424797e-01, 7.446045e-01, + 7.467209e-01, 7.488291e-01, 7.509291e-01, 7.530208e-01, + 7.551044e-01, 7.571798e-01, 7.592472e-01, 7.613064e-01, + 7.633576e-01, 7.654008e-01, 7.674360e-01, 7.694633e-01, + 7.714826e-01, 7.734940e-01, 7.754975e-01, 7.774932e-01, + 7.794811e-01, 7.814612e-01, 7.834335e-01, 7.853983e-01, + 7.853983e-01 + }; + + + /***************************************************************************** + Function: Arc tangent + + Syntax: angle = fast_atan2(y, x); + float y y component of input vector + float x x component of input vector + float angle angle of vector (x, y) in radians + + Description: This function calculates the angle of the vector (x,y) + based on a table lookup and linear interpolation. The table uses a + 256 point table covering -45 to +45 degrees and uses symetry to + determine the final angle value in the range of -180 to 180 + degrees. Note that this function uses the small angle approximation + for values close to zero. This routine calculates the arc tangent + with an average error of +/- 0.045 degrees. + *****************************************************************************/ + + float + fast_atan2f(float y, float x) + { + float x_abs, y_abs, z; + float alpha, angle, base_angle; + int index; + + /* don't divide by zero! */ // FIXME could get hosed with -0.0 + if((y == 0.0) && (x == 0.0)) + return 0.0; + + /* normalize to +/- 45 degree range */ + y_abs = fabsf(y); + x_abs = fabsf(x); + //z = (y_abs < x_abs ? y_abs / x_abs : x_abs / y_abs); + if(y_abs < x_abs) + z = y_abs / x_abs; + else + z = x_abs / y_abs; + + /* when ratio approaches the table resolution, the angle is */ + /* best approximated with the argument itself... */ + if(z < TAN_MAP_RES) + base_angle = z; + else { + /* find index and interpolation value */ + alpha = z * (float)TAN_MAP_SIZE - .5; + index = (int)alpha; + alpha -= (float)index; + /* determine base angle based on quadrant and */ + /* add or subtract table value from base angle based on quadrant */ + base_angle = fast_atan_table[index]; + base_angle += + (fast_atan_table[index + 1] - fast_atan_table[index]) * alpha; + } + + if(x_abs > y_abs) { /* -45 -> 45 or 135 -> 225 */ + if(x >= 0.0) { /* -45 -> 45 */ + if(y >= 0.0) + angle = base_angle; /* 0 -> 45, angle OK */ + else + angle = -base_angle; /* -45 -> 0, angle = -angle */ + } + else { /* 135 -> 180 or 180 -> -135 */ + angle = 3.14159265358979323846; + if(y >= 0.0) + angle -= base_angle; /* 135 -> 180, angle = 180 - angle */ + else + angle = base_angle - angle; /* 180 -> -135, angle = angle - 180 */ + } + } + else { /* 45 -> 135 or -135 -> -45 */ + if(y >= 0.0) { /* 45 -> 135 */ + angle = 1.57079632679489661923; + if(x >= 0.0) + angle -= base_angle; /* 45 -> 90, angle = 90 - angle */ + else + angle += base_angle; /* 90 -> 135, angle = 90 + angle */ + } + else { /* -135 -> -45 */ + angle = -1.57079632679489661923; + if(x >= 0.0) + angle += base_angle; /* -90 -> -45, angle = -90 + angle */ + else + angle -= base_angle; /* -135 -> -90, angle = -90 - angle */ + } + } + + #ifdef ZERO_TO_TWOPI + if (angle < 0) + return (angle + TWOPI); + else + return (angle); + #else + return (angle); + #endif + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/gr_fxpt.cc b/gnuradio-runtime/lib/math/fxpt.cc index 2ea8520e6b..23fdda1241 100644 --- a/gnuradio-runtime/lib/gr_fxpt.cc +++ b/gnuradio-runtime/lib/math/fxpt.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,12 +24,15 @@ #include "config.h" #endif -#include <gr_fxpt.h> +#include <gnuradio/fxpt.h> -const float gr_fxpt::s_sine_table[1 << NBITS][2] = { -#include "sine_table.h" -}; +namespace gr { -const float gr_fxpt::PI = 3.14159265358979323846; -const float gr_fxpt::TWO_TO_THE_31 = 2147483648.0; + const float fxpt::s_sine_table[1 << NBITS][2] = { + #include "sine_table.h" + }; + const float fxpt::PI = 3.14159265358979323846; + const float fxpt::TWO_TO_THE_31 = 2147483648.0; + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/gen_sine_table.py b/gnuradio-runtime/lib/math/gen_sine_table.py index d7d11eff11..d7d11eff11 100755 --- a/gnuradio-runtime/lib/gen_sine_table.py +++ b/gnuradio-runtime/lib/math/gen_sine_table.py diff --git a/gnuradio-runtime/lib/math/qa_fxpt.cc b/gnuradio-runtime/lib/math/qa_fxpt.cc new file mode 100644 index 0000000000..d368e7de82 --- /dev/null +++ b/gnuradio-runtime/lib/math/qa_fxpt.cc @@ -0,0 +1,102 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <qa_fxpt.h> +#include <gnuradio/fxpt.h> +#include <cppunit/TestAssert.h> +#include <iostream> +#include <stdio.h> +#include <unistd.h> +#include <math.h> + +static const float SIN_COS_TOLERANCE = 1e-5; + +void +qa_fxpt::t0() +{ + CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI/2, gr::fxpt::fixed_to_float(0x40000000), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, gr::fxpt::fixed_to_float(0x00000000), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(-M_PI, gr::fxpt::fixed_to_float(0x80000000), SIN_COS_TOLERANCE); + + if(0) { + /* + * These are disabled because of some precision issues. + * + * Different compilers seem to have different opinions on whether + * the calulations are done single or double (or extended) + * precision. Any of the answers are fine for our real purpose, but + * sometimes the answer is off by a few bits at the bottom. + * Hence, the disabled check. + */ + CPPUNIT_ASSERT_EQUAL((gr_int32)0x40000000, gr::fxpt::float_to_fixed(M_PI/2)); + CPPUNIT_ASSERT_EQUAL((gr_int32)0, gr::fxpt::float_to_fixed(0)); + CPPUNIT_ASSERT_EQUAL((gr_int32)0x80000000, gr::fxpt::float_to_fixed(-M_PI)); + } +} + +void +qa_fxpt::t1() +{ + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, gr::fxpt::sin(0x00000000), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.707106781, gr::fxpt::sin(0x20000000), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1, gr::fxpt::sin(0x40000000), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.707106781, gr::fxpt::sin(0x60000000), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, gr::fxpt::sin(0x7fffffff), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, gr::fxpt::sin(0x80000000), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, gr::fxpt::sin(0x80000001), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(-1, gr::fxpt::sin(-0x40000000), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.707106781, gr::fxpt::sin(-0x20000000), SIN_COS_TOLERANCE); + + for(float p = -M_PI; p < M_PI; p += 2 * M_PI / 3600) { + float expected = sin(p); + float actual = gr::fxpt::sin(gr::fxpt::float_to_fixed (p)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actual, SIN_COS_TOLERANCE); + } +} + +void +qa_fxpt::t2() +{ + for(float p = -M_PI; p < M_PI; p += 2 * M_PI / 3600) { + float expected = cos(p); + float actual = gr::fxpt::cos(gr::fxpt::float_to_fixed(p)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actual, SIN_COS_TOLERANCE); + } +} + +void +qa_fxpt::t3() +{ + for(float p = -M_PI; p < M_PI; p += 2 * M_PI / 3600) { + float expected_sin = sin(p); + float expected_cos = cos(p); + float actual_sin; + float actual_cos; + gr::fxpt::sincos(gr::fxpt::float_to_fixed (p), &actual_sin, &actual_cos); + CPPUNIT_ASSERT_DOUBLES_EQUAL(expected_sin, actual_sin, SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(expected_cos, actual_cos, SIN_COS_TOLERANCE); + } +} diff --git a/gnuradio-runtime/lib/qa_gr_fxpt.h b/gnuradio-runtime/lib/math/qa_fxpt.h index 72211563e7..58a6f02d1b 100644 --- a/gnuradio-runtime/lib/qa_gr_fxpt.h +++ b/gnuradio-runtime/lib/math/qa_fxpt.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,28 +19,27 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ + #ifndef INCLUDED_QA_GR_FXPT_H #define INCLUDED_QA_GR_FXPT_H - #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -class qa_gr_fxpt : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_fxpt); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); +class qa_fxpt : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(qa_fxpt); + CPPUNIT_TEST(t0); + CPPUNIT_TEST(t1); + CPPUNIT_TEST(t2); + CPPUNIT_TEST(t3); + CPPUNIT_TEST_SUITE_END(); private: - void t0 (); - void t1 (); - void t2 (); - void t3 (); - + void t0(); + void t1(); + void t2(); + void t3(); }; #endif /* INCLUDED_QA_GR_FXPT_H */ diff --git a/gnuradio-runtime/lib/qa_gr_fxpt_nco.cc b/gnuradio-runtime/lib/math/qa_fxpt_nco.cc index 6f208eac80..cf229d68be 100644 --- a/gnuradio-runtime/lib/qa_gr_fxpt_nco.cc +++ b/gnuradio-runtime/lib/math/qa_fxpt_nco.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,9 +23,10 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif -#include <qa_gr_fxpt_nco.h> -#include <gr_fxpt_nco.h> -#include <gr_nco.h> + +#include <qa_fxpt_nco.h> +#include <gnuradio/fxpt_nco.h> +#include <gnuradio/nco.h> #include <cppunit/TestAssert.h> #include <iostream> #include <stdio.h> @@ -45,59 +46,59 @@ static double max_d(double a, double b) } void -qa_gr_fxpt_nco::t0 () +qa_fxpt_nco::t0() { - gr_nco<float,float> ref_nco; - gr_fxpt_nco new_nco; + gr::nco<float,float> ref_nco; + gr::fxpt_nco new_nco; double max_error = 0, max_phase_error = 0; - ref_nco.set_freq ((float)(2 * M_PI / SIN_COS_FREQ)); - new_nco.set_freq ((float)(2 * M_PI / SIN_COS_FREQ)); + ref_nco.set_freq((float)(2 * M_PI / SIN_COS_FREQ)); + new_nco.set_freq((float)(2 * M_PI / SIN_COS_FREQ)); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_nco.get_freq(), new_nco.get_freq(), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(ref_nco.get_freq(), new_nco.get_freq(), SIN_COS_TOLERANCE); - for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){ - float ref_sin = ref_nco.sin (); - float new_sin = new_nco.sin (); + for(int i = 0; i < SIN_COS_BLOCK_SIZE; i++) { + float ref_sin = ref_nco.sin(); + float new_sin = new_nco.sin(); //printf ("i = %6d\n", i); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_sin, new_sin, SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(ref_sin, new_sin, SIN_COS_TOLERANCE); - max_error = max_d (max_error, ref_sin-new_sin); + max_error = max_d(max_error, ref_sin-new_sin); - float ref_cos = ref_nco.cos (); - float new_cos = new_nco.cos (); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_cos, new_cos, SIN_COS_TOLERANCE); + float ref_cos = ref_nco.cos(); + float new_cos = new_nco.cos(); + CPPUNIT_ASSERT_DOUBLES_EQUAL(ref_cos, new_cos, SIN_COS_TOLERANCE); - max_error = max_d (max_error, ref_cos-new_cos); + max_error = max_d(max_error, ref_cos-new_cos); - ref_nco.step (); - new_nco.step (); + ref_nco.step(); + new_nco.step(); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_nco.get_phase(), new_nco.get_phase(), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(ref_nco.get_phase(), new_nco.get_phase(), SIN_COS_TOLERANCE); - max_phase_error = max_d (max_phase_error, ref_nco.get_phase()-new_nco.get_phase()); + max_phase_error = max_d(max_phase_error, ref_nco.get_phase()-new_nco.get_phase()); } // printf ("Fxpt max error %.9f, max phase error %.9f\n", max_error, max_phase_error); } void -qa_gr_fxpt_nco::t1 () +qa_fxpt_nco::t1() { - gr_nco<float,float> ref_nco; - gr_fxpt_nco new_nco; + gr::nco<float,float> ref_nco; + gr::fxpt_nco new_nco; gr_complex ref_block[SIN_COS_BLOCK_SIZE]; gr_complex new_block[SIN_COS_BLOCK_SIZE]; double max_error = 0; - ref_nco.set_freq ((float)(2 * M_PI / SIN_COS_FREQ)); - new_nco.set_freq ((float)(2 * M_PI / SIN_COS_FREQ)); + ref_nco.set_freq((float)(2 * M_PI / SIN_COS_FREQ)); + new_nco.set_freq((float)(2 * M_PI / SIN_COS_FREQ)); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_nco.get_freq(), new_nco.get_freq(), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(ref_nco.get_freq(), new_nco.get_freq(), SIN_COS_TOLERANCE); - ref_nco.sincos ((gr_complex*)ref_block, SIN_COS_BLOCK_SIZE); - new_nco.sincos ((gr_complex*)new_block, SIN_COS_BLOCK_SIZE); + ref_nco.sincos((gr_complex*)ref_block, SIN_COS_BLOCK_SIZE); + new_nco.sincos((gr_complex*)new_block, SIN_COS_BLOCK_SIZE); - for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){ + for(int i = 0; i < SIN_COS_BLOCK_SIZE; i++) { CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_block[i].real(), new_block[i].real(), SIN_COS_TOLERANCE); max_error = max_d (max_error, ref_block[i].real()-new_block[i].real()); @@ -109,11 +110,11 @@ qa_gr_fxpt_nco::t1 () } void -qa_gr_fxpt_nco::t2 () +qa_fxpt_nco::t2() { } void -qa_gr_fxpt_nco::t3 () +qa_fxpt_nco::t3() { } diff --git a/gnuradio-runtime/lib/qa_gr_fxpt_nco.h b/gnuradio-runtime/lib/math/qa_fxpt_nco.h index 8998922bbb..1b2cdaede6 100644 --- a/gnuradio-runtime/lib/qa_gr_fxpt_nco.h +++ b/gnuradio-runtime/lib/math/qa_fxpt_nco.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,28 +19,27 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ + #ifndef INCLUDED_QA_GR_FXPT_NCO_H #define INCLUDED_QA_GR_FXPT_NCO_H - #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -class qa_gr_fxpt_nco : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_fxpt_nco); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void t0 (); - void t1 (); - void t2 (); - void t3 (); - +class qa_fxpt_nco : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(qa_fxpt_nco); + CPPUNIT_TEST(t0); + CPPUNIT_TEST(t1); + CPPUNIT_TEST(t2); + CPPUNIT_TEST(t3); + CPPUNIT_TEST_SUITE_END(); + +private: + void t0(); + void t1(); + void t2(); + void t3(); }; #endif /* INCLUDED_QA_GR_FXPT_NCO_H */ diff --git a/gnuradio-runtime/lib/qa_gr_fxpt_vco.cc b/gnuradio-runtime/lib/math/qa_fxpt_vco.cc index 5b6993a30c..ee9865e926 100644 --- a/gnuradio-runtime/lib/qa_gr_fxpt_vco.cc +++ b/gnuradio-runtime/lib/math/qa_fxpt_vco.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2005 Free Software Foundation, Inc. + * Copyright 2004,2005,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,9 +23,10 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif -#include <qa_gr_fxpt_vco.h> -#include <gr_fxpt_vco.h> -#include <gr_vco.h> + +#include <qa_fxpt_vco.h> +#include <gnuradio/fxpt_vco.h> +#include <vco.h> #include <cppunit/TestAssert.h> #include <iostream> #include <stdio.h> @@ -45,66 +46,65 @@ static double max_d(double a, double b) } void -qa_gr_fxpt_vco::t0 () +qa_fxpt_vco::t0() { - gr_vco<float,float> ref_vco; - gr_fxpt_vco new_vco; + gr::vco<float,float> ref_vco; + gr::fxpt_vco new_vco; double max_error = 0, max_phase_error = 0; float input[SIN_COS_BLOCK_SIZE]; - for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){ - input[i] = sin(double(i)); + for(int i = 0; i < SIN_COS_BLOCK_SIZE; i++) { + input[i] = sin(double(i)); } - for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){ - float ref_cos = ref_vco.cos (); - float new_cos = new_vco.cos (); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_cos, new_cos, SIN_COS_TOLERANCE); + for(int i = 0; i < SIN_COS_BLOCK_SIZE; i++) { + float ref_cos = ref_vco.cos(); + float new_cos = new_vco.cos(); + CPPUNIT_ASSERT_DOUBLES_EQUAL(ref_cos, new_cos, SIN_COS_TOLERANCE); - max_error = max_d (max_error, ref_cos-new_cos); + max_error = max_d(max_error, ref_cos-new_cos); - ref_vco.adjust_phase (input[i]); - new_vco.adjust_phase (input[i]); + ref_vco.adjust_phase(input[i]); + new_vco.adjust_phase(input[i]); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_vco.get_phase(), new_vco.get_phase(), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(ref_vco.get_phase(), new_vco.get_phase(), SIN_COS_TOLERANCE); - max_phase_error = max_d (max_phase_error, ref_vco.get_phase()-new_vco.get_phase()); + max_phase_error = max_d(max_phase_error, ref_vco.get_phase()-new_vco.get_phase()); } // printf ("Fxpt max error %.9f, max phase error %.9f\n", max_error, max_phase_error); } - void -qa_gr_fxpt_vco::t1 () +qa_fxpt_vco::t1() { - gr_vco<float,float> ref_vco; - gr_fxpt_vco new_vco; + gr::vco<float,float> ref_vco; + gr::fxpt_vco new_vco; float ref_block[SIN_COS_BLOCK_SIZE]; float new_block[SIN_COS_BLOCK_SIZE]; float input[SIN_COS_BLOCK_SIZE]; double max_error = 0; - for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){ - input[i] = sin(double(i)); + for(int i = 0; i < SIN_COS_BLOCK_SIZE; i++) { + input[i] = sin(double(i)); } - ref_vco.cos (ref_block, input, SIN_COS_BLOCK_SIZE, SIN_COS_K, SIN_COS_AMPL); - new_vco.cos (new_block, input, SIN_COS_BLOCK_SIZE, SIN_COS_K, SIN_COS_AMPL); + ref_vco.cos(ref_block, input, SIN_COS_BLOCK_SIZE, SIN_COS_K, SIN_COS_AMPL); + new_vco.cos(new_block, input, SIN_COS_BLOCK_SIZE, SIN_COS_K, SIN_COS_AMPL); - for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){ - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_block[i], new_block[i], SIN_COS_TOLERANCE); - max_error = max_d (max_error, ref_block[i]-new_block[i]); + for(int i = 0; i < SIN_COS_BLOCK_SIZE; i++) { + CPPUNIT_ASSERT_DOUBLES_EQUAL(ref_block[i], new_block[i], SIN_COS_TOLERANCE); + max_error = max_d(max_error, ref_block[i]-new_block[i]); } - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_vco.get_phase(), new_vco.get_phase(), SIN_COS_TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(ref_vco.get_phase(), new_vco.get_phase(), SIN_COS_TOLERANCE); // printf ("Fxpt max error %.9f, max phase error %.9f\n", max_error, ref_vco.get_phase()-new_vco.get_phase()); } void -qa_gr_fxpt_vco::t2 () +qa_fxpt_vco::t2() { } void -qa_gr_fxpt_vco::t3 () +qa_fxpt_vco::t3() { } diff --git a/gnuradio-runtime/lib/qa_gr_fxpt_vco.h b/gnuradio-runtime/lib/math/qa_fxpt_vco.h index fab8022e36..72693f32e2 100644 --- a/gnuradio-runtime/lib/qa_gr_fxpt_vco.h +++ b/gnuradio-runtime/lib/math/qa_fxpt_vco.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2005 Free Software Foundation, Inc. + * Copyright 2004,2005,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,28 +19,27 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ + #ifndef INCLUDED_QA_GR_FXPT_VCO_H #define INCLUDED_QA_GR_FXPT_VCO_H - #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -class qa_gr_fxpt_vco : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_fxpt_vco); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void t0 (); - void t1 (); - void t2 (); - void t3 (); - +class qa_fxpt_vco : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(qa_fxpt_vco); + CPPUNIT_TEST(t0); + CPPUNIT_TEST(t1); + CPPUNIT_TEST(t2); + CPPUNIT_TEST(t3); + CPPUNIT_TEST_SUITE_END(); + +private: + void t0(); + void t1(); + void t2(); + void t3(); }; #endif /* INCLUDED_QA_GR_FXPT_VCO_H */ diff --git a/gnuradio-runtime/lib/qa_gr_math.cc b/gnuradio-runtime/lib/math/qa_math.cc index 74d51b536e..1fb43cc67f 100644 --- a/gnuradio-runtime/lib/qa_gr_math.cc +++ b/gnuradio-runtime/lib/math/qa_math.cc @@ -19,21 +19,21 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_math.h> -#include <qa_gr_math.h> +#include <gnuradio/math.h> +#include <qa_math.h> #include <cppunit/TestAssert.h> #include <stdio.h> void -qa_gr_math::test_binary_slicer1 () +qa_math::test_binary_slicer1() { float x[5] = {-1, -0.5, 0, 0.5, 1.0}; unsigned int z[5] = {0, 0, 1, 1, 1}; unsigned int y; //printf("\nBinary\n"); - for (unsigned int i = 0; i < 5; i++) { - y = gr_binary_slicer(x[i]); + for(unsigned int i = 0; i < 5; i++) { + y = gr::binary_slicer(x[i]); //printf("in: %f out: %d desired: %d\n", x[i], y, z[i]); CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9); @@ -41,7 +41,7 @@ qa_gr_math::test_binary_slicer1 () //printf("\nBranchless Binary\n"); for (unsigned int i = 0; i < 5; i++) { - y = gr_branchless_binary_slicer(x[i]); + y = gr::branchless_binary_slicer(x[i]); //printf("in: %f out: %d desired: %d\n", x[i], y, z[i]); CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9); @@ -49,7 +49,7 @@ qa_gr_math::test_binary_slicer1 () } void -qa_gr_math::test_quad_0deg_slicer1 () +qa_math::test_quad_0deg_slicer1() { gr_complex x[4] = {gr_complex(1, 0), gr_complex(0, 1), @@ -61,7 +61,7 @@ qa_gr_math::test_quad_0deg_slicer1 () //printf("\nQuad0\n"); for (unsigned int i = 0; i < 4; i++) { - y = gr_quad_0deg_slicer(x[i]); + y = gr::quad_0deg_slicer(x[i]); //printf("in: %.4f+j%.4f out: %d desired: %d\n", x[i].real(), x[i].imag(), y, z[i]); CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9); @@ -69,7 +69,7 @@ qa_gr_math::test_quad_0deg_slicer1 () //printf("\nBranchless Quad0\n"); for (unsigned int i = 0; i < 4; i++) { - y = gr_branchless_quad_0deg_slicer(x[i]); + y = gr::branchless_quad_0deg_slicer(x[i]); //printf("in: %.4f+j%.4f out: %d desired: %d\n", x[i].real(), x[i].imag(), y, z[i]); CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9); @@ -77,7 +77,7 @@ qa_gr_math::test_quad_0deg_slicer1 () } void -qa_gr_math::test_quad_45deg_slicer1 () +qa_math::test_quad_45deg_slicer1() { gr_complex x[4] = {gr_complex(0.707, 0.707), gr_complex(-0.707, 0.707), @@ -89,7 +89,7 @@ qa_gr_math::test_quad_45deg_slicer1 () //printf("\nQuad45\n"); for (unsigned int i = 0; i < 4; i++) { - y = gr_quad_45deg_slicer(x[i]); + y = gr::quad_45deg_slicer(x[i]); //printf("in: %.4f+j%.4f out: %d desired: %d\n", x[i].real(), x[i].imag(), y, z[i]); CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9); @@ -97,7 +97,7 @@ qa_gr_math::test_quad_45deg_slicer1 () //printf("\nBranchless Quad45\n"); for (unsigned int i = 0; i < 4; i++) { - y = gr_branchless_quad_45deg_slicer(x[i]); + y = gr::branchless_quad_45deg_slicer(x[i]); //printf("in: %.4f+j%.4f out: %d desired: %d\n", x[i].real(), x[i].imag(), y, z[i]); CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9); diff --git a/gnuradio-runtime/lib/qa_gr_math.h b/gnuradio-runtime/lib/math/qa_math.h index 86858c03d5..3621283b37 100644 --- a/gnuradio-runtime/lib/qa_gr_math.h +++ b/gnuradio-runtime/lib/math/qa_math.h @@ -25,9 +25,9 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -class qa_gr_math : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE(qa_gr_math); +class qa_math : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(qa_math); CPPUNIT_TEST(test_binary_slicer1); CPPUNIT_TEST(test_quad_0deg_slicer1); CPPUNIT_TEST(test_quad_45deg_slicer1); diff --git a/gnuradio-runtime/lib/qa_sincos.cc b/gnuradio-runtime/lib/math/qa_sincos.cc index be163117de..7def8a9bb8 100644 --- a/gnuradio-runtime/lib/qa_sincos.cc +++ b/gnuradio-runtime/lib/math/qa_sincos.cc @@ -25,8 +25,7 @@ #endif #include <qa_sincos.h> -#include <gr_sincos.h> -#include <attributes.h> +#include <gnuradio/sincos.h> #include <cppunit/TestAssert.h> #include <cmath> @@ -42,7 +41,7 @@ qa_sincos::t1() c_sin = sin(x); c_cos = cos(x); - gr_sincos(x, &gr_sin, &gr_cos); + gr::sincos(x, &gr_sin, &gr_cos); CPPUNIT_ASSERT_DOUBLES_EQUAL(c_sin, gr_sin, 0.0001); CPPUNIT_ASSERT_DOUBLES_EQUAL(c_cos, gr_cos, 0.0001); @@ -61,7 +60,7 @@ qa_sincos::t2() c_sin = sinf(x); c_cos = cosf(x); - gr_sincosf(x, &gr_sin, &gr_cos); + gr::sincosf(x, &gr_sin, &gr_cos); CPPUNIT_ASSERT_DOUBLES_EQUAL(c_sin, gr_sin, 0.0001); CPPUNIT_ASSERT_DOUBLES_EQUAL(c_cos, gr_cos, 0.0001); diff --git a/gnuradio-runtime/lib/qa_sincos.h b/gnuradio-runtime/lib/math/qa_sincos.h index c54b75f97f..c54b75f97f 100644 --- a/gnuradio-runtime/lib/qa_sincos.h +++ b/gnuradio-runtime/lib/math/qa_sincos.h diff --git a/gnuradio-runtime/lib/math/random.cc b/gnuradio-runtime/lib/math/random.cc new file mode 100644 index 0000000000..7170f27edf --- /dev/null +++ b/gnuradio-runtime/lib/math/random.cc @@ -0,0 +1,188 @@ +/* -*- c++ -*- */ +/* + * Copyright 2002 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. + */ + +/* + * Copyright 1997 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <math.h> +#include <gnuradio/random.h> + +namespace gr { + +#define IA 16807 +#define IM 2147483647 +#define AM (1.0/IM) +#define IQ 127773 +#define IR 2836 +#define NDIV (1+(IM-1)/NTAB) +#define EPS 1.2e-7 +#define RNMX (1.0-EPS) + + random::random(long seed) + { + reseed(seed); + } + + void + random::reseed(long seed) + { + d_seed = seed; + d_iy = 0; + for(int i = 0; i < NTAB; i++) + d_iv[i] = 0; + d_iset = 0; + d_gset = 0; + } + + /* + * This looks like it returns a uniform random deviate between 0.0 and 1.0 + * It looks similar to code from "Numerical Recipes in C". + */ + float + random::ran1() + { + int j; + long k; + float temp; + + if(d_seed <= 0 || !d_iy) { + if(-d_seed < 1) + d_seed=1; + else + d_seed = -d_seed; + for(j=NTAB+7;j>=0;j--) { + k=d_seed/IQ; + d_seed=IA*(d_seed-k*IQ)-IR*k; + if(d_seed < 0) + d_seed += IM; + if(j < NTAB) + d_iv[j] = d_seed; + } + d_iy=d_iv[0]; + } + k=(d_seed)/IQ; + d_seed=IA*(d_seed-k*IQ)-IR*k; + if(d_seed < 0) + d_seed += IM; + j=d_iy/NDIV; + d_iy=d_iv[j]; + d_iv[j] = d_seed; + temp=AM * d_iy; + if(temp > RNMX) + temp = RNMX; + return temp; + } + + /* + * Returns a normally distributed deviate with zero mean and variance 1. + * Also looks like it's from "Numerical Recipes in C". + */ + float + random::gasdev() + { + float fac,rsq,v1,v2; + d_iset = 1 - d_iset; + if(d_iset) { + do { + v1=2.0*ran1()-1.0; + v2=2.0*ran1()-1.0; + rsq=v1*v1+v2*v2; + } while(rsq >= 1.0 || rsq == 0.0); + fac= sqrt(-2.0*log(rsq)/rsq); + d_gset=v1*fac; + return v2*fac; + } + return d_gset; + } + + /* + * Copied from The KC7WW / OH2BNS Channel Simulator + * FIXME Need to check how good this is at some point + */ + float + random::laplacian() + { + float z = ran1(); + if(z < 0.5) + return log(2.0 * z) / M_SQRT2; + else + return -log(2.0 * (1.0 - z)) / M_SQRT2; + } + + /* + * Copied from The KC7WW / OH2BNS Channel Simulator + * FIXME Need to check how good this is at some point + */ + // 5 => scratchy, 8 => Geiger + float + random::impulse(float factor = 5) + { + float z = -M_SQRT2 * log(ran1()); + if(fabsf(z) <= factor) + return 0.0; + else + return z; + } + + /* + * Complex rayleigh is really gaussian I and gaussian Q + * It can also be generated by real rayleigh magnitude and + * uniform random angle + * Adapted from The KC7WW / OH2BNS Channel Simulator + * FIXME Need to check how good this is at some point + */ + gr_complex + random::rayleigh_complex() + { + return gr_complex(gasdev(),gasdev()); + } + + /* Other option + mag = rayleigh(); + ang = 2.0 * M_PI * RNG(); + *Rx = rxx * cos(z); + *Iy = rxx * sin(z); + */ + + float + random::rayleigh() + { + return sqrt(-2.0 * log(ran1())); + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/gr_sincos.c b/gnuradio-runtime/lib/math/sincos.cc index a8d01b0da4..49a90d2128 100644 --- a/gnuradio-runtime/lib/gr_sincos.c +++ b/gnuradio-runtime/lib/math/sincos.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2010 Free Software Foundation, Inc. + * Copyright 2004,2010,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -28,56 +28,58 @@ #define _GNU_SOURCE // ask for GNU extensions if available #endif -#include <gr_sincos.h> +#include <gnuradio/sincos.h> #include <math.h> -// ---------------------------------------------------------------- +namespace gr { #if defined (HAVE_SINCOS) -void -gr_sincos (double x, double *sinx, double *cosx) -{ - sincos (x, sinx, cosx); -} + void + sincos(double x, double *sinx, double *cosx) + { + ::sincos(x, sinx, cosx); + } #else -void -gr_sincos (double x, double *sinx, double *cosx) -{ - *sinx = sin (x); - *cosx = cos (x); -} + void + sincos(double x, double *sinx, double *cosx) + { + *sinx = ::sin(x); + *cosx = ::cos(x); + } #endif -// ---------------------------------------------------------------- + // ---------------------------------------------------------------- #if defined (HAVE_SINCOSF) -void -gr_sincosf (float x, float *sinx, float *cosx) -{ - sincosf (x, sinx, cosx); -} + void + sincosf(float x, float *sinx, float *cosx) + { + ::sincosf(x, sinx, cosx); + } #elif defined (HAVE_SINF) && defined (HAVE_COSF) -void -gr_sincosf (float x, float *sinx, float *cosx) -{ - *sinx = sinf (x); - *cosx = cosf (x); -} + void + sincosf(float x, float *sinx, float *cosx) + { + *sinx = ::sinf(x); + *cosx = ::cosf(x); + } #else -void -gr_sincosf (float x, float *sinx, float *cosx) -{ - *sinx = sin (x); - *cosx = cos (x); -} + void + sincosf(float x, float *sinx, float *cosx) + { + *sinx = ::sin(x); + *cosx = ::cos(x); + } #endif + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/sine_table.h b/gnuradio-runtime/lib/math/sine_table.h index 69834943bc..69834943bc 100644 --- a/gnuradio-runtime/lib/sine_table.h +++ b/gnuradio-runtime/lib/math/sine_table.h diff --git a/gnuradio-runtime/lib/math/vco.h b/gnuradio-runtime/lib/math/vco.h new file mode 100644 index 0000000000..fa11732c1f --- /dev/null +++ b/gnuradio-runtime/lib/math/vco.h @@ -0,0 +1,99 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 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. + */ + +#ifndef _GR_VCO_H_ +#define _GR_VCO_H_ + +#include <gnuradio/sincos.h> +#include <gnuradio/gr_complex.h> +#include <vector> +#include <cmath> + +namespace gr { + + /*! + * \brief base class template for Voltage Controlled Oscillator (VCO) + * \ingroup misc + */ + template<class o_type, class i_type> + class vco + { + public: + vco() : d_phase(0) {} + + virtual ~vco() {} + + // radians + void set_phase(double angle) { + d_phase = angle; + } + + void adjust_phase(double delta_phase) { + d_phase += delta_phase; + if(fabs (d_phase) > M_PI){ + + while(d_phase > M_PI) + d_phase -= 2*M_PI; + + while(d_phase < -M_PI) + d_phase += 2*M_PI; + } + } + + double get_phase() const { return d_phase; } + + // compute sin and cos for current phase angle + void sincos(float *sinx, float *cosx) const; + + // compute cos or sin for current phase angle + float cos() const { return std::cos(d_phase); } + float sin() const { return std::sin(d_phase); } + + // compute a block at a time + void cos(float *output, const float *input, + int noutput_items, double k, double ampl = 1.0); + + protected: + double d_phase; + }; + + template<class o_type, class i_type> + void + vco<o_type,i_type>::sincos(float *sinx, float *cosx) const + { + gr::sincosf(d_phase, sinx, cosx); + } + + template<class o_type, class i_type> + void + vco<o_type,i_type>::cos(float *output, const float *input, + int noutput_items, double k, double ampl) + { + for(int i = 0; i < noutput_items; i++) { + output[i] = cos() * ampl; + adjust_phase(input[i] * k); + } + } + +} /* namespace gr */ + +#endif /* _GR_VCO_H_ */ diff --git a/gnuradio-runtime/lib/message.cc b/gnuradio-runtime/lib/message.cc new file mode 100644 index 0000000000..ac066d668e --- /dev/null +++ b/gnuradio-runtime/lib/message.cc @@ -0,0 +1,82 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/message.h> +#include <assert.h> +#include <string.h> + +namespace gr { + + static long s_ncurrently_allocated = 0; + + message::sptr + message::make(long type, double arg1, double arg2, size_t length) + { + return message::sptr(new message(type, arg1, arg2, length)); + } + + message::sptr + message::make_from_string(const std::string s, long type, double arg1, double arg2) + { + message::sptr m = message::make(type, arg1, arg2, s.size()); + memcpy(m->msg(), s.data(), s.size()); + return m; + } + + message::message(long type, double arg1, double arg2, size_t length) + : d_type(type), d_arg1(arg1), d_arg2(arg2) + { + if(length == 0) + d_buf_start = d_msg_start = d_msg_end = d_buf_end = 0; + else { + d_buf_start = new unsigned char[length]; + d_msg_start = d_buf_start; + d_msg_end = d_buf_end = d_buf_start + length; + } + s_ncurrently_allocated++; + } + + message::~message() + { + assert (d_next == 0); + delete [] d_buf_start; + d_msg_start = d_msg_end = d_buf_end = 0; + s_ncurrently_allocated--; + } + + std::string + message::to_string() const + { + return std::string((char *)d_msg_start, length()); + } + + long + message_ncurrently_allocated() + { + return s_ncurrently_allocated; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/messages/msg_accepter.cc b/gnuradio-runtime/lib/messages/msg_accepter.cc index a0d2d840c6..cc86a6ff8a 100644 --- a/gnuradio-runtime/lib/messages/msg_accepter.cc +++ b/gnuradio-runtime/lib/messages/msg_accepter.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <messages/msg_accepter.h> +#include <gnuradio/messages/msg_accepter.h> namespace gr { namespace messages { diff --git a/gnuradio-runtime/lib/messages/msg_accepter_msgq.cc b/gnuradio-runtime/lib/messages/msg_accepter_msgq.cc index adbea5ebc6..7ee6ea02c1 100644 --- a/gnuradio-runtime/lib/messages/msg_accepter_msgq.cc +++ b/gnuradio-runtime/lib/messages/msg_accepter_msgq.cc @@ -23,9 +23,7 @@ #include <config.h> #endif -#include <messages/msg_accepter_msgq.h> - -using namespace pmt; +#include <gnuradio/messages/msg_accepter_msgq.h> namespace gr { namespace messages { @@ -41,7 +39,7 @@ namespace gr { } void - msg_accepter_msgq::post(pmt_t msg) + msg_accepter_msgq::post(pmt::pmt_t msg) { d_msg_queue->insert_tail(msg); } diff --git a/gnuradio-runtime/lib/messages/msg_producer.cc b/gnuradio-runtime/lib/messages/msg_producer.cc index c354422aa6..3f56bc6637 100644 --- a/gnuradio-runtime/lib/messages/msg_producer.cc +++ b/gnuradio-runtime/lib/messages/msg_producer.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <messages/msg_producer.h> +#include <gnuradio/messages/msg_producer.h> namespace gr { namespace messages { diff --git a/gnuradio-runtime/lib/messages/msg_queue.cc b/gnuradio-runtime/lib/messages/msg_queue.cc index 0d460dc05c..6db2d2daa2 100644 --- a/gnuradio-runtime/lib/messages/msg_queue.cc +++ b/gnuradio-runtime/lib/messages/msg_queue.cc @@ -24,11 +24,9 @@ #include "config.h" #endif -#include <messages/msg_queue.h> +#include <gnuradio/messages/msg_queue.h> #include <stdexcept> -using namespace pmt; - namespace gr { namespace messages { @@ -49,7 +47,7 @@ namespace gr { } void - msg_queue::insert_tail(pmt_t msg) + msg_queue::insert_tail(pmt::pmt_t msg) { gr::thread::scoped_lock guard(d_mutex); @@ -60,7 +58,7 @@ namespace gr { d_not_empty.notify_one(); } - pmt_t + pmt::pmt_t msg_queue::delete_head() { gr::thread::scoped_lock guard(d_mutex); @@ -68,7 +66,7 @@ namespace gr { while(empty_p()) d_not_empty.wait(guard); - pmt_t m(d_msgs.front()); + pmt::pmt_t m(d_msgs.front()); d_msgs.pop_front(); if(d_limit > 0) // Unlimited length queues never block on write @@ -77,15 +75,15 @@ namespace gr { return m; } - pmt_t + pmt::pmt_t msg_queue::delete_head_nowait() { gr::thread::scoped_lock guard(d_mutex); if(empty_p()) - return pmt_t(); + return pmt::pmt_t(); - pmt_t m(d_msgs.front()); + pmt::pmt_t m(d_msgs.front()); d_msgs.pop_front(); if(d_limit > 0) // Unlimited length queues never block on write @@ -97,7 +95,7 @@ namespace gr { void msg_queue::flush() { - while(delete_head_nowait() != pmt_t()) + while(delete_head_nowait() != pmt::pmt_t()) ; } diff --git a/gnuradio-runtime/lib/gr_reverse.cc b/gnuradio-runtime/lib/misc.cc index 08c588cb55..f9ad6ca89c 100644 --- a/gnuradio-runtime/lib/gr_reverse.cc +++ b/gnuradio-runtime/lib/misc.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,37 +24,47 @@ #include "config.h" #endif -#include <gr_reverse.h> +#include "misc.h" +namespace gr { -std::vector<float> -gr_reverse (const std::vector<float> &taps) -{ - int size = taps.size (); - std::vector<float> new_taps(size); + unsigned int + rounduppow2(unsigned int n) + { + int i; + for(i=0;((n-1)>>i) != 0;i++) + ; + return 1<<i; + } - if (size == 0) - return new_taps; + // ---------------------------------------------------------------- - for (int i = 0; i < size; i++) - new_taps[i] = taps[size - i - 1]; + void + zero_vector(std::vector<float> &v) + { + for(unsigned int i=0; i < v.size(); i++) + v[i] = 0; + } - return new_taps; -} + void + zero_vector(std::vector<double> &v) + { + for(unsigned int i=0; i < v.size(); i++) + v[i] = 0; + } + void + zero_vector(std::vector<int> &v) + { + for(unsigned int i=0; i < v.size(); i++) + v[i] = 0; + } -std::vector<gr_complex> -gr_reverse (const std::vector<gr_complex> &taps) -{ - int size = taps.size (); - std::vector<gr_complex> new_taps(size); - - if (size == 0) - return new_taps; - - for (int i = 0; i < size; i++) - new_taps[i] = taps[size - i - 1]; - - return new_taps; -} + void + zero_vector(std::vector<gr_complex> &v) + { + for(unsigned int i=0; i < v.size(); i++) + v[i] = 0; + } +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/gr_misc.h b/gnuradio-runtime/lib/misc.h index 182ae87de6..833b6470a5 100644 --- a/gnuradio-runtime/lib/gr_misc.h +++ b/gnuradio-runtime/lib/misc.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,17 +23,20 @@ #ifndef INCLUDED_GR_MISC_H #define INCLUDED_GR_MISC_H -#include <gr_runtime_api.h> -#include <gr_types.h> +#include <gnuradio/api.h> +#include <gnuradio/types.h> -GR_RUNTIME_API unsigned int -gr_rounduppow2(unsigned int n); +namespace gr { -// FIXME should be template -GR_RUNTIME_API void gr_zero_vector(std::vector<float> &v); -GR_RUNTIME_API void gr_zero_vector(std::vector<double> &v); -GR_RUNTIME_API void gr_zero_vector(std::vector<int> &v); -GR_RUNTIME_API void gr_zero_vector(std::vector<gr_complex> &v); + GR_RUNTIME_API unsigned int + rounduppow2(unsigned int n); + // FIXME should be template + GR_RUNTIME_API void zero_vector(std::vector<float> &v); + GR_RUNTIME_API void zero_vector(std::vector<double> &v); + GR_RUNTIME_API void zero_vector(std::vector<int> &v); + GR_RUNTIME_API void zero_vector(std::vector<gr_complex> &v); + +} /* namespace gr */ #endif /* INCLUDED_GR_MISC_H */ diff --git a/gnuradio-runtime/lib/gr_msg_accepter.cc b/gnuradio-runtime/lib/msg_accepter.cc index 93d5fb20e8..354fce0c3d 100644 --- a/gnuradio-runtime/lib/gr_msg_accepter.cc +++ b/gnuradio-runtime/lib/msg_accepter.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2009 Free Software Foundation, Inc. + * Copyright 2009,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,37 +23,40 @@ #include <config.h> #endif -#include <gr_msg_accepter.h> -#include <gr_block.h> -#include <gr_block_detail.h> -#include <gr_hier_block2.h> +#include <gnuradio/msg_accepter.h> +#include <gnuradio/block.h> +#include <gnuradio/block_detail.h> +#include <gnuradio/hier_block2.h> #include <stdexcept> -using namespace pmt; - -gr_msg_accepter::gr_msg_accepter() -{ -} - -gr_msg_accepter::~gr_msg_accepter() -{ - // NOP, required as virtual destructor -} - -void -gr_msg_accepter::post(pmt_t which_port, pmt_t msg) -{ - // Notify derived class, handled case by case - gr_block *p = dynamic_cast<gr_block *>(this); - if (p) { - p->_post(which_port,msg); - return; +namespace gr { + + msg_accepter::msg_accepter() + { + } + + msg_accepter::~msg_accepter() + { + // NOP, required as virtual destructor } - gr_hier_block2 *p2 = dynamic_cast<gr_hier_block2 *>(this); - if (p2){ - // FIXME do the right thing - return; + + void + msg_accepter::post(pmt::pmt_t which_port, pmt::pmt_t msg) + { + // Notify derived class, handled case by case + block *p = dynamic_cast<block *>(this); + if(p) { + p->_post(which_port, msg); + return; + } + + hier_block2 *p2 = dynamic_cast<hier_block2 *>(this); + if(p2) { + // FIXME do the right thing + return; + } + + throw std::runtime_error("unknown derived class"); } - throw std::runtime_error("unknown derived class"); -} +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/gr_msg_handler.cc b/gnuradio-runtime/lib/msg_handler.cc index 0f93497088..32d14eb715 100644 --- a/gnuradio-runtime/lib/gr_msg_handler.cc +++ b/gnuradio-runtime/lib/msg_handler.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,8 +23,13 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include <gr_msg_handler.h> -gr_msg_handler::~gr_msg_handler () -{ -} +#include <gnuradio/msg_handler.h> + +namespace gr { + + msg_handler::~msg_handler() + { + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/msg_queue.cc b/gnuradio-runtime/lib/msg_queue.cc new file mode 100644 index 0000000000..9961f76296 --- /dev/null +++ b/gnuradio-runtime/lib/msg_queue.cc @@ -0,0 +1,130 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2009,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/msg_queue.h> +#include <stdexcept> + +namespace gr { + + msg_queue::sptr + msg_queue::make(unsigned int limit) + { + return msg_queue::sptr(new msg_queue(limit)); + } + + msg_queue::msg_queue(unsigned int limit) + : d_not_empty(), d_not_full(), + /*d_head(0), d_tail(0),*/ d_count(0), d_limit(limit) + { + } + + msg_queue::~msg_queue() + { + flush (); + } + + void + msg_queue::insert_tail(message::sptr msg) + { + if(msg->d_next) + throw std::invalid_argument("gr::msg_queue::insert_tail: msg already in queue"); + + gr::thread::scoped_lock guard(d_mutex); + + while(full_p()) + d_not_full.wait(guard); + + if(d_tail == 0) { + d_tail = d_head = msg; + //msg->d_next = 0; + msg->d_next.reset(); + } + else { + d_tail->d_next = msg; + d_tail = msg; + //msg->d_next = 0; + msg->d_next.reset(); + } + d_count++; + d_not_empty.notify_one(); + } + + message::sptr + msg_queue::delete_head() + { + gr::thread::scoped_lock guard(d_mutex); + message::sptr m; + + while((m = d_head) == 0) + d_not_empty.wait(guard); + + d_head = m->d_next; + if(d_head == 0){ + //d_tail = 0; + d_tail.reset(); + } + + d_count--; + // m->d_next = 0; + m->d_next.reset(); + d_not_full.notify_one(); + return m; + } + + message::sptr + msg_queue::delete_head_nowait() + { + gr::thread::scoped_lock guard(d_mutex); + message::sptr m; + + if((m = d_head) == 0) { + //return 0; + return message::sptr(); + } + + d_head = m->d_next; + if(d_head == 0) { + //d_tail = 0; + d_tail.reset(); + } + + d_count--; + //m->d_next = 0; + m->d_next.reset(); + d_not_full.notify_one(); + return m; + } + + void + msg_queue::flush() + { + message::sptr m; + + while((m = delete_head_nowait ()) != 0) + ; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/gr_pagesize.cc b/gnuradio-runtime/lib/pagesize.cc index e31e05ca70..373c0b6654 100644 --- a/gnuradio-runtime/lib/gr_pagesize.cc +++ b/gnuradio-runtime/lib/pagesize.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2003,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,33 +24,36 @@ #include "config.h" #endif -#include <gr_pagesize.h> +#include "pagesize.h" #include <unistd.h> #include <stdio.h> +namespace gr { + #if defined(_WIN32) && defined(HAVE_GETPAGESIZE) -extern "C" size_t getpagesize(void); + extern "C" size_t getpagesize(void); #endif -int -gr_pagesize () -{ - static int s_pagesize = -1; + int + pagesize() + { + static int s_pagesize = -1; - if (s_pagesize == -1){ + if(s_pagesize == -1) { #if defined(HAVE_GETPAGESIZE) - s_pagesize = getpagesize (); + s_pagesize = getpagesize(); #elif defined (HAVE_SYSCONF) - s_pagesize = sysconf (_SC_PAGESIZE); - if (s_pagesize == -1){ - perror ("_SC_PAGESIZE"); - s_pagesize = 4096; - } + s_pagesize = sysconf(_SC_PAGESIZE); + if(s_pagesize == -1) { + perror("_SC_PAGESIZE"); + s_pagesize = 4096; + } #else - fprintf (stderr, "gr_pagesize: no info; setting pagesize = 4096\n"); - s_pagesize = 4096; + fprintf(stderr, "gr::pagesize: no info; setting pagesize = 4096\n"); + s_pagesize = 4096; #endif + } + return s_pagesize; } - return s_pagesize; -} +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/gr_pagesize.h b/gnuradio-runtime/lib/pagesize.h index d14cb22b1b..6a16882002 100644 --- a/gnuradio-runtime/lib/gr_pagesize.h +++ b/gnuradio-runtime/lib/pagesize.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2003,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,16 +19,19 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -#ifndef _GR_PAGESIZE_H_ -#define _GR_PAGESIZE_H_ -#include <gr_runtime_api.h> +#ifndef GR_PAGESIZE_H_ +#define GR_PAGESIZE_H_ -/*! - * \brief return the page size in bytes - */ +#include <gnuradio/api.h> + +namespace gr { -GR_RUNTIME_API int gr_pagesize (); + /*! + * \brief return the page size in bytes + */ + GR_RUNTIME_API int pagesize(); +} /* namespace gr */ -#endif /* _GR_PAGESIZE_H_ */
\ No newline at end of file +#endif /* GR_PAGESIZE_H_ */ diff --git a/gnuradio-runtime/lib/pmt/CMakeLists.txt b/gnuradio-runtime/lib/pmt/CMakeLists.txt index 8d2dec8d14..1a8cc57ce8 100644 --- a/gnuradio-runtime/lib/pmt/CMakeLists.txt +++ b/gnuradio-runtime/lib/pmt/CMakeLists.txt @@ -113,5 +113,35 @@ add_dependencies(gnuradio-pmt pmt_generated ) -# Testing is handled in gnuradio-runtime tests one level down. +######################################################################## +# Setup tests +######################################################################## +if(ENABLE_TESTING) +include(GrTest) + +######################################################################## +# Append gnuradio-runtime test sources +######################################################################## +list(APPEND test_gnuradio_pmt_sources + qa_pmt.cc + qa_pmt_prims.cc + ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.cc +) + +include_directories(${CPPUNIT_INCLUDE_DIRS}) +link_directories(${CPPUNIT_LIBRARY_DIRS}) + +add_library(test-gnuradio-pmt SHARED ${test_gnuradio_pmt_sources}) +target_link_libraries(test-gnuradio-pmt gnuradio-runtime gnuradio-pmt + ${CPPUNIT_LIBRARIES} ${Boost_LIBRARIES} ${LOG4CPP_LIBRARIES}) + +######################################################################## +# Build the test executable +# Set the test environment so the build libs will be found under MSVC. +######################################################################## +list(APPEND GR_TEST_TARGET_DEPS test-gnuradio-pmt) +add_executable(gr_pmt_test test_pmt.cc) +target_link_libraries(gr_pmt_test test-gnuradio-pmt) +GR_ADD_TEST(gr-pmt-test gr_pmt_test) +endif(ENABLE_TESTING)
\ No newline at end of file diff --git a/gnuradio-runtime/lib/pmt/pmt.cc b/gnuradio-runtime/lib/pmt/pmt.cc index b6b3004331..f3f7783839 100644 --- a/gnuradio-runtime/lib/pmt/pmt.cc +++ b/gnuradio-runtime/lib/pmt/pmt.cc @@ -27,7 +27,7 @@ #include <vector> #include <pmt/pmt.h> #include "pmt_int.h" -#include <messages/msg_accepter.h> +#include <gnuradio/messages/msg_accepter.h> #include <pmt/pmt_pool.h> #include <stdio.h> #include <string.h> diff --git a/gnuradio-runtime/lib/pmt/qa_pmt.h b/gnuradio-runtime/lib/pmt/qa_pmt.h index 3e0c91abac..9293a076a6 100644 --- a/gnuradio-runtime/lib/pmt/qa_pmt.h +++ b/gnuradio-runtime/lib/pmt/qa_pmt.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_QA_PMT_H #define INCLUDED_QA_PMT_H -#include <attributes.h> +#include <gnuradio/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for pmt diff --git a/gnuradio-runtime/lib/pmt/qa_pmt_prims.cc b/gnuradio-runtime/lib/pmt/qa_pmt_prims.cc index e9a897deac..bfe71fbe5a 100644 --- a/gnuradio-runtime/lib/pmt/qa_pmt_prims.cc +++ b/gnuradio-runtime/lib/pmt/qa_pmt_prims.cc @@ -22,7 +22,7 @@ #include <qa_pmt_prims.h> #include <cppunit/TestAssert.h> -#include <messages/msg_passing.h> +#include <gnuradio/messages/msg_passing.h> #include <boost/format.hpp> #include <cstdio> #include <cstring> diff --git a/gnuradio-runtime/lib/pmt/qa_pmt_prims.h b/gnuradio-runtime/lib/pmt/qa_pmt_prims.h index 8c3f5c6220..f2f3dd77f7 100644 --- a/gnuradio-runtime/lib/pmt/qa_pmt_prims.h +++ b/gnuradio-runtime/lib/pmt/qa_pmt_prims.h @@ -22,13 +22,13 @@ #ifndef INCLUDED_QA_PMT_PRIMS_H #define INCLUDED_QA_PMT_PRIMS_H -#include <attributes.h> +#include <gnuradio/attributes.h> #include <pmt/api.h> //reason: suppress warnings #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -class __GR_ATTR_EXPORT qa_pmt_prims : public CppUnit::TestCase { - +class __GR_ATTR_EXPORT qa_pmt_prims : public CppUnit::TestCase +{ CPPUNIT_TEST_SUITE(qa_pmt_prims); CPPUNIT_TEST(test_symbols); CPPUNIT_TEST(test_booleans); diff --git a/gnuradio-runtime/lib/gr_select_handler.cc b/gnuradio-runtime/lib/pmt/test_pmt.cc index 0fc86354a6..49700b5928 100644 --- a/gnuradio-runtime/lib/gr_select_handler.cc +++ b/gnuradio-runtime/lib/pmt/test_pmt.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,13 +24,23 @@ #include "config.h" #endif -#include <gr_select_handler.h> +#include <cppunit/TextTestRunner.h> +#include <cppunit/XmlOutputter.h> -gr_select_handler::gr_select_handler(int fd) - : d_fd(fd) -{ -} +#include <gnuradio/unittests.h> +#include <qa_pmt.h> -gr_select_handler::~gr_select_handler() +int +main (int argc, char **argv) { + CppUnit::TextTestRunner runner; + std::ofstream xmlfile(get_unittest_path("gnuradio_runtime_runtime.xml").c_str()); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); + + runner.addTest(qa_pmt::suite()); + runner.setOutputter(xmlout); + + bool was_successful = runner.run("", false); + + return was_successful ? 0 : 1; } diff --git a/gnuradio-runtime/lib/pmt/unv_qa_template.cc.t b/gnuradio-runtime/lib/pmt/unv_qa_template.cc.t index a04d532b4e..ea675cee16 100644 --- a/gnuradio-runtime/lib/pmt/unv_qa_template.cc.t +++ b/gnuradio-runtime/lib/pmt/unv_qa_template.cc.t @@ -2,7 +2,7 @@ void qa_pmt_unv::test_@TAG@vector() { static const size_t N = 3; - pmt_t v1 = pmt::make_@TAG@vector(N, 0); + pmt::pmt_t v1 = pmt::make_@TAG@vector(N, 0); CPPUNIT_ASSERT_EQUAL(N, pmt::length(v1)); @TYPE@ s0 = @TYPE@(10); @TYPE@ s1 = @TYPE@(20); diff --git a/gnuradio-runtime/lib/posix_memalign.cc b/gnuradio-runtime/lib/posix_memalign.cc index aaeff78042..a08e9e127a 100644 --- a/gnuradio-runtime/lib/posix_memalign.cc +++ b/gnuradio-runtime/lib/posix_memalign.cc @@ -36,7 +36,7 @@ /* emulate posix_memalign functionality, to some degree */ #include <errno.h> -#include "gr_pagesize.h" +#include "pagesize.h" int posix_memalign (void **memptr, size_t alignment, size_t size) @@ -86,7 +86,7 @@ int posix_memalign /* try valloc if it exists */ /* cheap and easy way to make sure alignment is met, so long as it * is <= pagesize () */ - if (alignment <= (size_t) gr_pagesize ()) { + if (alignment <= (size_t) gr::pagesize ()) { *memptr = valloc (size); } } diff --git a/gnuradio-runtime/lib/prefs.cc b/gnuradio-runtime/lib/prefs.cc new file mode 100644 index 0000000000..468532f33b --- /dev/null +++ b/gnuradio-runtime/lib/prefs.cc @@ -0,0 +1,401 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gnuradio/prefs.h> +#include <gnuradio/sys_paths.h> +#include <gnuradio/constants.h> +#include <algorithm> + +#include <boost/filesystem/operations.hpp> +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/fstream.hpp> +namespace fs = boost::filesystem; + +namespace gr { + + /* + * Stub implementations + */ + static prefs s_default_singleton; + static prefs *s_singleton = &s_default_singleton; + + prefs * + prefs::singleton() + { + return s_singleton; + } + + void + prefs::set_singleton(prefs *p) + { + s_singleton = p; + } + + prefs::prefs() + { + _read_files(); + } + + prefs::~prefs() + { + // nop + } + + std::vector<std::string> + prefs::_sys_prefs_filenames() + { + std::vector<std::string> fnames; + + fs::path dir = prefsdir(); + if(!fs::is_directory(dir)) + return fnames; + + fs::directory_iterator diritr(dir); + while(diritr != fs::directory_iterator()) { + fs::path p = *diritr++; + if(p.extension() != ".swp") + fnames.push_back(p.string()); + } + std::sort(fnames.begin(), fnames.end()); + + // Find if there is a ~/.gnuradio/config.conf file and add this to + // the end of the file list to override any preferences in the + // installed path config files. + fs::path homedir = fs::path(gr::appdata_path()); + homedir = homedir/".gnuradio/config.conf"; + if(fs::exists(homedir)) { + fnames.push_back(homedir.string()); + } + + return fnames; + } + + void + prefs::_read_files() + { + std::string config; + + std::vector<std::string> filenames = _sys_prefs_filenames(); + std::vector<std::string>::iterator sitr; + char tmp[1024]; + for(sitr = filenames.begin(); sitr != filenames.end(); sitr++) { + fs::ifstream fin(*sitr); + while(!fin.eof()) { + fin.getline(tmp, 1024); + std::string t(tmp); + // ignore empty lines or lines of just comments + if((t.size() > 0) && (t[0] != '#')) { + // remove any comments in the line + size_t hash = t.find("#"); + + // Use hash marks at the end of each segment as a delimiter + config += t.substr(0, hash) + '#'; + } + } + fin.close(); + } + + // Remove all whitespace. + config.erase(std::remove_if(config.begin(), config.end(), + ::isspace), config.end()); + + // Convert the string into a map + _convert_to_map(config); + } + + void + prefs::_convert_to_map(const std::string &conf) + { + // Convert the string into an map of maps + // Map is structured as {section name: map of options} + // And options map is simply: {option name: option value} + std::string sub = conf; + size_t sec_start = sub.find("["); + while(sec_start != std::string::npos) { + sub = sub.substr(sec_start); + + size_t sec_end = sub.find("]"); + if(sec_end == std::string::npos) + throw std::runtime_error("Config file error: Mismatched section label.\n"); + + std::string sec = sub.substr(1, sec_end-1); + size_t next_sec_start = sub.find("[", sec_end); + std::string subsec = sub.substr(sec_end+1, next_sec_start-sec_end-2); + + std::transform(sec.begin(), sec.end(), sec.begin(), ::tolower); + + std::map<std::string, std::string> options_map = d_config_map[sec]; + size_t next_opt = 0; + size_t next_val = 0; + next_opt = subsec.find("#"); + while(next_opt < subsec.size()-1) { + next_val = subsec.find("=", next_opt); + std::string option = subsec.substr(next_opt+1, next_val-next_opt-1); + + next_opt = subsec.find("#", next_val); + std::string value = subsec.substr(next_val+1, next_opt-next_val-1); + + std::transform(option.begin(), option.end(), option.begin(), ::tolower); + options_map[option] = value; + } + + d_config_map[sec] = options_map; + + sec_start = sub.find("[", sec_end); + } + } + + std::string + prefs::to_string() + { + config_map_itr sections; + config_map_elem_itr options; + std::stringstream s; + + for(sections = d_config_map.begin(); sections != d_config_map.end(); sections++) { + s << "[" << sections->first << "]" << std::endl; + for(options = sections->second.begin(); options != sections->second.end(); options++) { + s << options->first << " = " << options->second << std::endl; + } + s << std::endl; + } + + return s.str(); + } + + void + prefs::save() + { + std::string conf = to_string(); + + fs::path homedir = fs::path(gr::appdata_path()); + homedir = homedir/".gnuradio/config.conf"; + fs::ofstream fout(homedir); + fout << conf; + fout.close(); + } + + char * + prefs::option_to_env(std::string section, std::string option) + { + std::stringstream envname; + std::string secname=section, optname=option; + + std::transform(section.begin(), section.end(), secname.begin(), ::toupper); + std::transform(option.begin(), option.end(), optname.begin(), ::toupper); + envname << "GR_CONF_" << secname << "_" << optname; + + return getenv(envname.str().c_str()); + } + + bool + prefs::has_section(const std::string §ion) + { + std::string s = section; + std::transform(section.begin(), section.end(), s.begin(), ::tolower); + return d_config_map.count(s) > 0; + } + + bool + prefs::has_option(const std::string §ion, const std::string &option) + { + if(option_to_env(section, option)) + return true; + + if(has_section(section)) { + std::string s = section; + std::transform(section.begin(), section.end(), s.begin(), ::tolower); + + std::string o = option; + std::transform(option.begin(), option.end(), o.begin(), ::tolower); + + config_map_itr sec = d_config_map.find(s); + return sec->second.count(o) > 0; + } + else { + return false; + } + } + + const std::string + prefs::get_string(const std::string §ion, const std::string &option, + const std::string &default_val) + { + char *env = option_to_env(section, option); + if(env) + return std::string(env); + + if(has_option(section, option)) { + std::string s = section; + std::transform(section.begin(), section.end(), s.begin(), ::tolower); + + std::string o = option; + std::transform(option.begin(), option.end(), o.begin(), ::tolower); + + config_map_itr sec = d_config_map.find(s); + config_map_elem_itr opt = sec->second.find(o); + return opt->second; + } + else { + return default_val; + } + } + + void + prefs::set_string(const std::string §ion, const std::string &option, + const std::string &val) + { + std::string s = section; + std::transform(section.begin(), section.end(), s.begin(), ::tolower); + + std::string o = option; + std::transform(option.begin(), option.end(), o.begin(), ::tolower); + + std::map<std::string, std::string> opt_map = d_config_map[s]; + + opt_map[o] = val; + + d_config_map[s] = opt_map; + } + + bool + prefs::get_bool(const std::string §ion, const std::string &option, + bool default_val) + { + if(has_option(section, option)) { + std::string str = get_string(section, option, ""); + if(str == "") { + return default_val; + } + std::transform(str.begin(), str.end(), str.begin(), ::tolower); + if((str == "true") || (str == "on") || (str == "1")) + return true; + else if((str == "false") || (str == "off") || (str == "0")) + return false; + else + return default_val; + } + else { + return default_val; + } + } + + void + prefs::set_bool(const std::string §ion, const std::string &option, + bool val) + { + std::string s = section; + std::transform(section.begin(), section.end(), s.begin(), ::tolower); + + std::string o = option; + std::transform(option.begin(), option.end(), o.begin(), ::tolower); + + std::map<std::string, std::string> opt_map = d_config_map[s]; + + std::stringstream sstr; + sstr << (val == true); + opt_map[o] = sstr.str(); + + d_config_map[s] = opt_map; + } + + long + prefs::get_long(const std::string §ion, const std::string &option, + long default_val) + { + if(has_option(section, option)) { + std::string str = get_string(section, option, ""); + if(str == "") { + return default_val; + } + std::stringstream sstr(str); + long n; + sstr >> n; + return n; + } + else { + return default_val; + } + } + + void + prefs::set_long(const std::string §ion, const std::string &option, + long val) + { + std::string s = section; + std::transform(section.begin(), section.end(), s.begin(), ::tolower); + + std::string o = option; + std::transform(option.begin(), option.end(), o.begin(), ::tolower); + + std::map<std::string, std::string> opt_map = d_config_map[s]; + + std::stringstream sstr; + sstr << val; + opt_map[o] = sstr.str(); + + d_config_map[s] = opt_map; + } + + double + prefs::get_double(const std::string §ion, const std::string &option, + double default_val) + { + if(has_option(section, option)) { + std::string str = get_string(section, option, ""); + if(str == "") { + return default_val; + } + std::stringstream sstr(str); + double n; + sstr >> n; + return n; + } + else { + return default_val; + } + } + + void + prefs::set_double(const std::string §ion, const std::string &option, + double val) + { + std::string s = section; + std::transform(section.begin(), section.end(), s.begin(), ::tolower); + + std::string o = option; + std::transform(option.begin(), option.end(), o.begin(), ::tolower); + + std::map<std::string, std::string> opt_map = d_config_map[s]; + + std::stringstream sstr; + sstr << val; + opt_map[o] = sstr.str(); + + d_config_map[s] = opt_map; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/qa_buffer.cc b/gnuradio-runtime/lib/qa_buffer.cc new file mode 100644 index 0000000000..5f1dece0ad --- /dev/null +++ b/gnuradio-runtime/lib/qa_buffer.cc @@ -0,0 +1,304 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004 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. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <qa_buffer.h> +#include <gnuradio/buffer.h> +#include <cppunit/TestAssert.h> +#include <stdlib.h> +#include <gnuradio/random.h> + +static void +leak_check(void f()) +{ + long buffer_count = gr::buffer_ncurrently_allocated(); + long buffer_reader_count = gr::buffer_reader_ncurrently_allocated(); + + f(); + + CPPUNIT_ASSERT_EQUAL(buffer_reader_count, gr::buffer_reader_ncurrently_allocated()); + CPPUNIT_ASSERT_EQUAL(buffer_count, gr::buffer_ncurrently_allocated()); +} + + +// ---------------------------------------------------------------------------- +// test single writer, no readers... +// + +static void +t0_body() +{ + int nitems = 4000 / sizeof(int); + int counter = 0; + + gr::buffer_sptr buf(gr::make_buffer(nitems, sizeof(int), gr::block_sptr())); + + int last_sa; + int sa; + + sa = buf->space_available(); + CPPUNIT_ASSERT(sa > 0); + last_sa = sa; + + for(int i = 0; i < 5; i++) { + sa = buf->space_available(); + CPPUNIT_ASSERT_EQUAL(last_sa, sa); + last_sa = sa; + + int *p = (int*)buf->write_pointer(); + CPPUNIT_ASSERT(p != 0); + + for(int j = 0; j < sa; j++) + *p++ = counter++; + + buf->update_write_pointer(sa); + } +} + +// ---------------------------------------------------------------------------- +// test single writer, single reader +// + +static void +t1_body() +{ + int nitems = 4000 / sizeof(int); + int write_counter = 0; + int read_counter = 0; + + gr::buffer_sptr buf(gr::make_buffer(nitems, sizeof(int), gr::block_sptr())); + gr::buffer_reader_sptr r1(gr::buffer_add_reader(buf, 0, gr::block_sptr())); + + int sa; + + // write 1/3 of buffer + + sa = buf->space_available(); + CPPUNIT_ASSERT(sa > 0); + + int *p = (int*)buf->write_pointer(); + CPPUNIT_ASSERT(p != 0); + + for(int j = 0; j < sa/3; j++) { + *p++ = write_counter++; + } + buf->update_write_pointer(sa/3); + + // write the next 1/3 (1/2 of what's left) + + sa = buf->space_available(); + CPPUNIT_ASSERT(sa > 0); + + p = (int*)buf->write_pointer(); + CPPUNIT_ASSERT(p != 0); + + for(int j = 0; j < sa/2; j++) { + *p++ = write_counter++; + } + buf->update_write_pointer(sa/2); + + // check that we can read it OK + + int ia = r1->items_available(); + CPPUNIT_ASSERT_EQUAL(write_counter, ia); + + int *rp = (int*)r1->read_pointer(); + CPPUNIT_ASSERT(rp != 0); + + for(int i = 0; i < ia/2; i++) { + CPPUNIT_ASSERT_EQUAL(read_counter, *rp); + read_counter++; + rp++; + } + r1->update_read_pointer(ia/2); + + // read the rest + + ia = r1->items_available(); + rp = (int *) r1->read_pointer(); + CPPUNIT_ASSERT(rp != 0); + + for(int i = 0; i < ia; i++) { + CPPUNIT_ASSERT_EQUAL(read_counter, *rp); + read_counter++; + rp++; + } + r1->update_read_pointer(ia); +} + +// ---------------------------------------------------------------------------- +// single writer, single reader: check wrap-around +// + +static void +t2_body() +{ + // 64K is the largest granularity we've seen so far (MS windows file mapping). + // This allows a bit of "white box testing" + + int nitems = (64 * (1L << 10)) / sizeof(int); // 64K worth of ints + + gr::buffer_sptr buf(gr::make_buffer(nitems, sizeof(int), gr::block_sptr())); + gr::buffer_reader_sptr r1(gr::buffer_add_reader(buf, 0, gr::block_sptr())); + + int read_counter = 0; + int write_counter = 0; + int n; + int *wp = 0; + int *rp = 0; + + // Write 3/4 of buffer + + n = (int)(buf->space_available() * 0.75); + wp = (int*)buf->write_pointer(); + + for(int i = 0; i < n; i++) + *wp++ = write_counter++; + buf->update_write_pointer(n); + + // Now read it all + + int m = r1->items_available(); + CPPUNIT_ASSERT_EQUAL(n, m); + rp = (int*)r1->read_pointer(); + + for(int i = 0; i < m; i++) { + CPPUNIT_ASSERT_EQUAL(read_counter, *rp); + read_counter++; + rp++; + } + r1->update_read_pointer(m); + + // Now write as much as we can. + // This will wrap around the buffer + + n = buf->space_available(); + CPPUNIT_ASSERT_EQUAL(nitems - 1, n); // white box test + wp = (int*)buf->write_pointer(); + + for(int i = 0; i < n; i++) + *wp++ = write_counter++; + buf->update_write_pointer(n); + + // now read it all + + m = r1->items_available(); + CPPUNIT_ASSERT_EQUAL(n, m); + rp = (int*)r1->read_pointer(); + + for(int i = 0; i < m; i++) { + CPPUNIT_ASSERT_EQUAL(read_counter, *rp); + read_counter++; + rp++; + } + r1->update_read_pointer(m); +} + +// ---------------------------------------------------------------------------- +// single writer, N readers, randomized order and lengths +// ---------------------------------------------------------------------------- + +static void +t3_body() +{ + int nitems = (64 * (1L << 10)) / sizeof(int); + + static const int N = 5; + gr::buffer_sptr buf(gr::make_buffer(nitems, sizeof(int), gr::block_sptr())); + gr::buffer_reader_sptr reader[N]; + int read_counter[N]; + int write_counter = 0; + gr::random random; + + for(int i = 0; i < N; i++) { + read_counter[i] = 0; + reader[i] = buffer_add_reader(buf, 0, gr::block_sptr()); + } + + for(int lc = 0; lc < 1000; lc++) { + + // write some + + int n = (int)(buf->space_available() * random.ran1()); + int *wp = (int*)buf->write_pointer(); + + for(int i = 0; i < n; i++) + *wp++ = write_counter++; + + buf->update_write_pointer(n); + + // pick a random reader and read some + + int r = (int)(N * random.ran1()); + CPPUNIT_ASSERT(0 <= r && r < N); + + int m = reader[r]->items_available(); + int *rp = (int*)reader[r]->read_pointer(); + + for(int i = 0; i < m; i++) { + CPPUNIT_ASSERT_EQUAL(read_counter[r], *rp); + read_counter[r]++; + rp++; + } + reader[r]->update_read_pointer (m); + } +} + + +// ---------------------------------------------------------------------------- + +void +qa_buffer::t0() +{ + leak_check(t0_body); +} + +void +qa_buffer::t1() +{ + leak_check(t1_body); +} + +void +qa_buffer::t2() +{ + leak_check(t2_body); +} + +void +qa_buffer::t3() +{ + leak_check(t3_body); +} + +void +qa_buffer::t4() +{ +} + +void +qa_buffer::t5() +{ +} diff --git a/gnuradio-runtime/lib/qa_gr_buffer.h b/gnuradio-runtime/lib/qa_buffer.h index 2937c24b68..a41e69dd48 100644 --- a/gnuradio-runtime/lib/qa_gr_buffer.h +++ b/gnuradio-runtime/lib/qa_buffer.h @@ -26,28 +26,24 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -class qa_gr_buffer : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_buffer); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST (t4); - CPPUNIT_TEST (t5); - CPPUNIT_TEST_SUITE_END (); - +class qa_buffer : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(qa_buffer); + CPPUNIT_TEST(t0); + CPPUNIT_TEST(t1); + CPPUNIT_TEST(t2); + CPPUNIT_TEST(t3); + CPPUNIT_TEST(t4); + CPPUNIT_TEST(t5); + CPPUNIT_TEST_SUITE_END(); private: - - void t0 (); - void t1 (); - void t2 (); - void t3 (); - void t4 (); - void t5 (); + void t0(); + void t1(); + void t2(); + void t3(); + void t4(); + void t5(); }; - - #endif /* INCLUDED_QA_GR_BUFFER_H */ diff --git a/gnuradio-runtime/lib/qa_gr_circular_file.cc b/gnuradio-runtime/lib/qa_circular_file.cc index 243e44784b..d80831b4b9 100644 --- a/gnuradio-runtime/lib/qa_gr_circular_file.cc +++ b/gnuradio-runtime/lib/qa_circular_file.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,8 +23,9 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include <qa_gr_circular_file.h> -#include <gr_circular_file.h> + +#include "qa_circular_file.h" +#include "circular_file.h" #include <cppunit/TestAssert.h> #include <iostream> #include <stdio.h> @@ -35,38 +36,37 @@ static const int BUFFER_SIZE = 8192; static const int NWRITE = 8192 * 9 / 8; void -qa_gr_circular_file::t1 () +qa_circular_file::t1() { #ifdef HAVE_MMAP - gr_circular_file *cf_writer; - gr_circular_file *cf_reader; + gr::circular_file *cf_writer; + gr::circular_file *cf_reader; // write the data... - - cf_writer = new gr_circular_file (test_file, true, BUFFER_SIZE * sizeof (short)); + cf_writer = new gr::circular_file(test_file, true, + BUFFER_SIZE * sizeof(short)); short sd; - for (int i = 0; i < NWRITE; i++){ + for(int i = 0; i < NWRITE; i++) { sd = i; - cf_writer->write (&sd, sizeof (sd)); + cf_writer->write(&sd, sizeof (sd)); } delete cf_writer; // now read it back... - - cf_reader = new gr_circular_file (test_file); - for (int i = 0; i < BUFFER_SIZE; i++){ - int n = cf_reader->read (&sd, sizeof (sd)); - CPPUNIT_ASSERT_EQUAL ((int) sizeof (sd), n); - CPPUNIT_ASSERT_EQUAL (NWRITE - BUFFER_SIZE + i, (int) sd); + cf_reader = new gr::circular_file(test_file); + for(int i = 0; i < BUFFER_SIZE; i++) { + int n = cf_reader->read (&sd, sizeof(sd)); + CPPUNIT_ASSERT_EQUAL((int) sizeof (sd), n); + CPPUNIT_ASSERT_EQUAL(NWRITE - BUFFER_SIZE + i, (int)sd); } - int n = cf_reader->read (&sd, sizeof (sd)); - CPPUNIT_ASSERT_EQUAL (0, n); + int n = cf_reader->read(&sd, sizeof(sd)); + CPPUNIT_ASSERT_EQUAL(0, n); delete cf_reader; - unlink (test_file); + unlink(test_file); #endif // HAVE_MMAP } diff --git a/gnuradio-runtime/lib/qa_gr_vmcircbuf.h b/gnuradio-runtime/lib/qa_circular_file.h index 3576660d5a..fd5c156b56 100644 --- a/gnuradio-runtime/lib/qa_gr_vmcircbuf.h +++ b/gnuradio-runtime/lib/qa_circular_file.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2002,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,21 +19,21 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -#ifndef _QA_GR_VMCIRCBUF_H_ -#define _QA_GR_VMCIRCBUF_H_ + +#ifndef QA_GR_CIRCULAR_FILE_H +#define QA_GR_CIRCULAR_FILE_H #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -class qa_gr_vmcircbuf : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_vmcircbuf); - CPPUNIT_TEST (test_all); - CPPUNIT_TEST_SUITE_END (); +class qa_circular_file : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(qa_circular_file); + CPPUNIT_TEST(t1); + CPPUNIT_TEST_SUITE_END(); - private: - void test_all (); +private: + void t1(); }; - -#endif /* _QA_GR_VMCIRCBUF_H_ */ +#endif /* QA_GR_CIRCULAR_FILE_H */ diff --git a/gnuradio-runtime/lib/qa_gr_buffer.cc b/gnuradio-runtime/lib/qa_gr_buffer.cc deleted file mode 100644 index c74baf398e..0000000000 --- a/gnuradio-runtime/lib/qa_gr_buffer.cc +++ /dev/null @@ -1,307 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <qa_gr_buffer.h> -#include <gr_buffer.h> -#include <cppunit/TestAssert.h> -#include <stdlib.h> -#include <gr_random.h> - -static void -leak_check (void f ()) -{ - long buffer_count = gr_buffer_ncurrently_allocated (); - long buffer_reader_count = gr_buffer_reader_ncurrently_allocated (); - - f (); - - CPPUNIT_ASSERT_EQUAL (buffer_reader_count, gr_buffer_reader_ncurrently_allocated ()); - CPPUNIT_ASSERT_EQUAL (buffer_count, gr_buffer_ncurrently_allocated ()); -} - - -// ---------------------------------------------------------------------------- -// test single writer, no readers... -// - -static void -t0_body () -{ - int nitems = 4000 / sizeof (int); - int counter = 0; - - gr_buffer_sptr buf(gr_make_buffer(nitems, sizeof (int), gr_block_sptr())); - - int last_sa; - int sa; - - sa = buf->space_available (); - CPPUNIT_ASSERT (sa > 0); - last_sa = sa; - - for (int i = 0; i < 5; i++){ - sa = buf->space_available (); - CPPUNIT_ASSERT_EQUAL (last_sa, sa); - last_sa = sa; - - int *p = (int *) buf->write_pointer (); - CPPUNIT_ASSERT (p != 0); - - for (int j = 0; j < sa; j++) - *p++ = counter++; - - buf->update_write_pointer (sa); - } -} - -// ---------------------------------------------------------------------------- -// test single writer, single reader -// - -static void -t1_body () - { - int nitems = 4000 / sizeof (int); - int write_counter = 0; - int read_counter = 0; - - gr_buffer_sptr buf(gr_make_buffer(nitems, sizeof (int), gr_block_sptr())); - gr_buffer_reader_sptr r1 (gr_buffer_add_reader (buf, 0, gr_block_sptr())); - - - int sa; - - // write 1/3 of buffer - - sa = buf->space_available (); - CPPUNIT_ASSERT (sa > 0); - - int *p = (int *) buf->write_pointer (); - CPPUNIT_ASSERT (p != 0); - - for (int j = 0; j < sa/3; j++){ - *p++ = write_counter++; - } - buf->update_write_pointer (sa/3); - - - // write the next 1/3 (1/2 of what's left) - - sa = buf->space_available (); - CPPUNIT_ASSERT (sa > 0); - - p = (int *) buf->write_pointer (); - CPPUNIT_ASSERT (p != 0); - - for (int j = 0; j < sa/2; j++){ - *p++ = write_counter++; - } - buf->update_write_pointer (sa/2); - - - // check that we can read it OK - - int ia = r1->items_available (); - CPPUNIT_ASSERT_EQUAL (write_counter, ia); - - int *rp = (int *) r1->read_pointer (); - CPPUNIT_ASSERT (rp != 0); - - for (int i = 0; i < ia/2; i++){ - CPPUNIT_ASSERT_EQUAL (read_counter, *rp); - read_counter++; - rp++; - } - r1->update_read_pointer (ia/2); - - // read the rest - - ia = r1->items_available (); - rp = (int *) r1->read_pointer (); - CPPUNIT_ASSERT (rp != 0); - - for (int i = 0; i < ia; i++){ - CPPUNIT_ASSERT_EQUAL (read_counter, *rp); - read_counter++; - rp++; - } - r1->update_read_pointer (ia); -} - -// ---------------------------------------------------------------------------- -// single writer, single reader: check wrap-around -// - -static void -t2_body () -{ - // 64K is the largest granularity we've seen so far (MS windows file mapping). - // This allows a bit of "white box testing" - - int nitems = (64 * (1L << 10)) / sizeof (int); // 64K worth of ints - - gr_buffer_sptr buf(gr_make_buffer (nitems, sizeof (int), gr_block_sptr())); - gr_buffer_reader_sptr r1 (gr_buffer_add_reader (buf, 0, gr_block_sptr())); - - int read_counter = 0; - int write_counter = 0; - int n; - int *wp = 0; - int *rp = 0; - - // Write 3/4 of buffer - - n = (int) (buf->space_available () * 0.75); - wp = (int *) buf->write_pointer (); - - for (int i = 0; i < n; i++) - *wp++ = write_counter++; - buf->update_write_pointer (n); - - // Now read it all - - int m = r1->items_available (); - CPPUNIT_ASSERT_EQUAL (n, m); - rp = (int *) r1->read_pointer (); - - for (int i = 0; i < m; i++){ - CPPUNIT_ASSERT_EQUAL (read_counter, *rp); - read_counter++; - rp++; - } - r1->update_read_pointer (m); - - // Now write as much as we can. - // This will wrap around the buffer - - n = buf->space_available (); - CPPUNIT_ASSERT_EQUAL (nitems - 1, n); // white box test - wp = (int *) buf->write_pointer (); - - for (int i = 0; i < n; i++) - *wp++ = write_counter++; - buf->update_write_pointer (n); - - // now read it all - - m = r1->items_available (); - CPPUNIT_ASSERT_EQUAL (n, m); - rp = (int *) r1->read_pointer (); - - for (int i = 0; i < m; i++){ - CPPUNIT_ASSERT_EQUAL (read_counter, *rp); - read_counter++; - rp++; - } - r1->update_read_pointer (m); - -} - -// ---------------------------------------------------------------------------- -// single writer, N readers, randomized order and lengths -// ---------------------------------------------------------------------------- - -static void -t3_body () -{ - int nitems = (64 * (1L << 10)) / sizeof (int); - - static const int N = 5; - gr_buffer_sptr buf(gr_make_buffer(nitems, sizeof (int), gr_block_sptr())); - gr_buffer_reader_sptr reader[N]; - int read_counter[N]; - int write_counter = 0; - gr_random random; - - for (int i = 0; i < N; i++){ - read_counter[i] = 0; - reader[i] = gr_buffer_add_reader (buf, 0, gr_block_sptr()); - } - - for (int lc = 0; lc < 1000; lc++){ - - // write some - - int n = (int) (buf->space_available () * random.ran1 ()); - int *wp = (int *) buf->write_pointer (); - - for (int i = 0; i < n; i++) - *wp++ = write_counter++; - - buf->update_write_pointer (n); - - // pick a random reader and read some - - int r = (int) (N * random.ran1 ()); - CPPUNIT_ASSERT (0 <= r && r < N); - - int m = reader[r]->items_available (); - int *rp = (int *) reader[r]->read_pointer (); - - for (int i = 0; i < m; i++){ - CPPUNIT_ASSERT_EQUAL (read_counter[r], *rp); - read_counter[r]++; - rp++; - } - reader[r]->update_read_pointer (m); - } -} - - -// ---------------------------------------------------------------------------- - -void -qa_gr_buffer::t0 () -{ - leak_check (t0_body); -} - -void -qa_gr_buffer::t1 () -{ - leak_check (t1_body); -} - -void -qa_gr_buffer::t2 () -{ - leak_check (t2_body); -} - -void -qa_gr_buffer::t3 () -{ - leak_check (t3_body); -} - -void -qa_gr_buffer::t4 () -{ -} - -void -qa_gr_buffer::t5 () -{ -} diff --git a/gnuradio-runtime/lib/qa_gr_fxpt.cc b/gnuradio-runtime/lib/qa_gr_fxpt.cc deleted file mode 100644 index 7eac0d8964..0000000000 --- a/gnuradio-runtime/lib/qa_gr_fxpt.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <qa_gr_fxpt.h> -#include <gr_fxpt.h> -#include <cppunit/TestAssert.h> -#include <iostream> -#include <stdio.h> -#include <unistd.h> -#include <math.h> - -static const float SIN_COS_TOLERANCE = 1e-5; - -void -qa_gr_fxpt::t0 () -{ - CPPUNIT_ASSERT_DOUBLES_EQUAL (M_PI/2, gr_fxpt::fixed_to_float (0x40000000), SIN_COS_TOLERANCE); - CPPUNIT_ASSERT_DOUBLES_EQUAL (0.0, gr_fxpt::fixed_to_float (0x00000000), SIN_COS_TOLERANCE); - CPPUNIT_ASSERT_DOUBLES_EQUAL (-M_PI, gr_fxpt::fixed_to_float (0x80000000), SIN_COS_TOLERANCE); - - if (0){ - /* - * These are disabled because of some precision issues. - * - * Different compilers seem to have different opinions on whether - * the calulations are done single or double (or extended) - * precision. Any of the answers are fine for our real purpose, but - * sometimes the answer is off by a few bits at the bottom. - * Hence, the disabled check. - */ - CPPUNIT_ASSERT_EQUAL ((gr_int32) 0x40000000, gr_fxpt::float_to_fixed (M_PI/2)); - CPPUNIT_ASSERT_EQUAL ((gr_int32) 0, gr_fxpt::float_to_fixed (0)); - CPPUNIT_ASSERT_EQUAL ((gr_int32) 0x80000000, gr_fxpt::float_to_fixed (-M_PI)); - } -} - -void -qa_gr_fxpt::t1 () -{ - - CPPUNIT_ASSERT_DOUBLES_EQUAL ( 0, gr_fxpt::sin (0x00000000), SIN_COS_TOLERANCE); - CPPUNIT_ASSERT_DOUBLES_EQUAL ( 0.707106781, gr_fxpt::sin (0x20000000), SIN_COS_TOLERANCE); - CPPUNIT_ASSERT_DOUBLES_EQUAL ( 1, gr_fxpt::sin (0x40000000), SIN_COS_TOLERANCE); - CPPUNIT_ASSERT_DOUBLES_EQUAL ( 0.707106781, gr_fxpt::sin (0x60000000), SIN_COS_TOLERANCE); - CPPUNIT_ASSERT_DOUBLES_EQUAL ( 0, gr_fxpt::sin (0x7fffffff), SIN_COS_TOLERANCE); - CPPUNIT_ASSERT_DOUBLES_EQUAL ( 0, gr_fxpt::sin (0x80000000), SIN_COS_TOLERANCE); - CPPUNIT_ASSERT_DOUBLES_EQUAL ( 0, gr_fxpt::sin (0x80000001), SIN_COS_TOLERANCE); - CPPUNIT_ASSERT_DOUBLES_EQUAL (-1, gr_fxpt::sin (-0x40000000), SIN_COS_TOLERANCE); - CPPUNIT_ASSERT_DOUBLES_EQUAL (-0.707106781, gr_fxpt::sin (-0x20000000), SIN_COS_TOLERANCE); - - - for (float p = -M_PI; p < M_PI; p += 2 * M_PI / 3600){ - float expected = sin (p); - float actual = gr_fxpt::sin (gr_fxpt::float_to_fixed (p)); - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected, actual, SIN_COS_TOLERANCE); - } -} - -void -qa_gr_fxpt::t2 () -{ - for (float p = -M_PI; p < M_PI; p += 2 * M_PI / 3600){ - float expected = cos (p); - float actual = gr_fxpt::cos (gr_fxpt::float_to_fixed (p)); - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected, actual, SIN_COS_TOLERANCE); - } -} - -void -qa_gr_fxpt::t3 () -{ - for (float p = -M_PI; p < M_PI; p += 2 * M_PI / 3600){ - float expected_sin = sin (p); - float expected_cos = cos (p); - float actual_sin; - float actual_cos; - gr_fxpt::sincos (gr_fxpt::float_to_fixed (p), &actual_sin, &actual_cos); - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_sin, actual_sin, SIN_COS_TOLERANCE); - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_cos, actual_cos, SIN_COS_TOLERANCE); - } -} diff --git a/gnuradio-runtime/lib/qa_gr_io_signature.cc b/gnuradio-runtime/lib/qa_gr_io_signature.cc deleted file mode 100644 index c1737ffb8e..0000000000 --- a/gnuradio-runtime/lib/qa_gr_io_signature.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <qa_gr_io_signature.h> -#include <gr_io_signature.h> - -void -qa_gr_io_signature::t0 () -{ - gr_make_io_signature (1, 1, sizeof (int)); -} - -void -qa_gr_io_signature::t1 () -{ - gr_make_io_signature (3, 1, sizeof (int)); // throws std::invalid_argument -} - -void -qa_gr_io_signature::t2 () -{ - gr_io_signature_sptr p = - gr_make_io_signature (3, gr_io_signature::IO_INFINITE, sizeof (int)); - - CPPUNIT_ASSERT_EQUAL (p->min_streams (), 3); - CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item (0), (int) sizeof (int)); -} - -void -qa_gr_io_signature::t3 () -{ - gr_io_signature_sptr p = - gr_make_io_signature3 (0, 5, 1, 2, 3); - - CPPUNIT_ASSERT_EQUAL (p->min_streams (), 0); - CPPUNIT_ASSERT_EQUAL (p->max_streams (), 5); - CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(0), 1); - CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(1), 2); - CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(2), 3); - CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(3), 3); - CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(4), 3); -} diff --git a/gnuradio-runtime/lib/qa_io_signature.cc b/gnuradio-runtime/lib/qa_io_signature.cc new file mode 100644 index 0000000000..bc3509a260 --- /dev/null +++ b/gnuradio-runtime/lib/qa_io_signature.cc @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <qa_io_signature.h> +#include <gnuradio/io_signature.h> + +void +qa_io_signature::t0() +{ + gr::io_signature::make(1, 1, sizeof(int)); +} + +void +qa_io_signature::t1() +{ + gr::io_signature::make(3, 1, sizeof(int)); // throws std::invalid_argument +} + +void +qa_io_signature::t2() +{ + gr::io_signature::sptr p = + gr::io_signature::make(3, gr::io_signature::IO_INFINITE, sizeof(int)); + + CPPUNIT_ASSERT_EQUAL(p->min_streams(), 3); + CPPUNIT_ASSERT_EQUAL(p->sizeof_stream_item(0), (int)sizeof(int)); +} + +void +qa_io_signature::t3() +{ + gr::io_signature::sptr p = + gr::io_signature::make3(0, 5, 1, 2, 3); + + CPPUNIT_ASSERT_EQUAL(p->min_streams(), 0); + CPPUNIT_ASSERT_EQUAL(p->max_streams(), 5); + CPPUNIT_ASSERT_EQUAL(p->sizeof_stream_item(0), 1); + CPPUNIT_ASSERT_EQUAL(p->sizeof_stream_item(1), 2); + CPPUNIT_ASSERT_EQUAL(p->sizeof_stream_item(2), 3); + CPPUNIT_ASSERT_EQUAL(p->sizeof_stream_item(3), 3); + CPPUNIT_ASSERT_EQUAL(p->sizeof_stream_item(4), 3); +} diff --git a/gnuradio-runtime/lib/qa_gr_io_signature.h b/gnuradio-runtime/lib/qa_io_signature.h index 9cd6bb5247..981ad03b59 100644 --- a/gnuradio-runtime/lib/qa_gr_io_signature.h +++ b/gnuradio-runtime/lib/qa_io_signature.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -27,20 +27,20 @@ #include <cppunit/TestCase.h> #include <stdexcept> -class qa_gr_io_signature : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_io_signature); - CPPUNIT_TEST (t0); - CPPUNIT_TEST_EXCEPTION (t1, std::invalid_argument); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); +class qa_io_signature : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(qa_io_signature); + CPPUNIT_TEST(t0); + CPPUNIT_TEST_EXCEPTION(t1, std::invalid_argument); + CPPUNIT_TEST(t2); + CPPUNIT_TEST(t3); + CPPUNIT_TEST_SUITE_END(); private: - void t0 (); - void t1 (); - void t2 (); - void t3 (); + void t0(); + void t1(); + void t2(); + void t3(); }; #endif /* INCLUDED_QA_GR_IO_SIGNATURE_H */ diff --git a/gnuradio-runtime/lib/qa_gr_logger.cc b/gnuradio-runtime/lib/qa_logger.cc index a8e4a1d766..b147b36da1 100644 --- a/gnuradio-runtime/lib/qa_gr_logger.cc +++ b/gnuradio-runtime/lib/qa_logger.cc @@ -29,11 +29,11 @@ #include <config.h> #endif -#include <qa_gr_logger.h> -#include <gr_logger.h> +#include <qa_logger.h> +#include <gnuradio/logger.h> void -qa_gr_logger::t1() +qa_logger::t1() { #ifdef ENABLE_GR_LOG // This doesn't really test anything, more just diff --git a/gnuradio-runtime/lib/qa_gr_logger.h b/gnuradio-runtime/lib/qa_logger.h index b0d3711523..35f7f1f6c4 100644 --- a/gnuradio-runtime/lib/qa_gr_logger.h +++ b/gnuradio-runtime/lib/qa_logger.h @@ -28,15 +28,15 @@ //! collect all the tests for the example directory -class qa_gr_logger : public CppUnit::TestCase { - public: - CPPUNIT_TEST_SUITE(qa_gr_logger); +class qa_logger : public CppUnit::TestCase +{ +public: + CPPUNIT_TEST_SUITE(qa_logger); CPPUNIT_TEST(t1); CPPUNIT_TEST_SUITE_END(); private: void t1(); - }; #endif /* INCLUDED_QA_GR_LOG_H */ diff --git a/gnuradio-runtime/lib/qa_runtime.cc b/gnuradio-runtime/lib/qa_runtime.cc index b15051c2ad..dbf7e5bb9a 100644 --- a/gnuradio-runtime/lib/qa_runtime.cc +++ b/gnuradio-runtime/lib/qa_runtime.cc @@ -30,32 +30,32 @@ #endif #include <qa_runtime.h> -#include <qa_gr_buffer.h> -#include <qa_gr_circular_file.h> -#include <qa_gr_fxpt.h> -#include <qa_gr_fxpt_nco.h> -#include <qa_gr_fxpt_vco.h> -#include <qa_gr_io_signature.h> -#include <qa_gr_logger.h> -#include <qa_gr_math.h> -#include <qa_gr_vmcircbuf.h> +#include <qa_buffer.h> +#include <qa_io_signature.h> +#include <qa_circular_file.h> +#include <qa_fxpt.h> +#include <qa_fxpt_nco.h> +#include <qa_fxpt_vco.h> +#include <qa_logger.h> +#include <qa_math.h> +#include <qa_vmcircbuf.h> #include <qa_sincos.h> CppUnit::TestSuite * -qa_runtime::suite () +qa_runtime::suite() { - CppUnit::TestSuite *s = new CppUnit::TestSuite ("runtime"); + CppUnit::TestSuite *s = new CppUnit::TestSuite("runtime"); - s->addTest (qa_gr_buffer::suite ()); - s->addTest (qa_gr_circular_file::suite ()); - s->addTest (qa_gr_fxpt::suite ()); - s->addTest (qa_gr_fxpt_nco::suite ()); - s->addTest (qa_gr_fxpt_vco::suite ()); - s->addTest (qa_gr_io_signature::suite ()); - s->addTest (qa_gr_logger::suite ()); - s->addTest (qa_gr_math::suite ()); - s->addTest (qa_gr_vmcircbuf::suite ()); - s->addTest (qa_sincos::suite ()); + s->addTest(qa_buffer::suite()); + s->addTest(qa_io_signature::suite()); + s->addTest(qa_circular_file::suite()); + s->addTest(qa_fxpt::suite()); + s->addTest(qa_fxpt_nco::suite()); + s->addTest(qa_fxpt_vco::suite()); + s->addTest(qa_logger::suite()); + s->addTest(qa_math::suite()); + s->addTest(qa_vmcircbuf::suite()); + s->addTest(qa_sincos::suite()); return s; } diff --git a/gnuradio-runtime/lib/qa_runtime.h b/gnuradio-runtime/lib/qa_runtime.h index b03e3db721..a1e58190d6 100644 --- a/gnuradio-runtime/lib/qa_runtime.h +++ b/gnuradio-runtime/lib/qa_runtime.h @@ -23,7 +23,7 @@ #ifndef _QA_RUNTIME_H_ #define _QA_RUNTIME_H_ -#include <attributes.h> +#include <gnuradio/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for the runtime directory diff --git a/gnuradio-runtime/lib/qa_gr_vmcircbuf.cc b/gnuradio-runtime/lib/qa_vmcircbuf.cc index e3b36d8829..7301b4cf17 100644 --- a/gnuradio-runtime/lib/qa_gr_vmcircbuf.cc +++ b/gnuradio-runtime/lib/qa_vmcircbuf.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,17 +24,17 @@ #include <config.h> #endif -#include <qa_gr_vmcircbuf.h> +#include <qa_vmcircbuf.h> #include <cppunit/TestAssert.h> -#include <gr_vmcircbuf.h> +#include "vmcircbuf.h" #include <stdio.h> void -qa_gr_vmcircbuf::test_all () +qa_vmcircbuf::test_all() { - int verbose = 1; // summary + int verbose = 1; // summary - bool ok = gr_vmcircbuf_sysconfig::test_all_factories (verbose); + bool ok = gr::vmcircbuf_sysconfig::test_all_factories(verbose); - CPPUNIT_ASSERT_EQUAL (true, ok); + CPPUNIT_ASSERT_EQUAL(true, ok); } diff --git a/gnuradio-runtime/lib/qa_gr_circular_file.h b/gnuradio-runtime/lib/qa_vmcircbuf.h index df35ab077b..93f46cf4a8 100644 --- a/gnuradio-runtime/lib/qa_gr_circular_file.h +++ b/gnuradio-runtime/lib/qa_vmcircbuf.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,22 +19,21 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -#ifndef _QA_GR_CIRCULAR_FILE_H_ -#define _QA_GR_CIRCULAR_FILE_H_ + +#ifndef QA_GR_VMCIRCBUF_H +#define QA_GR_VMCIRCBUF_H #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -class qa_gr_circular_file : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_circular_file); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - void t1 (); +class qa_vmcircbuf : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(qa_vmcircbuf); + CPPUNIT_TEST(test_all); + CPPUNIT_TEST_SUITE_END(); +private: + void test_all(); }; - -#endif /* _QA_GR_CIRCULAR_FILE_H_ */ +#endif /* QA_GR_VMCIRCBUF_H */ diff --git a/gnuradio-runtime/lib/random.h b/gnuradio-runtime/lib/random.h deleted file mode 100644 index c643c3e422..0000000000 --- a/gnuradio-runtime/lib/random.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003, 2008 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. - */ - -#ifndef _RANDOM_H_ -#define _RANDOM_H_ - -// While rand(3) specifies RAND_MAX, random(3) says that the output -// ranges from 0 to 2^31-1 but does not specify a macro to denote -// this. We define RANDOM_MAX for cleanliness. We must omit the -// definition for systems that have made the same choice. (Note that -// random(3) is from 4.2BSD, and not specified by POSIX.) - -#ifndef RANDOM_MAX -static const int RANDOM_MAX = 2147483647; // 2^31-1 -#endif /* RANDOM_MAX */ - -#include <stdlib.h> - -#endif // _RANDOM_H_ diff --git a/gnuradio-runtime/lib/realtime.cc b/gnuradio-runtime/lib/realtime.cc index 5dadc26bbd..e3fea1c6a6 100644 --- a/gnuradio-runtime/lib/realtime.cc +++ b/gnuradio-runtime/lib/realtime.cc @@ -24,155 +24,14 @@ #include <config.h> #endif -#include <realtime.h> - -#ifdef HAVE_SCHED_H -#include <sched.h> -#endif - -#include <algorithm> -#include <math.h> -#include <string.h> -#include <errno.h> -#include <stdio.h> - -#if defined(HAVE_PTHREAD_SETSCHEDPARAM) || defined(HAVE_SCHED_SETSCHEDULER) -#include <pthread.h> - -namespace gr { - - /*! - * Rescale our virtual priority so that it maps to the middle 1/2 of - * the priorities given by min_real_pri and max_real_pri. - */ - static int - rescale_virtual_pri(int virtual_pri, int min_real_pri, int max_real_pri) - { - float rmin = min_real_pri + (0.25 * (max_real_pri - min_real_pri)); - float rmax = min_real_pri + (0.75 * (max_real_pri - min_real_pri)); - float m = (rmax - rmin) / (rt_priority_max() - rt_priority_min()); - float y = m * (virtual_pri - rt_priority_min()) + rmin; - int y_int = static_cast<int>(rint(y)); - return std::max(min_real_pri, std::min(max_real_pri, y_int)); - } - -} // namespace gr - -#endif - - -#if defined(HAVE_PTHREAD_SETSCHEDPARAM) - -namespace gr { - - rt_status_t - enable_realtime_scheduling(rt_sched_param p) - { - int policy = p.policy == RT_SCHED_FIFO ? SCHED_FIFO : SCHED_RR; - int min_real_pri = sched_get_priority_min(policy); - int max_real_pri = sched_get_priority_max(policy); - int pri = rescale_virtual_pri(p.priority, min_real_pri, max_real_pri); - - // FIXME check hard and soft limits with getrlimit, and limit the value we ask for. - // fprintf(stderr, "pthread_setschedparam: policy = %d, pri = %d\n", policy, pri); - - struct sched_param param; - memset (¶m, 0, sizeof (param)); - param.sched_priority = pri; - int result = pthread_setschedparam (pthread_self(), policy, ¶m); - if (result != 0) { - if (result == EPERM) // N.B., return value, not errno - return RT_NO_PRIVS; - else { - fprintf(stderr, - "pthread_setschedparam: failed to set real time priority: %s\n", - strerror(result)); - return RT_OTHER_ERROR; - } - } - - //printf("SCHED_FIFO enabled with priority = %d\n", pri); - return RT_OK; - } -} // namespace gr - - -#elif defined(HAVE_SCHED_SETSCHEDULER) - -namespace gr { - - rt_status_t - enable_realtime_scheduling(rt_sched_param p) - { - int policy = p.policy == RT_SCHED_FIFO ? SCHED_FIFO : SCHED_RR; - int min_real_pri = sched_get_priority_min(policy); - int max_real_pri = sched_get_priority_max(policy); - int pri = rescale_virtual_pri(p.priority, min_real_pri, max_real_pri); - - // FIXME check hard and soft limits with getrlimit, and limit the value we ask for. - // fprintf(stderr, "sched_setscheduler: policy = %d, pri = %d\n", policy, pri); - - int pid = 0; // this process - struct sched_param param; - memset(¶m, 0, sizeof(param)); - param.sched_priority = pri; - int result = sched_setscheduler(pid, policy, ¶m); - if (result != 0){ - if (errno == EPERM) - return RT_NO_PRIVS; - else { - perror ("sched_setscheduler: failed to set real time priority"); - return RT_OTHER_ERROR; - } - } - - //printf("SCHED_FIFO enabled with priority = %d\n", pri); - return RT_OK; - } - -} // namespace gr - -#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) - -#include <windows.h> - -namespace gr { - - rt_status_t enable_realtime_scheduling(rt_sched_param p){ - - //set the priority class on the process - int pri_class = (true)? REALTIME_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS; - if (SetPriorityClass(GetCurrentProcess(), pri_class) == 0) - return RT_OTHER_ERROR; - - //scale the priority value to the constants - int priorities[] = { - THREAD_PRIORITY_IDLE, THREAD_PRIORITY_LOWEST, THREAD_PRIORITY_BELOW_NORMAL, THREAD_PRIORITY_NORMAL, - THREAD_PRIORITY_ABOVE_NORMAL, THREAD_PRIORITY_HIGHEST, THREAD_PRIORITY_TIME_CRITICAL - }; - const double priority = double(p.priority)/(rt_priority_max() - rt_priority_min()); - size_t pri_index = size_t((priority+1.0)*6/2.0); // -1 -> 0, +1 -> 6 - pri_index %= sizeof(priorities)/sizeof(*priorities); //range check - - //set the thread priority on the thread - if (SetThreadPriority(GetCurrentThread(), priorities[pri_index]) == 0) - return RT_OTHER_ERROR; - - //printf("SetPriorityClass + SetThreadPriority\n"); - return RT_OK; - } - -} // namespace gr - -#else +#include <gnuradio/realtime.h> namespace gr { - + rt_status_t - enable_realtime_scheduling(rt_sched_param p) + enable_realtime_scheduling() { - return RT_NOT_IMPLEMENTED; + return gr::enable_realtime_scheduling(); } -} // namespace gr -#endif +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/realtime_impl.cc b/gnuradio-runtime/lib/realtime_impl.cc new file mode 100644 index 0000000000..5dadc26bbd --- /dev/null +++ b/gnuradio-runtime/lib/realtime_impl.cc @@ -0,0 +1,178 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2007,2008 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. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <realtime.h> + +#ifdef HAVE_SCHED_H +#include <sched.h> +#endif + +#include <algorithm> +#include <math.h> +#include <string.h> +#include <errno.h> +#include <stdio.h> + +#if defined(HAVE_PTHREAD_SETSCHEDPARAM) || defined(HAVE_SCHED_SETSCHEDULER) +#include <pthread.h> + +namespace gr { + + /*! + * Rescale our virtual priority so that it maps to the middle 1/2 of + * the priorities given by min_real_pri and max_real_pri. + */ + static int + rescale_virtual_pri(int virtual_pri, int min_real_pri, int max_real_pri) + { + float rmin = min_real_pri + (0.25 * (max_real_pri - min_real_pri)); + float rmax = min_real_pri + (0.75 * (max_real_pri - min_real_pri)); + float m = (rmax - rmin) / (rt_priority_max() - rt_priority_min()); + float y = m * (virtual_pri - rt_priority_min()) + rmin; + int y_int = static_cast<int>(rint(y)); + return std::max(min_real_pri, std::min(max_real_pri, y_int)); + } + +} // namespace gr + +#endif + + +#if defined(HAVE_PTHREAD_SETSCHEDPARAM) + +namespace gr { + + rt_status_t + enable_realtime_scheduling(rt_sched_param p) + { + int policy = p.policy == RT_SCHED_FIFO ? SCHED_FIFO : SCHED_RR; + int min_real_pri = sched_get_priority_min(policy); + int max_real_pri = sched_get_priority_max(policy); + int pri = rescale_virtual_pri(p.priority, min_real_pri, max_real_pri); + + // FIXME check hard and soft limits with getrlimit, and limit the value we ask for. + // fprintf(stderr, "pthread_setschedparam: policy = %d, pri = %d\n", policy, pri); + + struct sched_param param; + memset (¶m, 0, sizeof (param)); + param.sched_priority = pri; + int result = pthread_setschedparam (pthread_self(), policy, ¶m); + if (result != 0) { + if (result == EPERM) // N.B., return value, not errno + return RT_NO_PRIVS; + else { + fprintf(stderr, + "pthread_setschedparam: failed to set real time priority: %s\n", + strerror(result)); + return RT_OTHER_ERROR; + } + } + + //printf("SCHED_FIFO enabled with priority = %d\n", pri); + return RT_OK; + } +} // namespace gr + + +#elif defined(HAVE_SCHED_SETSCHEDULER) + +namespace gr { + + rt_status_t + enable_realtime_scheduling(rt_sched_param p) + { + int policy = p.policy == RT_SCHED_FIFO ? SCHED_FIFO : SCHED_RR; + int min_real_pri = sched_get_priority_min(policy); + int max_real_pri = sched_get_priority_max(policy); + int pri = rescale_virtual_pri(p.priority, min_real_pri, max_real_pri); + + // FIXME check hard and soft limits with getrlimit, and limit the value we ask for. + // fprintf(stderr, "sched_setscheduler: policy = %d, pri = %d\n", policy, pri); + + int pid = 0; // this process + struct sched_param param; + memset(¶m, 0, sizeof(param)); + param.sched_priority = pri; + int result = sched_setscheduler(pid, policy, ¶m); + if (result != 0){ + if (errno == EPERM) + return RT_NO_PRIVS; + else { + perror ("sched_setscheduler: failed to set real time priority"); + return RT_OTHER_ERROR; + } + } + + //printf("SCHED_FIFO enabled with priority = %d\n", pri); + return RT_OK; + } + +} // namespace gr + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) + +#include <windows.h> + +namespace gr { + + rt_status_t enable_realtime_scheduling(rt_sched_param p){ + + //set the priority class on the process + int pri_class = (true)? REALTIME_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS; + if (SetPriorityClass(GetCurrentProcess(), pri_class) == 0) + return RT_OTHER_ERROR; + + //scale the priority value to the constants + int priorities[] = { + THREAD_PRIORITY_IDLE, THREAD_PRIORITY_LOWEST, THREAD_PRIORITY_BELOW_NORMAL, THREAD_PRIORITY_NORMAL, + THREAD_PRIORITY_ABOVE_NORMAL, THREAD_PRIORITY_HIGHEST, THREAD_PRIORITY_TIME_CRITICAL + }; + const double priority = double(p.priority)/(rt_priority_max() - rt_priority_min()); + size_t pri_index = size_t((priority+1.0)*6/2.0); // -1 -> 0, +1 -> 6 + pri_index %= sizeof(priorities)/sizeof(*priorities); //range check + + //set the thread priority on the thread + if (SetThreadPriority(GetCurrentThread(), priorities[pri_index]) == 0) + return RT_OTHER_ERROR; + + //printf("SetPriorityClass + SetThreadPriority\n"); + return RT_OK; + } + +} // namespace gr + +#else + +namespace gr { + + rt_status_t + enable_realtime_scheduling(rt_sched_param p) + { + return RT_NOT_IMPLEMENTED; + } +} // namespace gr + +#endif diff --git a/gnuradio-runtime/lib/runtime_block_gateway.cc b/gnuradio-runtime/lib/runtime_block_gateway.cc deleted file mode 100644 index 11d16af41e..0000000000 --- a/gnuradio-runtime/lib/runtime_block_gateway.cc +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 2011-2012 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. - */ - -#include <runtime_block_gateway.h> -#include <gr_io_signature.h> -#include <iostream> -#include <boost/bind.hpp> - -/*********************************************************************** - * Helper routines - **********************************************************************/ -template <typename OutType, typename InType> -void copy_pointers(OutType &out, const InType &in){ - out.resize(in.size()); - for (size_t i = 0; i < in.size(); i++){ - out[i] = (void *)(in[i]); - } -} - -/*********************************************************************** - * The gr_block gateway implementation class - **********************************************************************/ -class runtime_block_gateway_impl : public runtime_block_gateway{ -public: - runtime_block_gateway_impl( - gr_feval_ll *handler, - const std::string &name, - gr_io_signature_sptr in_sig, - gr_io_signature_sptr out_sig, - const gr_block_gw_work_type work_type, - const unsigned factor - ): - gr_block(name, in_sig, out_sig), - _handler(handler), - _work_type(work_type) - { - switch(_work_type){ - case GR_BLOCK_GW_WORK_GENERAL: - _decim = 1; //not relevant, but set anyway - _interp = 1; //not relevant, but set anyway - break; - - case GR_BLOCK_GW_WORK_SYNC: - _decim = 1; - _interp = 1; - this->set_fixed_rate(true); - break; - - case GR_BLOCK_GW_WORK_DECIM: - _decim = factor; - _interp = 1; - break; - - case GR_BLOCK_GW_WORK_INTERP: - _decim = 1; - _interp = factor; - this->set_output_multiple(_interp); - break; - } - } - - /******************************************************************* - * Overloads for various scheduler-called functions - ******************************************************************/ - void forecast( - int noutput_items, - gr_vector_int &ninput_items_required - ){ - switch(_work_type){ - case GR_BLOCK_GW_WORK_GENERAL: - _message.action = gr_block_gw_message_type::ACTION_FORECAST; - _message.forecast_args_noutput_items = noutput_items; - _message.forecast_args_ninput_items_required = ninput_items_required; - _handler->calleval(0); - ninput_items_required = _message.forecast_args_ninput_items_required; - return; - - default: - unsigned ninputs = ninput_items_required.size(); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = fixed_rate_noutput_to_ninput(noutput_items); - return; - } - } - - int general_work( - int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ){ - switch(_work_type){ - case GR_BLOCK_GW_WORK_GENERAL: - _message.action = gr_block_gw_message_type::ACTION_GENERAL_WORK; - _message.general_work_args_noutput_items = noutput_items; - _message.general_work_args_ninput_items = ninput_items; - copy_pointers(_message.general_work_args_input_items, input_items); - _message.general_work_args_output_items = output_items; - _handler->calleval(0); - return _message.general_work_args_return_value; - - default: - int r = work (noutput_items, input_items, output_items); - if (r > 0) consume_each(r*_decim/_interp); - return r; - } - } - - int work( - int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ){ - _message.action = gr_block_gw_message_type::ACTION_WORK; - _message.work_args_ninput_items = fixed_rate_noutput_to_ninput(noutput_items); - if (_message.work_args_ninput_items == 0) return -1; - _message.work_args_noutput_items = noutput_items; - copy_pointers(_message.work_args_input_items, input_items); - _message.work_args_output_items = output_items; - _handler->calleval(0); - return _message.work_args_return_value; - } - - int fixed_rate_noutput_to_ninput(int noutput_items){ - return (noutput_items*_decim/_interp) + history() - 1; - } - - int fixed_rate_ninput_to_noutput(int ninput_items){ - return std::max(0, ninput_items - (int)history() + 1)*_interp/_decim; - } - - bool start(void){ - _message.action = gr_block_gw_message_type::ACTION_START; - _handler->calleval(0); - return _message.start_args_return_value; - } - - bool stop(void){ - _message.action = gr_block_gw_message_type::ACTION_STOP; - _handler->calleval(0); - return _message.stop_args_return_value; - } - - gr_block_gw_message_type &gr_block_message(void){ - return _message; - } - -private: - gr_feval_ll *_handler; - gr_block_gw_message_type _message; - const gr_block_gw_work_type _work_type; - unsigned _decim, _interp; -}; - -boost::shared_ptr<runtime_block_gateway> runtime_make_block_gateway( - gr_feval_ll *handler, - const std::string &name, - gr_io_signature_sptr in_sig, - gr_io_signature_sptr out_sig, - const gr_block_gw_work_type work_type, - const unsigned factor -){ - return boost::shared_ptr<runtime_block_gateway>( - new runtime_block_gateway_impl(handler, name, in_sig, out_sig, - work_type, factor) - ); -} diff --git a/gnuradio-runtime/lib/gr_scheduler.cc b/gnuradio-runtime/lib/scheduler.cc index c691f5d99f..38d95e6fb2 100644 --- a/gnuradio-runtime/lib/gr_scheduler.cc +++ b/gnuradio-runtime/lib/scheduler.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008 Free Software Foundation, Inc. + * Copyright 2008,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,12 +22,18 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif -#include <gr_scheduler.h> -gr_scheduler::gr_scheduler(gr_flat_flowgraph_sptr ffg, int max_noutput_items) -{ -} +#include "scheduler.h" -gr_scheduler::~gr_scheduler() -{ -} +namespace gr { + + scheduler::scheduler(flat_flowgraph_sptr ffg, + int max_noutput_items) + { + } + + scheduler::~scheduler() + { + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/scheduler.h b/gnuradio-runtime/lib/scheduler.h new file mode 100644 index 0000000000..575862b27d --- /dev/null +++ b/gnuradio-runtime/lib/scheduler.h @@ -0,0 +1,68 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2013 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef INCLUDED_GR_SCHEDULER_H +#define INCLUDED_GR_SCHEDULER_H + +#include <gnuradio/api.h> +#include <boost/utility.hpp> +#include <gnuradio/block.h> +#include "flat_flowgraph.h" + +namespace gr { + + class scheduler; + typedef boost::shared_ptr<scheduler> scheduler_sptr; + + /*! + * \brief Abstract scheduler that takes a flattened flow graph and + * runs it. + * + * Preconditions: details, buffers and buffer readers have been + * assigned. + */ + class GR_RUNTIME_API scheduler : boost::noncopyable + { + public: + /*! + * \brief Construct a scheduler and begin evaluating the graph. + * + * The scheduler will continue running until all blocks until they + * report that they are done or the stop method is called. + */ + scheduler(flat_flowgraph_sptr ffg, int max_noutput_items); + + virtual ~scheduler(); + + /*! + * \brief Tell the scheduler to stop executing. + */ + virtual void stop() = 0; + + /*! + * \brief Block until the graph is done. + */ + virtual void wait() = 0; + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_SCHEDULER_H */ diff --git a/gnuradio-runtime/lib/scheduler_sts.cc b/gnuradio-runtime/lib/scheduler_sts.cc new file mode 100644 index 0000000000..19d05b2316 --- /dev/null +++ b/gnuradio-runtime/lib/scheduler_sts.cc @@ -0,0 +1,90 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2013 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "scheduler_sts.h" +#include "single_threaded_scheduler.h" +#include <gnuradio/thread/thread_body_wrapper.h> + +namespace gr { + + class sts_container + { + block_vector_t d_blocks; + + public: + sts_container(block_vector_t blocks) + : d_blocks(blocks) {} + + void operator()() + { + make_single_threaded_scheduler(d_blocks)->run(); + } + }; + + scheduler_sptr + scheduler_sts::make(flat_flowgraph_sptr ffg, int max_noutput_items) + { + return scheduler_sptr(new scheduler_sts(ffg, max_noutput_items)); + } + + scheduler_sts::scheduler_sts(flat_flowgraph_sptr ffg, int max_noutput_items) + : scheduler(ffg, max_noutput_items) + { + // Split the flattened flow graph into discrete partitions, each + // of which is topologically sorted. + + std::vector<basic_block_vector_t> graphs = ffg->partition(); + + // For each partition, create a thread to evaluate it using + // an instance of the gr_single_threaded_scheduler + + for(std::vector<basic_block_vector_t>::iterator p = graphs.begin(); + p != graphs.end(); p++) { + + block_vector_t blocks = flat_flowgraph::make_block_vector(*p); + d_threads.create_thread( + gr::thread::thread_body_wrapper<sts_container>(sts_container(blocks), + "single-threaded-scheduler")); + } + } + + scheduler_sts::~scheduler_sts() + { + stop(); + } + + void + scheduler_sts::stop() + { + d_threads.interrupt_all(); + } + + void + scheduler_sts::wait() + { + d_threads.join_all(); + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/scheduler_sts.h b/gnuradio-runtime/lib/scheduler_sts.h new file mode 100644 index 0000000000..b4cddb4614 --- /dev/null +++ b/gnuradio-runtime/lib/scheduler_sts.h @@ -0,0 +1,66 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2013 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef INCLUDED_GR_SCHEDULER_STS_H +#define INCLUDED_GR_SCHEDULER_STS_H + +#include <gnuradio/api.h> +#include <gnuradio/thread/thread_group.h> +#include "scheduler.h" + +namespace gr { + + /*! + * \brief Concrete scheduler that uses the single_threaded_scheduler + */ + class GR_RUNTIME_API scheduler_sts : public scheduler + { + gr::thread::thread_group d_threads; + + protected: + /*! + * \brief Construct a scheduler and begin evaluating the graph. + * + * The scheduler will continue running until all blocks until they + * report that they are done or the stop method is called. + */ + scheduler_sts(flat_flowgraph_sptr ffg, int max_noutput_items); + + public: + static scheduler_sptr make(flat_flowgraph_sptr ffg, + int max_noutput_items); + + ~scheduler_sts(); + + /*! + * \brief Tell the scheduler to stop executing. + */ + void stop(); + + /*! + * \brief Block until the graph is done. + */ + void wait(); + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_SCHEDULER_STS_H */ diff --git a/gnuradio-runtime/lib/scheduler_tpb.cc b/gnuradio-runtime/lib/scheduler_tpb.cc new file mode 100644 index 0000000000..d35c37fb34 --- /dev/null +++ b/gnuradio-runtime/lib/scheduler_tpb.cc @@ -0,0 +1,106 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2013 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "scheduler_tpb.h" +#include "tpb_thread_body.h" +#include <gnuradio/thread/thread_body_wrapper.h> +#include <sstream> + +namespace gr { + + class tpb_container + { + block_sptr d_block; + int d_max_noutput_items; + + public: + tpb_container(block_sptr block, int max_noutput_items) + : d_block(block), d_max_noutput_items(max_noutput_items) {} + + void operator()() + { + tpb_thread_body body(d_block, d_max_noutput_items); + } + }; + + scheduler_sptr + scheduler_tpb::make(flat_flowgraph_sptr ffg, int max_noutput_items) + { + return scheduler_sptr(new scheduler_tpb(ffg, max_noutput_items)); + } + + scheduler_tpb::scheduler_tpb(flat_flowgraph_sptr ffg, + int max_noutput_items) + : scheduler(ffg, max_noutput_items) + { + // Get a topologically sorted vector of all the blocks in use. + // Being topologically sorted probably isn't going to matter, but + // there's a non-zero chance it might help... + + basic_block_vector_t used_blocks = ffg->calc_used_blocks(); + used_blocks = ffg->topological_sort(used_blocks); + block_vector_t blocks = flat_flowgraph::make_block_vector(used_blocks); + + // Ensure that the done flag is clear on all blocks + + for(size_t i = 0; i < blocks.size(); i++) { + blocks[i]->detail()->set_done(false); + } + + // Fire off a thead for each block + + for(size_t i = 0; i < blocks.size(); i++) { + std::stringstream name; + name << "thread-per-block[" << i << "]: " << blocks[i]; + + // If set, use internal value instead of global value + if(blocks[i]->is_set_max_noutput_items()) + max_noutput_items = blocks[i]->max_noutput_items(); + + d_threads.create_thread( + gr::thread::thread_body_wrapper<tpb_container> + (tpb_container(blocks[i], max_noutput_items), + name.str())); + } + } + + scheduler_tpb::~scheduler_tpb() + { + stop(); + } + + void + scheduler_tpb::stop() + { + d_threads.interrupt_all(); + } + + void + scheduler_tpb::wait() + { + d_threads.join_all(); + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/scheduler_tpb.h b/gnuradio-runtime/lib/scheduler_tpb.h new file mode 100644 index 0000000000..f5ab21f269 --- /dev/null +++ b/gnuradio-runtime/lib/scheduler_tpb.h @@ -0,0 +1,66 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2013 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef INCLUDED_GR_SCHEDULER_TPB_H +#define INCLUDED_GR_SCHEDULER_TPB_H + +#include <gnuradio/api.h> +#include <gnuradio/thread/thread_group.h> +#include "scheduler.h" + +namespace gr { + + /*! + * \brief Concrete scheduler that uses a kernel thread-per-block + */ + class GR_RUNTIME_API scheduler_tpb : public scheduler + { + gr::thread::thread_group d_threads; + + protected: + /*! + * \brief Construct a scheduler and begin evaluating the graph. + * + * The scheduler will continue running until all blocks until they + * report that they are done or the stop method is called. + */ + scheduler_tpb(flat_flowgraph_sptr ffg, int max_noutput_items); + + public: + static scheduler_sptr make(flat_flowgraph_sptr ffg, + int max_noutput_items=100000); + + ~scheduler_tpb(); + + /*! + * \brief Tell the scheduler to stop executing. + */ + void stop(); + + /*! + * \brief Block until the graph is done. + */ + void wait(); + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_SCHEDULER_TPB_H */ diff --git a/gnuradio-runtime/lib/single_threaded_scheduler.cc b/gnuradio-runtime/lib/single_threaded_scheduler.cc new file mode 100644 index 0000000000..c86d26ca3a --- /dev/null +++ b/gnuradio-runtime/lib/single_threaded_scheduler.cc @@ -0,0 +1,363 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "single_threaded_scheduler.h" +#include <gnuradio/block.h> +#include <gnuradio/block_detail.h> +#include <gnuradio/buffer.h> +#include <boost/thread.hpp> +#include <boost/format.hpp> +#include <iostream> +#include <limits> +#include <assert.h> +#include <stdio.h> + +namespace gr { + + // must be defined to either 0 or 1 +#define ENABLE_LOGGING 0 + +#if (ENABLE_LOGGING) +#define LOG(x) do { x; } while(0) +#else +#define LOG(x) do {;} while(0) +#endif + + static int which_scheduler = 0; + + single_threaded_scheduler_sptr + make_single_threaded_scheduler(const std::vector<block_sptr> &blocks) + { + return single_threaded_scheduler_sptr + (new single_threaded_scheduler(blocks)); + } + + single_threaded_scheduler::single_threaded_scheduler(const std::vector<block_sptr> &blocks) + : d_blocks(blocks), d_enabled(true), d_log(0) + { + if(ENABLE_LOGGING) { + std::string name = str(boost::format("sst-%d.log") % which_scheduler++); + d_log = new std::ofstream(name.c_str()); + *d_log << "single_threaded_scheduler: " + << d_blocks.size () + << " blocks\n"; + } + } + + single_threaded_scheduler::~single_threaded_scheduler() + { + if(ENABLE_LOGGING) + delete d_log; + } + + void + single_threaded_scheduler::run() + { + // d_enabled = true; // KLUDGE + main_loop (); + } + + void + single_threaded_scheduler::stop() + { + if(0) + std::cout << "gr_singled_threaded_scheduler::stop() " + << this << std::endl; + d_enabled = false; + } + + inline static unsigned int + round_up(unsigned int n, unsigned int multiple) + { + return ((n + multiple - 1) / multiple) * multiple; + } + + inline static unsigned int + round_down(unsigned int n, unsigned int multiple) + { + return (n / multiple) * multiple; + } + + // + // Return minimum available write space in all our downstream + // buffers or -1 if we're output blocked and the output we're + // blocked on is done. + // + static int + min_available_space(block_detail *d, int output_multiple) + { + int min_space = std::numeric_limits<int>::max(); + + for(int i = 0; i < d->noutputs (); i++) { + int n = round_down (d->output(i)->space_available (), output_multiple); + if(n == 0) { // We're blocked on output. + if(d->output(i)->done()) { // Downstream is done, therefore we're done. + return -1; + } + return 0; + } + min_space = std::min (min_space, n); + } + return min_space; + } + + void + single_threaded_scheduler::main_loop() + { + static const int DEFAULT_CAPACITY = 16; + + int noutput_items; + gr_vector_int ninput_items_required(DEFAULT_CAPACITY); + gr_vector_int ninput_items(DEFAULT_CAPACITY); + gr_vector_const_void_star input_items(DEFAULT_CAPACITY); + gr_vector_void_star output_items(DEFAULT_CAPACITY); + unsigned int bi; + unsigned int nalive; + int max_items_avail; + bool made_progress_last_pass; + bool making_progress; + + for(unsigned i = 0; i < d_blocks.size (); i++) + d_blocks[i]->detail()->set_done (false); // reset any done flags + + for(unsigned i = 0; i < d_blocks.size (); i++) // enable any drivers, etc. + d_blocks[i]->start(); + + bi = 0; + made_progress_last_pass = true; + making_progress = false; + + // Loop while there are still blocks alive + + nalive = d_blocks.size (); + while(d_enabled && nalive > 0) { + if(boost::this_thread::interruption_requested()) + break; + + block *m = d_blocks[bi].get (); + block_detail *d = m->detail().get (); + + LOG(*d_log << std::endl << m); + + if(d->done ()) + goto next_block; + + if(d->source_p ()) { + // Invoke sources as a last resort. As long as the previous + // pass made progress, don't call a source. + if(made_progress_last_pass) { + LOG(*d_log << " Skipping source\n"); + goto next_block; + } + + ninput_items_required.resize (0); + ninput_items.resize (0); + input_items.resize (0); + output_items.resize (d->noutputs ()); + + // determine the minimum available output space + noutput_items = min_available_space (d, m->output_multiple ()); + LOG(*d_log << " source\n noutput_items = " << noutput_items << std::endl); + if(noutput_items == -1) // we're done + goto were_done; + + if(noutput_items == 0) { // we're output blocked + LOG(*d_log << " BLKD_OUT\n"); + goto next_block; + } + + goto setup_call_to_work; // jump to common code + } + + else if(d->sink_p ()) { + ninput_items_required.resize (d->ninputs ()); + ninput_items.resize (d->ninputs ()); + input_items.resize (d->ninputs ()); + output_items.resize (0); + LOG(*d_log << " sink\n"); + + max_items_avail = 0; + for(int i = 0; i < d->ninputs (); i++) { + ninput_items[i] = d->input(i)->items_available(); + //if (ninput_items[i] == 0 && d->input(i)->done()) + if(ninput_items[i] < m->output_multiple() && d->input(i)->done()) + goto were_done; + + max_items_avail = std::max (max_items_avail, ninput_items[i]); + } + + // take a swag at how much output we can sink + noutput_items = (int) (max_items_avail * m->relative_rate ()); + noutput_items = round_down (noutput_items, m->output_multiple ()); + LOG(*d_log << " max_items_avail = " << max_items_avail << std::endl); + LOG(*d_log << " noutput_items = " << noutput_items << std::endl); + + if(noutput_items == 0) { // we're blocked on input + LOG(*d_log << " BLKD_IN\n"); + goto next_block; + } + + goto try_again; // Jump to code shared with regular case. + } + + else { + // do the regular thing + ninput_items_required.resize(d->ninputs ()); + ninput_items.resize(d->ninputs ()); + input_items.resize(d->ninputs ()); + output_items.resize(d->noutputs ()); + + max_items_avail = 0; + for(int i = 0; i < d->ninputs (); i++) { + ninput_items[i] = d->input(i)->items_available (); + max_items_avail = std::max(max_items_avail, ninput_items[i]); + } + + // determine the minimum available output space + noutput_items = min_available_space(d, m->output_multiple ()); + if(ENABLE_LOGGING){ + *d_log << " regular "; + if(m->relative_rate() >= 1.0) + *d_log << "1:" << m->relative_rate() << std::endl; + else + *d_log << 1.0/m->relative_rate() << ":1\n"; + *d_log << " max_items_avail = " << max_items_avail << std::endl; + *d_log << " noutput_items = " << noutput_items << std::endl; + } + if(noutput_items == -1) // we're done + goto were_done; + + if(noutput_items == 0) { // we're output blocked + LOG(*d_log << " BLKD_OUT\n"); + goto next_block; + } + +#if 0 + // Compute best estimate of noutput_items that we can really use. + noutput_items = + std::min((unsigned)noutput_items, + std::max((unsigned)m->output_multiple(), + round_up((unsigned)(max_items_avail * m->relative_rate()), + m->output_multiple()))); + + LOG(*d_log << " revised noutput_items = " << noutput_items << std::endl); +#endif + + try_again: + if(m->fixed_rate()) { + // try to work it forward starting with max_items_avail. + // We want to try to consume all the input we've got. + int reqd_noutput_items = m->fixed_rate_ninput_to_noutput(max_items_avail); + reqd_noutput_items = round_up(reqd_noutput_items, m->output_multiple()); + if(reqd_noutput_items > 0 && reqd_noutput_items <= noutput_items) + noutput_items = reqd_noutput_items; + } + + // ask the block how much input they need to produce noutput_items + m->forecast(noutput_items, ninput_items_required); + + // See if we've got sufficient input available + int i; + for(i = 0; i < d->ninputs (); i++) + if(ninput_items_required[i] > ninput_items[i]) // not enough + break; + + if(i < d->ninputs()) { // not enough input on input[i] + // if we can, try reducing the size of our output request + if(noutput_items > m->output_multiple ()){ + noutput_items /= 2; + noutput_items = round_up (noutput_items, m->output_multiple ()); + goto try_again; + } + + // We're blocked on input + LOG(*d_log << " BLKD_IN\n"); + if(d->input(i)->done()) // If the upstream block is done, we're done + goto were_done; + + // Is it possible to ever fulfill this request? + if(ninput_items_required[i] > d->input(i)->max_possible_items_available ()) { + // Nope, never going to happen... + std::cerr << "\nsched: <block " << m->name() + << " (" << m->unique_id() << ")>" + << " is requesting more input data\n" + << " than we can provide.\n" + << " ninput_items_required = " + << ninput_items_required[i] << "\n" + << " max_possible_items_available = " + << d->input(i)->max_possible_items_available() << "\n" + << " If this is a filter, consider reducing the number of taps.\n"; + goto were_done; + } + + goto next_block; + } + + // We've got enough data on each input to produce noutput_items. + // Finish setting up the call to work. + for(int i = 0; i < d->ninputs (); i++) + input_items[i] = d->input(i)->read_pointer(); + + setup_call_to_work: + + for(int i = 0; i < d->noutputs (); i++) + output_items[i] = d->output(i)->write_pointer(); + + // Do the actual work of the block + int n = m->general_work(noutput_items, ninput_items, + input_items, output_items); + LOG(*d_log << " general_work: noutput_items = " << noutput_items + << " result = " << n << std::endl); + + if(n == -1) // block is done + goto were_done; + + d->produce_each(n); // advance write pointers + if(n > 0) + making_progress = true; + + goto next_block; + } + assert(0); + + were_done: + LOG(*d_log << " were_done\n"); + d->set_done (true); + nalive--; + + next_block: + if(++bi >= d_blocks.size ()) { + bi = 0; + made_progress_last_pass = making_progress; + making_progress = false; + } + } + + for(unsigned i = 0; i < d_blocks.size(); i++) // disable any drivers, etc. + d_blocks[i]->stop(); + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/include/gr_single_threaded_scheduler.h b/gnuradio-runtime/lib/single_threaded_scheduler.h index d538fa3921..eccbf03b36 100644 --- a/gnuradio-runtime/include/gr_single_threaded_scheduler.h +++ b/gnuradio-runtime/lib/single_threaded_scheduler.h @@ -23,40 +23,43 @@ #ifndef INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H #define INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H -#include <gr_runtime_api.h> -#include <gr_runtime_types.h> +#include <gnuradio/api.h> +#include <gnuradio/runtime_types.h> #include <fstream> -class gr_single_threaded_scheduler; -typedef boost::shared_ptr<gr_single_threaded_scheduler> gr_single_threaded_scheduler_sptr; +namespace gr { + class single_threaded_scheduler; + typedef boost::shared_ptr<single_threaded_scheduler> single_threaded_scheduler_sptr; -/*! - * \brief Simple scheduler for stream computations. - * \ingroup internal - */ + /*! + * \brief Simple scheduler for stream computations. + * \ingroup internal + */ + class GR_RUNTIME_API single_threaded_scheduler + { + public: + ~single_threaded_scheduler(); -class GR_RUNTIME_API gr_single_threaded_scheduler { - public: - ~gr_single_threaded_scheduler (); + void run(); + void stop(); - void run (); - void stop (); + private: + const std::vector<block_sptr> d_blocks; + volatile bool d_enabled; + std::ofstream *d_log; - private: - const std::vector<gr_block_sptr> d_blocks; - volatile bool d_enabled; - std::ofstream *d_log; + single_threaded_scheduler(const std::vector<block_sptr> &blocks); - gr_single_threaded_scheduler (const std::vector<gr_block_sptr> &blocks); + void main_loop(); - void main_loop (); + friend GR_RUNTIME_API single_threaded_scheduler_sptr + make_single_threaded_scheduler(const std::vector<block_sptr> &blocks); + }; - friend GR_RUNTIME_API gr_single_threaded_scheduler_sptr - gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &blocks); -}; + GR_RUNTIME_API single_threaded_scheduler_sptr + make_single_threaded_scheduler(const std::vector<block_sptr> &blocks); -GR_RUNTIME_API gr_single_threaded_scheduler_sptr -gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &blocks); +} /* namespace gr */ #endif /* INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H */ diff --git a/gnuradio-runtime/lib/gr_sptr_magic.cc b/gnuradio-runtime/lib/sptr_magic.cc index 2073701422..70596abb05 100644 --- a/gnuradio-runtime/lib/gr_sptr_magic.cc +++ b/gnuradio-runtime/lib/sptr_magic.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008,2009 Free Software Foundation, Inc. + * Copyright 2008,2009,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -18,54 +18,54 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifdef HAVE_CONFIG_H #include <config.h> #endif -#include <gr_sptr_magic.h> -#include <gr_hier_block2.h> + +#include <gnuradio/sptr_magic.h> +#include <gnuradio/hier_block2.h> #include <map> #include <stdexcept> - -#include <thread/thread.h> +#include <gnuradio/thread/thread.h> namespace gnuradio { - static gr::thread::mutex s_mutex; - typedef std::map<gr_basic_block*, gr_basic_block_sptr> sptr_map; - static sptr_map s_map; + static gr::thread::mutex s_mutex; + typedef std::map<gr::basic_block*, gr::basic_block_sptr> sptr_map; + static sptr_map s_map; void - detail::sptr_magic::create_and_stash_initial_sptr(gr_hier_block2 *p) + detail::sptr_magic::create_and_stash_initial_sptr(gr::hier_block2 *p) { - gr_basic_block_sptr sptr(p); + gr::basic_block_sptr sptr(p); gr::thread::scoped_lock guard(s_mutex); - s_map.insert(sptr_map::value_type(static_cast<gr_basic_block *>(p), sptr)); + s_map.insert(sptr_map::value_type(static_cast<gr::basic_block *>(p), sptr)); } - - gr_basic_block_sptr - detail::sptr_magic::fetch_initial_sptr(gr_basic_block *p) + gr::basic_block_sptr + detail::sptr_magic::fetch_initial_sptr(gr::basic_block *p) { /* - * If p isn't a subclass of gr_hier_block2, just create the + * If p isn't a subclass of gr::hier_block2, just create the * shared ptr and return it. */ - gr_hier_block2 *hb2 = dynamic_cast<gr_hier_block2 *>(p); - if (!hb2){ - return gr_basic_block_sptr(p); + gr::hier_block2 *hb2 = dynamic_cast<gr::hier_block2 *>(p); + if(!hb2) { + return gr::basic_block_sptr(p); } /* - * p is a subclass of gr_hier_block2, thus we've already created the shared pointer + * p is a subclass of gr::hier_block2, thus we've already created the shared pointer * and stashed it away. Fish it out and return it. */ gr::thread::scoped_lock guard(s_mutex); - sptr_map::iterator pos = s_map.find(static_cast<gr_basic_block *>(p)); - if (pos == s_map.end()) - throw std::invalid_argument("gr_sptr_magic: invalid pointer!"); + sptr_map::iterator pos = s_map.find(static_cast<gr::basic_block *>(p)); + if(pos == s_map.end()) + throw std::invalid_argument("sptr_magic: invalid pointer!"); - gr_basic_block_sptr sptr = pos->second; + gr::basic_block_sptr sptr = pos->second; s_map.erase(pos); return sptr; } diff --git a/gnuradio-runtime/lib/sync_block.cc b/gnuradio-runtime/lib/sync_block.cc new file mode 100644 index 0000000000..e00b80c79e --- /dev/null +++ b/gnuradio-runtime/lib/sync_block.cc @@ -0,0 +1,72 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/sync_block.h> + +namespace gr { + + sync_block::sync_block(const std::string &name, + io_signature::sptr input_signature, + io_signature::sptr output_signature) + : block(name, input_signature, output_signature) + { + set_fixed_rate(true); + } + + void + sync_block::forecast(int noutput_items, + gr_vector_int &ninput_items_required) + { + unsigned ninputs = ninput_items_required.size(); + for(unsigned i = 0; i < ninputs; i++) + ninput_items_required[i] = fixed_rate_noutput_to_ninput(noutput_items); + } + + int + sync_block::fixed_rate_noutput_to_ninput(int noutput_items) + { + return noutput_items + history() - 1; + } + + int + sync_block::fixed_rate_ninput_to_noutput(int ninput_items) + { + return std::max(0, ninput_items - (int)history() + 1); + } + + int + sync_block::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + int r = work(noutput_items, input_items, output_items); + if(r > 0) + consume_each(r); + return r; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/sync_decimator.cc b/gnuradio-runtime/lib/sync_decimator.cc new file mode 100644 index 0000000000..a9c2d1eeff --- /dev/null +++ b/gnuradio-runtime/lib/sync_decimator.cc @@ -0,0 +1,72 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/sync_decimator.h> + +namespace gr { + + sync_decimator::sync_decimator(const std::string &name, + io_signature::sptr input_signature, + io_signature::sptr output_signature, + unsigned decimation) + : sync_block(name, input_signature, output_signature) + { + set_decimation(decimation); + } + + void + sync_decimator::forecast(int noutput_items, gr_vector_int &ninput_items_required) + { + unsigned ninputs = ninput_items_required.size(); + for(unsigned i = 0; i < ninputs; i++) + ninput_items_required[i] = fixed_rate_noutput_to_ninput(noutput_items); + } + + int + sync_decimator::fixed_rate_noutput_to_ninput(int noutput_items) + { + return noutput_items * decimation() + history() - 1; + } + + int + sync_decimator::fixed_rate_ninput_to_noutput(int ninput_items) + { + return std::max(0, ninput_items - (int)history() + 1) / decimation(); + } + + int + sync_decimator::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + int r = work(noutput_items, input_items, output_items); + if(r > 0) + consume_each(r * decimation ()); + return r; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/sync_interpolator.cc b/gnuradio-runtime/lib/sync_interpolator.cc new file mode 100644 index 0000000000..5721f24f0f --- /dev/null +++ b/gnuradio-runtime/lib/sync_interpolator.cc @@ -0,0 +1,73 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2008,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/sync_interpolator.h> + +namespace gr { + + sync_interpolator::sync_interpolator(const std::string &name, + io_signature::sptr input_signature, + io_signature::sptr output_signature, + unsigned interpolation) + : sync_block(name, input_signature, output_signature) + { + set_interpolation(interpolation); + } + + void + sync_interpolator::forecast(int noutput_items, + gr_vector_int &ninput_items_required) + { + unsigned ninputs = ninput_items_required.size(); + for(unsigned i = 0; i < ninputs; i++) + ninput_items_required[i] = fixed_rate_noutput_to_ninput(noutput_items); + } + + int + sync_interpolator::fixed_rate_noutput_to_ninput(int noutput_items) + { + return noutput_items / interpolation() + history() - 1; + } + + int + sync_interpolator::fixed_rate_ninput_to_noutput(int ninput_items) + { + return std::max(0, ninput_items - (int)history() + 1) * interpolation(); + } + + int + sync_interpolator::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + int r = work(noutput_items, input_items, output_items); + if(r > 0) + consume_each(r / interpolation()); + return r; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/gr_sys_paths.cc b/gnuradio-runtime/lib/sys_paths.cc index b4918af33d..64853c68b2 100644 --- a/gnuradio-runtime/lib/gr_sys_paths.cc +++ b/gnuradio-runtime/lib/sys_paths.cc @@ -1,5 +1,5 @@ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,37 +19,47 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_sys_paths.h> +#include <gnuradio/sys_paths.h> #include <cstdlib> //getenv #include <cstdio> //P_tmpdir (maybe) -const char *gr_tmp_path(){ +namespace gr { + + const char *tmp_path() + { const char *path; //first case, try TMP environment variable path = getenv("TMP"); - if (path) return path; + if(path) + return path; //second case, try P_tmpdir when its defined #ifdef P_tmpdir - if (P_tmpdir) return P_tmpdir; + if(P_tmpdir) + return P_tmpdir; #endif /*P_tmpdir*/ //fall-through case, nothing worked return "/tmp"; -} + } -const char *gr_appdata_path(){ + const char *appdata_path() + { const char *path; //first case, try HOME environment variable (unix) path = getenv("HOME"); - if (path) return path; + if(path) + return path; //second case, try APPDATA environment variable (windows) path = getenv("APPDATA"); - if (path) return path; + if(path) + return path; //fall-through case, nothing worked - return gr_tmp_path(); -} + return tmp_path(); + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/tagged_stream_block.cc b/gnuradio-runtime/lib/tagged_stream_block.cc new file mode 100644 index 0000000000..40febfdeca --- /dev/null +++ b/gnuradio-runtime/lib/tagged_stream_block.cc @@ -0,0 +1,144 @@ +/* -*- c++ -*- */ +/* + * Copyright 2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <boost/format.hpp> +#include <gnuradio/tagged_stream_block.h> + +namespace gr { + + tagged_stream_block::tagged_stream_block(const std::string &name, + io_signature::sptr input_signature, + io_signature::sptr output_signature, + const std::string &length_tag_key) + : block(name, input_signature, output_signature), + d_length_tag_key(pmt::string_to_symbol(length_tag_key)), + d_n_input_items_reqd(input_signature->min_streams(), 0), + d_length_tag_key_str(length_tag_key) + { + } + + // This is evil hackery: We trick the scheduler into creating the right number of input items + void + tagged_stream_block::forecast(int noutput_items, + gr_vector_int &ninput_items_required) + { + unsigned ninputs = ninput_items_required.size(); + for(unsigned i = 0; i < ninputs; i++) { + if (i < d_n_input_items_reqd.size() && d_n_input_items_reqd[i] != 0) { + ninput_items_required[i] = d_n_input_items_reqd[i]; + } + else { + // If there's no item, there's no tag--so there must at least be one! + ninput_items_required[i] = std::max(1, (int)std::floor((double) noutput_items / relative_rate() + 0.5)); + } + } + } + + void + tagged_stream_block::parse_length_tags(const std::vector<std::vector<tag_t> > &tags, + gr_vector_int &n_input_items_reqd) + { + for(unsigned i = 0; i < tags.size(); i++) { + for(unsigned k = 0; k < tags[i].size(); k++) { + if(tags[i][k].key == d_length_tag_key) { + n_input_items_reqd[i] = pmt::to_long(tags[i][k].value); + remove_item_tag(i, tags[i][k]); + } + } + } + } + + int + tagged_stream_block::calculate_output_stream_length(const gr_vector_int &ninput_items) + { + int noutput_items = *std::max_element(ninput_items.begin(), ninput_items.end()); + return (int)std::floor(relative_rate() * noutput_items + 0.5); + } + + void + tagged_stream_block::update_length_tags(int n_produced, int n_ports) + { + for(int i = 0; i < n_ports; i++) { + add_item_tag(i, nitems_written(i), + d_length_tag_key, + pmt::from_long(n_produced)); + } + return; + } + + int + tagged_stream_block::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + if(d_length_tag_key_str.empty()) { + return work(noutput_items, ninput_items, input_items, output_items); + } + + if(d_n_input_items_reqd[0] == 0) { // Otherwise, it's already set from a previous call + std::vector<std::vector<tag_t> > tags(input_items.size(), std::vector<tag_t>()); + for(unsigned i = 0; i < input_items.size(); i++) { + get_tags_in_range(tags[i], i, nitems_read(i), nitems_read(i)+1); + } + d_n_input_items_reqd.assign(input_items.size(), -1); + parse_length_tags(tags, d_n_input_items_reqd); + } + for(unsigned i = 0; i < input_items.size(); i++) { + if(d_n_input_items_reqd[i] == -1) { + GR_LOG_FATAL(d_logger, boost::format("Missing a required length tag on port %1% at item #%2%") % i % nitems_read(i)); + throw std::runtime_error("Missing length tag."); + } + if(d_n_input_items_reqd[i] > ninput_items[i]) { + return 0; + } + } + + int min_output_size = calculate_output_stream_length(d_n_input_items_reqd); + if(noutput_items < min_output_size) { + set_min_noutput_items(min_output_size); + return 0; + } + set_min_noutput_items(1); + + // WORK CALLED HERE // + int n_produced = work(noutput_items, d_n_input_items_reqd, input_items, output_items); + ////////////////////// + + if(n_produced == WORK_DONE) { + return n_produced; + } + for(int i = 0; i < (int) d_n_input_items_reqd.size(); i++) { + consume(i, d_n_input_items_reqd[i]); + } + update_length_tags(n_produced, output_items.size()); + + d_n_input_items_reqd.assign(input_items.size(), 0); + + return n_produced; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/test.cc b/gnuradio-runtime/lib/test.cc new file mode 100644 index 0000000000..775dc2bde4 --- /dev/null +++ b/gnuradio-runtime/lib/test.cc @@ -0,0 +1,181 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2008,2010,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "test.h" +#include <gnuradio/io_signature.h> +#include <stdexcept> +#include <iostream> +#include <string.h> + +namespace gr { + + test_sptr + make_test(const std::string &name, + int min_inputs, int max_inputs, unsigned int sizeof_input_item, + int min_outputs, int max_outputs, unsigned int sizeof_output_item, + unsigned int history, unsigned int output_multiple, double relative_rate, + bool fixed_rate, consume_type_t cons_type, produce_type_t prod_type) + { + return gnuradio::get_initial_sptr + (new test(name, min_inputs, max_inputs, sizeof_input_item, + min_outputs, max_outputs, sizeof_output_item, + history, output_multiple, relative_rate, + fixed_rate,cons_type, prod_type)); + } + + test::test(const std::string &name, + int min_inputs, int max_inputs, + unsigned int sizeof_input_item, + int min_outputs, int max_outputs, + unsigned int sizeof_output_item, + unsigned int history, + unsigned int output_multiple, + double relative_rate, + bool fixed_rate, + consume_type_t cons_type, produce_type_t prod_type) + : block (name, + io_signature::make(min_inputs, max_inputs, sizeof_input_item), + io_signature::make(min_outputs, max_outputs, sizeof_output_item)), + d_sizeof_input_item(sizeof_input_item), + d_sizeof_output_item(sizeof_output_item), + d_check_topology(true), + d_consume_type(cons_type), + d_min_consume(0), + d_max_consume(0), + d_produce_type(prod_type), + d_min_produce(0), + d_max_produce(0) + { + set_history(history); + set_output_multiple(output_multiple); + set_relative_rate(relative_rate); + set_fixed_rate(fixed_rate); + } + + int + test::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + //touch all inputs and outputs to detect segfaults + unsigned ninputs = input_items.size (); + unsigned noutputs= output_items.size(); + for(unsigned i = 0; i < ninputs; i++) { + char * in=(char *)input_items[i]; + if(ninput_items[i]< (int)(noutput_items+history())) { + std::cerr << "ERROR: ninput_items[" << i << "] < noutput_items+history()" << std::endl; + std::cerr << "ninput_items[" << i << "] = " << ninput_items[i] << std::endl; + std::cerr << "noutput_items+history() = " << noutput_items+history() << std::endl; + std::cerr << "noutput_items = " << noutput_items << std::endl; + std::cerr << "history() = " << history() << std::endl; + throw std::runtime_error ("test"); + } + else { + for (int j = 0; j < ninput_items[i]; j++) { + //Touch every available input_item + //We use a class variable to avoid the compiler to optimize this away + for(unsigned int k = 0; k < d_sizeof_input_item; k++) + d_temp= in[j*d_sizeof_input_item+k]; + } + switch(d_consume_type){ + case CONSUME_NOUTPUT_ITEMS: + consume(i,noutput_items); + break; + case CONSUME_NOUTPUT_ITEMS_LIMIT_MAX: + consume(i,std::min(noutput_items,d_max_consume)); + break; + case CONSUME_NOUTPUT_ITEMS_LIMIT_MIN: + consume(i,std::min(std::max(noutput_items,d_min_consume),ninput_items[i])); + break; + case CONSUME_ALL_AVAILABLE: + consume(i,ninput_items[i]); + break; + case CONSUME_ALL_AVAILABLE_LIMIT_MAX: + consume(i,std::min(ninput_items[i],d_max_consume)); + break; +/* //This could result in segfault, uncomment if you want to test this + case CONSUME_ALL_AVAILABLE_LIMIT_MIN: + consume(i,std::max(ninput_items[i],d_max_consume)); + break;*/ + case CONSUME_ZERO: + consume(i,0); + break; + case CONSUME_ONE: + consume(i,1); + break; + case CONSUME_MINUS_ONE: + consume(i,-1); + break; + default: + consume(i,noutput_items); + } + } + } + for(unsigned i = 0; i < noutputs; i++) { + char * out=(char *)output_items[i]; + { + for(int j=0;j<noutput_items;j++) { + //Touch every available output_item + for(unsigned int k=0;k<d_sizeof_output_item;k++) + out[j*d_sizeof_input_item+k]=0; + } + } + } + //Now copy input to output until max ninputs or max noutputs is reached + int common_nports=std::min(ninputs,noutputs); + if(d_sizeof_output_item==d_sizeof_input_item) + for(int i = 0; i < common_nports; i++) { + memcpy(output_items[i],input_items[i],noutput_items*d_sizeof_input_item); + } + int noutput_items_produced=0; + switch(d_produce_type) { + case PRODUCE_NOUTPUT_ITEMS: + noutput_items_produced=noutput_items; + break; + case PRODUCE_NOUTPUT_ITEMS_LIMIT_MAX: + noutput_items_produced=std::min(noutput_items,d_max_produce); + break; +/* //This could result in segfault, uncomment if you want to test this + case PRODUCE_NOUTPUT_ITEMS_LIMIT_MIN: + noutput_items_produced=std::max(noutput_items,d_min_produce); + break;*/ + case PRODUCE_ZERO: + noutput_items_produced=0; + break; + case PRODUCE_ONE: + noutput_items_produced=1; + break; + case PRODUCE_MINUS_ONE: + noutput_items_produced=-1; + break; + default: + noutput_items_produced=noutput_items; + } + return noutput_items_produced; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/test.h b/gnuradio-runtime/lib/test.h new file mode 100644 index 0000000000..cbe42f94e8 --- /dev/null +++ b/gnuradio-runtime/lib/test.h @@ -0,0 +1,225 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2013 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. + */ + +#ifndef INCLUDED_GR_TEST_H +#define INCLUDED_GR_TEST_H + +#include <gnuradio/api.h> +#include <gnuradio/block.h> +#include <string> +#include "test_types.h" + +namespace gr { + + class test; + typedef boost::shared_ptr<test> test_sptr; + + // public constructor + GR_RUNTIME_API test_sptr + make_test(const std::string &name=std::string("test"), + int min_inputs=1, int max_inputs=1, unsigned int sizeof_input_item=1, + int min_outputs=1, int max_outputs=1, unsigned int sizeof_output_item=1, + unsigned int history=1,unsigned int output_multiple=1,double relative_rate=1.0, + bool fixed_rate=true,consume_type_t cons_type=CONSUME_NOUTPUT_ITEMS, + produce_type_t prod_type=PRODUCE_NOUTPUT_ITEMS); + + /*! + * \brief Test class for testing runtime system (setting up buffers and such.) + * \ingroup misc + * + * This block does not do any usefull actual data processing. It + * just exposes setting all standard block parameters using the + * contructor or public methods. + * + * This block can be usefull when testing the runtime system. + * You can force this block to have a large history, decimation + * factor and/or large output_multiple. + * The runtime system should detect this and create large enough buffers + * all through the signal chain. + */ + class GR_RUNTIME_API test : public block + { + public: + ~test() {} + + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + // ---------------------------------------------------------------- + // override these to define your behavior + // ---------------------------------------------------------------- + + /*! + * \brief Estimate input requirements given output request + * + * \param noutput_items number of output items to produce + * \param ninput_items_required number of input items required on each input stream + * + * Given a request to product \p noutput_items, estimate the + * number of data items required on each input stream. The + * estimate doesn't have to be exact, but should be close. + */ + void forecast(int noutput_items, + gr_vector_int &ninput_items_required) + { + unsigned ninputs = ninput_items_required.size(); + for(unsigned i = 0; i < ninputs; i++) + ninput_items_required[i] = (int)((double)noutput_items / relative_rate()) + (int)history(); + } + + /*! + * \brief Force check topology to return true or false. + * + * \param check_topology value to return when check_topology is + * called (true or false) default check_topology returns true + */ + void set_check_topology(bool check_topology) { + d_check_topology=check_topology; + } + + /*! + * \brief Confirm that ninputs and noutputs is an acceptable combination. + * + * \param ninputs number of input streams connected + * \param noutputs number of output streams connected + * + * \returns true if this is a valid configuration for this block. + * + * This function is called by the runtime system whenever the + * topology changes. Most classes do not need to override this. + * This check is in addition to the constraints specified by the + * input and output gr::io_signatures. + */ + bool check_topology(int ninputs, int noutputs) { + return d_check_topology; + } + + // ---------------------------------------------------------------- + /* + * The following two methods provide special case info to the + * scheduler in the event that a block has a fixed input to output + * ratio. gr::sync_block, gr::sync_decimator and + * gr::sync_interpolator override these. If you're fixed rate, + * subclass one of those. + */ + /*! + * \brief Given ninput samples, return number of output samples + * that will be produced. N.B. this is only defined if fixed_rate + * returns true. Generally speaking, you don't need to override + * this. + */ + int fixed_rate_ninput_to_noutput(int ninput) { + return (int)((double)ninput/relative_rate()); + } + + /*! + * \brief Given noutput samples, return number of input samples + * required to produce noutput. N.B. this is only defined if + * fixed_rate returns true. + */ + int fixed_rate_noutput_to_ninput(int noutput) { + return (int)((double)noutput*relative_rate()); + } + + /*! + * \brief Set if fixed rate should return true. + * N.B. This is normally a private method but we make it available here as public. + */ + void set_fixed_rate_public(bool fixed_rate) { + set_fixed_rate(fixed_rate); + } + + /*! + * \brief Set the consume pattern. + * + * \param cons_type which consume pattern to use + */ + void set_consume_type(consume_type_t cons_type) { + d_consume_type=cons_type; + } + + /*! + * \brief Set the consume limit. + * + * \param limit min or maximum items to consume (depending on + * consume_type) + */ + void set_consume_limit(unsigned int limit) { + d_min_consume=limit; d_max_consume=limit; + } + + /*! + * \brief Set the produce pattern. + * + * \param prod_type which produce pattern to use + */ + void set_produce_type(produce_type_t prod_type) { + d_produce_type=prod_type; + } + + /*! + * \brief Set the produce limit. + * + * \param limit min or maximum items to produce (depending on + * produce_type) + */ + void set_produce_limit(unsigned int limit) { + d_min_produce=limit; d_max_produce=limit; + } + + // ---------------------------------------------------------------------------- + + protected: + unsigned int d_sizeof_input_item; + unsigned int d_sizeof_output_item; + bool d_check_topology; + char d_temp; + consume_type_t d_consume_type; + int d_min_consume; + int d_max_consume; + produce_type_t d_produce_type; + int d_min_produce; + int d_max_produce; + test(const std::string &name,int min_inputs, int max_inputs, + unsigned int sizeof_input_item, + int min_outputs, int max_outputs, unsigned int sizeof_output_item, + unsigned int history, unsigned int output_multiple, double relative_rate, + bool fixed_rate, consume_type_t cons_type, produce_type_t prod_type); + + friend GR_RUNTIME_API test_sptr make_test(const std::string &name, + int min_inputs, int max_inputs, + unsigned int sizeof_input_item, + int min_outputs, int max_outputs, + unsigned int sizeof_output_item, + unsigned int history, + unsigned int output_multiple, + double relative_rate, + bool fixed_rate, + consume_type_t cons_type, + produce_type_t prod_type); + }; + +} /* namespace gr */ + +#endif /* INCLUDED_TEST_H */ diff --git a/gnuradio-runtime/lib/test_runtime.cc b/gnuradio-runtime/lib/test_runtime.cc index 7dc7b17ea0..1285302eb4 100644 --- a/gnuradio-runtime/lib/test_runtime.cc +++ b/gnuradio-runtime/lib/test_runtime.cc @@ -27,9 +27,8 @@ #include <cppunit/TextTestRunner.h> #include <cppunit/XmlOutputter.h> -#include <gr_unittests.h> +#include <gnuradio/unittests.h> #include <qa_runtime.h> -#include <pmt/qa_pmt.h> int main (int argc, char **argv) @@ -39,7 +38,6 @@ main (int argc, char **argv) CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest(qa_runtime::suite()); - runner.addTest(qa_pmt::suite()); runner.setOutputter(xmlout); bool was_successful = runner.run("", false); diff --git a/gnuradio-runtime/lib/gr_test_types.h b/gnuradio-runtime/lib/test_types.h index 04f38f7b26..868a9e62a3 100644 --- a/gnuradio-runtime/lib/gr_test_types.h +++ b/gnuradio-runtime/lib/test_types.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,28 +19,33 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ + #ifndef INCLUDED_GR_TEST_TYPES_H #define INCLUDED_GR_TEST_TYPES_H -typedef enum { - CONSUME_NOUTPUT_ITEMS=0, - CONSUME_NOUTPUT_ITEMS_LIMIT_MAX=1, - CONSUME_NOUTPUT_ITEMS_LIMIT_MIN=2, - CONSUME_ALL_AVAILABLE=3, - CONSUME_ALL_AVAILABLE_LIMIT_MAX=4, - /*CONSUME_ALL_AVAILABLE_LIMIT_MIN=5,*/ - CONSUME_ZERO=6, - CONSUME_ONE=7, - CONSUME_MINUS_ONE=8 - } gr_consume_type_t; +namespace gr { + + typedef enum { + CONSUME_NOUTPUT_ITEMS=0, + CONSUME_NOUTPUT_ITEMS_LIMIT_MAX=1, + CONSUME_NOUTPUT_ITEMS_LIMIT_MIN=2, + CONSUME_ALL_AVAILABLE=3, + CONSUME_ALL_AVAILABLE_LIMIT_MAX=4, + /*CONSUME_ALL_AVAILABLE_LIMIT_MIN=5,*/ + CONSUME_ZERO=6, + CONSUME_ONE=7, + CONSUME_MINUS_ONE=8 + } consume_type_t; + + typedef enum { + PRODUCE_NOUTPUT_ITEMS=0, + PRODUCE_NOUTPUT_ITEMS_LIMIT_MAX=1, + /*PRODUCE_NOUTPUT_ITEMS_LIMIT_MIN=2,*/ + PRODUCE_ZERO=6, + PRODUCE_ONE=7, + PRODUCE_MINUS_ONE=8 + } produce_type_t; -typedef enum { - PRODUCE_NOUTPUT_ITEMS=0, - PRODUCE_NOUTPUT_ITEMS_LIMIT_MAX=1, - /*PRODUCE_NOUTPUT_ITEMS_LIMIT_MIN=2,*/ - PRODUCE_ZERO=6, - PRODUCE_ONE=7, - PRODUCE_MINUS_ONE=8 - } gr_produce_type_t; +} /* namespace gr */ #endif /* INCLUDED_GR_TEST_TYPES_H */ diff --git a/gnuradio-runtime/lib/thread/thread.cc b/gnuradio-runtime/lib/thread/thread.cc index af0822445d..1727dc6621 100644 --- a/gnuradio-runtime/lib/thread/thread.cc +++ b/gnuradio-runtime/lib/thread/thread.cc @@ -23,7 +23,7 @@ #include <config.h> #endif -#include <thread/thread.h> +#include <gnuradio/thread/thread.h> #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) diff --git a/gnuradio-runtime/lib/thread/thread_body_wrapper.cc b/gnuradio-runtime/lib/thread/thread_body_wrapper.cc index 47feafdd42..e23b7d15d0 100644 --- a/gnuradio-runtime/lib/thread/thread_body_wrapper.cc +++ b/gnuradio-runtime/lib/thread/thread_body_wrapper.cc @@ -23,7 +23,7 @@ #include <config.h> #endif -#include <thread/thread_body_wrapper.h> +#include <gnuradio/thread/thread_body_wrapper.h> #ifdef HAVE_SIGNAL_H #include <signal.h> diff --git a/gnuradio-runtime/lib/thread/thread_group.cc b/gnuradio-runtime/lib/thread/thread_group.cc index 034fe82e75..e467dfda5a 100644 --- a/gnuradio-runtime/lib/thread/thread_group.cc +++ b/gnuradio-runtime/lib/thread/thread_group.cc @@ -12,7 +12,7 @@ * This was extracted from Boost 1.35.0 and fixed. */ -#include <thread/thread_group.h> +#include <gnuradio/thread/thread_group.h> namespace gr { namespace thread { diff --git a/gnuradio-runtime/lib/top_block.cc b/gnuradio-runtime/lib/top_block.cc new file mode 100644 index 0000000000..8d2e42bb12 --- /dev/null +++ b/gnuradio-runtime/lib/top_block.cc @@ -0,0 +1,167 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "top_block_impl.h" +#include <gnuradio/top_block.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/prefs.h> +#include <unistd.h> +#include <iostream> + +namespace gr { + top_block_sptr + make_top_block(const std::string &name) + { + return gnuradio::get_initial_sptr + (new top_block(name)); + } + + top_block::top_block(const std::string &name) + : hier_block2(name, + io_signature::make(0,0,0), + io_signature::make(0,0,0)) + { + d_impl = new top_block_impl(this); + } + + top_block::~top_block() + { + stop(); + wait(); + + delete d_impl; + } + + void + top_block::start(int max_noutput_items) + { + d_impl->start(max_noutput_items); + + if(prefs::singleton()->get_bool("ControlPort", "on", false)) { + setup_rpc(); + } + } + + void + top_block::stop() + { + d_impl->stop(); + } + + void + top_block::wait() + { + d_impl->wait(); + } + + void + top_block::run(int max_noutput_items) + { + start(max_noutput_items); + wait(); + } + + void + top_block::lock() + { + d_impl->lock(); + } + + void + top_block::unlock() + { + d_impl->unlock(); + } + + std::string + top_block::edge_list() + { + return d_impl->edge_list(); + } + + void + top_block::dump() + { + d_impl->dump(); + } + + int + top_block::max_noutput_items() + { + return d_impl->max_noutput_items(); + } + + void + top_block::set_max_noutput_items(int nmax) + { + d_impl->set_max_noutput_items(nmax); + } + + top_block_sptr + top_block::to_top_block() + { + return cast_to_top_block_sptr(shared_from_this()); + } + + void + top_block::setup_rpc() + { +#ifdef GR_CTRLPORT + if(is_rpc_set()) + return; + + // Getters + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<top_block, int>( + alias(), "max noutput_items", + &top_block::max_noutput_items, + pmt::mp(0), pmt::mp(8192), pmt::mp(8192), + "items", "Max number of output items", + RPC_PRIVLVL_MIN, DISPNULL))); + + if(prefs::singleton()->get_bool("ControlPort", "edges_list", false)) { + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<top_block, std::string>( + alias(), "edge list", + &top_block::edge_list, + pmt::mp(""), pmt::mp(""), pmt::mp(""), + "edges", "List of edges in the graph", + RPC_PRIVLVL_MIN, DISPNULL))); + } + + // Setters + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<top_block, int>( + alias(), "max noutput_items", + &top_block::set_max_noutput_items, + pmt::mp(0), pmt::mp(8192), pmt::mp(8192), + "items", "Max number of output items", + RPC_PRIVLVL_MIN, DISPNULL))); + rpc_set(); +#endif /* GR_CTRLPORT */ + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/top_block_impl.cc b/gnuradio-runtime/lib/top_block_impl.cc new file mode 100644 index 0000000000..9d377f469f --- /dev/null +++ b/gnuradio-runtime/lib/top_block_impl.cc @@ -0,0 +1,212 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2008,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "top_block_impl.h" +#include "flat_flowgraph.h" +#include "scheduler_sts.h" +#include "scheduler_tpb.h" +#include <gnuradio/top_block.h> +#include <gnuradio/prefs.h> + +#include <stdexcept> +#include <iostream> +#include <string.h> +#include <unistd.h> +#include <stdlib.h> + +namespace gr { + +#define GR_TOP_BLOCK_IMPL_DEBUG 0 + + typedef scheduler_sptr(*scheduler_maker)(flat_flowgraph_sptr ffg, + int max_noutput_items); + + static struct scheduler_table { + const char *name; + scheduler_maker f; + } scheduler_table[] = { + { "TPB", scheduler_tpb::make }, // first entry is default + { "STS", scheduler_sts::make } + }; + + static scheduler_sptr + make_scheduler(flat_flowgraph_sptr ffg, int max_noutput_items) + { + static scheduler_maker factory = 0; + + if(factory == 0) { + char *v = getenv("GR_SCHEDULER"); + if(!v) + factory = scheduler_table[0].f; // use default + else { + for(size_t i = 0; i < sizeof(scheduler_table)/sizeof(scheduler_table[0]); i++) { + if(strcmp(v, scheduler_table[i].name) == 0) { + factory = scheduler_table[i].f; + break; + } + } + if(factory == 0) { + std::cerr << "warning: Invalid GR_SCHEDULER environment variable value \"" + << v << "\". Using \"" << scheduler_table[0].name << "\"\n"; + factory = scheduler_table[0].f; + } + } + } + return factory(ffg, max_noutput_items); + } + + top_block_impl::top_block_impl(top_block *owner) + : d_owner(owner), d_ffg(), + d_state(IDLE), d_lock_count(0) + { + } + + top_block_impl::~top_block_impl() + { + d_owner = 0; + } + + void + top_block_impl::start(int max_noutput_items) + { + gr::thread::scoped_lock l(d_mutex); + + d_max_noutput_items = max_noutput_items; + + if(d_state != IDLE) + throw std::runtime_error("top_block::start: top block already running or wait() not called after previous stop()"); + + if(d_lock_count > 0) + throw std::runtime_error("top_block::start: can't start with flow graph locked"); + + // Create new flat flow graph by flattening hierarchy + d_ffg = d_owner->flatten(); + + // Validate new simple flow graph and wire it up + d_ffg->validate(); + d_ffg->setup_connections(); + + // Only export perf. counters if ControlPort config param is + // enabled and if the PerfCounter option 'export' is turned on. + prefs *p = prefs::singleton(); + if(p->get_bool("ControlPort", "on", false) && p->get_bool("PerfCounters", "export", false)) + d_ffg->enable_pc_rpc(); + + d_scheduler = make_scheduler(d_ffg, d_max_noutput_items); + d_state = RUNNING; + } + + void + top_block_impl::stop() + { + if(d_scheduler) + d_scheduler->stop(); + } + + void + top_block_impl::wait() + { + if(d_scheduler) + d_scheduler->wait(); + + d_state = IDLE; + } + + // N.B. lock() and unlock() cannot be called from a flow graph + // thread or deadlock will occur when reconfiguration happens + void + top_block_impl::lock() + { + gr::thread::scoped_lock lock(d_mutex); + d_lock_count++; + } + + void + top_block_impl::unlock() + { + gr::thread::scoped_lock lock(d_mutex); + + if(d_lock_count <= 0) { + d_lock_count = 0; // fix it, then complain + throw std::runtime_error("unpaired unlock() call"); + } + + d_lock_count--; + if(d_lock_count > 0 || d_state == IDLE) // nothing to do + return; + + restart(); + } + + /* + * restart is called with d_mutex held + */ + void + top_block_impl::restart() + { + stop(); // Stop scheduler and wait for completion + wait(); + + // Create new simple flow graph + flat_flowgraph_sptr new_ffg = d_owner->flatten(); + new_ffg->validate(); // check consistency, sanity, etc + new_ffg->merge_connections(d_ffg); // reuse buffers, etc + d_ffg = new_ffg; + + // Create a new scheduler to execute it + d_scheduler = make_scheduler(d_ffg, d_max_noutput_items); + d_state = RUNNING; + } + + std::string + top_block_impl::edge_list() + { + if(d_ffg) + return d_ffg->edge_list(); + else + return ""; + } + + void + top_block_impl::dump() + { + if(d_ffg) + d_ffg->dump(); + } + + int + top_block_impl::max_noutput_items() + { + return d_max_noutput_items; + } + + void + top_block_impl::set_max_noutput_items(int nmax) + { + d_max_noutput_items = nmax; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/top_block_impl.h b/gnuradio-runtime/lib/top_block_impl.h new file mode 100644 index 0000000000..9e0e661a02 --- /dev/null +++ b/gnuradio-runtime/lib/top_block_impl.h @@ -0,0 +1,90 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2008,2013 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. + */ + +#ifndef INCLUDED_GR_TOP_BLOCK_IMPL_H +#define INCLUDED_GR_TOP_BLOCK_IMPL_H + +#include <gnuradio/api.h> +#include "scheduler.h" +#include <gnuradio/thread/thread.h> + +namespace gr { + + /*! + *\brief Abstract implementation details of top_block + * \ingroup internal + * + * The actual implementation of top_block. Separate class allows + * decoupling of changes from dependent classes. + */ + class GR_RUNTIME_API top_block_impl + { + public: + top_block_impl(top_block *owner); + ~top_block_impl(); + + // Create and start scheduler threads + void start(int max_noutput_items=100000000); + + // Signal scheduler threads to stop + void stop(); + + // Wait for scheduler threads to exit + void wait(); + + // Lock the top block to allow reconfiguration + void lock(); + + // Unlock the top block at end of reconfiguration + void unlock(); + + // Return a string list of edges + std::string edge_list(); + + // Dump the flowgraph to stdout + void dump(); + + // Get the number of max noutput_items in the flowgraph + int max_noutput_items(); + + // Set the maximum number of noutput_items in the flowgraph + void set_max_noutput_items(int nmax); + + protected: + enum tb_state { IDLE, RUNNING }; + + top_block *d_owner; + flat_flowgraph_sptr d_ffg; + scheduler_sptr d_scheduler; + + gr::thread::mutex d_mutex; // protects d_state and d_lock_count + tb_state d_state; + int d_lock_count; + int d_max_noutput_items; + + private: + void restart(); + }; + +} /* namespace gr */ + +#endif /* INCLUDED_GR_TOP_BLOCK_IMPL_H */ diff --git a/gnuradio-runtime/lib/tpb_detail.cc b/gnuradio-runtime/lib/tpb_detail.cc new file mode 100644 index 0000000000..cf05c2b102 --- /dev/null +++ b/gnuradio-runtime/lib/tpb_detail.cc @@ -0,0 +1,71 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,2013 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gnuradio/tpb_detail.h> +#include <gnuradio/block.h> +#include <gnuradio/block_detail.h> +#include <gnuradio/buffer.h> + +namespace gr { + + /* + * We assume that no worker threads are ever running when the graph + * structure is being manipulated, thus it's safe for us to poke + * around in our neighbors w/o holding any locks. + */ + void + tpb_detail::notify_upstream(block_detail *d) + { + // For each of our inputs, tell the guy upstream that we've + // consumed some input, and that he most likely has more output + // buffer space available. + + for(size_t i = 0; i < d->d_input.size(); i++) { + // Can you say, "pointer chasing?" + d->d_input[i]->buffer()->link()->detail()->d_tpb.set_output_changed(); + } + } + + void + tpb_detail::notify_downstream(block_detail *d) + { + // For each of our outputs, tell the guys downstream that they + // have new input available. + + for(size_t i = 0; i < d->d_output.size(); i++) { + buffer_sptr buf = d->d_output[i]; + for(size_t j = 0, k = buf->nreaders(); j < k; j++) + buf->reader(j)->link()->detail()->d_tpb.set_input_changed(); + } + } + + void + tpb_detail::notify_neighbors(block_detail *d) + { + notify_downstream(d); + notify_upstream(d); + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/tpb_thread_body.cc b/gnuradio-runtime/lib/tpb_thread_body.cc new file mode 100644 index 0000000000..ceb94fbb2a --- /dev/null +++ b/gnuradio-runtime/lib/tpb_thread_body.cc @@ -0,0 +1,151 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,2011,2013 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "tpb_thread_body.h" +#include <gnuradio/prefs.h> +#include <boost/thread.hpp> +#include <boost/foreach.hpp> +#include <pmt/pmt.h> +#include <iostream> + +namespace gr { + + tpb_thread_body::tpb_thread_body(block_sptr block, int max_noutput_items) + : d_exec(block, max_noutput_items) + { + //std::cerr << "tpb_thread_body: " << block << std::endl; + + block_detail *d = block->detail().get(); + block_executor::state s; + pmt::pmt_t msg; + + d->threaded = true; + d->thread = gr::thread::get_current_thread_id(); + + prefs *p = prefs::singleton(); + size_t max_nmsgs = static_cast<size_t>(p->get_long("DEFAULT", "max_messages", 100)); + + // Set thread affinity if it was set before fg was started. + if(block->processor_affinity().size() > 0) { + gr::thread::thread_bind_to_processor(d->thread, block->processor_affinity()); + } + + while(1) { + boost::this_thread::interruption_point(); + + // handle any queued up messages + //BOOST_FOREACH( pmt::pmt_t port, block->msg_queue.keys() ) + + BOOST_FOREACH(basic_block::msg_queue_map_t::value_type &i, block->msg_queue) { + // Check if we have a message handler attached before getting + // any messages. This is mostly a protection for the unknown + // startup sequence of the threads. + if(block->has_msg_handler(i.first)) { + while((msg = block->delete_head_nowait(i.first))) { + block->dispatch_msg(i.first,msg); + } + } + else { + // If we don't have a handler but are building up messages, + // prune the queue from the front to keep memory in check. + if(block->nmsgs(i.first) > max_nmsgs) + msg = block->delete_head_nowait(i.first); + } + } + + d->d_tpb.clear_changed(); + // run one iteration if we are a connected stream block + if(d->noutputs() >0 || d->ninputs()>0){ + s = d_exec.run_one_iteration(); + } + else { + s = block_executor::BLKD_IN; + } + + switch(s){ + case block_executor::READY: // Tell neighbors we made progress. + d->d_tpb.notify_neighbors(d); + break; + + case block_executor::READY_NO_OUTPUT: // Notify upstream only + d->d_tpb.notify_upstream(d); + break; + + case block_executor::DONE: // Game over. + d->d_tpb.notify_neighbors(d); + return; + + case block_executor::BLKD_IN: // Wait for input. + { + gr::thread::scoped_lock guard(d->d_tpb.mutex); + while(!d->d_tpb.input_changed) { + + // wait for input or message + while(!d->d_tpb.input_changed && block->empty_p()) + d->d_tpb.input_cond.wait(guard); + + // handle all pending messages + BOOST_FOREACH(basic_block::msg_queue_map_t::value_type &i, block->msg_queue) { + while((msg = block->delete_head_nowait(i.first))) { + guard.unlock(); // release lock while processing msg + block->dispatch_msg(i.first, msg); + guard.lock(); + } + } + } + } + break; + + case block_executor::BLKD_OUT: // Wait for output buffer space. + { + gr::thread::scoped_lock guard(d->d_tpb.mutex); + while(!d->d_tpb.output_changed) { + // wait for output room or message + while(!d->d_tpb.output_changed && block->empty_p()) + d->d_tpb.output_cond.wait(guard); + + // handle all pending messages + BOOST_FOREACH(basic_block::msg_queue_map_t::value_type &i, block->msg_queue) { + while((msg = block->delete_head_nowait(i.first))) { + guard.unlock(); // release lock while processing msg + block->dispatch_msg(i.first,msg); + guard.lock(); + } + } + } + } + break; + + default: + assert(0); + } + } + } + + tpb_thread_body::~tpb_thread_body() + { + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/gr_tpb_thread_body.h b/gnuradio-runtime/lib/tpb_thread_body.h index 6ecb022f69..9859b125dd 100644 --- a/gnuradio-runtime/lib/gr_tpb_thread_body.h +++ b/gnuradio-runtime/lib/tpb_thread_body.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008 Free Software Foundation, Inc. + * Copyright 2008,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,26 +21,29 @@ #ifndef INCLUDED_GR_TPB_THREAD_BODY_H #define INCLUDED_GR_TPB_THREAD_BODY_H -#include <gr_runtime_api.h> -#include <gr_block_executor.h> -#include <gr_block.h> -#include <gr_block_detail.h> +#include <gnuradio/api.h> +#include <gnuradio/block.h> +#include <gnuradio/block_detail.h> +#include "block_executor.h" -/*! - * \brief The body of each thread-per-block thread. - * - * One of these is instantiated in its own thread for each block. The - * constructor turns into the main loop which returns when the block is - * done or is interrupted. - */ +namespace gr { -class GR_RUNTIME_API gr_tpb_thread_body { - gr_block_executor d_exec; + /*! + * \brief The body of each thread-per-block thread. + * + * One of these is instantiated in its own thread for each block. + * The constructor turns into the main loop which returns when the + * block is done or is interrupted. + */ + class GR_RUNTIME_API tpb_thread_body + { + block_executor d_exec; -public: - gr_tpb_thread_body(gr_block_sptr block, int max_noutput_items=100000); - ~gr_tpb_thread_body(); -}; + public: + tpb_thread_body(block_sptr block, int max_noutput_items=100000); + ~tpb_thread_body(); + }; +} /* namespace gr */ #endif /* INCLUDED_GR_TPB_THREAD_BODY_H */ diff --git a/gnuradio-runtime/lib/vmcircbuf.cc b/gnuradio-runtime/lib/vmcircbuf.cc new file mode 100644 index 0000000000..0fccb3d914 --- /dev/null +++ b/gnuradio-runtime/lib/vmcircbuf.cc @@ -0,0 +1,299 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <assert.h> +#include <stdexcept> +#include <stdio.h> +#include <string.h> +#include <vector> +#include <boost/format.hpp> +#include "vmcircbuf.h" +#include "vmcircbuf_prefs.h" +#include "local_sighandler.h" + +// all the factories we know about +#include "vmcircbuf_createfilemapping.h" +#include "vmcircbuf_sysv_shm.h" +#include "vmcircbuf_mmap_shm_open.h" +#include "vmcircbuf_mmap_tmpfile.h" + +namespace gr { + + static const char *FACTORY_PREF_KEY = "vmcircbuf_default_factory"; + + vmcircbuf::~vmcircbuf() + { + } + + vmcircbuf_factory::~vmcircbuf_factory() + { + } + + // ---------------------------------------------------------------- + + static vmcircbuf_factory *s_default_factory = 0; + + vmcircbuf_factory * + vmcircbuf_sysconfig::get_default_factory() + { + if(s_default_factory) + return s_default_factory; + + bool verbose = false; + + std::vector<gr::vmcircbuf_factory *> all = all_factories (); + + const char *name = gr::vmcircbuf_prefs::get(FACTORY_PREF_KEY); + + if(name) { + for(unsigned int i = 0; i < all.size (); i++) { + if(strcmp(name, all[i]->name ()) == 0) { + s_default_factory = all[i]; + if(verbose) + fprintf(stderr, "gr::vmcircbuf_sysconfig: using %s\n", + s_default_factory->name()); + return s_default_factory; + } + } + } + + // either we don't have a default, or the default named is not in our + // list of factories. Find the first factory that works. + + if(verbose) + fprintf(stderr, "gr::vmcircbuf_sysconfig: finding a working factory...\n"); + + for(unsigned int i = 0; i < all.size (); i++) { + if(test_factory(all[i], verbose)) { + set_default_factory(all[i]); + return s_default_factory; + } + } + + // We're screwed! + fprintf(stderr, "gr::vmcircbuf_sysconfig: unable to find a working factory!\n"); + throw std::runtime_error("gr::vmcircbuf_sysconfig"); + } + + std::vector<vmcircbuf_factory *> + vmcircbuf_sysconfig::all_factories() + { + std::vector<vmcircbuf_factory*> result; + + result.push_back(gr::vmcircbuf_createfilemapping_factory::singleton()); +#ifdef TRY_SHM_VMCIRCBUF + result.push_back(gr::vmcircbuf_sysv_shm_factory::singleton()); + result.push_back(gr::vmcircbuf_mmap_shm_open_factory::singleton()); +#endif + result.push_back (gr::vmcircbuf_mmap_tmpfile_factory::singleton()); + + return result; + } + + void + vmcircbuf_sysconfig::set_default_factory(vmcircbuf_factory *f) + { + gr::vmcircbuf_prefs::set(FACTORY_PREF_KEY, f->name()); + s_default_factory = f; + } + + + // ------------------------------------------------------------------------ + // test code for vmcircbuf factories + // ------------------------------------------------------------------------ + + static void + init_buffer(vmcircbuf *c, int counter, int size) + { + unsigned int *p = (unsigned int*)c->pointer_to_first_copy(); + for(unsigned int i = 0; i < size / sizeof(int); i++) + p[i] = counter + i; + } + + static bool + check_mapping(vmcircbuf *c, int counter, int size, const char *msg, bool verbose) + { + bool ok = true; + + if(verbose) + fprintf(stderr, "... %s", msg); + + unsigned int *p1 = (unsigned int *)c->pointer_to_first_copy(); + unsigned int *p2 = (unsigned int *)c->pointer_to_second_copy(); + + // fprintf(stderr, "p1 = %p, p2 = %p\n", p1, p2); + + for(unsigned int i = 0; i < size / sizeof (int); i++) { + if(p1[i] != counter + i) { + ok = false; + if(verbose) + fprintf(stderr, " p1[%d] == %u, expected %u\n", i, p1[i], counter + i); + break; + } + if(p2[i] != counter + i) { + if(verbose) + fprintf(stderr, " p2[%d] == %u, expected %u\n", i, p2[i], counter + i); + ok = false; + break; + } + } + + if(ok && verbose) { + fprintf(stderr, " OK\n"); + } + return ok; + } + + static const char * + memsize(int size) + { + static std::string buf; + if(size >= (1 << 20)) { + buf = str(boost::format("%dMB") % (size / (1 << 20))); + } + else if(size >= (1 << 10)){ + buf = str(boost::format("%dKB") % (size / (1 << 10))); + } + else { + buf = str(boost::format("%d") % size); + } + return buf.c_str(); + } + + static bool + test_a_bunch(vmcircbuf_factory *factory, int n, int size, int *start_ptr, bool verbose) + { + bool ok = true; + std::vector<int> counter(n); + std::vector<vmcircbuf*> c(n); + int cum_size = 0; + + for(int i = 0; i < n; i++) { + counter[i] = *start_ptr; + *start_ptr += size; + if((c[i] = factory->make (size)) == 0) { + if(verbose) + fprintf(stderr, + "Failed to allocate gr::vmcircbuf number %d of size %d (cum = %s)\n", + i + 1, size, memsize(cum_size)); + return false; + } + init_buffer(c[i], counter[i], size); + cum_size += size; + } + + for(int i = 0; i < n; i++) { + 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++) { + delete c[i]; + c[i] = 0; + } + + return ok; + } + + static bool + standard_tests(vmcircbuf_factory *f, int verbose) + { + if(verbose >= 1) + fprintf(stderr, "Testing %s...\n", f->name()); + + bool v = verbose >= 2; + int granularity = f->granularity(); + int start = 0; + bool ok = true; + + ok &= test_a_bunch(f, 1, 1 * granularity, &start, v); // 1 x 4KB = 4KB + + if(ok) { + ok &= test_a_bunch(f, 64, 4 * granularity, &start, v); // 64 x 16KB = 1MB + ok &= test_a_bunch(f, 4, 4 * (1L << 20), &start, v); // 4 x 4MB = 16MB + // ok &= test_a_bunch(f, 256, 256 * (1L << 10), &start, v); // 256 x 256KB = 64MB + } + + if(verbose >= 1) + fprintf(stderr, "....... %s: %s", f->name(), ok ? "OK\n" : "Doesn't work\n"); + + return ok; + } + + bool + vmcircbuf_sysconfig::test_factory(vmcircbuf_factory *f, int verbose) + { + // Install local signal handlers for SIGSEGV and SIGBUS. + // If something goes wrong, these signals may be invoked. + +#ifdef SIGSEGV + gr::local_sighandler sigsegv (SIGSEGV, gr::local_sighandler::throw_signal); +#endif +#ifdef SIGBUS + gr::local_sighandler sigbus (SIGBUS, gr::local_sighandler::throw_signal); +#endif +#ifdef SIGSYS + gr::local_sighandler sigsys (SIGSYS, gr::local_sighandler::throw_signal); +#endif + + try { + return standard_tests (f, verbose); + } + catch(gr::signal &sig) { + if(verbose) { + fprintf(stderr, "....... %s: %s", f->name(), "Doesn't work\n"); + fprintf(stderr, + "gr::vmcircbuf_factory::test_factory (%s): caught %s\n", + f->name(), sig.name().c_str()); + return false; + } + } + catch (...) { + if(verbose) { + fprintf(stderr, "....... %s: %s", f->name(), "Doesn't work\n"); + fprintf(stderr, + "gr::vmcircbuf_factory::test_factory (%s): some kind of uncaught exception\n", + f->name()); + } + return false; + } + return false; // never gets here. shut compiler up. + } + + bool + vmcircbuf_sysconfig::test_all_factories(int verbose) + { + bool ok = false; + + std::vector<vmcircbuf_factory *> all = all_factories(); + + for(unsigned int i = 0; i < all.size (); i++) + ok |= test_factory(all[i], verbose); + + return ok; + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/vmcircbuf.h b/gnuradio-runtime/lib/vmcircbuf.h new file mode 100644 index 0000000000..c3ddfe0043 --- /dev/null +++ b/gnuradio-runtime/lib/vmcircbuf.h @@ -0,0 +1,125 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2013 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. + */ + +#ifndef GR_VMCIRCBUF_H +#define GR_VMCIRCBUF_H + +#include <gnuradio/api.h> +#include <vector> + +namespace gr { + + /*! + * \brief abstract class to implement doubly mapped virtual memory circular buffers + * \ingroup internal + */ + class GR_RUNTIME_API vmcircbuf + { + protected: + int d_size; + char *d_base; + + // CREATORS + vmcircbuf(int size) : d_size(size), d_base(0) {}; + + public: + virtual ~vmcircbuf(); + + // ACCESSORS + void *pointer_to_first_copy() const{ return d_base; } + void *pointer_to_second_copy() const{ return d_base + d_size; } + }; + + /*! + * \brief abstract factory for creating circular buffers + */ + class GR_RUNTIME_API vmcircbuf_factory + { + protected: + vmcircbuf_factory() {}; + virtual ~vmcircbuf_factory(); + + public: + + /*! + * \brief return name of this factory + */ + virtual const char *name() const = 0; + + /*! + * \brief return granularity of mapping, typically equal to page size + */ + virtual int granularity() = 0; + + /*! + * \brief return a gr::vmcircbuf, or 0 if unable. + * + * Call this to create a doubly mapped circular buffer. + */ + virtual vmcircbuf *make(int size) = 0; + }; + + /* + * \brief pulls together all implementations of gr::vmcircbuf + */ + class GR_RUNTIME_API vmcircbuf_sysconfig + { + public: + /* + * \brief return the single instance of the default factory. + * + * returns the default factory to use if it's already defined, + * else find the first working factory and use it. + */ + static vmcircbuf_factory *get_default_factory(); + + static int granularity() { return get_default_factory()->granularity(); } + static vmcircbuf *make(int size) { return get_default_factory()->make(size); } + + // N.B. not all factories are guaranteed to work. + // It's too hard to check everything at config time, so we check at runtime + static std::vector<vmcircbuf_factory*> all_factories(); + + // make this factory the default + static void set_default_factory(vmcircbuf_factory *f); + + /*! + * \brief Does this factory really work? + * + * verbose = 0: silent + * verbose = 1: names of factories tested and results + * verbose = 2: all intermediate results + */ + static bool test_factory(vmcircbuf_factory *f, int verbose); + + /*! + * \brief Test all factories, return true if at least one of them works + * verbose = 0: silent + * verbose = 1: names of factories tested and results + * verbose = 2: all intermediate results + */ + static bool test_all_factories(int verbose); + }; + +} /* namespace gr */ + +#endif /* GR_VMCIRCBUF_H */ diff --git a/gnuradio-runtime/lib/vmcircbuf_createfilemapping.cc b/gnuradio-runtime/lib/vmcircbuf_createfilemapping.cc new file mode 100644 index 0000000000..2d345a29b1 --- /dev/null +++ b/gnuradio-runtime/lib/vmcircbuf_createfilemapping.cc @@ -0,0 +1,204 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2005,2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdexcept> +#include <assert.h> +#include <unistd.h> +#include <fcntl.h> +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif +#include <errno.h> +#include <stdio.h> +#include "pagesize.h" +#include "vmcircbuf_createfilemapping.h" +#include <boost/format.hpp> + +namespace gr { + +#ifdef HAVE_CREATEFILEMAPPING + // Print Windows error (could/should be global?) + static void + werror(char *where, DWORD last_error) + { + char buf[1024]; + + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + last_error, + 0, // default language + buf, + sizeof(buf)/sizeof(TCHAR), // buffer size + NULL); + fprintf(stderr, "%s: Error %d: %s", where, last_error, buf); + return; + } +#endif + + + vmcircbuf_createfilemapping::vmcircbuf_createfilemapping(int size) + : gr::vmcircbuf(size) + { +#if !defined(HAVE_CREATEFILEMAPPING) + fprintf(stderr, "%s: createfilemapping is not available\n", __FUNCTION__); + throw std::runtime_error("gr::vmcircbuf_createfilemapping"); +#else + static int s_seg_counter = 0; + + if(size <= 0 || (size % gr::pagesize ()) != 0) { + fprintf(stderr, "gr::vmcircbuf_createfilemapping: invalid size = %d\n", size); + throw std::runtime_error ("gr::vmcircbuf_createfilemapping"); + } + + 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.c_str()); // name of mapping object + + s_seg_counter++; + if(d_handle == NULL || d_handle == INVALID_HANDLE_VALUE) { + std::string msg = str(boost::format( + "gr::vmcircbuf_mmap_createfilemapping: CreateFileMapping [%s]") % + seg_name); + werror((char*)msg.c_str(), GetLastError()); + throw std::runtime_error("gr::vmcircbuf_mmap_createfilemapping"); + } + + // Allocate virtual memory of the needed size, then free it so we can use it + LPVOID first_tmp; + first_tmp = VirtualAlloc( NULL, 2*size, MEM_RESERVE, PAGE_NOACCESS ); + if(first_tmp == NULL) { + werror("gr::vmcircbuf_mmap_createfilemapping: VirtualAlloc", GetLastError()); + CloseHandle(d_handle); // cleanup + throw std::runtime_error("gr::vmcircbuf_mmap_createfilemapping"); + } + + if(VirtualFree(first_tmp, 0, MEM_RELEASE) == 0) { + werror("gr::vmcircbuf_mmap_createfilemapping: VirtualFree", GetLastError()); + CloseHandle(d_handle); // cleanup + throw std::runtime_error("gr::vmcircbuf_mmap_createfilemapping"); + } + + d_first_copy = MapViewOfFileEx((HANDLE)d_handle, // handle to map object + FILE_MAP_WRITE, // read/write permission + 0, + 0, + size, + first_tmp); + if(d_first_copy != first_tmp) { + werror( "gr::vmcircbuf_mmap_createfilemapping: MapViewOfFileEx(1)", GetLastError()); + CloseHandle(d_handle); // cleanup + throw std::runtime_error ("gr::vmcircbuf_mmap_createfilemapping"); + } + + d_second_copy = MapViewOfFileEx((HANDLE)d_handle, // handle to map object + FILE_MAP_WRITE, // read/write permission + 0, + 0, + size, + (char*)first_tmp + size);//(LPVOID) ((char *)d_first_copy + size)); + + if(d_second_copy != (char *)first_tmp + size) { + werror( "gr::vmcircbuf_mmap_createfilemapping: MapViewOfFileEx(2)", GetLastError()); + UnmapViewOfFile(d_first_copy); + CloseHandle(d_handle); // cleanup + throw std::runtime_error ("gr::vmcircbuf_mmap_createfilemapping"); + } + +#ifdef DEBUG + fprintf(stderr,"gr::vmcircbuf_mmap_createfilemapping: contiguous? mmap %p %p %p %p\n", + (char*)d_first_copy, (char*)d_second_copy, size, (char*)d_first_copy + size); +#endif + + // Now remember the important stuff + d_base = (char*)d_first_copy; + d_size = size; +#endif /*HAVE_CREATEFILEMAPPING*/ + } + + vmcircbuf_createfilemapping::~vmcircbuf_createfilemapping() + { +#ifdef HAVE_CREATEFILEMAPPING + if(UnmapViewOfFile(d_first_copy) == 0) { + werror("gr::vmcircbuf_createfilemapping: UnmapViewOfFile(d_first_copy)", GetLastError()); + } + d_base=NULL; + if(UnmapViewOfFile(d_second_copy) == 0) { + werror("gr::vmcircbuf_createfilemapping: UnmapViewOfFile(d_second_copy)", GetLastError()); + } + //d_second=NULL; + CloseHandle(d_handle); +#endif + } + + // ---------------------------------------------------------------- + // The factory interface + // ---------------------------------------------------------------- + + gr::vmcircbuf_factory *vmcircbuf_createfilemapping_factory::s_the_factory = 0; + + gr::vmcircbuf_factory * + vmcircbuf_createfilemapping_factory::singleton() + { + if(s_the_factory) + return s_the_factory; + s_the_factory = new vmcircbuf_createfilemapping_factory(); + return s_the_factory; + } + + int + vmcircbuf_createfilemapping_factory::granularity() + { +#ifdef HAVE_CREATEFILEMAPPING + // return 65536;//TODO, check, is this needed or can we just use gr::pagesize() + SYSTEM_INFO system_info; + GetSystemInfo(&system_info); + //fprintf(stderr,"win32 AllocationGranularity %p\n",(int)system_info.dwAllocationGranularity); + return (int)system_info.dwAllocationGranularity; +#else + return gr::pagesize(); +#endif + } + + gr::vmcircbuf * + vmcircbuf_createfilemapping_factory::make(int size) + { + try { + return new vmcircbuf_createfilemapping(size); + } + catch(...) { + return 0; + } + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/vmcircbuf_createfilemapping.h b/gnuradio-runtime/lib/vmcircbuf_createfilemapping.h new file mode 100644 index 0000000000..0513112f23 --- /dev/null +++ b/gnuradio-runtime/lib/vmcircbuf_createfilemapping.h @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2005,2013 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. + */ + +#ifndef GR_VMCIRCBUF_CREATEFILEMAPPING_H +#define GR_VMCIRCBUF_CREATEFILEMAPPING_H + +#include <gnuradio/api.h> +#include "vmcircbuf.h" + +#ifdef HAVE_CREATEFILEMAPPING +#include <windows.h> +#endif + +namespace gr { + + /*! + * \brief concrete class to implement circular buffers with mmap and shm_open + * \ingroup internal + */ + class GR_RUNTIME_API vmcircbuf_createfilemapping : public gr::vmcircbuf + { + public: + // CREATORS + vmcircbuf_createfilemapping(int size); + virtual ~vmcircbuf_createfilemapping(); +#ifdef HAVE_CREATEFILEMAPPING + private: + HANDLE d_handle; + LPVOID d_first_copy; + LPVOID d_second_copy; +#endif + }; + + /*! + * \brief concrete factory for circular buffers built using mmap and shm_open + */ + class GR_RUNTIME_API vmcircbuf_createfilemapping_factory : public gr::vmcircbuf_factory + { + private: + static gr::vmcircbuf_factory *s_the_factory; + + public: + static gr::vmcircbuf_factory *singleton(); + + virtual const char *name() const { return "gr::vmcircbuf_createfilemapping_factory"; } + + /*! + * \brief return granularity of mapping, typically equal to page size + */ + virtual int granularity(); + + /*! + * \brief return a gr::vmcircbuf, or 0 if unable. + * + * Call this to create a doubly mapped circular buffer. + */ + virtual gr::vmcircbuf *make(int size); + }; + +} /* namespace gr */ + +#endif /* GR_VMCIRCBUF_CREATEFILEMAPPING_H */ diff --git a/gnuradio-runtime/lib/vmcircbuf_mmap_shm_open.cc b/gnuradio-runtime/lib/vmcircbuf_mmap_shm_open.cc new file mode 100644 index 0000000000..7b461bc26b --- /dev/null +++ b/gnuradio-runtime/lib/vmcircbuf_mmap_shm_open.cc @@ -0,0 +1,204 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "vmcircbuf_mmap_shm_open.h" +#include <stdexcept> +#include <assert.h> +#include <unistd.h> +#include <fcntl.h> +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif +#include <errno.h> +#include <stdio.h> +#include "pagesize.h" +#include <gnuradio/sys_paths.h> + +namespace gr { + + vmcircbuf_mmap_shm_open::vmcircbuf_mmap_shm_open(int size) + : gr::vmcircbuf(size) + { +#if !defined(HAVE_MMAP) || !defined(HAVE_SHM_OPEN) + fprintf(stderr, "gr::vmcircbuf_mmap_shm_open: mmap or shm_open is not available\n"); + throw std::runtime_error("gr::vmcircbuf_mmap_shm_open"); +#else + static int s_seg_counter = 0; + + if(size <= 0 || (size % gr::pagesize ()) != 0) { + fprintf(stderr, "gr::vmcircbuf_mmap_shm_open: invalid size = %d\n", size); + throw std::runtime_error("gr::vmcircbuf_mmap_shm_open"); + } + + int shm_fd = -1; + char seg_name[1024]; + static bool portable_format = true; + + // open a new named shared memory segment + while(1) { + if(portable_format) { + + // This is the POSIX recommended "portable format". + // Of course the "portable format" doesn't work on some systems... + + snprintf(seg_name, sizeof(seg_name), + "/gnuradio-%d-%d", getpid(), s_seg_counter); + } + else { + + // Where the "portable format" doesn't work, we try building + // a full filesystem pathname pointing into a suitable temporary directory. + + snprintf(seg_name, sizeof(seg_name), + "%s/gnuradio-%d-%d", gr::tmp_path(), getpid(), s_seg_counter); + } + + shm_fd = shm_open(seg_name, O_RDWR | O_CREAT | O_EXCL, 0600); + if(shm_fd == -1 && errno == EACCES && portable_format) { + portable_format = false; + continue; // try again using "non-portable format" + } + + s_seg_counter++; + + if(shm_fd == -1) { + if(errno == EEXIST) // Named segment already exists (shouldn't happen). Try again + continue; + + char msg[1024]; + snprintf(msg, sizeof(msg), "gr::vmcircbuf_mmap_shm_open: shm_open [%s]", seg_name); + perror(msg); + throw std::runtime_error("gr::vmcircbuf_mmap_shm_open"); + } + break; + } + + // We've got a new shared memory segment fd open. + // Now set it's length to 2x what we really want and mmap it in. + if(ftruncate(shm_fd, (off_t)2 * size) == -1) { + close(shm_fd); // cleanup + perror("gr::vmcircbuf_mmap_shm_open: ftruncate (1)"); + throw std::runtime_error("gr::vmcircbuf_mmap_shm_open"); + } + + void *first_copy = mmap(0, 2 * size, + PROT_READ | PROT_WRITE, MAP_SHARED, + shm_fd, (off_t) 0); + + if(first_copy == MAP_FAILED) { + close(shm_fd); // cleanup + perror("gr::vmcircbuf_mmap_shm_open: mmap (1)"); + throw std::runtime_error("gr::vmcircbuf_mmap_shm_open"); + } + + // unmap the 2nd half + if(munmap ((char *) first_copy + size, size) == -1) { + close(shm_fd); // cleanup + perror("gr::vmcircbuf_mmap_shm_open: munmap (1)"); + throw std::runtime_error("gr::vmcircbuf_mmap_shm_open"); + } + + // map the first half into the now available hole where the + // second half used to be. + void *second_copy = mmap((char*)first_copy + size, size, + PROT_READ | PROT_WRITE, MAP_SHARED, + shm_fd, (off_t)0); + + if(second_copy == MAP_FAILED) { + close(shm_fd); // cleanup + perror("gr::vmcircbuf_mmap_shm_open: mmap (2)"); + throw std::runtime_error("gr::vmcircbuf_mmap_shm_open"); + } + +#if 0 // OS/X doesn't allow you to resize the segment + + // cut the shared memory segment down to size + if(ftruncate(shm_fd, (off_t)size) == -1) { + close(shm_fd); // cleanup + perror("gr::vmcircbuf_mmap_shm_open: ftruncate (2)"); + throw std::runtime_error("gr::vmcircbuf_mmap_shm_open"); + } +#endif + + close(shm_fd); // fd no longer needed. The mapping is retained. + + if(shm_unlink(seg_name) == -1) { // unlink the seg_name. + perror("gr::vmcircbuf_mmap_shm_open: shm_unlink"); + throw std::runtime_error("gr::vmcircbuf_mmap_shm_open"); + } + + // Now remember the important stuff + d_base = (char*)first_copy; + d_size = size; +#endif + } + + vmcircbuf_mmap_shm_open::~vmcircbuf_mmap_shm_open() + { +#if defined(HAVE_MMAP) + if(munmap (d_base, 2 * d_size) == -1) { + perror("gr::vmcircbuf_mmap_shm_open: munmap (2)"); + } +#endif + } + + // ---------------------------------------------------------------- + // The factory interface + // ---------------------------------------------------------------- + + gr::vmcircbuf_factory *vmcircbuf_mmap_shm_open_factory::s_the_factory = 0; + + gr::vmcircbuf_factory * + vmcircbuf_mmap_shm_open_factory::singleton() + { + if(s_the_factory) + return s_the_factory; + + s_the_factory = new gr::vmcircbuf_mmap_shm_open_factory(); + return s_the_factory; + } + + int + vmcircbuf_mmap_shm_open_factory::granularity() + { + return gr::pagesize(); + } + + gr::vmcircbuf * + vmcircbuf_mmap_shm_open_factory::make(int size) + { + try { + return new vmcircbuf_mmap_shm_open(size); + } + catch (...) { + return 0; + } + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/vmcircbuf_mmap_shm_open.h b/gnuradio-runtime/lib/vmcircbuf_mmap_shm_open.h new file mode 100644 index 0000000000..60654ee46e --- /dev/null +++ b/gnuradio-runtime/lib/vmcircbuf_mmap_shm_open.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2013 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. + */ + +#ifndef GR_VMCIRCBUF_MMAP_SHM_OPEN_H +#define GR_VMCIRCBUF_MMAP_SHM_OPEN_H + +#include <gnuradio/api.h> +#include "vmcircbuf.h" + +namespace gr { + + /*! + * \brief concrete class to implement circular buffers with mmap and shm_open + * \ingroup internal + */ + class GR_RUNTIME_API vmcircbuf_mmap_shm_open : public gr::vmcircbuf + { + public: + vmcircbuf_mmap_shm_open(int size); + virtual ~vmcircbuf_mmap_shm_open(); + }; + + /*! + * \brief concrete factory for circular buffers built using mmap and shm_open + */ + class GR_RUNTIME_API vmcircbuf_mmap_shm_open_factory : public gr::vmcircbuf_factory + { + private: + static gr::vmcircbuf_factory *s_the_factory; + + public: + static gr::vmcircbuf_factory *singleton(); + + virtual const char *name() const { return "gr::vmcircbuf_mmap_shm_open_factory"; } + + /*! + * \brief return granularity of mapping, typically equal to page size + */ + virtual int granularity(); + + /*! + * \brief return a gr::vmcircbuf, or 0 if unable. + * + * Call this to create a doubly mapped circular buffer. + */ + virtual gr::vmcircbuf *make(int size); + }; + +} /* namespace gr */ + +#endif /* GR_VMCIRCBUF_MMAP_SHM_OPEN_H */ diff --git a/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc b/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc new file mode 100644 index 0000000000..ffe2a3d2c2 --- /dev/null +++ b/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc @@ -0,0 +1,197 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "vmcircbuf_mmap_tmpfile.h" +#include <stdexcept> +#include <assert.h> +#include <unistd.h> +#include <stdlib.h> +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif +#include <fcntl.h> +#include <errno.h> +#include <stdio.h> +#include <string.h> +#include "pagesize.h" +#include <gnuradio/sys_paths.h> + +namespace gr { + + vmcircbuf_mmap_tmpfile::vmcircbuf_mmap_tmpfile (int size) + : gr::vmcircbuf (size) + { +#if !defined(HAVE_MMAP) + fprintf(stderr, "gr::vmcircbuf_mmap_tmpfile: mmap or mkstemp is not available\n"); + throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); +#else + + if(size <= 0 || (size % gr::pagesize ()) != 0) { + fprintf(stderr, "gr::vmcircbuf_mmap_tmpfile: invalid size = %d\n", size); + throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); + } + + int seg_fd = -1; + char seg_name[1024]; + + static int s_seg_counter = 0; + + // open a temporary file that we'll map in a bit later + while(1) { + snprintf(seg_name, sizeof(seg_name), + "%s/gnuradio-%d-%d-XXXXXX", gr::tmp_path(), getpid(), s_seg_counter); + s_seg_counter++; + + seg_fd = open(seg_name, O_RDWR | O_CREAT | O_EXCL, 0600); + if(seg_fd == -1) { + if(errno == EEXIST) // File already exists (shouldn't happen). Try again + continue; + + char msg[1024]; + snprintf(msg, sizeof (msg), + "gr::vmcircbuf_mmap_tmpfile: open [%s]", seg_name); + perror(msg); + throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); + } + break; + } + + if(unlink (seg_name) == -1) { + perror("gr::vmcircbuf_mmap_tmpfile: unlink"); + throw std::runtime_error ("gr::vmcircbuf_mmap_tmpfile"); + } + + // We've got a valid file descriptor to a tmp file. + // Now set it's length to 2x what we really want and mmap it in. + if(ftruncate (seg_fd, (off_t) 2 * size) == -1) { + close(seg_fd); // cleanup + perror("gr::vmcircbuf_mmap_tmpfile: ftruncate (1)"); + throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); + } + + void *first_copy = mmap(0, 2 * size, + PROT_READ | PROT_WRITE, MAP_SHARED, + seg_fd, (off_t)0); + + if(first_copy == MAP_FAILED) { + close(seg_fd); // cleanup + perror("gr::vmcircbuf_mmap_tmpfile: mmap (1)"); + throw std::runtime_error ("gr::vmcircbuf_mmap_tmpfile"); + } + + // unmap the 2nd half + if(munmap ((char *) first_copy + size, size) == -1) { + close(seg_fd); // cleanup + perror("gr::vmcircbuf_mmap_tmpfile: munmap (1)"); + throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); + } + + // map the first half into the now available hole where the + // second half used to be. + void *second_copy = mmap((char*)first_copy + size, size, + PROT_READ | PROT_WRITE, MAP_SHARED, + seg_fd, (off_t)0); + + if(second_copy == MAP_FAILED) { + munmap(first_copy, size); // cleanup + close(seg_fd); + perror("gr::vmcircbuf_mmap_tmpfile: mmap(2)"); + throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); + } + + // check for contiguity + if((char*)second_copy != (char*)first_copy + size) { + munmap(first_copy, size); // cleanup + munmap(second_copy, size); + close(seg_fd); + perror("gr::vmcircbuf_mmap_tmpfile: non-contiguous second copy"); + throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); + } + + // cut the tmp file down to size + if(ftruncate (seg_fd, (off_t) size) == -1) { + munmap(first_copy, size); // cleanup + munmap(second_copy, size); + close(seg_fd); + perror("gr::vmcircbuf_mmap_tmpfile: ftruncate (2)"); + throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); + } + + close(seg_fd); // fd no longer needed. The mapping is retained. + + // Now remember the important stuff + + d_base = (char*)first_copy; + d_size = size; +#endif + } + + vmcircbuf_mmap_tmpfile::~vmcircbuf_mmap_tmpfile() + { +#if defined(HAVE_MMAP) + if(munmap(d_base, 2 * d_size) == -1) { + perror("gr::vmcircbuf_mmap_tmpfile: munmap(2)"); + } +#endif + } + + // ---------------------------------------------------------------- + // The factory interface + // ---------------------------------------------------------------- + + gr::vmcircbuf_factory *vmcircbuf_mmap_tmpfile_factory::s_the_factory = 0; + + gr::vmcircbuf_factory * + vmcircbuf_mmap_tmpfile_factory::singleton() + { + if(s_the_factory) + return s_the_factory; + + s_the_factory = new gr::vmcircbuf_mmap_tmpfile_factory(); + return s_the_factory; + } + + int + vmcircbuf_mmap_tmpfile_factory::granularity() + { + return gr::pagesize(); + } + + gr::vmcircbuf * + vmcircbuf_mmap_tmpfile_factory::make(int size) + { + try { + return new vmcircbuf_mmap_tmpfile(size); + } + catch (...) { + return 0; + } + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.h b/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.h new file mode 100644 index 0000000000..f8959c5736 --- /dev/null +++ b/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2013 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. + */ + +#ifndef GR_VMCIRCBUF_MMAP_TMPFILE_H +#define GR_VMCIRCBUF_MMAP_TMPFILE_H + +#include <gnuradio/api.h> +#include "vmcircbuf.h" + +namespace gr { + + /*! + * \brief concrete class to implement circular buffers with mmap and shm_open + * \ingroup internal + */ + class GR_RUNTIME_API vmcircbuf_mmap_tmpfile : public gr::vmcircbuf + { + public: + vmcircbuf_mmap_tmpfile(int size); + virtual ~vmcircbuf_mmap_tmpfile(); + }; + + /*! + * \brief concrete factory for circular buffers built using mmap and shm_open + */ + class GR_RUNTIME_API vmcircbuf_mmap_tmpfile_factory : public gr::vmcircbuf_factory + { + private: + static gr::vmcircbuf_factory *s_the_factory; + + public: + static gr::vmcircbuf_factory *singleton(); + + virtual const char *name() const { return "gr::vmcircbuf_mmap_tmpfile_factory"; } + + /*! + * \brief return granularity of mapping, typically equal to page size + */ + virtual int granularity(); + + /*! + * \brief return a gr::vmcircbuf, or 0 if unable. + * + * Call this to create a doubly mapped circular buffer. + */ + virtual gr::vmcircbuf *make(int size); + }; + +} /* namespace gr */ + +#endif /* GR_VMCIRCBUF_MMAP_TMPFILE_H */ diff --git a/gnuradio-runtime/lib/vmcircbuf_prefs.cc b/gnuradio-runtime/lib/vmcircbuf_prefs.cc new file mode 100644 index 0000000000..1fa6350385 --- /dev/null +++ b/gnuradio-runtime/lib/vmcircbuf_prefs.cc @@ -0,0 +1,113 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2010,2011,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "vmcircbuf_prefs.h" +#include <gnuradio/sys_paths.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <string.h> + +#include <boost/filesystem/operations.hpp> +#include <boost/filesystem/path.hpp> +namespace fs = boost::filesystem; + +namespace gr { + + /* + * The simplest thing that could possibly work: + * the key is the filename; the value is the file contents. + */ + static const char * + pathname(const char *key) + { + static fs::path path; + path = fs::path(gr::appdata_path()) / ".gnuradio" / "prefs" / key; + return path.string().c_str(); + } + + static void + ensure_dir_path() + { + fs::path path = fs::path(gr::appdata_path()) / ".gnuradio"; + if(!fs::is_directory(path)) + fs::create_directory(path); + + path = path / "prefs"; + if(!fs::is_directory(path)) + fs::create_directory(path); + } + + const char * + vmcircbuf_prefs::get(const char *key) + { + static char buf[1024]; + + FILE *fp = fopen(pathname (key), "r"); + if(fp == 0) { + perror(pathname (key)); + return 0; + } + + memset(buf, 0, sizeof (buf)); + size_t ret = fread(buf, 1, sizeof(buf) - 1, fp); + if(ret == 0) { + if(ferror(fp) != 0) { + perror(pathname (key)); + fclose(fp); + return 0; + } + } + fclose(fp); + return buf; + } + + void + vmcircbuf_prefs::set(const char *key, const char *value) + { + ensure_dir_path(); + + FILE *fp = fopen(pathname(key), "w"); + if(fp == 0) { + perror(pathname (key)); + return; + } + + size_t ret = fwrite(value, 1, strlen(value), fp); + if(ret == 0) { + if(ferror(fp) != 0) { + perror(pathname (key)); + fclose(fp); + return; + } + } + fclose(fp); + }; + +} /* namespace gr */ diff --git a/gnuradio-runtime/include/gr_preferences.h b/gnuradio-runtime/lib/vmcircbuf_prefs.h index df5aecacba..709b8ff459 100644 --- a/gnuradio-runtime/include/gr_preferences.h +++ b/gnuradio-runtime/lib/vmcircbuf_prefs.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2003,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,15 +20,20 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _GR_PREFERENCES_H_ -#define _GR_PREFERENCES_H_ +#ifndef GR_PREFERENCES_H +#define GR_PREFERENCES_H -#include <gr_runtime_api.h> +#include <gnuradio/api.h> -class GR_RUNTIME_API gr_preferences { - public: - static const char *get (const char *key); - static void set (const char *key, const char *value); -}; +namespace gr { -#endif /* _GR_PREFERENCES_H_ */
\ No newline at end of file + class GR_RUNTIME_API vmcircbuf_prefs + { + public: + static const char *get(const char *key); + static void set(const char *key, const char *value); + }; + +} /* namespace gr */ + +#endif /* GR_PREFERENCES_H */ diff --git a/gnuradio-runtime/lib/vmcircbuf_sysv_shm.cc b/gnuradio-runtime/lib/vmcircbuf_sysv_shm.cc new file mode 100644 index 0000000000..0d7e9b7d34 --- /dev/null +++ b/gnuradio-runtime/lib/vmcircbuf_sysv_shm.cc @@ -0,0 +1,196 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2013 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "vmcircbuf_sysv_shm.h" +#include <stdexcept> +#include <assert.h> +#include <unistd.h> +#include <stdlib.h> +#include <fcntl.h> +#ifdef HAVE_SYS_IPC_H +#include <sys/ipc.h> +#endif +#ifdef HAVE_SYS_SHM_H +#include <sys/shm.h> +#endif +#include <errno.h> +#include <stdio.h> +#include "pagesize.h" + + +namespace gr { + + vmcircbuf_sysv_shm::vmcircbuf_sysv_shm(int size) + : gr::vmcircbuf(size) + { +#if !defined(HAVE_SYS_SHM_H) + fprintf(stderr, "gr::vmcircbuf_sysv_shm: sysv shared memory is not available\n"); + throw std::runtime_error("gr::vmcircbuf_sysv_shm"); +#else + + int pagesize = gr::pagesize(); + + if(size <= 0 || (size % pagesize) != 0) { + fprintf(stderr, "gr::vmcircbuf_sysv_shm: invalid size = %d\n", size); + throw std::runtime_error("gr::vmcircbuf_sysv_shm"); + } + + int shmid_guard = -1; + int shmid1 = -1; + int shmid2 = -1; + + // We use this as a guard page. We'll map it read-only on both ends of the buffer. + // Ideally we'd map it no access, but I don't think that's possible with SysV + if((shmid_guard = shmget(IPC_PRIVATE, pagesize, IPC_CREAT | 0400)) == -1) { + perror("gr::vmcircbuf_sysv_shm: shmget (0)"); + throw std::runtime_error("gr::vmcircbuf_sysv_shm"); + } + + if((shmid2 = shmget(IPC_PRIVATE, 2 * size + 2 * pagesize, IPC_CREAT | 0700)) == -1) { + perror("gr::vmcircbuf_sysv_shm: shmget(1)"); + shmctl(shmid_guard, IPC_RMID, 0); + throw std::runtime_error ("gr::vmcircbuf_sysv_shm"); + } + + if((shmid1 = shmget(IPC_PRIVATE, size, IPC_CREAT | 0700)) == -1) { + perror("gr::vmcircbuf_sysv_shm: shmget (2)"); + shmctl(shmid_guard, IPC_RMID, 0); + shmctl(shmid2, IPC_RMID, 0); + throw std::runtime_error("gr::vmcircbuf_sysv_shm"); + } + + void *first_copy = shmat (shmid2, 0, 0); + if(first_copy == (void *) -1) { + perror("gr::vmcircbuf_sysv_shm: shmat(1)"); + shmctl(shmid_guard, IPC_RMID, 0); + shmctl(shmid2, IPC_RMID, 0); + shmctl(shmid1, IPC_RMID, 0); + throw std::runtime_error("gr::vmcircbuf_sysv_shm"); + } + + shmctl(shmid2, IPC_RMID, 0); + + // There may be a race between our detach and attach. + // + // If the system allocates all shared memory segments at the same + // virtual addresses in all processes and if the system allocates + // some other segment to first_copy or first_copoy + size between + // our detach and attach, the attaches below could fail [I've never + // seen it fail for this reason]. + shmdt(first_copy); + + // first read-only guard page + if(shmat(shmid_guard, first_copy, SHM_RDONLY) == (void *) -1) { + perror("gr::vmcircbuf_sysv_shm: shmat(2)"); + shmctl(shmid_guard, IPC_RMID, 0); + shmctl(shmid1, IPC_RMID, 0); + throw std::runtime_error("gr::vmcircbuf_sysv_shm"); + } + + // first copy + if(shmat (shmid1, (char*)first_copy + pagesize, 0) == (void *) -1) { + perror("gr::vmcircbuf_sysv_shm: shmat (3)"); + shmctl(shmid_guard, IPC_RMID, 0); + shmctl(shmid1, IPC_RMID, 0); + shmdt(first_copy); + throw std::runtime_error("gr::vmcircbuf_sysv_shm"); + } + + // second copy + if(shmat (shmid1, (char*)first_copy + pagesize + size, 0) == (void *) -1) { + perror("gr::vmcircbuf_sysv_shm: shmat (4)"); + shmctl(shmid_guard, IPC_RMID, 0); + shmctl(shmid1, IPC_RMID, 0); + shmdt((char *)first_copy + pagesize); + throw std::runtime_error("gr::vmcircbuf_sysv_shm"); + } + + // second read-only guard page + if(shmat(shmid_guard, (char*)first_copy + pagesize + 2 * size, SHM_RDONLY) == (void *) -1) { + perror("gr::vmcircbuf_sysv_shm: shmat(5)"); + shmctl(shmid_guard, IPC_RMID, 0); + shmctl(shmid1, IPC_RMID, 0); + shmdt(first_copy); + shmdt((char *)first_copy + pagesize); + shmdt((char *)first_copy + pagesize + size); + throw std::runtime_error ("gr::vmcircbuf_sysv_shm"); + } + + shmctl(shmid1, IPC_RMID, 0); + shmctl(shmid_guard, IPC_RMID, 0); + + // Now remember the important stuff + d_base = (char*)first_copy + pagesize; + d_size = size; +#endif + } + + vmcircbuf_sysv_shm::~vmcircbuf_sysv_shm() + { +#if defined(HAVE_SYS_SHM_H) + if(shmdt(d_base - gr::pagesize()) == -1 + || shmdt(d_base) == -1 + || shmdt(d_base + d_size) == -1 + || shmdt(d_base + 2 * d_size) == -1){ + perror("gr::vmcircbuf_sysv_shm: shmdt(2)"); + } +#endif + } + + // ---------------------------------------------------------------- + // The factory interface + // ---------------------------------------------------------------- + + gr::vmcircbuf_factory *vmcircbuf_sysv_shm_factory::s_the_factory = 0; + + gr::vmcircbuf_factory * + vmcircbuf_sysv_shm_factory::singleton() + { + if(s_the_factory) + return s_the_factory; + + s_the_factory = new gr::vmcircbuf_sysv_shm_factory(); + return s_the_factory; + } + + int + vmcircbuf_sysv_shm_factory::granularity() + { + return gr::pagesize(); + } + + gr::vmcircbuf * + vmcircbuf_sysv_shm_factory::make(int size) + { + try { + return new vmcircbuf_sysv_shm(size); + } + catch (...) { + return 0; + } + } + +} /* namespace gr */ diff --git a/gnuradio-runtime/lib/vmcircbuf_sysv_shm.h b/gnuradio-runtime/lib/vmcircbuf_sysv_shm.h new file mode 100644 index 0000000000..08e0040bf1 --- /dev/null +++ b/gnuradio-runtime/lib/vmcircbuf_sysv_shm.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003 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. + */ + +#ifndef GR_VMCIRCBUF_SYSV_SHM_H +#define GR_VMCIRCBUF_SYSV_SHM_H + +#include <gnuradio/api.h> +#include "vmcircbuf.h" + +namespace gr { + + /*! + * \brief concrete class to implement circular buffers with mmap and shm_open + * \ingroup internal + */ + class GR_RUNTIME_API vmcircbuf_sysv_shm : public gr::vmcircbuf + { + public: + vmcircbuf_sysv_shm(int size); + virtual ~vmcircbuf_sysv_shm(); + }; + + /*! + * \brief concrete factory for circular buffers built using mmap and shm_open + */ + class GR_RUNTIME_API vmcircbuf_sysv_shm_factory : public gr::vmcircbuf_factory + { + private: + static gr::vmcircbuf_factory *s_the_factory; + + public: + static gr::vmcircbuf_factory *singleton(); + + virtual const char *name() const { return "gr::vmcircbuf_sysv_shm_factory"; } + + /*! + * \brief return granularity of mapping, typically equal to page size + */ + virtual int granularity(); + + /*! + * \brief return a gr::vmcircbuf, or 0 if unable. + * + * Call this to create a doubly mapped circular buffer. + */ + virtual gr::vmcircbuf *make(int size); + }; + +} /* namespace gr */ + +#endif /* GR_VMCIRCBUF_SYSV_SHM_H */ diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt index af563d3327..c910433cf7 100644 --- a/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt +++ b/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt @@ -21,15 +21,15 @@ include(GrPython) EXECUTE_PROCESS( - COMMAND ${ICE_SLICE2PY} -I${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib + COMMAND ${ICE_SLICE2PY} -I${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/controlport --output-dir=${CMAKE_BINARY_DIR}/gnuradio-runtime/python - ${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/gnuradio.ice + ${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/controlport/gnuradio.ice ) EXECUTE_PROCESS( - COMMAND ${ICE_SLICE2PY} -I${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib + COMMAND ${ICE_SLICE2PY} -I${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/controlport --output-dir=${CMAKE_BINARY_DIR}/gnuradio-runtime/python - ${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/frontend.ice + ${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/controlport/frontend.ice ) GR_PYTHON_INSTALL( diff --git a/gnuradio-runtime/python/gnuradio/gr/__init__.py b/gnuradio-runtime/python/gnuradio/gr/__init__.py index c1d6c87629..20a8f97f63 100644 --- a/gnuradio-runtime/python/gnuradio/gr/__init__.py +++ b/gnuradio-runtime/python/gnuradio/gr/__init__.py @@ -36,4 +36,4 @@ from tag_utils import * from gateway import basic_block, sync_block, decim_block, interp_block # Force the preference database to be initialized -prefs = gr_prefs.singleton +prefs = prefs.singleton diff --git a/gnuradio-runtime/python/gnuradio/gr/gateway.py b/gnuradio-runtime/python/gnuradio/gr/gateway.py index b595959494..4ff0c4fe00 100644 --- a/gnuradio-runtime/python/gnuradio/gr/gateway.py +++ b/gnuradio-runtime/python/gnuradio/gr/gateway.py @@ -21,7 +21,7 @@ import runtime_swig as gr from runtime_swig import io_signature, io_signaturev -from runtime_swig import gr_block_gw_message_type +from runtime_swig import block_gw_message_type from runtime_swig import block_gateway import numpy @@ -107,16 +107,16 @@ class gateway_block(object): self.__handler.init(self.__gr_block_handle) self.__gateway = block_gateway( self.__handler, name, gr_in_sig, gr_out_sig, work_type, factor) - self.__message = self.__gateway.gr_block_message() + self.__message = self.__gateway.block_message() #dict to keep references to all message handlers self.__msg_handlers = {} - #register gr_block functions - prefix = 'gr_block__' + #register block functions + prefix = 'block__' for attr in [x for x in dir(self.__gateway) if x.startswith(prefix)]: setattr(self, attr.replace(prefix, ''), getattr(self.__gateway, attr)) - self.pop_msg_queue = lambda: gr.gr_block_gw_pop_msg_queue_safe(self.__gateway) + self.pop_msg_queue = lambda: gr.block_gw_pop_msg_queue_safe(self.__gateway) def to_basic_block(self): """ @@ -128,7 +128,7 @@ class gateway_block(object): """ Dispatch tasks according to the action type specified in the message. """ - if self.__message.action == gr_block_gw_message_type.ACTION_GENERAL_WORK: + if self.__message.action == gr.block_gw_message_type.ACTION_GENERAL_WORK: self.__message.general_work_args_return_value = self.general_work( input_items=[pointer_to_ndarray( @@ -144,7 +144,7 @@ class gateway_block(object): ) for i in self.__out_indexes], ) - elif self.__message.action == gr_block_gw_message_type.ACTION_WORK: + elif self.__message.action == gr.block_gw_message_type.ACTION_WORK: self.__message.work_args_return_value = self.work( input_items=[pointer_to_ndarray( @@ -160,16 +160,16 @@ class gateway_block(object): ) for i in self.__out_indexes], ) - elif self.__message.action == gr_block_gw_message_type.ACTION_FORECAST: + elif self.__message.action == gr.block_gw_message_type.ACTION_FORECAST: self.forecast( noutput_items=self.__message.forecast_args_noutput_items, ninput_items_required=self.__message.forecast_args_ninput_items_required, ) - elif self.__message.action == gr_block_gw_message_type.ACTION_START: + elif self.__message.action == gr.block_gw_message_type.ACTION_START: self.__message.start_args_return_value = self.start() - elif self.__message.action == gr_block_gw_message_type.ACTION_STOP: + elif self.__message.action == gr.block_gw_message_type.ACTION_STOP: self.__message.stop_args_return_value = self.stop() def forecast(self, noutput_items, ninput_items_required): diff --git a/gnuradio-runtime/python/gnuradio/gr/prefs.py b/gnuradio-runtime/python/gnuradio/gr/prefs.py index 25fa8cd6ae..abba6b57a6 100644 --- a/gnuradio-runtime/python/gnuradio/gr/prefs.py +++ b/gnuradio-runtime/python/gnuradio/gr/prefs.py @@ -20,7 +20,7 @@ # import gnuradio_core as gsp -_prefs_base = gsp.gr_prefs +_prefs_base = gsp.prefs import ConfigParser diff --git a/gnuradio-runtime/python/gnuradio/gr/qa_tag_utils.py b/gnuradio-runtime/python/gnuradio/gr/qa_tag_utils.py index de1b5aa002..3a0e7889f9 100755 --- a/gnuradio-runtime/python/gnuradio/gr/qa_tag_utils.py +++ b/gnuradio-runtime/python/gnuradio/gr/qa_tag_utils.py @@ -38,7 +38,7 @@ class test_tag_utils (gr_unittest.TestCase): self.tb = None def test_001(self): - t = gr.gr_tag_t() + t = gr.tag_t() t.offset = 10 t.key = pmt.string_to_symbol('key') t.value = pmt.from_long(23) diff --git a/gnuradio-runtime/python/gnuradio/gr/tag_utils.py b/gnuradio-runtime/python/gnuradio/gr/tag_utils.py index 8de7110e3f..e35564c1eb 100644 --- a/gnuradio-runtime/python/gnuradio/gr/tag_utils.py +++ b/gnuradio-runtime/python/gnuradio/gr/tag_utils.py @@ -25,7 +25,7 @@ import pmt try: from gnuradio import gr except ImportError: - from runtime_swig import gr_tag_t + from runtime_swig import tag_t class PythonTag(object): " Python container for tags " @@ -46,7 +46,7 @@ def tag_to_python(tag): def tag_to_pmt(tag): """ Convert a Python-readable object to a stream tag """ - newtag = gr_tag_t() + newtag = tag_t() newtag.offset = tag.offset newtag.key = pmt.to_python(tag.key) newtag.value = pmt.from_python(tag.value) diff --git a/gnuradio-runtime/swig/CMakeLists.txt b/gnuradio-runtime/swig/CMakeLists.txt index 3bff08383f..f6f63b4384 100644 --- a/gnuradio-runtime/swig/CMakeLists.txt +++ b/gnuradio-runtime/swig/CMakeLists.txt @@ -90,40 +90,39 @@ GR_SWIG_INSTALL( install( FILES gnuradio_swig_bug_workaround.h + runtime_swig.i + gnuradio.i + basic_block.i + block.i + block_detail.i + block_gateway.i + buffer.i complex_vec_test.i + constants.i + feval.i gnuradio.i - gr_basic_block.i - gr_block_detail.i - gr_block.i - gr_buffer.i - gr_constants.i gr_ctrlport.i - gr_dispatcher.i - gr_error_handler.i - gr_feval.i - gr_hier_block2.i - gr_io_signature.i + gr_extras.i + gr_intrusive_ptr.i gr_logger.i - gr_message.i - gr_msg_handler.i - gr_msg_queue.i - gr_prefs.i - gr_realtime.i gr_shared_ptr.i - gr_single_threaded_scheduler.i gr_swig_block_magic.i - gr_sync_block.i - gr_sync_decimator.i - gr_sync_interpolator.i - gr_tagged_stream_block.i - gr_tags.i - gr_top_block.i gr_types.i - gr_extras.i - runtime_block_gateway.i - runtime_swig.i - gr_intrusive_ptr.i + hier_block2.i + io_signature.i + message.i + msg_handler.i + msg_queue.i pmt_swig.i + prefs.i + realtime.i + single_threaded_scheduler.i + sync_block.i + sync_decimator.i + sync_interpolator.i + tagged_stream_block.i + tags.i + top_block.i ${CMAKE_CURRENT_BINARY_DIR}/runtime_swig_doc.i ${CMAKE_CURRENT_BINARY_DIR}/pmt_swig_doc.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig diff --git a/gnuradio-runtime/swig/gr_basic_block.i b/gnuradio-runtime/swig/basic_block.i index 2e703278c5..6599ea4d7b 100644 --- a/gnuradio-runtime/swig/gr_basic_block.i +++ b/gnuradio-runtime/swig/basic_block.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2010 Free Software Foundation, Inc. + * Copyright 2006,2010,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,44 +20,46 @@ * Boston, MA 02110-1301, USA. */ -class gr_basic_block; -typedef boost::shared_ptr<gr_basic_block> gr_basic_block_sptr; -%template(gr_basic_block_sptr) boost::shared_ptr<gr_basic_block>; +class gr::basic_block; +typedef boost::shared_ptr<gr::basic_block> gr::basic_block_sptr; +%template(basic_block_sptr) boost::shared_ptr<gr::basic_block>; -%include "pmt_swig.i" -using namespace pmt; +%import "pmt_swig.i" // support vectors of these... namespace std { - %template(x_vector_gr_basic_block_sptr) vector<gr_basic_block_sptr>; + %template(x_vector_basic_block_sptr) vector<gr::basic_block_sptr>; }; -class gr_basic_block -{ -protected: - gr_basic_block(); +namespace gr { -public: - virtual ~gr_basic_block(); + class gr::basic_block + { + protected: + basic_block(); + + public: + virtual ~basic_block(); std::string name() const; std::string symbol_name() const; - gr_io_signature_sptr input_signature() const; - gr_io_signature_sptr output_signature() const; + gr::io_signature::sptr input_signature() const; + gr::io_signature::sptr output_signature() const; long unique_id() const; - gr_basic_block_sptr to_basic_block(); - bool check_topology (int ninputs, int noutputs); + gr::basic_block_sptr to_basic_block(); + bool check_topology(int ninputs, int noutputs); std::string alias(); void set_block_alias(std::string name); - void _post(pmt_t which_port, pmt_t msg); - pmt_t message_ports_in(); - pmt_t message_ports_out(); -}; + void _post(pmt::pmt_t which_port, pmt::pmt_t msg); + pmt::pmt_t message_ports_in(); + pmt::pmt_t message_ports_out(); + }; -%rename(block_ncurrently_allocated) gr_basic_block_ncurrently_allocated; -long gr_basic_block_ncurrently_allocated(); + %rename(block_ncurrently_allocated) basic_block_ncurrently_allocated; + long basic_block_ncurrently_allocated(); +} #ifdef SWIGPYTHON %pythoncode %{ -gr_basic_block_sptr.__repr__ = lambda self: "<gr_basic_block %s (%d)>" % (self.name(), self.unique_id ()) +basic_block_sptr.__repr__ = lambda self: "<basic_block %s (%d)>" % (self.name(), self.unique_id ()) %} #endif diff --git a/gnuradio-runtime/swig/gr_block.i b/gnuradio-runtime/swig/block.i index a53489f9a2..f697089185 100644 --- a/gnuradio-runtime/swig/gr_block.i +++ b/gnuradio-runtime/swig/block.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2010 Free Software Foundation, Inc. + * Copyright 2004,2010,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,26 +20,27 @@ * Boston, MA 02110-1301, USA. */ -%include <gr_basic_block.i> +%include <basic_block.i> -class gr_block; -typedef boost::shared_ptr<gr_block> gr_block_sptr; -%template(gr_block_sptr) boost::shared_ptr<gr_block>; +class gr::block; +typedef boost::shared_ptr<gr::block> gr::block_sptr; +%template(block_sptr) boost::shared_ptr<gr::block>; // support vectors of these... namespace std { - %template(x_vector_gr_block_sptr) vector<gr_block_sptr>; + %template(x_vector_block_sptr) vector<gr::block_sptr>; }; -class gr_block : public gr_basic_block { +class gr::block : public gr::basic_block +{ protected: - gr_block (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature); + block (const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature); public: - virtual ~gr_block (); + virtual ~block (); unsigned history () const; @@ -88,6 +89,6 @@ class gr_block : public gr_basic_block { std::vector<int> processor_affinity(); // internal use - gr_block_detail_sptr detail () const { return d_detail; } - void set_detail (gr_block_detail_sptr detail) { d_detail = detail; } + //block_detail_sptr detail () const { return d_detail; } + //void set_detail (block_detail_sptr detail) { d_detail = detail; } }; diff --git a/gnuradio-runtime/swig/block_detail.i b/gnuradio-runtime/swig/block_detail.i new file mode 100644 index 0000000000..a43e02bc6a --- /dev/null +++ b/gnuradio-runtime/swig/block_detail.i @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 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. + */ + +class gr::block_detail; +typedef boost::shared_ptr<gr::block_detail> gr::block_detail_sptr; +%template(block_detail_sptr) boost::shared_ptr<gr::block_detail>; +%rename(block_detail) gr::make_block_detail; +%ignore gr::block_detail; + +gr::block_detail_sptr gr:: +gr::make_block_detail(unsigned int ninputs, unsigned int noutputs); + +namespace gr { + + class gr::block_detail { + public: + + ~block_detail (); + + int ninputs() const; + int noutputs() const; + bool sink_p() const; + bool source_p() const; + + void set_input(unsigned int which, gr::buffer_reader_sptr reader); + gr::buffer_reader_sptr input(unsigned int which); + + void set_output(unsigned int which, gr::buffer_sptr buffer); + gr::buffer_sptr output(unsigned int which); + + private: + block_detail(unsigned int ninputs, unsigned int noutputs); + }; + + %rename(block_detail_ncurrently_allocated) block_detail_ncurrently_allocated; + long block_detail_ncurrently_allocated(); +} diff --git a/gnuradio-runtime/swig/runtime_block_gateway.i b/gnuradio-runtime/swig/block_gateway.i index 52d4194dee..95207a80a2 100644 --- a/gnuradio-runtime/swig/runtime_block_gateway.i +++ b/gnuradio-runtime/swig/block_gateway.i @@ -24,8 +24,8 @@ // standard includes //////////////////////////////////////////////////////////////////////// %include <gnuradio.i> -%include <gr_tags.i> -%include <gr_feval.i> +%include <tags.i> +%include <feval.i> %template(void_start_vector_t) std::vector<void *>; @@ -33,11 +33,17 @@ // block headers //////////////////////////////////////////////////////////////////////// %{ -#include <runtime_block_gateway.h> +#include <gnuradio/block_gateway.h> %} //////////////////////////////////////////////////////////////////////// // block magic //////////////////////////////////////////////////////////////////////// -GR_SWIG_BLOCK_MAGIC(runtime, block_gateway); -%include <runtime_block_gateway.h> +%include <gnuradio/block_gateway.h> + +%template(block_gateway_sptr) boost::shared_ptr<gr::block_gateway>; +%pythoncode %{ +block_gateway_sptr.__repr__ = lambda self: "<block_gateway>" +block_gateway = block_gateway.make; +%} + diff --git a/gnuradio-runtime/swig/buffer.i b/gnuradio-runtime/swig/buffer.i new file mode 100644 index 0000000000..44bd4887a8 --- /dev/null +++ b/gnuradio-runtime/swig/buffer.i @@ -0,0 +1,67 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 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. + */ + +class gr::buffer; +typedef boost::shared_ptr<gr::buffer> gr::buffer_sptr; +%template(buffer_sptr) boost::shared_ptr<gr::buffer>; +%rename(buffer) gr::make_buffer; +%ignore gr::buffer; + +gr::buffer_sptr +gr::make_buffer (int nitems, size_t sizeof_item, gr::block_sptr link); + +class gr::buffer_reader; +typedef boost::shared_ptr<gr::buffer_reader> gr::buffer_reader_sptr; +%template(buffer_reader_sptr) boost::shared_ptr<gr::buffer_reader>; +%ignore gr::buffer_reader; + +%rename(buffer_add_reader) gr::buffer_add_reader; +gr::buffer_reader_sptr +gr::buffer_add_reader (gr::buffer_sptr buf, int nzero_preload, gr::block_sptr link); + +namespace gr { + + class gr::buffer + { + public: + ~buffer(); + + private: + buffer(int nitems, size_t sizeof_item, gr::block_sptr link); + }; + + class gr::buffer_reader + { + public: + ~buffer_reader(); + + private: + friend class buffer; + buffer_reader(gr::buffer_sptr buffer, unsigned int read_index, gr::block_sptr link); + }; + + %rename(buffer_ncurrently_allocated) buffer_ncurrently_allocated; + long buffer_ncurrently_allocated(); + + %rename(buffer_reader_ncurrently_allocated) buffer_reader_ncurrently_allocated; + long buffer_reader_ncurrently_allocated(); +} diff --git a/gnuradio-runtime/swig/constants.i b/gnuradio-runtime/swig/constants.i new file mode 100644 index 0000000000..d9e5e28466 --- /dev/null +++ b/gnuradio-runtime/swig/constants.i @@ -0,0 +1,15 @@ +/* -*- c++ -*- */ + +namespace gr { + %rename(prefix) prefix; + %rename(sysconfdir) sysconfdir; + %rename(prefsdir) prefsdir; + %rename(build_date) build_date; + %rename(version) version; + + const std::string prefix(); + const std::string sysconfdir(); + const std::string prefsdir(); + const std::string build_date(); + const std::string version(); +} diff --git a/gnuradio-runtime/swig/feval.i b/gnuradio-runtime/swig/feval.i new file mode 100644 index 0000000000..f773346b1b --- /dev/null +++ b/gnuradio-runtime/swig/feval.i @@ -0,0 +1,243 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2010,2013 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. + */ + + +/* + * N.B., this is a _very_ non-standard SWIG .i file + * + * It contains a bunch of magic that is required to ensure that when + * these classes are used as base classes for python code, + * everything works when calling back from C++ into Python. + * + * The gist of the problem is that our C++ code is usually not holding + * the Python Global Interpreter Lock (GIL). Thus if we invoke a + * "director" method from C++, we'll end up in Python not holding the + * GIL. Disaster (SIGSEGV) will result. To avoid this we insert a + * "shim" that grabs and releases the GIL. + * + * If you don't understand SWIG "directors" or the Python GIL, + * don't bother trying to understand what's going on in here. + * + * [We could eliminate a bunch of this hair by requiring SWIG 1.3.29 + * or later and some additional magic declarations, but many systems + * aren't shipping that version yet. Thus we kludge...] + */ + +// Directors are only supported in Python, Java and C# +#ifdef SWIGPYTHON + +%import "pmt_swig.i" + + // Enable SWIG directors for these classes +%feature("director") gr::py_feval_dd; +%feature("director") gr::py_feval_cc; +%feature("director") gr::py_feval_ll; +%feature("director") gr::py_feval; +%feature("director") gr::py_feval_p; + +%feature("nodirector") gr::py_feval_dd::calleval; +%feature("nodirector") gr::py_feval_cc::calleval; +%feature("nodirector") gr::py_feval_ll::calleval; +%feature("nodirector") gr::py_feval::calleval; +%feature("nodirector") gr::py_feval_p::calleval; + +//%exception { +// try { $action } +// catch (Swig::DirectorException &e) { std::cerr << e.getMessage(); SWIG_fail; } +//} + +%{ + +// class that ensures we acquire and release the Python GIL + +class ensure_py_gil_state { + PyGILState_STATE d_gstate; +public: + ensure_py_gil_state() { d_gstate = PyGILState_Ensure(); } + ~ensure_py_gil_state() { PyGILState_Release(d_gstate); } +}; + +%} + +%ignore gr::feval_dd; +%ignore gr::feval_cc; +%ignore gr::feval_ll; +%ignore gr::feval; +%ignore gr::feval_p; + +namespace gr { +/* + * These are the real C++ base classes, however we don't want these exposed. + */ + class gr::feval_dd + { + protected: + virtual double eval(double x); + + public: + feval_dd() {} + virtual ~feval_dd(); + + virtual double calleval(double x); + }; + //%rename(feval_dd) gr::feval_dd; + + class gr::feval_cc + { + protected: + virtual gr_complex eval(gr_complex x); + + public: + feval_cc() {} + virtual ~feval_cc(); + + virtual gr_complex calleval(gr_complex x); + }; + //%rename(feval_cc) gr::feval_cc; + + class gr::feval_ll + { + protected: + virtual long eval(long x); + + public: + feval_ll() {} + virtual ~feval_ll(); + + virtual long calleval(long x); + }; + //%rename(feval_ll) gr::feval_ll; + + class gr::feval + { + protected: + virtual void eval(); + + public: + feval() {} + virtual ~feval(); + + virtual void calleval(); + }; + //%rename(feval) gr::feval; + + class gr::feval_p + { + protected: + virtual void eval(pmt::pmt_t x); + + public: + feval_p() {} + virtual ~feval_p(); + + virtual void calleval(pmt::pmt_t x); + }; + //%rename(feval_p) gr::feval_p; +} + +/* + * These are the ones to derive from in Python. They have the magic shim + * that ensures that we're holding the Python GIL when we enter Python land... + */ + +namespace gr { + %rename(feval_dd) py_feval_dd; + %rename(feval_cc) py_feval_cc; + %rename(feval_ll) py_feval_ll; + %rename(feval) py_feval; + %rename(feval_p) py_feval_p; +} + +%inline %{ +#include <pmt/pmt.h> + + namespace gr { + + class py_feval_dd : public gr::feval_dd + { + public: + double calleval(double x) + { + ensure_py_gil_state _lock; + return eval(x); + } + }; + + class py_feval_cc : public gr::feval_cc + { + public: + gr_complex calleval(gr_complex x) + { + ensure_py_gil_state _lock; + return eval(x); + } + }; + + class py_feval_ll : public gr::feval_ll + { + public: + long calleval(long x) + { + ensure_py_gil_state _lock; + return eval(x); + } + }; + + class py_feval : public gr::feval + { + public: + void calleval() + { + ensure_py_gil_state _lock; + eval(); + } + }; + + class py_feval_p : public gr::feval_p + { + public: + void calleval(pmt::pmt_t x) + { + ensure_py_gil_state _lock; + eval(x); + } + }; + } +%} + +namespace gr { + // examples / test cases + + %rename(feval_dd_example) gr::feval_dd_example; + double gr::feval_dd_example(gr::feval_dd *f, double x); + + %rename(feval_cc_example) gr::feval_cc_example; + gr_complex gr::feval_cc_example(gr::feval_cc *f, gr_complex x); + + %rename(feval_ll_example) gr::feval_ll_example; + long gr::feval_ll_example(gr::feval_ll *f, long x); + + %rename(feval_example) gr::feval_example; + void gr::feval_example(gr::feval *f); +} + +#endif // SWIGPYTHON diff --git a/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h b/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h index 1994f06609..1fc3755707 100644 --- a/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h +++ b/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h @@ -29,17 +29,16 @@ * %import "gnuradio.i" */ -class gr_base_error_handler; -class gr_basic_block; -class gr_block; -class gr_error_handler; -class gr_file_error_handler; -class gr_hier_block2; -class gr_msg_handler; -class gr_msg_queue; -class gr_sync_block; -class gr_sync_decimator; -class gr_sync_interpolator; -class gr_top_block; +class base_error_handler; +class basic_block; +class block; +class file_error_handler; +class hier_block2; +class msg_handler; +class msg_queue; +class sync_block; +class sync_decimator; +class sync_interpolator; +class top_block; #endif /* INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H */ diff --git a/gnuradio-runtime/swig/gr_block_detail.i b/gnuradio-runtime/swig/gr_block_detail.i deleted file mode 100644 index 74ff463604..0000000000 --- a/gnuradio-runtime/swig/gr_block_detail.i +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -class gr_block_detail; -typedef boost::shared_ptr<gr_block_detail> gr_block_detail_sptr; -%template(gr_block_detail_sptr) boost::shared_ptr<gr_block_detail>; -%rename(block_detail) gr_make_block_detail; -%ignore gr_block_detail; - -gr_block_detail_sptr gr_make_block_detail (unsigned int ninputs, unsigned int noutputs); - -class gr_block_detail { - public: - - ~gr_block_detail (); - - int ninputs () const { return d_ninputs; } - int noutputs () const { return d_noutputs; } - bool sink_p () const { return d_noutputs == 0; } - bool source_p () const { return d_ninputs == 0; } - - void set_input (unsigned int which, gr_buffer_reader_sptr reader); - gr_buffer_reader_sptr input (unsigned int which) - { - if (which >= d_ninputs) - throw std::invalid_argument ("gr_block_detail::input"); - return d_input[which]; - } - - void set_output (unsigned int which, gr_buffer_sptr buffer); - gr_buffer_sptr output (unsigned int which) - { - if (which >= d_noutputs) - throw std::invalid_argument ("gr_block_detail::output"); - return d_output[which]; - } - - // ---------------------------------------------------------------------------- - - private: - gr_block_detail (unsigned int ninputs, unsigned int noutputs); - -}; - - -%rename(block_detail_ncurrently_allocated) gr_block_detail_ncurrently_allocated; -long gr_block_detail_ncurrently_allocated (); diff --git a/gnuradio-runtime/swig/gr_buffer.i b/gnuradio-runtime/swig/gr_buffer.i deleted file mode 100644 index 390a94e050..0000000000 --- a/gnuradio-runtime/swig/gr_buffer.i +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -class gr_buffer; -typedef boost::shared_ptr<gr_buffer> gr_buffer_sptr; -%template(gr_buffer_sptr) boost::shared_ptr<gr_buffer>; -%rename(buffer) gr_make_buffer; -%ignore gr_buffer; - -gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link); - -class gr_buffer { - public: - ~gr_buffer (); - - private: - gr_buffer (int nitems, size_t sizeof_item, gr_block_sptr link); -}; - - -class gr_buffer_reader; -typedef boost::shared_ptr<gr_buffer_reader> gr_buffer_reader_sptr; -%template(gr_buffer_reader_sptr) boost::shared_ptr<gr_buffer_reader>; -%ignore gr_buffer_reader; - -%rename(buffer_add_reader) gr_buffer_add_reader; -gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link); - -class gr_buffer_reader { - public: - ~gr_buffer_reader (); - - private: - friend class gr_buffer; - gr_buffer_reader (gr_buffer_sptr buffer, unsigned int read_index, gr_block_sptr link); -}; - - -%rename(buffer_ncurrently_allocated) gr_buffer_ncurrently_allocated; -long gr_buffer_ncurrently_allocated (); - -%rename(buffer_reader_ncurrently_allocated) gr_buffer_reader_ncurrently_allocated; -long gr_buffer_reader_ncurrently_allocated (); - diff --git a/gnuradio-runtime/swig/gr_constants.i b/gnuradio-runtime/swig/gr_constants.i deleted file mode 100644 index a5aef14925..0000000000 --- a/gnuradio-runtime/swig/gr_constants.i +++ /dev/null @@ -1,13 +0,0 @@ -/* -*- c++ -*- */ - -%rename(prefix) gr_prefix; -%rename(sysconfdir) gr_sysconfdir; -%rename(prefsdir) gr_prefsdir; -%rename(build_date) gr_build_date; -%rename(version) gr_version; - -const std::string gr_prefix(); -const std::string gr_sysconfdir(); -const std::string gr_prefsdir(); -const std::string gr_build_date(); -const std::string gr_version(); diff --git a/gnuradio-runtime/swig/gr_ctrlport.i b/gnuradio-runtime/swig/gr_ctrlport.i index fa3ae845d7..ac05c05ee5 100644 --- a/gnuradio-runtime/swig/gr_ctrlport.i +++ b/gnuradio-runtime/swig/gr_ctrlport.i @@ -53,14 +53,14 @@ enum KnobType { }; %{ -#include <rpcserver_booter_base.h> -#include <rpcserver_booter_aggregator.h> -#include <pycallback_object.h> +#include <gnuradio/rpcserver_booter_base.h> +#include <gnuradio/rpcserver_booter_aggregator.h> +#include <gnuradio/pycallback_object.h> %} -%include <rpcserver_booter_base.h> -%include <rpcserver_booter_aggregator.h> -%include <pycallback_object.h> +%include <gnuradio/rpcserver_booter_base.h> +%include <gnuradio/rpcserver_booter_aggregator.h> +%include <gnuradio/pycallback_object.h> // Declare this class here but without the nested templated class // inside (replaces include of rpcmanager.h) diff --git a/gnuradio-runtime/swig/gr_dispatcher.i b/gnuradio-runtime/swig/gr_dispatcher.i deleted file mode 100644 index 28737cd317..0000000000 --- a/gnuradio-runtime/swig/gr_dispatcher.i +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ - -class gr_dispatcher; -typedef boost::shared_ptr<gr_dispatcher> gr_dispatcher_sptr; -%template(gr_dispatcher_sptr) boost::shared_ptr<gr_dispatcher>; - -%rename(dispatcher) gr_make_dispatcher; -gr_dispatcher_sptr gr_make_dispatcher(); - -%rename(dispatcher_singleton) gr_dispatcher_singleton; -gr_dispatcher_sptr gr_dispatcher_singleton(); - -/*! - * \brief invoke callbacks based on select. - * - * \sa gr_select_handler - */ -class gr_dispatcher -{ - gr_dispatcher(); - -public: - ~gr_dispatcher(); - - /*! - * \brief Event dispatching loop. - * - * Enter a polling loop that only terminates after all gr_select_handlers - * have been removed. \p timeout sets the timeout parameter to the select() - * call, measured in seconds. - * - * \param timeout maximum number of seconds to block in select. - */ - void loop(double timeout=10); -}; diff --git a/gnuradio-runtime/swig/gr_error_handler.i b/gnuradio-runtime/swig/gr_error_handler.i deleted file mode 100644 index 072394a727..0000000000 --- a/gnuradio-runtime/swig/gr_error_handler.i +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ - -%rename(error_handler) gr_error_handler; -%rename(file_error_handler) gr_file_error_handler; - -class gr_error_handler { -public: - enum seriousness { - ERR_DEBUG = 0x00000000, - ERR_MESSAGE = 0x00010000, - ERR_WARNING = 0x00020000, - ERR_ERROR = 0x00030000, - ERR_FATAL = 0x00040000 - }; - - gr_error_handler() {} - virtual ~gr_error_handler(); - - static gr_error_handler *default_handler(); - static gr_error_handler *silent_handler(); - - static bool has_default_handler(); - static void set_default_handler(gr_error_handler *errh); - - virtual int nwarnings() const = 0; - virtual int nerrors() const = 0; - virtual void reset_counts() = 0; - - void verror_text(seriousness s, const std::string &text); -}; - -%ignore gr_base_error_handler; -class gr_base_error_handler : public gr_error_handler { - int d_nwarnings; - int d_nerrors; - -public: - gr_base_error_handler() : d_nwarnings(0), d_nerrors(0) {} - int nwarnings() const { return d_nwarnings; } - int nerrors() const { return d_nerrors; } - void reset_counts() { d_nwarnings = d_nerrors = 0; } - void count_error(seriousness s); -}; - -class gr_file_error_handler : public gr_base_error_handler { -public: - gr_file_error_handler(int file_descriptor); - ~gr_file_error_handler(); -}; diff --git a/gnuradio-runtime/swig/gr_feval.i b/gnuradio-runtime/swig/gr_feval.i deleted file mode 100644 index e3b8696fa6..0000000000 --- a/gnuradio-runtime/swig/gr_feval.i +++ /dev/null @@ -1,233 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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. - */ - - -/* - * N.B., this is a _very_ non-standard SWIG .i file - * - * It contains a bunch of magic that is required to ensure that when - * these classes are used as base classes for python code, - * everything works when calling back from C++ into Python. - * - * The gist of the problem is that our C++ code is usually not holding - * the Python Global Interpreter Lock (GIL). Thus if we invoke a - * "director" method from C++, we'll end up in Python not holding the - * GIL. Disaster (SIGSEGV) will result. To avoid this we insert a - * "shim" that grabs and releases the GIL. - * - * If you don't understand SWIG "directors" or the Python GIL, - * don't bother trying to understand what's going on in here. - * - * [We could eliminate a bunch of this hair by requiring SWIG 1.3.29 - * or later and some additional magic declarations, but many systems - * aren't shipping that version yet. Thus we kludge...] - */ - - -// Directors are only supported in Python, Java and C# -#ifdef SWIGPYTHON -%include "pmt_swig.i" -using namespace pmt; - -// Enable SWIG directors for these classes -%feature("director") gr_py_feval_dd; -%feature("director") gr_py_feval_cc; -%feature("director") gr_py_feval_ll; -%feature("director") gr_py_feval; -%feature("director") gr_py_feval_p; - -%feature("nodirector") gr_py_feval_dd::calleval; -%feature("nodirector") gr_py_feval_cc::calleval; -%feature("nodirector") gr_py_feval_ll::calleval; -%feature("nodirector") gr_py_feval::calleval; -%feature("nodirector") gr_py_feval_p::calleval; - - -%rename(feval_dd) gr_py_feval_dd; -%rename(feval_cc) gr_py_feval_cc; -%rename(feval_ll) gr_py_feval_ll; -%rename(feval) gr_py_feval; -%rename(feval_p) gr_py_feval_p; - -//%exception { -// try { $action } -// catch (Swig::DirectorException &e) { std::cerr << e.getMessage(); SWIG_fail; } -//} - -%{ - -// class that ensures we acquire and release the Python GIL - -class ensure_py_gil_state { - PyGILState_STATE d_gstate; -public: - ensure_py_gil_state() { d_gstate = PyGILState_Ensure(); } - ~ensure_py_gil_state() { PyGILState_Release(d_gstate); } -}; - -%} - -/* - * These are the real C++ base classes, however we don't want these exposed. - */ -%ignore gr_feval_dd; -class gr_feval_dd -{ -protected: - virtual double eval(double x); - -public: - gr_feval_dd() {} - virtual ~gr_feval_dd(); - - virtual double calleval(double x); -}; - -%ignore gr_feval_cc; -class gr_feval_cc -{ -protected: - virtual gr_complex eval(gr_complex x); - -public: - gr_feval_cc() {} - virtual ~gr_feval_cc(); - - virtual gr_complex calleval(gr_complex x); -}; - -%ignore gr_feval_ll; -class gr_feval_ll -{ -protected: - virtual long eval(long x); - -public: - gr_feval_ll() {} - virtual ~gr_feval_ll(); - - virtual long calleval(long x); -}; - -%ignore gr_feval; -class gr_feval -{ -protected: - virtual void eval(); - -public: - gr_feval() {} - virtual ~gr_feval(); - - virtual void calleval(); -}; - -%ignore gr_feval_p; -class gr_feval_p -{ -protected: - virtual void eval(pmt_t x); - -public: - gr_feval_p() {} - virtual ~gr_feval_p(); - - virtual void calleval(pmt_t x); -}; - -/* - * These are the ones to derive from in Python. They have the magic shim - * that ensures that we're holding the Python GIL when we enter Python land... - */ - -%inline %{ -#include <pmt/pmt.h> - -class gr_py_feval_dd : public gr_feval_dd -{ - public: - double calleval(double x) - { - ensure_py_gil_state _lock; - return eval(x); - } -}; - -class gr_py_feval_cc : public gr_feval_cc -{ - public: - gr_complex calleval(gr_complex x) - { - ensure_py_gil_state _lock; - return eval(x); - } -}; - -class gr_py_feval_ll : public gr_feval_ll -{ - public: - long calleval(long x) - { - ensure_py_gil_state _lock; - return eval(x); - } -}; - -class gr_py_feval : public gr_feval -{ - public: - void calleval() - { - ensure_py_gil_state _lock; - eval(); - } -}; - -class gr_py_feval_p : public gr_feval_p -{ - public: - void calleval(pmt::pmt_t x) - { - ensure_py_gil_state _lock; - eval(x); - } -}; - -%} - - - -// examples / test cases - -%rename(feval_dd_example) gr_feval_dd_example; -double gr_feval_dd_example(gr_feval_dd *f, double x); - -%rename(feval_cc_example) gr_feval_cc_example; -gr_complex gr_feval_cc_example(gr_feval_cc *f, gr_complex x); - -%rename(feval_ll_example) gr_feval_ll_example; -long gr_feval_ll_example(gr_feval_ll *f, long x); - -%rename(feval_example) gr_feval_example; -void gr_feval_example(gr_feval *f); - -#endif // SWIGPYTHON diff --git a/gnuradio-runtime/swig/gr_hier_block2.i b/gnuradio-runtime/swig/gr_hier_block2.i deleted file mode 100644 index a857394ca7..0000000000 --- a/gnuradio-runtime/swig/gr_hier_block2.i +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2007 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. - */ - -%include <gr_basic_block.i> - -class gr_hier_block2; -typedef boost::shared_ptr<gr_hier_block2> gr_hier_block2_sptr; -%template(gr_hier_block2_sptr) boost::shared_ptr<gr_hier_block2>; - -// Hack to have a Python shim implementation of gr.hier_block2 -// that instantiates one of these and passes through calls -%rename(hier_block2_swig) gr_make_hier_block2; -gr_hier_block2_sptr gr_make_hier_block2(const std::string name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature) - throw (std::runtime_error); - -// Rename connect and disconnect so that we can more easily build a -// better interface in scripting land. -%rename(primitive_connect) gr_hier_block2::connect; -%rename(primitive_disconnect) gr_hier_block2::disconnect; -%rename(primitive_msg_connect) gr_hier_block2::msg_connect; -%rename(primitive_msg_disconnect) gr_hier_block2::msg_disconnect; -%rename(primitive_message_port_register_hier_in) gr_hier_block2::message_port_register_hier_in; -%rename(primitive_message_port_register_hier_out) gr_hier_block2::message_port_register_hier_out; - -class gr_hier_block2 : public gr_basic_block -{ -private: - gr_hier_block2(const std::string name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature); - -public: - ~gr_hier_block2 (); - - void connect(gr_basic_block_sptr block) - throw (std::invalid_argument); - void connect(gr_basic_block_sptr src, int src_port, - gr_basic_block_sptr dst, int dst_port) - throw (std::invalid_argument); - void msg_connect(gr_basic_block_sptr src, pmt::pmt_t srcport, - gr_basic_block_sptr dst, pmt::pmt_t dstport) - throw (std::runtime_error); - void msg_connect(gr_basic_block_sptr src, std::string srcport, - gr_basic_block_sptr dst, std::string dstport) - throw (std::runtime_error); - void msg_disconnect(gr_basic_block_sptr src, pmt::pmt_t srcport, - gr_basic_block_sptr dst, pmt::pmt_t dstport) - throw (std::runtime_error); - void msg_disconnect(gr_basic_block_sptr src, std::string srcport, - gr_basic_block_sptr dst, std::string dstport) - throw (std::runtime_error); - - void disconnect(gr_basic_block_sptr block) - throw (std::invalid_argument); - void disconnect(gr_basic_block_sptr src, int src_port, - gr_basic_block_sptr dst, int dst_port) - throw (std::invalid_argument); - void disconnect_all(); - void lock(); - void unlock(); - - void message_port_register_hier_in(pmt::pmt_t port_id); - void message_port_register_hier_out(pmt::pmt_t port_id); - - - gr_hier_block2_sptr to_hier_block2(); // Needed for Python type coercion -}; diff --git a/gnuradio-runtime/swig/gr_io_signature.i b/gnuradio-runtime/swig/gr_io_signature.i deleted file mode 100644 index fe1707e410..0000000000 --- a/gnuradio-runtime/swig/gr_io_signature.i +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005,2007 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. - */ - -class gr_io_signature; -typedef boost::shared_ptr<gr_io_signature> gr_io_signature_sptr; -%template(gr_io_signature_sptr) boost::shared_ptr<gr_io_signature>; - -%rename(io_signature) gr_make_io_signature; -%rename(io_signature2) gr_make_io_signature2; -%rename(io_signature3) gr_make_io_signature3; -%rename(io_signaturev) gr_make_io_signaturev; - - -gr_io_signature_sptr -gr_make_io_signature(int min_streams, int max_streams, - int sizeof_stream_item); - -gr_io_signature_sptr -gr_make_io_signature2(int min_streams, int max_streams, - int sizeof_stream_item1, - int sizeof_stream_item2 - ); -gr_io_signature_sptr -gr_make_io_signature3(int min_streams, int max_streams, - int sizeof_stream_item1, - int sizeof_stream_item2, - int sizeof_stream_item3 - ); -gr_io_signature_sptr -gr_make_io_signaturev(int min_streams, int max_streams, - const std::vector<int> &sizeof_stream_items); - - -class gr_io_signature { - gr_io_signature (int min_streams, int max_streams, int sizeof_stream_item); - - friend gr_io_signature_sptr - gr_make_io_signaturev(int min_streams, - int max_streams, - const std::vector<int> &sizeof_stream_item); - - public: - - // disabled. Suspected bug in SWIG 1.3.24 - // static const int IO_INFINITE = -1; - - ~gr_io_signature (); - - int min_streams () const { return d_min_streams; } - int max_streams () const { return d_max_streams; } - int sizeof_stream_item (int index) const; - std::vector<int> sizeof_stream_items() const; -}; - diff --git a/gnuradio-runtime/swig/gr_logger.i b/gnuradio-runtime/swig/gr_logger.i index b43bff5a89..d87ee01b44 100644 --- a/gnuradio-runtime/swig/gr_logger.i +++ b/gnuradio-runtime/swig/gr_logger.i @@ -41,39 +41,43 @@ %{ // The .h files -#include <gr_logger.h> +#include <gnuradio/logger.h> %} -%rename(logger) gr_logger; -%rename(logger_config) gr_logger_config; -%rename(logger_get_names) gr_logger_get_logger_names; -%rename(logger_reset_config) gr_logger_reset_config; +%rename(logger) gr::logger; +%rename(logger_config) gr::logger_config; +%rename(logger_get_names) gr::logger_get_logger_names; +%rename(logger_reset_config) gr::logger_reset_config; +namespace gr { -void gr_logger_config(const std::string config_filename,unsigned int watch_period = 0); -std::vector<std::string> gr_logger_get_logger_names(void); -void gr_logger_reset_config(void); + void logger_config(const std::string config_filename, unsigned int watch_period = 0); + std::vector<std::string> logger_get_logger_names(void); + void logger_reset_config(void); -class gr_logger -{ - public: - gr_logger(std::string logger_name); - void set_level(std::string level){GR_LOG_SET_LEVEL(d_logger,level);} - void get_level(std::string &level){GR_LOG_GET_LEVEL(d_logger,level);} - void debug(std::string msg){GR_LOG_DEBUG(d_logger,msg);}; - void info(std::string msg){GR_LOG_INFO(d_logger,msg);}; - void notice(std::string msg){GR_LOG_NOTICE(d_logger,msg);}; - void warn(std::string msg){GR_LOG_WARN(d_logger,msg);}; - void error(std::string msg){GR_LOG_ERROR(d_logger,msg);}; - void crit(std::string msg){GR_LOG_CRIT(d_logger,msg);}; - void alert(std::string msg){GR_LOG_ALERT(d_logger,msg);}; - void fatal(std::string msg){GR_LOG_FATAL(d_logger,msg);}; - void emerg(std::string msg){GR_LOG_EMERG(d_logger,msg);}; - void errorIF(bool cond,std::string msg){GR_LOG_ERRORIF(d_logger,cond,msg);}; - void log_assert(bool cond,std::string msg){GR_LOG_ASSERT(d_logger,cond,msg);}; + class logger + { + public: + logger(std::string logger_name); + void set_level(std::string level){LOG_SET_LEVEL(d_logger,level);} + void get_level(std::string &level){LOG_GET_LEVEL(d_logger,level);} + void debug(std::string msg){LOG_DEBUG(d_logger,msg);}; + void info(std::string msg){LOG_INFO(d_logger,msg);}; + void notice(std::string msg){LOG_NOTICE(d_logger,msg);}; + void warn(std::string msg){LOG_WARN(d_logger,msg);}; + void error(std::string msg){LOG_ERROR(d_logger,msg);}; + void crit(std::string msg){LOG_CRIT(d_logger,msg);}; + void alert(std::string msg){LOG_ALERT(d_logger,msg);}; + void fatal(std::string msg){LOG_FATAL(d_logger,msg);}; + void emerg(std::string msg){LOG_EMERG(d_logger,msg);}; + void errorIF(bool cond,std::string msg){LOG_ERRORIF(d_logger,cond,msg);}; + void log_assert(bool cond,std::string msg){LOG_ASSERT(d_logger,cond,msg);}; void add_console_appender(std::string target,std::string pattern); void add_file_appender(std::string filename,bool append,std::string pattern); - void add_rollingfile_appender(std::string filename,size_t filesize,int bkup_index,bool append,mode_t mode,std::string pattern); -}; + void add_rollingfile_appender(std::string filename, size_t filesize, + int bkup_index, bool append, mode_t mode, + std::string pattern); + }; +} /* namespace gr */ diff --git a/gnuradio-runtime/swig/gr_message.i b/gnuradio-runtime/swig/gr_message.i deleted file mode 100644 index 356bba5b58..0000000000 --- a/gnuradio-runtime/swig/gr_message.i +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ - -class gr_message; -typedef boost::shared_ptr<gr_message> gr_message_sptr; -%template(gr_message_sptr) boost::shared_ptr<gr_message>; - -%rename(message_from_string) gr_make_message_from_string; -gr_message_sptr -gr_make_message_from_string(const std::string s, long type = 0, double arg1 = 0, double arg2 = 0); - -%rename(message) gr_make_message; -gr_message_sptr -gr_make_message(long type = 0, double arg1 = 0, double arg2 = 0, size_t length = 0); - -/*! - * \brief Message. - * - * The ideas and method names for adjustable message length were - * lifted from the click modular router "Packet" class. - */ -class gr_message { - gr_message (long type, double arg1, double arg2, size_t length); - - unsigned char *buf_data() const { return d_buf_start; } - size_t buf_len() const { return d_buf_end - d_buf_start; } - -public: - ~gr_message (); - - long type() const { return d_type; } - double arg1() const { return d_arg1; } - double arg2() const { return d_arg2; } - - void set_type(long type) { d_type = type; } - void set_arg1(double arg1) { d_arg1 = arg1; } - void set_arg2(double arg2) { d_arg2 = arg2; } - - size_t length() const; - std::string to_string() const; - -}; - -%rename(message_ncurrently_allocated) gr_message_ncurrently_allocated; -long gr_message_ncurrently_allocated(); - diff --git a/gnuradio-runtime/swig/gr_msg_queue.i b/gnuradio-runtime/swig/gr_msg_queue.i deleted file mode 100644 index 65cbe782b9..0000000000 --- a/gnuradio-runtime/swig/gr_msg_queue.i +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2009,2010,2011 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. - */ - -class gr_msg_queue; -typedef boost::shared_ptr<gr_msg_queue> gr_msg_queue_sptr; -%template(gr_msg_queue_sptr) boost::shared_ptr<gr_msg_queue>; - -%rename(msg_queue) gr_make_msg_queue; -gr_msg_queue_sptr gr_make_msg_queue(unsigned limit=0); - -/*! - * \brief thread-safe message queue - */ -%ignore gr_msg_queue; -class gr_msg_queue : public gr_msg_handler { -public: - gr_msg_queue(unsigned int limit); - ~gr_msg_queue(); - - //! Generic msg_handler method: insert the message. - //void handle(gr_message_sptr msg) { insert_tail (msg); } - - /*! - * \brief Insert message at tail of queue. - * \param msg message - * - * Block if queue if full. - */ - //void insert_tail(gr_message_sptr msg); - - /*! - * \brief Delete message from head of queue and return it. - * Block if no message is available. - */ - //gr_message_sptr delete_head(); - - /*! - * \brief If there's a message in the q, delete it and return it. - * If no message is available, return 0. - */ - gr_message_sptr delete_head_nowait(); - - //! is the queue empty? - bool empty_p() const; - - //! is the queue full? - bool full_p() const; - - //! return number of messages in queue - unsigned int count() const; - - //! Delete all messages from the queue - void flush(); -}; - -/* - * The following kludge-o-rama releases the Python global interpreter - * lock around these potentially blocking calls. We don't want - * libgnuradio-core to be dependent on Python, thus we create these - * functions that serve as replacements for the normal C++ delete_head - * and insert_tail methods. The %pythoncode smashes these new C++ - * functions into the gr.msg_queue wrapper class, so that everything - * appears normal. (An evil laugh is heard in the distance...) - */ -#ifdef SWIGPYTHON -%inline %{ - gr_message_sptr gr_py_msg_queue__delete_head(gr_msg_queue_sptr q) { - gr_message_sptr msg; - GR_PYTHON_BLOCKING_CODE( - msg = q->delete_head(); - ) - return msg; - } - - void gr_py_msg_queue__insert_tail(gr_msg_queue_sptr q, gr_message_sptr msg) { - GR_PYTHON_BLOCKING_CODE( - q->insert_tail(msg); - ) - } -%} - -// smash in new python delete_head and insert_tail methods... -%pythoncode %{ -gr_msg_queue_sptr.delete_head = gr_py_msg_queue__delete_head -gr_msg_queue_sptr.insert_tail = gr_py_msg_queue__insert_tail -gr_msg_queue_sptr.handle = gr_py_msg_queue__insert_tail -%} -#endif // SWIGPYTHON diff --git a/gnuradio-runtime/swig/gr_types.i b/gnuradio-runtime/swig/gr_types.i index b9bf3ba80b..6e1d825de3 100644 --- a/gnuradio-runtime/swig/gr_types.i +++ b/gnuradio-runtime/swig/gr_types.i @@ -30,7 +30,7 @@ #include <string> #include <stddef.h> // size_t #include <stdint.h> -#include <gr_types.h> +#include <gnuradio/types.h> %} %include <std_complex.i> @@ -68,6 +68,9 @@ namespace std { %template() vector< vector< double > >; %template() vector<string>; + + %template() std::vector<size_t>; + %template() std::vector< std::vector< std::vector<size_t> > >; }; %template(gr_vector_complexf) std::vector< std::complex<float> >; diff --git a/gnuradio-runtime/swig/hier_block2.i b/gnuradio-runtime/swig/hier_block2.i new file mode 100644 index 0000000000..b455e02a7e --- /dev/null +++ b/gnuradio-runtime/swig/hier_block2.i @@ -0,0 +1,92 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005-2007,2013 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. + */ + +%include <basic_block.i> + +class gr::hier_block2; +typedef boost::shared_ptr<gr::hier_block2> gr::hier_block2_sptr; +%template(hier_block2_sptr) boost::shared_ptr<gr::hier_block2>; + +namespace gr { + // Hack to have a Python shim implementation of gr.hier_block2 + // that instantiates one of these and passes through calls + %rename(hier_block2_swig) make_hier_block2; + gr::hier_block2_sptr + make_hier_block2(const std::string name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature) + throw (std::runtime_error); +} + +// Rename connect and disconnect so that we can more easily build a +// better interface in scripting land. +%rename(primitive_connect) gr::hier_block2::connect; +%rename(primitive_disconnect) gr::hier_block2::disconnect; +%rename(primitive_msg_connect) gr::hier_block2::msg_connect; +%rename(primitive_msg_disconnect) gr::hier_block2::msg_disconnect; +%rename(primitive_message_port_register_hier_in) gr::hier_block2::message_port_register_hier_in; +%rename(primitive_message_port_register_hier_out) gr::hier_block2::message_port_register_hier_out; + +namespace gr { + class hier_block2 : public gr::basic_block + { + private: + hier_block2(const std::string name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature); + + public: + ~hier_block2 (); + + void connect(gr::basic_block_sptr block) + throw (std::invalid_argument); + void connect(gr::basic_block_sptr src, int src_port, + gr::basic_block_sptr dst, int dst_port) + throw (std::invalid_argument); + void msg_connect(gr::basic_block_sptr src, pmt::pmt_t srcport, + gr::basic_block_sptr dst, pmt::pmt_t dstport) + throw (std::runtime_error); + void msg_connect(gr::basic_block_sptr src, std::string srcport, + gr::basic_block_sptr dst, std::string dstport) + throw (std::runtime_error); + void msg_disconnect(gr::basic_block_sptr src, pmt::pmt_t srcport, + gr::basic_block_sptr dst, pmt::pmt_t dstport) + throw (std::runtime_error); + void msg_disconnect(gr::basic_block_sptr src, std::string srcport, + gr::basic_block_sptr dst, std::string dstport) + throw (std::runtime_error); + + void disconnect(gr::basic_block_sptr block) + throw (std::invalid_argument); + void disconnect(gr::basic_block_sptr src, int src_port, + gr::basic_block_sptr dst, int dst_port) + throw (std::invalid_argument); + void disconnect_all(); + void lock(); + void unlock(); + + void message_port_register_hier_in(pmt::pmt_t port_id); + void message_port_register_hier_out(pmt::pmt_t port_id); + + gr::hier_block2_sptr to_hier_block2(); // Needed for Python type coercion + }; +} diff --git a/gnuradio-runtime/swig/io_signature.i b/gnuradio-runtime/swig/io_signature.i new file mode 100644 index 0000000000..53cde17bff --- /dev/null +++ b/gnuradio-runtime/swig/io_signature.i @@ -0,0 +1,69 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2005,2007,2013 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. + */ + +namespace gr { + + class GR_RUNTIME_API io_signature + { + io_signature(int min_streams, int max_streams, + const std::vector<int> &sizeof_stream_items); + + public: + typedef boost::shared_ptr<io_signature> sptr; + + // Avoids a swig warning, otherwise we could just + // #include <gnuradio/io_signature.h> instead of redoing this + // #entire class + //static const int IO_INFINITE = -1; + + ~io_signature(); + + + static sptr make(int min_streams, int max_streams, + int sizeof_stream_item); + static sptr make2(int min_streams, int max_streams, + int sizeof_stream_item1, + int sizeof_stream_item2); + static sptr make3(int min_streams, int max_streams, + int sizeof_stream_item1, + int sizeof_stream_item2, + int sizeof_stream_item3); + static sptr makev(int min_streams, int max_streams, + const std::vector<int> &sizeof_stream_items); + + int min_streams() const { return d_min_streams; } + int max_streams() const { return d_max_streams; } + int sizeof_stream_item(int index) const; + std::vector<int> sizeof_stream_items() const; + }; + +} /* namespace gr */ + + +%template(io_signature_sptr) boost::shared_ptr<gr::io_signature>; +%pythoncode %{ +io_signature_sptr.__repr__ = lambda self: "<io_signature: %d, %d>" % (self.min_streams(), self.max_streams()) +io_signaturev = io_signature.makev; +io_signature3 = io_signature.make3; +io_signature2 = io_signature.make2; +io_signature = io_signature.make; +%} diff --git a/gnuradio-runtime/swig/message.i b/gnuradio-runtime/swig/message.i new file mode 100644 index 0000000000..ac13c40641 --- /dev/null +++ b/gnuradio-runtime/swig/message.i @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 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. + */ + +namespace gr { + + /*! + * \brief Message. + * + * The ideas and method names for adjustable message length were + * lifted from the click modular router "Packet" class. + */ + class message + { + public: + typedef boost::shared_ptr<message> sptr; + + private: + message(long type, double arg1, double arg2, size_t length); + + unsigned char *buf_data() const; + size_t buf_len() const; + + public: + static sptr make(long type = 0, double arg1 = 0, double arg2 = 0, size_t length = 0); + + static sptr make_from_string(const std::string s, long type = 0, + double arg1 = 0, double arg2 = 0); + + ~message(); + + long type() const; + double arg1() const; + double arg2() const; + + void set_type(long type); + void set_arg1(double arg1); + void set_arg2(double arg2); + + size_t length() const; + std::string to_string() const; + }; + + %rename(message_ncurrently_allocated) message_ncurrently_allocated; + long message_ncurrently_allocated(); +} + +%template(message_sptr) boost::shared_ptr<gr::message>; +%pythoncode %{ +message_from_string = message.make_from_string +message = message.make +%} diff --git a/gnuradio-runtime/swig/gr_msg_handler.i b/gnuradio-runtime/swig/msg_handler.i index f493dac1b2..6869152889 100644 --- a/gnuradio-runtime/swig/gr_msg_handler.i +++ b/gnuradio-runtime/swig/msg_handler.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,10 +23,11 @@ /*! * \brief abstract class of message handlers */ -class gr_msg_handler { +class gr::msg_handler +{ public: - virtual ~gr_msg_handler () = 0; + virtual ~msg_handler () = 0; //! handle \p msg - virtual void handle (gr_message_sptr msg) = 0; + virtual void handle(gr::message::sptr msg) = 0; }; diff --git a/gnuradio-runtime/swig/msg_queue.i b/gnuradio-runtime/swig/msg_queue.i new file mode 100644 index 0000000000..59dff158ce --- /dev/null +++ b/gnuradio-runtime/swig/msg_queue.i @@ -0,0 +1,108 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2009-2011,2013 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. + */ + +namespace gr { + /*! + * \brief thread-safe message queue + */ + class msg_queue : public gr::msg_handler + { + public: + typedef boost::shared_ptr<msg_queue> sptr; + + static sptr make(unsigned int limit=0); + + msg_queue(unsigned int limit); + ~msg_queue(); + + //! Generic msg_handler method: insert the message. + //void handle(gr::message::sptr msg) { insert_tail (msg); } + + /*! + * \brief Insert message at tail of queue. + * \param msg message + * + * Block if queue if full. + */ + //void insert_tail(gr::message::sptr msg); + + /*! + * \brief Delete message from head of queue and return it. + * Block if no message is available. + */ + //gr::message::sptr delete_head(); + + /*! + * \brief If there's a message in the q, delete it and return it. + * If no message is available, return 0. + */ + gr::message::sptr delete_head_nowait(); + + //! is the queue empty? + bool empty_p() const; + + //! is the queue full? + bool full_p() const; + + //! return number of messages in queue + unsigned int count() const; + + //! Delete all messages from the queue + void flush(); + }; +} + +/* + * The following kludge-o-rama releases the Python global interpreter + * lock around these potentially blocking calls. We don't want + * libgnuradio-core to be dependent on Python, thus we create these + * functions that serve as replacements for the normal C++ delete_head + * and insert_tail methods. The %pythoncode smashes these new C++ + * functions into the gr.msg_queue wrapper class, so that everything + * appears normal. (An evil laugh is heard in the distance...) + */ +#ifdef SWIGPYTHON +%inline %{ + gr::message::sptr py_msg_queue__delete_head(gr::msg_queue::sptr q) { + gr::message::sptr msg; + GR_PYTHON_BLOCKING_CODE( + msg = q->delete_head(); + ) + return msg; + } + + void py_msg_queue__insert_tail(gr::msg_queue::sptr q, gr::message::sptr msg) { + GR_PYTHON_BLOCKING_CODE( + q->insert_tail(msg); + ) + } +%} + +// smash in new python delete_head and insert_tail methods... +%template(msg_queue_sptr) boost::shared_ptr<gr::msg_queue>; +%pythoncode %{ +msg_queue_sptr.delete_head = py_msg_queue__delete_head +msg_queue_sptr.insert_tail = py_msg_queue__insert_tail +msg_queue_sptr.handle = py_msg_queue__insert_tail +msg_queue = msg_queue.make +%} +#endif // SWIGPYTHON diff --git a/gnuradio-runtime/swig/gr_prefs.i b/gnuradio-runtime/swig/prefs.i index c8c4242002..f56c7910ee 100644 --- a/gnuradio-runtime/swig/gr_prefs.i +++ b/gnuradio-runtime/swig/prefs.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,13 +20,13 @@ * Boston, MA 02110-1301, USA. */ -class gr_prefs +class gr::prefs { public: - static gr_prefs *singleton(); - static void set_singleton(gr_prefs *p); + static gr::prefs *singleton(); + static void set_singleton(gr::prefs *p); - virtual ~gr_prefs(); + virtual ~prefs(); std::string to_string(); diff --git a/gnuradio-runtime/swig/gr_realtime.i b/gnuradio-runtime/swig/realtime.i index 4d5c2b856f..d408249a19 100644 --- a/gnuradio-runtime/swig/gr_realtime.i +++ b/gnuradio-runtime/swig/realtime.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008 Free Software Foundation, Inc. + * Copyright 2008,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,25 +20,26 @@ * Boston, MA 02110-1301, USA. */ -%rename(enable_realtime_scheduling) gr_enable_realtime_scheduling; +%rename(enable_realtime_scheduling) gr::enable_realtime_scheduling; -// NOTE: This is duplicated from gnuradio-runtime/include/gr_realtime.h, +// NOTE: This is duplicated from gnuradio-runtime/include/realtime.h, // and must be kept in sync with it. This is the least evil workaround // for allowing 3rd party code builds to work when GNU Radio is // installed from binary packages into the standard system directories. -// Otherwise, they can't find #include <gr_realtime.h>, since +// Otherwise, they can't find #include <realtime.h>, since // pkg-config strips -I/usr/include from the --cflags path. namespace gr { + namespace impl { - typedef enum { - RT_OK = 0, - RT_NOT_IMPLEMENTED, - RT_NO_PRIVS, - RT_OTHER_ERROR - } rt_status_t; - + typedef enum { + RT_OK = 0, + RT_NOT_IMPLEMENTED, + RT_NO_PRIVS, + RT_OTHER_ERROR + } rt_status_t; + } } -typedef gr::rt_status_t gr_rt_status_t; -gr_rt_status_t gr_enable_realtime_scheduling(); +typedef gr::rt_status_t rt_status_t; +rt_status_t gr::enable_realtime_scheduling(); diff --git a/gnuradio-runtime/swig/runtime_swig.i b/gnuradio-runtime/swig/runtime_swig.i index ae3d1d7dcb..73bc689724 100644 --- a/gnuradio-runtime/swig/runtime_swig.i +++ b/gnuradio-runtime/swig/runtime_swig.i @@ -33,29 +33,31 @@ %include "gnuradio.i" // the common stuff %{ -#include <gr_endianness.h> -#include <gr_block.h> -#include <gr_block_detail.h> -#include <gr_buffer.h> -#include <gr_constants.h> -#include <gr_dispatcher.h> -#include <gr_error_handler.h> -#include <gr_feval.h> -#include <gr_hier_block2.h> -#include <gr_io_signature.h> -#include <gr_message.h> -#include <gr_msg_handler.h> -#include <gr_msg_queue.h> -#include <gr_prefs.h> -#include <gr_realtime.h> -#include <gr_runtime_types.h> -#include <gr_single_threaded_scheduler.h> -#include <gr_sync_block.h> -#include <gr_sync_decimator.h> -#include <gr_sync_interpolator.h> -#include <gr_tagged_stream_block.h> -#include <gr_tags.h> -#include <gr_top_block.h> +#include <gnuradio/runtime_types.h> +%} + +%include <gnuradio/runtime_types.h> + +%{ +#include <gnuradio/block.h> +#include <gnuradio/block_detail.h> +#include <gnuradio/buffer.h> +#include <gnuradio/constants.h> +#include <gnuradio/endianness.h> +#include <gnuradio/feval.h> +#include <gnuradio/hier_block2.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/message.h> +#include <gnuradio/msg_handler.h> +#include <gnuradio/msg_queue.h> +#include <gnuradio/prefs.h> +#include <gnuradio/realtime.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/sync_decimator.h> +#include <gnuradio/sync_interpolator.h> +#include <gnuradio/tags.h> +#include <gnuradio/tagged_stream_block.h> +#include <gnuradio/top_block.h> %} %constant int sizeof_char = sizeof(char); @@ -65,30 +67,27 @@ %constant int sizeof_double = sizeof(double); %constant int sizeof_gr_complex = sizeof(gr_complex); -%include <gr_endianness.h> -%include <gr_basic_block.i> -%include <gr_block.i> -%include <gr_block_detail.i> -%include <gr_buffer.i> -%include <gr_constants.i> -%include <gr_dispatcher.i> -%include <gr_error_handler.i> -%include <gr_feval.i> -%include <gr_hier_block2.i> -%include <gr_io_signature.i> -%include <gr_message.i> -%include <gr_msg_handler.i> -%include <gr_msg_queue.i> -%include <gr_prefs.i> -%include <gr_realtime.i> -%include <gr_single_threaded_scheduler.i> -%include <gr_swig_block_magic.i> -%include <gr_sync_block.i> -%include <gr_sync_decimator.i> -%include <gr_sync_interpolator.i> -%include <gr_tagged_stream_block.i> -%include <gr_tags.i> -%include <gr_top_block.i> -%include <runtime_block_gateway.i> +%include <gnuradio/endianness.h> +%include "basic_block.i" +%include "block.i" +%include "block_detail.i" +%include "buffer.i" +%include "constants.i" +%include "feval.i" +%include "hier_block2.i" +%include "io_signature.i" +%include "message.i" +%include "msg_handler.i" +%include "msg_queue.i" +%include "prefs.i" +%include "realtime.i" +%include "sync_block.i" +%include "sync_decimator.i" +%include "sync_interpolator.i" +%include "tagged_stream_block.i" +%include "tags.i" +%include "top_block.i" +%include "block_gateway.i" -%include <gr_ctrlport.i> +%include "gr_swig_block_magic.i" +%include "gr_ctrlport.i" diff --git a/gnuradio-runtime/swig/gr_single_threaded_scheduler.i b/gnuradio-runtime/swig/single_threaded_scheduler.i index 7305cc9ada..f4fbed075c 100644 --- a/gnuradio-runtime/swig/gr_single_threaded_scheduler.i +++ b/gnuradio-runtime/swig/single_threaded_scheduler.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,31 +20,31 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_runtime.h> +#include <gnuradio/runtime.h> -class gr_single_threaded_scheduler; -typedef boost::shared_ptr<gr_single_threaded_scheduler> gr_single_threaded_scheduler_sptr; -%template(gr_single_threaded_scheduler_sptr) boost::shared_ptr<gr_single_threaded_scheduler>; -%rename(single_threaded_scheduler) gr_make_single_threaded_scheduler; -%ignore gr_single_threaded_scheduler; +class gr::single_threaded_scheduler; +typedef boost::shared_ptr<gr::single_threaded_scheduler> gr::single_threaded_scheduler_sptr; +%template(single_threaded_scheduler_sptr) boost::shared_ptr<gr::single_threaded_scheduler>; +%rename(single_threaded_scheduler) gr::make_single_threaded_scheduler; +%ignore gr::single_threaded_scheduler; -gr_single_threaded_scheduler_sptr -gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &modules); +gr::single_threaded_scheduler_sptr +gr::make_single_threaded_scheduler(const std::vector<gr::block_sptr> &modules); -class gr_single_threaded_scheduler { +class gr::single_threaded_scheduler { public: - ~gr_single_threaded_scheduler (); + ~single_threaded_scheduler (); // void run (); void stop (); private: - gr_single_threaded_scheduler (const std::vector<gr_block_sptr> &modules); + single_threaded_scheduler (const std::vector<block_sptr> &modules); }; #ifdef SWIGPYTHON %inline %{ - void sts_pyrun (gr_single_threaded_scheduler_sptr s) { + void sts_pyrun (gr::single_threaded_scheduler_sptr s) { Py_BEGIN_ALLOW_THREADS; // release global interpreter lock s->run (); Py_END_ALLOW_THREADS; // acquire global interpreter lock diff --git a/gnuradio-runtime/swig/gr_sync_block.i b/gnuradio-runtime/swig/sync_block.i index d3e1bb9578..892e58e4a0 100644 --- a/gnuradio-runtime/swig/gr_sync_block.i +++ b/gnuradio-runtime/swig/sync_block.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,11 +19,12 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -class gr_sync_block : public gr_block + +class gr::sync_block : public gr::block { protected: - gr_sync_block (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature); + sync_block(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature); }; diff --git a/gnuradio-runtime/swig/gr_sync_decimator.i b/gnuradio-runtime/swig/sync_decimator.i index af4574b193..9c0506bd54 100644 --- a/gnuradio-runtime/swig/gr_sync_decimator.i +++ b/gnuradio-runtime/swig/sync_decimator.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,12 +20,12 @@ * Boston, MA 02110-1301, USA. */ -class gr_sync_decimator : public gr_sync_block +class gr::sync_decimator : public gr::sync_block { protected: - gr_sync_decimator (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - unsigned decimation); + sync_decimator(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature, + unsigned decimation); }; diff --git a/gnuradio-runtime/swig/gr_sync_interpolator.i b/gnuradio-runtime/swig/sync_interpolator.i index 6f8b08252f..9ebbb460dd 100644 --- a/gnuradio-runtime/swig/gr_sync_interpolator.i +++ b/gnuradio-runtime/swig/sync_interpolator.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,12 +20,12 @@ * Boston, MA 02110-1301, USA. */ -class gr_sync_interpolator : public gr_sync_block +class gr::sync_interpolator : public gr::sync_block { protected: - gr_sync_interpolator (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - unsigned interpolation); + sync_interpolator(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature, + unsigned interpolation); }; diff --git a/gnuradio-runtime/swig/gr_tagged_stream_block.i b/gnuradio-runtime/swig/tagged_stream_block.i index 9fc803dca1..10943f58de 100644 --- a/gnuradio-runtime/swig/gr_tagged_stream_block.i +++ b/gnuradio-runtime/swig/tagged_stream_block.i @@ -19,12 +19,13 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -class gr_tagged_stream_block : public gr_block + +class gr::tagged_stream_block : public gr::block { protected: - gr_tagged_stream_block (const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - const std::string &length_tag_key); + tagged_stream_block(const std::string &name, + gr::io_signature::sptr input_signature, + gr::io_signature::sptr output_signature, + const std::string &length_tag_key); }; diff --git a/gnuradio-runtime/swig/gr_tags.i b/gnuradio-runtime/swig/tags.i index 828d0147ce..2615264738 100644 --- a/gnuradio-runtime/swig/gr_tags.i +++ b/gnuradio-runtime/swig/tags.i @@ -1,5 +1,5 @@ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,13 +20,13 @@ */ %{ -#include <gr_tags.h> +#include <gnuradio/tags.h> %} -%include <pmt_swig.i> //for pmt support +%import <pmt_swig.i> //for pmt support -%include <gr_tags.h> +%include <gnuradio/tags.h> //gives support for a vector of tags (get tags in range) %include "std_vector.i" -%template(tags_vector_t) std::vector<gr_tag_t>; +%template(tags_vector_t) std::vector<gr::tag_t>; diff --git a/gnuradio-runtime/swig/gr_top_block.i b/gnuradio-runtime/swig/top_block.i index 1612ddf8c5..7639403393 100644 --- a/gnuradio-runtime/swig/gr_top_block.i +++ b/gnuradio-runtime/swig/top_block.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007,2008,2010 Free Software Foundation, Inc. + * Copyright 2007,2008,2010,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,50 +20,50 @@ * Boston, MA 02110-1301, USA. */ -class gr_top_block; -typedef boost::shared_ptr<gr_top_block> gr_top_block_sptr; -%template(gr_top_block_sptr) boost::shared_ptr<gr_top_block>; +%template(top_block_sptr) boost::shared_ptr<gr::top_block>; -// Hack to have a Python shim implementation of gr.top_block -// that instantiates one of these and passes through calls -%rename(top_block_swig) gr_make_top_block; -gr_top_block_sptr gr_make_top_block(const std::string name) - throw (std::logic_error); +namespace gr { + // Hack to have a Python shim implementation of gr.top_block + // that instantiates one of these and passes through calls + %rename(top_block_swig) make_top_block; + gr::top_block_sptr make_top_block(const std::string name) + throw (std::logic_error); -class gr_top_block : public gr_hier_block2 -{ -private: - gr_top_block(const std::string &name); - -public: - ~gr_top_block(); + class top_block : public gr::hier_block2 + { + private: + top_block(const std::string &name); - void start(int max_noutput_items=100000000) throw (std::runtime_error); - void stop(); - //void wait(); - //void run() throw (std::runtime_error); - void lock(); - void unlock() throw (std::runtime_error); - std::string edge_list(); - void dump(); + public: + ~top_block(); - int max_noutput_items(); - void set_max_noutput_items(int nmax); + void start(int max_noutput_items=100000000) throw (std::runtime_error); + void stop(); + //void wait(); + //void run() throw (std::runtime_error); + void lock(); + void unlock() throw (std::runtime_error); + std::string edge_list(); + void dump(); - gr_top_block_sptr to_top_block(); // Needed for Python type coercion -}; + int max_noutput_items(); + void set_max_noutput_items(int nmax); + gr::top_block_sptr to_top_block(); // Needed for Python type coercion + }; +} + #ifdef SWIGPYTHON %inline %{ -void top_block_run_unlocked(gr_top_block_sptr r) throw (std::runtime_error) +void top_block_run_unlocked(gr::top_block_sptr r) throw (std::runtime_error) { Py_BEGIN_ALLOW_THREADS; // release global interpreter lock r->run(); Py_END_ALLOW_THREADS; // acquire global interpreter lock } -void top_block_wait_unlocked(gr_top_block_sptr r) throw (std::runtime_error) +void top_block_wait_unlocked(gr::top_block_sptr r) throw (std::runtime_error) { Py_BEGIN_ALLOW_THREADS; // release global interpreter lock r->wait(); diff --git a/gr-analog/CMakeLists.txt b/gr-analog/CMakeLists.txt index 10a9976496..31e0adf2d1 100644 --- a/gr-analog/CMakeLists.txt +++ b/gr-analog/CMakeLists.txt @@ -87,7 +87,7 @@ CPACK_COMPONENT("analog_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/analog) +add_subdirectory(include/gnuradio/analog) add_subdirectory(lib) add_subdirectory(doc) if(ENABLE_PYTHON) diff --git a/gr-analog/include/analog/CMakeLists.txt b/gr-analog/include/gnuradio/analog/CMakeLists.txt index 0343abcd85..0343abcd85 100644 --- a/gr-analog/include/analog/CMakeLists.txt +++ b/gr-analog/include/gnuradio/analog/CMakeLists.txt diff --git a/gr-analog/include/analog/agc.h b/gr-analog/include/gnuradio/analog/agc.h index ae3af7091d..ca6125082f 100644 --- a/gr-analog/include/analog/agc.h +++ b/gr-analog/include/gnuradio/analog/agc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_AGC_H #define INCLUDED_ANALOG_AGC_H -#include <analog/api.h> -#include <gr_complex.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/gr_complex.h> #include <math.h> namespace gr { diff --git a/gr-analog/include/analog/agc2.h b/gr-analog/include/gnuradio/analog/agc2.h index 1e1f695fe9..225adc4410 100644 --- a/gr-analog/include/analog/agc2.h +++ b/gr-analog/include/gnuradio/analog/agc2.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_AGC2_H #define INCLUDED_ANALOG_AGC2_H -#include <analog/api.h> -#include <gr_complex.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/gr_complex.h> #include <math.h> namespace gr { diff --git a/gr-analog/include/analog/agc2_cc.h b/gr-analog/include/gnuradio/analog/agc2_cc.h index 82efe914d8..76a5263183 100644 --- a/gr-analog/include/analog/agc2_cc.h +++ b/gr-analog/include/gnuradio/analog/agc2_cc.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ANALOG_AGC2_CC_H #define INCLUDED_ANALOG_AGC2_CC_H -#include <analog/api.h> -#include <analog/agc2.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/agc2.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -38,7 +38,7 @@ namespace gr { * \details * For Power the absolute value of the complex number is used. */ - class ANALOG_API agc2_cc : virtual public gr_sync_block + class ANALOG_API agc2_cc : virtual public sync_block { public: // gr::analog::agc2_cc::sptr diff --git a/gr-analog/include/analog/agc2_ff.h b/gr-analog/include/gnuradio/analog/agc2_ff.h index dd2507e33d..740d795e1d 100644 --- a/gr-analog/include/analog/agc2_ff.h +++ b/gr-analog/include/gnuradio/analog/agc2_ff.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ANALOG_AGC2_FF_H #define INCLUDED_ANALOG_AGC2_FF_H -#include <analog/api.h> -#include <analog/agc2.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/agc2.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -38,7 +38,7 @@ namespace gr { * \details * Power is approximated by absolute value */ - class ANALOG_API agc2_ff : virtual public gr_sync_block + class ANALOG_API agc2_ff : virtual public sync_block { public: // gr::analog::agc2_ff::sptr diff --git a/gr-analog/include/analog/agc_cc.h b/gr-analog/include/gnuradio/analog/agc_cc.h index 0c2e831b0c..8319995960 100644 --- a/gr-analog/include/analog/agc_cc.h +++ b/gr-analog/include/gnuradio/analog/agc_cc.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ANALOG_AGC_CC_H #define INCLUDED_ANALOG_AGC_CC_H -#include <analog/api.h> -#include <analog/agc.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/agc.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -37,7 +37,7 @@ namespace gr { * \details * For Power the absolute value of the complex number is used. */ - class ANALOG_API agc_cc : virtual public gr_sync_block + class ANALOG_API agc_cc : virtual public sync_block { public: // gr::analog::agc_cc::sptr diff --git a/gr-analog/include/analog/agc_ff.h b/gr-analog/include/gnuradio/analog/agc_ff.h index ffcafaa642..d55072889b 100644 --- a/gr-analog/include/analog/agc_ff.h +++ b/gr-analog/include/gnuradio/analog/agc_ff.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ANALOG_AGC_FF_H #define INCLUDED_ANALOG_AGC_FF_H -#include <analog/api.h> -#include <analog/agc.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/agc.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -37,7 +37,7 @@ namespace gr { * \details * Power is approximated by absolute value */ - class ANALOG_API agc_ff : virtual public gr_sync_block + class ANALOG_API agc_ff : virtual public sync_block { public: // gr::analog::agc_ff::sptr diff --git a/gr-analog/include/analog/api.h b/gr-analog/include/gnuradio/analog/api.h index 2459ace614..01107345e6 100644 --- a/gr-analog/include/analog/api.h +++ b/gr-analog/include/gnuradio/analog/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_ANALOG_API_H #define INCLUDED_ANALOG_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_analog_EXPORTS # define ANALOG_API __GR_ATTR_EXPORT diff --git a/gr-analog/include/analog/cpfsk_bc.h b/gr-analog/include/gnuradio/analog/cpfsk_bc.h index 8150e0d08f..580c387d45 100644 --- a/gr-analog/include/analog/cpfsk_bc.h +++ b/gr-analog/include/gnuradio/analog/cpfsk_bc.h @@ -21,8 +21,8 @@ #ifndef INCLUDED_ANALOG_CPFSK_BC_H #define INCLUDED_ANALOG_CPFSK_BC_H -#include <analog/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace analog { @@ -32,7 +32,7 @@ namespace gr { * on an input stream of unpacked bits. * \ingroup modulators_blk */ - class ANALOG_API cpfsk_bc : virtual public gr_sync_interpolator + class ANALOG_API cpfsk_bc : virtual public sync_interpolator { public: // gr::analog::cpfsk_bc::sptr diff --git a/gr-analog/include/analog/cpm.h b/gr-analog/include/gnuradio/analog/cpm.h index 43dd0b3729..040f20514a 100644 --- a/gr-analog/include/analog/cpm.h +++ b/gr-analog/include/gnuradio/analog/cpm.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_ANALOG_CPM_H #define INCLUDED_ANALOG_CPM_H -#include <analog/api.h> +#include <gnuradio/analog/api.h> #include <vector> namespace gr { diff --git a/gr-analog/include/analog/ctcss_squelch_ff.h b/gr-analog/include/gnuradio/analog/ctcss_squelch_ff.h index f8c551d291..f9ecc88a03 100644 --- a/gr-analog/include/analog/ctcss_squelch_ff.h +++ b/gr-analog/include/gnuradio/analog/ctcss_squelch_ff.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ANALOG_CTCSS_SQUELCH_FF_H #define INCLUDED_ANALOG_CTCSS_SQUELCH_FF_H -#include <analog/api.h> -#include <analog/squelch_base_ff.h> -#include <gr_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/squelch_base_ff.h> +#include <gnuradio/block.h> namespace gr { namespace analog { @@ -35,7 +35,7 @@ namespace gr { * \ingroup level_controllers_blk */ class ANALOG_API ctcss_squelch_ff : - public squelch_base_ff, virtual public gr_block + public squelch_base_ff, virtual public block { protected: virtual void update_state(const float &in) = 0; diff --git a/gr-analog/include/analog/dpll_bb.h b/gr-analog/include/gnuradio/analog/dpll_bb.h index f25e860b2c..4f9a6c0dd9 100644 --- a/gr-analog/include/analog/dpll_bb.h +++ b/gr-analog/include/gnuradio/analog/dpll_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_DPLL_BB_H #define INCLUDED_ANALOG_DPLL_BB_H -#include <analog/api.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -37,7 +37,7 @@ namespace gr { * If a peak is detected, this block outputs a 1, * or it outputs 0's. */ - class ANALOG_API dpll_bb : virtual public gr_sync_block + class ANALOG_API dpll_bb : virtual public sync_block { public: // gr::analog::dpll_bb::sptr diff --git a/gr-analog/include/analog/fastnoise_source_X.h.t b/gr-analog/include/gnuradio/analog/fastnoise_source_X.h.t index e1c606692c..c5331fc084 100644 --- a/gr-analog/include/analog/fastnoise_source_X.h.t +++ b/gr-analog/include/gnuradio/analog/fastnoise_source_X.h.t @@ -25,9 +25,9 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <analog/api.h> -#include <analog/noise_type.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/noise_type.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -40,14 +40,14 @@ namespace gr { * Generate random values from different distributions. * Currently, only Gaussian and uniform are enabled. */ - class ANALOG_API @BASE_NAME@ : virtual public gr_sync_block + class ANALOG_API @BASE_NAME@ : virtual public sync_block { public: // gr::analog::@BASE_NAME@::sptr typedef boost::shared_ptr<@BASE_NAME@> sptr; /*! \brief Make a fast noise source - * \param type the random distribution to use (see analog/noise_type.h) + * \param type the random distribution to use (see gnuradio/analog/noise_type.h) * \param ampl a scaling factor for the output * \param seed seed for random generators. Note that for uniform and * \param samples Number of samples to pre-generate diff --git a/gr-analog/include/analog/feedforward_agc_cc.h b/gr-analog/include/gnuradio/analog/feedforward_agc_cc.h index 0a688ccdde..5d4abfeedb 100644 --- a/gr-analog/include/analog/feedforward_agc_cc.h +++ b/gr-analog/include/gnuradio/analog/feedforward_agc_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_H #define INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_H -#include <analog/api.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -34,7 +34,7 @@ namespace gr { * absolute value over nsamples * \ingroup level_controllers_blk */ - class ANALOG_API feedforward_agc_cc : virtual public gr_sync_block + class ANALOG_API feedforward_agc_cc : virtual public sync_block { public: // gr::analog::feedforward_agc_cc::sptr diff --git a/gr-analog/include/analog/fmdet_cf.h b/gr-analog/include/gnuradio/analog/fmdet_cf.h index bd26e39226..15749efc4e 100644 --- a/gr-analog/include/analog/fmdet_cf.h +++ b/gr-analog/include/gnuradio/analog/fmdet_cf.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_FMDET_CF_H #define INCLUDED_ANALOG_FMDET_CF_H -#include <analog/api.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -38,7 +38,7 @@ namespace gr { * This implements a limiting slope detector. The limiter is in * the normalization by the magnitude of the sample */ - class ANALOG_API fmdet_cf : virtual public gr_sync_block + class ANALOG_API fmdet_cf : virtual public sync_block { public: // gr::analog::fmdet_cf::sptr diff --git a/gr-analog/include/analog/frequency_modulator_fc.h b/gr-analog/include/gnuradio/analog/frequency_modulator_fc.h index a0d4404729..d6e2b277fe 100644 --- a/gr-analog/include/analog/frequency_modulator_fc.h +++ b/gr-analog/include/gnuradio/analog/frequency_modulator_fc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_H #define INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_H -#include <analog/api.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -36,7 +36,7 @@ namespace gr { * \details * float input; complex baseband output */ - class ANALOG_API frequency_modulator_fc : virtual public gr_sync_block + class ANALOG_API frequency_modulator_fc : virtual public sync_block { public: // gr::analog::frequency_modulator_fc::sptr diff --git a/gr-analog/include/analog/noise_source_X.h.t b/gr-analog/include/gnuradio/analog/noise_source_X.h.t index 1a9630dfdf..b7b0906c06 100644 --- a/gr-analog/include/analog/noise_source_X.h.t +++ b/gr-analog/include/gnuradio/analog/noise_source_X.h.t @@ -25,10 +25,9 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <analog/api.h> -#include <analog/noise_type.h> -#include <gr_sync_block.h> -#include <gr_random.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/noise_type.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -41,14 +40,14 @@ namespace gr { * Generate random values from different distributions. * Currently, only Gaussian and uniform are enabled. */ - class ANALOG_API @BASE_NAME@ : virtual public gr_sync_block + class ANALOG_API @BASE_NAME@ : virtual public sync_block { public: // gr::analog::@BASE_NAME@::sptr typedef boost::shared_ptr<@BASE_NAME@> sptr; /*! Build a noise source - * \param type the random distribution to use (see analog/noise_type.h) + * \param type the random distribution to use (see gnuradio/analog/noise_type.h) * \param ampl a scaling factor for the output * \param seed seed for random generators. Note that for uniform and * Gaussian distributions, this should be a negative number. diff --git a/gr-analog/include/analog/noise_type.h b/gr-analog/include/gnuradio/analog/noise_type.h index c3a2146b7e..c3a2146b7e 100644 --- a/gr-analog/include/analog/noise_type.h +++ b/gr-analog/include/gnuradio/analog/noise_type.h diff --git a/gr-analog/include/analog/phase_modulator_fc.h b/gr-analog/include/gnuradio/analog/phase_modulator_fc.h index 2ec7c1a3c4..56c39ce3ea 100644 --- a/gr-analog/include/analog/phase_modulator_fc.h +++ b/gr-analog/include/gnuradio/analog/phase_modulator_fc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_PHASE_MODULATOR_FC_H #define INCLUDED_ANALOG_PHASE_MODULATOR_FC_H -#include <analog/api.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -39,7 +39,7 @@ namespace gr { * Input stream 0: floats * Ouput stream 0: complex */ - class ANALOG_API phase_modulator_fc : virtual public gr_sync_block + class ANALOG_API phase_modulator_fc : virtual public sync_block { public: // gr::analog::phase_modulator_fc::sptr diff --git a/gr-analog/include/analog/pll_carriertracking_cc.h b/gr-analog/include/gnuradio/analog/pll_carriertracking_cc.h index 520a2f57da..35da29c8af 100644 --- a/gr-analog/include/analog/pll_carriertracking_cc.h +++ b/gr-analog/include/gnuradio/analog/pll_carriertracking_cc.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_H #define INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_H -#include <analog/api.h> -#include <blocks/control_loop.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/blocks/control_loop.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -48,7 +48,7 @@ namespace gr { * pll_freqdet_cf, pll_carriertracking_cc */ class ANALOG_API pll_carriertracking_cc - : virtual public gr_sync_block, + : virtual public sync_block, virtual public blocks::control_loop { public: diff --git a/gr-analog/include/analog/pll_freqdet_cf.h b/gr-analog/include/gnuradio/analog/pll_freqdet_cf.h index b33fb909ba..1ea7eb97ec 100644 --- a/gr-analog/include/analog/pll_freqdet_cf.h +++ b/gr-analog/include/gnuradio/analog/pll_freqdet_cf.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ANALOG_PLL_FREQDET_CF_H #define INCLUDED_ANALOG_PLL_FREQDET_CF_H -#include <analog/api.h> -#include <blocks/control_loop.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/blocks/control_loop.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -47,7 +47,7 @@ namespace gr { * \sa pll_refout_cc, pll_carriertracking_cc */ class ANALOG_API pll_freqdet_cf - : virtual public gr_sync_block, + : virtual public sync_block, virtual public blocks::control_loop { public: diff --git a/gr-analog/include/analog/pll_refout_cc.h b/gr-analog/include/gnuradio/analog/pll_refout_cc.h index 9c713749c7..29a2f43198 100644 --- a/gr-analog/include/analog/pll_refout_cc.h +++ b/gr-analog/include/gnuradio/analog/pll_refout_cc.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ANALOG_PLL_REFOUT_CC_H #define INCLUDED_ANALOG_PLL_REFOUT_CC_H -#include <analog/api.h> -#include <blocks/control_loop.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/blocks/control_loop.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -48,7 +48,7 @@ namespace gr { * pll_freqdet_cf, pll_carriertracking_cc */ class ANALOG_API pll_refout_cc - : virtual public gr_sync_block, + : virtual public sync_block, virtual public blocks::control_loop { public: diff --git a/gr-analog/include/analog/probe_avg_mag_sqrd_c.h b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_c.h index 2fed4fff0b..fe67f3ad59 100644 --- a/gr-analog/include/analog/probe_avg_mag_sqrd_c.h +++ b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_c.h @@ -22,8 +22,8 @@ #ifndef INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_H #define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_H -#include <analog/api.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -40,7 +40,7 @@ namespace gr { * threshold can be retrieved with the level and unmuted * accessors. */ - class ANALOG_API probe_avg_mag_sqrd_c : virtual public gr_sync_block + class ANALOG_API probe_avg_mag_sqrd_c : virtual public sync_block { public: // gr::analog::probe_avg_mag_sqrd_c::sptr diff --git a/gr-analog/include/analog/probe_avg_mag_sqrd_cf.h b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_cf.h index 303670adee..d491321e68 100644 --- a/gr-analog/include/analog/probe_avg_mag_sqrd_cf.h +++ b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_cf.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_H #define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_H -#include <analog/api.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -42,7 +42,7 @@ namespace gr { * threshold can be retrieved with the level and unmuted * accessors. */ - class ANALOG_API probe_avg_mag_sqrd_cf : virtual public gr_sync_block + class ANALOG_API probe_avg_mag_sqrd_cf : virtual public sync_block { public: // gr::analog::probe_avg_mag_sqrd_cf::sptr diff --git a/gr-analog/include/analog/probe_avg_mag_sqrd_f.h b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_f.h index 2300f8bca1..960480b962 100644 --- a/gr-analog/include/analog/probe_avg_mag_sqrd_f.h +++ b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_f.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_H #define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_H -#include <analog/api.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -41,7 +41,7 @@ namespace gr { * threshold can be retrieved with the level and unmuted * accessors. */ - class ANALOG_API probe_avg_mag_sqrd_f : virtual public gr_sync_block + class ANALOG_API probe_avg_mag_sqrd_f : virtual public sync_block { public: // gr::analog::probe_avg_mag_sqrd_f::sptr diff --git a/gr-analog/include/analog/pwr_squelch_cc.h b/gr-analog/include/gnuradio/analog/pwr_squelch_cc.h index 73b89f0db6..766f76d385 100644 --- a/gr-analog/include/analog/pwr_squelch_cc.h +++ b/gr-analog/include/gnuradio/analog/pwr_squelch_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_PWR_SQUELCH_CC_H #define INCLUDED_ANALOG_PWR_SQUELCH_CC_H -#include <analog/api.h> -#include <analog/squelch_base_cc.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/squelch_base_cc.h> #include <cmath> namespace gr { @@ -35,7 +35,7 @@ namespace gr { * \ingroup level_controllers_blk */ class ANALOG_API pwr_squelch_cc : - public squelch_base_cc, virtual public gr_block + public squelch_base_cc, virtual public block { protected: virtual void update_state(const gr_complex &in) = 0; diff --git a/gr-analog/include/analog/pwr_squelch_ff.h b/gr-analog/include/gnuradio/analog/pwr_squelch_ff.h index 5490827390..abff53d5e0 100644 --- a/gr-analog/include/analog/pwr_squelch_ff.h +++ b/gr-analog/include/gnuradio/analog/pwr_squelch_ff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_PWR_SQUELCH_FF_H #define INCLUDED_ANALOG_PWR_SQUELCH_FF_H -#include <analog/api.h> -#include <analog/squelch_base_ff.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/squelch_base_ff.h> #include <cmath> namespace gr { @@ -35,7 +35,7 @@ namespace gr { * \ingroup level_controllers_blk */ class ANALOG_API pwr_squelch_ff : - public squelch_base_ff, virtual public gr_block + public squelch_base_ff, virtual public block { protected: virtual void update_state(const float &in) = 0; diff --git a/gr-analog/include/analog/quadrature_demod_cf.h b/gr-analog/include/gnuradio/analog/quadrature_demod_cf.h index c7682649b8..888cb4a20b 100644 --- a/gr-analog/include/analog/quadrature_demod_cf.h +++ b/gr-analog/include/gnuradio/analog/quadrature_demod_cf.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H #define INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H -#include <analog/api.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -37,7 +37,7 @@ namespace gr { * This can be used to demod FM, FSK, GMSK, etc. * The input is complex baseband. */ - class ANALOG_API quadrature_demod_cf : virtual public gr_sync_block + class ANALOG_API quadrature_demod_cf : virtual public sync_block { public: // gr::analog::quadrature_demod_cf::sptr diff --git a/gr-analog/include/analog/rail_ff.h b/gr-analog/include/gnuradio/analog/rail_ff.h index 2018017935..29856bbcbc 100644 --- a/gr-analog/include/analog/rail_ff.h +++ b/gr-analog/include/gnuradio/analog/rail_ff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_RAIL_FF_H #define INCLUDED_ANALOG_RAIL_FF_H -#include <analog/api.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -33,7 +33,7 @@ namespace gr { * \brief clips input values to min, max * \ingroup level_controllers_blk */ - class ANALOG_API rail_ff : virtual public gr_sync_block + class ANALOG_API rail_ff : virtual public sync_block { public: // gr::analog::rail_ff::sptr diff --git a/gr-analog/include/analog/sig_source_X.h.t b/gr-analog/include/gnuradio/analog/sig_source_X.h.t index 752fe4cd29..81c42926cf 100644 --- a/gr-analog/include/analog/sig_source_X.h.t +++ b/gr-analog/include/gnuradio/analog/sig_source_X.h.t @@ -25,9 +25,9 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <analog/api.h> -#include <analog/sig_source_waveform.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/sig_source_waveform.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -36,7 +36,7 @@ namespace gr { * \brief signal generator with @TYPE@ output. * \ingroup waveform_generators_blk */ - class ANALOG_API @BASE_NAME@ : virtual public gr_sync_block + class ANALOG_API @BASE_NAME@ : virtual public sync_block { public: // gr::analog::@BASE_NAME@::sptr diff --git a/gr-analog/include/analog/sig_source_waveform.h b/gr-analog/include/gnuradio/analog/sig_source_waveform.h index e3efeb1fbb..e3efeb1fbb 100644 --- a/gr-analog/include/analog/sig_source_waveform.h +++ b/gr-analog/include/gnuradio/analog/sig_source_waveform.h diff --git a/gr-analog/include/analog/simple_squelch_cc.h b/gr-analog/include/gnuradio/analog/simple_squelch_cc.h index bf949e3d2e..de6252b288 100644 --- a/gr-analog/include/analog/simple_squelch_cc.h +++ b/gr-analog/include/gnuradio/analog/simple_squelch_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_H #define INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_H -#include <analog/api.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { @@ -33,7 +33,7 @@ namespace gr { * \brief simple squelch block based on average signal power and threshold in dB. * \ingroup level_controllers_blk */ - class ANALOG_API simple_squelch_cc : virtual public gr_sync_block + class ANALOG_API simple_squelch_cc : virtual public sync_block { public: // gr::analog::simple_squelch_cc::sptr diff --git a/gr-analog/include/analog/squelch_base_cc.h b/gr-analog/include/gnuradio/analog/squelch_base_cc.h index 11476e7e88..63f84cb374 100644 --- a/gr-analog/include/analog/squelch_base_cc.h +++ b/gr-analog/include/gnuradio/analog/squelch_base_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_SQUELCH_BASE_CC_H #define INCLUDED_ANALOG_SQUELCH_BASE_CC_H -#include <analog/api.h> -#include <gr_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/block.h> namespace gr { namespace analog { @@ -33,7 +33,7 @@ namespace gr { * \brief basic squelch block; to be subclassed for other squelches. * \ingroup level_blk */ - class ANALOG_API squelch_base_cc : virtual public gr_block + class ANALOG_API squelch_base_cc : virtual public block { protected: virtual void update_state(const gr_complex &sample) = 0; diff --git a/gr-analog/include/analog/squelch_base_ff.h b/gr-analog/include/gnuradio/analog/squelch_base_ff.h index 2ce1f1a65a..f68262f015 100644 --- a/gr-analog/include/analog/squelch_base_ff.h +++ b/gr-analog/include/gnuradio/analog/squelch_base_ff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_SQUELCH_BASE_FF_H #define INCLUDED_ANALOG_SQUELCH_BASE_FF_H -#include <analog/api.h> -#include <gr_block.h> +#include <gnuradio/analog/api.h> +#include <gnuradio/block.h> namespace gr { namespace analog { @@ -33,7 +33,7 @@ namespace gr { * \brief basic squelch block; to be subclassed for other squelches. * \ingroup level_blk */ - class ANALOG_API squelch_base_ff : virtual public gr_block + class ANALOG_API squelch_base_ff : virtual public block { protected: virtual void update_state(const float &sample) = 0; diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt index 5719eac7a5..ce10422487 100644 --- a/gr-analog/lib/CMakeLists.txt +++ b/gr-analog/lib/CMakeLists.txt @@ -158,6 +158,7 @@ ENDIF(MSVC) list(APPEND analog_libs volk gnuradio-runtime + gnuradio-blocks gnuradio-filter ${Boost_LIBRARIES} ) diff --git a/gr-analog/lib/agc2_cc_impl.cc b/gr-analog/lib/agc2_cc_impl.cc index 2ef18e5ab8..fbca18777b 100644 --- a/gr-analog/lib/agc2_cc_impl.cc +++ b/gr-analog/lib/agc2_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include "agc2_cc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace analog { @@ -43,9 +43,9 @@ namespace gr { agc2_cc_impl::agc2_cc_impl(float attack_rate, float decay_rate, float reference, float gain, float max_gain) - : gr_sync_block("agc2_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : sync_block("agc2_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), kernel::agc2_cc(attack_rate, decay_rate, reference, gain, max_gain) { diff --git a/gr-analog/lib/agc2_cc_impl.h b/gr-analog/lib/agc2_cc_impl.h index 98afc668a0..9220501323 100644 --- a/gr-analog/lib/agc2_cc_impl.h +++ b/gr-analog/lib/agc2_cc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_ANALOG_AGC2_IMPL_CC_H #define INCLUDED_ANALOG_AGC2_IMPL_CC_H -#include <analog/agc2_cc.h> +#include <gnuradio/analog/agc2_cc.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/agc2_ff_impl.cc b/gr-analog/lib/agc2_ff_impl.cc index e0cdd6c44b..93a404c6df 100644 --- a/gr-analog/lib/agc2_ff_impl.cc +++ b/gr-analog/lib/agc2_ff_impl.cc @@ -25,7 +25,7 @@ #endif #include "agc2_ff_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace analog { @@ -48,9 +48,9 @@ namespace gr { agc2_ff_impl::agc2_ff_impl(float attack_rate, float decay_rate, float reference, float gain, float max_gain) - : gr_sync_block("agc2_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))) + : sync_block("agc2_ff", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))) , kernel::agc2_ff(attack_rate, decay_rate, reference, gain, max_gain) { diff --git a/gr-analog/lib/agc2_ff_impl.h b/gr-analog/lib/agc2_ff_impl.h index df33c8e446..8c068c4e34 100644 --- a/gr-analog/lib/agc2_ff_impl.h +++ b/gr-analog/lib/agc2_ff_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_ANALOG_AGC2_FF_IMPL_H #define INCLUDED_ANALOG_AGC2_FF_IMPL_H -#include <analog/agc2_ff.h> +#include <gnuradio/analog/agc2_ff.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/agc_cc_impl.cc b/gr-analog/lib/agc_cc_impl.cc index 81e1f67f8d..04d70d5421 100644 --- a/gr-analog/lib/agc_cc_impl.cc +++ b/gr-analog/lib/agc_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include "agc_cc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace analog { @@ -40,9 +40,9 @@ namespace gr { agc_cc_impl::agc_cc_impl(float rate, float reference, float gain, float max_gain) - : gr_sync_block("agc_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : sync_block("agc_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), kernel::agc_cc(rate, reference, gain, max_gain) { } diff --git a/gr-analog/lib/agc_cc_impl.h b/gr-analog/lib/agc_cc_impl.h index 822f46ef27..fda154d021 100644 --- a/gr-analog/lib/agc_cc_impl.h +++ b/gr-analog/lib/agc_cc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_ANALOG_AGC_CC_IMPL_H #define INCLUDED_ANALOG_AGC_CC_IMPL_H -#include <analog/agc_cc.h> +#include <gnuradio/analog/agc_cc.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/agc_ff_impl.cc b/gr-analog/lib/agc_ff_impl.cc index a80b90c12d..1c29934361 100644 --- a/gr-analog/lib/agc_ff_impl.cc +++ b/gr-analog/lib/agc_ff_impl.cc @@ -25,7 +25,7 @@ #endif #include "agc_ff_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace analog { @@ -38,9 +38,9 @@ namespace gr { } agc_ff_impl::agc_ff_impl(float rate, float reference, float gain, float max_gain) - : gr_sync_block("agc_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), + : sync_block("agc_ff", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))), kernel::agc_ff(rate, reference, gain, max_gain) { } diff --git a/gr-analog/lib/agc_ff_impl.h b/gr-analog/lib/agc_ff_impl.h index e309cca1be..c67739b73e 100644 --- a/gr-analog/lib/agc_ff_impl.h +++ b/gr-analog/lib/agc_ff_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_ANALOG_AGC_FF_IMPL_H #define INCLUDED_ANALOG_AGC_FF_IMPL_H -#include <analog/agc_ff.h> +#include <gnuradio/analog/agc_ff.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/cpfsk_bc_impl.cc b/gr-analog/lib/cpfsk_bc_impl.cc index 1b7f25f6cf..d529936608 100644 --- a/gr-analog/lib/cpfsk_bc_impl.cc +++ b/gr-analog/lib/cpfsk_bc_impl.cc @@ -23,8 +23,8 @@ #endif #include "cpfsk_bc_impl.h" -#include <gr_io_signature.h> -#include <gr_expj.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/expj.h> namespace gr { namespace analog { @@ -39,9 +39,9 @@ namespace gr { } cpfsk_bc_impl::cpfsk_bc_impl(float k, float ampl, int samples_per_sym) - : gr_sync_interpolator("cpfsk_bc", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(1, 1, sizeof(gr_complex)), + : sync_interpolator("cpfsk_bc", + io_signature::make(1, 1, sizeof(char)), + io_signature::make(1, 1, sizeof(gr_complex)), samples_per_sym) { d_samples_per_sym = samples_per_sym; diff --git a/gr-analog/lib/cpfsk_bc_impl.h b/gr-analog/lib/cpfsk_bc_impl.h index 9f6ec2c7fe..c3ae0dc864 100644 --- a/gr-analog/lib/cpfsk_bc_impl.h +++ b/gr-analog/lib/cpfsk_bc_impl.h @@ -21,7 +21,7 @@ #ifndef INCLUDED_ANALOG_CPFSK_BC_IMPL_H #define INCLUDED_ANALOG_CPFSK_BC_IMPL_H -#include <analog/cpfsk_bc.h> +#include <gnuradio/analog/cpfsk_bc.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/cpm.cc b/gr-analog/lib/cpm.cc index 618475cec7..b61ee28816 100644 --- a/gr-analog/lib/cpm.cc +++ b/gr-analog/lib/cpm.cc @@ -26,7 +26,7 @@ #include <cmath> #include <cfloat> -#include <analog/cpm.h> +#include <gnuradio/analog/cpm.h> //gives us erf on compilers without it #include <boost/math/special_functions/erf.hpp> diff --git a/gr-analog/lib/ctcss_squelch_ff_impl.cc b/gr-analog/lib/ctcss_squelch_ff_impl.cc index 60cd94fdb5..9a6f301ba0 100644 --- a/gr-analog/lib/ctcss_squelch_ff_impl.cc +++ b/gr-analog/lib/ctcss_squelch_ff_impl.cc @@ -57,9 +57,9 @@ namespace gr { ctcss_squelch_ff_impl::ctcss_squelch_ff_impl(int rate, float freq, float level, int len, int ramp, bool gate) - : gr_block("ctcss_squelch_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), + : block("ctcss_squelch_ff", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))), squelch_base_ff_impl("ctcss_squelch_ff", ramp, gate) { d_freq = freq; diff --git a/gr-analog/lib/ctcss_squelch_ff_impl.h b/gr-analog/lib/ctcss_squelch_ff_impl.h index 0827fbafe3..8954b213e2 100644 --- a/gr-analog/lib/ctcss_squelch_ff_impl.h +++ b/gr-analog/lib/ctcss_squelch_ff_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ANALOG_CTCSS_SQUELCH_FF_IMPL_H #define INCLUDED_ANALOG_CTCSS_SQUELCH_FF_IMPL_H -#include <analog/ctcss_squelch_ff.h> #include "squelch_base_ff_impl.h" -#include <fft/goertzel.h> +#include <gnuradio/analog/ctcss_squelch_ff.h> +#include <gnuradio/fft/goertzel.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/dpll_bb_impl.cc b/gr-analog/lib/dpll_bb_impl.cc index a199b66b4e..4ed0ce6925 100644 --- a/gr-analog/lib/dpll_bb_impl.cc +++ b/gr-analog/lib/dpll_bb_impl.cc @@ -25,7 +25,7 @@ #endif #include "dpll_bb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } dpll_bb_impl::dpll_bb_impl(float period, float gain) - : gr_sync_block("dpll_bb", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(1, 1, sizeof(char))), + : sync_block("dpll_bb", + io_signature::make(1, 1, sizeof(char)), + io_signature::make(1, 1, sizeof(char))), d_restart(0), d_pulse_phase(0) { d_pulse_frequency = 1.0/period; diff --git a/gr-analog/lib/dpll_bb_impl.h b/gr-analog/lib/dpll_bb_impl.h index a1d8b77097..4caa498d70 100644 --- a/gr-analog/lib/dpll_bb_impl.h +++ b/gr-analog/lib/dpll_bb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_ANALOG_DPLL_BB_IMPL_H #define INCLUDED_ANALOG_DPLL_BB_IMPL_H -#include <analog/dpll_bb.h> +#include <gnuradio/analog/dpll_bb.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/fastnoise_source_X_impl.cc.t b/gr-analog/lib/fastnoise_source_X_impl.cc.t index 706ddbbf84..e6c7f13f34 100644 --- a/gr-analog/lib/fastnoise_source_X_impl.cc.t +++ b/gr-analog/lib/fastnoise_source_X_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@IMPL_NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> namespace gr { @@ -41,9 +41,9 @@ namespace gr { } @IMPL_NAME@::@IMPL_NAME@(noise_type_t type, float ampl, long seed, long samples) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, sizeof(@TYPE@))), + : sync_block("@BASE_NAME@", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, sizeof(@TYPE@))), d_type(type), d_ampl(ampl), d_rng(seed) diff --git a/gr-analog/lib/fastnoise_source_X_impl.h.t b/gr-analog/lib/fastnoise_source_X_impl.h.t index 3c5dc106a2..ed342ec176 100644 --- a/gr-analog/lib/fastnoise_source_X_impl.h.t +++ b/gr-analog/lib/fastnoise_source_X_impl.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <analog/@BASE_NAME@.h> -#include <gr_random.h> +#include <gnuradio/analog/@BASE_NAME@.h> +#include <gnuradio/random.h> namespace gr { namespace analog { @@ -36,7 +36,7 @@ namespace gr { private: noise_type_t d_type; float d_ampl; - gr_random d_rng; + gr::random d_rng; std::vector<@TYPE@> d_samples; public: diff --git a/gr-analog/lib/feedforward_agc_cc_impl.cc b/gr-analog/lib/feedforward_agc_cc_impl.cc index 4796fdfc5b..94894d9bf1 100644 --- a/gr-analog/lib/feedforward_agc_cc_impl.cc +++ b/gr-analog/lib/feedforward_agc_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include "feedforward_agc_cc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } feedforward_agc_cc_impl::feedforward_agc_cc_impl(int nsamples, float reference) - : gr_sync_block("feedforward_agc_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : sync_block("feedforward_agc_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), d_nsamples(nsamples), d_reference(reference) { if(nsamples < 1) diff --git a/gr-analog/lib/feedforward_agc_cc_impl.h b/gr-analog/lib/feedforward_agc_cc_impl.h index 60c7acadaf..ebbfceb278 100644 --- a/gr-analog/lib/feedforward_agc_cc_impl.h +++ b/gr-analog/lib/feedforward_agc_cc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_IMPL_H #define INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_IMPL_H -#include <analog/feedforward_agc_cc.h> +#include <gnuradio/analog/feedforward_agc_cc.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/fmdet_cf_impl.cc b/gr-analog/lib/fmdet_cf_impl.cc index c92ea28896..2c48ff07e2 100644 --- a/gr-analog/lib/fmdet_cf_impl.cc +++ b/gr-analog/lib/fmdet_cf_impl.cc @@ -25,8 +25,8 @@ #endif #include "fmdet_cf_impl.h" -#include <gr_io_signature.h> -#include <gr_math.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/math.h> namespace gr { namespace analog { @@ -43,9 +43,9 @@ namespace gr { fmdet_cf_impl::fmdet_cf_impl(float samplerate, float freq_low, float freq_high, float scl) - : gr_sync_block("fmdet_cf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(float))), + : sync_block("fmdet_cf", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(float))), d_S1(0.1), d_S2(0.1), d_S3(0.1), d_S4(0.1) { diff --git a/gr-analog/lib/fmdet_cf_impl.h b/gr-analog/lib/fmdet_cf_impl.h index 01fce09dd2..921e20ec78 100644 --- a/gr-analog/lib/fmdet_cf_impl.h +++ b/gr-analog/lib/fmdet_cf_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ANALOG_FMDET_CF_IMPL_H #define INCLUDED_ANALOG_FMDET_CF_IMPL_H -#include <analog/fmdet_cf.h> -//#include <filter/fir_filter.h> -#include <gr_sync_block.h> +#include <gnuradio/analog/fmdet_cf.h> +//#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/sync_block.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/frequency_modulator_fc_impl.cc b/gr-analog/lib/frequency_modulator_fc_impl.cc index 2da7ee15f1..9fb741690b 100644 --- a/gr-analog/lib/frequency_modulator_fc_impl.cc +++ b/gr-analog/lib/frequency_modulator_fc_impl.cc @@ -25,8 +25,8 @@ #endif #include "frequency_modulator_fc_impl.h" -#include <gr_io_signature.h> -#include <gr_fxpt.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/fxpt.h> #include <math.h> #include <boost/math/special_functions/trunc.hpp> @@ -41,9 +41,9 @@ namespace gr { } frequency_modulator_fc_impl::frequency_modulator_fc_impl(double sensitivity) - : gr_sync_block("frequency_modulator_fc", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : sync_block("frequency_modulator_fc", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(gr_complex))), d_sensitivity(sensitivity), d_phase(0) { } @@ -70,8 +70,8 @@ namespace gr { float oi, oq; - gr_int32 angle = gr_fxpt::float_to_fixed (d_phase); - gr_fxpt::sincos(angle, &oq, &oi); + gr_int32 angle = gr::fxpt::float_to_fixed (d_phase); + gr::fxpt::sincos(angle, &oq, &oi); out[i] = gr_complex(oi, oq); } diff --git a/gr-analog/lib/frequency_modulator_fc_impl.h b/gr-analog/lib/frequency_modulator_fc_impl.h index 36512f5164..cdd3562e09 100644 --- a/gr-analog/lib/frequency_modulator_fc_impl.h +++ b/gr-analog/lib/frequency_modulator_fc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_IMPL_H #define INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_IMPL_H -#include <analog/frequency_modulator_fc.h> +#include <gnuradio/analog/frequency_modulator_fc.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/noise_source_X_impl.cc.t b/gr-analog/lib/noise_source_X_impl.cc.t index 7f371b2cfd..5d09647848 100644 --- a/gr-analog/lib/noise_source_X_impl.cc.t +++ b/gr-analog/lib/noise_source_X_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@IMPL_NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> namespace gr { @@ -41,9 +41,9 @@ namespace gr { } @IMPL_NAME@::@IMPL_NAME@(noise_type_t type, float ampl, long seed) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, sizeof(@TYPE@))), + : sync_block("@BASE_NAME@", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, sizeof(@TYPE@))), d_type(type), d_ampl(ampl), d_rng(seed) diff --git a/gr-analog/lib/noise_source_X_impl.h.t b/gr-analog/lib/noise_source_X_impl.h.t index 3a0e8d6d7c..cd7a3e1636 100644 --- a/gr-analog/lib/noise_source_X_impl.h.t +++ b/gr-analog/lib/noise_source_X_impl.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <analog/@BASE_NAME@.h> -#include <gr_random.h> +#include <gnuradio/analog/@BASE_NAME@.h> +#include <gnuradio/random.h> namespace gr { namespace analog { @@ -35,7 +35,7 @@ namespace gr { { noise_type_t d_type; float d_ampl; - gr_random d_rng; + gr::random d_rng; public: @IMPL_NAME@(noise_type_t type, float ampl, long seed = 0); diff --git a/gr-analog/lib/phase_modulator_fc_impl.cc b/gr-analog/lib/phase_modulator_fc_impl.cc index 9e9e73f8ce..9dc010dd5b 100644 --- a/gr-analog/lib/phase_modulator_fc_impl.cc +++ b/gr-analog/lib/phase_modulator_fc_impl.cc @@ -25,8 +25,8 @@ #endif #include "phase_modulator_fc_impl.h" -#include <gr_io_signature.h> -#include <gr_sincos.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/sincos.h> #include <math.h> namespace gr { @@ -40,9 +40,9 @@ namespace gr { } phase_modulator_fc_impl::phase_modulator_fc_impl(double sensitivity) - : gr_sync_block("phase_modulator_fc", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : sync_block("phase_modulator_fc", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(gr_complex))), d_sensitivity(sensitivity), d_phase(0) { } @@ -62,7 +62,7 @@ namespace gr { for(int i = 0; i < noutput_items; i++) { d_phase = d_sensitivity * in[i]; float oi, oq; - gr_sincosf(d_phase, &oq, &oi); + gr::sincosf(d_phase, &oq, &oi); out[i] = gr_complex(oi, oq); } diff --git a/gr-analog/lib/phase_modulator_fc_impl.h b/gr-analog/lib/phase_modulator_fc_impl.h index ac10bc891f..8b7c1df053 100644 --- a/gr-analog/lib/phase_modulator_fc_impl.h +++ b/gr-analog/lib/phase_modulator_fc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_ANALOG_PHASE_MODULATOR_FC_IMPL_H #define INCLUDED_ANALOG_PHASE_MODULATOR_FC_IMPL_H -#include <analog/phase_modulator_fc.h> +#include <gnuradio/analog/phase_modulator_fc.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.cc b/gr-analog/lib/pll_carriertracking_cc_impl.cc index 9213a5e681..0cc3f8b8ec 100644 --- a/gr-analog/lib/pll_carriertracking_cc_impl.cc +++ b/gr-analog/lib/pll_carriertracking_cc_impl.cc @@ -25,10 +25,10 @@ #endif #include "pll_carriertracking_cc_impl.h" -#include <gr_io_signature.h> -#include <gr_sincos.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/sincos.h> #include <math.h> -#include <gr_math.h> +#include <gnuradio/math.h> namespace gr { namespace analog { @@ -47,9 +47,9 @@ namespace gr { pll_carriertracking_cc_impl::pll_carriertracking_cc_impl(float loop_bw, float max_freq, float min_freq) - : gr_sync_block("pll_carriertracking_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : sync_block("pll_carriertracking_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), blocks::control_loop(loop_bw, max_freq, min_freq), d_locksig(0), d_lock_threshold(0), d_squelch_enable(false) { @@ -75,7 +75,7 @@ namespace gr { { float sample_phase; // sample_phase = atan2(sample.imag(),sample.real()); - sample_phase = gr_fast_atan2f(sample.imag(),sample.real()); + sample_phase = gr::fast_atan2f(sample.imag(),sample.real()); return mod_2pi(sample_phase-ref_phase); } @@ -109,7 +109,7 @@ namespace gr { float t_imag, t_real; for(int i = 0; i < noutput_items; i++) { - gr_sincosf(d_phase, &t_imag, &t_real); + gr::sincosf(d_phase, &t_imag, &t_real); optr[i] = iptr[i] * gr_complex(t_real, -t_imag); error = phase_detector(iptr[i], d_phase); diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.h b/gr-analog/lib/pll_carriertracking_cc_impl.h index c809736709..49259f996e 100644 --- a/gr-analog/lib/pll_carriertracking_cc_impl.h +++ b/gr-analog/lib/pll_carriertracking_cc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_IMPL_H #define INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_IMPL_H -#include <analog/pll_carriertracking_cc.h> +#include <gnuradio/analog/pll_carriertracking_cc.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/pll_freqdet_cf_impl.cc b/gr-analog/lib/pll_freqdet_cf_impl.cc index 9e55d9bedb..42caa0bfd5 100644 --- a/gr-analog/lib/pll_freqdet_cf_impl.cc +++ b/gr-analog/lib/pll_freqdet_cf_impl.cc @@ -25,9 +25,9 @@ #endif #include "pll_freqdet_cf_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <math.h> -#include <gr_math.h> +#include <gnuradio/math.h> namespace gr { namespace analog { @@ -44,9 +44,9 @@ namespace gr { } pll_freqdet_cf_impl::pll_freqdet_cf_impl(float loop_bw, float max_freq, float min_freq) - : gr_sync_block("pll_freqdet_cf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(float))), + : sync_block("pll_freqdet_cf", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(float))), blocks::control_loop(loop_bw, max_freq, min_freq) { } @@ -70,7 +70,7 @@ namespace gr { pll_freqdet_cf_impl::phase_detector(gr_complex sample, float ref_phase) { float sample_phase; - sample_phase = gr_fast_atan2f(sample.imag(), sample.real()); + sample_phase = gr::fast_atan2f(sample.imag(), sample.real()); return mod_2pi(sample_phase - ref_phase); } diff --git a/gr-analog/lib/pll_freqdet_cf_impl.h b/gr-analog/lib/pll_freqdet_cf_impl.h index 3170d819b6..646b0609c0 100644 --- a/gr-analog/lib/pll_freqdet_cf_impl.h +++ b/gr-analog/lib/pll_freqdet_cf_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_ANALOG_PLL_FREQDET_CF_IMPL_H #define INCLUDED_ANALOG_PLL_FREQDET_CF_IMPL_H -#include <analog/pll_freqdet_cf.h> +#include <gnuradio/analog/pll_freqdet_cf.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/pll_refout_cc_impl.cc b/gr-analog/lib/pll_refout_cc_impl.cc index 3f0ccc7df5..157961318a 100644 --- a/gr-analog/lib/pll_refout_cc_impl.cc +++ b/gr-analog/lib/pll_refout_cc_impl.cc @@ -25,10 +25,10 @@ #endif #include "pll_refout_cc_impl.h" -#include <gr_io_signature.h> -#include <gr_sincos.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/sincos.h> #include <math.h> -#include <gr_math.h> +#include <gnuradio/math.h> namespace gr { namespace analog { @@ -45,9 +45,9 @@ namespace gr { } pll_refout_cc_impl::pll_refout_cc_impl(float loop_bw, float max_freq, float min_freq) - : gr_sync_block("pll_refout_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : sync_block("pll_refout_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), blocks::control_loop(loop_bw, max_freq, min_freq) { } @@ -71,7 +71,7 @@ namespace gr { pll_refout_cc_impl::phase_detector(gr_complex sample,float ref_phase) { float sample_phase; - sample_phase = gr_fast_atan2f(sample.imag(),sample.real()); + sample_phase = gr::fast_atan2f(sample.imag(),sample.real()); return mod_2pi(sample_phase-ref_phase); } @@ -88,7 +88,7 @@ namespace gr { int size = noutput_items; while(size-- > 0) { - gr_sincosf(d_phase,&t_imag,&t_real); + gr::sincosf(d_phase,&t_imag,&t_real); *optr++ = gr_complex(t_real,t_imag); error = phase_detector(*iptr++,d_phase); diff --git a/gr-analog/lib/pll_refout_cc_impl.h b/gr-analog/lib/pll_refout_cc_impl.h index 1734b6e138..1a7e3d5066 100644 --- a/gr-analog/lib/pll_refout_cc_impl.h +++ b/gr-analog/lib/pll_refout_cc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_ANALOG_PLL_REFOUT_CC_IMPL_H #define INCLUDED_ANALOG_PLL_REFOUT_CC_IMPL_H -#include <analog/pll_refout_cc.h> +#include <gnuradio/analog/pll_refout_cc.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/probe_avg_mag_sqrd_c_impl.cc b/gr-analog/lib/probe_avg_mag_sqrd_c_impl.cc index 291809bb24..78e0c842ed 100644 --- a/gr-analog/lib/probe_avg_mag_sqrd_c_impl.cc +++ b/gr-analog/lib/probe_avg_mag_sqrd_c_impl.cc @@ -25,7 +25,7 @@ #endif #include "probe_avg_mag_sqrd_c_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cmath> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } probe_avg_mag_sqrd_c_impl::probe_avg_mag_sqrd_c_impl(double threshold_db, double alpha) - : gr_sync_block("probe_avg_mag_sqrd_c", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), + : sync_block("probe_avg_mag_sqrd_c", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(0, 0, 0)), d_unmuted(false), d_level(0), d_iir(alpha) { set_threshold(threshold_db); diff --git a/gr-analog/lib/probe_avg_mag_sqrd_c_impl.h b/gr-analog/lib/probe_avg_mag_sqrd_c_impl.h index 0a2685357a..cddb9a7234 100644 --- a/gr-analog/lib/probe_avg_mag_sqrd_c_impl.h +++ b/gr-analog/lib/probe_avg_mag_sqrd_c_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_IMPL_H #define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_IMPL_H -#include <analog/probe_avg_mag_sqrd_c.h> -#include <filter/single_pole_iir.h> +#include <gnuradio/analog/probe_avg_mag_sqrd_c.h> +#include <gnuradio/filter/single_pole_iir.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.cc b/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.cc index ceaf5dbf01..76d54880d4 100644 --- a/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.cc +++ b/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.cc @@ -25,7 +25,7 @@ #endif #include "probe_avg_mag_sqrd_cf_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cmath> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } probe_avg_mag_sqrd_cf_impl::probe_avg_mag_sqrd_cf_impl(double threshold_db, double alpha) - : gr_sync_block("probe_avg_mag_sqrd_cf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(float))), + : sync_block("probe_avg_mag_sqrd_cf", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(float))), d_unmuted(false), d_level(0), d_iir(alpha) { set_threshold(threshold_db); diff --git a/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.h b/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.h index 9cd8f8d4c3..359f7f8d53 100644 --- a/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.h +++ b/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_IMPL_H #define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_IMPL_H -#include <analog/probe_avg_mag_sqrd_cf.h> -#include <filter/single_pole_iir.h> +#include <gnuradio/analog/probe_avg_mag_sqrd_cf.h> +#include <gnuradio/filter/single_pole_iir.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/probe_avg_mag_sqrd_f_impl.cc b/gr-analog/lib/probe_avg_mag_sqrd_f_impl.cc index 4ac7ef06bd..505a24a5e9 100644 --- a/gr-analog/lib/probe_avg_mag_sqrd_f_impl.cc +++ b/gr-analog/lib/probe_avg_mag_sqrd_f_impl.cc @@ -25,7 +25,7 @@ #endif #include "probe_avg_mag_sqrd_f_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cmath> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } probe_avg_mag_sqrd_f_impl::probe_avg_mag_sqrd_f_impl(double threshold_db, double alpha) - : gr_sync_block("probe_avg_mag_sqrd_f", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(0, 0, 0)), + : sync_block("probe_avg_mag_sqrd_f", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(0, 0, 0)), d_unmuted(false), d_level(0), d_iir(alpha) { set_threshold(threshold_db); diff --git a/gr-analog/lib/probe_avg_mag_sqrd_f_impl.h b/gr-analog/lib/probe_avg_mag_sqrd_f_impl.h index ba879763c2..bdccfc7b3a 100644 --- a/gr-analog/lib/probe_avg_mag_sqrd_f_impl.h +++ b/gr-analog/lib/probe_avg_mag_sqrd_f_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_IMPL_H #define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_IMPL_H -#include <analog/probe_avg_mag_sqrd_f.h> -#include <filter/single_pole_iir.h> +#include <gnuradio/analog/probe_avg_mag_sqrd_f.h> +#include <gnuradio/filter/single_pole_iir.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/pwr_squelch_cc_impl.cc b/gr-analog/lib/pwr_squelch_cc_impl.cc index 1bfba6846f..44fd5dc668 100644 --- a/gr-analog/lib/pwr_squelch_cc_impl.cc +++ b/gr-analog/lib/pwr_squelch_cc_impl.cc @@ -39,9 +39,9 @@ namespace gr { pwr_squelch_cc_impl::pwr_squelch_cc_impl(double threshold, double alpha, int ramp, bool gate) - : gr_block("pwr_squelch_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : block("pwr_squelch_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), squelch_base_cc_impl("pwr_squelch_cc", ramp, gate), d_iir(alpha) { diff --git a/gr-analog/lib/pwr_squelch_cc_impl.h b/gr-analog/lib/pwr_squelch_cc_impl.h index 72df0f3d2d..1fd2bc8a71 100644 --- a/gr-analog/lib/pwr_squelch_cc_impl.h +++ b/gr-analog/lib/pwr_squelch_cc_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ANALOG_PWR_SQUELCH_CC_IMPL_H #define INCLUDED_ANALOG_PWR_SQUELCH_CC_IMPL_H -#include <analog/pwr_squelch_cc.h> +#include <gnuradio/analog/pwr_squelch_cc.h> #include "squelch_base_cc_impl.h" -#include <filter/single_pole_iir.h> +#include <gnuradio/filter/single_pole_iir.h> #include <cmath> namespace gr { diff --git a/gr-analog/lib/pwr_squelch_ff_impl.cc b/gr-analog/lib/pwr_squelch_ff_impl.cc index c6bb6af903..812011bbb5 100644 --- a/gr-analog/lib/pwr_squelch_ff_impl.cc +++ b/gr-analog/lib/pwr_squelch_ff_impl.cc @@ -39,9 +39,9 @@ namespace gr { pwr_squelch_ff_impl::pwr_squelch_ff_impl(double threshold, double alpha, int ramp, bool gate) - : gr_block("pwr_squelch_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), + : block("pwr_squelch_ff", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))), squelch_base_ff_impl("pwr_squelch_ff", ramp, gate), d_iir(alpha) { diff --git a/gr-analog/lib/pwr_squelch_ff_impl.h b/gr-analog/lib/pwr_squelch_ff_impl.h index 96d959b4dd..022f97c16c 100644 --- a/gr-analog/lib/pwr_squelch_ff_impl.h +++ b/gr-analog/lib/pwr_squelch_ff_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ANALOG_PWR_SQUELCH_FF_IMPL_H #define INCLUDED_ANALOG_PWR_SQUELCH_FF_IMPL_H -#include <analog/pwr_squelch_ff.h> +#include <gnuradio/analog/pwr_squelch_ff.h> #include "squelch_base_ff_impl.h" -#include <filter/single_pole_iir.h> +#include <gnuradio/filter/single_pole_iir.h> #include <cmath> namespace gr { diff --git a/gr-analog/lib/qa_analog.h b/gr-analog/lib/qa_analog.h index b66b62b5fe..cdb5c78b94 100644 --- a/gr-analog/lib/qa_analog.h +++ b/gr-analog/lib/qa_analog.h @@ -23,7 +23,7 @@ #ifndef _QA_GR_ANALOG_H_ #define _QA_GR_ANALOG_H_ -#include <attributes.h> +#include <gnuradio/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for the gr-analog directory diff --git a/gr-analog/lib/quadrature_demod_cf_impl.cc b/gr-analog/lib/quadrature_demod_cf_impl.cc index 9490ba6bed..583de4dba4 100644 --- a/gr-analog/lib/quadrature_demod_cf_impl.cc +++ b/gr-analog/lib/quadrature_demod_cf_impl.cc @@ -25,8 +25,8 @@ #endif #include "quadrature_demod_cf_impl.h" -#include <gr_io_signature.h> -#include <gr_math.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/math.h> namespace gr { namespace analog { @@ -39,9 +39,9 @@ namespace gr { } quadrature_demod_cf_impl::quadrature_demod_cf_impl(float gain) - : gr_sync_block("quadrature_demod_cf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(float))), + : sync_block("quadrature_demod_cf", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(float))), d_gain(gain) { set_history(2); // we need to look at the previous value @@ -62,7 +62,7 @@ namespace gr { for(int i = 0; i < noutput_items; i++) { gr_complex product = in[i] * conj(in[i-1]); - out[i] = d_gain * gr_fast_atan2f(imag(product), real(product)); + out[i] = d_gain * gr::fast_atan2f(imag(product), real(product)); } return noutput_items; diff --git a/gr-analog/lib/quadrature_demod_cf_impl.h b/gr-analog/lib/quadrature_demod_cf_impl.h index 72beb23316..2b505c3c55 100644 --- a/gr-analog/lib/quadrature_demod_cf_impl.h +++ b/gr-analog/lib/quadrature_demod_cf_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_IMPL_H #define INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_IMPL_H -#include <analog/quadrature_demod_cf.h> +#include <gnuradio/analog/quadrature_demod_cf.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/rail_ff_impl.cc b/gr-analog/lib/rail_ff_impl.cc index 106c6353ae..a0e4f7cccd 100644 --- a/gr-analog/lib/rail_ff_impl.cc +++ b/gr-analog/lib/rail_ff_impl.cc @@ -25,8 +25,8 @@ #endif #include "rail_ff_impl.h" -#include <gr_io_signature.h> -#include <gr_math.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/math.h> namespace gr { namespace analog { @@ -39,9 +39,9 @@ namespace gr { } rail_ff_impl::rail_ff_impl(float lo, float hi) - : gr_sync_block("rail_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), + : sync_block("rail_ff", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))), d_lo(lo), d_hi(hi) { set_clipping(); @@ -81,7 +81,7 @@ namespace gr { float *out = (float*)output_items[0]; for(int i = 0; i < noutput_items; i++) { - out[i] = d_mid + gr_branchless_clip(in[i] - d_mid, d_clip); + out[i] = d_mid + gr::branchless_clip(in[i] - d_mid, d_clip); } return noutput_items; diff --git a/gr-analog/lib/rail_ff_impl.h b/gr-analog/lib/rail_ff_impl.h index 436b10b412..3617d097d9 100644 --- a/gr-analog/lib/rail_ff_impl.h +++ b/gr-analog/lib/rail_ff_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_ANALOG_RAIL_FF_IMPL_H #define INCLUDED_ANALOG_RAIL_FF_IMPL_H -#include <analog/rail_ff.h> +#include <gnuradio/analog/rail_ff.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/sig_source_X_impl.cc.t b/gr-analog/lib/sig_source_X_impl.cc.t index ad8b7e4b0c..c9e99f015a 100644 --- a/gr-analog/lib/sig_source_X_impl.cc.t +++ b/gr-analog/lib/sig_source_X_impl.cc.t @@ -28,10 +28,10 @@ #include "@IMPL_NAME@.h" #include <algorithm> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> #include <algorithm> -#include <gr_complex.h> +#include <gnuradio/gr_complex.h> namespace gr { namespace analog { @@ -46,9 +46,9 @@ namespace gr { @IMPL_NAME@::@IMPL_NAME@(double sampling_freq, gr_waveform_t waveform, double frequency, double ampl, @TYPE@ offset) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, sizeof(@TYPE@))), + : sync_block("@BASE_NAME@", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, sizeof(@TYPE@))), d_sampling_freq(sampling_freq), d_waveform(waveform), d_frequency(frequency), d_ampl(ampl), d_offset(offset) { diff --git a/gr-analog/lib/sig_source_X_impl.h.t b/gr-analog/lib/sig_source_X_impl.h.t index 50f1791270..930a810a67 100644 --- a/gr-analog/lib/sig_source_X_impl.h.t +++ b/gr-analog/lib/sig_source_X_impl.h.t @@ -25,9 +25,9 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <analog/@BASE_NAME@.h> -#include <gr_sync_block.h> -#include <gr_fxpt_nco.h> +#include <gnuradio/analog/@BASE_NAME@.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/fxpt_nco.h> namespace gr { namespace analog { @@ -40,7 +40,7 @@ namespace gr { double d_frequency; double d_ampl; @TYPE@ d_offset; - gr_fxpt_nco d_nco; + gr::fxpt_nco d_nco; public: @IMPL_NAME@(double sampling_freq, gr_waveform_t waveform, diff --git a/gr-analog/lib/simple_squelch_cc_impl.cc b/gr-analog/lib/simple_squelch_cc_impl.cc index 02ccc535da..edaf8de9ce 100644 --- a/gr-analog/lib/simple_squelch_cc_impl.cc +++ b/gr-analog/lib/simple_squelch_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include "simple_squelch_cc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cmath> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } simple_squelch_cc_impl::simple_squelch_cc_impl(double threshold_db, double alpha) - : gr_sync_block("simple_squelch_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : sync_block("simple_squelch_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), d_unmuted(false), d_iir(alpha) { set_threshold(threshold_db); diff --git a/gr-analog/lib/simple_squelch_cc_impl.h b/gr-analog/lib/simple_squelch_cc_impl.h index ba11de91e7..d1a923a296 100644 --- a/gr-analog/lib/simple_squelch_cc_impl.h +++ b/gr-analog/lib/simple_squelch_cc_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_IMPL_H #define INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_IMPL_H -#include <analog/simple_squelch_cc.h> -#include <filter/single_pole_iir.h> +#include <gnuradio/analog/simple_squelch_cc.h> +#include <gnuradio/filter/single_pole_iir.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/squelch_base_cc_impl.cc b/gr-analog/lib/squelch_base_cc_impl.cc index cba7b30dba..73be18349d 100644 --- a/gr-analog/lib/squelch_base_cc_impl.cc +++ b/gr-analog/lib/squelch_base_cc_impl.cc @@ -25,15 +25,15 @@ #endif #include "squelch_base_cc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace analog { squelch_base_cc_impl::squelch_base_cc_impl(const char *name, int ramp, bool gate) - : gr_block(name, - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))) + : block(name, + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))) { set_ramp(ramp); set_gate(gate); diff --git a/gr-analog/lib/squelch_base_cc_impl.h b/gr-analog/lib/squelch_base_cc_impl.h index 19dccaa101..58802df91c 100644 --- a/gr-analog/lib/squelch_base_cc_impl.h +++ b/gr-analog/lib/squelch_base_cc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_SQUELCH_BASE_CC_IMPL_H #define INCLUDED_GR_SQUELCH_BASE_CC_IMPL_H -#include <analog/squelch_base_cc.h> +#include <gnuradio/analog/squelch_base_cc.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/squelch_base_ff_impl.cc b/gr-analog/lib/squelch_base_ff_impl.cc index f9f07d36da..2fb0e64301 100644 --- a/gr-analog/lib/squelch_base_ff_impl.cc +++ b/gr-analog/lib/squelch_base_ff_impl.cc @@ -25,15 +25,15 @@ #endif #include "squelch_base_ff_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace analog { squelch_base_ff_impl::squelch_base_ff_impl(const char *name, int ramp, bool gate) - : gr_block(name, - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))) + : block(name, + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))) { set_ramp(ramp); set_gate(gate); diff --git a/gr-analog/lib/squelch_base_ff_impl.h b/gr-analog/lib/squelch_base_ff_impl.h index 22659be746..343dc5f610 100644 --- a/gr-analog/lib/squelch_base_ff_impl.h +++ b/gr-analog/lib/squelch_base_ff_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_SQUELCH_BASE_FF_IMPL_H #define INCLUDED_GR_SQUELCH_BASE_FF_IMPL_H -#include <analog/squelch_base_ff.h> +#include <gnuradio/analog/squelch_base_ff.h> namespace gr { namespace analog { diff --git a/gr-analog/lib/test_gr_analog.cc b/gr-analog/lib/test_gr_analog.cc index 95ee3aa8cb..e621f9d395 100644 --- a/gr-analog/lib/test_gr_analog.cc +++ b/gr-analog/lib/test_gr_analog.cc @@ -27,7 +27,7 @@ #include <cppunit/TextTestRunner.h> #include <cppunit/XmlOutputter.h> -#include <gr_unittests.h> +#include <gnuradio/unittests.h> #include "qa_analog.h" #include <iostream> diff --git a/gr-analog/swig/CMakeLists.txt b/gr-analog/swig/CMakeLists.txt index 3e93f0c77b..577a69eae4 100644 --- a/gr-analog/swig/CMakeLists.txt +++ b/gr-analog/swig/CMakeLists.txt @@ -37,7 +37,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/analog_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/analog) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/analog) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_TARGET_DEPS analog_generated_includes) set(GR_SWIG_LIBRARIES gnuradio-analog gnuradio-filter) diff --git a/gr-analog/swig/analog_swig.i b/gr-analog/swig/analog_swig.i index 9ae019ad8e..a2da8dd10e 100644 --- a/gr-analog/swig/analog_swig.i +++ b/gr-analog/swig/analog_swig.i @@ -29,91 +29,91 @@ %include "analog_swig_doc.i" %{ -#include <blocks/control_loop.h> +#include <gnuradio/blocks/control_loop.h> %} -%include <blocks/control_loop.h> +%include <gnuradio/blocks/control_loop.h> %{ -#include "analog/cpm.h" -#include "analog/noise_type.h" -#include "analog/agc_cc.h" -#include "analog/agc_ff.h" -#include "analog/agc2_cc.h" -#include "analog/agc2_ff.h" -#include "analog/cpfsk_bc.h" -#include "analog/ctcss_squelch_ff.h" -#include "analog/dpll_bb.h" -#include "analog/feedforward_agc_cc.h" -#include "analog/fmdet_cf.h" -#include "analog/frequency_modulator_fc.h" -#include "analog/fastnoise_source_s.h" -#include "analog/fastnoise_source_i.h" -#include "analog/fastnoise_source_f.h" -#include "analog/fastnoise_source_c.h" -#include "analog/noise_source_s.h" -#include "analog/noise_source_i.h" -#include "analog/noise_source_f.h" -#include "analog/noise_source_c.h" -#include "analog/phase_modulator_fc.h" -#include "analog/pll_carriertracking_cc.h" -#include "analog/pll_freqdet_cf.h" -#include "analog/pll_refout_cc.h" -#include "analog/probe_avg_mag_sqrd_c.h" -#include "analog/probe_avg_mag_sqrd_cf.h" -#include "analog/probe_avg_mag_sqrd_f.h" -#include "analog/pwr_squelch_cc.h" -#include "analog/pwr_squelch_ff.h" -#include "analog/quadrature_demod_cf.h" -#include "analog/rail_ff.h" -#include "analog/sig_source_s.h" -#include "analog/sig_source_i.h" -#include "analog/sig_source_f.h" -#include "analog/sig_source_c.h" -#include "analog/sig_source_waveform.h" -#include "analog/simple_squelch_cc.h" -#include "analog/squelch_base_cc.h" -#include "analog/squelch_base_ff.h" +#include "gnuradio/analog/cpm.h" +#include "gnuradio/analog/noise_type.h" +#include "gnuradio/analog/agc_cc.h" +#include "gnuradio/analog/agc_ff.h" +#include "gnuradio/analog/agc2_cc.h" +#include "gnuradio/analog/agc2_ff.h" +#include "gnuradio/analog/cpfsk_bc.h" +#include "gnuradio/analog/ctcss_squelch_ff.h" +#include "gnuradio/analog/dpll_bb.h" +#include "gnuradio/analog/feedforward_agc_cc.h" +#include "gnuradio/analog/fmdet_cf.h" +#include "gnuradio/analog/frequency_modulator_fc.h" +#include "gnuradio/analog/fastnoise_source_s.h" +#include "gnuradio/analog/fastnoise_source_i.h" +#include "gnuradio/analog/fastnoise_source_f.h" +#include "gnuradio/analog/fastnoise_source_c.h" +#include "gnuradio/analog/noise_source_s.h" +#include "gnuradio/analog/noise_source_i.h" +#include "gnuradio/analog/noise_source_f.h" +#include "gnuradio/analog/noise_source_c.h" +#include "gnuradio/analog/phase_modulator_fc.h" +#include "gnuradio/analog/pll_carriertracking_cc.h" +#include "gnuradio/analog/pll_freqdet_cf.h" +#include "gnuradio/analog/pll_refout_cc.h" +#include "gnuradio/analog/probe_avg_mag_sqrd_c.h" +#include "gnuradio/analog/probe_avg_mag_sqrd_cf.h" +#include "gnuradio/analog/probe_avg_mag_sqrd_f.h" +#include "gnuradio/analog/pwr_squelch_cc.h" +#include "gnuradio/analog/pwr_squelch_ff.h" +#include "gnuradio/analog/quadrature_demod_cf.h" +#include "gnuradio/analog/rail_ff.h" +#include "gnuradio/analog/sig_source_s.h" +#include "gnuradio/analog/sig_source_i.h" +#include "gnuradio/analog/sig_source_f.h" +#include "gnuradio/analog/sig_source_c.h" +#include "gnuradio/analog/sig_source_waveform.h" +#include "gnuradio/analog/simple_squelch_cc.h" +#include "gnuradio/analog/squelch_base_cc.h" +#include "gnuradio/analog/squelch_base_ff.h" %} -%include "analog/cpm.h" -%include "analog/noise_type.h" -%include "analog/agc_cc.h" -%include "analog/agc_ff.h" -%include "analog/agc2_cc.h" -%include "analog/agc2_ff.h" -%include "analog/cpfsk_bc.h" -%include "analog/ctcss_squelch_ff.h" -%include "analog/dpll_bb.h" -%include "analog/feedforward_agc_cc.h" -%include "analog/fmdet_cf.h" -%include "analog/frequency_modulator_fc.h" -%include "analog/fastnoise_source_s.h" -%include "analog/fastnoise_source_i.h" -%include "analog/fastnoise_source_f.h" -%include "analog/fastnoise_source_c.h" -%include "analog/noise_source_s.h" -%include "analog/noise_source_i.h" -%include "analog/noise_source_f.h" -%include "analog/noise_source_c.h" -%include "analog/phase_modulator_fc.h" -%include "analog/pll_carriertracking_cc.h" -%include "analog/pll_freqdet_cf.h" -%include "analog/pll_refout_cc.h" -%include "analog/probe_avg_mag_sqrd_c.h" -%include "analog/probe_avg_mag_sqrd_cf.h" -%include "analog/probe_avg_mag_sqrd_f.h" -%include "analog/pwr_squelch_cc.h" -%include "analog/pwr_squelch_ff.h" -%include "analog/quadrature_demod_cf.h" -%include "analog/rail_ff.h" -%include "analog/sig_source_s.h" -%include "analog/sig_source_i.h" -%include "analog/sig_source_f.h" -%include "analog/sig_source_c.h" -%include "analog/sig_source_waveform.h" -%include "analog/simple_squelch_cc.h" -%include "analog/squelch_base_cc.h" -%include "analog/squelch_base_ff.h" +%include "gnuradio/analog/cpm.h" +%include "gnuradio/analog/noise_type.h" +%include "gnuradio/analog/agc_cc.h" +%include "gnuradio/analog/agc_ff.h" +%include "gnuradio/analog/agc2_cc.h" +%include "gnuradio/analog/agc2_ff.h" +%include "gnuradio/analog/cpfsk_bc.h" +%include "gnuradio/analog/ctcss_squelch_ff.h" +%include "gnuradio/analog/dpll_bb.h" +%include "gnuradio/analog/feedforward_agc_cc.h" +%include "gnuradio/analog/fmdet_cf.h" +%include "gnuradio/analog/frequency_modulator_fc.h" +%include "gnuradio/analog/fastnoise_source_s.h" +%include "gnuradio/analog/fastnoise_source_i.h" +%include "gnuradio/analog/fastnoise_source_f.h" +%include "gnuradio/analog/fastnoise_source_c.h" +%include "gnuradio/analog/noise_source_s.h" +%include "gnuradio/analog/noise_source_i.h" +%include "gnuradio/analog/noise_source_f.h" +%include "gnuradio/analog/noise_source_c.h" +%include "gnuradio/analog/phase_modulator_fc.h" +%include "gnuradio/analog/pll_carriertracking_cc.h" +%include "gnuradio/analog/pll_freqdet_cf.h" +%include "gnuradio/analog/pll_refout_cc.h" +%include "gnuradio/analog/probe_avg_mag_sqrd_c.h" +%include "gnuradio/analog/probe_avg_mag_sqrd_cf.h" +%include "gnuradio/analog/probe_avg_mag_sqrd_f.h" +%include "gnuradio/analog/pwr_squelch_cc.h" +%include "gnuradio/analog/pwr_squelch_ff.h" +%include "gnuradio/analog/quadrature_demod_cf.h" +%include "gnuradio/analog/rail_ff.h" +%include "gnuradio/analog/sig_source_s.h" +%include "gnuradio/analog/sig_source_i.h" +%include "gnuradio/analog/sig_source_f.h" +%include "gnuradio/analog/sig_source_c.h" +%include "gnuradio/analog/sig_source_waveform.h" +%include "gnuradio/analog/simple_squelch_cc.h" +%include "gnuradio/analog/squelch_base_cc.h" +%include "gnuradio/analog/squelch_base_ff.h" GR_SWIG_BLOCK_MAGIC2(analog, agc_cc); GR_SWIG_BLOCK_MAGIC2(analog, agc_ff); diff --git a/gr-atsc/CMakeLists.txt b/gr-atsc/CMakeLists.txt index 5e136cadae..9958edb36c 100644 --- a/gr-atsc/CMakeLists.txt +++ b/gr-atsc/CMakeLists.txt @@ -91,7 +91,7 @@ CPACK_COMPONENT("atsc_swig" # Add subdirectories ######################################################################## add_subdirectory(lib) -add_subdirectory(include/atsc) +add_subdirectory(include/gnuradio/atsc) if(ENABLE_PYTHON) add_subdirectory(swig) add_subdirectory(python) diff --git a/gr-atsc/include/atsc/CMakeLists.txt b/gr-atsc/include/gnuradio/atsc/CMakeLists.txt index cdf818aab2..cdf818aab2 100644 --- a/gr-atsc/include/atsc/CMakeLists.txt +++ b/gr-atsc/include/gnuradio/atsc/CMakeLists.txt diff --git a/gr-atsc/include/atsc/GrAtscBitTimingLoop.h b/gr-atsc/include/gnuradio/atsc/GrAtscBitTimingLoop.h index 1bedbb39ec..e42d37c581 100644 --- a/gr-atsc/include/atsc/GrAtscBitTimingLoop.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscBitTimingLoop.h @@ -23,16 +23,16 @@ #ifndef _GRATSCBITTIMINGLOOP_H_ #define _GRATSCBITTIMINGLOOP_H_ -#include <blocks/nco.h> +#include <gnuradio/blocks/nco.h> #include <VrSigProc.h> #include <VrHistoryProc.h> #include <VrDecimatingSigProc.h> -#include <atsc/interleaver_fifo.h> -#include <filter/single_pole_iir.h> -#include <filter/mmse_fir_interpolator.h> -#include <atsc/slicer_agc_impl.h> +#include <gnuradio/atsc/interleaver_fifo.h> +#include <gnuradio/filter/single_pole_iir.h> +#include <gnuradio/filter/mmse_fir_interpolator.h> +#include <gnuradio/atsc/slicer_agc_impl.h> #include <stdio.h> -#include <atsc/diag_output_impl.h> +#include <gnuradio/atsc/diag_output_impl.h> /*! diff --git a/gr-atsc/include/atsc/GrAtscBitTimingLoop2.h b/gr-atsc/include/gnuradio/atsc/GrAtscBitTimingLoop2.h index 64d25da01e..7acdbb6140 100644 --- a/gr-atsc/include/atsc/GrAtscBitTimingLoop2.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscBitTimingLoop2.h @@ -23,13 +23,13 @@ #ifndef _GRATSCBITTIMINGLOOP2_H_ #define _GRATSCBITTIMINGLOOP2_H_ -#include <blocks/nco.h> +#include <gnuradio/blocks/nco.h> #include <VrSigProc.h> #include <VrHistoryProc.h> #include <VrDecimatingSigProc.h> -#include <atsc/interleaver_fifo.h> +#include <gnuradio/atsc/interleaver_fifo.h> #include <filtersingle_pole_iir.h> -#include <filter/mmse_fir_interpolator.h> +#include <gnuradio/filter/mmse_fir_interpolator.h> /*! * \brief ATSC BitTimingLoop diff --git a/gr-atsc/include/atsc/GrAtscBitTimingLoop3.h b/gr-atsc/include/gnuradio/atsc/GrAtscBitTimingLoop3.h index c0fb333ace..cc90e667b6 100644 --- a/gr-atsc/include/atsc/GrAtscBitTimingLoop3.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscBitTimingLoop3.h @@ -25,9 +25,9 @@ #include <cstdio> #include <VrDecimatingSigProc.h> -#include <atsc/diag_output_impl.h> -#include <atsc/sssr_impl.h> -#include <atsc/syminfo_impl.h> +#include <gnuradio/atsc/diag_output_impl.h> +#include <gnuradio/atsc/sssr_impl.h> +#include <gnuradio/atsc/syminfo_impl.h> /*! * \brief ATSC BitTimingLoop3 diff --git a/gr-atsc/include/atsc/GrAtscConvert2xTo20.h b/gr-atsc/include/gnuradio/atsc/GrAtscConvert2xTo20.h index 47ea4fb593..5920832bba 100644 --- a/gr-atsc/include/atsc/GrAtscConvert2xTo20.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscConvert2xTo20.h @@ -23,7 +23,7 @@ #define _GRATSCCONVERT2XTO20_H_ #include <VrDecimatingSigProc.h> -#include <filter/mmse_fir_interpolator.h> +#include <gnuradio/filter/mmse_fir_interpolator.h> class GrAtscConvert2xTo20 : public VrDecimatingSigProc<float,float> { gr_mmse_fir_interpolator d_interp; diff --git a/gr-atsc/include/atsc/GrAtscDataSegToSoftDataSeg.h b/gr-atsc/include/gnuradio/atsc/GrAtscDataSegToSoftDataSeg.h index 5fcb894321..c0f5cf8c33 100644 --- a/gr-atsc/include/atsc/GrAtscDataSegToSoftDataSeg.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscDataSegToSoftDataSeg.h @@ -24,7 +24,7 @@ #define _GRATSCDATASEGTOSOFTDATASEG_H_ #include <VrHistoryProc.h> -#include <atsc/types.h> +#include <gnuradio/atsc/types.h> /*! * \brief Debug glue routine (atsc_data_segment --> atsc_soft_data_segment) diff --git a/gr-atsc/include/atsc/GrAtscDeinterleaver.h b/gr-atsc/include/gnuradio/atsc/GrAtscDeinterleaver.h index 8b602fa2dc..5cb59c057d 100644 --- a/gr-atsc/include/atsc/GrAtscDeinterleaver.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscDeinterleaver.h @@ -24,8 +24,8 @@ #define _GRATSCDEINTERLEAVER_H_ #include <VrHistoryProc.h> -#include <atsc/types.h> -#include <atsc/data_interleaver_impl.h> +#include <gnuradio/atsc/types.h> +#include <gnuradio/atsc/data_interleaver_impl.h> /*! * \brief Deinterleave RS encoded ATSC data ( atsc_mpeg_packet_rs_encoded --> atsc_mpeg_packet_rs_encoded) diff --git a/gr-atsc/include/atsc/GrAtscDerandomizer.h b/gr-atsc/include/gnuradio/atsc/GrAtscDerandomizer.h index 0075ae2998..2fb6ce3308 100644 --- a/gr-atsc/include/atsc/GrAtscDerandomizer.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscDerandomizer.h @@ -24,8 +24,8 @@ #define _GRATSCDERANDOMIZER_H_ #include <VrHistoryProc.h> -#include <atsc/types.h> -#include <atsc/randomizer_impl.h> +#include <gnuradio/atsc/types.h> +#include <gnuradio/atsc/randomizer_impl.h> /*! * \brief Derandomize ATSC data (atsc_mpeg_packet_no_sync --> atsc_mpeg_packet) diff --git a/gr-atsc/include/atsc/GrAtscEqualizer.h b/gr-atsc/include/gnuradio/atsc/GrAtscEqualizer.h index ff944deb7d..ff944deb7d 100644 --- a/gr-atsc/include/atsc/GrAtscEqualizer.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscEqualizer.h diff --git a/gr-atsc/include/atsc/GrAtscFPLL.h b/gr-atsc/include/gnuradio/atsc/GrAtscFPLL.h index c1e3302a17..39d053299b 100644 --- a/gr-atsc/include/atsc/GrAtscFPLL.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscFPLL.h @@ -24,13 +24,13 @@ #ifndef _GRATSCFPLL_H_ #define _GRATSCFPLL_H_ -#include <blocks/nco.h> -#include <filter/iir.h> -#include <filter/single_pole_iir.h> -#include <analog/agc.h> +#include <gnuradio/blocks/nco.h> +#include <gnuradio/filter/iir.h> +#include <gnuradio/filter/single_pole_iir.h> +#include <gnuradio/analog/agc.h> #include <VrSigProc.h> #include <stdio.h> -#include <atsc/diag_output_impl.h> +#include <gnuradio/atsc/diag_output_impl.h> /*! * \brief ATSC FPLL (2nd Version) diff --git a/gr-atsc/include/atsc/GrAtscFieldSyncChecker.h b/gr-atsc/include/gnuradio/atsc/GrAtscFieldSyncChecker.h index 28458a19b5..28458a19b5 100644 --- a/gr-atsc/include/atsc/GrAtscFieldSyncChecker.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscFieldSyncChecker.h diff --git a/gr-atsc/include/atsc/GrAtscFieldSyncCorrelator.h b/gr-atsc/include/gnuradio/atsc/GrAtscFieldSyncCorrelator.h index 1a16048b22..1a16048b22 100644 --- a/gr-atsc/include/atsc/GrAtscFieldSyncCorrelator.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscFieldSyncCorrelator.h diff --git a/gr-atsc/include/atsc/GrAtscFieldSyncDemux.h b/gr-atsc/include/gnuradio/atsc/GrAtscFieldSyncDemux.h index 248c257914..ed7eb16215 100644 --- a/gr-atsc/include/atsc/GrAtscFieldSyncDemux.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscFieldSyncDemux.h @@ -24,7 +24,7 @@ #define _GRATSCFIELDSYNCDEMUX_H_ #include <VrDecimatingSigProc.h> -#include <atsc/types.h> +#include <gnuradio/atsc/types.h> /*! * \brief ATSC Field Sync Demux diff --git a/gr-atsc/include/atsc/GrAtscFieldSyncMux.h b/gr-atsc/include/gnuradio/atsc/GrAtscFieldSyncMux.h index 3045f32846..7998d9a8e1 100644 --- a/gr-atsc/include/atsc/GrAtscFieldSyncMux.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscFieldSyncMux.h @@ -24,7 +24,7 @@ #define _GRATSCFIELDSYNCMUX_H_ #include <VrHistoryProc.h> -#include <atsc/types.h> +#include <gnuradio/atsc/types.h> /*! * \brief Insert ATSC Field Syncs as required (atsc_data_segment --> atsc_data_segment) diff --git a/gr-atsc/include/atsc/GrAtscInterleaver.h b/gr-atsc/include/gnuradio/atsc/GrAtscInterleaver.h index 5b6ad4849c..158c6a6a17 100644 --- a/gr-atsc/include/atsc/GrAtscInterleaver.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscInterleaver.h @@ -24,8 +24,8 @@ #define _GRATSCINTERLEAVER_H_ #include <VrHistoryProc.h> -#include <atsc/types.h> -#include <atsc/data_interleaver_impl.h> +#include <gnuradio/atsc/types.h> +#include <gnuradio/atsc/data_interleaver_impl.h> /*! * \brief Interleave RS encoded ATSC data ( atsc_mpeg_packet_rs_encoded --> atsc_mpeg_packet_rs_encoded) diff --git a/gr-atsc/include/atsc/GrAtscRSDecoder.h b/gr-atsc/include/gnuradio/atsc/GrAtscRSDecoder.h index 9321b66a5b..160adc5413 100644 --- a/gr-atsc/include/atsc/GrAtscRSDecoder.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscRSDecoder.h @@ -24,8 +24,8 @@ #define _GRATSCRSDECODER_H_ #include <VrHistoryProc.h> -#include <atsc/types.h> -#include <atsc/reed_solomon_impl.h> +#include <gnuradio/atsc/types.h> +#include <gnuradio/atsc/reed_solomon_impl.h> /*! * \brief Pass ATSC data Reed-Solomon decoder( atsc_mpeg_packet_rs_encoded --> atsc_mpeg_rs_no_sync) diff --git a/gr-atsc/include/atsc/GrAtscRSEncoder.h b/gr-atsc/include/gnuradio/atsc/GrAtscRSEncoder.h index e18b6bd63f..b59e28dcb5 100644 --- a/gr-atsc/include/atsc/GrAtscRSEncoder.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscRSEncoder.h @@ -24,8 +24,8 @@ #define _GRATSCRSENCODER_H_ #include <VrHistoryProc.h> -#include <atsc/types.h> -#include <atsc/reed_solomon_impl.h> +#include <gnuradio/atsc/types.h> +#include <gnuradio/atsc/reed_solomon_impl.h> /*! * \brief Encode using Reed Solomon ATSC data (atsc_mpeg_packet_no_sync --> atsc_mpeg_packet_rs_encoded) diff --git a/gr-atsc/include/atsc/GrAtscRandomizer.h b/gr-atsc/include/gnuradio/atsc/GrAtscRandomizer.h index 565ea7b8eb..44be87349f 100644 --- a/gr-atsc/include/atsc/GrAtscRandomizer.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscRandomizer.h @@ -24,8 +24,8 @@ #define _GRATSCRANDOMIZER_H_ #include <VrHistoryProc.h> -#include <atsc/types.h> -#include <atsc/randomizer_impl.h> +#include <gnuradio/atsc/types.h> +#include <gnuradio/atsc/randomizer_impl.h> /*! * \brief Randomize ATSC data (atsc_mpeg_packet --> atsc_mpeg_packet_no_sync) diff --git a/gr-atsc/include/atsc/GrAtscSegSymSync.h b/gr-atsc/include/gnuradio/atsc/GrAtscSegSymSync.h index 750483f544..750483f544 100644 --- a/gr-atsc/include/atsc/GrAtscSegSymSync.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscSegSymSync.h diff --git a/gr-atsc/include/atsc/GrAtscSegSymSyncImpl.h b/gr-atsc/include/gnuradio/atsc/GrAtscSegSymSyncImpl.h index 779f311f4f..e7b3a83018 100644 --- a/gr-atsc/include/atsc/GrAtscSegSymSyncImpl.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscSegSymSyncImpl.h @@ -23,7 +23,7 @@ #define _GRATSCSEGSYMSYNCIMPL_H_ #include <GrAtscSegSymSync.h> -#include <atsc/sssr_impl.h> +#include <gnuradio/atsc/sssr_impl.h> /*! diff --git a/gr-atsc/include/atsc/GrAtscSegSymSyncImpl_export.h b/gr-atsc/include/gnuradio/atsc/GrAtscSegSymSyncImpl_export.h index 187f1a0395..187f1a0395 100644 --- a/gr-atsc/include/atsc/GrAtscSegSymSyncImpl_export.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscSegSymSyncImpl_export.h diff --git a/gr-atsc/include/atsc/GrAtscSymbolMapper.h b/gr-atsc/include/gnuradio/atsc/GrAtscSymbolMapper.h index c4e4083aa3..a67b860a45 100644 --- a/gr-atsc/include/atsc/GrAtscSymbolMapper.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscSymbolMapper.h @@ -25,8 +25,8 @@ #include <VrInterpolatingSigProcNoWork.h> -#include <atsc/types.h> -#include <blocks/nco.h> +#include <gnuradio/atsc/types.h> +#include <gnuradio/blocks/nco.h> /*! * \brief take atsc_data_segments and map them to symbols. diff --git a/gr-atsc/include/atsc/GrAtscTrellisEncoder.h b/gr-atsc/include/gnuradio/atsc/GrAtscTrellisEncoder.h index b1a047ce24..5e8115e677 100644 --- a/gr-atsc/include/atsc/GrAtscTrellisEncoder.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscTrellisEncoder.h @@ -23,7 +23,7 @@ #ifndef _GRATSCTRELLISENCODER_H_ #include <VrHistoryProc.h> -#include <atsc/trellis_encoder_impl.h> +#include <gnuradio/atsc/trellis_encoder_impl.h> /*! * \brief ATSC 12-way interleaved trellis encoder (atsc_mpeg_packet_rs_encoded --> atsc_data_segment) diff --git a/gr-atsc/include/atsc/GrAtscViterbiDecoder.h b/gr-atsc/include/gnuradio/atsc/GrAtscViterbiDecoder.h index 35b1ea0dc7..e33aba04ce 100644 --- a/gr-atsc/include/atsc/GrAtscViterbiDecoder.h +++ b/gr-atsc/include/gnuradio/atsc/GrAtscViterbiDecoder.h @@ -23,7 +23,7 @@ #ifndef _GRATSCVITERBIDECODER_H_ #include <VrHistoryProc.h> -#include <atsc/viterbi_decoder_impl.h> +#include <gnuradio/atsc/viterbi_decoder_impl.h> /*! * \brief ATSC 12-way interleaved viterbi decoder (atsc_soft_data_segment --> atsc_mpeg_packet_rs_encoded) diff --git a/gr-atsc/include/atsc/api.h b/gr-atsc/include/gnuradio/atsc/api.h index 9516892e02..1c1f257059 100644 --- a/gr-atsc/include/atsc/api.h +++ b/gr-atsc/include/gnuradio/atsc/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_ATSC_API_H #define INCLUDED_ATSC_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_atsc_EXPORTS # define ATSC_API __GR_ATTR_EXPORT diff --git a/gr-atsc/include/atsc/basic_trellis_encoder_impl.h b/gr-atsc/include/gnuradio/atsc/basic_trellis_encoder_impl.h index 396ca94957..665a0f9ebf 100644 --- a/gr-atsc/include/atsc/basic_trellis_encoder_impl.h +++ b/gr-atsc/include/gnuradio/atsc/basic_trellis_encoder_impl.h @@ -23,7 +23,7 @@ #ifndef _ATSC_BASIC_TRELLIS_ENCODER_H_ #define _ATSC_BASIC_TRELLIS_ENCODER_H_ -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> #include <assert.h> /*! diff --git a/gr-atsc/include/atsc/bit_timing_loop.h b/gr-atsc/include/gnuradio/atsc/bit_timing_loop.h index eee2b2f73b..9965ade81d 100644 --- a/gr-atsc/include/atsc/bit_timing_loop.h +++ b/gr-atsc/include/gnuradio/atsc/bit_timing_loop.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_ATSC_BIT_TIMING_LOOP_H #define INCLUDED_ATSC_BIT_TIMING_LOOP_H -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> #include <cstdio> -#include <gr_block.h> -#include <atsc/diag_output_impl.h> -#include <atsc/sssr_impl.h> -#include <atsc/syminfo_impl.h> +#include <gnuradio/block.h> +#include <gnuradio/atsc/diag_output_impl.h> +#include <gnuradio/atsc/sssr_impl.h> +#include <gnuradio/atsc/syminfo_impl.h> class atsc_bit_timing_loop; typedef boost::shared_ptr<atsc_bit_timing_loop> atsc_bit_timing_loop_sptr; @@ -42,7 +42,7 @@ ATSC_API atsc_bit_timing_loop_sptr atsc_make_bit_timing_loop(); * This class accepts a single real input and produces two outputs, * the raw symbol (float) and the tag (atsc_syminfo) */ -class ATSC_API atsc_bit_timing_loop : public gr_block +class ATSC_API atsc_bit_timing_loop : public gr::block { friend ATSC_API atsc_bit_timing_loop_sptr atsc_make_bit_timing_loop(); diff --git a/gr-atsc/include/atsc/consts.h b/gr-atsc/include/gnuradio/atsc/consts.h index bbe2ec69aa..bbe2ec69aa 100644 --- a/gr-atsc/include/atsc/consts.h +++ b/gr-atsc/include/gnuradio/atsc/consts.h diff --git a/gr-atsc/include/atsc/convolutional_interleaver.h b/gr-atsc/include/gnuradio/atsc/convolutional_interleaver.h index 00c843b015..02c0c4dc44 100644 --- a/gr-atsc/include/atsc/convolutional_interleaver.h +++ b/gr-atsc/include/gnuradio/atsc/convolutional_interleaver.h @@ -24,7 +24,7 @@ #define _CONVOLUTIONAL_INTERLEAVER_H_ #include <vector> -#include <atsc/interleaver_fifo.h> +#include <gnuradio/atsc/interleaver_fifo.h> #include <assert.h> /*! diff --git a/gr-atsc/include/atsc/create_atsci_equalizer.h b/gr-atsc/include/gnuradio/atsc/create_atsci_equalizer.h index adc4991703..63773a80bb 100644 --- a/gr-atsc/include/atsc/create_atsci_equalizer.h +++ b/gr-atsc/include/gnuradio/atsc/create_atsci_equalizer.h @@ -23,7 +23,7 @@ #ifndef _CREATE_ATSC_EQUALIZER_H_ #define _CREATE_ATSC_EQUALIZER_H_ -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> class atsci_equalizer; diff --git a/gr-atsc/include/atsc/create_atsci_fs_checker.h b/gr-atsc/include/gnuradio/atsc/create_atsci_fs_checker.h index 5d8e9ea407..73b0c7443f 100644 --- a/gr-atsc/include/atsc/create_atsci_fs_checker.h +++ b/gr-atsc/include/gnuradio/atsc/create_atsci_fs_checker.h @@ -23,7 +23,7 @@ #ifndef _CREATE_ATSC_FS_CHECKER_H_ #define _CREATE_ATSC_FS_CHECKER_H_ -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> class atsci_fs_checker; diff --git a/gr-atsc/include/atsc/create_atsci_fs_correlator.h b/gr-atsc/include/gnuradio/atsc/create_atsci_fs_correlator.h index 0488645ace..dc6d81499f 100644 --- a/gr-atsc/include/atsc/create_atsci_fs_correlator.h +++ b/gr-atsc/include/gnuradio/atsc/create_atsci_fs_correlator.h @@ -23,7 +23,7 @@ #ifndef _CREATE_ATSC_FS_CORRELATOR_H_ #define _CREATE_ATSC_FS_CORRELATOR_H_ -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> class atsci_fs_correlator; diff --git a/gr-atsc/include/atsc/data_interleaver_impl.h b/gr-atsc/include/gnuradio/atsc/data_interleaver_impl.h index a7765bd43f..e44125864b 100644 --- a/gr-atsc/include/atsc/data_interleaver_impl.h +++ b/gr-atsc/include/gnuradio/atsc/data_interleaver_impl.h @@ -23,9 +23,9 @@ #ifndef _ATSC_DATA_INTERLEAVER_H_ #define _ATSC_DATA_INTERLEAVER_H_ -#include <atsc/api.h> -#include <atsc/types.h> -#include <atsc/convolutional_interleaver.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/types.h> +#include <gnuradio/atsc/convolutional_interleaver.h> /*! * \brief atsc convolutional data interleaver diff --git a/gr-atsc/include/atsc/deinterleaver.h b/gr-atsc/include/gnuradio/atsc/deinterleaver.h index 7864526cfd..22b5461aaf 100644 --- a/gr-atsc/include/atsc/deinterleaver.h +++ b/gr-atsc/include/gnuradio/atsc/deinterleaver.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ATSC_DEINTERLEAVER_H #define INCLUDED_ATSC_DEINTERLEAVER_H -#include <atsc/api.h> -#include <gr_sync_block.h> -#include <atsc/data_interleaver_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/atsc/data_interleaver_impl.h> class atsc_deinterleaver; typedef boost::shared_ptr<atsc_deinterleaver> atsc_deinterleaver_sptr; @@ -38,7 +38,7 @@ ATSC_API atsc_deinterleaver_sptr atsc_make_deinterleaver(); * * input: atsc_mpeg_packet_rs_encoded; output: atsc_mpeg_packet_rs_encoded */ -class ATSC_API atsc_deinterleaver : public gr_sync_block +class ATSC_API atsc_deinterleaver : public gr::sync_block { friend ATSC_API atsc_deinterleaver_sptr atsc_make_deinterleaver(); diff --git a/gr-atsc/include/atsc/depad.h b/gr-atsc/include/gnuradio/atsc/depad.h index ffced87a39..3a638c46fe 100644 --- a/gr-atsc/include/atsc/depad.h +++ b/gr-atsc/include/gnuradio/atsc/depad.h @@ -22,8 +22,8 @@ #ifndef INCLUDED_ATSC_DEPAD_H #define INCLUDED_ATSC_DEPAD_H -#include <atsc/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_interpolator.h> class atsc_depad; typedef boost::shared_ptr<atsc_depad> atsc_depad_sptr; @@ -36,7 +36,7 @@ ATSC_API atsc_depad_sptr atsc_make_depad(); * * input: atsc_mpeg_packet; output: unsigned char */ -class ATSC_API atsc_depad : public gr_sync_interpolator +class ATSC_API atsc_depad : public gr::sync_interpolator { friend ATSC_API atsc_depad_sptr atsc_make_depad(); diff --git a/gr-atsc/include/atsc/derandomizer.h b/gr-atsc/include/gnuradio/atsc/derandomizer.h index 4def872aa6..86eaca427c 100644 --- a/gr-atsc/include/atsc/derandomizer.h +++ b/gr-atsc/include/gnuradio/atsc/derandomizer.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_ATSC_DERANDOMIZER_H #define INCLUDED_ATSC_DERANDOMIZER_H -#include <atsc/api.h> -#include <gr_sync_block.h> -#include <atsc/randomizer_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/atsc/randomizer_impl.h> class atsc_derandomizer; typedef boost::shared_ptr<atsc_derandomizer> atsc_derandomizer_sptr; @@ -37,7 +37,7 @@ ATSC_API atsc_derandomizer_sptr atsc_make_derandomizer(); * * input: atsc_mpeg_packet_no_sync; output: atsc_mpeg_packet; */ -class ATSC_API atsc_derandomizer : public gr_sync_block +class ATSC_API atsc_derandomizer : public gr::sync_block { friend ATSC_API atsc_derandomizer_sptr atsc_make_derandomizer(); diff --git a/gr-atsc/include/atsc/diag_output_impl.h b/gr-atsc/include/gnuradio/atsc/diag_output_impl.h index 09fd763d6a..09fd763d6a 100644 --- a/gr-atsc/include/atsc/diag_output_impl.h +++ b/gr-atsc/include/gnuradio/atsc/diag_output_impl.h diff --git a/gr-atsc/include/atsc/ds_to_softds.h b/gr-atsc/include/gnuradio/atsc/ds_to_softds.h index 6356506663..197aafb7ad 100644 --- a/gr-atsc/include/atsc/ds_to_softds.h +++ b/gr-atsc/include/gnuradio/atsc/ds_to_softds.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ATSC_DS_TO_SOFTDS_H #define INCLUDED_ATSC_DS_TO_SOFTDS_H -#include <atsc/api.h> -#include <gr_sync_block.h> -#include <atsc/types.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/atsc/types.h> class atsc_ds_to_softds; typedef boost::shared_ptr<atsc_ds_to_softds> atsc_ds_to_softds_sptr; @@ -38,7 +38,7 @@ ATSC_API atsc_ds_to_softds_sptr atsc_make_ds_to_softds(); * * input: atsc_data_segment; output: atsc_soft_data_segment */ -class ATSC_API atsc_ds_to_softds : public gr_sync_block +class ATSC_API atsc_ds_to_softds : public gr::sync_block { friend ATSC_API atsc_ds_to_softds_sptr atsc_make_ds_to_softds(); diff --git a/gr-atsc/include/atsc/equalizer.h b/gr-atsc/include/gnuradio/atsc/equalizer.h index a910ab7562..4e9103fb12 100644 --- a/gr-atsc/include/atsc/equalizer.h +++ b/gr-atsc/include/gnuradio/atsc/equalizer.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ATSC_EQUALIZER_H #define INCLUDED_ATSC_EQUALIZER_H -#include <atsc/api.h> -#include <gr_sync_block.h> -#include <atsc/equalizer_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/atsc/equalizer_impl.h> #include <vector> class atsc_equalizer; @@ -40,7 +40,7 @@ atsc_equalizer_sptr ATSC_API atsc_make_equalizer(); * first inputs are data samples, second inputs are tags. * first outputs are equalized data samples, second outputs are tags. */ -class ATSC_API atsc_equalizer : public gr_sync_block +class ATSC_API atsc_equalizer : public gr::sync_block { friend ATSC_API atsc_equalizer_sptr atsc_make_equalizer(); diff --git a/gr-atsc/include/atsc/equalizer_impl.h b/gr-atsc/include/gnuradio/atsc/equalizer_impl.h index e2baf537df..a6d849b00f 100644 --- a/gr-atsc/include/atsc/equalizer_impl.h +++ b/gr-atsc/include/gnuradio/atsc/equalizer_impl.h @@ -23,8 +23,8 @@ #ifndef _ATSC_EQUALIZER_H_ #define _ATSC_EQUALIZER_H_ -#include <atsc/api.h> -#include <atsc/syminfo_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/syminfo_impl.h> #include <vector> /*! diff --git a/gr-atsc/include/atsc/equalizer_lms2_impl.h b/gr-atsc/include/gnuradio/atsc/equalizer_lms2_impl.h index ebd6c13d0f..5f4ab66c96 100644 --- a/gr-atsc/include/atsc/equalizer_lms2_impl.h +++ b/gr-atsc/include/gnuradio/atsc/equalizer_lms2_impl.h @@ -23,8 +23,8 @@ #ifndef _ATSC_EQUALIZER_LMS2_H_ #define _ATSC_EQUALIZER_LMS2_H_ -#include <atsc/api.h> -#include <atsc/equalizer_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/equalizer_impl.h> #include <vector> #include <stdio.h> diff --git a/gr-atsc/include/atsc/equalizer_lms_impl.h b/gr-atsc/include/gnuradio/atsc/equalizer_lms_impl.h index c91349de69..0daa00e67c 100644 --- a/gr-atsc/include/atsc/equalizer_lms_impl.h +++ b/gr-atsc/include/gnuradio/atsc/equalizer_lms_impl.h @@ -23,8 +23,8 @@ #ifndef _ATSC_EQUALIZER_LMS_H_ #define _ATSC_EQUALIZER_LMS_H_ -#include <atsc/api.h> -#include <atsc/equalizer_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/equalizer_impl.h> #include <vector> #include <stdio.h> diff --git a/gr-atsc/include/atsc/equalizer_nop_impl.h b/gr-atsc/include/gnuradio/atsc/equalizer_nop_impl.h index 85549e326b..1c075c5220 100644 --- a/gr-atsc/include/atsc/equalizer_nop_impl.h +++ b/gr-atsc/include/gnuradio/atsc/equalizer_nop_impl.h @@ -23,8 +23,8 @@ #ifndef _ATSC_EQUALIZER_NOP_H_ #define _ATSC_EQUALIZER_NOP_H_ -#include <atsc/api.h> -#include <atsc/equalizer_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/equalizer_impl.h> class ATSC_API atsci_equalizer_nop : public atsci_equalizer { diff --git a/gr-atsc/include/atsc/exp2_lp_impl.h b/gr-atsc/include/gnuradio/atsc/exp2_lp_impl.h index b0fbc46432..2d61fc8667 100644 --- a/gr-atsc/include/atsc/exp2_lp_impl.h +++ b/gr-atsc/include/gnuradio/atsc/exp2_lp_impl.h @@ -23,7 +23,7 @@ #ifndef _ATSC_EXP2_LP_H_ #define _ATSC_EXP2_LP_H_ -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> #include <gr_fir_builder.h> class ATSC_API atsci_exp2_lp : public gr_fir_builder diff --git a/gr-atsc/include/atsc/fake_single_viterbi_impl.h b/gr-atsc/include/gnuradio/atsc/fake_single_viterbi_impl.h index 5895e0ac61..ae671832b4 100644 --- a/gr-atsc/include/atsc/fake_single_viterbi_impl.h +++ b/gr-atsc/include/gnuradio/atsc/fake_single_viterbi_impl.h @@ -23,7 +23,7 @@ #ifndef _ATSCFAKESINGLEVITERBI_H_ #define _ATSCFAKESINGLEVITERBI_H_ -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> /*! * \brief single channel viterbi decoder diff --git a/gr-atsc/include/atsc/field_sync_demux.h b/gr-atsc/include/gnuradio/atsc/field_sync_demux.h index bec3590096..e12a456b51 100644 --- a/gr-atsc/include/atsc/field_sync_demux.h +++ b/gr-atsc/include/gnuradio/atsc/field_sync_demux.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_ATSC_FIELD_SYNC_DEMUX_H #define INCLUDED_ATSC_FIELD_SYNC_DEMUX_H -#include <atsc/api.h> -#include <gr_block.h> -#include <atsc/types.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/block.h> +#include <gnuradio/atsc/types.h> class atsc_field_sync_demux; typedef boost::shared_ptr<atsc_field_sync_demux> atsc_field_sync_demux_sptr; @@ -38,7 +38,7 @@ ATSC_API atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); * \ingroup atsc * */ -class ATSC_API atsc_field_sync_demux : public gr_block +class ATSC_API atsc_field_sync_demux : public gr::block { friend ATSC_API atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); diff --git a/gr-atsc/include/atsc/field_sync_mux.h b/gr-atsc/include/gnuradio/atsc/field_sync_mux.h index 21a2f0fdab..dbf08c5132 100644 --- a/gr-atsc/include/atsc/field_sync_mux.h +++ b/gr-atsc/include/gnuradio/atsc/field_sync_mux.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ATSC_FIELD_SYNC_MUX_H #define INCLUDED_ATSC_FIELD_SYNC_MUX_H -#include <atsc/api.h> -#include <gr_sync_block.h> -#include <atsc/types.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/atsc/types.h> class atsc_field_sync_mux; typedef boost::shared_ptr<atsc_field_sync_mux> atsc_field_sync_mux_sptr; @@ -38,7 +38,7 @@ ATSC_API atsc_field_sync_mux_sptr atsc_make_field_sync_mux(); * * input: atsc_data_segment; output: atsc_data_segment */ -class ATSC_API atsc_field_sync_mux : public gr_sync_block +class ATSC_API atsc_field_sync_mux : public gr::sync_block { friend ATSC_API atsc_field_sync_mux_sptr atsc_make_field_sync_mux(); diff --git a/gr-atsc/include/atsc/fpll.h b/gr-atsc/include/gnuradio/atsc/fpll.h index 2bffc327eb..9c565ed2eb 100644 --- a/gr-atsc/include/atsc/fpll.h +++ b/gr-atsc/include/gnuradio/atsc/fpll.h @@ -23,13 +23,13 @@ #ifndef INCLUDED_ATSC_FPLL_H #define INCLUDED_ATSC_FPLL_H -#include <atsc/api.h> -#include <gr_sync_block.h> -#include <gr_nco.h> -#include <filter/single_pole_iir.h> -#include <analog/agc.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/nco.h> +#include <gnuradio/filter/single_pole_iir.h> +#include <gnuradio/analog/agc.h> #include <stdio.h> -#include <atsc/diag_output_impl.h> +#include <gnuradio/atsc/diag_output_impl.h> using namespace gr; @@ -49,7 +49,7 @@ ATSC_API atsc_fpll_sptr atsc_make_fpll(); * This class accepts a single real input and produces a single real output */ -class ATSC_API atsc_fpll : public gr_sync_block +class ATSC_API atsc_fpll : public gr::sync_block { friend ATSC_API atsc_fpll_sptr atsc_make_fpll(); @@ -70,7 +70,7 @@ public: double initial_freq; double initial_phase; bool debug_no_update; - gr_nco<float,float> nco; + gr::nco<float,float> nco; analog::kernel::agc_ff agc; // automatic gain control filter::single_pole_iir<float,float,float> afci; filter::single_pole_iir<float,float,float> afcq; diff --git a/gr-atsc/include/atsc/fs_checker.h b/gr-atsc/include/gnuradio/atsc/fs_checker.h index 1bd304090f..7a7d73852a 100644 --- a/gr-atsc/include/atsc/fs_checker.h +++ b/gr-atsc/include/gnuradio/atsc/fs_checker.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ATSC_FS_CHECKER_H #define INCLUDED_ATSC_FS_CHECKER_H -#include <atsc/api.h> -#include <atsc/fs_checker_impl.h> -#include <gr_sync_block.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/fs_checker_impl.h> +#include <gnuradio/sync_block.h> class atsc_fs_checker; typedef boost::shared_ptr<atsc_fs_checker> atsc_fs_checker_sptr; @@ -40,7 +40,7 @@ ATSC_API atsc_fs_checker_sptr atsc_make_fs_checker(); * second output is set of tags, one-for-one with first output. */ -class ATSC_API atsc_fs_checker : public gr_sync_block +class ATSC_API atsc_fs_checker : public gr::sync_block { friend ATSC_API atsc_fs_checker_sptr atsc_make_fs_checker(); diff --git a/gr-atsc/include/atsc/fs_checker_impl.h b/gr-atsc/include/gnuradio/atsc/fs_checker_impl.h index a4975d243e..3ac1b8d913 100644 --- a/gr-atsc/include/atsc/fs_checker_impl.h +++ b/gr-atsc/include/gnuradio/atsc/fs_checker_impl.h @@ -22,8 +22,8 @@ #ifndef _ATSC_FS_CHECKER_H_ #define _ATSC_FS_CHECKER_H_ -#include <atsc/api.h> -#include <atsc/syminfo_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/syminfo_impl.h> /*! * \brief abstract base class for ATSC field sync checker diff --git a/gr-atsc/include/atsc/fs_checker_naive_impl.h b/gr-atsc/include/gnuradio/atsc/fs_checker_naive_impl.h index 0056bf69c8..002af5c645 100644 --- a/gr-atsc/include/atsc/fs_checker_naive_impl.h +++ b/gr-atsc/include/gnuradio/atsc/fs_checker_naive_impl.h @@ -23,8 +23,8 @@ #ifndef _ATSC_FS_CHECKER_NAIVE_H_ #define _ATSC_FS_CHECKER_NAIVE_H_ -#include <atsc/api.h> -#include <atsc/fs_checker_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/fs_checker_impl.h> /*! * \brief Naive concrete implementation of field sync checker diff --git a/gr-atsc/include/atsc/fs_correlator_impl.h b/gr-atsc/include/gnuradio/atsc/fs_correlator_impl.h index b55b1b9854..2517877666 100644 --- a/gr-atsc/include/atsc/fs_correlator_impl.h +++ b/gr-atsc/include/gnuradio/atsc/fs_correlator_impl.h @@ -23,7 +23,7 @@ #ifndef _ATSC_FS_CORRELATOR_H_ #define _ATSC_FS_CORRELATOR_H_ -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> /*! * \brief abstract base class for ATSC field sync correlator diff --git a/gr-atsc/include/atsc/fs_correlator_naive_impl.h b/gr-atsc/include/gnuradio/atsc/fs_correlator_naive_impl.h index e2fd19557b..4f8b5a8d76 100644 --- a/gr-atsc/include/atsc/fs_correlator_naive_impl.h +++ b/gr-atsc/include/gnuradio/atsc/fs_correlator_naive_impl.h @@ -23,8 +23,8 @@ #ifndef _ATSC_FS_CORRELATOR_NAIVE_H_ #define _ATSC_FS_CORRELATOR_NAIVE_H_ -#include <atsc/api.h> -#include <atsc/fs_correlator_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/fs_correlator_impl.h> /*! * \brief Naive concrete implementation of field sync correlator diff --git a/gr-atsc/include/atsc/interleaver.h b/gr-atsc/include/gnuradio/atsc/interleaver.h index f426381add..1f245bbbe0 100644 --- a/gr-atsc/include/atsc/interleaver.h +++ b/gr-atsc/include/gnuradio/atsc/interleaver.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ATSC_INTERLEAVER_H #define INCLUDED_ATSC_INTERLEAVER_H -#include <atsc/api.h> -#include <gr_sync_block.h> -#include <atsc/data_interleaver_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/atsc/data_interleaver_impl.h> class atsc_interleaver; typedef boost::shared_ptr<atsc_interleaver> atsc_interleaver_sptr; @@ -37,7 +37,7 @@ ATSC_API atsc_interleaver_sptr atsc_make_interleaver(); * * input: atsc_mpeg_packet_rs_encoded; output: atsc_mpeg_packet_rs_encoded */ -class ATSC_API atsc_interleaver : public gr_sync_block +class ATSC_API atsc_interleaver : public gr::sync_block { friend ATSC_API atsc_interleaver_sptr atsc_make_interleaver(); diff --git a/gr-atsc/include/atsc/interleaver_fifo.h b/gr-atsc/include/gnuradio/atsc/interleaver_fifo.h index 5c29a82563..aee42104e7 100644 --- a/gr-atsc/include/atsc/interleaver_fifo.h +++ b/gr-atsc/include/gnuradio/atsc/interleaver_fifo.h @@ -24,7 +24,7 @@ #define _INTERLEAVER_FIFO_H_ -#include <atsc/interleaver_fifo.h> +#include <gnuradio/atsc/interleaver_fifo.h> #include <string.h> /*! diff --git a/gr-atsc/include/atsc/pad.h b/gr-atsc/include/gnuradio/atsc/pad.h index b48d17f7b7..cbe5b11e5d 100644 --- a/gr-atsc/include/atsc/pad.h +++ b/gr-atsc/include/gnuradio/atsc/pad.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ATSC_PAD_H #define INCLUDED_ATSC_PAD_H -#include <atsc/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_decimator.h> class atsc_pad; typedef boost::shared_ptr<atsc_pad> atsc_pad_sptr; @@ -38,7 +38,7 @@ ATSC_API atsc_pad_sptr atsc_make_pad(); * * input: unsigned char; output: atsc_mpeg_packet */ -class ATSC_API atsc_pad : public gr_sync_decimator +class ATSC_API atsc_pad : public gr::sync_decimator { friend ATSC_API atsc_pad_sptr atsc_make_pad(); diff --git a/gr-atsc/include/atsc/pnXXX_impl.h b/gr-atsc/include/gnuradio/atsc/pnXXX_impl.h index 3de6eb1f51..b33d82cec6 100644 --- a/gr-atsc/include/atsc/pnXXX_impl.h +++ b/gr-atsc/include/gnuradio/atsc/pnXXX_impl.h @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> ATSC_API extern const unsigned char atsc_pn511[]; ATSC_API extern const unsigned char atsc_pn63[]; diff --git a/gr-atsc/include/atsc/randomizer.h b/gr-atsc/include/gnuradio/atsc/randomizer.h index 8825062bbc..dfda95d032 100644 --- a/gr-atsc/include/atsc/randomizer.h +++ b/gr-atsc/include/gnuradio/atsc/randomizer.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ATSC_RANDOMIZER_H #define INCLUDED_ATSC_RANDOMIZER_H -#include <atsc/api.h> -#include <gr_sync_block.h> -#include <atsc/randomizer_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/atsc/randomizer_impl.h> class atsc_randomizer; typedef boost::shared_ptr<atsc_randomizer> atsc_randomizer_sptr; @@ -38,7 +38,7 @@ ATSC_API atsc_randomizer_sptr atsc_make_randomizer(); * * input: atsc_mpeg_packet; output: atsc_mpeg_packet_no_sync */ -class ATSC_API atsc_randomizer : public gr_sync_block +class ATSC_API atsc_randomizer : public gr::sync_block { friend ATSC_API atsc_randomizer_sptr atsc_make_randomizer(); diff --git a/gr-atsc/include/atsc/randomizer_impl.h b/gr-atsc/include/gnuradio/atsc/randomizer_impl.h index 4fdbebc06d..d798629de2 100644 --- a/gr-atsc/include/atsc/randomizer_impl.h +++ b/gr-atsc/include/gnuradio/atsc/randomizer_impl.h @@ -23,8 +23,8 @@ #ifndef _ATSC_RANDOMIZER_H_ #define _ATSC_RANDOMIZER_H_ -#include <atsc/api.h> -#include <atsc/types.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/types.h> /*! * \brief ATSC data "whitener" diff --git a/gr-atsc/include/atsc/reed_solomon_impl.h b/gr-atsc/include/gnuradio/atsc/reed_solomon_impl.h index 484b6d0ce2..53584b4dbf 100644 --- a/gr-atsc/include/atsc/reed_solomon_impl.h +++ b/gr-atsc/include/gnuradio/atsc/reed_solomon_impl.h @@ -23,8 +23,8 @@ #ifndef _ATSC_REED_SOLOMON_H_ #define _ATSC_REED_SOLOMON_H_ -#include <atsc/api.h> -#include <atsc/types.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/types.h> /*! * \brief ATSC Reed-Solomon encoder / decoder diff --git a/gr-atsc/include/atsc/root_raised_cosine_bandpass_impl.h b/gr-atsc/include/gnuradio/atsc/root_raised_cosine_bandpass_impl.h index 50548bec89..318d888712 100644 --- a/gr-atsc/include/atsc/root_raised_cosine_bandpass_impl.h +++ b/gr-atsc/include/gnuradio/atsc/root_raised_cosine_bandpass_impl.h @@ -23,8 +23,8 @@ #ifndef _ATSC_RRC_BANDPASS_H_ #define _ATSC_RRC_BANDPASS_H_ -#include <atsc/api.h> -#include <atsc/root_raised_cosine_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/root_raised_cosine_impl.h> class ATSC_API atsc_root_raised_cosine_bandpass : public atsc_root_raised_cosine { diff --git a/gr-atsc/include/atsc/root_raised_cosine_impl.h b/gr-atsc/include/gnuradio/atsc/root_raised_cosine_impl.h index ae884bfb19..3489a7a908 100644 --- a/gr-atsc/include/atsc/root_raised_cosine_impl.h +++ b/gr-atsc/include/gnuradio/atsc/root_raised_cosine_impl.h @@ -23,7 +23,7 @@ #ifndef _ATSC_RRC_H_ #define _ATSC_RRC_H_ -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> #include <gr_fir_builder.h> class ATSC_API atsc_root_raised_cosine : public gr_fir_builder diff --git a/gr-atsc/include/atsc/rs_decoder.h b/gr-atsc/include/gnuradio/atsc/rs_decoder.h index 308fb46432..99ab875869 100644 --- a/gr-atsc/include/atsc/rs_decoder.h +++ b/gr-atsc/include/gnuradio/atsc/rs_decoder.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ATSC_RS_DECODER_H #define INCLUDED_ATSC_RS_DECODER_H -#include <atsc/api.h> -#include <gr_sync_block.h> -#include <atsc/reed_solomon_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/atsc/reed_solomon_impl.h> class atsc_rs_decoder; typedef boost::shared_ptr<atsc_rs_decoder> atsc_rs_decoder_sptr; @@ -38,7 +38,7 @@ ATSC_API atsc_rs_decoder_sptr atsc_make_rs_decoder(); * * input: atsc_mpeg_packet_rs_encoded; output: atsc_mpeg_packet_no_sync */ -class ATSC_API atsc_rs_decoder : public gr_sync_block +class ATSC_API atsc_rs_decoder : public gr::sync_block { friend ATSC_API atsc_rs_decoder_sptr atsc_make_rs_decoder(); diff --git a/gr-atsc/include/atsc/rs_encoder.h b/gr-atsc/include/gnuradio/atsc/rs_encoder.h index ace2806da3..49f67d2762 100644 --- a/gr-atsc/include/atsc/rs_encoder.h +++ b/gr-atsc/include/gnuradio/atsc/rs_encoder.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ATSC_RS_ENCODER_H #define INCLUDED_ATSC_RS_ENCODER_H -#include <atsc/api.h> -#include <gr_sync_block.h> -#include <atsc/reed_solomon_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/atsc/reed_solomon_impl.h> class atsc_rs_encoder; typedef boost::shared_ptr<atsc_rs_encoder> atsc_rs_encoder_sptr; @@ -38,7 +38,7 @@ ATSC_API atsc_rs_encoder_sptr atsc_make_rs_encoder(); * * input: atsc_mpeg_packet_no_sync; output: atsc_mpeg_packet_rs_encoded */ -class ATSC_API atsc_rs_encoder : public gr_sync_block +class ATSC_API atsc_rs_encoder : public gr::sync_block { friend ATSC_API atsc_rs_encoder_sptr atsc_make_rs_encoder(); diff --git a/gr-atsc/include/atsc/single_viterbi_impl.h b/gr-atsc/include/gnuradio/atsc/single_viterbi_impl.h index d92ded80e5..d6578ce259 100644 --- a/gr-atsc/include/atsc/single_viterbi_impl.h +++ b/gr-atsc/include/gnuradio/atsc/single_viterbi_impl.h @@ -23,7 +23,7 @@ #ifndef _ATSCSINGLEVITERBI_H_ #define _ATSCSINGLEVITERBI_H_ -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> /*! * \brief single channel viterbi decoder diff --git a/gr-atsc/include/atsc/slicer_agc_impl.h b/gr-atsc/include/gnuradio/atsc/slicer_agc_impl.h index 91694c09db..d55e744fea 100644 --- a/gr-atsc/include/atsc/slicer_agc_impl.h +++ b/gr-atsc/include/gnuradio/atsc/slicer_agc_impl.h @@ -23,9 +23,9 @@ #ifndef _ATSC_SLICER_AGC_H_ #define _ATSC_SLICER_AGC_H_ -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> #include <math.h> -#include <filter/single_pole_iir.h> +#include <gnuradio/filter/single_pole_iir.h> /*! * \brief Automatic Gain Control class for atsc slicer diff --git a/gr-atsc/include/atsc/sliding_correlator_impl.h b/gr-atsc/include/gnuradio/atsc/sliding_correlator_impl.h index 45c0caa241..eca63df609 100644 --- a/gr-atsc/include/atsc/sliding_correlator_impl.h +++ b/gr-atsc/include/gnuradio/atsc/sliding_correlator_impl.h @@ -23,10 +23,10 @@ #ifndef _ATSC_SLIDING_CORRELATOR_H_ #define _ATSC_SLIDING_CORRELATOR_H_ -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> #include <string.h> -#include <atsc/pnXXX_impl.h> +#include <gnuradio/atsc/pnXXX_impl.h> //extern const unsigned char atsc_pn511[511]; //extern const unsigned char atsc_pn63[63]; diff --git a/gr-atsc/include/atsc/sssr_impl.h b/gr-atsc/include/gnuradio/atsc/sssr_impl.h index 60d116577b..f61d0f340f 100644 --- a/gr-atsc/include/atsc/sssr_impl.h +++ b/gr-atsc/include/gnuradio/atsc/sssr_impl.h @@ -27,10 +27,10 @@ #ifndef _ATSC_SSSR_H_ #define _ATSC_SSSR_H_ -#include <atsc/api.h> -#include <atsc/consts.h> -#include <filter/mmse_fir_interpolator_ff.h> -#include <filter/single_pole_iir.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/consts.h> +#include <gnuradio/filter/mmse_fir_interpolator_ff.h> +#include <gnuradio/filter/single_pole_iir.h> #include <cstdio> /* diff --git a/gr-atsc/include/atsc/syminfo_impl.h b/gr-atsc/include/gnuradio/atsc/syminfo_impl.h index 9f25e4902a..9f25e4902a 100644 --- a/gr-atsc/include/atsc/syminfo_impl.h +++ b/gr-atsc/include/gnuradio/atsc/syminfo_impl.h diff --git a/gr-atsc/include/atsc/sync_tag_impl.h b/gr-atsc/include/gnuradio/atsc/sync_tag_impl.h index bdb64c5d3d..bdb64c5d3d 100644 --- a/gr-atsc/include/atsc/sync_tag_impl.h +++ b/gr-atsc/include/gnuradio/atsc/sync_tag_impl.h diff --git a/gr-atsc/include/atsc/trellis_encoder.h b/gr-atsc/include/gnuradio/atsc/trellis_encoder.h index 243dd7c2ce..6eb424650f 100644 --- a/gr-atsc/include/atsc/trellis_encoder.h +++ b/gr-atsc/include/gnuradio/atsc/trellis_encoder.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_ATSC_TRELLIS_ENCODER_H #define INCLUDED_ATSC_TRELLIS_ENCODER_H -#include <atsc/api.h> -#include <gr_sync_block.h> -#include <atsc/trellis_encoder_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/atsc/trellis_encoder_impl.h> class atsc_trellis_encoder; typedef boost::shared_ptr<atsc_trellis_encoder> atsc_trellis_encoder_sptr; @@ -37,7 +37,7 @@ ATSC_API atsc_trellis_encoder_sptr atsc_make_trellis_encoder(); * * input: atsc_mpeg_packet_rs_encoded; output: atsc_data_segment */ -class ATSC_API atsc_trellis_encoder : public gr_sync_block +class ATSC_API atsc_trellis_encoder : public gr::sync_block { friend ATSC_API atsc_trellis_encoder_sptr atsc_make_trellis_encoder(); diff --git a/gr-atsc/include/atsc/trellis_encoder_impl.h b/gr-atsc/include/gnuradio/atsc/trellis_encoder_impl.h index d20885ef36..93aab1b190 100644 --- a/gr-atsc/include/atsc/trellis_encoder_impl.h +++ b/gr-atsc/include/gnuradio/atsc/trellis_encoder_impl.h @@ -23,9 +23,9 @@ #ifndef _ATSC_TRELLIS_ENCODER_H_ #define _ATSC_TRELLIS_ENCODER_H_ -#include <atsc/api.h> -#include <atsc/basic_trellis_encoder_impl.h> -#include <atsc/types.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/basic_trellis_encoder_impl.h> +#include <gnuradio/atsc/types.h> /*! * \brief fancy, schmancy 12-way interleaved trellis encoder for ATSC diff --git a/gr-atsc/include/atsc/types.h b/gr-atsc/include/gnuradio/atsc/types.h index 759ef68ba7..1d93bb0d6a 100644 --- a/gr-atsc/include/atsc/types.h +++ b/gr-atsc/include/gnuradio/atsc/types.h @@ -23,7 +23,7 @@ #ifndef _ATSC_TYPES_H_ #define _ATSC_TYPES_H_ -#include <atsc/consts.h> +#include <gnuradio/atsc/consts.h> #include <cstring> #include <cassert> diff --git a/gr-atsc/include/atsc/viterbi_decoder.h b/gr-atsc/include/gnuradio/atsc/viterbi_decoder.h index e119337553..a529c18d3b 100644 --- a/gr-atsc/include/atsc/viterbi_decoder.h +++ b/gr-atsc/include/gnuradio/atsc/viterbi_decoder.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_ATSC_VITERBI_DECODER_H #define INCLUDED_ATSC_VITERBI_DECODER_H -#include <atsc/api.h> -#include <gr_sync_block.h> -#include <atsc/viterbi_decoder_impl.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/atsc/viterbi_decoder_impl.h> class atsc_viterbi_decoder; typedef boost::shared_ptr<atsc_viterbi_decoder> atsc_viterbi_decoder_sptr; @@ -38,7 +38,7 @@ ATSC_API atsc_viterbi_decoder_sptr atsc_make_viterbi_decoder(); * * input: atsc_soft_data_segment; output: atsc_mpeg_packet_rs_encoded */ -class ATSC_API atsc_viterbi_decoder : public gr_sync_block +class ATSC_API atsc_viterbi_decoder : public gr::sync_block { friend ATSC_API atsc_viterbi_decoder_sptr atsc_make_viterbi_decoder(); diff --git a/gr-atsc/include/atsc/viterbi_decoder_impl.h b/gr-atsc/include/gnuradio/atsc/viterbi_decoder_impl.h index 307b157a9b..447d43911d 100644 --- a/gr-atsc/include/atsc/viterbi_decoder_impl.h +++ b/gr-atsc/include/gnuradio/atsc/viterbi_decoder_impl.h @@ -25,15 +25,15 @@ #define USE_SIMPLE_SLICER 0 -#include <atsc/api.h> -#include <atsc/types.h> -#include <atsc/interleaver_fifo.h> +#include <gnuradio/atsc/api.h> +#include <gnuradio/atsc/types.h> +#include <gnuradio/atsc/interleaver_fifo.h> #if (USE_SIMPLE_SLICER) -#include <atsc/fake_single_viterbi_impl.h> +#include <gnuradio/atsc/fake_single_viterbi_impl.h> typedef atsci_fake_single_viterbi single_viterbi_t; #else -#include <atsc/single_viterbi_impl.h> +#include <gnuradio/atsc/single_viterbi_impl.h> typedef atsci_single_viterbi single_viterbi_t; #endif diff --git a/gr-atsc/include/atsc/vsbtx_lp_impl.h b/gr-atsc/include/gnuradio/atsc/vsbtx_lp_impl.h index d9640ca483..ce6f8bfefb 100644 --- a/gr-atsc/include/atsc/vsbtx_lp_impl.h +++ b/gr-atsc/include/gnuradio/atsc/vsbtx_lp_impl.h @@ -23,7 +23,7 @@ #ifndef _ATSC_VSBTX_LP_H_ #define _ATSC_VSBTX_LP_H_ -#include <atsc/api.h> +#include <gnuradio/atsc/api.h> #include <gr_fir_builder.h> class ATSC_API atsc_vsbtx_lp : public gr_fir_builder diff --git a/gr-atsc/lib/GrAtscBitTimingLoop.cc b/gr-atsc/lib/GrAtscBitTimingLoop.cc index f2e666892b..835dc14a91 100644 --- a/gr-atsc/lib/GrAtscBitTimingLoop.cc +++ b/gr-atsc/lib/GrAtscBitTimingLoop.cc @@ -21,10 +21,10 @@ */ #include <cmath> -#include <atsc/GrAtscBitTimingLoop.h> +#include <gnuradio/atsc/GrAtscBitTimingLoop.h> #include "fpll_btloop_coupling.h" #include <algorithm> -#include <atsc/consts.h> +#include <gnuradio/atsc/consts.h> #include <stdio.h> #include <assert.h> diff --git a/gr-atsc/lib/GrAtscBitTimingLoop2.cc b/gr-atsc/lib/GrAtscBitTimingLoop2.cc index d856123fc3..536ca08720 100644 --- a/gr-atsc/lib/GrAtscBitTimingLoop2.cc +++ b/gr-atsc/lib/GrAtscBitTimingLoop2.cc @@ -20,9 +20,9 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscBitTimingLoop2.h> +#include <gnuradio/atsc/GrAtscBitTimingLoop2.h> #include <algorithm> -#include <atsc/consts.h> +#include <gnuradio/atsc/consts.h> #include <stdio.h> #include <assert.h> diff --git a/gr-atsc/lib/GrAtscBitTimingLoop3.cc b/gr-atsc/lib/GrAtscBitTimingLoop3.cc index 647b34c151..14596900a9 100644 --- a/gr-atsc/lib/GrAtscBitTimingLoop3.cc +++ b/gr-atsc/lib/GrAtscBitTimingLoop3.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscBitTimingLoop3.h> +#include <gnuradio/atsc/GrAtscBitTimingLoop3.h> #include <cmath> #include <cstdio> #include <assert.h> diff --git a/gr-atsc/lib/GrAtscConvert2xTo20.cc b/gr-atsc/lib/GrAtscConvert2xTo20.cc index ac22ee1258..296ae35302 100644 --- a/gr-atsc/lib/GrAtscConvert2xTo20.cc +++ b/gr-atsc/lib/GrAtscConvert2xTo20.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscConvert2xTo20.h> -#include <atsc/consts.h> +#include <gnuradio/atsc/GrAtscConvert2xTo20.h> +#include <gnuradio/atsc/consts.h> #include <cmath> #include <cstdio> diff --git a/gr-atsc/lib/GrAtscDataSegToSoftDataSeg.cc b/gr-atsc/lib/GrAtscDataSegToSoftDataSeg.cc index 2406c0c33d..a17927bf5b 100644 --- a/gr-atsc/lib/GrAtscDataSegToSoftDataSeg.cc +++ b/gr-atsc/lib/GrAtscDataSegToSoftDataSeg.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscDataSegToSoftDataSeg.h> +#include <gnuradio/atsc/GrAtscDataSegToSoftDataSeg.h> // typedefs for fundamental i/o types diff --git a/gr-atsc/lib/GrAtscDeinterleaver.cc b/gr-atsc/lib/GrAtscDeinterleaver.cc index 69fac69aa8..dffa99e809 100644 --- a/gr-atsc/lib/GrAtscDeinterleaver.cc +++ b/gr-atsc/lib/GrAtscDeinterleaver.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscDeinterleaver.h> +#include <gnuradio/atsc/GrAtscDeinterleaver.h> // typedefs for fundamental i/o types diff --git a/gr-atsc/lib/GrAtscDerandomizer.cc b/gr-atsc/lib/GrAtscDerandomizer.cc index ac1701d906..f6c1203bc9 100644 --- a/gr-atsc/lib/GrAtscDerandomizer.cc +++ b/gr-atsc/lib/GrAtscDerandomizer.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscDerandomizer.h> +#include <gnuradio/atsc/GrAtscDerandomizer.h> // typedefs for fundamental i/o types diff --git a/gr-atsc/lib/GrAtscEqualizer.cc b/gr-atsc/lib/GrAtscEqualizer.cc index 3e9f8a0022..71e6723505 100644 --- a/gr-atsc/lib/GrAtscEqualizer.cc +++ b/gr-atsc/lib/GrAtscEqualizer.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscEqualizer.h> -#include <atsc/equalizer_impl.h> +#include <gnuradio/atsc/GrAtscEqualizer.h> +#include <gnuradio/atsc/equalizer_impl.h> // typedefs for fundamental i/o types diff --git a/gr-atsc/lib/GrAtscFPLL.cc b/gr-atsc/lib/GrAtscFPLL.cc index fc796c3c12..e0919e0181 100644 --- a/gr-atsc/lib/GrAtscFPLL.cc +++ b/gr-atsc/lib/GrAtscFPLL.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscFPLL.h> +#include <gnuradio/atsc/GrAtscFPLL.h> #include <algorithm> #include "fpll_btloop_coupling.h" diff --git a/gr-atsc/lib/GrAtscFieldSyncChecker.cc b/gr-atsc/lib/GrAtscFieldSyncChecker.cc index 0aaa98e4f6..620962cbcd 100644 --- a/gr-atsc/lib/GrAtscFieldSyncChecker.cc +++ b/gr-atsc/lib/GrAtscFieldSyncChecker.cc @@ -20,9 +20,9 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscFieldSyncChecker.h> -#include <atsc/create_atsci_fs_checker.h> -#include <atsc/fs_checker_impl.h> +#include <gnuradio/atsc/GrAtscFieldSyncChecker.h> +#include <gnuradio/atsc/create_atsci_fs_checker.h> +#include <gnuradio/atsc/fs_checker_impl.h> // typedefs for fundamental i/o types diff --git a/gr-atsc/lib/GrAtscFieldSyncCorrelator.cc b/gr-atsc/lib/GrAtscFieldSyncCorrelator.cc index 5d42d3b5a9..0abb1799f1 100644 --- a/gr-atsc/lib/GrAtscFieldSyncCorrelator.cc +++ b/gr-atsc/lib/GrAtscFieldSyncCorrelator.cc @@ -20,9 +20,9 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscFieldSyncCorrelator.h> -#include <atsc/create_atsci_fs_correlator.h> -#include <atsc/fs_correlator_impl.h> +#include <gnuradio/atsc/GrAtscFieldSyncCorrelator.h> +#include <gnuradio/atsc/create_atsci_fs_correlator.h> +#include <gnuradio/atsc/fs_correlator_impl.h> // typedefs for fundamental i/o types diff --git a/gr-atsc/lib/GrAtscFieldSyncDemux.cc b/gr-atsc/lib/GrAtscFieldSyncDemux.cc index 171d25d23d..873b56eaf3 100644 --- a/gr-atsc/lib/GrAtscFieldSyncDemux.cc +++ b/gr-atsc/lib/GrAtscFieldSyncDemux.cc @@ -21,10 +21,10 @@ */ #include <cmath> -#include <atsc/GrAtscFieldSyncDemux.h> -#include <atsc/consts.h> -#include <atsc/types.h> -#include <atsc/syminfo_impl.h> +#include <gnuradio/atsc/GrAtscFieldSyncDemux.h> +#include <gnuradio/atsc/consts.h> +#include <gnuradio/atsc/types.h> +#include <gnuradio/atsc/syminfo_impl.h> #include <stdio.h> #include <assert.h> diff --git a/gr-atsc/lib/GrAtscFieldSyncMux.cc b/gr-atsc/lib/GrAtscFieldSyncMux.cc index 50ad55448d..4d514fd852 100644 --- a/gr-atsc/lib/GrAtscFieldSyncMux.cc +++ b/gr-atsc/lib/GrAtscFieldSyncMux.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscFieldSyncMux.h> -#include <atsc/pnXXX_impl.h> +#include <gnuradio/atsc/GrAtscFieldSyncMux.h> +#include <gnuradio/atsc/pnXXX_impl.h> // typedefs for fundamental i/o types diff --git a/gr-atsc/lib/GrAtscInterleaver.cc b/gr-atsc/lib/GrAtscInterleaver.cc index 58113bd5d4..f24dcaad15 100644 --- a/gr-atsc/lib/GrAtscInterleaver.cc +++ b/gr-atsc/lib/GrAtscInterleaver.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscInterleaver.h> +#include <gnuradio/atsc/GrAtscInterleaver.h> // typedefs for fundamental i/o types diff --git a/gr-atsc/lib/GrAtscRSDecoder.cc b/gr-atsc/lib/GrAtscRSDecoder.cc index 211c569efd..f87edef6ae 100644 --- a/gr-atsc/lib/GrAtscRSDecoder.cc +++ b/gr-atsc/lib/GrAtscRSDecoder.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscRSDecoder.h> +#include <gnuradio/atsc/GrAtscRSDecoder.h> // typedefs for fundamental i/o types diff --git a/gr-atsc/lib/GrAtscRSEncoder.cc b/gr-atsc/lib/GrAtscRSEncoder.cc index f7a457351b..deef98f180 100644 --- a/gr-atsc/lib/GrAtscRSEncoder.cc +++ b/gr-atsc/lib/GrAtscRSEncoder.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscRSEncoder.h> +#include <gnuradio/atsc/GrAtscRSEncoder.h> // typedefs for fundamental i/o types diff --git a/gr-atsc/lib/GrAtscRandomizer.cc b/gr-atsc/lib/GrAtscRandomizer.cc index b4123c788f..bdf5e682ae 100644 --- a/gr-atsc/lib/GrAtscRandomizer.cc +++ b/gr-atsc/lib/GrAtscRandomizer.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscRandomizer.h> +#include <gnuradio/atsc/GrAtscRandomizer.h> // typedefs for fundamental i/o types diff --git a/gr-atsc/lib/GrAtscSegSymSync.cc b/gr-atsc/lib/GrAtscSegSymSync.cc index 53d5d3b4bb..001f8a1bba 100644 --- a/gr-atsc/lib/GrAtscSegSymSync.cc +++ b/gr-atsc/lib/GrAtscSegSymSync.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscSegSymSync.h> -#include <atsc/GrAtscSegSymSyncImpl_export.h> +#include <gnuradio/atsc/GrAtscSegSymSync.h> +#include <gnuradio/atsc/GrAtscSegSymSyncImpl_export.h> #include <iostream> #include <assert.h> diff --git a/gr-atsc/lib/GrAtscSegSymSyncImpl.cc b/gr-atsc/lib/GrAtscSegSymSyncImpl.cc index 425ab36d11..bdb15a2b57 100644 --- a/gr-atsc/lib/GrAtscSegSymSyncImpl.cc +++ b/gr-atsc/lib/GrAtscSegSymSyncImpl.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscSegSymSyncImpl.h> -#include <atsc/GrAtscSegSymSyncImpl_export.h> +#include <gnuradio/atsc/GrAtscSegSymSyncImpl.h> +#include <gnuradio/atsc/GrAtscSegSymSyncImpl_export.h> #include <cmath> #include <assert.h> diff --git a/gr-atsc/lib/GrAtscTrellisEncoder.cc b/gr-atsc/lib/GrAtscTrellisEncoder.cc index abe67d2a9e..62f7f75b22 100644 --- a/gr-atsc/lib/GrAtscTrellisEncoder.cc +++ b/gr-atsc/lib/GrAtscTrellisEncoder.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscTrellisEncoder.h> +#include <gnuradio/atsc/GrAtscTrellisEncoder.h> // typedefs for fundamental i/o types diff --git a/gr-atsc/lib/GrAtscViterbiDecoder.cc b/gr-atsc/lib/GrAtscViterbiDecoder.cc index 986fe001dc..272d457846 100644 --- a/gr-atsc/lib/GrAtscViterbiDecoder.cc +++ b/gr-atsc/lib/GrAtscViterbiDecoder.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/GrAtscViterbiDecoder.h> +#include <gnuradio/atsc/GrAtscViterbiDecoder.h> #include <iostream> // typedefs for fundamental i/o types diff --git a/gr-atsc/lib/atsc_bit_timing_loop.cc b/gr-atsc/lib/atsc_bit_timing_loop.cc index 7287eee19f..f75e724834 100644 --- a/gr-atsc/lib/atsc_bit_timing_loop.cc +++ b/gr-atsc/lib/atsc_bit_timing_loop.cc @@ -24,9 +24,9 @@ #include <config.h> #endif -#include <atsc/bit_timing_loop.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> +#include <gnuradio/atsc/bit_timing_loop.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> #include <string.h> // Input rate changed from 20MHz to 19.2 to support usrp at 3 * 6.4MHz @@ -42,12 +42,12 @@ atsc_make_bit_timing_loop() atsc_bit_timing_loop::atsc_bit_timing_loop() - : gr_block("atsc_bit_timing_loop", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature3(2, 3, sizeof(float), sizeof(float), sizeof(float))), - d_interp(ratio_of_rx_clock_to_symbol_freq), d_next_input(0), - d_rx_clock_to_symbol_freq (ratio_of_rx_clock_to_symbol_freq), - d_si(0) + : gr::block("atsc_bit_timing_loop", + gr::io_signature::make(1, 1, sizeof(float)), + gr::io_signature::make3(2, 3, sizeof(float), sizeof(float), sizeof(float))), + d_interp(ratio_of_rx_clock_to_symbol_freq), d_next_input(0), + d_rx_clock_to_symbol_freq (ratio_of_rx_clock_to_symbol_freq), + d_si(0) { reset(); } diff --git a/gr-atsc/lib/atsc_deinterleaver.cc b/gr-atsc/lib/atsc_deinterleaver.cc index bc6d742bf6..47507e58aa 100644 --- a/gr-atsc/lib/atsc_deinterleaver.cc +++ b/gr-atsc/lib/atsc_deinterleaver.cc @@ -24,9 +24,9 @@ #include <config.h> #endif -#include <atsc/deinterleaver.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> +#include <gnuradio/atsc/deinterleaver.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> atsc_deinterleaver_sptr @@ -36,9 +36,9 @@ atsc_make_deinterleaver() } atsc_deinterleaver::atsc_deinterleaver() - : gr_sync_block("atsc_deinterleaver", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded))) + : gr::sync_block("atsc_deinterleaver", + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_rs_encoded)), + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_rs_encoded))) { reset(); } diff --git a/gr-atsc/lib/atsc_depad.cc b/gr-atsc/lib/atsc_depad.cc index 7dd6ba1c68..b4872df2c9 100644 --- a/gr-atsc/lib/atsc_depad.cc +++ b/gr-atsc/lib/atsc_depad.cc @@ -24,9 +24,9 @@ #include <config.h> #endif -#include <atsc/depad.h> -#include <gr_io_signature.h> -#include <atsc/types.h> +#include <gnuradio/atsc/depad.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/types.h> atsc_depad_sptr atsc_make_depad() @@ -35,10 +35,10 @@ atsc_make_depad() } atsc_depad::atsc_depad() - : gr_sync_interpolator("atsc_depad", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet)), - gr_make_io_signature(1, 1, sizeof(unsigned char)), - ATSC_MPEG_PKT_LENGTH) + : gr::sync_interpolator("atsc_depad", + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet)), + gr::io_signature::make(1, 1, sizeof(unsigned char)), + ATSC_MPEG_PKT_LENGTH) { reset(); } diff --git a/gr-atsc/lib/atsc_derandomizer.cc b/gr-atsc/lib/atsc_derandomizer.cc index 79b3612af4..e619aa6865 100644 --- a/gr-atsc/lib/atsc_derandomizer.cc +++ b/gr-atsc/lib/atsc_derandomizer.cc @@ -24,9 +24,9 @@ #include <config.h> #endif -#include <atsc/derandomizer.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> +#include <gnuradio/atsc/derandomizer.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> atsc_derandomizer_sptr @@ -36,9 +36,9 @@ atsc_make_derandomizer() } atsc_derandomizer::atsc_derandomizer() - : gr_sync_block("atsc_derandomizer", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_no_sync)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet))) + : gr::sync_block("atsc_derandomizer", + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_no_sync)), + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet))) { reset(); } diff --git a/gr-atsc/lib/atsc_ds_to_softds.cc b/gr-atsc/lib/atsc_ds_to_softds.cc index 06ea9686c0..d4f79f829e 100644 --- a/gr-atsc/lib/atsc_ds_to_softds.cc +++ b/gr-atsc/lib/atsc_ds_to_softds.cc @@ -24,9 +24,9 @@ #include <config.h> #endif -#include <atsc/ds_to_softds.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> +#include <gnuradio/atsc/ds_to_softds.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> atsc_ds_to_softds_sptr @@ -36,9 +36,9 @@ atsc_make_ds_to_softds() } atsc_ds_to_softds::atsc_ds_to_softds() - : gr_sync_block("atsc_ds_to_softds", - gr_make_io_signature(1, 1, sizeof(atsc_data_segment)), - gr_make_io_signature(1, 1, sizeof(atsc_soft_data_segment))) + : gr::sync_block("atsc_ds_to_softds", + gr::io_signature::make(1, 1, sizeof(atsc_data_segment)), + gr::io_signature::make(1, 1, sizeof(atsc_soft_data_segment))) { reset(); } diff --git a/gr-atsc/lib/atsc_equalizer.cc b/gr-atsc/lib/atsc_equalizer.cc index 6838cc1547..2e00f5f374 100644 --- a/gr-atsc/lib/atsc_equalizer.cc +++ b/gr-atsc/lib/atsc_equalizer.cc @@ -24,11 +24,11 @@ #include <config.h> #endif -#include <atsc/equalizer.h> -#include <atsc/create_atsci_equalizer.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> -#include <atsc/syminfo_impl.h> +#include <gnuradio/atsc/equalizer.h> +#include <gnuradio/atsc/create_atsci_equalizer.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> +#include <gnuradio/atsc/syminfo_impl.h> atsc_equalizer_sptr @@ -39,9 +39,9 @@ atsc_make_equalizer() // had atsc_equalizer(atsci_equalizer *equalizer) atsc_equalizer::atsc_equalizer() - : gr_sync_block("atsc_equalizer", - gr_make_io_signature(2, 2, sizeof(float)), - gr_make_io_signature(2, 2, sizeof(float))) + : gr::sync_block("atsc_equalizer", + gr::io_signature::make(2, 2, sizeof(float)), + gr::io_signature::make(2, 2, sizeof(float))) { d_equalizer = create_atsci_equalizer_lms(); } diff --git a/gr-atsc/lib/atsc_field_sync_demux.cc b/gr-atsc/lib/atsc_field_sync_demux.cc index 7697a02c6a..69830f45ed 100644 --- a/gr-atsc/lib/atsc_field_sync_demux.cc +++ b/gr-atsc/lib/atsc_field_sync_demux.cc @@ -25,11 +25,11 @@ #endif #include <cmath> -#include <atsc/field_sync_demux.h> -#include <gr_io_signature.h> -#include <atsc/types.h> -#include <atsc/consts.h> -#include <atsc/syminfo_impl.h> +#include <gnuradio/atsc/field_sync_demux.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/types.h> +#include <gnuradio/atsc/consts.h> +#include <gnuradio/atsc/syminfo_impl.h> #include <stdio.h> #include <assert.h> #include <iostream> @@ -38,7 +38,7 @@ using std::cerr; using std::endl; -static const int DEC = ATSC_DATA_SEGMENT_LENGTH; // nominal decimation factor +static const int DEC = ATSC_DATA_SEGMENT_LENGTH; // nominal decimation factor atsc_field_sync_demux_sptr @@ -48,12 +48,12 @@ atsc_make_field_sync_demux() } atsc_field_sync_demux::atsc_field_sync_demux() - : gr_block("atsc_field_sync_demux", - gr_make_io_signature(2, 2, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(atsc_soft_data_segment))), - d_locked(false), d_in_field2(true), d_segment_number(0), - d_next_input(0), d_lost_index(0), d_inputs0_index(0), - d_inputs0_size(0), d_consume(0) + : gr::block("atsc_field_sync_demux", + gr::io_signature::make(2, 2, sizeof(float)), + gr::io_signature::make(1, 1, sizeof(atsc_soft_data_segment))), + d_locked(false), d_in_field2(true), d_segment_number(0), + d_next_input(0), d_lost_index(0), d_inputs0_index(0), + d_inputs0_size(0), d_consume(0) { reset(); } diff --git a/gr-atsc/lib/atsc_field_sync_mux.cc b/gr-atsc/lib/atsc_field_sync_mux.cc index 578af9eff1..5520a74877 100644 --- a/gr-atsc/lib/atsc_field_sync_mux.cc +++ b/gr-atsc/lib/atsc_field_sync_mux.cc @@ -24,10 +24,10 @@ #include <config.h> #endif -#include <atsc/field_sync_mux.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> -#include <atsc/pnXXX_impl.h> +#include <gnuradio/atsc/field_sync_mux.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> +#include <gnuradio/atsc/pnXXX_impl.h> atsc_field_sync_mux_sptr @@ -37,9 +37,9 @@ atsc_make_field_sync_mux() } atsc_field_sync_mux::atsc_field_sync_mux() - : gr_sync_block("atsc_field_sync_mux", - gr_make_io_signature(1, 1, sizeof(atsc_data_segment)), - gr_make_io_signature(1, 1, sizeof(atsc_data_segment))) + : gr::sync_block("atsc_field_sync_mux", + gr::io_signature::make(1, 1, sizeof(atsc_data_segment)), + gr::io_signature::make(1, 1, sizeof(atsc_data_segment))) { reset(); } diff --git a/gr-atsc/lib/atsc_fpll.cc b/gr-atsc/lib/atsc_fpll.cc index 999a326bee..9a27674c0a 100644 --- a/gr-atsc/lib/atsc_fpll.cc +++ b/gr-atsc/lib/atsc_fpll.cc @@ -24,12 +24,12 @@ #include <config.h> #endif -#include <atsc/fpll.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> +#include <gnuradio/atsc/fpll.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> #include <algorithm> #include "fpll_btloop_coupling.h" -#include <gr_math.h> +#include <gnuradio/math.h> atsc_fpll_sptr atsc_make_fpll() @@ -51,9 +51,9 @@ static const float FPLL_AGC_RATE = 0.25e-6; atsc_fpll::atsc_fpll() - : gr_sync_block("atsc_fpll", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), + : gr::sync_block("atsc_fpll", + gr::io_signature::make(1, 1, sizeof(float)), + gr::io_signature::make(1, 1, sizeof(float))), initial_phase(0) { initial_freq = 5.75e6 - 3e6 + 0.31e6 + 5e3; // a_initial_freq; @@ -107,7 +107,7 @@ atsc_fpll::work (int noutput_items, // phase detector // float x = atan2 (filtered_Q, filtered_I); - float x = gr_fast_atan2f(filtered_Q, filtered_I); + float x = gr::fast_atan2f(filtered_Q, filtered_I); // avoid slamming filter with big transitions diff --git a/gr-atsc/lib/atsc_fs_checker.cc b/gr-atsc/lib/atsc_fs_checker.cc index 41d16d20be..28e771dfb5 100644 --- a/gr-atsc/lib/atsc_fs_checker.cc +++ b/gr-atsc/lib/atsc_fs_checker.cc @@ -24,12 +24,12 @@ #include <config.h> #endif -#include <atsc/fs_checker.h> -#include <atsc/create_atsci_fs_checker.h> -#include <atsc/fs_checker_impl.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> -#include <atsc/syminfo_impl.h> +#include <gnuradio/atsc/fs_checker.h> +#include <gnuradio/atsc/create_atsci_fs_checker.h> +#include <gnuradio/atsc/fs_checker_impl.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> +#include <gnuradio/atsc/syminfo_impl.h> atsc_fs_checker_sptr @@ -39,9 +39,9 @@ atsc_make_fs_checker() } atsc_fs_checker::atsc_fs_checker() - : gr_sync_block("atsc_fs_checker", - gr_make_io_signature(2, 2, sizeof(float)), - gr_make_io_signature(2, 2, sizeof(float))) + : gr::sync_block("atsc_fs_checker", + gr::io_signature::make(2, 2, sizeof(float)), + gr::io_signature::make(2, 2, sizeof(float))) { d_fsc = create_atsci_fs_checker(); } diff --git a/gr-atsc/lib/atsc_interleaver.cc b/gr-atsc/lib/atsc_interleaver.cc index e7c22316b5..ef8820abaf 100644 --- a/gr-atsc/lib/atsc_interleaver.cc +++ b/gr-atsc/lib/atsc_interleaver.cc @@ -24,9 +24,9 @@ #include <config.h> #endif -#include <atsc/interleaver.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> +#include <gnuradio/atsc/interleaver.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> atsc_interleaver_sptr @@ -36,9 +36,9 @@ atsc_make_interleaver() } atsc_interleaver::atsc_interleaver() - : gr_sync_block("atsc_interleaver", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded))) + : gr::sync_block("atsc_interleaver", + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_rs_encoded)), + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_rs_encoded))) { reset(); } diff --git a/gr-atsc/lib/atsc_pad.cc b/gr-atsc/lib/atsc_pad.cc index 9b181a8b78..776eb4ab05 100644 --- a/gr-atsc/lib/atsc_pad.cc +++ b/gr-atsc/lib/atsc_pad.cc @@ -24,9 +24,9 @@ #include <config.h> #endif -#include <atsc/pad.h> -#include <gr_io_signature.h> -#include <atsc/types.h> +#include <gnuradio/atsc/pad.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/types.h> static const int INTR = ATSC_MPEG_PKT_LENGTH; @@ -37,10 +37,10 @@ atsc_make_pad() } atsc_pad::atsc_pad() - : gr_sync_decimator("atsc_pad", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet)), - INTR) + : gr::sync_decimator("atsc_pad", + gr::io_signature::make(1, 1, sizeof(unsigned char)), + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet)), + INTR) { reset(); } diff --git a/gr-atsc/lib/atsc_randomizer.cc b/gr-atsc/lib/atsc_randomizer.cc index 8f88c51a26..6ee61a9888 100644 --- a/gr-atsc/lib/atsc_randomizer.cc +++ b/gr-atsc/lib/atsc_randomizer.cc @@ -24,9 +24,9 @@ #include <config.h> #endif -#include <atsc/randomizer.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> +#include <gnuradio/atsc/randomizer.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> atsc_randomizer_sptr @@ -36,9 +36,9 @@ atsc_make_randomizer() } atsc_randomizer::atsc_randomizer() - : gr_sync_block("atsc_randomizer", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_no_sync))) + : gr::sync_block("atsc_randomizer", + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet)), + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_no_sync))) { reset(); } diff --git a/gr-atsc/lib/atsc_rs_decoder.cc b/gr-atsc/lib/atsc_rs_decoder.cc index 80ff41c2be..3891b3874d 100644 --- a/gr-atsc/lib/atsc_rs_decoder.cc +++ b/gr-atsc/lib/atsc_rs_decoder.cc @@ -24,9 +24,9 @@ #include <config.h> #endif -#include <atsc/rs_decoder.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> +#include <gnuradio/atsc/rs_decoder.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> atsc_rs_decoder_sptr @@ -36,9 +36,9 @@ atsc_make_rs_decoder() } atsc_rs_decoder::atsc_rs_decoder() - : gr_sync_block("atsc_rs_decoder", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_no_sync))) + : gr::sync_block("atsc_rs_decoder", + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_rs_encoded)), + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_no_sync))) { reset(); } diff --git a/gr-atsc/lib/atsc_rs_encoder.cc b/gr-atsc/lib/atsc_rs_encoder.cc index 9773f94489..b2b8cf7421 100644 --- a/gr-atsc/lib/atsc_rs_encoder.cc +++ b/gr-atsc/lib/atsc_rs_encoder.cc @@ -24,9 +24,9 @@ #include <config.h> #endif -#include <atsc/rs_encoder.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> +#include <gnuradio/atsc/rs_encoder.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> atsc_rs_encoder_sptr @@ -36,9 +36,9 @@ atsc_make_rs_encoder() } atsc_rs_encoder::atsc_rs_encoder() - : gr_sync_block("atsc_rs_encoder", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_no_sync)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded))) + : gr::sync_block("atsc_rs_encoder", + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_no_sync)), + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_rs_encoded))) { reset(); } diff --git a/gr-atsc/lib/atsc_trellis_encoder.cc b/gr-atsc/lib/atsc_trellis_encoder.cc index 615864d971..fe8530d6d2 100644 --- a/gr-atsc/lib/atsc_trellis_encoder.cc +++ b/gr-atsc/lib/atsc_trellis_encoder.cc @@ -24,9 +24,9 @@ #include <config.h> #endif -#include <atsc/trellis_encoder.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> +#include <gnuradio/atsc/trellis_encoder.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> atsc_trellis_encoder_sptr @@ -36,9 +36,9 @@ atsc_make_trellis_encoder() } atsc_trellis_encoder::atsc_trellis_encoder() - : gr_sync_block("atsc_trellis_encoder", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded)), - gr_make_io_signature(1, 1, sizeof(atsc_data_segment))) + : gr::sync_block("atsc_trellis_encoder", + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_rs_encoded)), + gr::io_signature::make(1, 1, sizeof(atsc_data_segment))) { set_output_multiple(atsci_trellis_encoder::NCODERS); reset(); diff --git a/gr-atsc/lib/atsc_viterbi_decoder.cc b/gr-atsc/lib/atsc_viterbi_decoder.cc index ca32c6d998..7f74bffc3b 100644 --- a/gr-atsc/lib/atsc_viterbi_decoder.cc +++ b/gr-atsc/lib/atsc_viterbi_decoder.cc @@ -24,9 +24,9 @@ #include <config.h> #endif -#include <atsc/viterbi_decoder.h> -#include <gr_io_signature.h> -#include <atsc/consts.h> +#include <gnuradio/atsc/viterbi_decoder.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/atsc/consts.h> #include <iostream> using std::cerr; @@ -39,9 +39,9 @@ atsc_make_viterbi_decoder() } atsc_viterbi_decoder::atsc_viterbi_decoder() - : gr_sync_block("atsc_viterbi_decoder", - gr_make_io_signature(1, 1, sizeof(atsc_soft_data_segment)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded))), + : gr::sync_block("atsc_viterbi_decoder", + gr::io_signature::make(1, 1, sizeof(atsc_soft_data_segment)), + gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_rs_encoded))), last_start(-1) { set_output_multiple(atsci_viterbi_decoder::NCODERS); diff --git a/gr-atsc/lib/atsci_basic_trellis_encoder.cc b/gr-atsc/lib/atsci_basic_trellis_encoder.cc index a4fa3d6d83..589958220a 100644 --- a/gr-atsc/lib/atsci_basic_trellis_encoder.cc +++ b/gr-atsc/lib/atsci_basic_trellis_encoder.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/basic_trellis_encoder_impl.h> +#include <gnuradio/atsc/basic_trellis_encoder_impl.h> #include <assert.h> const unsigned char atsci_basic_trellis_encoder::next_state[32] = { diff --git a/gr-atsc/lib/atsci_data_interleaver.cc b/gr-atsc/lib/atsci_data_interleaver.cc index 9aa2541412..ec270071ad 100644 --- a/gr-atsc/lib/atsci_data_interleaver.cc +++ b/gr-atsc/lib/atsci_data_interleaver.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/data_interleaver_impl.h> +#include <gnuradio/atsc/data_interleaver_impl.h> void atsci_data_interleaver::interleave (atsc_mpeg_packet_rs_encoded &out, diff --git a/gr-atsc/lib/atsci_equalizer.cc b/gr-atsc/lib/atsci_equalizer.cc index 6646810a2b..9e58cddfc2 100644 --- a/gr-atsc/lib/atsci_equalizer.cc +++ b/gr-atsc/lib/atsci_equalizer.cc @@ -20,10 +20,10 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/equalizer_impl.h> +#include <gnuradio/atsc/equalizer_impl.h> #include <algorithm> #include <iostream> -#include <atsc/types.h> +#include <gnuradio/atsc/types.h> using std::cerr; using std::endl; diff --git a/gr-atsc/lib/atsci_equalizer_lms.cc b/gr-atsc/lib/atsci_equalizer_lms.cc index b4776faea6..9da93aebf0 100644 --- a/gr-atsc/lib/atsci_equalizer_lms.cc +++ b/gr-atsc/lib/atsci_equalizer_lms.cc @@ -20,10 +20,10 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/equalizer_lms_impl.h> +#include <gnuradio/atsc/equalizer_lms_impl.h> #include <assert.h> #include <algorithm> -#include <atsc/pnXXX_impl.h> +#include <gnuradio/atsc/pnXXX_impl.h> #include <stdio.h> diff --git a/gr-atsc/lib/atsci_equalizer_lms2.cc b/gr-atsc/lib/atsci_equalizer_lms2.cc index 2fad19b748..51097931ca 100644 --- a/gr-atsc/lib/atsci_equalizer_lms2.cc +++ b/gr-atsc/lib/atsci_equalizer_lms2.cc @@ -20,13 +20,13 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/equalizer_lms2_impl.h> +#include <gnuradio/atsc/equalizer_lms2_impl.h> #include <assert.h> #include <algorithm> -#include <atsc/pnXXX_impl.h> +#include <gnuradio/atsc/pnXXX_impl.h> #include <cmath> #include <stdlib.h> -#include <gr_math.h> +#include <gnuradio/math.h> #include <stdio.h> #include <boost/math/special_functions/fpclassify.hpp> diff --git a/gr-atsc/lib/atsci_equalizer_nop.cc b/gr-atsc/lib/atsci_equalizer_nop.cc index 61fed43d27..39cf2ea1f6 100644 --- a/gr-atsc/lib/atsci_equalizer_nop.cc +++ b/gr-atsc/lib/atsci_equalizer_nop.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/equalizer_nop_impl.h> -#include <atsc/sync_tag_impl.h> +#include <gnuradio/atsc/equalizer_nop_impl.h> +#include <gnuradio/atsc/sync_tag_impl.h> #include <assert.h> atsci_equalizer_nop::atsci_equalizer_nop () diff --git a/gr-atsc/lib/atsci_exp2_lp.cc b/gr-atsc/lib/atsci_exp2_lp.cc index 93e15f7023..ae12db02c2 100644 --- a/gr-atsc/lib/atsci_exp2_lp.cc +++ b/gr-atsc/lib/atsci_exp2_lp.cc @@ -21,7 +21,7 @@ */ #include <atsc_consts.h> -#include <atsc/exp2_lp_impl.h> +#include <gnuradio/atsc/exp2_lp_impl.h> #include <stdexcept> #include <cmath> #include <iostream> diff --git a/gr-atsc/lib/atsci_fake_single_viterbi.cc b/gr-atsc/lib/atsci_fake_single_viterbi.cc index e94e7f0734..0e1eb6f3a4 100644 --- a/gr-atsc/lib/atsci_fake_single_viterbi.cc +++ b/gr-atsc/lib/atsci_fake_single_viterbi.cc @@ -21,7 +21,7 @@ */ #include <math.h> -#include <atsc/fake_single_viterbi_impl.h> +#include <gnuradio/atsc/fake_single_viterbi_impl.h> #include <iostream> #include <algorithm> diff --git a/gr-atsc/lib/atsci_fs_checker.cc b/gr-atsc/lib/atsci_fs_checker.cc index e43f88e33d..064edb2f77 100644 --- a/gr-atsc/lib/atsci_fs_checker.cc +++ b/gr-atsc/lib/atsci_fs_checker.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/fs_checker_impl.h> +#include <gnuradio/atsc/fs_checker_impl.h> // empty constructor atsci_fs_checker::atsci_fs_checker () diff --git a/gr-atsc/lib/atsci_fs_checker_naive.cc b/gr-atsc/lib/atsci_fs_checker_naive.cc index 392bf70399..96ec09ad1b 100644 --- a/gr-atsc/lib/atsci_fs_checker_naive.cc +++ b/gr-atsc/lib/atsci_fs_checker_naive.cc @@ -20,9 +20,9 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/fs_checker_naive_impl.h> -#include <atsc/syminfo_impl.h> -#include <atsc/pnXXX_impl.h> +#include <gnuradio/atsc/fs_checker_naive_impl.h> +#include <gnuradio/atsc/syminfo_impl.h> +#include <gnuradio/atsc/pnXXX_impl.h> #include <iostream> #include <cstring> diff --git a/gr-atsc/lib/atsci_fs_correlator.cc b/gr-atsc/lib/atsci_fs_correlator.cc index 1dccfc5e21..bc6db0de32 100644 --- a/gr-atsc/lib/atsci_fs_correlator.cc +++ b/gr-atsc/lib/atsci_fs_correlator.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/fs_correlator_impl.h> +#include <gnuradio/atsc/fs_correlator_impl.h> // empty constructor atsci_fs_correlator::atsci_fs_correlator () diff --git a/gr-atsc/lib/atsci_fs_correlator_naive.cc b/gr-atsc/lib/atsci_fs_correlator_naive.cc index 5bddcfa79c..1458dc8527 100644 --- a/gr-atsc/lib/atsci_fs_correlator_naive.cc +++ b/gr-atsc/lib/atsci_fs_correlator_naive.cc @@ -20,9 +20,9 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/fs_correlator_naive_impl.h> -#include <atsc/sync_tag_impl.h> -#include <atsc/pnXXX_impl.h> +#include <gnuradio/atsc/fs_correlator_naive_impl.h> +#include <gnuradio/atsc/sync_tag_impl.h> +#include <gnuradio/atsc/pnXXX_impl.h> #include <iostream> #include <cstring> diff --git a/gr-atsc/lib/atsci_pnXXX.cc b/gr-atsc/lib/atsci_pnXXX.cc index 93c9b22950..250d487c71 100644 --- a/gr-atsc/lib/atsci_pnXXX.cc +++ b/gr-atsc/lib/atsci_pnXXX.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/pnXXX_impl.h> +#include <gnuradio/atsc/pnXXX_impl.h> const unsigned char atsc_pn511[511] = { 0,0,0,0, 0,0,0,1, 0,1,1,1, 1,1,1,1, 1,1,0,0, 1,0,1,0, 1,0,1,0, 1,1,1,0, diff --git a/gr-atsc/lib/atsci_randomizer.cc b/gr-atsc/lib/atsci_randomizer.cc index 6deadfecf8..e9427c66ea 100644 --- a/gr-atsc/lib/atsci_randomizer.cc +++ b/gr-atsc/lib/atsci_randomizer.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/randomizer_impl.h> +#include <gnuradio/atsc/randomizer_impl.h> #include <assert.h> unsigned char atsci_randomizer::s_output_map[1 << 14]; diff --git a/gr-atsc/lib/atsci_reed_solomon.cc b/gr-atsc/lib/atsci_reed_solomon.cc index 6aff353b4e..49cbed1c78 100644 --- a/gr-atsc/lib/atsci_reed_solomon.cc +++ b/gr-atsc/lib/atsci_reed_solomon.cc @@ -20,12 +20,12 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/reed_solomon_impl.h> +#include <gnuradio/atsc/reed_solomon_impl.h> #include <assert.h> #include <string.h> extern "C" { -#include <fec/rs.h> +#include <gnuradio/fec/rs.h> } static const int rs_init_symsize = 8; diff --git a/gr-atsc/lib/atsci_root_raised_cosine.cc b/gr-atsc/lib/atsci_root_raised_cosine.cc index c5cedbd1fc..2a8cf928b9 100644 --- a/gr-atsc/lib/atsci_root_raised_cosine.cc +++ b/gr-atsc/lib/atsci_root_raised_cosine.cc @@ -20,9 +20,9 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/consts.h> -#include <atsc/root_raised_cosine_impl.h> -#include <filter/firdes.h> +#include <gnuradio/atsc/consts.h> +#include <gnuradio/atsc/root_raised_cosine_impl.h> +#include <gnuradio/filter/firdes.h> vector<float> atsc_root_raised_cosine::taps (double sampling_rate) diff --git a/gr-atsc/lib/atsci_root_raised_cosine_bandpass.cc b/gr-atsc/lib/atsci_root_raised_cosine_bandpass.cc index 5dd7705541..84f9f22cab 100644 --- a/gr-atsc/lib/atsci_root_raised_cosine_bandpass.cc +++ b/gr-atsc/lib/atsci_root_raised_cosine_bandpass.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/root_raised_cosine_bandpass_impl.h> +#include <gnuradio/atsc/root_raised_cosine_bandpass_impl.h> #include <iostream> #include <cmath> diff --git a/gr-atsc/lib/atsci_single_viterbi.cc b/gr-atsc/lib/atsci_single_viterbi.cc index f53f16c8e1..0458f80998 100644 --- a/gr-atsc/lib/atsci_single_viterbi.cc +++ b/gr-atsc/lib/atsci_single_viterbi.cc @@ -21,7 +21,7 @@ */ #include <math.h> -#include <atsc/single_viterbi_impl.h> +#include <gnuradio/atsc/single_viterbi_impl.h> #include <iostream> using std::cerr; diff --git a/gr-atsc/lib/atsci_sliding_correlator.cc b/gr-atsc/lib/atsci_sliding_correlator.cc index b79adfb53b..1e0498931d 100644 --- a/gr-atsc/lib/atsci_sliding_correlator.cc +++ b/gr-atsc/lib/atsci_sliding_correlator.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/sliding_correlator_impl.h> -#include <atsc/pnXXX_impl.h> +#include <gnuradio/atsc/sliding_correlator_impl.h> +#include <gnuradio/atsc/pnXXX_impl.h> // #define TRY_BACKWARDS diff --git a/gr-atsc/lib/atsci_sssr.cc b/gr-atsc/lib/atsci_sssr.cc index 5deeda86ce..0906555738 100644 --- a/gr-atsc/lib/atsci_sssr.cc +++ b/gr-atsc/lib/atsci_sssr.cc @@ -20,13 +20,13 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/sssr_impl.h> +#include <gnuradio/atsc/sssr_impl.h> #include <algorithm> #include <cmath> #include <cstdio> #include <assert.h> -#include <atsc/diag_output_impl.h> -#include <gr_math.h> +#include <gnuradio/atsc/diag_output_impl.h> +#include <gnuradio/math.h> #include <stdio.h> #include <boost/math/special_functions/sign.hpp> #include <iostream> diff --git a/gr-atsc/lib/atsci_trellis_encoder.cc b/gr-atsc/lib/atsci_trellis_encoder.cc index 4e81c87e32..3037f5e0b4 100644 --- a/gr-atsc/lib/atsci_trellis_encoder.cc +++ b/gr-atsc/lib/atsci_trellis_encoder.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/trellis_encoder_impl.h> +#include <gnuradio/atsc/trellis_encoder_impl.h> #include <assert.h> #include <stdio.h> #include <string.h> diff --git a/gr-atsc/lib/atsci_viterbi_decoder.cc b/gr-atsc/lib/atsci_viterbi_decoder.cc index 26f5577de5..2179cb5a5c 100644 --- a/gr-atsc/lib/atsci_viterbi_decoder.cc +++ b/gr-atsc/lib/atsci_viterbi_decoder.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/viterbi_decoder.h> +#include <gnuradio/atsc/viterbi_decoder.h> #include <assert.h> #include <stdio.h> #include <cmath> diff --git a/gr-atsc/lib/atsci_vsbtx_lp.cc b/gr-atsc/lib/atsci_vsbtx_lp.cc index 4b6f82af3d..2de5cd7497 100644 --- a/gr-atsc/lib/atsci_vsbtx_lp.cc +++ b/gr-atsc/lib/atsci_vsbtx_lp.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/consts.h> -#include <atsc/vsbtx_lp_impl.h> +#include <gnuradio/atsc/consts.h> +#include <gnuradio/atsc/vsbtx_lp_impl.h> #include <stdexcept> #include <cmath> #include <iostream> diff --git a/gr-atsc/lib/create_atsci_equalizer.cc b/gr-atsc/lib/create_atsci_equalizer.cc index 17874cdd47..2d3b1b1882 100644 --- a/gr-atsc/lib/create_atsci_equalizer.cc +++ b/gr-atsc/lib/create_atsci_equalizer.cc @@ -20,10 +20,10 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/create_atsci_equalizer.h> -#include <atsc/equalizer_nop_impl.h> -#include <atsc/equalizer_lms_impl.h> -#include <atsc/equalizer_lms2_impl.h> +#include <gnuradio/atsc/create_atsci_equalizer.h> +#include <gnuradio/atsc/equalizer_nop_impl.h> +#include <gnuradio/atsc/equalizer_lms_impl.h> +#include <gnuradio/atsc/equalizer_lms2_impl.h> atsci_equalizer * create_atsci_equalizer_nop () diff --git a/gr-atsc/lib/create_atsci_fs_checker.cc b/gr-atsc/lib/create_atsci_fs_checker.cc index 1eea7bcc01..98a904acb7 100644 --- a/gr-atsc/lib/create_atsci_fs_checker.cc +++ b/gr-atsc/lib/create_atsci_fs_checker.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/create_atsci_fs_checker.h> -#include <atsc/fs_checker_naive_impl.h> +#include <gnuradio/atsc/create_atsci_fs_checker.h> +#include <gnuradio/atsc/fs_checker_naive_impl.h> atsci_fs_checker * create_atsci_fs_checker () diff --git a/gr-atsc/lib/create_atsci_fs_correlator.cc b/gr-atsc/lib/create_atsci_fs_correlator.cc index 021d315de9..1dd10e6812 100644 --- a/gr-atsc/lib/create_atsci_fs_correlator.cc +++ b/gr-atsc/lib/create_atsci_fs_correlator.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/create_atsci_fs_correlator.h> -#include <atsc/fs_correlator_naive_impl.h> +#include <gnuradio/atsc/create_atsci_fs_correlator.h> +#include <gnuradio/atsc/fs_correlator_naive_impl.h> atsci_fs_correlator * create_atsci_fs_correlator () diff --git a/gr-atsc/lib/plinfo.cc b/gr-atsc/lib/plinfo.cc index 8ad28c6001..0a24f7a073 100644 --- a/gr-atsc/lib/plinfo.cc +++ b/gr-atsc/lib/plinfo.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <atsc/types.h> +#include <gnuradio/atsc/types.h> #include <assert.h> void diff --git a/gr-atsc/lib/qa_atsci_basic_trellis_encoder.h b/gr-atsc/lib/qa_atsci_basic_trellis_encoder.h index c1e6e8f8ce..6102d72071 100644 --- a/gr-atsc/lib/qa_atsci_basic_trellis_encoder.h +++ b/gr-atsc/lib/qa_atsci_basic_trellis_encoder.h @@ -25,7 +25,7 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -#include <atsc/basic_trellis_encoder_impl.h> +#include <gnuradio/atsc/basic_trellis_encoder_impl.h> class qa_atsci_basic_trellis_encoder : public CppUnit::TestCase { diff --git a/gr-atsc/lib/qa_atsci_data_interleaver.h b/gr-atsc/lib/qa_atsci_data_interleaver.h index 32c9e79c46..d7b94f8e2b 100644 --- a/gr-atsc/lib/qa_atsci_data_interleaver.h +++ b/gr-atsc/lib/qa_atsci_data_interleaver.h @@ -27,7 +27,7 @@ #include <cppunit/TestCase.h> #include <stdio.h> -#include <atsc/data_interleaver_impl.h> +#include <gnuradio/atsc/data_interleaver_impl.h> class qa_atsci_data_interleaver : public CppUnit::TestCase { public: diff --git a/gr-atsc/lib/qa_atsci_equalizer_nop.cc b/gr-atsc/lib/qa_atsci_equalizer_nop.cc index 927e23fdac..098d745db3 100644 --- a/gr-atsc/lib/qa_atsci_equalizer_nop.cc +++ b/gr-atsc/lib/qa_atsci_equalizer_nop.cc @@ -21,10 +21,10 @@ */ #include "qa_atsci_equalizer_nop.h" -#include <atsc/equalizer_impl.h> -#include <atsc/equalizer_nop_impl.h> -#include <atsc/pnXXX_impl.h> -#include <atsc/types.h> +#include <gnuradio/atsc/equalizer_impl.h> +#include <gnuradio/atsc/equalizer_nop_impl.h> +#include <gnuradio/atsc/pnXXX_impl.h> +#include <gnuradio/atsc/types.h> #include <cppunit/TestAssert.h> #include <assert.h> #include <iostream> diff --git a/gr-atsc/lib/qa_atsci_fake_single_viterbi.cc b/gr-atsc/lib/qa_atsci_fake_single_viterbi.cc index 88e2fdb929..e59bc3880b 100644 --- a/gr-atsc/lib/qa_atsci_fake_single_viterbi.cc +++ b/gr-atsc/lib/qa_atsci_fake_single_viterbi.cc @@ -26,9 +26,9 @@ #include <cppunit/TestAssert.h> #include <stdio.h> -#include <atsc/fake_single_viterbi_impl.h> +#include <gnuradio/atsc/fake_single_viterbi_impl.h> #include "qa_atsci_fake_single_viterbi.h" -#include <random.h> +#include <gnuradio/random.h> #include <string.h> diff --git a/gr-atsc/lib/qa_atsci_fake_single_viterbi.h b/gr-atsc/lib/qa_atsci_fake_single_viterbi.h index 373f4b6c67..42915ac6e8 100644 --- a/gr-atsc/lib/qa_atsci_fake_single_viterbi.h +++ b/gr-atsc/lib/qa_atsci_fake_single_viterbi.h @@ -26,8 +26,8 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -#include <atsc/fake_single_viterbi_impl.h> -#include <atsc/basic_trellis_encoder_impl.h> +#include <gnuradio/atsc/fake_single_viterbi_impl.h> +#include <gnuradio/atsc/basic_trellis_encoder_impl.h> class qa_atsci_fake_single_viterbi : public CppUnit::TestCase { private: diff --git a/gr-atsc/lib/qa_atsci_fs_correlator.cc b/gr-atsc/lib/qa_atsci_fs_correlator.cc index a00731ab4d..c416c22fbb 100644 --- a/gr-atsc/lib/qa_atsci_fs_correlator.cc +++ b/gr-atsc/lib/qa_atsci_fs_correlator.cc @@ -25,16 +25,16 @@ #endif #include "qa_atsci_fs_correlator.h" -#include <atsc/fs_correlator_impl.h> -#include <atsc/create_atsci_fs_correlator.h> -#include <atsc/sync_tag_impl.h> +#include <gnuradio/atsc/fs_correlator_impl.h> +#include <gnuradio/atsc/create_atsci_fs_correlator.h> +#include <gnuradio/atsc/sync_tag_impl.h> #include <stdlib.h> #include <algorithm> -#include <atsc/pnXXX_impl.h> -#include <atsc/types.h> +#include <gnuradio/atsc/pnXXX_impl.h> +#include <gnuradio/atsc/types.h> #include <cppunit/TestAssert.h> #include <assert.h> -#include <random.h> +#include <gnuradio/random.h> static float diff --git a/gr-atsc/lib/qa_atsci_randomizer.h b/gr-atsc/lib/qa_atsci_randomizer.h index 0255d8a4ae..e0e293e85c 100644 --- a/gr-atsc/lib/qa_atsci_randomizer.h +++ b/gr-atsc/lib/qa_atsci_randomizer.h @@ -25,7 +25,7 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -#include <atsc/randomizer_impl.h> +#include <gnuradio/atsc/randomizer_impl.h> class qa_atsci_randomizer : public CppUnit::TestCase { private: diff --git a/gr-atsc/lib/qa_atsci_reed_solomon.cc b/gr-atsc/lib/qa_atsci_reed_solomon.cc index 50acb76a01..f6c21dd8ce 100644 --- a/gr-atsc/lib/qa_atsci_reed_solomon.cc +++ b/gr-atsc/lib/qa_atsci_reed_solomon.cc @@ -27,7 +27,7 @@ #include <cppunit/TestAssert.h> #include <stdlib.h> #include <stdio.h> -#include <atsc/reed_solomon_impl.h> +#include <gnuradio/atsc/reed_solomon_impl.h> #include "qa_atsci_reed_solomon.h" #include <string.h> diff --git a/gr-atsc/lib/qa_atsci_reed_solomon.h b/gr-atsc/lib/qa_atsci_reed_solomon.h index 097d681302..0afcd1398b 100644 --- a/gr-atsc/lib/qa_atsci_reed_solomon.h +++ b/gr-atsc/lib/qa_atsci_reed_solomon.h @@ -26,7 +26,7 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -#include <atsc/reed_solomon_impl.h> +#include <gnuradio/atsc/reed_solomon_impl.h> class qa_atsci_reed_solomon : public CppUnit::TestCase { diff --git a/gr-atsc/lib/qa_atsci_single_viterbi.cc b/gr-atsc/lib/qa_atsci_single_viterbi.cc index be5187dc25..8291041a55 100644 --- a/gr-atsc/lib/qa_atsci_single_viterbi.cc +++ b/gr-atsc/lib/qa_atsci_single_viterbi.cc @@ -27,9 +27,9 @@ #include <cppunit/TestAssert.h> #include <stdlib.h> #include <stdio.h> -#include <atsc/single_viterbi_impl.h> +#include <gnuradio/atsc/single_viterbi_impl.h> #include "qa_atsci_single_viterbi.h" -#include <random.h> +#include <gnuradio/random.h> #include <string.h> diff --git a/gr-atsc/lib/qa_atsci_single_viterbi.h b/gr-atsc/lib/qa_atsci_single_viterbi.h index bfd911ab08..571988c559 100644 --- a/gr-atsc/lib/qa_atsci_single_viterbi.h +++ b/gr-atsc/lib/qa_atsci_single_viterbi.h @@ -26,8 +26,8 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -#include <atsc/single_viterbi_impl.h> -#include <atsc/basic_trellis_encoder_impl.h> +#include <gnuradio/atsc/single_viterbi_impl.h> +#include <gnuradio/atsc/basic_trellis_encoder_impl.h> class qa_atsci_single_viterbi : public CppUnit::TestCase { private: diff --git a/gr-atsc/lib/qa_atsci_sliding_correlator.h b/gr-atsc/lib/qa_atsci_sliding_correlator.h index 34f12cbcbc..ea02449711 100644 --- a/gr-atsc/lib/qa_atsci_sliding_correlator.h +++ b/gr-atsc/lib/qa_atsci_sliding_correlator.h @@ -27,7 +27,7 @@ #include <cppunit/TestCase.h> #include <stdio.h> -#include <atsc/sliding_correlator_impl.h> +#include <gnuradio/atsc/sliding_correlator_impl.h> class qa_atsci_sliding_correlator : public CppUnit::TestCase { diff --git a/gr-atsc/lib/qa_atsci_trellis_encoder.h b/gr-atsc/lib/qa_atsci_trellis_encoder.h index a93c0c3895..16567488c8 100644 --- a/gr-atsc/lib/qa_atsci_trellis_encoder.h +++ b/gr-atsc/lib/qa_atsci_trellis_encoder.h @@ -27,7 +27,7 @@ #include <cppunit/TestCase.h> #include <stdio.h> -#include <atsc/trellis_encoder_impl.h> +#include <gnuradio/atsc/trellis_encoder_impl.h> class qa_atsci_trellis_encoder : public CppUnit::TestCase { diff --git a/gr-atsc/lib/qa_atsci_viterbi_decoder.h b/gr-atsc/lib/qa_atsci_viterbi_decoder.h index 94b5ce21d2..47b2776af8 100644 --- a/gr-atsc/lib/qa_atsci_viterbi_decoder.h +++ b/gr-atsc/lib/qa_atsci_viterbi_decoder.h @@ -27,7 +27,7 @@ #include <cppunit/TestCase.h> #include <stdio.h> -#include <atsc/viterbi_decoder_impl.h> +#include <gnuradio/atsc/viterbi_decoder_impl.h> class qa_atsci_viterbi_decoder : public CppUnit::TestCase { diff --git a/gr-atsc/lib/qa_convolutional_interleaver.h b/gr-atsc/lib/qa_convolutional_interleaver.h index afe795a547..5fc73dd70c 100644 --- a/gr-atsc/lib/qa_convolutional_interleaver.h +++ b/gr-atsc/lib/qa_convolutional_interleaver.h @@ -26,7 +26,7 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -#include <atsc/convolutional_interleaver.h> +#include <gnuradio/atsc/convolutional_interleaver.h> class qa_convolutional_interleaver : public CppUnit::TestCase { private: diff --git a/gr-atsc/lib/qa_interleaver_fifo.h b/gr-atsc/lib/qa_interleaver_fifo.h index d0651b591f..9fea65a748 100644 --- a/gr-atsc/lib/qa_interleaver_fifo.h +++ b/gr-atsc/lib/qa_interleaver_fifo.h @@ -26,7 +26,7 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -#include <atsc/interleaver_fifo.h> +#include <gnuradio/atsc/interleaver_fifo.h> class qa_interleaver_fifo : public CppUnit::TestCase { private: diff --git a/gr-atsc/lib/test_atsci.cc b/gr-atsc/lib/test_atsci.cc index a3703d4d31..acea17a7ab 100644 --- a/gr-atsc/lib/test_atsci.cc +++ b/gr-atsc/lib/test_atsci.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <gr_unittests.h> +#include <gnuradio/unittests.h> #include <cppunit/TextTestRunner.h> #include <cppunit/XmlOutputter.h> #include "qa_atsci.h" diff --git a/gr-atsc/python/qa_atsc.py b/gr-atsc/python/qa_atsc.py index d17a200cf6..dc54051b77 100755 --- a/gr-atsc/python/qa_atsc.py +++ b/gr-atsc/python/qa_atsc.py @@ -136,12 +136,16 @@ class qa_atsc(gr_unittest.TestCase): rand = atsc.randomizer() derand = atsc.derandomizer() dst = vector_sink_ts() - self.tb.connect(src, rand, derand, dst) - self.tb.run () + + self.tb.connect(src, rand) + self.tb.connect(rand, derand) + self.tb.connect(derand, dst) + self.tb.run() + result_data = dst.data () self.assertEqual (expected_result, result_data) - def test_loopback_001(self): + def est_loopback_001(self): """ Loopback randomizer/rs_encoder to rs_decoder/derandomizer """ @@ -159,7 +163,7 @@ class qa_atsc(gr_unittest.TestCase): result_data = dst.data () self.assertEqual (expected_result, result_data) - def test_loopback_002(self): + def est_loopback_002(self): """ Loopback randomizer/rs_encoder/interleaver to deinterleaver/rs_decoder/derandomizer @@ -183,7 +187,7 @@ class qa_atsc(gr_unittest.TestCase): self.assertEqual (expected_result, result_data) - def test_loopback_003(self): + def est_loopback_003(self): """ Loopback randomizer/rs_encoder/interleaver/trellis_encoder via ds_to_softds to diff --git a/gr-atsc/swig/CMakeLists.txt b/gr-atsc/swig/CMakeLists.txt index 9fdd7ec764..2eb7047a11 100644 --- a/gr-atsc/swig/CMakeLists.txt +++ b/gr-atsc/swig/CMakeLists.txt @@ -39,7 +39,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/atsc_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/atsc) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/atsc) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_LIBRARIES gnuradio-atsc gnuradio-fft) diff --git a/gr-atsc/swig/atsc_swig.i b/gr-atsc/swig/atsc_swig.i index 6ca65a6c69..9b77000d5a 100644 --- a/gr-atsc/swig/atsc_swig.i +++ b/gr-atsc/swig/atsc_swig.i @@ -26,26 +26,26 @@ %include "atsc_swig_doc.i" %{ -#include <atsc/randomizer.h> -#include <atsc/derandomizer.h> -#include <atsc/rs_encoder.h> -#include <atsc/rs_decoder.h> -#include <atsc/interleaver.h> -#include <atsc/deinterleaver.h> -#include <atsc/trellis_encoder.h> -#include <atsc/viterbi_decoder.h> -#include <atsc/ds_to_softds.h> -#include <atsc/field_sync_mux.h> -#include <atsc/field_sync_demux.h> -#include <atsc/equalizer.h> -#include <atsc/fs_checker.h> -#include <atsc/bit_timing_loop.h> -#include <atsc/fpll.h> -#include <atsc/depad.h> -#include <atsc/pad.h> +#include <gnuradio/atsc/randomizer.h> +#include <gnuradio/atsc/derandomizer.h> +#include <gnuradio/atsc/rs_encoder.h> +#include <gnuradio/atsc/rs_decoder.h> +#include <gnuradio/atsc/interleaver.h> +#include <gnuradio/atsc/deinterleaver.h> +#include <gnuradio/atsc/trellis_encoder.h> +#include <gnuradio/atsc/viterbi_decoder.h> +#include <gnuradio/atsc/ds_to_softds.h> +#include <gnuradio/atsc/field_sync_mux.h> +#include <gnuradio/atsc/field_sync_demux.h> +#include <gnuradio/atsc/equalizer.h> +#include <gnuradio/atsc/fs_checker.h> +#include <gnuradio/atsc/bit_timing_loop.h> +#include <gnuradio/atsc/fpll.h> +#include <gnuradio/atsc/depad.h> +#include <gnuradio/atsc/pad.h> %} -%include "atsc/consts.h" +%include "gnuradio/atsc/consts.h" %constant int sizeof_atsc_mpeg_packet = sizeof(atsc_mpeg_packet); %constant int sizeof_atsc_mpeg_packet_no_sync = sizeof(atsc_mpeg_packet_no_sync); @@ -65,7 +65,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,randomizer); atsc_randomizer_sptr atsc_make_randomizer(); -class atsc_randomizer : public gr_sync_block +class atsc_randomizer : public gr::sync_block { atsc_randomizer(); @@ -79,7 +79,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,derandomizer); atsc_derandomizer_sptr atsc_make_derandomizer(); -class atsc_derandomizer : public gr_sync_block +class atsc_derandomizer : public gr::sync_block { atsc_derandomizer(); @@ -93,7 +93,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,rs_encoder); atsc_rs_encoder_sptr atsc_make_rs_encoder(); -class atsc_rs_encoder : public gr_sync_block +class atsc_rs_encoder : public gr::sync_block { atsc_rs_encoder(); @@ -107,7 +107,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,rs_decoder); atsc_rs_decoder_sptr atsc_make_rs_decoder(); -class atsc_rs_decoder : public gr_sync_block +class atsc_rs_decoder : public gr::sync_block { atsc_rs_decoder(); @@ -121,7 +121,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,interleaver); atsc_interleaver_sptr atsc_make_interleaver(); -class atsc_interleaver : public gr_sync_block +class atsc_interleaver : public gr::sync_block { atsc_interleaver(); @@ -135,7 +135,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,deinterleaver); atsc_deinterleaver_sptr atsc_make_deinterleaver(); -class atsc_deinterleaver : public gr_sync_block +class atsc_deinterleaver : public gr::sync_block { atsc_deinterleaver(); @@ -149,7 +149,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,trellis_encoder); atsc_trellis_encoder_sptr atsc_make_trellis_encoder(); -class atsc_trellis_encoder : public gr_sync_block +class atsc_trellis_encoder : public gr::sync_block { atsc_trellis_encoder(); @@ -163,7 +163,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,viterbi_decoder); atsc_viterbi_decoder_sptr atsc_make_viterbi_decoder(); -class atsc_viterbi_decoder : public gr_sync_block +class atsc_viterbi_decoder : public gr::sync_block { atsc_viterbi_decoder(); @@ -177,7 +177,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,ds_to_softds); atsc_ds_to_softds_sptr atsc_make_ds_to_softds(); -class atsc_ds_to_softds : public gr_sync_block +class atsc_ds_to_softds : public gr::sync_block { atsc_ds_to_softds(); @@ -191,7 +191,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,field_sync_mux); atsc_field_sync_mux_sptr atsc_make_field_sync_mux(); -class atsc_field_sync_mux : public gr_sync_block +class atsc_field_sync_mux : public gr::sync_block { atsc_field_sync_mux(); @@ -205,7 +205,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,field_sync_demux); atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); -class atsc_field_sync_demux : public gr_block +class atsc_field_sync_demux : public gr::block { atsc_field_sync_demux(); @@ -219,7 +219,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,equalizer); atsc_equalizer_sptr atsc_make_equalizer(); -class atsc_equalizer : public gr_sync_block +class atsc_equalizer : public gr::sync_block { atsc_equalizer(); @@ -234,7 +234,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,fs_checker); atsc_fs_checker_sptr atsc_make_fs_checker(); -class atsc_fs_checker : public gr_sync_block +class atsc_fs_checker : public gr::sync_block { atsc_fs_checker(); @@ -248,7 +248,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,bit_timing_loop); atsc_bit_timing_loop_sptr atsc_make_bit_timing_loop(); -class atsc_bit_timing_loop : public gr_block +class atsc_bit_timing_loop : public gr::block { atsc_bit_timing_loop(); @@ -262,13 +262,12 @@ GR_SWIG_BLOCK_MAGIC(atsc,fpll); atsc_fpll_sptr atsc_make_fpll(); -class atsc_fpll : public gr_sync_block +class atsc_fpll : public gr::sync_block { atsc_fpll(); public: void reset(); - }; // ---------------------------------------------------------------- @@ -277,13 +276,12 @@ GR_SWIG_BLOCK_MAGIC(atsc,depad); atsc_depad_sptr atsc_make_depad(); -class atsc_depad : public gr_sync_interpolator +class atsc_depad : public gr::sync_interpolator { atsc_depad(); public: void reset(); - }; // ---------------------------------------------------------------- @@ -292,14 +290,12 @@ GR_SWIG_BLOCK_MAGIC(atsc,pad); atsc_pad_sptr atsc_make_pad(); -class atsc_pad : public gr_sync_decimator +class atsc_pad : public gr::sync_decimator { atsc_pad(); public: void reset(); - }; // ---------------------------------------------------------------- - diff --git a/gr-audio/CMakeLists.txt b/gr-audio/CMakeLists.txt index 6c3a816f7f..88cfc40c50 100644 --- a/gr-audio/CMakeLists.txt +++ b/gr-audio/CMakeLists.txt @@ -86,7 +86,7 @@ CPACK_COMPONENT("audio_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/audio) +add_subdirectory(include/gnuradio/audio) add_subdirectory(lib) add_subdirectory(doc) if(ENABLE_PYTHON) diff --git a/gr-audio/examples/c++/CMakeLists.txt b/gr-audio/examples/c++/CMakeLists.txt index d383008011..a61c089c3e 100644 --- a/gr-audio/examples/c++/CMakeLists.txt +++ b/gr-audio/examples/c++/CMakeLists.txt @@ -25,7 +25,8 @@ include_directories( ) add_executable(dial_tone dial_tone.cc) -target_link_libraries(dial_tone gnuradio-audio gnuradio-analog) +target_link_libraries(dial_tone + gnuradio-runtime gnuradio-audio gnuradio-analog) INSTALL(TARGETS dial_tone diff --git a/gr-audio/examples/c++/dial_tone.cc b/gr-audio/examples/c++/dial_tone.cc index f866edfdee..728d1767a3 100644 --- a/gr-audio/examples/c++/dial_tone.cc +++ b/gr-audio/examples/c++/dial_tone.cc @@ -37,9 +37,9 @@ */ // Include header files for each block used in flowgraph -#include <gr_top_block.h> -#include <analog/sig_source_f.h> -#include <audio/sink.h> +#include <gnuradio/top_block.h> +#include <gnuradio/analog/sig_source_f.h> +#include <gnuradio/audio/sink.h> using namespace gr; @@ -49,9 +49,9 @@ int main(int argc, char **argv) float ampl = 0.1; // Don't exceed 0.5 or clipping will occur // Construct a top block that will contain flowgraph blocks. Alternatively, - // one may create a derived class from gr_top_block and hold instantiated blocks + // one may create a derived class from top_block and hold instantiated blocks // as member data for later manipulation. - gr_top_block_sptr tb = gr_make_top_block("dial_tone"); + top_block_sptr tb = make_top_block("dial_tone"); // Construct a real-valued signal source for each tone, at given sample rate analog::sig_source_f::sptr src0 = analog::sig_source_f::make(rate, analog::GR_SIN_WAVE, 350, ampl); diff --git a/gr-audio/include/audio/CMakeLists.txt b/gr-audio/include/gnuradio/audio/CMakeLists.txt index 1cfbb9bfa2..1cfbb9bfa2 100644 --- a/gr-audio/include/audio/CMakeLists.txt +++ b/gr-audio/include/gnuradio/audio/CMakeLists.txt diff --git a/gr-audio/include/audio/api.h b/gr-audio/include/gnuradio/audio/api.h index 1c113c92ba..224cdfc01a 100644 --- a/gr-audio/include/audio/api.h +++ b/gr-audio/include/gnuradio/audio/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_GR_AUDIO_API_H #define INCLUDED_GR_AUDIO_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_audio_EXPORTS # define GR_AUDIO_API __GR_ATTR_EXPORT diff --git a/gr-audio/include/audio/sink.h b/gr-audio/include/gnuradio/audio/sink.h index d53ff6f6f1..b65b08a371 100644 --- a/gr-audio/include/audio/sink.h +++ b/gr-audio/include/gnuradio/audio/sink.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_AUDIO_SINK_H #define INCLUDED_GR_AUDIO_SINK_H -#include <audio/api.h> -#include <gr_sync_block.h> +#include <gnuradio/audio/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace audio { @@ -33,7 +33,7 @@ namespace gr { * \brief Creates a sink from an audio device. * \ingroup audio_blk */ - class GR_AUDIO_API sink : virtual public gr_sync_block + class GR_AUDIO_API sink : virtual public sync_block { public: typedef boost::shared_ptr<sink> sptr; diff --git a/gr-audio/include/audio/source.h b/gr-audio/include/gnuradio/audio/source.h index f8e21f1567..d790650ec8 100644 --- a/gr-audio/include/audio/source.h +++ b/gr-audio/include/gnuradio/audio/source.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_AUDIO_SOURCE_H #define INCLUDED_GR_AUDIO_SOURCE_H -#include <audio/api.h> -#include <gr_sync_block.h> +#include <gnuradio/audio/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace audio { @@ -33,7 +33,7 @@ namespace gr { * \brief Creates a source from an audio device. * \ingroup audio_blk */ - class GR_AUDIO_API source : virtual public gr_sync_block + class GR_AUDIO_API source : virtual public sync_block { public: typedef boost::shared_ptr<source> sptr; diff --git a/gr-audio/lib/alsa/alsa_sink.cc b/gr-audio/lib/alsa/alsa_sink.cc index 4af57105a9..fa77933669 100644 --- a/gr-audio/lib/alsa/alsa_sink.cc +++ b/gr-audio/lib/alsa/alsa_sink.cc @@ -27,8 +27,8 @@ #include "audio_registry.h" #include <alsa_sink.h> #include <alsa_impl.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/prefs.h> #include <stdio.h> #include <iostream> #include <stdexcept> @@ -57,21 +57,21 @@ namespace gr { static std::string default_device_name() { - return gr_prefs::singleton()->get_string("audio_alsa", "default_output_device", "hw:0,0"); + return prefs::singleton()->get_string("audio_alsa", "default_output_device", "hw:0,0"); } static double default_period_time() { return std::max(0.001, - gr_prefs::singleton()->get_double("audio_alsa", "period_time", 0.010)); + prefs::singleton()->get_double("audio_alsa", "period_time", 0.010)); } static int default_nperiods() { return std::max(2L, - gr_prefs::singleton()->get_long("audio_alsa", "nperiods", 4)); + prefs::singleton()->get_long("audio_alsa", "nperiods", 4)); } // ---------------------------------------------------------------- @@ -79,9 +79,9 @@ namespace gr { alsa_sink::alsa_sink(int sampling_rate, const std::string device_name, bool ok_to_block) - : gr_sync_block("audio_alsa_sink", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), + : sync_block("audio_alsa_sink", + io_signature::make(0, 0, 0), + io_signature::make(0, 0, 0)), d_sampling_rate(sampling_rate), d_device_name(device_name.empty() ? default_device_name() : device_name), d_pcm_handle(0), @@ -94,7 +94,7 @@ namespace gr { d_worker(0), d_special_case_mono_to_stereo(false), d_nunderuns(0), d_nsuspends(0), d_ok_to_block(ok_to_block) { - CHATTY_DEBUG = gr_prefs::singleton()->get_bool("audio_alsa", "verbose", false); + CHATTY_DEBUG = prefs::singleton()->get_bool("audio_alsa", "verbose", false); int error; int dir; @@ -131,7 +131,7 @@ namespace gr { min_chan = 1; d_special_case_mono_to_stereo = true; } - set_input_signature(gr_make_io_signature(min_chan, max_chan, + set_input_signature(io_signature::make(min_chan, max_chan, sizeof(float))); // fill in portions of the d_hw_params that we know now... diff --git a/gr-audio/lib/alsa/alsa_sink.h b/gr-audio/lib/alsa/alsa_sink.h index 1dea62f56e..c1e4670341 100644 --- a/gr-audio/lib/alsa/alsa_sink.h +++ b/gr-audio/lib/alsa/alsa_sink.h @@ -27,7 +27,7 @@ #define ALSA_PCM_NEW_HW_PARAMS_API #define ALSA_PCM_NEW_SW_PARAMS_API -#include <audio/sink.h> +#include <gnuradio/audio/sink.h> #include <alsa/asoundlib.h> #include <string> #include <stdexcept> diff --git a/gr-audio/lib/alsa/alsa_source.cc b/gr-audio/lib/alsa/alsa_source.cc index 838da60af3..0f265e75b4 100644 --- a/gr-audio/lib/alsa/alsa_source.cc +++ b/gr-audio/lib/alsa/alsa_source.cc @@ -27,8 +27,8 @@ #include "audio_registry.h" #include <alsa_source.h> #include <alsa_impl.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/prefs.h> #include <stdio.h> #include <iostream> #include <stdexcept> @@ -57,7 +57,7 @@ namespace gr { static std::string default_device_name() { - return gr_prefs::singleton()->get_string("audio_alsa", + return prefs::singleton()->get_string("audio_alsa", "default_input_device", "hw:0,0"); } @@ -66,14 +66,14 @@ namespace gr { default_period_time() { return std::max(0.001, - gr_prefs::singleton()->get_double("audio_alsa", "period_time", 0.010)); + prefs::singleton()->get_double("audio_alsa", "period_time", 0.010)); } static int default_nperiods() { return std::max(2L, - gr_prefs::singleton()->get_long("audio_alsa", "nperiods", 4)); + prefs::singleton()->get_long("audio_alsa", "nperiods", 4)); } // ---------------------------------------------------------------- @@ -81,9 +81,9 @@ namespace gr { alsa_source::alsa_source(int sampling_rate, const std::string device_name, bool ok_to_block) - : gr_sync_block("audio_alsa_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), + : sync_block("audio_alsa_source", + io_signature::make(0, 0, 0), + io_signature::make(0, 0, 0)), d_sampling_rate(sampling_rate), d_device_name(device_name.empty() ? default_device_name() : device_name), d_pcm_handle(0), @@ -97,7 +97,7 @@ namespace gr { d_special_case_stereo_to_mono(false), d_noverruns(0), d_nsuspends(0) { - CHATTY_DEBUG = gr_prefs::singleton()->get_bool("audio_alsa", "verbose", false); + CHATTY_DEBUG = prefs::singleton()->get_bool("audio_alsa", "verbose", false); int error; int dir; @@ -134,7 +134,7 @@ namespace gr { d_special_case_stereo_to_mono = true; } - set_output_signature(gr_make_io_signature(min_chan, max_chan, + set_output_signature(io_signature::make(min_chan, max_chan, sizeof(float))); // fill in portions of the d_hw_params that we know now... diff --git a/gr-audio/lib/alsa/alsa_source.h b/gr-audio/lib/alsa/alsa_source.h index 6314fc1376..88e16932ca 100644 --- a/gr-audio/lib/alsa/alsa_source.h +++ b/gr-audio/lib/alsa/alsa_source.h @@ -27,7 +27,7 @@ #define ALSA_PCM_NEW_HW_PARAMS_API #define ALSA_PCM_NEW_SW_PARAMS_API -#include <audio/source.h> +#include <gnuradio/audio/source.h> #include <alsa/asoundlib.h> #include <string> #include <stdexcept> diff --git a/gr-audio/lib/audio_registry.cc b/gr-audio/lib/audio_registry.cc index 71f9099a63..98848a0f89 100644 --- a/gr-audio/lib/audio_registry.cc +++ b/gr-audio/lib/audio_registry.cc @@ -21,7 +21,7 @@ #include "audio_registry.h" #include <boost/foreach.hpp> -#include <gr_prefs.h> +#include <gnuradio/prefs.h> #include <stdexcept> #include <vector> #include <iostream> @@ -89,7 +89,7 @@ namespace gr { **********************************************************************/ static std::string default_arch_name(void) { - return gr_prefs::singleton()->get_string("audio", "audio_module", "auto"); + return prefs::singleton()->get_string("audio", "audio_module", "auto"); } static void do_arch_warning(const std::string &arch) diff --git a/gr-audio/lib/audio_registry.h b/gr-audio/lib/audio_registry.h index 70612de574..6caf5c4943 100644 --- a/gr-audio/lib/audio_registry.h +++ b/gr-audio/lib/audio_registry.h @@ -22,8 +22,8 @@ #ifndef INCLUDED_GR_AUDIO_REGISTRY_H #define INCLUDED_GR_AUDIO_REGISTRY_H -#include <audio/sink.h> -#include <audio/source.h> +#include <gnuradio/audio/sink.h> +#include <gnuradio/audio/source.h> #include <string> namespace gr { diff --git a/gr-audio/lib/jack/jack_sink.cc b/gr-audio/lib/jack/jack_sink.cc index 9e9d1e34db..c47c37a301 100644 --- a/gr-audio/lib/jack/jack_sink.cc +++ b/gr-audio/lib/jack/jack_sink.cc @@ -27,8 +27,8 @@ #include "audio_registry.h" #include <jack_sink.h> #include <jack_impl.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/prefs.h> #include <stdio.h> #include <iostream> #include <stdexcept> @@ -57,7 +57,7 @@ namespace gr { static std::string default_device_name() { - return gr_prefs::singleton()->get_string + return prefs::singleton()->get_string ("audio_jack", "default_output_device", "gr_sink"); } @@ -98,9 +98,9 @@ namespace gr { jack_sink::jack_sink(int sampling_rate, const std::string device_name, bool ok_to_block) - : gr_sync_block("audio_jack_sink", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), + : sync_block("audio_jack_sink", + io_signature::make(0, 0, 0), + io_signature::make(0, 0, 0)), d_sampling_rate(sampling_rate), d_device_name(device_name.empty() ? default_device_name() : device_name), d_ok_to_block(ok_to_block), @@ -150,7 +150,7 @@ namespace gr { bail("jack_ringbuffer_create failed", 0); assert(sizeof(float)==sizeof(sample_t)); - set_input_signature(gr_make_io_signature(1, 1, sizeof(sample_t))); + set_input_signature(io_signature::make(1, 1, sizeof(sample_t))); jack_nframes_t sample_rate = jack_get_sample_rate(d_jack_client); diff --git a/gr-audio/lib/jack/jack_sink.h b/gr-audio/lib/jack/jack_sink.h index 2caecbd54c..de34120055 100644 --- a/gr-audio/lib/jack/jack_sink.h +++ b/gr-audio/lib/jack/jack_sink.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_AUDIO_JACK_SINK_H #define INCLUDED_AUDIO_JACK_SINK_H -#include <audio/sink.h> +#include <gnuradio/audio/sink.h> #include <jack/jack.h> #include <jack/ringbuffer.h> #include <string> diff --git a/gr-audio/lib/jack/jack_source.cc b/gr-audio/lib/jack/jack_source.cc index e5a46e3416..a897785b0e 100644 --- a/gr-audio/lib/jack/jack_source.cc +++ b/gr-audio/lib/jack/jack_source.cc @@ -27,8 +27,8 @@ #include "audio_registry.h" #include <jack_source.h> #include <jack_impl.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/prefs.h> #include <stdio.h> #include <iostream> #include <stdexcept> @@ -57,7 +57,7 @@ namespace gr { static std::string default_device_name() { - return gr_prefs::singleton()->get_string + return prefs::singleton()->get_string ("audio_jack", "default_input_device", "gr_source"); } @@ -99,9 +99,9 @@ namespace gr { jack_source::jack_source(int sampling_rate, const std::string device_name, bool ok_to_block) - : gr_sync_block("audio_jack_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), + : sync_block("audio_jack_source", + io_signature::make(0, 0, 0), + io_signature::make(0, 0, 0)), d_sampling_rate(sampling_rate), d_device_name(device_name.empty() ? default_device_name() : device_name), d_ok_to_block(ok_to_block), @@ -149,7 +149,7 @@ namespace gr { bail("jack_ringbuffer_create failed", 0); assert(sizeof(float)==sizeof(sample_t)); - set_output_signature(gr_make_io_signature(1, 1, sizeof(sample_t))); + set_output_signature(io_signature::make(1, 1, sizeof(sample_t))); jack_nframes_t sample_rate = jack_get_sample_rate(d_jack_client); diff --git a/gr-audio/lib/jack/jack_source.h b/gr-audio/lib/jack/jack_source.h index f096220b26..665139289b 100644 --- a/gr-audio/lib/jack/jack_source.h +++ b/gr-audio/lib/jack/jack_source.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_AUDIO_JACK_SOURCE_H #define INCLUDED_AUDIO_JACK_SOURCE_H -#include <audio/source.h> +#include <gnuradio/audio/source.h> #include <jack/jack.h> #include <jack/ringbuffer.h> #include <string> diff --git a/gr-audio/lib/oss/oss_sink.cc b/gr-audio/lib/oss/oss_sink.cc index 129e771fd6..75372b0b43 100644 --- a/gr-audio/lib/oss/oss_sink.cc +++ b/gr-audio/lib/oss/oss_sink.cc @@ -26,8 +26,8 @@ #include "audio_registry.h" #include <oss_sink.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/prefs.h> #include <sys/soundcard.h> #include <sys/ioctl.h> #include <sys/types.h> @@ -52,16 +52,16 @@ namespace gr { static std::string default_device_name() { - return gr_prefs::singleton()->get_string + return prefs::singleton()->get_string ("audio_oss", "default_output_device", "/dev/dsp"); } oss_sink::oss_sink(int sampling_rate, const std::string device_name, bool ok_to_block) - : gr_sync_block("audio_oss_sink", - gr_make_io_signature(1, 2, sizeof(float)), - gr_make_io_signature(0, 0, 0)), + : sync_block("audio_oss_sink", + io_signature::make(1, 2, sizeof(float)), + io_signature::make(0, 0, 0)), d_sampling_rate(sampling_rate), d_device_name(device_name.empty() ? default_device_name() : device_name), d_fd(-1), d_buffer(0), d_chunk_size(0) @@ -74,7 +74,7 @@ namespace gr { double CHUNK_TIME = std::max(0.001, - gr_prefs::singleton()->get_double("audio_oss", "latency", 0.005)); + prefs::singleton()->get_double("audio_oss", "latency", 0.005)); d_chunk_size = (int)(d_sampling_rate * CHUNK_TIME); set_output_multiple(d_chunk_size); diff --git a/gr-audio/lib/oss/oss_sink.h b/gr-audio/lib/oss/oss_sink.h index 3bb5f4ee1a..e190944857 100644 --- a/gr-audio/lib/oss/oss_sink.h +++ b/gr-audio/lib/oss/oss_sink.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_AUDIO_OSS_SINK_H #define INCLUDED_AUDIO_OSS_SINK_H -#include <audio/sink.h> +#include <gnuradio/audio/sink.h> #include <string> namespace gr { diff --git a/gr-audio/lib/oss/oss_source.cc b/gr-audio/lib/oss/oss_source.cc index 6d6bafceb8..0d27f74fa8 100644 --- a/gr-audio/lib/oss/oss_source.cc +++ b/gr-audio/lib/oss/oss_source.cc @@ -26,8 +26,8 @@ #include "audio_registry.h" #include <oss_source.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/prefs.h> #include <sys/soundcard.h> #include <sys/ioctl.h> #include <sys/types.h> @@ -52,16 +52,16 @@ namespace gr { static std::string default_device_name() { - return gr_prefs::singleton()->get_string + return prefs::singleton()->get_string ("audio_oss", "default_input_device", "/dev/dsp"); } oss_source::oss_source(int sampling_rate, const std::string device_name, bool ok_to_block) - : gr_sync_block("audio_oss_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 2, sizeof(float))), + : sync_block("audio_oss_source", + io_signature::make(0, 0, 0), + io_signature::make(1, 2, sizeof(float))), d_sampling_rate(sampling_rate), d_device_name(device_name.empty() ? default_device_name() : device_name), d_fd(-1), d_buffer(0), d_chunk_size(0) @@ -73,7 +73,7 @@ namespace gr { } double CHUNK_TIME = - std::max(0.001, gr_prefs::singleton()->get_double("audio_oss", "latency", 0.005)); + std::max(0.001, prefs::singleton()->get_double("audio_oss", "latency", 0.005)); d_chunk_size = (int)(d_sampling_rate * CHUNK_TIME); set_output_multiple(d_chunk_size); diff --git a/gr-audio/lib/oss/oss_source.h b/gr-audio/lib/oss/oss_source.h index bf5183bd32..6f1df26a11 100644 --- a/gr-audio/lib/oss/oss_source.h +++ b/gr-audio/lib/oss/oss_source.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_AUDIO_OSS_SOURCE_H #define INCLUDED_AUDIO_OSS_SOURCE_H -#include <audio/source.h> +#include <gnuradio/audio/source.h> #include <string> namespace gr { diff --git a/gr-audio/lib/osx/circular_buffer.h b/gr-audio/lib/osx/circular_buffer.h index 7abbeaeb0c..fee9eeafbc 100644 --- a/gr-audio/lib/osx/circular_buffer.h +++ b/gr-audio/lib/osx/circular_buffer.h @@ -23,7 +23,7 @@ #ifndef _CIRCULAR_BUFFER_H_ #define _CIRCULAR_BUFFER_H_ -#include <thread/thread.h> +#include <gnuradio/thread/thread.h> #include <iostream> #include <stdexcept> diff --git a/gr-audio/lib/osx/osx_sink.cc b/gr-audio/lib/osx/osx_sink.cc index b7fe4e9d11..7c5be43d76 100644 --- a/gr-audio/lib/osx/osx_sink.cc +++ b/gr-audio/lib/osx/osx_sink.cc @@ -27,7 +27,7 @@ #include "audio_registry.h" #include <osx_sink.h> #include <osx_impl.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> namespace gr { @@ -48,9 +48,9 @@ namespace gr { bool do_block, int channel_config, int max_sample_count) - : gr_sync_block("audio_osx_sink", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), + : sync_block("audio_osx_sink", + io_signature::make(0, 0, 0), + io_signature::make(0, 0, 0)), d_sample_rate(0.0), d_channel_config(0), d_n_channels(0), d_queueSampleCount(0), d_max_sample_count(0), d_do_block(do_block), d_internal(0), d_cond_data(0), @@ -84,7 +84,7 @@ namespace gr { // set the input signature - set_input_signature(gr_make_io_signature(1, d_n_channels, sizeof(float))); + set_input_signature(io_signature::make(1, d_n_channels, sizeof(float))); // check that the max # of samples to store is valid diff --git a/gr-audio/lib/osx/osx_sink.h b/gr-audio/lib/osx/osx_sink.h index 153d2d76e6..241e10ab79 100644 --- a/gr-audio/lib/osx/osx_sink.h +++ b/gr-audio/lib/osx/osx_sink.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_AUDIO_OSX_SINK_H #define INCLUDED_AUDIO_OSX_SINK_H -#include <audio/sink.h> +#include <gnuradio/audio/sink.h> #include <string> #include <list> #include <AudioUnit/AudioUnit.h> diff --git a/gr-audio/lib/osx/osx_source.cc b/gr-audio/lib/osx/osx_source.cc index c666bb7ad8..3e2dcef4fe 100644 --- a/gr-audio/lib/osx/osx_source.cc +++ b/gr-audio/lib/osx/osx_source.cc @@ -27,7 +27,7 @@ #include "audio_registry.h" #include <osx_source.h> #include <osx_impl.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> namespace gr { @@ -71,9 +71,9 @@ namespace gr { bool do_block, int channel_config, int max_sample_count) - : gr_sync_block("audio_osx_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), + : sync_block("audio_osx_source", + io_signature::make(0, 0, 0), + io_signature::make(0, 0, 0)), d_deviceSampleRate(0.0), d_outputSampleRate(0.0), d_channel_config(0), d_inputBufferSizeFrames(0), d_inputBufferSizeBytes(0), @@ -310,7 +310,7 @@ namespace gr { // create the output io signature; // no input siganture to set (source is hardware) - set_output_signature(gr_make_io_signature(1, + set_output_signature(io_signature::make(1, d_n_max_channels, sizeof(float))); diff --git a/gr-audio/lib/osx/osx_source.h b/gr-audio/lib/osx/osx_source.h index 03a2d8879c..0b675f8863 100644 --- a/gr-audio/lib/osx/osx_source.h +++ b/gr-audio/lib/osx/osx_source.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_AUDIO_OSX_SOURCE_H #define INCLUDED_AUDIO_OSX_SOURCE_H -#include <audio/source.h> +#include <gnuradio/audio/source.h> #include <string> #include <AudioToolbox/AudioToolbox.h> #include <AudioUnit/AudioUnit.h> diff --git a/gr-audio/lib/portaudio/portaudio_sink.cc b/gr-audio/lib/portaudio/portaudio_sink.cc index 746894e494..089dedc33e 100644 --- a/gr-audio/lib/portaudio/portaudio_sink.cc +++ b/gr-audio/lib/portaudio/portaudio_sink.cc @@ -27,8 +27,8 @@ #include "audio_registry.h" #include <portaudio_sink.h> #include <portaudio_impl.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/prefs.h> #include <stdio.h> #include <iostream> #include <unistd.h> @@ -58,7 +58,7 @@ namespace gr { static std::string default_device_name() { - return gr_prefs::singleton()->get_string + return prefs::singleton()->get_string ("audio_portaudio", "default_output_device", ""); } @@ -73,8 +73,8 @@ namespace gr { } // FYI, the buffer indicies are in units of samples. - d_writer = gr_make_buffer(N_BUFFERS * bufsize_samples, sizeof(sample_t)); - d_reader = gr_buffer_add_reader(d_writer, 0); + d_writer = gr::make_buffer(N_BUFFERS * bufsize_samples, sizeof(sample_t)); + d_reader = gr::buffer_add_reader(d_writer, 0); } /* @@ -137,13 +137,13 @@ namespace gr { portaudio_sink::portaudio_sink(int sampling_rate, const std::string device_name, bool ok_to_block) - : gr_sync_block("audio_portaudio_sink", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), + : sync_block("audio_portaudio_sink", + io_signature::make(0, 0, 0), + io_signature::make(0, 0, 0)), d_sampling_rate(sampling_rate), d_device_name(device_name.empty() ? default_device_name() : device_name), d_ok_to_block(ok_to_block), - d_verbose(gr_prefs::singleton()->get_bool("audio_portaudio", "verbose", false)), + d_verbose(prefs::singleton()->get_bool("audio_portaudio", "verbose", false)), d_portaudio_buffer_size_frames(0), d_stream(0), d_ringbuffer_mutex(), @@ -226,7 +226,7 @@ namespace gr { // supported by the h/w, we can compute a reasonable input // signature. The portaudio specs say that they'll accept any // number of channels from 1 to max. - set_input_signature(gr_make_io_signature(1, deviceInfo->maxOutputChannels, + set_input_signature(io_signature::make(1, deviceInfo->maxOutputChannels, sizeof(sample_t))); } diff --git a/gr-audio/lib/portaudio/portaudio_sink.h b/gr-audio/lib/portaudio/portaudio_sink.h index e69f96b252..6327f4397c 100644 --- a/gr-audio/lib/portaudio/portaudio_sink.h +++ b/gr-audio/lib/portaudio/portaudio_sink.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_AUDIO_PORTAUDIO_SINK_H #define INCLUDED_AUDIO_PORTAUDIO_SINK_H -#include <audio/sink.h> -#include <gr_buffer.h> -#include <thread/thread.h> +#include <gnuradio/audio/sink.h> +#include <gnuradio/buffer.h> +#include <gnuradio/thread/thread.h> #include <string> #include <portaudio.h> #include <stdexcept> @@ -55,8 +55,8 @@ namespace gr { PaStream *d_stream; PaStreamParameters d_output_parameters; - gr_buffer_sptr d_writer; // buffer used between work and callback - gr_buffer_reader_sptr d_reader; + gr::buffer_sptr d_writer; // buffer used between work and callback + gr::buffer_reader_sptr d_reader; gr::thread::mutex d_ringbuffer_mutex; gr::thread::condition_variable d_ringbuffer_cond; diff --git a/gr-audio/lib/portaudio/portaudio_source.cc b/gr-audio/lib/portaudio/portaudio_source.cc index 500d3109e5..5d081f63e2 100644 --- a/gr-audio/lib/portaudio/portaudio_source.cc +++ b/gr-audio/lib/portaudio/portaudio_source.cc @@ -27,8 +27,8 @@ #include "audio_registry.h" #include <portaudio_source.h> #include <portaudio_impl.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/prefs.h> #include <stdio.h> #include <iostream> #include <unistd.h> @@ -58,7 +58,7 @@ namespace gr { static std::string default_device_name() { - return gr_prefs::singleton()->get_string + return prefs::singleton()->get_string ("audio_portaudio", "default_input_device", ""); } @@ -73,8 +73,8 @@ namespace gr { } // FYI, the buffer indicies are in units of samples. - d_writer = gr_make_buffer(N_BUFFERS * bufsize_samples, sizeof(sample_t)); - d_reader = gr_buffer_add_reader(d_writer, 0); + d_writer = gr::make_buffer(N_BUFFERS * bufsize_samples, sizeof(sample_t)); + d_reader = gr::buffer_add_reader(d_writer, 0); } /* @@ -136,13 +136,13 @@ namespace gr { portaudio_source::portaudio_source(int sampling_rate, const std::string device_name, bool ok_to_block) - : gr_sync_block("audio_portaudio_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), + : sync_block("audio_portaudio_source", + io_signature::make(0, 0, 0), + io_signature::make(0, 0, 0)), d_sampling_rate(sampling_rate), d_device_name(device_name.empty() ? default_device_name() : device_name), d_ok_to_block(ok_to_block), - d_verbose(gr_prefs::singleton()->get_bool("audio_portaudio", "verbose", false)), + d_verbose(prefs::singleton()->get_bool("audio_portaudio", "verbose", false)), d_portaudio_buffer_size_frames(0), d_stream(0), d_ringbuffer_mutex(), @@ -221,7 +221,7 @@ namespace gr { // supported by the h/w, we can compute a reasonable output // signature. The portaudio specs say that they'll accept any // number of channels from 1 to max. - set_output_signature(gr_make_io_signature(1, deviceInfo->maxInputChannels, + set_output_signature(io_signature::make(1, deviceInfo->maxInputChannels, sizeof (sample_t))); } diff --git a/gr-audio/lib/portaudio/portaudio_source.h b/gr-audio/lib/portaudio/portaudio_source.h index 6a3419b613..b42f9a3a9b 100644 --- a/gr-audio/lib/portaudio/portaudio_source.h +++ b/gr-audio/lib/portaudio/portaudio_source.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_AUDIO_PORTAUDIO_SOURCE_H #define INCLUDED_AUDIO_PORTAUDIO_SOURCE_H -#include <audio/source.h> -#include <gr_buffer.h> -#include <thread/thread.h> +#include <gnuradio/audio/source.h> +#include <gnuradio/buffer.h> +#include <gnuradio/thread/thread.h> #include <string> #include <portaudio.h> #include <stdexcept> @@ -55,8 +55,8 @@ namespace gr { PaStream *d_stream; PaStreamParameters d_input_parameters; - gr_buffer_sptr d_writer; // buffer used between work and callback - gr_buffer_reader_sptr d_reader; + gr::buffer_sptr d_writer; // buffer used between work and callback + gr::buffer_reader_sptr d_reader; gr::thread::mutex d_ringbuffer_mutex; gr::thread::condition_variable d_ringbuffer_cond; diff --git a/gr-audio/lib/windows/windows_sink.cc b/gr-audio/lib/windows/windows_sink.cc index f372bd0e75..4241a5c16b 100644 --- a/gr-audio/lib/windows/windows_sink.cc +++ b/gr-audio/lib/windows/windows_sink.cc @@ -26,7 +26,7 @@ #include "audio_registry.h" #include <windows_sink.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -59,9 +59,9 @@ namespace gr { } windows_sink::windows_sink(int sampling_freq, const std::string device_name) - : gr_sync_block("audio_windows_sink", - gr_make_io_signature(1, 2, sizeof(float)), - gr_make_io_signature(0, 0, 0)), + : sync_block("audio_windows_sink", + io_signature::make(1, 2, sizeof(float)), + io_signature::make(0, 0, 0)), d_sampling_freq(sampling_freq), d_device_name(device_name.empty() ? default_device_name() : device_name), d_fd(-1), d_buffer(0), d_chunk_size(0) diff --git a/gr-audio/lib/windows/windows_sink.h b/gr-audio/lib/windows/windows_sink.h index beaccc9054..3d21cc47a3 100644 --- a/gr-audio/lib/windows/windows_sink.h +++ b/gr-audio/lib/windows/windows_sink.h @@ -29,7 +29,7 @@ #include <windows.h> #include <mmsystem.h> -#include <audio/sink.h> +#include <gnuradio/audio/sink.h> #include <string> namespace gr { diff --git a/gr-audio/lib/windows/windows_source.cc b/gr-audio/lib/windows/windows_source.cc index 89371cfa84..5180868f2e 100644 --- a/gr-audio/lib/windows/windows_source.cc +++ b/gr-audio/lib/windows/windows_source.cc @@ -26,7 +26,7 @@ #include "audio_registry.h" #include <windows_source.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> //include <sys/soundcard.h> //include <sys/ioctl.h> #include <sys/types.h> @@ -60,9 +60,9 @@ namespace gr { windows_source::windows_source(int sampling_freq, const std::string device_name) - : gr_sync_block("audio_windows_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 2, sizeof(float))), + : sync_block("audio_windows_source", + io_signature::make(0, 0, 0), + io_signature::make(1, 2, sizeof(float))), d_sampling_freq(sampling_freq), d_device_name(device_name.empty() ? default_device_name() : device_name), d_fd(-1), d_buffer(0), d_chunk_size(0) diff --git a/gr-audio/lib/windows/windows_source.h b/gr-audio/lib/windows/windows_source.h index 18507d14b7..9814d12f54 100644 --- a/gr-audio/lib/windows/windows_source.h +++ b/gr-audio/lib/windows/windows_source.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_AUDIO_WINDOWS_SOURCE_H #define INCLUDED_AUDIO_WINDOWS_SOURCE_H -#include <audio/source.h> +#include <gnuradio/audio/source.h> #include <string> namespace gr { diff --git a/gr-audio/swig/CMakeLists.txt b/gr-audio/swig/CMakeLists.txt index 47163b0e3b..72301d55b1 100644 --- a/gr-audio/swig/CMakeLists.txt +++ b/gr-audio/swig/CMakeLists.txt @@ -35,7 +35,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/audio_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/audio) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/audio) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_LIBRARIES gnuradio-audio) diff --git a/gr-audio/swig/audio_swig.i b/gr-audio/swig/audio_swig.i index d675df0f95..f8d13d6f61 100644 --- a/gr-audio/swig/audio_swig.i +++ b/gr-audio/swig/audio_swig.i @@ -28,12 +28,12 @@ %include "audio_swig_doc.i" %{ -#include <audio/source.h> -#include <audio/sink.h> +#include <gnuradio/audio/source.h> +#include <gnuradio/audio/sink.h> %} -%include <audio/source.h> -%include <audio/sink.h> +%include <gnuradio/audio/source.h> +%include <gnuradio/audio/sink.h> GR_SWIG_BLOCK_MAGIC2(audio, source) GR_SWIG_BLOCK_MAGIC2(audio, sink) diff --git a/gr-blocks/CMakeLists.txt b/gr-blocks/CMakeLists.txt index 10e779fc20..6014f871bd 100644 --- a/gr-blocks/CMakeLists.txt +++ b/gr-blocks/CMakeLists.txt @@ -80,7 +80,7 @@ CPACK_COMPONENT("blocks_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/blocks) +add_subdirectory(include/gnuradio/blocks) add_subdirectory(lib) #if(ENABLE_TESTING) # add_subdirectory(tests) diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt index 14346f9c15..14346f9c15 100644 --- a/gr-blocks/include/blocks/CMakeLists.txt +++ b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt diff --git a/gr-blocks/include/blocks/add_XX.h.t b/gr-blocks/include/gnuradio/blocks/add_XX.h.t index ffe08f683b..08e9646af6 100644 --- a/gr-blocks/include/blocks/add_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/add_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -38,7 +38,7 @@ namespace gr { * \details * Add across all input streams. */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: diff --git a/gr-blocks/include/blocks/add_const_XX.h.t b/gr-blocks/include/gnuradio/blocks/add_const_XX.h.t index 3a99978b6b..3e783213a8 100644 --- a/gr-blocks/include/blocks/add_const_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/add_const_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -35,7 +35,7 @@ namespace gr { * \brief output = input + constant * \ingroup math_operators_blk */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: diff --git a/gr-blocks/include/blocks/add_const_vXX.h.t b/gr-blocks/include/gnuradio/blocks/add_const_vXX.h.t index 33a50a42ca..ea6c35695e 100644 --- a/gr-blocks/include/blocks/add_const_vXX.h.t +++ b/gr-blocks/include/gnuradio/blocks/add_const_vXX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -35,7 +35,7 @@ namespace gr { * \brief output = input + constant vector * \ingroup math_operators_blk */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: diff --git a/gr-blocks/include/blocks/add_ff.h b/gr-blocks/include/gnuradio/blocks/add_ff.h index 6a9bbfbded..fd2420ce09 100644 --- a/gr-blocks/include/blocks/add_ff.h +++ b/gr-blocks/include/gnuradio/blocks/add_ff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_ADD_FF_H #define INCLUDED_BLOCKS_ADD_FF_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -36,11 +36,11 @@ namespace gr { * \details * Add across all input streams. */ - class BLOCKS_API add_ff : virtual public gr_sync_block + class BLOCKS_API add_ff : virtual public sync_block { public: - // gr::blocks::add_ff::sptr + // gr::gnuradio/blocks::add_ff::sptr typedef boost::shared_ptr<add_ff> sptr; /*! diff --git a/gr-blocks/include/blocks/and_XX.h.t b/gr-blocks/include/gnuradio/blocks/and_XX.h.t index 048e1bea57..820daefdbf 100644 --- a/gr-blocks/include/blocks/and_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/and_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -37,7 +37,7 @@ namespace gr { * * bitwise boolean and across all input streams. */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: diff --git a/gr-blocks/include/blocks/and_const_XX.h.t b/gr-blocks/include/gnuradio/blocks/and_const_XX.h.t index 9e478819cb..a4c83a4eab 100644 --- a/gr-blocks/include/blocks/and_const_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/and_const_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -37,7 +37,7 @@ namespace gr { * * bitwise boolean and of const to the data stream. */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: diff --git a/gr-blocks/include/blocks/annotator_1to1.h b/gr-blocks/include/gnuradio/blocks/annotator_1to1.h index 1c5ab038fc..82c7bc0485 100644 --- a/gr-blocks/include/blocks/annotator_1to1.h +++ b/gr-blocks/include/gnuradio/blocks/annotator_1to1.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_ANNOTATOR_1TO1_H #define INCLUDED_GR_ANNOTATOR_1TO1_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -44,15 +44,15 @@ namespace gr { * * This block is only meant for testing and showing how to use the tags. */ - class BLOCKS_API annotator_1to1 : virtual public gr_sync_block + class BLOCKS_API annotator_1to1 : virtual public sync_block { public: - // gr::blocks::annotator_1to1::sptr + // gr::gnuradio/blocks::annotator_1to1::sptr typedef boost::shared_ptr<annotator_1to1> sptr; static sptr make(int when, size_t sizeof_stream_item); - virtual std::vector<gr_tag_t> data() const = 0; + virtual std::vector<tag_t> data() const = 0; }; } /* namespace blocks */ diff --git a/gr-blocks/include/blocks/annotator_alltoall.h b/gr-blocks/include/gnuradio/blocks/annotator_alltoall.h index 7bad73b291..2585f1c018 100644 --- a/gr-blocks/include/blocks/annotator_alltoall.h +++ b/gr-blocks/include/gnuradio/blocks/annotator_alltoall.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H #define INCLUDED_GR_ANNOTATOR_ALLTOALL_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -45,15 +45,15 @@ namespace gr { * * This block is only meant for testing and showing how to use the tags. */ - class BLOCKS_API annotator_alltoall : virtual public gr_sync_block + class BLOCKS_API annotator_alltoall : virtual public sync_block { public: - // gr::blocks::annotator_alltoall::sptr + // gr::gnuradio/blocks::annotator_alltoall::sptr typedef boost::shared_ptr<annotator_alltoall> sptr; static sptr make(int when, size_t sizeof_stream_item); - virtual std::vector<gr_tag_t> data() const = 0; + virtual std::vector<tag_t> data() const = 0; }; } /* namespace blocks */ diff --git a/gr-blocks/include/blocks/annotator_raw.h b/gr-blocks/include/gnuradio/blocks/annotator_raw.h index 703c42516a..0797f97928 100644 --- a/gr-blocks/include/blocks/annotator_raw.h +++ b/gr-blocks/include/gnuradio/blocks/annotator_raw.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_ANNOTATOR_RAW_H #define INCLUDED_GR_ANNOTATOR_RAW_H -#include <blocks/api.h> -#include <gr_sync_block.h> -#include <gr_tags.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/tags.h> namespace gr { namespace blocks { @@ -34,16 +34,16 @@ namespace gr { * \brief raw stream annotator testing block. * * \details - * This block creates arbitrary tags to be sent downstream blocks + * This block creates arbitrary tags to be sent downstream gnuradio/blocks * to be sent are set manually via accessor methods and are sent * only once. * - * This block is intended for testing of tag related blocks + * This block is intended for testing of tag related gnuradio/blocks */ - class BLOCKS_API annotator_raw : virtual public gr_sync_block + class BLOCKS_API annotator_raw : virtual public sync_block { public: - // gr::blocks::annotator_raw::sptr + // gr::gnuradio/blocks::annotator_raw::sptr typedef boost::shared_ptr<annotator_raw> sptr; static sptr make(size_t sizeof_stream_item); diff --git a/gr-blocks/include/blocks/api.h b/gr-blocks/include/gnuradio/blocks/api.h index d77bdbdd5b..fd4e605b56 100644 --- a/gr-blocks/include/blocks/api.h +++ b/gr-blocks/include/gnuradio/blocks/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_BLOCKS_API_H #define INCLUDED_BLOCKS_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_blocks_EXPORTS # define BLOCKS_API __GR_ATTR_EXPORT diff --git a/gr-blocks/include/blocks/argmax_XX.h.t b/gr-blocks/include/gnuradio/blocks/argmax_XX.h.t index 93aa367260..71468726ec 100644 --- a/gr-blocks/include/blocks/argmax_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/argmax_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -46,7 +46,7 @@ namespace gr { * Stream 1 will contain the number of the input stream that * held the maximum value. */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: // gr::blocks::@NAME@::sptr diff --git a/gr-blocks/include/blocks/bin_statistics_f.h b/gr-blocks/include/gnuradio/blocks/bin_statistics_f.h index a73afc82d6..47abaefec9 100644 --- a/gr-blocks/include/blocks/bin_statistics_f.h +++ b/gr-blocks/include/gnuradio/blocks/bin_statistics_f.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_GR_BIN_STATISTICS_F_H #define INCLUDED_GR_BIN_STATISTICS_F_H -#include <blocks/api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> -#include <gr_feval.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> +#include <gnuradio/feval.h> namespace gr { namespace blocks { @@ -35,21 +35,21 @@ namespace gr { * \brief control scanning and record frequency domain statistics * \ingroup sink_blk */ - class BLOCKS_API bin_statistics_f : virtual public gr_sync_block + class BLOCKS_API bin_statistics_f : virtual public sync_block { protected: std::vector<float> d_max; // per bin maxima virtual size_t vlen() const = 0; virtual double center_freq() const = 0; - virtual gr_msg_queue_sptr msgq() const = 0; + virtual gr::msg_queue::sptr msgq() const = 0; virtual void reset_stats() = 0; virtual void accrue_stats(const float *input) = 0; virtual void send_stats() = 0; public: - // gr::blocks::bin_statistics_f::sptr + // gr::gnuradio/blocks::bin_statistics_f::sptr typedef boost::shared_ptr<bin_statistics_f> sptr; /*! @@ -59,13 +59,13 @@ namespace gr { * * \param vlen vector length * \param msgq message queue - * \param tune a gr_feval_dd callback function + * \param tune a feval_dd callback function * \param tune_delay number of samples for the tune delay * \param dwell_delay number of samples for the dwell delay */ static sptr make(unsigned int vlen, // vector length - gr_msg_queue_sptr msgq, - gr_feval_dd *tune, // callback + gr::msg_queue::sptr msgq, + feval_dd *tune, // callback size_t tune_delay, // samples size_t dwell_delay); // samples }; diff --git a/gr-blocks/include/blocks/burst_tagger.h b/gr-blocks/include/gnuradio/blocks/burst_tagger.h index 312fb2ffbd..e10938980e 100644 --- a/gr-blocks/include/blocks/burst_tagger.h +++ b/gr-blocks/include/gnuradio/blocks/burst_tagger.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_BURST_TAGGER_H #define INCLUDED_GR_BURST_TAGGER_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -44,14 +44,14 @@ namespace gr { * * The signal on stream 0 is retransmitted to output stream 0. */ - class BLOCKS_API burst_tagger : virtual public gr_sync_block + class BLOCKS_API burst_tagger : virtual public sync_block { public: - // gr::blocks::burst_tagger::sptr + // gr::gnuradio/blocks::burst_tagger::sptr typedef boost::shared_ptr<burst_tagger> sptr; /*! - * Build a burst tagger blocks. + * Build a burst tagger gnuradio/blocks. * * \param itemsize itemsize of the signal stream on input 0. */ diff --git a/gr-blocks/include/blocks/char_to_float.h b/gr-blocks/include/gnuradio/blocks/char_to_float.h index 0002ceb30b..71861adf16 100644 --- a/gr-blocks/include/blocks/char_to_float.h +++ b/gr-blocks/include/gnuradio/blocks/char_to_float.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_CHAR_TO_FLOAT_H #define INCLUDED_BLOCKS_CHAR_TO_FLOAT_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,11 +33,11 @@ namespace gr { * \brief Convert stream of chars to a stream of float * \ingroup type_converters_blk */ - class BLOCKS_API char_to_float : virtual public gr_sync_block + class BLOCKS_API char_to_float : virtual public sync_block { public: - // gr::blocks::char_to_float_ff::sptr + // gr::gnuradio/blocks::char_to_float_ff::sptr typedef boost::shared_ptr<char_to_float> sptr; /*! diff --git a/gr-blocks/include/blocks/char_to_short.h b/gr-blocks/include/gnuradio/blocks/char_to_short.h index fc9d3b4b52..62800b216a 100644 --- a/gr-blocks/include/blocks/char_to_short.h +++ b/gr-blocks/include/gnuradio/blocks/char_to_short.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_CHAR_TO_SHORT_H #define INCLUDED_BLOCKS_CHAR_TO_SHORT_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,11 +33,11 @@ namespace gr { * \brief Convert stream of chars to a stream of short * \ingroup type_converters_blk */ - class BLOCKS_API char_to_short : virtual public gr_sync_block + class BLOCKS_API char_to_short : virtual public sync_block { public: - // gr::blocks::char_to_short_ff::sptr + // gr::gnuradio/blocks::char_to_short_ff::sptr typedef boost::shared_ptr<char_to_short> sptr; static sptr make(size_t vlen=1); diff --git a/gr-blocks/include/blocks/check_lfsr_32k_s.h b/gr-blocks/include/gnuradio/blocks/check_lfsr_32k_s.h index 6eddd607b6..d9853a9cd4 100644 --- a/gr-blocks/include/blocks/check_lfsr_32k_s.h +++ b/gr-blocks/include/gnuradio/blocks/check_lfsr_32k_s.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_CHECK_LFSR_32K_S_H #define INCLUDED_GR_CHECK_LFSR_32K_S_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -38,10 +38,10 @@ namespace gr { * gr::blocks::lfsr_32k_source_s to test the USRP using its * digital loopback mode. */ - class BLOCKS_API check_lfsr_32k_s : virtual public gr_sync_block + class BLOCKS_API check_lfsr_32k_s : virtual public sync_block { public: - // gr::blocks::check_lfsr_32k_s::sptr + // gr::gnuradio/blocks::check_lfsr_32k_s::sptr typedef boost::shared_ptr<check_lfsr_32k_s> sptr; static sptr make(); diff --git a/gr-blocks/include/blocks/complex_to_arg.h b/gr-blocks/include/gnuradio/blocks/complex_to_arg.h index 178f846704..63e2a37cb9 100644 --- a/gr-blocks/include/blocks/complex_to_arg.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_arg.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_COMPLEX_TO_ARG_H #define INCLUDED_BLOCKS_COMPLEX_TO_ARG_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief complex in, arg out (float) * \ingroup type_converters_blk */ - class BLOCKS_API complex_to_arg : virtual public gr_sync_block + class BLOCKS_API complex_to_arg : virtual public sync_block { public: - // gr::blocks::complex_to_arg_ff::sptr + // gr::gnuradio/blocks::complex_to_arg_ff::sptr typedef boost::shared_ptr<complex_to_arg> sptr; /*! diff --git a/gr-blocks/include/blocks/complex_to_float.h b/gr-blocks/include/gnuradio/blocks/complex_to_float.h index 7648648d6c..341d2e2d9e 100644 --- a/gr-blocks/include/blocks/complex_to_float.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_float.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_COMPLEX_TO_FLOAT_H #define INCLUDED_BLOCKS_COMPLEX_TO_FLOAT_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief convert a stream of gr_complex to 1 or 2 streams of float * \ingroup type_converters_blk */ - class BLOCKS_API complex_to_float : virtual public gr_sync_block + class BLOCKS_API complex_to_float : virtual public sync_block { public: - // gr::blocks::complex_to_float_ff::sptr + // gr::gnuradio/blocks::complex_to_float_ff::sptr typedef boost::shared_ptr<complex_to_float> sptr; /*! diff --git a/gr-blocks/include/blocks/complex_to_imag.h b/gr-blocks/include/gnuradio/blocks/complex_to_imag.h index cb1d32fec6..7a8d200639 100644 --- a/gr-blocks/include/blocks/complex_to_imag.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_imag.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_COMPLEX_TO_IMAG_H #define INCLUDED_BLOCKS_COMPLEX_TO_IMAG_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief complex in, imag out (float) * \ingroup type_converters_blk */ - class BLOCKS_API complex_to_imag : virtual public gr_sync_block + class BLOCKS_API complex_to_imag : virtual public sync_block { public: - // gr::blocks::complex_to_imag_ff::sptr + // gr::gnuradio/blocks::complex_to_imag_ff::sptr typedef boost::shared_ptr<complex_to_imag> sptr; /*! diff --git a/gr-blocks/include/blocks/complex_to_interleaved_short.h b/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h index c7304787a9..8be4f86622 100644 --- a/gr-blocks/include/blocks/complex_to_interleaved_short.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_COMPLEX_TO_INTERLEAVED_SHORT_H #define INCLUDED_BLOCKS_COMPLEX_TO_INTERLEAVED_SHORT_H -#include <blocks/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Convert stream of complex to a stream of interleaved shorts * \ingroup type_converters_blk */ - class BLOCKS_API complex_to_interleaved_short : virtual public gr_sync_interpolator + class BLOCKS_API complex_to_interleaved_short : virtual public sync_interpolator { public: - // gr::blocks::complex_to_interleaved_short::sptr + // gr::gnuradio/blocks::complex_to_interleaved_short::sptr typedef boost::shared_ptr<complex_to_interleaved_short> sptr; /*! diff --git a/gr-blocks/include/blocks/complex_to_mag.h b/gr-blocks/include/gnuradio/blocks/complex_to_mag.h index b1758fd3eb..fcb1fe66ca 100644 --- a/gr-blocks/include/blocks/complex_to_mag.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_mag.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_COMPLEX_TO_MAG_H #define INCLUDED_BLOCKS_COMPLEX_TO_MAG_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief complex in, magnitude out (float) * \ingroup type_converters_blk */ - class BLOCKS_API complex_to_mag : virtual public gr_sync_block + class BLOCKS_API complex_to_mag : virtual public sync_block { public: - // gr::blocks::complex_to_mag_ff::sptr + // gr::gnuradio/blocks::complex_to_mag_ff::sptr typedef boost::shared_ptr<complex_to_mag> sptr; /*! diff --git a/gr-blocks/include/blocks/complex_to_mag_squared.h b/gr-blocks/include/gnuradio/blocks/complex_to_mag_squared.h index a7c464fbb0..662505039c 100644 --- a/gr-blocks/include/blocks/complex_to_mag_squared.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_mag_squared.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_COMPLEX_TO_MAG_SQUARED_H #define INCLUDED_BLOCKS_COMPLEX_TO_MAG_SQUARED_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief complex in, magnitude squared out (float) * \ingroup type_converters_blk */ - class BLOCKS_API complex_to_mag_squared : virtual public gr_sync_block + class BLOCKS_API complex_to_mag_squared : virtual public sync_block { public: - // gr::blocks::complex_to_mag_squared_ff::sptr + // gr::gnuradio/blocks::complex_to_mag_squared_ff::sptr typedef boost::shared_ptr<complex_to_mag_squared> sptr; /*! diff --git a/gr-blocks/include/blocks/complex_to_real.h b/gr-blocks/include/gnuradio/blocks/complex_to_real.h index 908ca9fc94..7efefcddd3 100644 --- a/gr-blocks/include/blocks/complex_to_real.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_real.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_COMPLEX_TO_REAL_H #define INCLUDED_BLOCKS_COMPLEX_TO_REAL_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief complex in, real out (float) * \ingroup type_converters_blk */ - class BLOCKS_API complex_to_real : virtual public gr_sync_block + class BLOCKS_API complex_to_real : virtual public sync_block { public: - // gr::blocks::complex_to_real_ff::sptr + // gr::gnuradio/blocks::complex_to_real_ff::sptr typedef boost::shared_ptr<complex_to_real> sptr; /*! diff --git a/gr-blocks/include/blocks/conjugate_cc.h b/gr-blocks/include/gnuradio/blocks/conjugate_cc.h index 92096eea31..7e4440c713 100644 --- a/gr-blocks/include/blocks/conjugate_cc.h +++ b/gr-blocks/include/gnuradio/blocks/conjugate_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_CONJUGATE_CC_H #define INCLUDED_BLOCKS_CONJUGATE_CC_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,11 +33,11 @@ namespace gr { * \brief output = complex conjugate of input * \ingroup math_operators_blk */ - class BLOCKS_API conjugate_cc : virtual public gr_sync_block + class BLOCKS_API conjugate_cc : virtual public sync_block { public: - // gr::blocks::conjugate_cc_ff::sptr + // gr::gnuradio/blocks::conjugate_cc_ff::sptr typedef boost::shared_ptr<conjugate_cc> sptr; static sptr make(); diff --git a/gr-blocks/include/blocks/control_loop.h b/gr-blocks/include/gnuradio/blocks/control_loop.h index 7c09f5915b..d53c81cbac 100644 --- a/gr-blocks/include/blocks/control_loop.h +++ b/gr-blocks/include/gnuradio/blocks/control_loop.h @@ -23,7 +23,7 @@ #ifndef GR_BLOCKS_CONTROL_LOOP #define GR_BLOCKS_CONTROL_LOOP -#include <blocks/api.h> +#include <gnuradio/blocks/api.h> namespace gr { namespace blocks { diff --git a/gr-blocks/include/blocks/copy.h b/gr-blocks/include/gnuradio/blocks/copy.h index a243a54917..f960d4fba7 100644 --- a/gr-blocks/include/blocks/copy.h +++ b/gr-blocks/include/gnuradio/blocks/copy.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_COPY_H #define INCLUDED_GR_COPY_H -#include <blocks/api.h> -#include <gr_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> namespace gr { namespace blocks { @@ -37,10 +37,10 @@ namespace gr { * When enabled (default), this block copies its input to its * output. When disabled, this block drops its input on the floor. */ - class BLOCKS_API copy : virtual public gr_block + class BLOCKS_API copy : virtual public block { public: - // gr::blocks::copy::sptr + // gr::gnuradio/blocks::copy::sptr typedef boost::shared_ptr<copy> sptr; static sptr make(size_t itemsize); diff --git a/gr-blocks/include/blocks/count_bits.h b/gr-blocks/include/gnuradio/blocks/count_bits.h index ceb882f67b..88f56f7221 100644 --- a/gr-blocks/include/blocks/count_bits.h +++ b/gr-blocks/include/gnuradio/blocks/count_bits.h @@ -23,7 +23,7 @@ #ifndef _GR_COUNT_BITS_H_ #define _GR_COUNT_BITS_H_ -#include <blocks/api.h> +#include <gnuradio/blocks/api.h> namespace gr { namespace blocks { diff --git a/gr-blocks/include/blocks/ctrlport_probe2_c.h b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_c.h index 736c23e4e7..c15635bc2c 100644 --- a/gr-blocks/include/blocks/ctrlport_probe2_c.h +++ b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_c.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_CTRLPORT_PROBE2_C_H #define INCLUDED_CTRLPORT_PROBE2_C_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -40,10 +40,10 @@ namespace gr { * the latest \p len number of complex samples so that every query * by a ControlPort client will get the same length vector. */ - class BLOCKS_API ctrlport_probe2_c : virtual public gr_sync_block + class BLOCKS_API ctrlport_probe2_c : virtual public sync_block { public: - // gr::blocks::ctrlport_probe2_c::sptr + // gr::gnuradio/blocks::ctrlport_probe2_c::sptr typedef boost::shared_ptr<ctrlport_probe2_c> sptr; /*! diff --git a/gr-blocks/include/blocks/ctrlport_probe_c.h b/gr-blocks/include/gnuradio/blocks/ctrlport_probe_c.h index 579621c680..88eed7e5d7 100644 --- a/gr-blocks/include/blocks/ctrlport_probe_c.h +++ b/gr-blocks/include/gnuradio/blocks/ctrlport_probe_c.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_CTRLPORT_PROBE_C_H #define INCLUDED_CTRLPORT_PROBE_C_H -#include <blocks/api.h> -#include <gr_sync_block.h> -#include <rpcregisterhelpers.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/rpcregisterhelpers.h> #include <boost/thread/shared_mutex.hpp> namespace gr { @@ -42,10 +42,10 @@ namespace gr { * sends the current vector held in the work function when the * queried by a ControlPort client. */ - class BLOCKS_API ctrlport_probe_c : virtual public gr_sync_block + class BLOCKS_API ctrlport_probe_c : virtual public sync_block { public: - // gr::blocks::ctrlport_probe_c::sptr + // gr::gnuradio/blocks::ctrlport_probe_c::sptr typedef boost::shared_ptr<ctrlport_probe_c> sptr; /*! diff --git a/gr-blocks/include/blocks/deinterleave.h b/gr-blocks/include/gnuradio/blocks/deinterleave.h index bb6ad59a22..e9e7ebd58a 100644 --- a/gr-blocks/include/blocks/deinterleave.h +++ b/gr-blocks/include/gnuradio/blocks/deinterleave.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_DEINTERLEAVE_H #define INCLUDED_BLOCKS_DEINTERLEAVE_H -#include <blocks/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief deinterleave a single input into N outputs * \ingroup stream_operators_blk */ - class BLOCKS_API deinterleave : virtual public gr_sync_decimator + class BLOCKS_API deinterleave : virtual public sync_decimator { public: - // gr::blocks::deinterleave::sptr + // gr::gnuradio/blocks::deinterleave::sptr typedef boost::shared_ptr<deinterleave> sptr; /*! diff --git a/gr-blocks/include/blocks/delay.h b/gr-blocks/include/gnuradio/blocks/delay.h index 2a59fa0fca..8fc5bb3028 100644 --- a/gr-blocks/include/blocks/delay.h +++ b/gr-blocks/include/gnuradio/blocks/delay.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_DELAY_H #define INCLUDED_BLOCKS_DELAY_H -#include <blocks/api.h> -#include <gr_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief delay the input by a certain number of samples * \ingroup misc_blk */ - class BLOCKS_API delay : virtual public gr_block + class BLOCKS_API delay : virtual public block { public: - // gr::blocks::delay::sptr + // gr::gnuradio/blocks::delay::sptr typedef boost::shared_ptr<delay> sptr; /*! diff --git a/gr-blocks/include/blocks/divide_XX.h.t b/gr-blocks/include/gnuradio/blocks/divide_XX.h.t index 821a458ec4..25e7941f72 100644 --- a/gr-blocks/include/blocks/divide_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/divide_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -38,7 +38,7 @@ namespace gr { * \details * Divide across all input streams. */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: diff --git a/gr-blocks/include/blocks/endian_swap.h b/gr-blocks/include/gnuradio/blocks/endian_swap.h index c26a1d2aa4..841fc3c4b8 100644 --- a/gr-blocks/include/blocks/endian_swap.h +++ b/gr-blocks/include/gnuradio/blocks/endian_swap.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_ENDIAN_SWAP_H #define INCLUDED_GR_ENDIAN_SWAP_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Convert stream of items into thier byte swapped version * \ingroup stream_operators_blk */ - class BLOCKS_API endian_swap : virtual public gr_sync_block + class BLOCKS_API endian_swap : virtual public sync_block { public: - // gr::blocks::endian_swap::sptr + // gr::gnuradio/blocks::endian_swap::sptr typedef boost::shared_ptr<endian_swap> sptr; /*! diff --git a/gr-blocks/include/blocks/file_descriptor_sink.h b/gr-blocks/include/gnuradio/blocks/file_descriptor_sink.h index e98f918c14..9a3cf2edad 100644 --- a/gr-blocks/include/blocks/file_descriptor_sink.h +++ b/gr-blocks/include/gnuradio/blocks/file_descriptor_sink.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_FILE_DESCRIPTOR_SINK_H #define INCLUDED_GR_FILE_DESCRIPTOR_SINK_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Write stream to file descriptor. * \ingroup file_operators_blk */ - class BLOCKS_API file_descriptor_sink : virtual public gr_sync_block + class BLOCKS_API file_descriptor_sink : virtual public sync_block { public: - // gr::blocks::file_descriptor_sink::sptr + // gr::gnuradio/blocks::file_descriptor_sink::sptr typedef boost::shared_ptr<file_descriptor_sink> sptr; /*! diff --git a/gr-blocks/include/blocks/file_descriptor_source.h b/gr-blocks/include/gnuradio/blocks/file_descriptor_source.h index ac827800cd..24e6028892 100644 --- a/gr-blocks/include/blocks/file_descriptor_source.h +++ b/gr-blocks/include/gnuradio/blocks/file_descriptor_source.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H #define INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { @@ -34,7 +34,7 @@ namespace gr { * \brief Read stream from file descriptor. * \ingroup file_operators_blk */ - class BLOCKS_API file_descriptor_source : virtual public gr_sync_block + class BLOCKS_API file_descriptor_source : virtual public sync_block { protected: virtual int read_items(char *buf, int nitems) = 0; @@ -42,7 +42,7 @@ namespace gr { virtual void flush_residue() = 0; public: - // gr::blocks::file_descriptor_source::sptr + // gr::gnuradio/blocks::file_descriptor_source::sptr typedef boost::shared_ptr<file_descriptor_source> sptr; /*! diff --git a/gr-blocks/include/blocks/file_meta_sink.h b/gr-blocks/include/gnuradio/blocks/file_meta_sink.h index 763e0a2da0..10230008a3 100644 --- a/gr-blocks/include/blocks/file_meta_sink.h +++ b/gr-blocks/include/gnuradio/blocks/file_meta_sink.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_FILE_META_SINK_H #define INCLUDED_BLOCKS_FILE_META_SINK_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -67,10 +67,10 @@ namespace gr { * the data segment starts plus the data segment size. Following * will either be a new header or EOF. */ - class BLOCKS_API file_meta_sink : virtual public gr_sync_block + class BLOCKS_API file_meta_sink : virtual public sync_block { public: - // gr::blocks::file_meta_sink::sptr + // gr::gnuradio/blocks::file_meta_sink::sptr typedef boost::shared_ptr<file_meta_sink> sptr; /*! diff --git a/gr-blocks/include/blocks/file_meta_source.h b/gr-blocks/include/gnuradio/blocks/file_meta_source.h index 83997fc9b5..38b6a43d86 100644 --- a/gr-blocks/include/blocks/file_meta_source.h +++ b/gr-blocks/include/gnuradio/blocks/file_meta_source.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_FILE_META_SOURCE_H #define INCLUDED_BLOCKS_FILE_META_SOURCE_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -48,10 +48,10 @@ namespace gr { * Any item inside of the extra header dictionary is ready out and * made into a stream tag. */ - class BLOCKS_API file_meta_source : virtual public gr_sync_block + class BLOCKS_API file_meta_source : virtual public sync_block { public: - // gr::blocks::file_meta_source::sptr + // gr::gnuradio/blocks::file_meta_source::sptr typedef boost::shared_ptr<file_meta_source> sptr; /*! diff --git a/gr-blocks/include/blocks/file_sink.h b/gr-blocks/include/gnuradio/blocks/file_sink.h index c894defd78..7ea2889835 100644 --- a/gr-blocks/include/blocks/file_sink.h +++ b/gr-blocks/include/gnuradio/blocks/file_sink.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_FILE_SINK_H #define INCLUDED_GR_FILE_SINK_H -#include <blocks/api.h> -#include <blocks/file_sink_base.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/blocks/file_sink_base.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -34,11 +34,11 @@ namespace gr { * \brief Write stream to file. * \ingroup file_operators_blk */ - class BLOCKS_API file_sink : virtual public gr_sync_block, + class BLOCKS_API file_sink : virtual public sync_block, virtual public file_sink_base { public: - // gr::blocks::file_sink::sptr + // gr::gnuradio/blocks::file_sink::sptr typedef boost::shared_ptr<file_sink> sptr; /*! diff --git a/gr-blocks/include/blocks/file_sink_base.h b/gr-blocks/include/gnuradio/blocks/file_sink_base.h index 3eeb0e63da..812da6dfae 100644 --- a/gr-blocks/include/blocks/file_sink_base.h +++ b/gr-blocks/include/gnuradio/blocks/file_sink_base.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_FILE_SINK_BASE_H #define INCLUDED_GR_FILE_SINK_BASE_H -#include <blocks/api.h> +#include <gnuradio/blocks/api.h> #include <boost/thread.hpp> #include <cstdio> diff --git a/gr-blocks/include/blocks/file_source.h b/gr-blocks/include/gnuradio/blocks/file_source.h index 6f1bc49ea1..3ed2747c3e 100644 --- a/gr-blocks/include/blocks/file_source.h +++ b/gr-blocks/include/gnuradio/blocks/file_source.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_FILE_SOURCE_H #define INCLUDED_BLOCKS_FILE_SOURCE_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,11 +33,11 @@ namespace gr { * \brief Read stream from file * \ingroup file_operators_blk */ - class BLOCKS_API file_source : virtual public gr_sync_block + class BLOCKS_API file_source : virtual public sync_block { public: - // gr::blocks::file_source::sptr + // gr::gnuradio/blocks::file_source::sptr typedef boost::shared_ptr<file_source> sptr; /*! diff --git a/gr-blocks/include/blocks/float_to_char.h b/gr-blocks/include/gnuradio/blocks/float_to_char.h index c0193da573..5933606088 100644 --- a/gr-blocks/include/blocks/float_to_char.h +++ b/gr-blocks/include/gnuradio/blocks/float_to_char.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_FLOAT_TO_CHAR_H #define INCLUDED_BLOCKS_FLOAT_TO_CHAR_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Convert stream of floats to a stream of char * \ingroup type_converters_blk */ - class BLOCKS_API float_to_char : virtual public gr_sync_block + class BLOCKS_API float_to_char : virtual public sync_block { public: - // gr::blocks::float_to_char_ff::sptr + // gr::gnuradio/blocks::float_to_char_ff::sptr typedef boost::shared_ptr<float_to_char> sptr; /*! diff --git a/gr-blocks/include/blocks/float_to_complex.h b/gr-blocks/include/gnuradio/blocks/float_to_complex.h index aba9aed8c4..c8a97f1fb7 100644 --- a/gr-blocks/include/blocks/float_to_complex.h +++ b/gr-blocks/include/gnuradio/blocks/float_to_complex.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_FLOAT_TO_COMPLEX_H #define INCLUDED_BLOCKS_FLOAT_TO_COMPLEX_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief one or two floats in, complex out * \ingroup type_converters_blk */ - class BLOCKS_API float_to_complex : virtual public gr_sync_block + class BLOCKS_API float_to_complex : virtual public sync_block { public: - // gr::blocks::float_to_complex_ff::sptr + // gr::gnuradio/blocks::float_to_complex_ff::sptr typedef boost::shared_ptr<float_to_complex> sptr; /*! diff --git a/gr-blocks/include/blocks/float_to_int.h b/gr-blocks/include/gnuradio/blocks/float_to_int.h index 3c8e7ad5ab..0d82b7e5c5 100644 --- a/gr-blocks/include/blocks/float_to_int.h +++ b/gr-blocks/include/gnuradio/blocks/float_to_int.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_FLOAT_TO_INT_H #define INCLUDED_BLOCKS_FLOAT_TO_INT_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Convert stream of floats to a stream of ints. * \ingroup type_converters_blk */ - class BLOCKS_API float_to_int : virtual public gr_sync_block + class BLOCKS_API float_to_int : virtual public sync_block { public: - // gr::blocks::float_to_int_ff::sptr + // gr::gnuradio/blocks::float_to_int_ff::sptr typedef boost::shared_ptr<float_to_int> sptr; /*! diff --git a/gr-blocks/include/blocks/float_to_short.h b/gr-blocks/include/gnuradio/blocks/float_to_short.h index 8f5f60e55b..ad62189dd2 100644 --- a/gr-blocks/include/blocks/float_to_short.h +++ b/gr-blocks/include/gnuradio/blocks/float_to_short.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_FLOAT_TO_SHORT_H #define INCLUDED_BLOCKS_FLOAT_TO_SHORT_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Convert stream of floats to a stream of shorts * \ingroup type_converters_blk */ - class BLOCKS_API float_to_short : virtual public gr_sync_block + class BLOCKS_API float_to_short : virtual public sync_block { public: - // gr::blocks::float_to_short_ff::sptr + // gr::gnuradio/blocks::float_to_short_ff::sptr typedef boost::shared_ptr<float_to_short> sptr; /*! diff --git a/gr-blocks/include/blocks/float_to_uchar.h b/gr-blocks/include/gnuradio/blocks/float_to_uchar.h index 9bfaaa65aa..3a34079bc1 100644 --- a/gr-blocks/include/blocks/float_to_uchar.h +++ b/gr-blocks/include/gnuradio/blocks/float_to_uchar.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_FLOAT_TO_UCHAR_H #define INCLUDED_BLOCKS_FLOAT_TO_UCHAR_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,11 +33,11 @@ namespace gr { * \brief Convert stream of floats to a stream of unsigned chars * \ingroup type_converters_blk */ - class BLOCKS_API float_to_uchar : virtual public gr_sync_block + class BLOCKS_API float_to_uchar : virtual public sync_block { public: - // gr::blocks::float_to_uchar_ff::sptr + // gr::gnuradio/blocks::float_to_uchar_ff::sptr typedef boost::shared_ptr<float_to_uchar> sptr; /*! diff --git a/gr-blocks/include/blocks/head.h b/gr-blocks/include/gnuradio/blocks/head.h index 4693f988b8..f4a870908a 100644 --- a/gr-blocks/include/blocks/head.h +++ b/gr-blocks/include/gnuradio/blocks/head.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_HEAD_H #define INCLUDED_GR_HEAD_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> #include <stddef.h> // size_t namespace gr { @@ -37,10 +37,10 @@ namespace gr { * \details * Useful for building test cases */ - class BLOCKS_API head : virtual public gr_sync_block + class BLOCKS_API head : virtual public sync_block { public: - // gr::blocks::head::sptr + // gr::gnuradio/blocks::head::sptr typedef boost::shared_ptr<head> sptr; static sptr make(size_t sizeof_stream_item, diff --git a/gr-blocks/include/blocks/int_to_float.h b/gr-blocks/include/gnuradio/blocks/int_to_float.h index 179667e4df..6813449a95 100644 --- a/gr-blocks/include/blocks/int_to_float.h +++ b/gr-blocks/include/gnuradio/blocks/int_to_float.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_INT_TO_FLOAT_H #define INCLUDED_BLOCKS_INT_TO_FLOAT_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Convert stream of ints to a stream of floats. * \ingroup type_converters_blk */ - class BLOCKS_API int_to_float : virtual public gr_sync_block + class BLOCKS_API int_to_float : virtual public sync_block { public: - // gr::blocks::int_to_float_ff::sptr + // gr::gnuradio/blocks::int_to_float_ff::sptr typedef boost::shared_ptr<int_to_float> sptr; /*! diff --git a/gr-blocks/include/blocks/integrate_XX.h.t b/gr-blocks/include/gnuradio/blocks/integrate_XX.h.t index 45a49def0c..343ab1ef6c 100644 --- a/gr-blocks/include/blocks/integrate_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/integrate_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace blocks { @@ -35,7 +35,7 @@ namespace gr { * \brief Integrate successive samples and decimate * \ingroup math_operators_blk */ - class BLOCKS_API @NAME@ : virtual public gr_sync_decimator + class BLOCKS_API @NAME@ : virtual public sync_decimator { public: diff --git a/gr-blocks/include/blocks/interleave.h b/gr-blocks/include/gnuradio/blocks/interleave.h index 043ad6d27b..a2aa2fc6c2 100644 --- a/gr-blocks/include/blocks/interleave.h +++ b/gr-blocks/include/gnuradio/blocks/interleave.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_INTERLEAVE_H #define INCLUDED_BLOCKS_INTERLEAVE_H -#include <blocks/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief interleave N inputs into a single output * \ingroup stream_operators_blk */ - class BLOCKS_API interleave : virtual public gr_sync_interpolator + class BLOCKS_API interleave : virtual public sync_interpolator { public: - // gr::blocks::interleave::sptr + // gr::gnuradio/blocks::interleave::sptr typedef boost::shared_ptr<interleave> sptr; /*! diff --git a/gr-blocks/include/blocks/interleaved_short_to_complex.h b/gr-blocks/include/gnuradio/blocks/interleaved_short_to_complex.h index 44b6dfcdf4..38caaf7ffa 100644 --- a/gr-blocks/include/blocks/interleaved_short_to_complex.h +++ b/gr-blocks/include/gnuradio/blocks/interleaved_short_to_complex.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_INTERLEAVED_SHORT_TO_COMPLEX_H #define INCLUDED_BLOCKS_INTERLEAVED_SHORT_TO_COMPLEX_H -#include <blocks/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Convert stream of interleaved shorts to a stream of complex * \ingroup type_converters_blk */ - class BLOCKS_API interleaved_short_to_complex : virtual public gr_sync_decimator + class BLOCKS_API interleaved_short_to_complex : virtual public sync_decimator { public: - // gr::blocks::interleaved_short_to_complex::sptr + // gr::gnuradio/blocks::interleaved_short_to_complex::sptr typedef boost::shared_ptr<interleaved_short_to_complex> sptr; /*! diff --git a/gr-blocks/include/blocks/keep_m_in_n.h b/gr-blocks/include/gnuradio/blocks/keep_m_in_n.h index 88d94fab85..4a1de48331 100644 --- a/gr-blocks/include/blocks/keep_m_in_n.h +++ b/gr-blocks/include/gnuradio/blocks/keep_m_in_n.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_KEEP_M_IN_N_H #define INCLUDED_BLOCKS_KEEP_M_IN_N_H -#include <blocks/api.h> -#include <gr_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> namespace gr { namespace blocks { @@ -33,11 +33,11 @@ namespace gr { * \brief decimate a stream, keeping \p m items out of every \p n. * \ingroup stream_operators_blk */ - class BLOCKS_API keep_m_in_n : virtual public gr_block + class BLOCKS_API keep_m_in_n : virtual public block { public: - // gr::blocks::keep_m_in_n::sptr + // gr::gnuradio/blocks::keep_m_in_n::sptr typedef boost::shared_ptr<keep_m_in_n> sptr; /*! diff --git a/gr-blocks/include/blocks/keep_one_in_n.h b/gr-blocks/include/gnuradio/blocks/keep_one_in_n.h index 9cce1e93ed..bc63bf9383 100644 --- a/gr-blocks/include/blocks/keep_one_in_n.h +++ b/gr-blocks/include/gnuradio/blocks/keep_one_in_n.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_KEEP_ONE_IN_N_H #define INCLUDED_BLOCKS_KEEP_ONE_IN_N_H -#include <blocks/api.h> -#include <gr_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> namespace gr { namespace blocks { @@ -33,11 +33,11 @@ namespace gr { * \brief decimate a stream, keeping one item out of every \p n. * \ingroup stream_operators_blk */ - class BLOCKS_API keep_one_in_n : virtual public gr_block + class BLOCKS_API keep_one_in_n : virtual public block { public: - // gr::blocks::keep_one_in_n::sptr + // gr::gnuradio/blocks::keep_one_in_n::sptr typedef boost::shared_ptr<keep_one_in_n> sptr; /*! diff --git a/gr-blocks/include/blocks/lfsr_15_1_0.h b/gr-blocks/include/gnuradio/blocks/lfsr_15_1_0.h index b906844585..2ebfe08319 100644 --- a/gr-blocks/include/blocks/lfsr_15_1_0.h +++ b/gr-blocks/include/gnuradio/blocks/lfsr_15_1_0.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GRI_LFSR_15_1_0_H #define INCLUDED_GRI_LFSR_15_1_0_H -#include <blocks/api.h> +#include <gnuradio/blocks/api.h> namespace gr { namespace blocks { diff --git a/gr-blocks/include/blocks/lfsr_32k.h b/gr-blocks/include/gnuradio/blocks/lfsr_32k.h index 23954139d8..502efebc5d 100644 --- a/gr-blocks/include/blocks/lfsr_32k.h +++ b/gr-blocks/include/gnuradio/blocks/lfsr_32k.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GRI_LFSR_32k_H #define INCLUDED_GRI_LFSR_32k_H -#include <blocks/api.h> -#include <blocks/lfsr_15_1_0.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/blocks/lfsr_15_1_0.h> namespace gr { namespace blocks { diff --git a/gr-blocks/include/blocks/lfsr_32k_source_s.h b/gr-blocks/include/gnuradio/blocks/lfsr_32k_source_s.h index 9cc32fc2c9..39f4f4b7c6 100644 --- a/gr-blocks/include/blocks/lfsr_32k_source_s.h +++ b/gr-blocks/include/gnuradio/blocks/lfsr_32k_source_s.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_LFSR_32K_SOURCE_S_H #define INCLUDED_GR_LFSR_32K_SOURCE_S_H -#include <blocks/api.h> -#include <blocks/lfsr_32k.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/blocks/lfsr_32k.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -38,10 +38,10 @@ namespace gr { * This source is typically used along with gr::blocks::check_lfsr_32k_s to * test the USRP using its digital loopback mode. */ - class BLOCKS_API lfsr_32k_source_s : virtual public gr_sync_block + class BLOCKS_API lfsr_32k_source_s : virtual public sync_block { public: - // gr::blocks::lfsr_32k_source_s::sptr + // gr::gnuradio/blocks::lfsr_32k_source_s::sptr typedef boost::shared_ptr<lfsr_32k_source_s> sptr; /*! diff --git a/gr-blocks/include/blocks/log2_const.h b/gr-blocks/include/gnuradio/blocks/log2_const.h index 67d63810fc..c2526e76ed 100644 --- a/gr-blocks/include/blocks/log2_const.h +++ b/gr-blocks/include/gnuradio/blocks/log2_const.h @@ -27,7 +27,7 @@ #ifndef INCLUDED_BLOCKS_LOG2_CONST_H #define INCLUDED_BLOCKS_LOG2_CONST_H -#include <blocks/api.h> +#include <gnuradio/blocks/api.h> #include <assert.h> namespace gr { diff --git a/gr-blocks/include/blocks/max_XX.h.t b/gr-blocks/include/gnuradio/blocks/max_XX.h.t index 738d7bb938..44b3ad4878 100644 --- a/gr-blocks/include/blocks/max_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/max_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -43,7 +43,7 @@ namespace gr { * Stream 0 will contain the index value in the vector where * the maximum value occurred. */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: // gr::blocks::@NAME@::sptr diff --git a/gr-blocks/include/blocks/message_burst_source.h b/gr-blocks/include/gnuradio/blocks/message_burst_source.h index 72997abf2c..0e7527cbe0 100644 --- a/gr-blocks/include/blocks/message_burst_source.h +++ b/gr-blocks/include/gnuradio/blocks/message_burst_source.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_MESSAGE_BURST_SOURCE_H #define INCLUDED_GR_MESSAGE_BURST_SOURCE_H -#include <blocks/api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> namespace gr { namespace blocks { @@ -34,16 +34,16 @@ namespace gr { * \brief Turn received messages into a stream and tag them for UHD to send. * \ingroup message_tools_blk */ - class BLOCKS_API message_burst_source : virtual public gr_sync_block + class BLOCKS_API message_burst_source : virtual public sync_block { public: - // gr::blocks::message_source::sptr + // gr::gnuradio/blocks::message_source::sptr typedef boost::shared_ptr<message_burst_source> sptr; static sptr make(size_t itemsize, int msgq_limit); - static sptr make(size_t itemsize, gr_msg_queue_sptr msgq); + static sptr make(size_t itemsize, gr::msg_queue::sptr msgq); - virtual gr_msg_queue_sptr msgq() const = 0; + virtual gr::msg_queue::sptr msgq() const = 0; }; } /* namespace blocks */ diff --git a/gr-blocks/include/blocks/message_debug.h b/gr-blocks/include/gnuradio/blocks/message_debug.h index 59a778ba49..cc9612542c 100644 --- a/gr-blocks/include/blocks/message_debug.h +++ b/gr-blocks/include/gnuradio/blocks/message_debug.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_MESSAGE_DEBUG_H #define INCLUDED_GR_MESSAGE_DEBUG_H -#include <blocks/api.h> -#include <gr_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> namespace gr { namespace blocks { @@ -48,10 +48,10 @@ namespace gr { * \li print_pdu: specifically designed to handle formatted PDUs * (see pdu.h). */ - class BLOCKS_API message_debug : virtual public gr_block + class BLOCKS_API message_debug : virtual public block { public: - // gr::blocks::message_debug::sptr + // gr::gnuradio/blocks::message_debug::sptr typedef boost::shared_ptr<message_debug> sptr; /*! diff --git a/gr-blocks/include/blocks/message_sink.h b/gr-blocks/include/gnuradio/blocks/message_sink.h index aec636e3cf..60eaa84497 100644 --- a/gr-blocks/include/blocks/message_sink.h +++ b/gr-blocks/include/gnuradio/blocks/message_sink.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_MESSAGE_SINK_H #define INCLUDED_GR_MESSAGE_SINK_H -#include <blocks/api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> namespace gr { namespace blocks { @@ -34,14 +34,14 @@ namespace gr { * \brief Gather received items into messages and insert into msgq * \ingroup message_tools_blk */ - class BLOCKS_API message_sink : virtual public gr_sync_block + class BLOCKS_API message_sink : virtual public sync_block { public: - // gr::blocks::message_sink::sptr + // gr::gnuradio/blocks::message_sink::sptr typedef boost::shared_ptr<message_sink> sptr; - static sptr make(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block); - static sptr make(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block, + static sptr make(size_t itemsize, gr::msg_queue::sptr msgq, bool dont_block); + static sptr make(size_t itemsize, gr::msg_queue::sptr msgq, bool dont_block, const std::string& lengthtagname); }; diff --git a/gr-blocks/include/blocks/message_source.h b/gr-blocks/include/gnuradio/blocks/message_source.h index 2aa3ddaa35..af21d7333f 100644 --- a/gr-blocks/include/blocks/message_source.h +++ b/gr-blocks/include/gnuradio/blocks/message_source.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_MESSAGE_SOURCE_H #define INCLUDED_GR_MESSAGE_SOURCE_H -#include <blocks/api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> namespace gr { namespace blocks { @@ -34,18 +34,18 @@ namespace gr { * \brief Turn received messages into a stream * \ingroup message_tools_blk */ - class BLOCKS_API message_source : virtual public gr_sync_block + class BLOCKS_API message_source : virtual public sync_block { public: - // gr::blocks::message_source::sptr + // gr::gnuradio/blocks::message_source::sptr typedef boost::shared_ptr<message_source> sptr; static sptr make(size_t itemsize, int msgq_limit=0); - static sptr make(size_t itemsize, gr_msg_queue_sptr msgq); - static sptr make(size_t itemsize, gr_msg_queue_sptr msgq, + static sptr make(size_t itemsize, gr::msg_queue::sptr msgq); + static sptr make(size_t itemsize, gr::msg_queue::sptr msgq, const std::string& lengthtagname); - virtual gr_msg_queue_sptr msgq() const = 0; + virtual gr::msg_queue::sptr msgq() const = 0; }; } /* namespace blocks */ diff --git a/gr-blocks/include/blocks/message_strobe.h b/gr-blocks/include/gnuradio/blocks/message_strobe.h index abd9b73596..07b6833b43 100644 --- a/gr-blocks/include/blocks/message_strobe.h +++ b/gr-blocks/include/gnuradio/blocks/message_strobe.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_MESSAGE_STROBE_H #define INCLUDED_GR_MESSAGE_STROBE_H -#include <blocks/api.h> -#include <gr_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> namespace gr { namespace blocks { @@ -37,10 +37,10 @@ namespace gr { * Takes a PMT message and sends it out every \p period_ms * milliseconds. Useful for testing/debugging the message system. */ - class BLOCKS_API message_strobe : virtual public gr_block + class BLOCKS_API message_strobe : virtual public block { public: - // gr::blocks::message_strobe::sptr + // gr::gnuradio/blocks::message_strobe::sptr typedef boost::shared_ptr<message_strobe> sptr; /*! diff --git a/gr-blocks/include/blocks/moving_average_XX.h.t b/gr-blocks/include/gnuradio/blocks/moving_average_XX.h.t index 5b996bd4d5..37472f70d7 100644 --- a/gr-blocks/include/blocks/moving_average_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/moving_average_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -35,7 +35,7 @@ namespace gr { * \brief output is the moving sum of the last N samples, scaled by the scale factor * \ingroup level_controllers_blk */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: // gr::blocks::@NAME@::sptr diff --git a/gr-blocks/include/blocks/multiply_XX.h.t b/gr-blocks/include/gnuradio/blocks/multiply_XX.h.t index 4ad25d35e9..1071b5b5c5 100644 --- a/gr-blocks/include/blocks/multiply_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/multiply_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -38,7 +38,7 @@ namespace gr { * \details * Multiply across all input streams. */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: diff --git a/gr-blocks/include/blocks/multiply_cc.h b/gr-blocks/include/gnuradio/blocks/multiply_cc.h index 79533c2dc6..c6116b6452 100644 --- a/gr-blocks/include/blocks/multiply_cc.h +++ b/gr-blocks/include/gnuradio/blocks/multiply_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_MULTIPLY_CC_H #define INCLUDED_GR_MULTIPLY_CC_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -36,11 +36,11 @@ namespace gr { * \details * Multiply across all input streams. */ - class BLOCKS_API multiply_cc : virtual public gr_sync_block + class BLOCKS_API multiply_cc : virtual public sync_block { public: - // gr::blocks::multiply_cc::sptr + // gr::gnuradio/blocks::multiply_cc::sptr typedef boost::shared_ptr<multiply_cc> sptr; /*! diff --git a/gr-blocks/include/blocks/multiply_conjugate_cc.h b/gr-blocks/include/gnuradio/blocks/multiply_conjugate_cc.h index 7fa46f891e..43101bf441 100644 --- a/gr-blocks/include/blocks/multiply_conjugate_cc.h +++ b/gr-blocks/include/gnuradio/blocks/multiply_conjugate_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_MULTIPLY_CONJUGATE_CC_H #define INCLUDED_GR_MULTIPLY_CONJUGATE_CC_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,11 +33,11 @@ namespace gr { * \brief Multiplies stream 0 by the complex conjugate of stream 1. * \ingroup math_operators_blk */ - class BLOCKS_API multiply_conjugate_cc : virtual public gr_sync_block + class BLOCKS_API multiply_conjugate_cc : virtual public sync_block { public: - // gr::blocks::multiply_conjugate_cc::sptr + // gr::gnuradio/blocks::multiply_conjugate_cc::sptr typedef boost::shared_ptr<multiply_conjugate_cc> sptr; /*! diff --git a/gr-blocks/include/blocks/multiply_const_XX.h.t b/gr-blocks/include/gnuradio/blocks/multiply_const_XX.h.t index 4f5ac5c5a6..d1bc76c3b3 100644 --- a/gr-blocks/include/blocks/multiply_const_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/multiply_const_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -35,7 +35,7 @@ namespace gr { * \brief output = input * constant * \ingroup math_operators_blk */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: diff --git a/gr-blocks/include/blocks/multiply_const_cc.h b/gr-blocks/include/gnuradio/blocks/multiply_const_cc.h index 3469b4df17..d24c1135c3 100644 --- a/gr-blocks/include/blocks/multiply_const_cc.h +++ b/gr-blocks/include/gnuradio/blocks/multiply_const_cc.h @@ -25,8 +25,8 @@ #ifndef INCLUDED_MULTIPLY_CONST_CC_H #define INCLUDED_MULTIPLY_CONST_CC_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -35,12 +35,12 @@ namespace gr { * \brief output = input * complex constant * \ingroup math_operators_blk */ - class BLOCKS_API multiply_const_cc : virtual public gr_sync_block + class BLOCKS_API multiply_const_cc : virtual public sync_block { public: - // gr::blocks::multiply_const_cc::sptr + // gr::gnuradio/blocks::multiply_const_cc::sptr typedef boost::shared_ptr<multiply_const_cc> sptr; /*! diff --git a/gr-blocks/include/blocks/multiply_const_ff.h b/gr-blocks/include/gnuradio/blocks/multiply_const_ff.h index 627e0c39a6..0fc81dc38f 100644 --- a/gr-blocks/include/blocks/multiply_const_ff.h +++ b/gr-blocks/include/gnuradio/blocks/multiply_const_ff.h @@ -25,8 +25,8 @@ #ifndef INCLUDED_MULTIPLY_CONST_FF_H #define INCLUDED_MULTIPLY_CONST_FF_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -35,12 +35,12 @@ namespace gr { * \brief output = input * real constant * \ingroup math_operators_blk */ - class BLOCKS_API multiply_const_ff : virtual public gr_sync_block + class BLOCKS_API multiply_const_ff : virtual public sync_block { public: - // gr::blocks::multiply_const_ff::sptr + // gr::gnuradio/blocks::multiply_const_ff::sptr typedef boost::shared_ptr<multiply_const_ff> sptr; /*! diff --git a/gr-blocks/include/blocks/multiply_const_vXX.h.t b/gr-blocks/include/gnuradio/blocks/multiply_const_vXX.h.t index 4cd479f009..40f0b06dd1 100644 --- a/gr-blocks/include/blocks/multiply_const_vXX.h.t +++ b/gr-blocks/include/gnuradio/blocks/multiply_const_vXX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -35,7 +35,7 @@ namespace gr { * \brief output = input * constant vector (element-wise) * \ingroup math_blk */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: diff --git a/gr-blocks/include/blocks/multiply_ff.h b/gr-blocks/include/gnuradio/blocks/multiply_ff.h index ef3f5109bd..b7ee6ca430 100644 --- a/gr-blocks/include/blocks/multiply_ff.h +++ b/gr-blocks/include/gnuradio/blocks/multiply_ff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_MULTIPLY_FF_H #define INCLUDED_GR_MULTIPLY_FF_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -36,11 +36,11 @@ namespace gr { * \details * Multiply across all input streams. */ - class BLOCKS_API multiply_ff : virtual public gr_sync_block + class BLOCKS_API multiply_ff : virtual public sync_block { public: - // gr::blocks::multiply_ff::sptr + // gr::gnuradio/blocks::multiply_ff::sptr typedef boost::shared_ptr<multiply_ff> sptr; /*! diff --git a/gr-blocks/include/blocks/mute_XX.h.t b/gr-blocks/include/gnuradio/blocks/mute_XX.h.t index b9a394df2f..ab246c54b5 100644 --- a/gr-blocks/include/blocks/mute_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/mute_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -35,7 +35,7 @@ namespace gr { * \brief output = input or zero if muted. * \ingroup level_controllers_blk */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: // gr::blocks::@NAME@::sptr diff --git a/gr-blocks/include/blocks/nlog10_ff.h b/gr-blocks/include/gnuradio/blocks/nlog10_ff.h index 7c4dfd8962..642cf987bd 100644 --- a/gr-blocks/include/blocks/nlog10_ff.h +++ b/gr-blocks/include/gnuradio/blocks/nlog10_ff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_NLOG10_FF_H #define INCLUDED_BLOCKS_NLOG10_FF_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,11 +33,11 @@ namespace gr { * \brief output = n*log10(input) + k * \ingroup math_operators_blk */ - class BLOCKS_API nlog10_ff : virtual public gr_sync_block + class BLOCKS_API nlog10_ff : virtual public sync_block { public: - // gr::blocks::nlog10_ff::sptr + // gr::gnuradio/blocks::nlog10_ff::sptr typedef boost::shared_ptr<nlog10_ff> sptr; /*! diff --git a/gr-blocks/include/blocks/nop.h b/gr-blocks/include/gnuradio/blocks/nop.h index a75adad621..20ca0532a9 100644 --- a/gr-blocks/include/blocks/nop.h +++ b/gr-blocks/include/gnuradio/blocks/nop.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_NOP_H #define INCLUDED_GR_NOP_H -#include <blocks/api.h> -#include <gr_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> #include <stddef.h> // size_t namespace gr { @@ -34,10 +34,10 @@ namespace gr { * \brief Does nothing. Used for testing only. * \ingroup misc_blk */ - class BLOCKS_API nop : virtual public gr_block + class BLOCKS_API nop : virtual public block { public: - // gr::blocks::nop::sptr + // gr::gnuradio/blocks::nop::sptr typedef boost::shared_ptr<nop> sptr; /*! diff --git a/gr-blocks/include/blocks/not_XX.h.t b/gr-blocks/include/gnuradio/blocks/not_XX.h.t index fc06327722..2c32237ce5 100644 --- a/gr-blocks/include/blocks/not_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/not_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -37,7 +37,7 @@ namespace gr { * * bitwise boolean not of input streams. */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: diff --git a/gr-blocks/include/blocks/null_sink.h b/gr-blocks/include/gnuradio/blocks/null_sink.h index 8e772ab61f..840d58aade 100644 --- a/gr-blocks/include/blocks/null_sink.h +++ b/gr-blocks/include/gnuradio/blocks/null_sink.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_NULL_SINK_H #define INCLUDED_GR_NULL_SINK_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> #include <stddef.h> // size_t namespace gr { @@ -35,10 +35,10 @@ namespace gr { * required and we don't want to do anything real. * \ingroup misc_blk */ - class BLOCKS_API null_sink : virtual public gr_sync_block + class BLOCKS_API null_sink : virtual public sync_block { public: - // gr::blocks::null_sink::sptr + // gr::gnuradio/blocks::null_sink::sptr typedef boost::shared_ptr<null_sink> sptr; /*! diff --git a/gr-blocks/include/blocks/null_source.h b/gr-blocks/include/gnuradio/blocks/null_source.h index fc782c1cb5..387c649f45 100644 --- a/gr-blocks/include/blocks/null_source.h +++ b/gr-blocks/include/gnuradio/blocks/null_source.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_NULL_SOURCE_H #define INCLUDED_GR_NULL_SOURCE_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief A source of zeros used mainly for testing. * \ingroup misc_blk */ - class BLOCKS_API null_source : virtual public gr_sync_block + class BLOCKS_API null_source : virtual public sync_block { public: - // gr::blocks::null_source::sptr + // gr::gnuradio/blocks::null_source::sptr typedef boost::shared_ptr<null_source> sptr; /*! diff --git a/gr-blocks/include/blocks/or_XX.h.t b/gr-blocks/include/gnuradio/blocks/or_XX.h.t index 67afe54ea9..d485f04962 100644 --- a/gr-blocks/include/blocks/or_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/or_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -37,7 +37,7 @@ namespace gr { * * Bitwise boolean or across all input streams. */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: diff --git a/gr-blocks/include/blocks/pack_k_bits_bb.h b/gr-blocks/include/gnuradio/blocks/pack_k_bits_bb.h index 41ae4bc418..584ea6361e 100644 --- a/gr-blocks/include/blocks/pack_k_bits_bb.h +++ b/gr-blocks/include/gnuradio/blocks/pack_k_bits_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_PACK_K_BITS_BB_H #define INCLUDED_GR_PACK_K_BITS_BB_H -#include <blocks/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace blocks { @@ -34,10 +34,10 @@ namespace gr { * byte with k relevent bits. * \ingroup byte_operators_blk */ - class BLOCKS_API pack_k_bits_bb : virtual public gr_sync_decimator + class BLOCKS_API pack_k_bits_bb : virtual public sync_decimator { public: - // gr::blocks::pack_k_bits_bb::sptr + // gr::gnuradio/blocks::pack_k_bits_bb::sptr typedef boost::shared_ptr<pack_k_bits_bb> sptr; /*! diff --git a/gr-blocks/include/blocks/packed_to_unpacked_XX.h.t b/gr-blocks/include/gnuradio/blocks/packed_to_unpacked_XX.h.t index d8edba2297..98b7df2658 100644 --- a/gr-blocks/include/blocks/packed_to_unpacked_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/packed_to_unpacked_XX.h.t @@ -25,9 +25,9 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_block.h> -#include <gr_endianness.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> +#include <gnuradio/endianness.h> namespace gr { namespace blocks { @@ -58,14 +58,14 @@ namespace gr { * \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc. * \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc. */ - class BLOCKS_API @NAME@ : virtual public gr_block + class BLOCKS_API @NAME@ : virtual public block { public: // gr::blocks::@NAME@::sptr typedef boost::shared_ptr<@NAME@> sptr; static sptr make(unsigned int bits_per_chunk, - gr_endianness_t endianness); + endianness_t endianness); }; } /* namespace blocks */ diff --git a/gr-blocks/include/blocks/patterned_interleaver.h b/gr-blocks/include/gnuradio/blocks/patterned_interleaver.h index 01e9a0d58f..ad3d1e9c8e 100644 --- a/gr-blocks/include/blocks/patterned_interleaver.h +++ b/gr-blocks/include/gnuradio/blocks/patterned_interleaver.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_PATTERNED_INTERLEAVER_H #define INCLUDED_BLOCKS_PATTERNED_INTERLEAVER_H -#include <blocks/api.h> -#include <gr_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> namespace gr { namespace blocks { @@ -33,7 +33,7 @@ namespace gr { * \brief Interleave items based on the provided vector \p pattern. * \ingroup stream_operators_blk */ - class BLOCKS_API patterned_interleaver : virtual public gr_block + class BLOCKS_API patterned_interleaver : virtual public block { public: typedef boost::shared_ptr<patterned_interleaver> sptr; diff --git a/gr-blocks/include/blocks/pdu.h b/gr-blocks/include/gnuradio/blocks/pdu.h index 8890c5cb17..decc5e17d0 100644 --- a/gr-blocks/include/blocks/pdu.h +++ b/gr-blocks/include/gnuradio/blocks/pdu.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_PDU_H #define INCLUDED_BLOCKS_PDU_H -#include <blocks/api.h> -#include <gr_complex.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/gr_complex.h> #include <pmt/pmt.h> #define PDU_PORT_ID pmt::mp("pdus") diff --git a/gr-blocks/include/blocks/pdu_to_tagged_stream.h b/gr-blocks/include/gnuradio/blocks/pdu_to_tagged_stream.h index 6a26673149..758d7412db 100644 --- a/gr-blocks/include/blocks/pdu_to_tagged_stream.h +++ b/gr-blocks/include/gnuradio/blocks/pdu_to_tagged_stream.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_BLOCKS_PDU_TO_TAGGED_STREAM_H #define INCLUDED_BLOCKS_PDU_TO_TAGGED_STREAM_H -#include <blocks/api.h> -#include <blocks/pdu.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/blocks/pdu.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -34,10 +34,10 @@ namespace gr { * \brief Turns received PDUs into a tagged stream of items * \ingroup message_tools_blk */ - class BLOCKS_API pdu_to_tagged_stream : virtual public gr_sync_block + class BLOCKS_API pdu_to_tagged_stream : virtual public sync_block { public: - // gr::blocks::pdu_to_tagged_stream::sptr + // gr::gnuradio/blocks::pdu_to_tagged_stream::sptr typedef boost::shared_ptr<pdu_to_tagged_stream> sptr; /*! diff --git a/gr-blocks/include/blocks/peak_detector2_fb.h b/gr-blocks/include/gnuradio/blocks/peak_detector2_fb.h index aa30d46a04..84b8a74a72 100644 --- a/gr-blocks/include/blocks/peak_detector2_fb.h +++ b/gr-blocks/include/gnuradio/blocks/peak_detector2_fb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_PEAK_DETECTOR2_FB_H #define INCLUDED_GR_PEAK_DETECTOR2_FB_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -38,10 +38,10 @@ namespace gr { * 0's. A separate debug output may be connected, to view the * internal EWMA described below. */ - class BLOCKS_API peak_detector2_fb : virtual public gr_sync_block + class BLOCKS_API peak_detector2_fb : virtual public sync_block { public: - // gr::blocks::peak_detector2_fb::sptr + // gr::gnuradio/blocks::peak_detector2_fb::sptr typedef boost::shared_ptr<peak_detector2_fb> sptr; /*! diff --git a/gr-blocks/include/blocks/peak_detector_XX.h.t b/gr-blocks/include/gnuradio/blocks/peak_detector_XX.h.t index 8d42f42ea8..6bf14320a0 100644 --- a/gr-blocks/include/blocks/peak_detector_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/peak_detector_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -39,7 +39,7 @@ namespace gr { * If a peak is detected, this block outputs a 1, * or it outputs 0's. */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: // gr::blocks::@NAME@::sptr diff --git a/gr-blocks/include/blocks/plateau_detector_fb.h b/gr-blocks/include/gnuradio/blocks/plateau_detector_fb.h index 119262d396..3f5ea189e9 100644 --- a/gr-blocks/include/blocks/plateau_detector_fb.h +++ b/gr-blocks/include/gnuradio/blocks/plateau_detector_fb.h @@ -24,8 +24,8 @@ #ifndef INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H #define INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -51,7 +51,7 @@ namespace gr { * An implicit hysteresis is provided by the fact that after detecting one plateau, * it waits at least max_len samples before the next plateau can be detected. */ - class BLOCKS_API plateau_detector_fb : virtual public gr_sync_block + class BLOCKS_API plateau_detector_fb : virtual public sync_block { public: typedef boost::shared_ptr<plateau_detector_fb> sptr; diff --git a/gr-blocks/include/blocks/probe_rate.h b/gr-blocks/include/gnuradio/blocks/probe_rate.h index fc0b9f29d4..7789de1925 100644 --- a/gr-blocks/include/blocks/probe_rate.h +++ b/gr-blocks/include/gnuradio/blocks/probe_rate.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_PROBE_RATE_H #define INCLUDED_BLOCKS_PROBE_RATE_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief throughput measurement * \ingroup measurement_tools_blk */ - class BLOCKS_API probe_rate : virtual public gr_sync_block + class BLOCKS_API probe_rate : virtual public sync_block { public: - // gr::blocks::probe_rate::sptr + // gr::gnuradio/blocks::probe_rate::sptr typedef boost::shared_ptr<probe_rate> sptr; /*! diff --git a/gr-blocks/include/blocks/probe_signal_X.h.t b/gr-blocks/include/gnuradio/blocks/probe_signal_X.h.t index fb0d84bb41..5398411a73 100644 --- a/gr-blocks/include/blocks/probe_signal_X.h.t +++ b/gr-blocks/include/gnuradio/blocks/probe_signal_X.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -35,7 +35,7 @@ namespace gr { * \brief Sink that allows a sample to be grabbed from Python. * \ingroup measurement_tools_blk */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: // gr::blocks::@NAME@::sptr diff --git a/gr-blocks/include/blocks/probe_signal_vX.h.t b/gr-blocks/include/gnuradio/blocks/probe_signal_vX.h.t index 77462dc658..05e0137953 100644 --- a/gr-blocks/include/blocks/probe_signal_vX.h.t +++ b/gr-blocks/include/gnuradio/blocks/probe_signal_vX.h.t @@ -26,8 +26,8 @@ #define @GUARD_NAME@ #include <vector> -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -37,7 +37,7 @@ namespace gr { * \ingroup sink_blk * \ingroup measurement_tools_blk */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: // gr::blocks::@NAME@::sptr diff --git a/gr-blocks/include/blocks/random_pdu.h b/gr-blocks/include/gnuradio/blocks/random_pdu.h index 6cc7afaae3..6ffdd86a9e 100644 --- a/gr-blocks/include/blocks/random_pdu.h +++ b/gr-blocks/include/gnuradio/blocks/random_pdu.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_RANDOM_PDU_H #define INCLUDED_BLOCKS_RANDOM_PDU_H -#include <blocks/api.h> -#include <gr_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> namespace gr { namespace blocks { @@ -34,10 +34,10 @@ namespace gr { * \ingroup message_tools_blk * \ingroup debug_tools_blk */ - class BLOCKS_API random_pdu : virtual public gr_block + class BLOCKS_API random_pdu : virtual public block { public: - // gr::blocks::random_pdu::sptr + // gr::gnuradio/blocks::random_pdu::sptr typedef boost::shared_ptr<random_pdu> sptr; /*! diff --git a/gr-blocks/include/blocks/regenerate_bb.h b/gr-blocks/include/gnuradio/blocks/regenerate_bb.h index a2cc76737e..0ff8b4c9d1 100644 --- a/gr-blocks/include/blocks/regenerate_bb.h +++ b/gr-blocks/include/gnuradio/blocks/regenerate_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_REGENERATE_BB_H #define INCLUDED_GR_REGENERATE_BB_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -41,10 +41,10 @@ namespace gr { * Note that if max_regen=(-1)/ULONG_MAX then the regeneration * will run forever. */ - class BLOCKS_API regenerate_bb : virtual public gr_sync_block + class BLOCKS_API regenerate_bb : virtual public sync_block { public: - // gr::blocks::regenerate_bb::sptr + // gr::gnuradio/blocks::regenerate_bb::sptr typedef boost::shared_ptr<regenerate_bb> sptr; /*! diff --git a/gr-blocks/include/blocks/repack_bits_bb.h b/gr-blocks/include/gnuradio/blocks/repack_bits_bb.h index f33d4bdf8e..c594966e6e 100644 --- a/gr-blocks/include/blocks/repack_bits_bb.h +++ b/gr-blocks/include/gnuradio/blocks/repack_bits_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_REPACK_BITS_BB_H #define INCLUDED_BLOCKS_REPACK_BITS_BB_H -#include <blocks/api.h> -#include <gr_tagged_stream_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/tagged_stream_block.h> namespace gr { namespace blocks { @@ -44,7 +44,7 @@ namespace gr { * bits is not an integer multiple of \p l, or bits are truncated from the input * if \p align_output is set to true. */ - class BLOCKS_API repack_bits_bb : virtual public gr_tagged_stream_block + class BLOCKS_API repack_bits_bb : virtual public tagged_stream_block { public: typedef boost::shared_ptr<repack_bits_bb> sptr; diff --git a/gr-blocks/include/blocks/repeat.h b/gr-blocks/include/gnuradio/blocks/repeat.h index b353205541..50a3daf38f 100644 --- a/gr-blocks/include/blocks/repeat.h +++ b/gr-blocks/include/gnuradio/blocks/repeat.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_REPEAT_H #define INCLUDED_BLOCKS_REPEAT_H -#include <blocks/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief repeat each input \p repeat times * \ingroup stream_operators_blk */ - class BLOCKS_API repeat : virtual public gr_sync_interpolator + class BLOCKS_API repeat : virtual public sync_interpolator { public: - // gr::blocks::repeat::sptr + // gr::gnuradio/blocks::repeat::sptr typedef boost::shared_ptr<repeat> sptr; /*! diff --git a/gr-blocks/include/blocks/rms_cf.h b/gr-blocks/include/gnuradio/blocks/rms_cf.h index 94a17f7a67..f10a19521a 100644 --- a/gr-blocks/include/blocks/rms_cf.h +++ b/gr-blocks/include/gnuradio/blocks/rms_cf.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_RMS_CF_H #define INCLUDED_BLOCKS_RMS_CF_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief RMS average power * \ingroup math_operators_blk */ - class BLOCKS_API rms_cf : virtual public gr_sync_block + class BLOCKS_API rms_cf : virtual public sync_block { public: - // gr::blocks::rms_cf::sptr + // gr::gnuradio/blocks::rms_cf::sptr typedef boost::shared_ptr<rms_cf> sptr; /*! diff --git a/gr-blocks/include/blocks/rms_ff.h b/gr-blocks/include/gnuradio/blocks/rms_ff.h index e202d79f2c..60b0c50f9d 100644 --- a/gr-blocks/include/blocks/rms_ff.h +++ b/gr-blocks/include/gnuradio/blocks/rms_ff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_RMS_FF_H #define INCLUDED_BLOCKS_RMS_FF_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief RMS average power * \ingroup math_operators_blk */ - class BLOCKS_API rms_ff : virtual public gr_sync_block + class BLOCKS_API rms_ff : virtual public sync_block { public: - // gr::blocks::rms_ff::sptr + // gr::gnuradio/blocks::rms_ff::sptr typedef boost::shared_ptr<rms_ff> sptr; /*! diff --git a/gr-blocks/include/blocks/rotator.h b/gr-blocks/include/gnuradio/blocks/rotator.h index 918e86edd2..975bfc62aa 100644 --- a/gr-blocks/include/blocks/rotator.h +++ b/gr-blocks/include/gnuradio/blocks/rotator.h @@ -23,8 +23,8 @@ #ifndef _GR_ROTATOR_H_ #define _GR_ROTATOR_H_ -#include <blocks/api.h> -#include <gr_complex.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/gr_complex.h> namespace gr { namespace blocks { diff --git a/gr-blocks/include/blocks/sample_and_hold_XX.h.t b/gr-blocks/include/gnuradio/blocks/sample_and_hold_XX.h.t index 0d2ecdc5d7..2f15b2490f 100644 --- a/gr-blocks/include/blocks/sample_and_hold_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/sample_and_hold_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -39,7 +39,7 @@ namespace gr { * Samples the data stream (input stream 0) and holds the value if * the control signal is 1 (intput stream 1). */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: // gr::blocks::@NAME@::sptr diff --git a/gr-blocks/include/blocks/short_to_char.h b/gr-blocks/include/gnuradio/blocks/short_to_char.h index 09e784f101..f6073ea46f 100644 --- a/gr-blocks/include/blocks/short_to_char.h +++ b/gr-blocks/include/gnuradio/blocks/short_to_char.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_SHORT_TO_CHAR_H #define INCLUDED_BLOCKS_SHORT_TO_CHAR_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Convert stream of shorts to a stream of chars. * \ingroup type_converters_blk */ - class BLOCKS_API short_to_char : virtual public gr_sync_block + class BLOCKS_API short_to_char : virtual public sync_block { public: - // gr::blocks::short_to_char_ff::sptr + // gr::gnuradio/blocks::short_to_char_ff::sptr typedef boost::shared_ptr<short_to_char> sptr; /*! diff --git a/gr-blocks/include/blocks/short_to_float.h b/gr-blocks/include/gnuradio/blocks/short_to_float.h index ec85e892ed..7d5c2caac9 100644 --- a/gr-blocks/include/blocks/short_to_float.h +++ b/gr-blocks/include/gnuradio/blocks/short_to_float.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_SHORT_TO_FLOAT_H #define INCLUDED_BLOCKS_SHORT_TO_FLOAT_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Convert stream of shorts to a stream of floats * \ingroup type_converters_blk */ - class BLOCKS_API short_to_float : virtual public gr_sync_block + class BLOCKS_API short_to_float : virtual public sync_block { public: - // gr::blocks::short_to_float_ff::sptr + // gr::gnuradio/blocks::short_to_float_ff::sptr typedef boost::shared_ptr<short_to_float> sptr; /*! diff --git a/gr-blocks/include/blocks/skiphead.h b/gr-blocks/include/gnuradio/blocks/skiphead.h index 27a8afea92..1d3a019d72 100644 --- a/gr-blocks/include/blocks/skiphead.h +++ b/gr-blocks/include/gnuradio/blocks/skiphead.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_SKIPHEAD_H #define INCLUDED_GR_SKIPHEAD_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> #include <stddef.h> // size_t namespace gr { @@ -38,10 +38,10 @@ namespace gr { * Useful for building test cases and sources which have metadata * or junk at the start */ - class BLOCKS_API skiphead : virtual public gr_block + class BLOCKS_API skiphead : virtual public block { public: - // gr::blocks::skiphead::sptr + // gr::gnuradio/blocks::skiphead::sptr typedef boost::shared_ptr<skiphead> sptr; static sptr make(size_t itemsize, diff --git a/gr-blocks/include/blocks/socket_pdu.h b/gr-blocks/include/gnuradio/blocks/socket_pdu.h index f72d303c75..906d1aba0b 100644 --- a/gr-blocks/include/blocks/socket_pdu.h +++ b/gr-blocks/include/gnuradio/blocks/socket_pdu.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_SOCKET_PDU_H #define INCLUDED_BLOCKS_SOCKET_PDU_H -#include <blocks/api.h> -#include <gr_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Creates socket interface and translates traffic to PDUs * \ingroup networking_tools_blk */ - class BLOCKS_API socket_pdu : virtual public gr_block + class BLOCKS_API socket_pdu : virtual public block { public: - // gr::blocks::socket_pdu::sptr + // gr::gnuradio/blocks::socket_pdu::sptr typedef boost::shared_ptr<socket_pdu> sptr; /*! diff --git a/gr-blocks/include/blocks/stream_mux.h b/gr-blocks/include/gnuradio/blocks/stream_mux.h index 0e29aab364..67f5874c3a 100644 --- a/gr-blocks/include/blocks/stream_mux.h +++ b/gr-blocks/include/gnuradio/blocks/stream_mux.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_STREAM_MUX_H #define INCLUDED_BLOCKS_STREAM_MUX_H -#include <blocks/api.h> -#include <gr_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> #include <vector> namespace gr { @@ -42,11 +42,11 @@ namespace gr { * * [N0, N1, N2, ..., Nm, N0, N1, ...] */ - class BLOCKS_API stream_mux : virtual public gr_block + class BLOCKS_API stream_mux : virtual public block { public: - // gr::blocks::stream_mux::sptr + // gr::gnuradio/blocks::stream_mux::sptr typedef boost::shared_ptr<stream_mux> sptr; /*! diff --git a/gr-blocks/include/blocks/stream_to_streams.h b/gr-blocks/include/gnuradio/blocks/stream_to_streams.h index e9b257575f..cef660c3ba 100644 --- a/gr-blocks/include/blocks/stream_to_streams.h +++ b/gr-blocks/include/gnuradio/blocks/stream_to_streams.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_STREAM_TO_STREAMS_H #define INCLUDED_BLOCKS_STREAM_TO_STREAMS_H -#include <blocks/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace blocks { @@ -37,10 +37,10 @@ namespace gr { * Converts a stream of N items into N streams of 1 item. * Repeat ad infinitum. */ - class BLOCKS_API stream_to_streams : virtual public gr_sync_decimator + class BLOCKS_API stream_to_streams : virtual public sync_decimator { public: - // gr::blocks::stream_to_streams::sptr + // gr::gnuradio/blocks::stream_to_streams::sptr typedef boost::shared_ptr<stream_to_streams> sptr; /*! diff --git a/gr-blocks/include/blocks/stream_to_vector.h b/gr-blocks/include/gnuradio/blocks/stream_to_vector.h index 98325500b1..d059693945 100644 --- a/gr-blocks/include/blocks/stream_to_vector.h +++ b/gr-blocks/include/gnuradio/blocks/stream_to_vector.h @@ -23,20 +23,20 @@ #ifndef INCLUDED_BLOCKS_STREAM_TO_VECTOR_H #define INCLUDED_BLOCKS_STREAM_TO_VECTOR_H -#include <blocks/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace blocks { /*! - * \brief convert a stream of items into a stream of blocks containing nitems_per_block + * \brief convert a stream of items into a stream of gnuradio/blocks containing nitems_per_block * \ingroup stream_operators_blk */ - class BLOCKS_API stream_to_vector : virtual public gr_sync_decimator + class BLOCKS_API stream_to_vector : virtual public sync_decimator { public: - // gr::blocks::stream_to_vector::sptr + // gr::gnuradio/blocks::stream_to_vector::sptr typedef boost::shared_ptr<stream_to_vector> sptr; /*! diff --git a/gr-blocks/include/blocks/streams_to_stream.h b/gr-blocks/include/gnuradio/blocks/streams_to_stream.h index e677a18e2a..ba6d04a38e 100644 --- a/gr-blocks/include/blocks/streams_to_stream.h +++ b/gr-blocks/include/gnuradio/blocks/streams_to_stream.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_STREAMS_TO_STREAM_H #define INCLUDED_BLOCKS_STREAMS_TO_STREAM_H -#include <blocks/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace blocks { @@ -37,10 +37,10 @@ namespace gr { * Convert N streams of 1 item into 1 stream of N items. * Repeat ad infinitum. */ - class BLOCKS_API streams_to_stream : virtual public gr_sync_interpolator + class BLOCKS_API streams_to_stream : virtual public sync_interpolator { public: - // gr::blocks::streams_to_stream::sptr + // gr::gnuradio/blocks::streams_to_stream::sptr typedef boost::shared_ptr<streams_to_stream> sptr; /*! diff --git a/gr-blocks/include/blocks/streams_to_vector.h b/gr-blocks/include/gnuradio/blocks/streams_to_vector.h index f4df16c9f4..5954bdf07f 100644 --- a/gr-blocks/include/blocks/streams_to_vector.h +++ b/gr-blocks/include/gnuradio/blocks/streams_to_vector.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_STREAMS_TO_VECTOR_H #define INCLUDED_BLOCKS_STREAMS_TO_VECTOR_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief convert N streams of items to 1 stream of vector length N * \ingroup stream_operators_blk */ - class BLOCKS_API streams_to_vector : virtual public gr_sync_block + class BLOCKS_API streams_to_vector : virtual public sync_block { public: - // gr::blocks::streams_to_vector::sptr + // gr::gnuradio/blocks::streams_to_vector::sptr typedef boost::shared_ptr<streams_to_vector> sptr; /*! diff --git a/gr-blocks/include/blocks/stretch_ff.h b/gr-blocks/include/gnuradio/blocks/stretch_ff.h index 47bcb9ee87..86f366935e 100644 --- a/gr-blocks/include/blocks/stretch_ff.h +++ b/gr-blocks/include/gnuradio/blocks/stretch_ff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_STRETCH_FF_H #define INCLUDED_GR_STRETCH_FF_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -35,10 +35,10 @@ namespace gr { * signature matching by normalizing spectrum dynamic ranges. * \ingroup stream_operators_blk */ - class BLOCKS_API stretch_ff : virtual public gr_sync_block + class BLOCKS_API stretch_ff : virtual public sync_block { public: - // gr::blocks::stretch_ff::sptr + // gr::gnuradio/blocks::stretch_ff::sptr typedef boost::shared_ptr<stretch_ff> sptr; /*! diff --git a/gr-blocks/include/blocks/sub_XX.h.t b/gr-blocks/include/gnuradio/blocks/sub_XX.h.t index db854346f6..ecc55fc865 100644 --- a/gr-blocks/include/blocks/sub_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/sub_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -38,7 +38,7 @@ namespace gr { * \details * Subtract across all input streams. */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: diff --git a/gr-blocks/include/blocks/tag_debug.h b/gr-blocks/include/gnuradio/blocks/tag_debug.h index 8093a6152f..88dfb1b726 100644 --- a/gr-blocks/include/blocks/tag_debug.h +++ b/gr-blocks/include/gnuradio/blocks/tag_debug.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_TAG_DEBUG_H #define INCLUDED_GR_TAG_DEBUG_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -50,10 +50,10 @@ namespace gr { * The tags from the last call to this work function are stored * and can be retrieved using the function 'current_tags'. */ - class BLOCKS_API tag_debug : virtual public gr_sync_block + class BLOCKS_API tag_debug : virtual public sync_block { public: - // gr::blocks::tag_debug::sptr + // gr::gnuradio/blocks::tag_debug::sptr typedef boost::shared_ptr<tag_debug> sptr; /*! @@ -66,10 +66,10 @@ namespace gr { const std::string &name); /*! - * \brief Returns a vector of gr_tag_t items as of the last call to + * \brief Returns a vector of tag_t items as of the last call to * work. */ - virtual std::vector<gr_tag_t> current_tags() = 0; + virtual std::vector<tag_t> current_tags() = 0; /*! * \brief Set the display of tags to stdout on/off. diff --git a/gr-blocks/include/blocks/tagged_file_sink.h b/gr-blocks/include/gnuradio/blocks/tagged_file_sink.h index 2014b66964..287ecb8246 100644 --- a/gr-blocks/include/blocks/tagged_file_sink.h +++ b/gr-blocks/include/gnuradio/blocks/tagged_file_sink.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_TAGGED_FILE_SINK_H #define INCLUDED_GR_TAGGED_FILE_SINK_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -45,10 +45,10 @@ namespace gr { * found, the new time is calculated based off the sample rate of * the block. */ - class BLOCKS_API tagged_file_sink : virtual public gr_sync_block + class BLOCKS_API tagged_file_sink : virtual public sync_block { public: - // gr::blocks::tagged_file_sink::sptr + // gr::gnuradio/blocks::tagged_file_sink::sptr typedef boost::shared_ptr<tagged_file_sink> sptr; /*! diff --git a/gr-blocks/include/blocks/tagged_stream_mux.h b/gr-blocks/include/gnuradio/blocks/tagged_stream_mux.h index 2fa9b3f01d..73a02f9e1d 100644 --- a/gr-blocks/include/blocks/tagged_stream_mux.h +++ b/gr-blocks/include/gnuradio/blocks/tagged_stream_mux.h @@ -22,8 +22,8 @@ #ifndef INCLUDED_TAGGED_STREAM_MUX_H #define INCLUDED_TAGGED_STREAM_MUX_H -#include <blocks/api.h> -#include <gr_tagged_stream_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/tagged_stream_block.h> namespace gr { namespace blocks { @@ -42,7 +42,7 @@ namespace gr { * All other tags are propagated as expected, i.e. they stay associated * with the same input item. */ - class BLOCKS_API tagged_stream_mux : virtual public gr_tagged_stream_block + class BLOCKS_API tagged_stream_mux : virtual public tagged_stream_block { public: typedef boost::shared_ptr<tagged_stream_mux> sptr; diff --git a/gr-blocks/include/blocks/tagged_stream_to_pdu.h b/gr-blocks/include/gnuradio/blocks/tagged_stream_to_pdu.h index b990c44ab1..9b0f24a535 100644 --- a/gr-blocks/include/blocks/tagged_stream_to_pdu.h +++ b/gr-blocks/include/gnuradio/blocks/tagged_stream_to_pdu.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_BLOCKS_TAGGED_STREAM_TO_PDU_H #define INCLUDED_BLOCKS_TAGGED_STREAM_TO_PDU_H -#include <blocks/api.h> -#include <blocks/pdu.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/blocks/pdu.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -34,10 +34,10 @@ namespace gr { * \brief Turns received stream data and tags into PDUs * \ingroup message_tools_blk */ - class BLOCKS_API tagged_stream_to_pdu : virtual public gr_sync_block + class BLOCKS_API tagged_stream_to_pdu : virtual public sync_block { public: - // gr::blocks::tagged_stream_to_pdu::sptr + // gr::gnuradio/blocks::tagged_stream_to_pdu::sptr typedef boost::shared_ptr<tagged_stream_to_pdu> sptr; /*! diff --git a/gr-blocks/include/blocks/threshold_ff.h b/gr-blocks/include/gnuradio/blocks/threshold_ff.h index 6a20e7ed43..253041b83a 100644 --- a/gr-blocks/include/blocks/threshold_ff.h +++ b/gr-blocks/include/gnuradio/blocks/threshold_ff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_THRESHOLD_FF_H #define INCLUDED_GR_THRESHOLD_FF_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -38,10 +38,10 @@ namespace gr { * excedes the \p hi value, it will output a 1 until the signal * falls below the \p lo value. */ - class BLOCKS_API threshold_ff : virtual public gr_sync_block + class BLOCKS_API threshold_ff : virtual public sync_block { public: - // gr::blocks::threshold_ff::sptr + // gr::gnuradio/blocks::threshold_ff::sptr typedef boost::shared_ptr<threshold_ff> sptr; /* \brief Create a threadshold block. diff --git a/gr-blocks/include/blocks/throttle.h b/gr-blocks/include/gnuradio/blocks/throttle.h index d9d9f311c4..662582e0ba 100644 --- a/gr-blocks/include/blocks/throttle.h +++ b/gr-blocks/include/gnuradio/blocks/throttle.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_THROTTLE_H #define INCLUDED_GR_THROTTLE_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -43,7 +43,7 @@ namespace gr { * controlled by a source or sink tied to sample clock. E.g., a * USRP or audio card. */ - class BLOCKS_API throttle : virtual public gr_sync_block + class BLOCKS_API throttle : virtual public sync_block { public: typedef boost::shared_ptr<throttle> sptr; diff --git a/gr-blocks/include/blocks/transcendental.h b/gr-blocks/include/gnuradio/blocks/transcendental.h index a3a483e8f3..9d7a1e70e2 100644 --- a/gr-blocks/include/blocks/transcendental.h +++ b/gr-blocks/include/gnuradio/blocks/transcendental.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_TRANSCENDENTAL_H #define INCLUDED_GR_TRANSCENDENTAL_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> #include <string> namespace gr { @@ -42,10 +42,10 @@ namespace gr { * * output[i] = trans_fcn(input[i]) */ - class BLOCKS_API transcendental : virtual public gr_sync_block + class BLOCKS_API transcendental : virtual public sync_block { public: - // gr::blocks::transcendental::sptr + // gr::gnuradio/blocks::transcendental::sptr typedef boost::shared_ptr<transcendental> sptr; static sptr make(const std::string &name, diff --git a/gr-blocks/include/blocks/tuntap_pdu.h b/gr-blocks/include/gnuradio/blocks/tuntap_pdu.h index afa03cfb82..53d9371bc4 100644 --- a/gr-blocks/include/blocks/tuntap_pdu.h +++ b/gr-blocks/include/gnuradio/blocks/tuntap_pdu.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_TUNTAP_PDU_H #define INCLUDED_BLOCKS_TUNTAP_PDU_H -#include <blocks/api.h> -#include <gr_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Creates TUNTAP interface and translates traffic to PDUs * \ingroup networking_tools_blk */ - class BLOCKS_API tuntap_pdu : virtual public gr_block + class BLOCKS_API tuntap_pdu : virtual public block { public: - // gr::blocks::tuntap_pdu::sptr + // gr::gnuradio/blocks::tuntap_pdu::sptr typedef boost::shared_ptr<tuntap_pdu> sptr; /*! diff --git a/gr-blocks/include/blocks/uchar_to_float.h b/gr-blocks/include/gnuradio/blocks/uchar_to_float.h index 725c4e5021..a978a76958 100644 --- a/gr-blocks/include/blocks/uchar_to_float.h +++ b/gr-blocks/include/gnuradio/blocks/uchar_to_float.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_UCHAR_TO_FLOAT_H #define INCLUDED_BLOCKS_UCHAR_TO_FLOAT_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Convert stream of unsigned chars to a stream of floats * \ingroup type_converters_blk */ - class BLOCKS_API uchar_to_float : virtual public gr_sync_block + class BLOCKS_API uchar_to_float : virtual public sync_block { public: - // gr::blocks::uchar_to_float_ff::sptr + // gr::gnuradio/blocks::uchar_to_float_ff::sptr typedef boost::shared_ptr<uchar_to_float> sptr; /*! diff --git a/gr-blocks/include/blocks/udp_sink.h b/gr-blocks/include/gnuradio/blocks/udp_sink.h index 9530217515..d9360938e2 100644 --- a/gr-blocks/include/blocks/udp_sink.h +++ b/gr-blocks/include/gnuradio/blocks/udp_sink.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_UDP_SINK_H #define INCLUDED_GR_UDP_SINK_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Write stream to an UDP socket. * \ingroup networking_tools_blk */ - class BLOCKS_API udp_sink : virtual public gr_sync_block + class BLOCKS_API udp_sink : virtual public sync_block { public: - // gr::blocks::udp_sink::sptr + // gr::gnuradio/blocks::udp_sink::sptr typedef boost::shared_ptr<udp_sink> sptr; /*! diff --git a/gr-blocks/include/blocks/udp_source.h b/gr-blocks/include/gnuradio/blocks/udp_source.h index 4681b0b54a..e5534bc328 100644 --- a/gr-blocks/include/blocks/udp_source.h +++ b/gr-blocks/include/gnuradio/blocks/udp_source.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_UDP_SOURCE_H #define INCLUDED_GR_UDP_SOURCE_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Read stream from an UDP socket. * \ingroup networking_tools_blk */ - class BLOCKS_API udp_source : virtual public gr_sync_block + class BLOCKS_API udp_source : virtual public sync_block { public: - // gr::blocks::udp_source::sptr + // gr::gnuradio/blocks::udp_source::sptr typedef boost::shared_ptr<udp_source> sptr; /*! diff --git a/gr-blocks/include/blocks/unpack_k_bits_bb.h b/gr-blocks/include/gnuradio/blocks/unpack_k_bits_bb.h index a36cfb50e4..942973f60d 100644 --- a/gr-blocks/include/blocks/unpack_k_bits_bb.h +++ b/gr-blocks/include/gnuradio/blocks/unpack_k_bits_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_UNPACK_K_BITS_BB_H #define INCLUDED_GR_UNPACK_K_BITS_BB_H -#include <blocks/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Converts a byte with k relevent bits to k output bytes with 1 bit in the LSB. * \ingroup byte_operators_blk */ - class BLOCKS_API unpack_k_bits_bb : virtual public gr_sync_interpolator + class BLOCKS_API unpack_k_bits_bb : virtual public sync_interpolator { public: - // gr::blocks::unpack_k_bits_bb::sptr + // gr::gnuradio/blocks::unpack_k_bits_bb::sptr typedef boost::shared_ptr<unpack_k_bits_bb> sptr; /*! diff --git a/gr-blocks/include/blocks/unpacked_to_packed_XX.h.t b/gr-blocks/include/gnuradio/blocks/unpacked_to_packed_XX.h.t index 649b9082fb..194d79e0d2 100644 --- a/gr-blocks/include/blocks/unpacked_to_packed_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/unpacked_to_packed_XX.h.t @@ -25,9 +25,9 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_block.h> -#include <gr_endianness.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> +#include <gnuradio/endianness.h> namespace gr { namespace blocks { @@ -57,14 +57,14 @@ namespace gr { * \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc. * \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc. */ - class BLOCKS_API @NAME@ : virtual public gr_block + class BLOCKS_API @NAME@ : virtual public block { public: // gr::blocks::@NAME@::sptr typedef boost::shared_ptr<@NAME@> sptr; static sptr make(unsigned int bits_per_chunk, - gr_endianness_t endianness); + endianness_t endianness); }; } /* namespace blocks */ diff --git a/gr-blocks/include/blocks/vco_f.h b/gr-blocks/include/gnuradio/blocks/vco_f.h index 7245f4c96b..c0fe5cd51c 100644 --- a/gr-blocks/include/blocks/vco_f.h +++ b/gr-blocks/include/gnuradio/blocks/vco_f.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_VCO_F_H #define INCLUDED_GR_VCO_F_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -37,10 +37,10 @@ namespace gr { * \details * input: float stream of control voltages; output: float oscillator output */ - class BLOCKS_API vco_f : virtual public gr_sync_block + class BLOCKS_API vco_f : virtual public sync_block { public: - // gr::blocks::vco_f::sptr + // gr::gnuradio/blocks::vco_f::sptr typedef boost::shared_ptr<vco_f> sptr; /*! diff --git a/gr-blocks/include/blocks/vector_insert_X.h.t b/gr-blocks/include/gnuradio/blocks/vector_insert_X.h.t index c45e5152fa..8b26b0b9b0 100644 --- a/gr-blocks/include/blocks/vector_insert_X.h.t +++ b/gr-blocks/include/gnuradio/blocks/vector_insert_X.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> namespace gr { namespace blocks { @@ -35,7 +35,7 @@ namespace gr { * \brief source of @TYPE@'s that gets its data from a vector * \ingroup stream_operators_blk */ - class BLOCKS_API @NAME@ : virtual public gr_block + class BLOCKS_API @NAME@ : virtual public block { public: // gr::blocks::@NAME@::sptr diff --git a/gr-blocks/include/blocks/vector_map.h b/gr-blocks/include/gnuradio/blocks/vector_map.h index 77a7fc1865..4819d52696 100644 --- a/gr-blocks/include/blocks/vector_map.h +++ b/gr-blocks/include/gnuradio/blocks/vector_map.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_VECTOR_MAP_H #define INCLUDED_GR_VECTOR_MAP_H -#include <blocks/api.h> +#include <gnuradio/blocks/api.h> #include <vector> -#include <gr_sync_block.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -45,10 +45,10 @@ namespace gr { * form (element1_mapping, element2_mapping, ...) and * element1_mapping is of the form (in_stream, in_element). */ - class BLOCKS_API vector_map : virtual public gr_sync_block + class BLOCKS_API vector_map : virtual public sync_block { public: - // gr::blocks::vector_map::sptr + // gr::gnuradio/blocks::vector_map::sptr typedef boost::shared_ptr<vector_map> sptr; /*! diff --git a/gr-blocks/include/blocks/vector_sink_X.h.t b/gr-blocks/include/gnuradio/blocks/vector_sink_X.h.t index 1d17700f5f..527ebf7dff 100644 --- a/gr-blocks/include/blocks/vector_sink_X.h.t +++ b/gr-blocks/include/gnuradio/blocks/vector_sink_X.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -35,7 +35,7 @@ namespace gr { * \brief @TYPE@ sink that writes to a vector * \ingroup debug_tools_blk */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: // gr::blocks::@NAME@::sptr @@ -45,7 +45,7 @@ namespace gr { virtual void reset() = 0; virtual std::vector<@TYPE@> data() const = 0; - virtual std::vector<gr_tag_t> tags() const = 0; + virtual std::vector<tag_t> tags() const = 0; }; } /* namespace blocks */ diff --git a/gr-blocks/include/blocks/vector_source_X.h.t b/gr-blocks/include/gnuradio/blocks/vector_source_X.h.t index 8d3693f3ee..7ff18ad083 100644 --- a/gr-blocks/include/blocks/vector_source_X.h.t +++ b/gr-blocks/include/gnuradio/blocks/vector_source_X.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -35,7 +35,7 @@ namespace gr { * \brief source of @TYPE@'s that gets its data from a vector * \ingroup misc_blk */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: // gr::blocks::@NAME@::sptr @@ -43,11 +43,11 @@ namespace gr { static sptr make(const std::vector<@TYPE@> &data, bool repeat=false, int vlen=1, - const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>()); + const std::vector<tag_t> &tags=std::vector<tag_t>()); virtual void rewind() = 0; virtual void set_data(const std::vector<@TYPE@> &data, - const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>()) = 0; + const std::vector<tag_t> &tags=std::vector<tag_t>()) = 0; }; } /* namespace blocks */ diff --git a/gr-blocks/include/blocks/vector_to_stream.h b/gr-blocks/include/gnuradio/blocks/vector_to_stream.h index 2a02704287..3b08bd08b5 100644 --- a/gr-blocks/include/blocks/vector_to_stream.h +++ b/gr-blocks/include/gnuradio/blocks/vector_to_stream.h @@ -23,20 +23,20 @@ #ifndef INCLUDED_BLOCKS_VECTOR_TO_STREAM_H #define INCLUDED_BLOCKS_VECTOR_TO_STREAM_H -#include <blocks/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace blocks { /*! - * \brief convert a stream of blocks of nitems_per_block items into a stream of items + * \brief convert a stream of gnuradio/blocks of nitems_per_block items into a stream of items * \ingroup stream_operators_blk */ - class BLOCKS_API vector_to_stream : virtual public gr_sync_interpolator + class BLOCKS_API vector_to_stream : virtual public sync_interpolator { public: - // gr::blocks::vector_to_stream::sptr + // gr::gnuradio/blocks::vector_to_stream::sptr typedef boost::shared_ptr<vector_to_stream> sptr; /*! diff --git a/gr-blocks/include/blocks/vector_to_streams.h b/gr-blocks/include/gnuradio/blocks/vector_to_streams.h index 364bc9afbd..ce10ed3155 100644 --- a/gr-blocks/include/blocks/vector_to_streams.h +++ b/gr-blocks/include/gnuradio/blocks/vector_to_streams.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_BLOCKS_VECTOR_TO_STREAMS_H #define INCLUDED_BLOCKS_VECTOR_TO_STREAMS_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -33,10 +33,10 @@ namespace gr { * \brief Convert 1 stream of vectors of length N to N streams of items * \ingroup stream_operators_blk */ - class BLOCKS_API vector_to_streams : virtual public gr_sync_block + class BLOCKS_API vector_to_streams : virtual public sync_block { public: - // gr::blocks::vector_to_streams::sptr + // gr::gnuradio/blocks::vector_to_streams::sptr typedef boost::shared_ptr<vector_to_streams> sptr; /*! diff --git a/gr-blocks/include/blocks/wavfile.h b/gr-blocks/include/gnuradio/blocks/wavfile.h index 719ef92253..f0c8a4c1e7 100644 --- a/gr-blocks/include/blocks/wavfile.h +++ b/gr-blocks/include/gnuradio/blocks/wavfile.h @@ -21,9 +21,9 @@ */ // This file stores all the RIFF file type knowledge for the wavfile_* -// blocks. +// gnuradio/blocks. -#include <blocks/api.h> +#include <gnuradio/blocks/api.h> #include <cstdio> namespace gr { diff --git a/gr-blocks/include/blocks/wavfile_sink.h b/gr-blocks/include/gnuradio/blocks/wavfile_sink.h index f380e055a2..97550bfa98 100644 --- a/gr-blocks/include/blocks/wavfile_sink.h +++ b/gr-blocks/include/gnuradio/blocks/wavfile_sink.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_WAVFILE_SINK_H #define INCLUDED_GR_WAVFILE_SINK_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -37,10 +37,10 @@ namespace gr { * Values must be floats within [-1;1]. * Check gr_make_wavfile_sink() for extra info. */ - class BLOCKS_API wavfile_sink : virtual public gr_sync_block + class BLOCKS_API wavfile_sink : virtual public sync_block { public: - // gr::blocks::wavfile_sink::sptr + // gr::gnuradio/blocks::wavfile_sink::sptr typedef boost::shared_ptr<wavfile_sink> sptr; /* diff --git a/gr-blocks/include/blocks/wavfile_source.h b/gr-blocks/include/gnuradio/blocks/wavfile_source.h index 5332a0c20e..b8fe4988f1 100644 --- a/gr-blocks/include/blocks/wavfile_source.h +++ b/gr-blocks/include/gnuradio/blocks/wavfile_source.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_WAVFILE_SOURCE_H #define INCLUDED_GR_WAVFILE_SOURCE_H -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -37,10 +37,10 @@ namespace gr { * Unless otherwise called, values are within [-1;1]. * Check gr_make_wavfile_source() for extra info. */ - class BLOCKS_API wavfile_source : virtual public gr_sync_block + class BLOCKS_API wavfile_source : virtual public sync_block { public: - // gr::blocks::wavfile_source::sptr + // gr::gnuradio/blocks::wavfile_source::sptr typedef boost::shared_ptr<wavfile_source> sptr; static sptr make(const char *filename, bool repeat = false); diff --git a/gr-blocks/include/blocks/xor_XX.h.t b/gr-blocks/include/gnuradio/blocks/xor_XX.h.t index a890dbaf89..fa32192e76 100644 --- a/gr-blocks/include/blocks/xor_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/xor_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <blocks/api.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { @@ -37,7 +37,7 @@ namespace gr { * * Bitwise boolean xor across all input streams. */ - class BLOCKS_API @NAME@ : virtual public gr_sync_block + class BLOCKS_API @NAME@ : virtual public sync_block { public: diff --git a/gr-blocks/lib/add_XX_impl.cc.t b/gr-blocks/lib/add_XX_impl.cc.t index c528e2fbff..281dcea050 100644 --- a/gr-blocks/lib/add_XX_impl.cc.t +++ b/gr-blocks/lib/add_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(size_t vlen) - : gr_sync_block ("@NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)), + : sync_block ("@NAME@", + io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen), + io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)), d_vlen(vlen) { } diff --git a/gr-blocks/lib/add_XX_impl.h.t b/gr-blocks/lib/add_XX_impl.h.t index 2e20ef5fe3..22292b9fa5 100644 --- a/gr-blocks/lib/add_XX_impl.h.t +++ b/gr-blocks/lib/add_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/add_const_XX_impl.cc.t b/gr-blocks/lib/add_const_XX_impl.cc.t index 7fa883f4bb..87b22452dc 100644 --- a/gr-blocks/lib/add_const_XX_impl.cc.t +++ b/gr-blocks/lib/add_const_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(@O_TYPE@ k) - : gr_sync_block ("@NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), + : sync_block ("@NAME@", + io_signature::make (1, 1, sizeof (@I_TYPE@)), + io_signature::make (1, 1, sizeof (@O_TYPE@))), d_k(k) { } diff --git a/gr-blocks/lib/add_const_XX_impl.h.t b/gr-blocks/lib/add_const_XX_impl.h.t index cae5ca8135..e0c2ae54bc 100644 --- a/gr-blocks/lib/add_const_XX_impl.h.t +++ b/gr-blocks/lib/add_const_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/add_const_vXX_impl.cc.t b/gr-blocks/lib/add_const_vXX_impl.cc.t index da76cfeef2..3a7174a4ef 100644 --- a/gr-blocks/lib/add_const_vXX_impl.cc.t +++ b/gr-blocks/lib/add_const_vXX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(std::vector<@O_TYPE@> k) - : gr_sync_block ("@NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)*k.size()), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*k.size())), + : sync_block ("@NAME@", + io_signature::make (1, 1, sizeof (@I_TYPE@)*k.size()), + io_signature::make (1, 1, sizeof (@O_TYPE@)*k.size())), d_k(k) { } diff --git a/gr-blocks/lib/add_const_vXX_impl.h.t b/gr-blocks/lib/add_const_vXX_impl.h.t index a7a6197258..6c087d9461 100644 --- a/gr-blocks/lib/add_const_vXX_impl.h.t +++ b/gr-blocks/lib/add_const_vXX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/add_ff_impl.cc b/gr-blocks/lib/add_ff_impl.cc index 83359ef804..e12e86c061 100644 --- a/gr-blocks/lib/add_ff_impl.cc +++ b/gr-blocks/lib/add_ff_impl.cc @@ -25,7 +25,7 @@ #endif #include "add_ff_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } add_ff_impl::add_ff_impl(size_t vlen) - : gr_sync_block("add_ff", - gr_make_io_signature (1, -1, sizeof(float)*vlen), - gr_make_io_signature (1, 1, sizeof(float)*vlen)), + : sync_block("add_ff", + io_signature::make (1, -1, sizeof(float)*vlen), + io_signature::make (1, 1, sizeof(float)*vlen)), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/add_ff_impl.h b/gr-blocks/lib/add_ff_impl.h index 77b90d0795..237ca37217 100644 --- a/gr-blocks/lib/add_ff_impl.h +++ b/gr-blocks/lib/add_ff_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_BLOCKS_ADD_FF_IMPL_H #define INCLUDED_BLOCKS_ADD_FF_IMPL_H -#include <blocks/add_ff.h> +#include <gnuradio/blocks/add_ff.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/and_XX_impl.cc.t b/gr-blocks/lib/and_XX_impl.cc.t index 3218a8c746..04d6dfe862 100644 --- a/gr-blocks/lib/and_XX_impl.cc.t +++ b/gr-blocks/lib/and_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(size_t vlen) - : gr_sync_block ("@NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)), + : sync_block ("@NAME@", + io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen), + io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)), d_vlen(vlen) { } diff --git a/gr-blocks/lib/and_XX_impl.h.t b/gr-blocks/lib/and_XX_impl.h.t index 25f0da0c85..f7db3f2162 100644 --- a/gr-blocks/lib/and_XX_impl.h.t +++ b/gr-blocks/lib/and_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/and_const_XX_impl.cc.t b/gr-blocks/lib/and_const_XX_impl.cc.t index 8ff5ac3713..8eba4ed588 100644 --- a/gr-blocks/lib/and_const_XX_impl.cc.t +++ b/gr-blocks/lib/and_const_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(@O_TYPE@ k) - : gr_sync_block ("@NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), + : sync_block ("@NAME@", + io_signature::make (1, 1, sizeof (@I_TYPE@)), + io_signature::make (1, 1, sizeof (@O_TYPE@))), d_k(k) { } diff --git a/gr-blocks/lib/and_const_XX_impl.h.t b/gr-blocks/lib/and_const_XX_impl.h.t index 2c379feb84..186fda9508 100644 --- a/gr-blocks/lib/and_const_XX_impl.h.t +++ b/gr-blocks/lib/and_const_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/annotator_1to1_impl.cc b/gr-blocks/lib/annotator_1to1_impl.cc index e7f105fc02..04f9a2f458 100644 --- a/gr-blocks/lib/annotator_1to1_impl.cc +++ b/gr-blocks/lib/annotator_1to1_impl.cc @@ -25,7 +25,7 @@ #endif #include "annotator_1to1_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <iostream> #include <iomanip> @@ -41,9 +41,9 @@ namespace gr { } annotator_1to1_impl::annotator_1to1_impl(int when, size_t sizeof_stream_item) - : gr_sync_block("annotator_1to1", - gr_make_io_signature(1, -1, sizeof_stream_item), - gr_make_io_signature(1, -1, sizeof_stream_item)), + : sync_block("annotator_1to1", + io_signature::make(1, -1, sizeof_stream_item), + io_signature::make(1, -1, sizeof_stream_item)), d_itemsize(sizeof_stream_item), d_when((uint64_t)when) { set_tag_propagation_policy(TPP_ONE_TO_ONE); @@ -72,10 +72,10 @@ namespace gr { for(int i = 0; i < ninputs; i++) { abs_N = nitems_read(i); - std::vector<gr_tag_t> all_tags; + std::vector<tag_t> all_tags; get_tags_in_range(all_tags, i, abs_N, abs_N + noutput_items); - std::vector<gr_tag_t>::iterator itr; + std::vector<tag_t>::iterator itr; for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { d_stored_tags.push_back(*itr); } diff --git a/gr-blocks/lib/annotator_1to1_impl.h b/gr-blocks/lib/annotator_1to1_impl.h index 3306602e2c..2da73c8a66 100644 --- a/gr-blocks/lib/annotator_1to1_impl.h +++ b/gr-blocks/lib/annotator_1to1_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_ANNOTATOR_1TO1_IMPL_H #define INCLUDED_GR_ANNOTATOR_1TO1_IMPL_H -#include <blocks/annotator_1to1.h> +#include <gnuradio/blocks/annotator_1to1.h> namespace gr { namespace blocks { @@ -34,13 +34,13 @@ namespace gr { size_t d_itemsize; uint64_t d_when; uint64_t d_tag_counter; - std::vector<gr_tag_t> d_stored_tags; + std::vector<tag_t> d_stored_tags; public: annotator_1to1_impl(int when, size_t sizeof_stream_item); ~annotator_1to1_impl(); - std::vector<gr_tag_t> data() const + std::vector<tag_t> data() const { return d_stored_tags; } diff --git a/gr-blocks/lib/annotator_alltoall_impl.cc b/gr-blocks/lib/annotator_alltoall_impl.cc index 4909f7f820..cedf8dd44f 100644 --- a/gr-blocks/lib/annotator_alltoall_impl.cc +++ b/gr-blocks/lib/annotator_alltoall_impl.cc @@ -25,7 +25,7 @@ #endif #include "annotator_alltoall_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <iostream> #include <iomanip> @@ -42,9 +42,9 @@ namespace gr { annotator_alltoall_impl::annotator_alltoall_impl(int when, size_t sizeof_stream_item) - : gr_sync_block("annotator_alltoall", - gr_make_io_signature(1, -1, sizeof_stream_item), - gr_make_io_signature(1, -1, sizeof_stream_item)), + : sync_block("annotator_alltoall", + io_signature::make(1, -1, sizeof_stream_item), + io_signature::make(1, -1, sizeof_stream_item)), d_itemsize(sizeof_stream_item), d_when((uint64_t)when) { set_tag_propagation_policy(TPP_ALL_TO_ALL); @@ -73,10 +73,10 @@ namespace gr { abs_N = nitems_read(i); end_N = abs_N + (uint64_t)(noutput_items); - std::vector<gr_tag_t> all_tags; + std::vector<tag_t> all_tags; get_tags_in_range(all_tags, i, abs_N, end_N); - std::vector<gr_tag_t>::iterator itr; + std::vector<tag_t>::iterator itr; for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { d_stored_tags.push_back(*itr); } diff --git a/gr-blocks/lib/annotator_alltoall_impl.h b/gr-blocks/lib/annotator_alltoall_impl.h index 24c21948bc..81b73a8972 100644 --- a/gr-blocks/lib/annotator_alltoall_impl.h +++ b/gr-blocks/lib/annotator_alltoall_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_IMPL_H #define INCLUDED_GR_ANNOTATOR_ALLTOALL_IMPL_H -#include <blocks/annotator_alltoall.h> +#include <gnuradio/blocks/annotator_alltoall.h> namespace gr { namespace blocks { @@ -34,13 +34,13 @@ namespace gr { size_t d_itemsize; uint64_t d_when; uint64_t d_tag_counter; - std::vector<gr_tag_t> d_stored_tags; + std::vector<tag_t> d_stored_tags; public: annotator_alltoall_impl(int when, size_t sizeof_stream_item); ~annotator_alltoall_impl(); - std::vector<gr_tag_t> data() const + std::vector<tag_t> data() const { return d_stored_tags; } diff --git a/gr-blocks/lib/annotator_raw_impl.cc b/gr-blocks/lib/annotator_raw_impl.cc index ee5deb1f6b..499168c275 100644 --- a/gr-blocks/lib/annotator_raw_impl.cc +++ b/gr-blocks/lib/annotator_raw_impl.cc @@ -25,7 +25,7 @@ #endif #include "annotator_raw_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <iostream> #include <iomanip> @@ -44,9 +44,9 @@ namespace gr { } annotator_raw_impl::annotator_raw_impl(size_t sizeof_stream_item) - : gr_sync_block("annotator_raw", - gr_make_io_signature(1, 1, sizeof_stream_item), - gr_make_io_signature(1, 1, sizeof_stream_item)), + : sync_block("annotator_raw", + io_signature::make(1, 1, sizeof_stream_item), + io_signature::make(1, 1, sizeof_stream_item)), d_itemsize(sizeof_stream_item) { set_tag_propagation_policy(TPP_ONE_TO_ONE); @@ -62,7 +62,7 @@ namespace gr { { gr::thread::scoped_lock l(d_mutex); - gr_tag_t tag; + tag_t tag; tag.srcid = pmt::intern(name()); tag.key = key; tag.value = val; @@ -72,7 +72,7 @@ namespace gr { d_queued_tags.push_back(tag); // make sure our tags are in offset order std::sort(d_queued_tags.begin(), d_queued_tags.end(), - gr_tag_t::offset_compare); + tag_t::offset_compare); // make sure we are not adding an item in the past! if(tag.offset > nitems_read(0)) { throw std::runtime_error("annotator_raw::add_tag: item added too far in the past\n."); @@ -93,7 +93,7 @@ namespace gr { uint64_t end_N = start_N + (uint64_t)(noutput_items); // locate queued tags that fall in this range and insert them when appropriate - std::vector<gr_tag_t>::iterator i = d_queued_tags.begin(); + std::vector<tag_t>::iterator i = d_queued_tags.begin(); while( i != d_queued_tags.end() ) { if( (*i).offset >= start_N && (*i).offset < end_N) { add_item_tag(0, (*i).offset,(*i).key, (*i).value, (*i).srcid); diff --git a/gr-blocks/lib/annotator_raw_impl.h b/gr-blocks/lib/annotator_raw_impl.h index e0e16c30d6..54bed2ea25 100644 --- a/gr-blocks/lib/annotator_raw_impl.h +++ b/gr-blocks/lib/annotator_raw_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_ANNOTATOR_RAW_IMPL_H #define INCLUDED_GR_ANNOTATOR_RAW_IMPL_H -#include <blocks/annotator_raw.h> -#include <thread/thread.h> +#include <gnuradio/blocks/annotator_raw.h> +#include <gnuradio/thread/thread.h> namespace gr { namespace blocks { @@ -33,7 +33,7 @@ namespace gr { { private: size_t d_itemsize; - std::vector<gr_tag_t> d_queued_tags; + std::vector<tag_t> d_queued_tags; gr::thread::mutex d_mutex; public: diff --git a/gr-blocks/lib/argmax_XX_impl.cc.t b/gr-blocks/lib/argmax_XX_impl.cc.t index 56673ef995..87e025e2d7 100644 --- a/gr-blocks/lib/argmax_XX_impl.cc.t +++ b/gr-blocks/lib/argmax_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -40,9 +40,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(size_t vlen) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(1, -1, vlen*sizeof(@I_TYPE@)), - gr_make_io_signature(2, 2, sizeof(@O_TYPE@))), + : sync_block("@BASE_NAME@", + io_signature::make(1, -1, vlen*sizeof(@I_TYPE@)), + io_signature::make(2, 2, sizeof(@O_TYPE@))), d_vlen(vlen) { } diff --git a/gr-blocks/lib/argmax_XX_impl.h.t b/gr-blocks/lib/argmax_XX_impl.h.t index 0f1643f6b9..79da4e1d82 100644 --- a/gr-blocks/lib/argmax_XX_impl.h.t +++ b/gr-blocks/lib/argmax_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/bin_statistics_f_impl.cc b/gr-blocks/lib/bin_statistics_f_impl.cc index 014222a63d..1f17e85365 100644 --- a/gr-blocks/lib/bin_statistics_f_impl.cc +++ b/gr-blocks/lib/bin_statistics_f_impl.cc @@ -25,7 +25,7 @@ #endif #include "bin_statistics_f_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> namespace gr { @@ -33,8 +33,8 @@ namespace gr { bin_statistics_f::sptr bin_statistics_f::make(unsigned int vlen, - gr_msg_queue_sptr msgq, - gr_feval_dd *tune, + msg_queue::sptr msgq, + feval_dd *tune, size_t tune_delay, size_t dwell_delay) { @@ -44,13 +44,13 @@ namespace gr { } bin_statistics_f_impl::bin_statistics_f_impl(unsigned int vlen, - gr_msg_queue_sptr msgq, - gr_feval_dd *tune, + msg_queue::sptr msgq, + feval_dd *tune, size_t tune_delay, size_t dwell_delay) - : gr_sync_block("bin_statistics_f", - gr_make_io_signature(1, 1, sizeof(float) * vlen), - gr_make_io_signature(0, 0, 0)), + : sync_block("bin_statistics_f", + io_signature::make(1, 1, sizeof(float) * vlen), + io_signature::make(0, 0, 0)), d_vlen(vlen), d_msgq(msgq), d_tune(tune), d_tune_delay(tune_delay), d_dwell_delay(dwell_delay), d_center_freq(0), d_delay(0), @@ -168,7 +168,7 @@ namespace gr { return; // build & send a message - gr_message_sptr msg = gr_make_message(0, center_freq(), vlen(), vlen() * sizeof(float)); + message::sptr msg = message::make(0, center_freq(), vlen(), vlen() * sizeof(float)); memcpy(msg->msg(), &d_max[0], vlen() * sizeof(float)); msgq()->insert_tail(msg); } diff --git a/gr-blocks/lib/bin_statistics_f_impl.h b/gr-blocks/lib/bin_statistics_f_impl.h index 0abb60ed38..1d8da6b348 100644 --- a/gr-blocks/lib/bin_statistics_f_impl.h +++ b/gr-blocks/lib/bin_statistics_f_impl.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_GR_BIN_STATISTICS_F_IMPL_H #define INCLUDED_GR_BIN_STATISTICS_F_IMPL_H -#include <blocks/bin_statistics_f.h> -#include <gr_feval.h> -#include <gr_message.h> -#include <gr_msg_queue.h> +#include <gnuradio/blocks/bin_statistics_f.h> +#include <gnuradio/feval.h> +#include <gnuradio/message.h> +#include <gnuradio/msg_queue.h> namespace gr { namespace blocks { @@ -37,8 +37,8 @@ namespace gr { enum state_t { ST_INIT, ST_TUNE_DELAY, ST_DWELL_DELAY }; size_t d_vlen; - gr_msg_queue_sptr d_msgq; - gr_feval_dd *d_tune; + msg_queue::sptr d_msgq; + feval_dd *d_tune; size_t d_tune_delay; size_t d_dwell_delay; double d_center_freq; @@ -56,7 +56,7 @@ namespace gr { size_t vlen() const { return d_vlen; } double center_freq() const { return d_center_freq; } - gr_msg_queue_sptr msgq() const { return d_msgq; } + msg_queue::sptr msgq() const { return d_msgq; } virtual void reset_stats(); virtual void accrue_stats(const float *input); @@ -64,8 +64,8 @@ namespace gr { public: bin_statistics_f_impl(unsigned int vlen, - gr_msg_queue_sptr msgq, - gr_feval_dd *tune, + msg_queue::sptr msgq, + feval_dd *tune, size_t tune_delay, size_t dwell_delay); ~bin_statistics_f_impl(); diff --git a/gr-blocks/lib/burst_tagger_impl.cc b/gr-blocks/lib/burst_tagger_impl.cc index 31c535290d..da69a0ea48 100644 --- a/gr-blocks/lib/burst_tagger_impl.cc +++ b/gr-blocks/lib/burst_tagger_impl.cc @@ -25,7 +25,7 @@ #endif #include "burst_tagger_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } burst_tagger_impl::burst_tagger_impl(size_t itemsize) - : gr_sync_block("burst_tagger", - gr_make_io_signature2(2, 2, itemsize, sizeof(short)), - gr_make_io_signature(1, 1, itemsize)), + : sync_block("burst_tagger", + io_signature::make2(2, 2, itemsize, sizeof(short)), + io_signature::make(1, 1, itemsize)), d_itemsize(itemsize), d_state(false) { std::stringstream str; diff --git a/gr-blocks/lib/burst_tagger_impl.h b/gr-blocks/lib/burst_tagger_impl.h index 80bdec12fb..65ad58f8b3 100644 --- a/gr-blocks/lib/burst_tagger_impl.h +++ b/gr-blocks/lib/burst_tagger_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_BURST_TAGGER_IMPL_H #define INCLUDED_GR_BURST_TAGGER_IMPL_H -#include <blocks/burst_tagger.h> +#include <gnuradio/blocks/burst_tagger.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/char_to_float_impl.cc b/gr-blocks/lib/char_to_float_impl.cc index 22c5d2e252..de6ee5ba5a 100644 --- a/gr-blocks/lib/char_to_float_impl.cc +++ b/gr-blocks/lib/char_to_float_impl.cc @@ -25,7 +25,7 @@ #endif #include "char_to_float_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } char_to_float_impl::char_to_float_impl(size_t vlen, float scale) - : gr_sync_block("char_to_float", - gr_make_io_signature (1, -1, sizeof(char)*vlen), - gr_make_io_signature (1, 1, sizeof(float)*vlen)), + : sync_block("char_to_float", + io_signature::make (1, -1, sizeof(char)*vlen), + io_signature::make (1, 1, sizeof(float)*vlen)), d_vlen(vlen), d_scale(scale) { const int alignment_multiple = diff --git a/gr-blocks/lib/char_to_float_impl.h b/gr-blocks/lib/char_to_float_impl.h index 620d7e7371..f5677f86bd 100644 --- a/gr-blocks/lib/char_to_float_impl.h +++ b/gr-blocks/lib/char_to_float_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_CHAR_TO_FLOAT_IMPL_H #define INCLUDED_CHAR_TO_FLOAT_IMPL_H -#include <blocks/char_to_float.h> +#include <gnuradio/blocks/char_to_float.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/char_to_short_impl.cc b/gr-blocks/lib/char_to_short_impl.cc index a86a928b51..2b5414d673 100644 --- a/gr-blocks/lib/char_to_short_impl.cc +++ b/gr-blocks/lib/char_to_short_impl.cc @@ -25,7 +25,7 @@ #endif #include "char_to_short_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } char_to_short_impl::char_to_short_impl(size_t vlen) - : gr_sync_block("char_to_short", - gr_make_io_signature (1, -1, sizeof(char)*vlen), - gr_make_io_signature (1, 1, sizeof(short)*vlen)), + : sync_block("char_to_short", + io_signature::make (1, -1, sizeof(char)*vlen), + io_signature::make (1, 1, sizeof(short)*vlen)), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/char_to_short_impl.h b/gr-blocks/lib/char_to_short_impl.h index efd3ab3a8c..1009defedc 100644 --- a/gr-blocks/lib/char_to_short_impl.h +++ b/gr-blocks/lib/char_to_short_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_CHAR_TO_SHORT_IMPL_H #define INCLUDED_CHAR_TO_SHORT_IMPL_H -#include <blocks/char_to_short.h> +#include <gnuradio/blocks/char_to_short.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/check_lfsr_32k_s_impl.cc b/gr-blocks/lib/check_lfsr_32k_s_impl.cc index 5664067591..fac30223f7 100644 --- a/gr-blocks/lib/check_lfsr_32k_s_impl.cc +++ b/gr-blocks/lib/check_lfsr_32k_s_impl.cc @@ -25,7 +25,7 @@ #endif #include "check_lfsr_32k_s_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdlib.h> #include <stdio.h> @@ -40,9 +40,9 @@ namespace gr { } check_lfsr_32k_s_impl::check_lfsr_32k_s_impl() - : gr_sync_block("check_lfsr_32k", - gr_make_io_signature(1, 1, sizeof(short)), - gr_make_io_signature(0, 0, 0)), + : sync_block("check_lfsr_32k", + io_signature::make(1, 1, sizeof(short)), + io_signature::make(0, 0, 0)), d_state(SEARCHING), d_history(0), d_ntotal(0), d_nright(0), d_runlength(0), d_index(0) { diff --git a/gr-blocks/lib/check_lfsr_32k_s_impl.h b/gr-blocks/lib/check_lfsr_32k_s_impl.h index f6d3c8daa2..e060e89afc 100644 --- a/gr-blocks/lib/check_lfsr_32k_s_impl.h +++ b/gr-blocks/lib/check_lfsr_32k_s_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_CHECK_LFSR_32K_S_IMPL_H #define INCLUDED_GR_CHECK_LFSR_32K_S_IMPL_H -#include <blocks/check_lfsr_32k_s.h> -#include <blocks/lfsr_32k.h> +#include <gnuradio/blocks/check_lfsr_32k_s.h> +#include <gnuradio/blocks/lfsr_32k.h> namespace gr { namespace blocks { @@ -59,14 +59,14 @@ namespace gr { void right() { - d_history = (d_history << 1) | 0x1; + d_history = (d_history < 1) | 0x1; d_nright++; d_runlength++; } void wrong() { - d_history = (d_history << 1) | 0x0; + d_history = (d_history < 1) | 0x0; d_runlength = 0; } diff --git a/gr-blocks/lib/complex_to_arg_impl.cc b/gr-blocks/lib/complex_to_arg_impl.cc index 87ac9966f0..38539c8004 100644 --- a/gr-blocks/lib/complex_to_arg_impl.cc +++ b/gr-blocks/lib/complex_to_arg_impl.cc @@ -25,9 +25,9 @@ #endif #include "complex_to_arg_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> -#include <gr_math.h> +#include <gnuradio/math.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } complex_to_arg_impl::complex_to_arg_impl(size_t vlen) - : gr_sync_block("complex_to_arg", - gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen), - gr_make_io_signature (1, 1, sizeof(float)*vlen)), + : sync_block("complex_to_arg", + io_signature::make (1, 1, sizeof(gr_complex)*vlen), + io_signature::make (1, 1, sizeof(float)*vlen)), d_vlen(vlen) { const int alignment_multiple = @@ -60,7 +60,7 @@ namespace gr { // The fast_atan2f is faster than Volk for (int i = 0; i < noi; i++){ // out[i] = std::arg (in[i]); - out[i] = gr_fast_atan2f(in[i]); + out[i] = gr::fast_atan2f(in[i]); } return noutput_items; diff --git a/gr-blocks/lib/complex_to_arg_impl.h b/gr-blocks/lib/complex_to_arg_impl.h index 9ccfba05ae..cc1863b2d8 100644 --- a/gr-blocks/lib/complex_to_arg_impl.h +++ b/gr-blocks/lib/complex_to_arg_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_COMPLEX_TO_ARG_IMPL_H #define INCLUDED_COMPLEX_TO_ARG_IMPL_H -#include <blocks/complex_to_arg.h> +#include <gnuradio/blocks/complex_to_arg.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/complex_to_float_impl.cc b/gr-blocks/lib/complex_to_float_impl.cc index 3c1109de5f..d0b2bc6b9c 100644 --- a/gr-blocks/lib/complex_to_float_impl.cc +++ b/gr-blocks/lib/complex_to_float_impl.cc @@ -25,7 +25,7 @@ #endif #include "complex_to_float_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } complex_to_float_impl::complex_to_float_impl(size_t vlen) - : gr_sync_block("complex_to_float", - gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen), - gr_make_io_signature (1, 2, sizeof(float)*vlen)), + : sync_block("complex_to_float", + io_signature::make (1, 1, sizeof(gr_complex)*vlen), + io_signature::make (1, 2, sizeof(float)*vlen)), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/complex_to_float_impl.h b/gr-blocks/lib/complex_to_float_impl.h index d90ac28d58..d4fdcb7a9b 100644 --- a/gr-blocks/lib/complex_to_float_impl.h +++ b/gr-blocks/lib/complex_to_float_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_COMPLEX_TO_FLOAT_IMPL_H #define INCLUDED_COMPLEX_TO_FLOAT_IMPL_H -#include <blocks/complex_to_float.h> +#include <gnuradio/blocks/complex_to_float.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/complex_to_imag_impl.cc b/gr-blocks/lib/complex_to_imag_impl.cc index 760440cc9d..27d349aa1d 100644 --- a/gr-blocks/lib/complex_to_imag_impl.cc +++ b/gr-blocks/lib/complex_to_imag_impl.cc @@ -25,7 +25,7 @@ #endif #include "complex_to_imag_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } complex_to_imag_impl::complex_to_imag_impl(size_t vlen) - : gr_sync_block("complex_to_imag", - gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen), - gr_make_io_signature (1, 1, sizeof(float)*vlen)), + : sync_block("complex_to_imag", + io_signature::make (1, 1, sizeof(gr_complex)*vlen), + io_signature::make (1, 1, sizeof(float)*vlen)), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/complex_to_imag_impl.h b/gr-blocks/lib/complex_to_imag_impl.h index e647e67732..6758b0f6c5 100644 --- a/gr-blocks/lib/complex_to_imag_impl.h +++ b/gr-blocks/lib/complex_to_imag_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_COMPLEX_TO_IMAG_IMPL_H #define INCLUDED_COMPLEX_TO_IMAG_IMPL_H -#include <blocks/complex_to_imag.h> +#include <gnuradio/blocks/complex_to_imag.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/complex_to_interleaved_short_impl.cc b/gr-blocks/lib/complex_to_interleaved_short_impl.cc index 2f2ea6e00d..87146364bc 100644 --- a/gr-blocks/lib/complex_to_interleaved_short_impl.cc +++ b/gr-blocks/lib/complex_to_interleaved_short_impl.cc @@ -25,7 +25,7 @@ #endif #include "complex_to_interleaved_short_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -36,9 +36,9 @@ namespace gr { } complex_to_interleaved_short_impl::complex_to_interleaved_short_impl() - : gr_sync_interpolator("complex_to_interleaved_short", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(short)), + : sync_interpolator("complex_to_interleaved_short", + io_signature::make (1, 1, sizeof(gr_complex)), + io_signature::make (1, 1, sizeof(short)), 2) { } diff --git a/gr-blocks/lib/complex_to_interleaved_short_impl.h b/gr-blocks/lib/complex_to_interleaved_short_impl.h index 9a09d1ff99..7bcea95be0 100644 --- a/gr-blocks/lib/complex_to_interleaved_short_impl.h +++ b/gr-blocks/lib/complex_to_interleaved_short_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_COMPLEX_TO_INTERLEAVED_SHORT_IMPL_H #define INCLUDED_COMPLEX_TO_INTERLEAVED_SHORT_IMPL_H -#include <blocks/complex_to_interleaved_short.h> +#include <gnuradio/blocks/complex_to_interleaved_short.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/complex_to_mag_impl.cc b/gr-blocks/lib/complex_to_mag_impl.cc index 419bc53eb1..52a193f4d1 100644 --- a/gr-blocks/lib/complex_to_mag_impl.cc +++ b/gr-blocks/lib/complex_to_mag_impl.cc @@ -25,7 +25,7 @@ #endif #include "complex_to_mag_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } complex_to_mag_impl::complex_to_mag_impl(size_t vlen) - : gr_sync_block("complex_to_mag", - gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen), - gr_make_io_signature (1, 1, sizeof(float)*vlen)), + : sync_block("complex_to_mag", + io_signature::make (1, 1, sizeof(gr_complex)*vlen), + io_signature::make (1, 1, sizeof(float)*vlen)), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/complex_to_mag_impl.h b/gr-blocks/lib/complex_to_mag_impl.h index fe6da3f15e..54f12ac312 100644 --- a/gr-blocks/lib/complex_to_mag_impl.h +++ b/gr-blocks/lib/complex_to_mag_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_COMPLEX_TO_MAG_IMPL_H #define INCLUDED_COMPLEX_TO_MAG_IMPL_H -#include <blocks/complex_to_mag.h> +#include <gnuradio/blocks/complex_to_mag.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/complex_to_mag_squared_impl.cc b/gr-blocks/lib/complex_to_mag_squared_impl.cc index a3b48b153e..513527c25a 100644 --- a/gr-blocks/lib/complex_to_mag_squared_impl.cc +++ b/gr-blocks/lib/complex_to_mag_squared_impl.cc @@ -25,7 +25,7 @@ #endif #include "complex_to_mag_squared_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } complex_to_mag_squared_impl::complex_to_mag_squared_impl(size_t vlen) - : gr_sync_block("complex_to_mag_squared", - gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen), - gr_make_io_signature (1, 1, sizeof(float)*vlen)), + : sync_block("complex_to_mag_squared", + io_signature::make (1, 1, sizeof(gr_complex)*vlen), + io_signature::make (1, 1, sizeof(float)*vlen)), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/complex_to_mag_squared_impl.h b/gr-blocks/lib/complex_to_mag_squared_impl.h index 01851d2661..0cf22c8d9b 100644 --- a/gr-blocks/lib/complex_to_mag_squared_impl.h +++ b/gr-blocks/lib/complex_to_mag_squared_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_COMPLEX_TO_MAG_SQUARED_IMPL_H #define INCLUDED_COMPLEX_TO_MAG_SQUARED_IMPL_H -#include <blocks/complex_to_mag_squared.h> +#include <gnuradio/blocks/complex_to_mag_squared.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/complex_to_real_impl.cc b/gr-blocks/lib/complex_to_real_impl.cc index 6f053b669a..06d1b5ab0e 100644 --- a/gr-blocks/lib/complex_to_real_impl.cc +++ b/gr-blocks/lib/complex_to_real_impl.cc @@ -25,7 +25,7 @@ #endif #include "complex_to_real_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } complex_to_real_impl::complex_to_real_impl(size_t vlen) - : gr_sync_block("complex_to_real", - gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen), - gr_make_io_signature (1, 1, sizeof(float)*vlen)), + : sync_block("complex_to_real", + io_signature::make (1, 1, sizeof(gr_complex)*vlen), + io_signature::make (1, 1, sizeof(float)*vlen)), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/complex_to_real_impl.h b/gr-blocks/lib/complex_to_real_impl.h index 7d4d4306f8..233f90c93d 100644 --- a/gr-blocks/lib/complex_to_real_impl.h +++ b/gr-blocks/lib/complex_to_real_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_COMPLEX_TO_REAL_IMPL_H #define INCLUDED_COMPLEX_TO_REAL_IMPL_H -#include <blocks/complex_to_real.h> +#include <gnuradio/blocks/complex_to_real.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/conjugate_cc_impl.cc b/gr-blocks/lib/conjugate_cc_impl.cc index 3d46bef68b..14fbbf172c 100644 --- a/gr-blocks/lib/conjugate_cc_impl.cc +++ b/gr-blocks/lib/conjugate_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include "conjugate_cc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } conjugate_cc_impl::conjugate_cc_impl() - : gr_sync_block("conjugate_cc", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex))) + : sync_block("conjugate_cc", + io_signature::make (1, 1, sizeof(gr_complex)), + io_signature::make (1, 1, sizeof(gr_complex))) { const int alignment_multiple = volk_get_alignment() / sizeof(gr_complex); diff --git a/gr-blocks/lib/conjugate_cc_impl.h b/gr-blocks/lib/conjugate_cc_impl.h index 448e7b3188..d3d0f9a0b7 100644 --- a/gr-blocks/lib/conjugate_cc_impl.h +++ b/gr-blocks/lib/conjugate_cc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_CONJUGATE_CC_IMPL_H #define INCLUDED_CONJUGATE_CC_IMPL_H -#include <blocks/conjugate_cc.h> +#include <gnuradio/blocks/conjugate_cc.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/control_loop.cc b/gr-blocks/lib/control_loop.cc index 44f4e53394..bd33e6a7a0 100644 --- a/gr-blocks/lib/control_loop.cc +++ b/gr-blocks/lib/control_loop.cc @@ -24,8 +24,8 @@ #include "config.h" #endif -#include <blocks/control_loop.h> -#include <gr_math.h> +#include <gnuradio/blocks/control_loop.h> +#include <gnuradio/math.h> #include <stdexcept> namespace gr { diff --git a/gr-blocks/lib/copy_impl.cc b/gr-blocks/lib/copy_impl.cc index 929f22b7d3..564ea09ef4 100644 --- a/gr-blocks/lib/copy_impl.cc +++ b/gr-blocks/lib/copy_impl.cc @@ -25,7 +25,7 @@ #endif #include "copy_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } copy_impl::copy_impl(size_t itemsize) - : gr_block("copy", - gr_make_io_signature(1, -1, itemsize), - gr_make_io_signature(1, -1, itemsize)), + : block("copy", + io_signature::make(1, -1, itemsize), + io_signature::make(1, -1, itemsize)), d_itemsize(itemsize), d_enabled(true) { diff --git a/gr-blocks/lib/copy_impl.h b/gr-blocks/lib/copy_impl.h index 1f0f1a655e..5f3c81a306 100644 --- a/gr-blocks/lib/copy_impl.h +++ b/gr-blocks/lib/copy_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_COPY_IMPL_H #define INCLUDED_GR_COPY_IMPL_H -#include <blocks/copy.h> +#include <gnuradio/blocks/copy.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/count_bits.cc b/gr-blocks/lib/count_bits.cc index 167396b575..c65dc94894 100644 --- a/gr-blocks/lib/count_bits.cc +++ b/gr-blocks/lib/count_bits.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <blocks/count_bits.h> +#include <gnuradio/blocks/count_bits.h> /* * these are slow and obvious. If you need something faster, fix these diff --git a/gr-blocks/lib/ctrlport_probe2_c_impl.cc b/gr-blocks/lib/ctrlport_probe2_c_impl.cc index f52e605a0d..bc6febdb2d 100644 --- a/gr-blocks/lib/ctrlport_probe2_c_impl.cc +++ b/gr-blocks/lib/ctrlport_probe2_c_impl.cc @@ -25,7 +25,7 @@ #endif #include "ctrlport_probe2_c_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -40,9 +40,9 @@ namespace gr { ctrlport_probe2_c_impl::ctrlport_probe2_c_impl(const std::string &id, const std::string &desc, int len) - : gr_sync_block("probe2_c", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), + : sync_block("probe2_c", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(0, 0, 0)), d_id(id), d_desc(desc), d_len(len) { set_length(len); diff --git a/gr-blocks/lib/ctrlport_probe2_c_impl.h b/gr-blocks/lib/ctrlport_probe2_c_impl.h index 4d290a4e8f..c58d97f078 100644 --- a/gr-blocks/lib/ctrlport_probe2_c_impl.h +++ b/gr-blocks/lib/ctrlport_probe2_c_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_CTRLPORT_PROBE2_C_IMPL_H #define INCLUDED_CTRLPORT_PROBE2_C_IMPL_H -#include <blocks/ctrlport_probe2_c.h> -#include <rpcregisterhelpers.h> +#include <gnuradio/blocks/ctrlport_probe2_c.h> +#include <gnuradio/rpcregisterhelpers.h> #include <boost/thread/shared_mutex.hpp> namespace gr { diff --git a/gr-blocks/lib/ctrlport_probe_c_impl.cc b/gr-blocks/lib/ctrlport_probe_c_impl.cc index e11bd0496e..1c077af481 100644 --- a/gr-blocks/lib/ctrlport_probe_c_impl.cc +++ b/gr-blocks/lib/ctrlport_probe_c_impl.cc @@ -25,7 +25,7 @@ #endif #include "ctrlport_probe_c_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -40,9 +40,9 @@ namespace gr { ctrlport_probe_c_impl::ctrlport_probe_c_impl(const std::string &id, const std::string &desc) - : gr_sync_block("probe_c", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), + : sync_block("probe_c", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(0, 0, 0)), d_id(id), d_desc(desc), d_ptr(NULL), d_ptrLen(0) { } diff --git a/gr-blocks/lib/ctrlport_probe_c_impl.h b/gr-blocks/lib/ctrlport_probe_c_impl.h index 5d9073ac10..59e9497a82 100644 --- a/gr-blocks/lib/ctrlport_probe_c_impl.h +++ b/gr-blocks/lib/ctrlport_probe_c_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_CTRLPORT_PROBE_C_IMPL_H #define INCLUDED_CTRLPORT_PROBE_C_IMPL_H -#include <blocks/ctrlport_probe_c.h> -#include <rpcregisterhelpers.h> +#include <gnuradio/blocks/ctrlport_probe_c.h> +#include <gnuradio/rpcregisterhelpers.h> #include <boost/thread/shared_mutex.hpp> namespace gr { diff --git a/gr-blocks/lib/deinterleave_impl.cc b/gr-blocks/lib/deinterleave_impl.cc index badf4973a6..6866cc7acb 100644 --- a/gr-blocks/lib/deinterleave_impl.cc +++ b/gr-blocks/lib/deinterleave_impl.cc @@ -25,7 +25,7 @@ #endif #include "deinterleave_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -36,9 +36,9 @@ namespace gr { } deinterleave_impl::deinterleave_impl(size_t itemsize) - : gr_sync_decimator("deinterleave", - gr_make_io_signature (1, 1, itemsize), - gr_make_io_signature (1, gr_io_signature::IO_INFINITE, itemsize), + : sync_decimator("deinterleave", + io_signature::make (1, 1, itemsize), + io_signature::make (1, io_signature::IO_INFINITE, itemsize), 1), d_itemsize(itemsize) { diff --git a/gr-blocks/lib/deinterleave_impl.h b/gr-blocks/lib/deinterleave_impl.h index 762c9d5fe0..d4d9392e8a 100644 --- a/gr-blocks/lib/deinterleave_impl.h +++ b/gr-blocks/lib/deinterleave_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DEINTERLEAVE_IMPL_H #define INCLUDED_DEINTERLEAVE_IMPL_H -#include <blocks/deinterleave.h> +#include <gnuradio/blocks/deinterleave.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/delay_impl.cc b/gr-blocks/lib/delay_impl.cc index 08cd1db1c3..197aa66977 100644 --- a/gr-blocks/lib/delay_impl.cc +++ b/gr-blocks/lib/delay_impl.cc @@ -25,7 +25,7 @@ #endif #include "delay_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } delay_impl::delay_impl(size_t itemsize, int delay) - : gr_block("delay", - gr_make_io_signature(1, -1, itemsize), - gr_make_io_signature(1, -1, itemsize)), + : block("delay", + io_signature::make(1, -1, itemsize), + io_signature::make(1, -1, itemsize)), d_itemsize(itemsize) { set_dly(delay); diff --git a/gr-blocks/lib/delay_impl.h b/gr-blocks/lib/delay_impl.h index 1cb959359e..ad07e6aa78 100644 --- a/gr-blocks/lib/delay_impl.h +++ b/gr-blocks/lib/delay_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_DELAY_IMPL_H #define INCLUDED_GR_DELAY_IMPL_H -#include <blocks/delay.h> -#include <thread/thread.h> +#include <gnuradio/blocks/delay.h> +#include <gnuradio/thread/thread.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/divide_XX_impl.cc.t b/gr-blocks/lib/divide_XX_impl.cc.t index 223d6ad905..30cb3ab38c 100644 --- a/gr-blocks/lib/divide_XX_impl.cc.t +++ b/gr-blocks/lib/divide_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(size_t vlen) - : gr_sync_block ("@NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)), + : sync_block ("@NAME@", + io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen), + io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)), d_vlen(vlen) { } diff --git a/gr-blocks/lib/divide_XX_impl.h.t b/gr-blocks/lib/divide_XX_impl.h.t index a1c486b859..2680ef7012 100644 --- a/gr-blocks/lib/divide_XX_impl.h.t +++ b/gr-blocks/lib/divide_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/endian_swap_impl.cc b/gr-blocks/lib/endian_swap_impl.cc index 7e67c30147..3c263e40a3 100644 --- a/gr-blocks/lib/endian_swap_impl.cc +++ b/gr-blocks/lib/endian_swap_impl.cc @@ -25,7 +25,7 @@ #endif #include "endian_swap_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } endian_swap_impl::endian_swap_impl (size_t item_size_bytes) - : gr_sync_block("endian_swap_impl", - gr_make_io_signature(1, 1, item_size_bytes), - gr_make_io_signature(1, 1, item_size_bytes)) + : sync_block("endian_swap_impl", + io_signature::make(1, 1, item_size_bytes), + io_signature::make(1, 1, item_size_bytes)) { const int alignment_multiple = volk_get_alignment(); set_alignment(std::max(1, alignment_multiple)); diff --git a/gr-blocks/lib/endian_swap_impl.h b/gr-blocks/lib/endian_swap_impl.h index 517df44f17..ab8fff1b65 100644 --- a/gr-blocks/lib/endian_swap_impl.h +++ b/gr-blocks/lib/endian_swap_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_ENDIAN_SWAP_IMPL_H #define INCLUDED_GR_ENDIAN_SWAP_IMPL_H -#include <blocks/endian_swap.h> +#include <gnuradio/blocks/endian_swap.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/file_descriptor_sink_impl.cc b/gr-blocks/lib/file_descriptor_sink_impl.cc index a1f26220d2..975c60c63d 100644 --- a/gr-blocks/lib/file_descriptor_sink_impl.cc +++ b/gr-blocks/lib/file_descriptor_sink_impl.cc @@ -25,7 +25,7 @@ #endif #include "file_descriptor_sink_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> #include <errno.h> #include <sys/types.h> @@ -49,9 +49,9 @@ namespace gr { } file_descriptor_sink_impl::file_descriptor_sink_impl(size_t itemsize, int fd) - : gr_sync_block("file_descriptor_sink", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(0, 0, 0)), + : sync_block("file_descriptor_sink", + io_signature::make(1, 1, itemsize), + io_signature::make(0, 0, 0)), d_itemsize(itemsize), d_fd(fd) { } diff --git a/gr-blocks/lib/file_descriptor_sink_impl.h b/gr-blocks/lib/file_descriptor_sink_impl.h index 90b02f4163..0b455879a4 100644 --- a/gr-blocks/lib/file_descriptor_sink_impl.h +++ b/gr-blocks/lib/file_descriptor_sink_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_FILE_DESCRIPTOR_SINK_IMPL_H #define INCLUDED_GR_FILE_DESCRIPTOR_SINK_IMPL_H -#include <blocks/file_descriptor_sink.h> +#include <gnuradio/blocks/file_descriptor_sink.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/file_descriptor_source_impl.cc b/gr-blocks/lib/file_descriptor_source_impl.cc index 667e96b7fa..575681ba9b 100644 --- a/gr-blocks/lib/file_descriptor_source_impl.cc +++ b/gr-blocks/lib/file_descriptor_source_impl.cc @@ -25,7 +25,7 @@ #endif #include "file_descriptor_source_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> #include <errno.h> #include <sys/types.h> @@ -52,9 +52,9 @@ namespace gr { file_descriptor_source_impl::file_descriptor_source_impl(size_t itemsize, int fd, bool repeat) - : gr_sync_block("file_descriptor_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), + : sync_block("file_descriptor_source", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, itemsize)), d_itemsize(itemsize), d_fd(fd), d_repeat(repeat), d_residue(new unsigned char[itemsize]), d_residue_len (0) { diff --git a/gr-blocks/lib/file_descriptor_source_impl.h b/gr-blocks/lib/file_descriptor_source_impl.h index dd86e18af1..6bdfa03614 100644 --- a/gr-blocks/lib/file_descriptor_source_impl.h +++ b/gr-blocks/lib/file_descriptor_source_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_IMPL_H #define INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_IMPL_H -#include <blocks/file_descriptor_source.h> +#include <gnuradio/blocks/file_descriptor_source.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/file_meta_sink_impl.cc b/gr-blocks/lib/file_meta_sink_impl.cc index dc87a7e956..82ecb93db3 100644 --- a/gr-blocks/lib/file_meta_sink_impl.cc +++ b/gr-blocks/lib/file_meta_sink_impl.cc @@ -25,7 +25,7 @@ #endif #include "file_meta_sink_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> #include <sys/types.h> #include <sys/stat.h> @@ -79,9 +79,9 @@ namespace gr { size_t max_segment_size, const std::string &extra_dict, bool detached_header) - : gr_sync_block("file_meta_sink", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(0, 0, 0)), + : sync_block("file_meta_sink", + io_signature::make(1, 1, itemsize), + io_signature::make(0, 0, 0)), d_itemsize(itemsize), d_samp_rate(samp_rate), d_relative_rate(relative_rate), d_max_seg_size(max_segment_size), d_total_seg_size(0), @@ -396,10 +396,10 @@ namespace gr { uint64_t abs_N = nitems_read(0); uint64_t end_N = abs_N + (uint64_t)(noutput_items); - std::vector<gr_tag_t> all_tags; + std::vector<tag_t> all_tags; get_tags_in_range(all_tags, 0, abs_N, end_N); - std::vector<gr_tag_t>::iterator itr; + std::vector<tag_t>::iterator itr; for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { int item_offset = (int)(itr->offset - abs_N); diff --git a/gr-blocks/lib/file_meta_sink_impl.h b/gr-blocks/lib/file_meta_sink_impl.h index d4048e1e4e..e454341f62 100644 --- a/gr-blocks/lib/file_meta_sink_impl.h +++ b/gr-blocks/lib/file_meta_sink_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_BLOCKS_FILE_META_SINK_IMPL_H #define INCLUDED_BLOCKS_FILE_META_SINK_IMPL_H -#include <blocks/file_meta_sink.h> +#include <gnuradio/blocks/file_meta_sink.h> #include <pmt/pmt.h> -#include <thread/thread.h> +#include <gnuradio/thread/thread.h> using namespace pmt; diff --git a/gr-blocks/lib/file_meta_source_impl.cc b/gr-blocks/lib/file_meta_source_impl.cc index 2b16b9066b..6f1338dd58 100644 --- a/gr-blocks/lib/file_meta_source_impl.cc +++ b/gr-blocks/lib/file_meta_source_impl.cc @@ -25,7 +25,7 @@ #endif #include "file_meta_source_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> #include <sys/types.h> #include <sys/stat.h> @@ -72,9 +72,9 @@ namespace gr { bool repeat, bool detached_header, const std::string &hdr_filename) - : gr_sync_block("file_meta_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, 1)), + : sync_block("file_meta_source", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, 1)), d_itemsize(0), d_samp_rate(0), d_seg_size(0), d_updated(false), d_repeat(repeat) @@ -104,7 +104,7 @@ namespace gr { throw std::runtime_error("file_meta_source: could not read header.\n"); // Set output signature based on itemsize info in header - set_output_signature(gr_make_io_signature(1, 1, d_itemsize)); + set_output_signature(io_signature::make(1, 1, d_itemsize)); } file_meta_source_impl::~file_meta_source_impl() @@ -197,7 +197,7 @@ namespace gr { void file_meta_source_impl::parse_header(pmt::pmt_t hdr, uint64_t offset, - std::vector<gr_tag_t> &tags) + std::vector<tag_t> &tags) { pmt::pmt_t r, key; @@ -207,7 +207,7 @@ namespace gr { r = pmt::dict_ref(hdr, key, pmt::PMT_NIL); d_samp_rate = pmt::to_double(r); - gr_tag_t t; + tag_t t; t.offset = offset; t.key = key; t.value = r; @@ -223,7 +223,7 @@ namespace gr { if(pmt::dict_has_key(hdr, key)) { d_time_stamp = pmt::dict_ref(hdr, key, pmt::PMT_NIL); - gr_tag_t t; + tag_t t; t.offset = offset; t.key = key; t.value = d_time_stamp; @@ -256,7 +256,7 @@ namespace gr { void file_meta_source_impl::parse_extras(pmt::pmt_t extras, uint64_t offset, - std::vector<gr_tag_t> &tags) + std::vector<tag_t> &tags) { pmt::pmt_t item, key, val; @@ -266,7 +266,7 @@ namespace gr { key = pmt::car(item); val = pmt::cdr(item); - gr_tag_t t; + tag_t t; t.offset = offset; t.key = key; t.value = val; diff --git a/gr-blocks/lib/file_meta_source_impl.h b/gr-blocks/lib/file_meta_source_impl.h index 3f8ebda6ee..00d8d7e86f 100644 --- a/gr-blocks/lib/file_meta_source_impl.h +++ b/gr-blocks/lib/file_meta_source_impl.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_BLOCKS_FILE_META_SOURCE_IMPL_H #define INCLUDED_BLOCKS_FILE_META_SOURCE_IMPL_H -#include <blocks/file_meta_source.h> -#include <gr_tags.h> +#include <gnuradio/blocks/file_meta_source.h> +#include <gnuradio/tags.h> #include <pmt/pmt.h> -#include <thread/thread.h> +#include <gnuradio/thread/thread.h> -#include <blocks/file_meta_sink.h> +#include <gnuradio/blocks/file_meta_sink.h> using namespace pmt; @@ -55,15 +55,15 @@ namespace gr { FILE *d_fp, *d_hdr_fp; meta_state_t d_state; - std::vector<gr_tag_t> d_tags; + std::vector<tag_t> d_tags; protected: bool _open(FILE **fp, const char *filename); bool read_header(pmt_t &hdr, pmt_t &extras); void parse_header(pmt_t hdr, uint64_t offset, - std::vector<gr_tag_t> &tags); + std::vector<tag_t> &tags); void parse_extras(pmt_t extras, uint64_t offset, - std::vector<gr_tag_t> &tags); + std::vector<tag_t> &tags); public: file_meta_source_impl(const std::string &filename, diff --git a/gr-blocks/lib/file_sink_base.cc b/gr-blocks/lib/file_sink_base.cc index d3a36f3321..42e2eae528 100644 --- a/gr-blocks/lib/file_sink_base.cc +++ b/gr-blocks/lib/file_sink_base.cc @@ -24,14 +24,14 @@ #include "config.h" #endif -#include <blocks/file_sink_base.h> +#include <gnuradio/blocks/file_sink_base.h> #include <cstdio> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdexcept> #include <stdio.h> -#include <thread/thread.h> +#include <gnuradio/thread/thread.h> // win32 (mingw/msvc) specific #ifdef HAVE_IO_H diff --git a/gr-blocks/lib/file_sink_impl.cc b/gr-blocks/lib/file_sink_impl.cc index 88dcb5a021..e78576e288 100644 --- a/gr-blocks/lib/file_sink_impl.cc +++ b/gr-blocks/lib/file_sink_impl.cc @@ -25,7 +25,7 @@ #endif #include "file_sink_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } file_sink_impl::file_sink_impl(size_t itemsize, const char *filename) - : gr_sync_block("file_sink", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(0, 0, 0)), + : sync_block("file_sink", + io_signature::make(1, 1, itemsize), + io_signature::make(0, 0, 0)), file_sink_base(filename, true), d_itemsize(itemsize) { diff --git a/gr-blocks/lib/file_sink_impl.h b/gr-blocks/lib/file_sink_impl.h index 8e802ad88a..f86009419e 100644 --- a/gr-blocks/lib/file_sink_impl.h +++ b/gr-blocks/lib/file_sink_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_FILE_SINK_IMPL_H #define INCLUDED_GR_FILE_SINK_IMPL_H -#include <blocks/file_sink.h> +#include <gnuradio/blocks/file_sink.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/file_source_impl.cc b/gr-blocks/lib/file_source_impl.cc index 3c30884a59..d413995549 100644 --- a/gr-blocks/lib/file_source_impl.cc +++ b/gr-blocks/lib/file_source_impl.cc @@ -24,9 +24,9 @@ #include "config.h" #endif -#include <thread/thread.h> +#include <gnuradio/thread/thread.h> #include "file_source_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> #include <sys/types.h> #include <sys/stat.h> @@ -60,9 +60,9 @@ namespace gr { } file_source_impl::file_source_impl(size_t itemsize, const char *filename, bool repeat) - : gr_sync_block("file_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), + : sync_block("file_source", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, itemsize)), d_itemsize(itemsize), d_fp(0), d_new_fp(0), d_repeat(repeat), d_updated(false) { diff --git a/gr-blocks/lib/file_source_impl.h b/gr-blocks/lib/file_source_impl.h index fc7f8053df..5f5e8c9340 100644 --- a/gr-blocks/lib/file_source_impl.h +++ b/gr-blocks/lib/file_source_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_BLOCKS_FILE_SOURCE_IMPL_H #define INCLUDED_BLOCKS_FILE_SOURCE_IMPL_H -#include <blocks/file_source.h> +#include <gnuradio/blocks/file_source.h> #include <boost/thread/mutex.hpp> namespace gr { diff --git a/gr-blocks/lib/float_array_to_int.h b/gr-blocks/lib/float_array_to_int.h index 943736d7ee..6a528d797a 100644 --- a/gr-blocks/lib/float_array_to_int.h +++ b/gr-blocks/lib/float_array_to_int.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_BLOCKS_FLOAT_ARRAY_TO_INT_H #define INCLUDED_BLOCKS_FLOAT_ARRAY_TO_INT_H -#include <blocks/api.h> +#include <gnuradio/blocks/api.h> /*! * convert array of floats to int with rounding and saturation. diff --git a/gr-blocks/lib/float_array_to_uchar.h b/gr-blocks/lib/float_array_to_uchar.h index defed8e3e4..2cc3993d50 100644 --- a/gr-blocks/lib/float_array_to_uchar.h +++ b/gr-blocks/lib/float_array_to_uchar.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_FLOAT_ARRAY_TO_UCHAR_H #define INCLUDED_FLOAT_ARRAY_TO_UCHAR_H -#include <blocks/api.h> +#include <gnuradio/blocks/api.h> /*! * convert array of floats to unsigned chars with rounding and saturation. diff --git a/gr-blocks/lib/float_to_char_impl.cc b/gr-blocks/lib/float_to_char_impl.cc index c37522dc95..cec95cb66b 100644 --- a/gr-blocks/lib/float_to_char_impl.cc +++ b/gr-blocks/lib/float_to_char_impl.cc @@ -25,7 +25,7 @@ #endif #include "float_to_char_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } float_to_char_impl::float_to_char_impl(size_t vlen, float scale) - : gr_sync_block("float_to_char", - gr_make_io_signature (1, 1, sizeof(float)*vlen), - gr_make_io_signature (1, 1, sizeof(char)*vlen)), + : sync_block("float_to_char", + io_signature::make (1, 1, sizeof(float)*vlen), + io_signature::make (1, 1, sizeof(char)*vlen)), d_vlen(vlen), d_scale(scale) { const int alignment_multiple = diff --git a/gr-blocks/lib/float_to_char_impl.h b/gr-blocks/lib/float_to_char_impl.h index 2644f3e709..a5435d9960 100644 --- a/gr-blocks/lib/float_to_char_impl.h +++ b/gr-blocks/lib/float_to_char_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_FLOAT_TO_CHAR_IMPL_H #define INCLUDED_FLOAT_TO_CHAR_IMPL_H -#include <blocks/float_to_char.h> +#include <gnuradio/blocks/float_to_char.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/float_to_complex_impl.cc b/gr-blocks/lib/float_to_complex_impl.cc index 709aa420c3..f37f2bb7a6 100644 --- a/gr-blocks/lib/float_to_complex_impl.cc +++ b/gr-blocks/lib/float_to_complex_impl.cc @@ -25,7 +25,7 @@ #endif #include "float_to_complex_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } float_to_complex_impl::float_to_complex_impl(size_t vlen) - : gr_sync_block("float_to_complex", - gr_make_io_signature (1, 2, sizeof(float)*vlen), - gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen)), + : sync_block("float_to_complex", + io_signature::make (1, 2, sizeof(float)*vlen), + io_signature::make (1, 1, sizeof(gr_complex)*vlen)), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/float_to_complex_impl.h b/gr-blocks/lib/float_to_complex_impl.h index 859c5bf965..d28beb2697 100644 --- a/gr-blocks/lib/float_to_complex_impl.h +++ b/gr-blocks/lib/float_to_complex_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_FLOAT_TO_COMPLEX_IMPL_H #define INCLUDED_FLOAT_TO_COMPLEX_IMPL_H -#include <blocks/float_to_complex.h> +#include <gnuradio/blocks/float_to_complex.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/float_to_int_impl.cc b/gr-blocks/lib/float_to_int_impl.cc index 24218ab682..04db8bed2f 100644 --- a/gr-blocks/lib/float_to_int_impl.cc +++ b/gr-blocks/lib/float_to_int_impl.cc @@ -26,7 +26,7 @@ #include "float_to_int_impl.h" #include "float_array_to_int.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -38,9 +38,9 @@ namespace gr { } float_to_int_impl::float_to_int_impl(size_t vlen, float scale) - : gr_sync_block("float_to_int", - gr_make_io_signature (1, 1, sizeof(float)*vlen), - gr_make_io_signature (1, 1, sizeof(int)*vlen)), + : sync_block("float_to_int", + io_signature::make (1, 1, sizeof(float)*vlen), + io_signature::make (1, 1, sizeof(int)*vlen)), d_vlen(vlen), d_scale(scale) { const int alignment_multiple = diff --git a/gr-blocks/lib/float_to_int_impl.h b/gr-blocks/lib/float_to_int_impl.h index 71775fcb1c..d437b50cfa 100644 --- a/gr-blocks/lib/float_to_int_impl.h +++ b/gr-blocks/lib/float_to_int_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_FLOAT_TO_INT_IMPL_H #define INCLUDED_FLOAT_TO_INT_IMPL_H -#include <blocks/float_to_int.h> +#include <gnuradio/blocks/float_to_int.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/float_to_short_impl.cc b/gr-blocks/lib/float_to_short_impl.cc index 2807ae1927..6c6b5607a9 100644 --- a/gr-blocks/lib/float_to_short_impl.cc +++ b/gr-blocks/lib/float_to_short_impl.cc @@ -25,7 +25,7 @@ #endif #include "float_to_short_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } float_to_short_impl::float_to_short_impl(size_t vlen, float scale) - : gr_sync_block("float_to_short", - gr_make_io_signature (1, 1, sizeof(float)*vlen), - gr_make_io_signature (1, 1, sizeof(short)*vlen)), + : sync_block("float_to_short", + io_signature::make (1, 1, sizeof(float)*vlen), + io_signature::make (1, 1, sizeof(short)*vlen)), d_vlen(vlen), d_scale(scale) { const int alignment_multiple = diff --git a/gr-blocks/lib/float_to_short_impl.h b/gr-blocks/lib/float_to_short_impl.h index 5427862b38..2ca5a3bf04 100644 --- a/gr-blocks/lib/float_to_short_impl.h +++ b/gr-blocks/lib/float_to_short_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_FLOAT_TO_SHORT_IMPL_H #define INCLUDED_FLOAT_TO_SHORT_IMPL_H -#include <blocks/float_to_short.h> +#include <gnuradio/blocks/float_to_short.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/float_to_uchar_impl.cc b/gr-blocks/lib/float_to_uchar_impl.cc index 22d0527b1c..a55b3dbc82 100644 --- a/gr-blocks/lib/float_to_uchar_impl.cc +++ b/gr-blocks/lib/float_to_uchar_impl.cc @@ -26,7 +26,7 @@ #include "float_to_uchar_impl.h" #include "float_array_to_uchar.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -37,9 +37,9 @@ namespace gr { } float_to_uchar_impl::float_to_uchar_impl() - : gr_sync_block("float_to_uchar", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature (1, 1, sizeof(unsigned char))) + : sync_block("float_to_uchar", + io_signature::make (1, 1, sizeof(float)), + io_signature::make (1, 1, sizeof(unsigned char))) { } diff --git a/gr-blocks/lib/float_to_uchar_impl.h b/gr-blocks/lib/float_to_uchar_impl.h index effd66c5cc..56e815c511 100644 --- a/gr-blocks/lib/float_to_uchar_impl.h +++ b/gr-blocks/lib/float_to_uchar_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_FLOAT_TO_UCHAR_IMPL_H #define INCLUDED_FLOAT_TO_UCHAR_IMPL_H -#include <blocks/float_to_uchar.h> +#include <gnuradio/blocks/float_to_uchar.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/head_impl.cc b/gr-blocks/lib/head_impl.cc index 7dfa36607c..4c33f9f08e 100644 --- a/gr-blocks/lib/head_impl.cc +++ b/gr-blocks/lib/head_impl.cc @@ -25,7 +25,7 @@ #endif #include "head_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } head_impl::head_impl(size_t sizeof_stream_item, uint64_t nitems) - : gr_sync_block("head", - gr_make_io_signature(1, 1, sizeof_stream_item), - gr_make_io_signature(1, 1, sizeof_stream_item)), + : sync_block("head", + io_signature::make(1, 1, sizeof_stream_item), + io_signature::make(1, 1, sizeof_stream_item)), d_nitems(nitems), d_ncopied_items(0) { } diff --git a/gr-blocks/lib/head_impl.h b/gr-blocks/lib/head_impl.h index a56acfbb27..fe2918c404 100644 --- a/gr-blocks/lib/head_impl.h +++ b/gr-blocks/lib/head_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_HEAD_IMPL_H #define INCLUDED_GR_HEAD_IMPL_H -#include <blocks/head.h> +#include <gnuradio/blocks/head.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/int_to_float_impl.cc b/gr-blocks/lib/int_to_float_impl.cc index 0190d7ccb0..306a6f169d 100644 --- a/gr-blocks/lib/int_to_float_impl.cc +++ b/gr-blocks/lib/int_to_float_impl.cc @@ -25,7 +25,7 @@ #endif #include "int_to_float_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } int_to_float_impl::int_to_float_impl(size_t vlen, float scale) - : gr_sync_block("int_to_float", - gr_make_io_signature (1, 1, sizeof(int32_t)*vlen), - gr_make_io_signature (1, 1, sizeof(float)*vlen)), + : sync_block("int_to_float", + io_signature::make (1, 1, sizeof(int32_t)*vlen), + io_signature::make (1, 1, sizeof(float)*vlen)), d_vlen(vlen), d_scale(scale) { const int alignment_multiple = diff --git a/gr-blocks/lib/int_to_float_impl.h b/gr-blocks/lib/int_to_float_impl.h index 7498a0bb13..96b416be1d 100644 --- a/gr-blocks/lib/int_to_float_impl.h +++ b/gr-blocks/lib/int_to_float_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_INT_TO_FLOAT_IMPL_H #define INCLUDED_INT_TO_FLOAT_IMPL_H -#include <blocks/int_to_float.h> +#include <gnuradio/blocks/int_to_float.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/integrate_XX_impl.cc.t b/gr-blocks/lib/integrate_XX_impl.cc.t index 4c82729e3c..2def0309df 100644 --- a/gr-blocks/lib/integrate_XX_impl.cc.t +++ b/gr-blocks/lib/integrate_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(int decim) - : gr_sync_decimator("@NAME@", - gr_make_io_signature(1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature(1, 1, sizeof (@O_TYPE@)), + : sync_decimator("@NAME@", + io_signature::make(1, 1, sizeof (@I_TYPE@)), + io_signature::make(1, 1, sizeof (@O_TYPE@)), decim), d_decim(decim), d_count(0) diff --git a/gr-blocks/lib/integrate_XX_impl.h.t b/gr-blocks/lib/integrate_XX_impl.h.t index 9fc3333882..e37ddc077d 100644 --- a/gr-blocks/lib/integrate_XX_impl.h.t +++ b/gr-blocks/lib/integrate_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/interleave_impl.cc b/gr-blocks/lib/interleave_impl.cc index df37ed26d6..1f68cfc512 100644 --- a/gr-blocks/lib/interleave_impl.cc +++ b/gr-blocks/lib/interleave_impl.cc @@ -25,7 +25,7 @@ #endif #include "interleave_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -36,9 +36,9 @@ namespace gr { } interleave_impl::interleave_impl(size_t itemsize) - : gr_sync_interpolator("interleave", - gr_make_io_signature (1, gr_io_signature::IO_INFINITE, itemsize), - gr_make_io_signature (1, 1, itemsize), + : sync_interpolator("interleave", + io_signature::make (1, io_signature::IO_INFINITE, itemsize), + io_signature::make (1, 1, itemsize), 1), d_itemsize(itemsize) { diff --git a/gr-blocks/lib/interleave_impl.h b/gr-blocks/lib/interleave_impl.h index a02517e3e1..962747c8b5 100644 --- a/gr-blocks/lib/interleave_impl.h +++ b/gr-blocks/lib/interleave_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_INTERLEAVE_IMPL_H #define INCLUDED_INTERLEAVE_IMPL_H -#include <blocks/interleave.h> +#include <gnuradio/blocks/interleave.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/interleaved_short_array_to_complex.h b/gr-blocks/lib/interleaved_short_array_to_complex.h index 3f20fdb989..33f70ccdfa 100644 --- a/gr-blocks/lib/interleaved_short_array_to_complex.h +++ b/gr-blocks/lib/interleaved_short_array_to_complex.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_INTERLEAVED_SHORT_ARRAY_TO_COMPLEX_H #define INCLUDED_INTERLEAVED_SHORT_ARRAY_TO_COMPLEX_H -#include <blocks/api.h> -#include <gr_complex.h> +#include <gnuradio/blocks/api.h> +#include <gnuradio/gr_complex.h> /* * convert array of interleaved shorts to complex. diff --git a/gr-blocks/lib/interleaved_short_to_complex_impl.cc b/gr-blocks/lib/interleaved_short_to_complex_impl.cc index 9a28d9c974..962b29b37c 100644 --- a/gr-blocks/lib/interleaved_short_to_complex_impl.cc +++ b/gr-blocks/lib/interleaved_short_to_complex_impl.cc @@ -26,7 +26,7 @@ #include "interleaved_short_to_complex_impl.h" #include "interleaved_short_array_to_complex.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -37,10 +37,10 @@ namespace gr { } interleaved_short_to_complex_impl::interleaved_short_to_complex_impl(bool vector_input) - : gr_sync_decimator("interleaved_short_to_complex", - gr_make_io_signature (1, 1, (vector_input?2:1)*sizeof(short)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), - vector_input?1:2), + : sync_decimator("interleaved_short_to_complex", + gr::io_signature::make (1, 1, (vector_input?2:1)*sizeof(short)), + gr::io_signature::make (1, 1, sizeof(gr_complex)), + vector_input?1:2), d_vector_input(vector_input) { } diff --git a/gr-blocks/lib/interleaved_short_to_complex_impl.h b/gr-blocks/lib/interleaved_short_to_complex_impl.h index 4d027b7b5c..3280f894fd 100644 --- a/gr-blocks/lib/interleaved_short_to_complex_impl.h +++ b/gr-blocks/lib/interleaved_short_to_complex_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_INTERLEAVED_SHORT_TO_COMPLEX_IMPL_H #define INCLUDED_INTERLEAVED_SHORT_TO_COMPLEX_IMPL_H -#include <blocks/interleaved_short_to_complex.h> +#include <gnuradio/blocks/interleaved_short_to_complex.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/keep_m_in_n_impl.cc b/gr-blocks/lib/keep_m_in_n_impl.cc index 312b09c253..8ce7a81d80 100644 --- a/gr-blocks/lib/keep_m_in_n_impl.cc +++ b/gr-blocks/lib/keep_m_in_n_impl.cc @@ -25,7 +25,7 @@ #endif #include "keep_m_in_n_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -36,9 +36,9 @@ namespace gr { } keep_m_in_n_impl::keep_m_in_n_impl(size_t itemsize, int m, int n, int offset) - : gr_block("keep_m_in_n", - gr_make_io_signature (1, 1, itemsize), - gr_make_io_signature (1, 1, itemsize)), + : block("keep_m_in_n", + io_signature::make (1, 1, itemsize), + io_signature::make (1, 1, itemsize)), d_m(m), d_n(n), d_offset(offset), diff --git a/gr-blocks/lib/keep_m_in_n_impl.h b/gr-blocks/lib/keep_m_in_n_impl.h index 0b8819489a..ffb580bb3a 100644 --- a/gr-blocks/lib/keep_m_in_n_impl.h +++ b/gr-blocks/lib/keep_m_in_n_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_KEEP_M_IN_N_IMPL_H #define INCLUDED_KEEP_M_IN_N_IMPL_H -#include <blocks/keep_m_in_n.h> +#include <gnuradio/blocks/keep_m_in_n.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/keep_one_in_n_impl.cc b/gr-blocks/lib/keep_one_in_n_impl.cc index 7ab6dc14de..34012dd59a 100644 --- a/gr-blocks/lib/keep_one_in_n_impl.cc +++ b/gr-blocks/lib/keep_one_in_n_impl.cc @@ -25,7 +25,7 @@ #endif #include "keep_one_in_n_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -36,9 +36,9 @@ namespace gr { } keep_one_in_n_impl::keep_one_in_n_impl(size_t itemsize, int n) - : gr_block("keep_one_in_n", - gr_make_io_signature (1, 1, itemsize), - gr_make_io_signature (1, 1, itemsize)), + : block("keep_one_in_n", + io_signature::make (1, 1, itemsize), + io_signature::make (1, 1, itemsize)), d_count(n) { // To avoid bad behavior with using set_relative_rate in this block with @@ -92,11 +92,11 @@ namespace gr { // Because we have set TPP_DONT, we have to propagate the tags here manually. // Adjustment of the tag sample value is done using the float d_decim_rate. - std::vector<gr_tag_t> tags; - std::vector<gr_tag_t>::iterator t; + std::vector<tag_t> tags; + std::vector<tag_t>::iterator t; get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+ni); for(t = tags.begin(); t != tags.end(); t++) { - gr_tag_t new_tag = *t; + tag_t new_tag = *t; new_tag.offset *= d_decim_rate; add_item_tag(0, new_tag); } diff --git a/gr-blocks/lib/keep_one_in_n_impl.h b/gr-blocks/lib/keep_one_in_n_impl.h index 1588fb1a61..4138f164a1 100644 --- a/gr-blocks/lib/keep_one_in_n_impl.h +++ b/gr-blocks/lib/keep_one_in_n_impl.h @@ -24,7 +24,7 @@ #ifndef INCLUDED_KEEP_ONE_IN_N_IMPL_H #define INCLUDED_KEEP_ONE_IN_N_IMPL_H -#include <blocks/keep_one_in_n.h> +#include <gnuradio/blocks/keep_one_in_n.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/lfsr_32k_source_s_impl.cc b/gr-blocks/lib/lfsr_32k_source_s_impl.cc index 738e732b49..58b0ad7def 100644 --- a/gr-blocks/lib/lfsr_32k_source_s_impl.cc +++ b/gr-blocks/lib/lfsr_32k_source_s_impl.cc @@ -25,7 +25,7 @@ #endif #include "lfsr_32k_source_s_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } lfsr_32k_source_s_impl::lfsr_32k_source_s_impl() - : gr_sync_block("lfsr_32k_source_s", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, sizeof(short))), + : sync_block("lfsr_32k_source_s", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, sizeof(short))), d_index(0) { lfsr_32k lfsr; diff --git a/gr-blocks/lib/lfsr_32k_source_s_impl.h b/gr-blocks/lib/lfsr_32k_source_s_impl.h index b8c684e8d6..40fc6b6d84 100644 --- a/gr-blocks/lib/lfsr_32k_source_s_impl.h +++ b/gr-blocks/lib/lfsr_32k_source_s_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_LFSR_32K_SOURCE_S_IMPL_H #define INCLUDED_GR_LFSR_32K_SOURCE_S_IMPL_H -#include <blocks/lfsr_32k_source_s.h> -#include <blocks/lfsr_32k.h> -#include <gr_sync_block.h> +#include <gnuradio/blocks/lfsr_32k_source_s.h> +#include <gnuradio/blocks/lfsr_32k.h> +#include <gnuradio/sync_block.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/max_XX_impl.cc.t b/gr-blocks/lib/max_XX_impl.cc.t index 669e2fd30d..21ce85e8ec 100644 --- a/gr-blocks/lib/max_XX_impl.cc.t +++ b/gr-blocks/lib/max_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -40,9 +40,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(size_t vlen) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(1, -1, vlen*sizeof(@I_TYPE@)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@))), + : sync_block("@BASE_NAME@", + io_signature::make(1, -1, vlen*sizeof(@I_TYPE@)), + io_signature::make(1, 1, sizeof(@O_TYPE@))), d_vlen(vlen) { } diff --git a/gr-blocks/lib/max_XX_impl.h.t b/gr-blocks/lib/max_XX_impl.h.t index 0f1643f6b9..79da4e1d82 100644 --- a/gr-blocks/lib/max_XX_impl.h.t +++ b/gr-blocks/lib/max_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/message_burst_source_impl.cc b/gr-blocks/lib/message_burst_source_impl.cc index 5ac417f7a5..573959e027 100644 --- a/gr-blocks/lib/message_burst_source_impl.cc +++ b/gr-blocks/lib/message_burst_source_impl.cc @@ -25,7 +25,7 @@ #endif #include "message_burst_source_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> #include <errno.h> #include <sys/types.h> @@ -33,7 +33,7 @@ #include <fcntl.h> #include <stdexcept> #include <string.h> -#include <gr_tags.h> +#include <gnuradio/tags.h> namespace gr { namespace blocks { @@ -46,17 +46,17 @@ namespace gr { } message_burst_source::sptr - message_burst_source::make(size_t itemsize, gr_msg_queue_sptr msgq) + message_burst_source::make(size_t itemsize, msg_queue::sptr msgq) { return gnuradio::get_initial_sptr (new message_burst_source_impl(itemsize, msgq)); } message_burst_source_impl::message_burst_source_impl(size_t itemsize, int msgq_limit) - : gr_sync_block("message_burst_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(gr_make_msg_queue(msgq_limit)), + : sync_block("message_burst_source", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, itemsize)), + d_itemsize(itemsize), d_msgq(msg_queue::make(msgq_limit)), d_msg_offset(0), d_eof(false) { std::stringstream id; @@ -64,10 +64,10 @@ namespace gr { d_me = pmt::string_to_symbol(id.str()); } - message_burst_source_impl::message_burst_source_impl(size_t itemsize, gr_msg_queue_sptr msgq) - : gr_sync_block("message_burst_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), + message_burst_source_impl::message_burst_source_impl(size_t itemsize, msg_queue::sptr msgq) + : sync_block("message_burst_source", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, itemsize)), d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false) { diff --git a/gr-blocks/lib/message_burst_source_impl.h b/gr-blocks/lib/message_burst_source_impl.h index 2d5e6a974f..ceb0985e65 100644 --- a/gr-blocks/lib/message_burst_source_impl.h +++ b/gr-blocks/lib/message_burst_source_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_MESSAGE_BURST_SOURCE_IMPL_H #define INCLUDED_GR_MESSAGE_BURST_SOURCE_IMPL_H -#include <blocks/message_burst_source.h> -#include <gr_message.h> +#include <gnuradio/blocks/message_burst_source.h> +#include <gnuradio/message.h> namespace gr { namespace blocks { @@ -33,8 +33,8 @@ namespace gr { { private: size_t d_itemsize; - gr_msg_queue_sptr d_msgq; - gr_message_sptr d_msg; + msg_queue::sptr d_msgq; + message::sptr d_msg; unsigned d_msg_offset; bool d_eof; @@ -42,10 +42,10 @@ namespace gr { public: message_burst_source_impl(size_t itemsize, int msgq_limit); - message_burst_source_impl(size_t itemsize, gr_msg_queue_sptr msgq); + message_burst_source_impl(size_t itemsize, msg_queue::sptr msgq); ~message_burst_source_impl(); - gr_msg_queue_sptr msgq() const { return d_msgq; } + msg_queue::sptr msgq() const { return d_msgq; } int work(int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gr-blocks/lib/message_debug_impl.cc b/gr-blocks/lib/message_debug_impl.cc index 04f31f88a2..3f7c6ef097 100644 --- a/gr-blocks/lib/message_debug_impl.cc +++ b/gr-blocks/lib/message_debug_impl.cc @@ -25,7 +25,7 @@ #endif #include "message_debug_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> #include <iostream> @@ -97,9 +97,9 @@ namespace gr { } message_debug_impl::message_debug_impl() - : gr_block("message_debug", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)) + : block("message_debug", + io_signature::make(0, 0, 0), + io_signature::make(0, 0, 0)) { message_port_register_in(pmt::mp("print")); set_msg_handler(pmt::mp("print"), boost::bind(&message_debug_impl::print, this, _1)); diff --git a/gr-blocks/lib/message_debug_impl.h b/gr-blocks/lib/message_debug_impl.h index 817a9a834c..5a6e2e4acb 100644 --- a/gr-blocks/lib/message_debug_impl.h +++ b/gr-blocks/lib/message_debug_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_MESSAGE_DEBUG_IMPL_H #define INCLUDED_GR_MESSAGE_DEBUG_IMPL_H -#include <blocks/message_debug.h> -#include <gr_block.h> -#include <thread/thread.h> +#include <gnuradio/blocks/message_debug.h> +#include <gnuradio/block.h> +#include <gnuradio/thread/thread.h> #include <pmt/pmt.h> namespace gr { diff --git a/gr-blocks/lib/message_sink_impl.cc b/gr-blocks/lib/message_sink_impl.cc index fbc7b27d58..4dfcc6396b 100644 --- a/gr-blocks/lib/message_sink_impl.cc +++ b/gr-blocks/lib/message_sink_impl.cc @@ -25,7 +25,7 @@ #endif #include "message_sink_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> #include <errno.h> #include <sys/types.h> @@ -38,34 +38,34 @@ namespace gr { namespace blocks { message_sink::sptr - message_sink::make(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block) + message_sink::make(size_t itemsize, msg_queue::sptr msgq, bool dont_block) { return gnuradio::get_initial_sptr (new message_sink_impl(itemsize, msgq, dont_block)); } message_sink::sptr - message_sink::make(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block, + message_sink::make(size_t itemsize, msg_queue::sptr msgq, bool dont_block, const std::string& lengthtagname) { return gnuradio::get_initial_sptr (new message_sink_impl(itemsize, msgq, dont_block, lengthtagname)); } - message_sink_impl::message_sink_impl(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block) - : gr_sync_block("message_sink", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(0, 0, 0)), + message_sink_impl::message_sink_impl(size_t itemsize, msg_queue::sptr msgq, bool dont_block) + : sync_block("message_sink", + io_signature::make(1, 1, itemsize), + io_signature::make(0, 0, 0)), d_itemsize(itemsize), d_msgq(msgq), d_dont_block(dont_block), d_tags(false), d_items_read(0) { } - message_sink_impl::message_sink_impl(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block, + message_sink_impl::message_sink_impl(size_t itemsize, msg_queue::sptr msgq, bool dont_block, const std::string& lengthtagname) - : gr_sync_block("message_sink", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(0, 0, 0)), + : sync_block("message_sink", + io_signature::make(1, 1, itemsize), + io_signature::make(0, 0, 0)), d_itemsize(itemsize), d_msgq(msgq), d_dont_block(dont_block), d_tags(true), d_lengthtagname(lengthtagname), d_items_read(0) { @@ -84,7 +84,7 @@ namespace gr { if (d_tags) { long packet_length = 0; - std::vector<gr_tag_t> tags; + std::vector<tag_t> tags; this->get_tags_in_range(tags, 0, d_items_read, d_items_read+1); //const size_t ninput_items = noutput_items; //assumption for sync block, this can change for (unsigned int i = 0; i < tags.size(); i++) { @@ -98,10 +98,10 @@ namespace gr { if (noutput_items >= packet_length ) { // If the message queue is full we drop the packet. if (!d_msgq->full_p()) { - gr_message_sptr msg = gr_make_message(0, // msg type - d_itemsize, // arg1 for other end - packet_length, // arg2 for other end (redundant) - packet_length * d_itemsize); // len of msg + message::sptr msg = message::make(0, // msg type + d_itemsize, // arg1 for other end + packet_length, // arg2 for other end (redundant) + packet_length * d_itemsize); // len of msg memcpy(msg->msg(), in, packet_length * d_itemsize); d_msgq->handle(msg); // send it } @@ -114,10 +114,10 @@ namespace gr { // If the queue if full we drop all the data we got. if (!d_msgq->full_p()) { // build a message to hold whatever we've got - gr_message_sptr msg = gr_make_message(0, // msg type - d_itemsize, // arg1 for other end - noutput_items, // arg2 for other end (redundant) - noutput_items * d_itemsize); // len of msg + message::sptr msg = message::make(0, // msg type + d_itemsize, // arg1 for other end + noutput_items, // arg2 for other end (redundant) + noutput_items * d_itemsize); // len of msg memcpy(msg->msg(), in, noutput_items * d_itemsize); d_msgq->handle(msg); // send it diff --git a/gr-blocks/lib/message_sink_impl.h b/gr-blocks/lib/message_sink_impl.h index 280a46765e..e0ae3d00c0 100644 --- a/gr-blocks/lib/message_sink_impl.h +++ b/gr-blocks/lib/message_sink_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_MESSAGE_SINK_IMPL_H #define INCLUDED_GR_MESSAGE_SINK_IMPL_H -#include <blocks/message_sink.h> +#include <gnuradio/blocks/message_sink.h> namespace gr { namespace blocks { @@ -32,15 +32,15 @@ namespace gr { { private: size_t d_itemsize; - gr_msg_queue_sptr d_msgq; + msg_queue::sptr d_msgq; bool d_dont_block; bool d_tags; std::string d_lengthtagname; uint64_t d_items_read; public: - message_sink_impl(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block); - message_sink_impl(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block, + message_sink_impl(size_t itemsize, msg_queue::sptr msgq, bool dont_block); + message_sink_impl(size_t itemsize, msg_queue::sptr msgq, bool dont_block, const std::string& lengthtagname); ~message_sink_impl(); diff --git a/gr-blocks/lib/message_source_impl.cc b/gr-blocks/lib/message_source_impl.cc index 818cd336f1..05ec2f248b 100644 --- a/gr-blocks/lib/message_source_impl.cc +++ b/gr-blocks/lib/message_source_impl.cc @@ -25,7 +25,7 @@ #endif #include "message_source_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> #include <errno.h> #include <sys/types.h> @@ -45,14 +45,14 @@ namespace gr { } message_source::sptr - message_source::make(size_t itemsize, gr_msg_queue_sptr msgq) + message_source::make(size_t itemsize, msg_queue::sptr msgq) { return gnuradio::get_initial_sptr (new message_source_impl(itemsize, msgq)); } message_source::sptr - message_source::make(size_t itemsize, gr_msg_queue_sptr msgq, + message_source::make(size_t itemsize, msg_queue::sptr msgq, const std::string& lengthtagname) { return gnuradio::get_initial_sptr @@ -60,28 +60,28 @@ namespace gr { } message_source_impl::message_source_impl(size_t itemsize, int msgq_limit) - : gr_sync_block("message_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(gr_make_msg_queue(msgq_limit)), + : sync_block("message_source", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, itemsize)), + d_itemsize(itemsize), d_msgq(msg_queue::make(msgq_limit)), d_msg_offset(0), d_eof(false), d_tags(false) { } - message_source_impl::message_source_impl(size_t itemsize, gr_msg_queue_sptr msgq) - : gr_sync_block("message_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), + message_source_impl::message_source_impl(size_t itemsize, msg_queue::sptr msgq) + : sync_block("message_source", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, itemsize)), d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false), d_tags(false) { } - message_source_impl::message_source_impl(size_t itemsize, gr_msg_queue_sptr msgq, + message_source_impl::message_source_impl(size_t itemsize, msg_queue::sptr msgq, const std::string& lengthtagname) - : gr_sync_block("message_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), + : sync_block("message_source", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, itemsize)), d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false), d_tags(true), d_lengthtagname(lengthtagname) { diff --git a/gr-blocks/lib/message_source_impl.h b/gr-blocks/lib/message_source_impl.h index 8fbd209e0a..bbc8f728d5 100644 --- a/gr-blocks/lib/message_source_impl.h +++ b/gr-blocks/lib/message_source_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_MESSAGE_SOURCE_IMPL_H #define INCLUDED_GR_MESSAGE_SOURCE_IMPL_H -#include <blocks/message_source.h> -#include <gr_message.h> +#include <gnuradio/blocks/message_source.h> +#include <gnuradio/message.h> namespace gr { namespace blocks { @@ -33,8 +33,8 @@ namespace gr { { private: size_t d_itemsize; - gr_msg_queue_sptr d_msgq; - gr_message_sptr d_msg; + msg_queue::sptr d_msgq; + message::sptr d_msg; unsigned d_msg_offset; bool d_eof; bool d_tags; @@ -43,13 +43,13 @@ namespace gr { public: message_source_impl(size_t itemsize, int msgq_limit); - message_source_impl(size_t itemsize, gr_msg_queue_sptr msgq); - message_source_impl(size_t itemsize, gr_msg_queue_sptr msgq, + message_source_impl(size_t itemsize, msg_queue::sptr msgq); + message_source_impl(size_t itemsize, msg_queue::sptr msgq, const std::string& lengthtagname); ~message_source_impl(); - gr_msg_queue_sptr msgq() const { return d_msgq; } + msg_queue::sptr msgq() const { return d_msgq; } int work(int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gr-blocks/lib/message_strobe_impl.cc b/gr-blocks/lib/message_strobe_impl.cc index c4b0e5d567..3f58fdcaac 100644 --- a/gr-blocks/lib/message_strobe_impl.cc +++ b/gr-blocks/lib/message_strobe_impl.cc @@ -25,7 +25,7 @@ #endif #include "message_strobe_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> #include <errno.h> #include <sys/types.h> @@ -46,9 +46,9 @@ namespace gr { } message_strobe_impl::message_strobe_impl(pmt::pmt_t msg, float period_ms) - : gr_block("message_strobe", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), + : block("message_strobe", + io_signature::make(0, 0, 0), + io_signature::make(0, 0, 0)), d_finished(false), d_period_ms(period_ms), d_msg(msg) diff --git a/gr-blocks/lib/message_strobe_impl.h b/gr-blocks/lib/message_strobe_impl.h index 1b2edae593..7a54680286 100644 --- a/gr-blocks/lib/message_strobe_impl.h +++ b/gr-blocks/lib/message_strobe_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_MESSAGE_STROBE_IMPL_H #define INCLUDED_GR_MESSAGE_STROBE_IMPL_H -#include <blocks/message_strobe.h> +#include <gnuradio/blocks/message_strobe.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/moving_average_XX_impl.cc.t b/gr-blocks/lib/moving_average_XX_impl.cc.t index 566deff116..089166971f 100644 --- a/gr-blocks/lib/moving_average_XX_impl.cc.t +++ b/gr-blocks/lib/moving_average_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@NAME_IMPL@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -40,9 +40,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(int length, @O_TYPE@ scale, int max_iter) - : gr_sync_block("@NAME@", - gr_make_io_signature(1, 1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@))), + : sync_block("@NAME@", + io_signature::make(1, 1, sizeof(@I_TYPE@)), + io_signature::make(1, 1, sizeof(@O_TYPE@))), d_length(length), d_scale(scale), d_max_iter(max_iter), diff --git a/gr-blocks/lib/moving_average_XX_impl.h.t b/gr-blocks/lib/moving_average_XX_impl.h.t index 7234cbe139..17e8ef5da9 100644 --- a/gr-blocks/lib/moving_average_XX_impl.h.t +++ b/gr-blocks/lib/moving_average_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/multiply_XX_impl.cc.t b/gr-blocks/lib/multiply_XX_impl.cc.t index bda4eac6aa..3f82a1bbe8 100644 --- a/gr-blocks/lib/multiply_XX_impl.cc.t +++ b/gr-blocks/lib/multiply_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(size_t vlen) - : gr_sync_block ("@NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)), + : sync_block ("@NAME@", + io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen), + io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)), d_vlen(vlen) { } diff --git a/gr-blocks/lib/multiply_XX_impl.h.t b/gr-blocks/lib/multiply_XX_impl.h.t index 78c62b5e1e..2b0ea25a1b 100644 --- a/gr-blocks/lib/multiply_XX_impl.h.t +++ b/gr-blocks/lib/multiply_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/multiply_cc_impl.cc b/gr-blocks/lib/multiply_cc_impl.cc index e5160a9d5b..b54296c112 100644 --- a/gr-blocks/lib/multiply_cc_impl.cc +++ b/gr-blocks/lib/multiply_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include <multiply_cc_impl.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } multiply_cc_impl::multiply_cc_impl(size_t vlen) - : gr_sync_block("multiply_cc", - gr_make_io_signature (1, -1, sizeof(gr_complex)*vlen), - gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen)), + : sync_block("multiply_cc", + io_signature::make (1, -1, sizeof(gr_complex)*vlen), + io_signature::make (1, 1, sizeof(gr_complex)*vlen)), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/multiply_cc_impl.h b/gr-blocks/lib/multiply_cc_impl.h index 1595dc524c..0419a5439b 100644 --- a/gr-blocks/lib/multiply_cc_impl.h +++ b/gr-blocks/lib/multiply_cc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_BLOCKS_MULTIPLY_CC_IMPL_H #define INCLUDED_BLOCKS_MULTIPLY_CC_IMPL_H -#include <blocks/multiply_cc.h> +#include <gnuradio/blocks/multiply_cc.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/multiply_conjugate_cc_impl.cc b/gr-blocks/lib/multiply_conjugate_cc_impl.cc index 7a4356c453..671e1160f6 100644 --- a/gr-blocks/lib/multiply_conjugate_cc_impl.cc +++ b/gr-blocks/lib/multiply_conjugate_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include <multiply_conjugate_cc_impl.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } multiply_conjugate_cc_impl::multiply_conjugate_cc_impl(size_t vlen) - : gr_sync_block("multiply_conjugate_cc", - gr_make_io_signature (2, 2, sizeof(gr_complex)*vlen), - gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen)), + : sync_block("multiply_conjugate_cc", + io_signature::make (2, 2, sizeof(gr_complex)*vlen), + io_signature::make (1, 1, sizeof(gr_complex)*vlen)), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/multiply_conjugate_cc_impl.h b/gr-blocks/lib/multiply_conjugate_cc_impl.h index 66e7ec55b4..f3d3b64d6b 100644 --- a/gr-blocks/lib/multiply_conjugate_cc_impl.h +++ b/gr-blocks/lib/multiply_conjugate_cc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_BLOCKS_MULTIPLY_CONJUGATE_CC_IMPL_H #define INCLUDED_BLOCKS_MULTIPLY_CONJUGATE_CC_IMPL_H -#include <blocks/multiply_conjugate_cc.h> +#include <gnuradio/blocks/multiply_conjugate_cc.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/multiply_const_XX_impl.cc.t b/gr-blocks/lib/multiply_const_XX_impl.cc.t index 8ca79f6f39..f58dd33945 100644 --- a/gr-blocks/lib/multiply_const_XX_impl.cc.t +++ b/gr-blocks/lib/multiply_const_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(@O_TYPE@ k) - : gr_sync_block ("@NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), + : sync_block ("@NAME@", + io_signature::make (1, 1, sizeof (@I_TYPE@)), + io_signature::make (1, 1, sizeof (@O_TYPE@))), d_k(k) { } diff --git a/gr-blocks/lib/multiply_const_XX_impl.h.t b/gr-blocks/lib/multiply_const_XX_impl.h.t index cae5ca8135..e0c2ae54bc 100644 --- a/gr-blocks/lib/multiply_const_XX_impl.h.t +++ b/gr-blocks/lib/multiply_const_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/multiply_const_cc_impl.cc b/gr-blocks/lib/multiply_const_cc_impl.cc index 7618150da2..1f363fd4a3 100644 --- a/gr-blocks/lib/multiply_const_cc_impl.cc +++ b/gr-blocks/lib/multiply_const_cc_impl.cc @@ -27,7 +27,7 @@ #endif #include <multiply_const_cc_impl.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } multiply_const_cc_impl::multiply_const_cc_impl(gr_complex k, size_t vlen) - : gr_sync_block ("multiply_const_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)*vlen), - gr_make_io_signature (1, 1, sizeof (gr_complex)*vlen)), + : sync_block ("multiply_const_cc", + io_signature::make (1, 1, sizeof (gr_complex)*vlen), + io_signature::make (1, 1, sizeof (gr_complex)*vlen)), d_k(k), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/multiply_const_cc_impl.h b/gr-blocks/lib/multiply_const_cc_impl.h index 81c8cc6da5..bdd7017c8f 100644 --- a/gr-blocks/lib/multiply_const_cc_impl.h +++ b/gr-blocks/lib/multiply_const_cc_impl.h @@ -25,7 +25,7 @@ #ifndef INCLUDED_MULTIPLY_CONST_CC_IMPL_H #define INCLUDED_MULTIPLY_CONST_CC_IMPL_H -#include <blocks/multiply_const_cc.h> +#include <gnuradio/blocks/multiply_const_cc.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/multiply_const_ff_impl.cc b/gr-blocks/lib/multiply_const_ff_impl.cc index e9cd347975..67205c06c0 100644 --- a/gr-blocks/lib/multiply_const_ff_impl.cc +++ b/gr-blocks/lib/multiply_const_ff_impl.cc @@ -27,7 +27,7 @@ #endif #include <multiply_const_ff_impl.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } multiply_const_ff_impl::multiply_const_ff_impl(float k, size_t vlen) - : gr_sync_block ("multiply_const_ff", - gr_make_io_signature (1, 1, sizeof (float)*vlen), - gr_make_io_signature (1, 1, sizeof (float)*vlen)), + : sync_block ("multiply_const_ff", + io_signature::make (1, 1, sizeof (float)*vlen), + io_signature::make (1, 1, sizeof (float)*vlen)), d_k(k), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/multiply_const_ff_impl.h b/gr-blocks/lib/multiply_const_ff_impl.h index e63a3279a2..976d0a7507 100644 --- a/gr-blocks/lib/multiply_const_ff_impl.h +++ b/gr-blocks/lib/multiply_const_ff_impl.h @@ -25,7 +25,7 @@ #ifndef INCLUDED_MULTIPLY_CONST_FF_IMPL_H #define INCLUDED_MULTIPLY_CONST_FF_IMPL_H -#include <blocks/multiply_const_ff.h> +#include <gnuradio/blocks/multiply_const_ff.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/multiply_const_vXX_impl.cc.t b/gr-blocks/lib/multiply_const_vXX_impl.cc.t index dd20f28939..55b3d3e41d 100644 --- a/gr-blocks/lib/multiply_const_vXX_impl.cc.t +++ b/gr-blocks/lib/multiply_const_vXX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(std::vector<@O_TYPE@> k) - : gr_sync_block ("@NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)*k.size()), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*k.size())), + : sync_block ("@NAME@", + io_signature::make (1, 1, sizeof (@I_TYPE@)*k.size()), + io_signature::make (1, 1, sizeof (@O_TYPE@)*k.size())), d_k(k) { } diff --git a/gr-blocks/lib/multiply_const_vXX_impl.h.t b/gr-blocks/lib/multiply_const_vXX_impl.h.t index a7a6197258..6c087d9461 100644 --- a/gr-blocks/lib/multiply_const_vXX_impl.h.t +++ b/gr-blocks/lib/multiply_const_vXX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/multiply_ff_impl.cc b/gr-blocks/lib/multiply_ff_impl.cc index 6e8f277114..912c1bb926 100644 --- a/gr-blocks/lib/multiply_ff_impl.cc +++ b/gr-blocks/lib/multiply_ff_impl.cc @@ -25,7 +25,7 @@ #endif #include <multiply_ff_impl.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } multiply_ff_impl::multiply_ff_impl(size_t vlen) - : gr_sync_block("multiply_ff", - gr_make_io_signature (1, -1, sizeof(float)*vlen), - gr_make_io_signature (1, 1, sizeof(float)*vlen)), + : sync_block("multiply_ff", + io_signature::make (1, -1, sizeof(float)*vlen), + io_signature::make (1, 1, sizeof(float)*vlen)), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/multiply_ff_impl.h b/gr-blocks/lib/multiply_ff_impl.h index 2c5325a98a..e084b0e494 100644 --- a/gr-blocks/lib/multiply_ff_impl.h +++ b/gr-blocks/lib/multiply_ff_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_BLOCKS_MULTIPLY_FF_IMPL_H #define INCLUDED_BLOCKS_MULTIPLY_FF_IMPL_H -#include <blocks/multiply_ff.h> +#include <gnuradio/blocks/multiply_ff.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/mute_XX_impl.cc.t b/gr-blocks/lib/mute_XX_impl.cc.t index b29e9edada..af46dc221a 100644 --- a/gr-blocks/lib/mute_XX_impl.cc.t +++ b/gr-blocks/lib/mute_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> namespace gr { @@ -41,9 +41,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(bool mute) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@))), + : sync_block("@BASE_NAME@", + io_signature::make(1, 1, sizeof(@I_TYPE@)), + io_signature::make(1, 1, sizeof(@O_TYPE@))), d_mute(mute) { } diff --git a/gr-blocks/lib/mute_XX_impl.h.t b/gr-blocks/lib/mute_XX_impl.h.t index de93c8eb82..b519bb20a1 100644 --- a/gr-blocks/lib/mute_XX_impl.h.t +++ b/gr-blocks/lib/mute_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/nlog10_ff_impl.cc b/gr-blocks/lib/nlog10_ff_impl.cc index f662b8fd51..bed2da4d0d 100644 --- a/gr-blocks/lib/nlog10_ff_impl.cc +++ b/gr-blocks/lib/nlog10_ff_impl.cc @@ -25,7 +25,7 @@ #endif #include "nlog10_ff_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -36,9 +36,9 @@ namespace gr { } nlog10_ff_impl::nlog10_ff_impl(float n, size_t vlen, float k) - : gr_sync_block("nlog10_ff", - gr_make_io_signature (1, 1, sizeof(float)*vlen), - gr_make_io_signature (1, 1, sizeof(float)*vlen)), + : sync_block("nlog10_ff", + io_signature::make (1, 1, sizeof(float)*vlen), + io_signature::make (1, 1, sizeof(float)*vlen)), d_n(n), d_vlen(vlen), d_k(k) { } diff --git a/gr-blocks/lib/nlog10_ff_impl.h b/gr-blocks/lib/nlog10_ff_impl.h index 3789bc3173..2935904366 100644 --- a/gr-blocks/lib/nlog10_ff_impl.h +++ b/gr-blocks/lib/nlog10_ff_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_NLOG10_FF_IMPL_H #define INCLUDED_NLOG10_FF_IMPL_H -#include <blocks/nlog10_ff.h> +#include <gnuradio/blocks/nlog10_ff.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/nop_impl.cc b/gr-blocks/lib/nop_impl.cc index 387eda0baf..da1398e51a 100644 --- a/gr-blocks/lib/nop_impl.cc +++ b/gr-blocks/lib/nop_impl.cc @@ -25,7 +25,7 @@ #endif #include "nop_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <boost/bind.hpp> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } nop_impl::nop_impl (size_t sizeof_stream_item) - : gr_block("nop", - gr_make_io_signature(0, -1, sizeof_stream_item), - gr_make_io_signature(0, -1, sizeof_stream_item)), + : block("nop", + io_signature::make(0, -1, sizeof_stream_item), + io_signature::make(0, -1, sizeof_stream_item)), d_nmsgs_recvd(0) { // Arrange to have count_received_msgs called when messages are received. diff --git a/gr-blocks/lib/nop_impl.h b/gr-blocks/lib/nop_impl.h index e01e8fc9d9..a76b2a3288 100644 --- a/gr-blocks/lib/nop_impl.h +++ b/gr-blocks/lib/nop_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_NOP_IMPL_H #define INCLUDED_GR_NOP_IMPL_H -#include <blocks/nop.h> +#include <gnuradio/blocks/nop.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/not_XX_impl.cc.t b/gr-blocks/lib/not_XX_impl.cc.t index b491a4ccc9..cb9be5cdb8 100644 --- a/gr-blocks/lib/not_XX_impl.cc.t +++ b/gr-blocks/lib/not_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(size_t vlen) - : gr_sync_block ("@NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)*vlen), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)), + : sync_block ("@NAME@", + io_signature::make (1, 1, sizeof (@I_TYPE@)*vlen), + io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)), d_vlen(vlen) { } diff --git a/gr-blocks/lib/not_XX_impl.h.t b/gr-blocks/lib/not_XX_impl.h.t index 25f0da0c85..f7db3f2162 100644 --- a/gr-blocks/lib/not_XX_impl.h.t +++ b/gr-blocks/lib/not_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/null_sink_impl.cc b/gr-blocks/lib/null_sink_impl.cc index b780a2405a..41adeea0fd 100644 --- a/gr-blocks/lib/null_sink_impl.cc +++ b/gr-blocks/lib/null_sink_impl.cc @@ -25,7 +25,7 @@ #endif #include "null_sink_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } null_sink_impl::null_sink_impl(size_t sizeof_stream_item) - : gr_sync_block("null_sink", - gr_make_io_signature(1, 1, sizeof_stream_item), - gr_make_io_signature(0, 0, 0)) + : sync_block("null_sink", + io_signature::make(1, 1, sizeof_stream_item), + io_signature::make(0, 0, 0)) { } diff --git a/gr-blocks/lib/null_sink_impl.h b/gr-blocks/lib/null_sink_impl.h index bb4c695c23..948bc19de6 100644 --- a/gr-blocks/lib/null_sink_impl.h +++ b/gr-blocks/lib/null_sink_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_NULL_SINK_IMPL_H #define INCLUDED_GR_NULL_SINK_IMPL_H -#include <blocks/null_sink.h> +#include <gnuradio/blocks/null_sink.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/null_source_impl.cc b/gr-blocks/lib/null_source_impl.cc index 81999d0501..edf0104da1 100644 --- a/gr-blocks/lib/null_source_impl.cc +++ b/gr-blocks/lib/null_source_impl.cc @@ -25,7 +25,7 @@ #endif #include "null_source_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } null_source_impl::null_source_impl (size_t sizeof_stream_item) - : gr_sync_block("null_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, sizeof_stream_item)) + : sync_block("null_source", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, sizeof_stream_item)) { } diff --git a/gr-blocks/lib/null_source_impl.h b/gr-blocks/lib/null_source_impl.h index 36201d54b6..887c77d424 100644 --- a/gr-blocks/lib/null_source_impl.h +++ b/gr-blocks/lib/null_source_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_NULL_SOURCE_IMPL_H #define INCLUDED_GR_NULL_SOURCE_IMPL_H -#include <blocks/null_source.h> +#include <gnuradio/blocks/null_source.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/or_XX_impl.cc.t b/gr-blocks/lib/or_XX_impl.cc.t index 15f6fa0b8a..95586e4fae 100644 --- a/gr-blocks/lib/or_XX_impl.cc.t +++ b/gr-blocks/lib/or_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(size_t vlen) - : gr_sync_block ("@NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)), + : sync_block ("@NAME@", + io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen), + io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)), d_vlen(vlen) { } diff --git a/gr-blocks/lib/or_XX_impl.h.t b/gr-blocks/lib/or_XX_impl.h.t index 25f0da0c85..f7db3f2162 100644 --- a/gr-blocks/lib/or_XX_impl.h.t +++ b/gr-blocks/lib/or_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/pack_k_bits_bb_impl.cc b/gr-blocks/lib/pack_k_bits_bb_impl.cc index 2a7fcc04cb..9009c89ab7 100644 --- a/gr-blocks/lib/pack_k_bits_bb_impl.cc +++ b/gr-blocks/lib/pack_k_bits_bb_impl.cc @@ -25,7 +25,7 @@ #endif #include "pack_k_bits_bb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> #include <iostream> @@ -40,9 +40,9 @@ namespace gr { } pack_k_bits_bb_impl::pack_k_bits_bb_impl(unsigned k) - : gr_sync_decimator("pack_k_bits_bb", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(unsigned char)), + : sync_decimator("pack_k_bits_bb", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(unsigned char)), k), d_k(k) { diff --git a/gr-blocks/lib/pack_k_bits_bb_impl.h b/gr-blocks/lib/pack_k_bits_bb_impl.h index 668d438a46..dfe859478c 100644 --- a/gr-blocks/lib/pack_k_bits_bb_impl.h +++ b/gr-blocks/lib/pack_k_bits_bb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_PACK_K_BITS_BB_IMPL_H #define INCLUDED_GR_PACK_K_BITS_BB_IMPL_H -#include <blocks/pack_k_bits_bb.h> +#include <gnuradio/blocks/pack_k_bits_bb.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/packed_to_unpacked_XX_impl.cc.t b/gr-blocks/lib/packed_to_unpacked_XX_impl.cc.t index 4f34d83470..8ac22bdf8d 100644 --- a/gr-blocks/lib/packed_to_unpacked_XX_impl.cc.t +++ b/gr-blocks/lib/packed_to_unpacked_XX_impl.cc.t @@ -27,8 +27,8 @@ #endif #include "@NAME_IMPL@.h" -#include <gr_io_signature.h> -#include <blocks/log2_const.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/blocks/log2_const.h> #include <assert.h> namespace gr { @@ -39,17 +39,17 @@ namespace gr { @NAME@::sptr @NAME@::make(unsigned int bits_per_chunk, - gr_endianness_t endianness) + endianness_t endianness) { return gnuradio::get_initial_sptr (new @NAME_IMPL@(bits_per_chunk, endianness)); } @NAME_IMPL@::@NAME_IMPL@(unsigned int bits_per_chunk, - gr_endianness_t endianness) - : gr_block("@NAME@", - gr_make_io_signature(1, -1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, -1, sizeof(@O_TYPE@))), + endianness_t endianness) + : block("@NAME@", + io_signature::make(1, -1, sizeof(@I_TYPE@)), + io_signature::make(1, -1, sizeof(@O_TYPE@))), d_bits_per_chunk(bits_per_chunk), d_endianness(endianness), d_index(0) { assert(bits_per_chunk <= BITS_PER_TYPE); diff --git a/gr-blocks/lib/packed_to_unpacked_XX_impl.h.t b/gr-blocks/lib/packed_to_unpacked_XX_impl.h.t index f83496fa79..3f8b15c1a6 100644 --- a/gr-blocks/lib/packed_to_unpacked_XX_impl.h.t +++ b/gr-blocks/lib/packed_to_unpacked_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { @@ -34,12 +34,12 @@ namespace gr { { private: unsigned int d_bits_per_chunk; - gr_endianness_t d_endianness; + endianness_t d_endianness; unsigned int d_index; public: @NAME_IMPL@(unsigned int bits_per_chunk, - gr_endianness_t endianness); + endianness_t endianness); ~@NAME_IMPL@(); void forecast(int noutput_items, diff --git a/gr-blocks/lib/patterned_interleaver_impl.cc b/gr-blocks/lib/patterned_interleaver_impl.cc index 437c733a10..ba298afc8e 100644 --- a/gr-blocks/lib/patterned_interleaver_impl.cc +++ b/gr-blocks/lib/patterned_interleaver_impl.cc @@ -25,7 +25,7 @@ #endif #include "patterned_interleaver_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -36,9 +36,9 @@ namespace gr { } patterned_interleaver_impl::patterned_interleaver_impl(size_t itemsize, std::vector<int> pattern) - : gr_block ("patterned_interleaver", - gr_make_io_signature (pattern_max(pattern)+1, pattern_max(pattern)+1, itemsize), - gr_make_io_signature (1, 1, itemsize)), + : block ("patterned_interleaver", + io_signature::make (pattern_max(pattern)+1, pattern_max(pattern)+1, itemsize), + io_signature::make (1, 1, itemsize)), d_pattern(pattern), d_counts( pattern_max(pattern)+1, 0), d_itemsize(itemsize) { BOOST_FOREACH( int i, d_pattern) diff --git a/gr-blocks/lib/patterned_interleaver_impl.h b/gr-blocks/lib/patterned_interleaver_impl.h index 4266c96360..2401480ad9 100644 --- a/gr-blocks/lib/patterned_interleaver_impl.h +++ b/gr-blocks/lib/patterned_interleaver_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_PATTERNED_INTERLEAVER_IMPL_H #define INCLUDED_PATTERNED_INTERLEAVER_IMPL_H -#include <blocks/patterned_interleaver.h> +#include <gnuradio/blocks/patterned_interleaver.h> #include <boost/foreach.hpp> namespace gr { diff --git a/gr-blocks/lib/pdu.cc b/gr-blocks/lib/pdu.cc index 9d5322bfe3..0c3e3aa334 100644 --- a/gr-blocks/lib/pdu.cc +++ b/gr-blocks/lib/pdu.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <blocks/pdu.h> +#include <gnuradio/blocks/pdu.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/pdu_to_tagged_stream_impl.cc b/gr-blocks/lib/pdu_to_tagged_stream_impl.cc index 1fc4857f2e..d6ad78cb97 100644 --- a/gr-blocks/lib/pdu_to_tagged_stream_impl.cc +++ b/gr-blocks/lib/pdu_to_tagged_stream_impl.cc @@ -25,8 +25,8 @@ #endif #include "pdu_to_tagged_stream_impl.h" -#include <blocks/pdu.h> -#include <gr_io_signature.h> +#include <gnuradio/blocks/pdu.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } pdu_to_tagged_stream_impl::pdu_to_tagged_stream_impl(pdu::vector_type type) - : gr_sync_block("pdu_to_tagged_stream", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, pdu::itemsize(type))), + : sync_block("pdu_to_tagged_stream", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, pdu::itemsize(type))), d_itemsize(pdu::itemsize(type)), d_type(type) { diff --git a/gr-blocks/lib/pdu_to_tagged_stream_impl.h b/gr-blocks/lib/pdu_to_tagged_stream_impl.h index ca1c6437bd..8b3d13c921 100644 --- a/gr-blocks/lib/pdu_to_tagged_stream_impl.h +++ b/gr-blocks/lib/pdu_to_tagged_stream_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_PDU_TO_TAGGED_STREAM_IMPL_H #define INCLUDED_PDU_TO_TAGGED_STREAM_IMPL_H -#include <blocks/pdu_to_tagged_stream.h> +#include <gnuradio/blocks/pdu_to_tagged_stream.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/peak_detector2_fb_impl.cc b/gr-blocks/lib/peak_detector2_fb_impl.cc index 0d375c3bad..dd1b677222 100644 --- a/gr-blocks/lib/peak_detector2_fb_impl.cc +++ b/gr-blocks/lib/peak_detector2_fb_impl.cc @@ -25,7 +25,7 @@ #endif #include "peak_detector2_fb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> namespace gr { @@ -42,9 +42,9 @@ namespace gr { peak_detector2_fb_impl::peak_detector2_fb_impl(float threshold_factor_rise, int look_ahead, float alpha) - : gr_sync_block("peak_detector2_fb", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature2(1, 2, sizeof(char), sizeof(float))), + : sync_block("peak_detector2_fb", + io_signature::make(1, 1, sizeof(float)), + io_signature::make2(1, 2, sizeof(char), sizeof(float))), d_threshold_factor_rise(threshold_factor_rise), d_look_ahead(look_ahead), d_alpha(alpha), d_avg(0.0f), d_found(false) { diff --git a/gr-blocks/lib/peak_detector2_fb_impl.h b/gr-blocks/lib/peak_detector2_fb_impl.h index f03dd36a8d..53c06ca810 100644 --- a/gr-blocks/lib/peak_detector2_fb_impl.h +++ b/gr-blocks/lib/peak_detector2_fb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_PEAK_DETECTOR2_FB_IMPL_H #define INCLUDED_GR_PEAK_DETECTOR2_FB_IMPL_H -#include <blocks/peak_detector2_fb.h> +#include <gnuradio/blocks/peak_detector2_fb.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/peak_detector_XX_impl.cc.t b/gr-blocks/lib/peak_detector_XX_impl.cc.t index 27518962f5..6846a02df0 100644 --- a/gr-blocks/lib/peak_detector_XX_impl.cc.t +++ b/gr-blocks/lib/peak_detector_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@NAME_IMPL@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> namespace gr { @@ -47,9 +47,9 @@ namespace gr { @NAME_IMPL@::@NAME_IMPL@(float threshold_factor_rise, float threshold_factor_fall, int look_ahead, float alpha) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, 1, sizeof(char))), + : sync_block("@BASE_NAME@", + io_signature::make(1, 1, sizeof(@I_TYPE@)), + io_signature::make(1, 1, sizeof(char))), d_threshold_factor_rise(threshold_factor_rise), d_threshold_factor_fall(threshold_factor_fall), d_look_ahead(look_ahead), d_avg_alpha(alpha), d_avg(0), d_found(0) diff --git a/gr-blocks/lib/peak_detector_XX_impl.h.t b/gr-blocks/lib/peak_detector_XX_impl.h.t index ef52f0f744..ed364a490e 100644 --- a/gr-blocks/lib/peak_detector_XX_impl.h.t +++ b/gr-blocks/lib/peak_detector_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/plateau_detector_fb_impl.cc b/gr-blocks/lib/plateau_detector_fb_impl.cc index f68ef6463f..0c35a32f68 100644 --- a/gr-blocks/lib/plateau_detector_fb_impl.cc +++ b/gr-blocks/lib/plateau_detector_fb_impl.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "plateau_detector_fb_impl.h" namespace gr { @@ -38,9 +38,9 @@ namespace gr { } plateau_detector_fb_impl::plateau_detector_fb_impl(int max_len, float threshold) - : gr_sync_block("plateau_detector_fb", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(char))), + : sync_block("plateau_detector_fb", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(char))), d_max_len(max_len), d_threshold(threshold) {} diff --git a/gr-blocks/lib/plateau_detector_fb_impl.h b/gr-blocks/lib/plateau_detector_fb_impl.h index 67682d00f3..6497f0e838 100644 --- a/gr-blocks/lib/plateau_detector_fb_impl.h +++ b/gr-blocks/lib/plateau_detector_fb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_IMPL_H #define INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_IMPL_H -#include <blocks/plateau_detector_fb.h> +#include <gnuradio/blocks/plateau_detector_fb.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/probe_rate_impl.cc b/gr-blocks/lib/probe_rate_impl.cc index 37749c85e3..418d9d4013 100644 --- a/gr-blocks/lib/probe_rate_impl.cc +++ b/gr-blocks/lib/probe_rate_impl.cc @@ -25,7 +25,7 @@ #endif #include "probe_rate_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } probe_rate_impl::probe_rate_impl(size_t itemsize, double update_rate_ms, double alpha) : - gr_sync_block("probe_rate", - gr_make_io_signature(1,1,itemsize), - gr_make_io_signature(0,0,itemsize)), + sync_block("probe_rate", + io_signature::make(1,1,itemsize), + io_signature::make(0,0,itemsize)), d_alpha(alpha), d_beta(1.0-alpha), d_avg(0), diff --git a/gr-blocks/lib/probe_rate_impl.h b/gr-blocks/lib/probe_rate_impl.h index 139fc34876..a1c69ba189 100644 --- a/gr-blocks/lib/probe_rate_impl.h +++ b/gr-blocks/lib/probe_rate_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_PROBE_RATE_IMPL_H #define INCLUDED_GR_PROBE_RATE_IMPL_H -#include <blocks/probe_rate.h> +#include <gnuradio/blocks/probe_rate.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/probe_signal_X_impl.cc.t b/gr-blocks/lib/probe_signal_X_impl.cc.t index 4cda4e5273..1bc2793af2 100644 --- a/gr-blocks/lib/probe_signal_X_impl.cc.t +++ b/gr-blocks/lib/probe_signal_X_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -40,9 +40,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@() - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(@TYPE@)), - gr_make_io_signature(0, 0, 0)), + : sync_block("@BASE_NAME@", + io_signature::make(1, 1, sizeof(@TYPE@)), + io_signature::make(0, 0, 0)), d_level(0) { } diff --git a/gr-blocks/lib/probe_signal_X_impl.h.t b/gr-blocks/lib/probe_signal_X_impl.h.t index 9c3d05becd..c20994877f 100644 --- a/gr-blocks/lib/probe_signal_X_impl.h.t +++ b/gr-blocks/lib/probe_signal_X_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/probe_signal_vX_impl.cc.t b/gr-blocks/lib/probe_signal_vX_impl.cc.t index bd520b0bc8..5865bde41b 100644 --- a/gr-blocks/lib/probe_signal_vX_impl.cc.t +++ b/gr-blocks/lib/probe_signal_vX_impl.cc.t @@ -28,7 +28,7 @@ #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -41,9 +41,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(size_t size) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(1, 1, size*sizeof(@TYPE@)), - gr_make_io_signature(0, 0, 0)), + : sync_block("@BASE_NAME@", + io_signature::make(1, 1, size*sizeof(@TYPE@)), + io_signature::make(0, 0, 0)), d_level(size, 0), d_size(size) { } diff --git a/gr-blocks/lib/probe_signal_vX_impl.h.t b/gr-blocks/lib/probe_signal_vX_impl.h.t index 1424334a7f..434eb44ac1 100644 --- a/gr-blocks/lib/probe_signal_vX_impl.h.t +++ b/gr-blocks/lib/probe_signal_vX_impl.h.t @@ -26,7 +26,7 @@ #define @GUARD_NAME_IMPL@ #include <vector> -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/qa_block_tags.cc b/gr-blocks/lib/qa_block_tags.cc index f3139245d8..c554425f8e 100644 --- a/gr-blocks/lib/qa_block_tags.cc +++ b/gr-blocks/lib/qa_block_tags.cc @@ -25,21 +25,19 @@ #endif #include <qa_block_tags.h> -#include <gr_block.h> -#include <gr_top_block.h> -#include <blocks/null_source.h> -#include <blocks/null_sink.h> -#include <blocks/head.h> -#include <blocks/annotator_alltoall.h> -#include <blocks/annotator_1to1.h> -#include <blocks/keep_one_in_n.h> -#include <gr_tags.h> +#include <gnuradio/block.h> +#include <gnuradio/top_block.h> +#include <gnuradio/blocks/null_source.h> +#include <gnuradio/blocks/null_sink.h> +#include <gnuradio/blocks/head.h> +#include <gnuradio/blocks/annotator_alltoall.h> +#include <gnuradio/blocks/annotator_1to1.h> +#include <gnuradio/blocks/keep_one_in_n.h> +#include <gnuradio/tags.h> // ---------------------------------------------------------------- -using namespace pmt; - // set to 1 to turn on debug output // The debug output fully checks that the tags seen are what are expected. While // this behavior currently works with our implementation, there is no guarentee @@ -53,10 +51,10 @@ void qa_block_tags::t0() { unsigned int N = 1000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr::blocks::null_source::make(sizeof(int))); - gr_block_sptr head (gr::blocks::head::make(sizeof(int), N)); - gr_block_sptr snk (gr::blocks::null_sink::make(sizeof(int))); + gr::top_block_sptr tb = gr::make_top_block("top"); + gr::block_sptr src (gr::blocks::null_source::make(sizeof(int))); + gr::block_sptr head (gr::blocks::head::make(sizeof(int), N)); + gr::block_sptr snk (gr::blocks::null_sink::make(sizeof(int))); tb->connect(src, 0, head, 0); tb->connect(head, 0, snk, 0); @@ -79,16 +77,16 @@ void qa_block_tags::t1() { int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr::blocks::null_source::make(sizeof(int))); - gr_block_sptr head (gr::blocks::head::make(sizeof(int), N)); + gr::top_block_sptr tb = gr::make_top_block("top"); + gr::block_sptr src (gr::blocks::null_source::make(sizeof(int))); + gr::block_sptr head (gr::blocks::head::make(sizeof(int), N)); gr::blocks::annotator_alltoall::sptr ann0(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); gr::blocks::annotator_alltoall::sptr ann1(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); gr::blocks::annotator_alltoall::sptr ann2(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); gr::blocks::annotator_alltoall::sptr ann3(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); gr::blocks::annotator_alltoall::sptr ann4(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); - gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int))); - gr_block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int))); + gr::block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int))); + gr::block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int))); tb->connect(src, 0, head, 0); tb->connect(head, 0, ann0, 0); @@ -103,9 +101,9 @@ qa_block_tags::t1() tb->run(); - std::vector<gr_tag_t> tags0 = ann0->data(); - std::vector<gr_tag_t> tags3 = ann3->data(); - std::vector<gr_tag_t> tags4 = ann4->data(); + std::vector<gr::tag_t> tags0 = ann0->data(); + std::vector<gr::tag_t> tags3 = ann3->data(); + std::vector<gr::tag_t> tags4 = ann4->data(); // The first annotator does not receive any tags from the null sink upstream CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); @@ -119,7 +117,7 @@ qa_block_tags::t1() str1 << ann1->name() << ann1->unique_id(); str2 << ann2->name() << ann2->unique_id(); - pmt_t expected_tags3[8]; + pmt::pmt_t expected_tags3[8]; expected_tags3[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); expected_tags3[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); expected_tags3[2] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); @@ -129,7 +127,7 @@ qa_block_tags::t1() expected_tags3[6] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); expected_tags3[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - pmt_t expected_tags4[8]; + pmt::pmt_t expected_tags4[8]; expected_tags4[0] = mp(pmt::from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); expected_tags4[2] = mp(pmt::from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); @@ -160,17 +158,17 @@ void qa_block_tags::t2 () { int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr::blocks::null_source::make(sizeof(int))); - gr_block_sptr head (gr::blocks::head::make(sizeof(int), N)); + gr::top_block_sptr tb = gr::make_top_block("top"); + gr::block_sptr src (gr::blocks::null_source::make(sizeof(int))); + gr::block_sptr head (gr::blocks::head::make(sizeof(int), N)); gr::blocks::annotator_alltoall::sptr ann0(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); gr::blocks::annotator_alltoall::sptr ann1(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); gr::blocks::annotator_alltoall::sptr ann2(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); gr::blocks::annotator_alltoall::sptr ann3(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); gr::blocks::annotator_alltoall::sptr ann4(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); - gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int))); - gr_block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int))); - gr_block_sptr snk2 (gr::blocks::null_sink::make(sizeof(int))); + gr::block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int))); + gr::block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int))); + gr::block_sptr snk2 (gr::blocks::null_sink::make(sizeof(int))); tb->connect(src, 0, head, 0); tb->connect(head, 0, ann0, 0); @@ -187,11 +185,11 @@ qa_block_tags::t2 () tb->run(); - std::vector<gr_tag_t> tags0 = ann0->data(); - std::vector<gr_tag_t> tags1 = ann1->data(); - std::vector<gr_tag_t> tags2 = ann2->data(); - std::vector<gr_tag_t> tags3 = ann4->data(); - std::vector<gr_tag_t> tags4 = ann4->data(); + std::vector<gr::tag_t> tags0 = ann0->data(); + std::vector<gr::tag_t> tags1 = ann1->data(); + std::vector<gr::tag_t> tags2 = ann2->data(); + std::vector<gr::tag_t> tags3 = ann4->data(); + std::vector<gr::tag_t> tags4 = ann4->data(); // The first annotator does not receive any tags from the null sink upstream CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); @@ -209,7 +207,7 @@ qa_block_tags::t2 () str0 << ann0->name() << ann0->unique_id(); str1 << ann1->name() << ann1->unique_id(); - pmt_t expected_tags2[12]; + pmt::pmt_t expected_tags2[12]; expected_tags2[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); expected_tags2[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); expected_tags2[2] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); @@ -223,7 +221,7 @@ qa_block_tags::t2 () expected_tags2[10] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); expected_tags2[11] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - pmt_t expected_tags4[12]; + pmt::pmt_t expected_tags4[12]; expected_tags4[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(2)); expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); expected_tags4[2] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); @@ -261,16 +259,16 @@ void qa_block_tags::t3() { int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr::blocks::null_source::make(sizeof(int))); - gr_block_sptr head (gr::blocks::head::make(sizeof(int), N)); + gr::top_block_sptr tb = gr::make_top_block("top"); + gr::block_sptr src (gr::blocks::null_source::make(sizeof(int))); + gr::block_sptr head (gr::blocks::head::make(sizeof(int), N)); gr::blocks::annotator_1to1::sptr ann0 (gr::blocks::annotator_1to1::make(10000, sizeof(int))); gr::blocks::annotator_alltoall::sptr ann1 (gr::blocks::annotator_alltoall::make(10000, sizeof(int))); gr::blocks::annotator_alltoall::sptr ann2 (gr::blocks::annotator_alltoall::make(10000, sizeof(int))); gr::blocks::annotator_1to1::sptr ann3 (gr::blocks::annotator_1to1::make(10000, sizeof(int))); gr::blocks::annotator_1to1::sptr ann4 (gr::blocks::annotator_1to1::make(10000, sizeof(int))); - gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int))); - gr_block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int))); + gr::block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int))); + gr::block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int))); tb->connect(src, 0, head, 0); tb->connect(head, 0, ann0, 0); @@ -287,9 +285,9 @@ qa_block_tags::t3() tb->run(); - std::vector<gr_tag_t> tags0 = ann0->data(); - std::vector<gr_tag_t> tags3 = ann3->data(); - std::vector<gr_tag_t> tags4 = ann4->data(); + std::vector<gr::tag_t> tags0 = ann0->data(); + std::vector<gr::tag_t> tags3 = ann3->data(); + std::vector<gr::tag_t> tags4 = ann4->data(); // The first annotator does not receive any tags from the null sink upstream CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); @@ -303,7 +301,7 @@ qa_block_tags::t3() str1 << ann1->name() << ann1->unique_id(); str2 << ann2->name() << ann2->unique_id(); - pmt_t expected_tags3[8]; + pmt::pmt_t expected_tags3[8]; expected_tags3[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); expected_tags3[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); expected_tags3[2] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); @@ -313,7 +311,7 @@ qa_block_tags::t3() expected_tags3[6] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); expected_tags3[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - pmt_t expected_tags4[8]; + pmt::pmt_t expected_tags4[8]; expected_tags4[0] = mp(pmt::from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); expected_tags4[2] = mp(pmt::from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); @@ -345,14 +343,14 @@ void qa_block_tags::t4() { int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr::blocks::null_source::make(sizeof(int))); - gr_block_sptr head (gr::blocks::head::make(sizeof(int), N)); + gr::top_block_sptr tb = gr::make_top_block("top"); + gr::block_sptr src (gr::blocks::null_source::make(sizeof(int))); + gr::block_sptr head (gr::blocks::head::make(sizeof(int), N)); gr::blocks::annotator_1to1::sptr ann0(gr::blocks::annotator_1to1::make(10000, sizeof(int))); gr::blocks::annotator_1to1::sptr ann1(gr::blocks::annotator_1to1::make(10000, sizeof(int))); gr::blocks::annotator_1to1::sptr ann2(gr::blocks::annotator_1to1::make(10000, sizeof(int))); - gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int))); - gr_block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int))); + gr::block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int))); + gr::block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int))); // using 1-to-1 tag propagation without having equal number of // ins and outs. Make sure this works; will just exit run early. @@ -364,7 +362,7 @@ qa_block_tags::t4() tb->connect(ann2, 0, snk1, 0); std::cerr << std::endl - << "NOTE: This is supposed to produce an error from gr_block_executor" + << "NOTE: This is supposed to produce an error from block_executor" << std::endl; tb->run(); } @@ -374,13 +372,13 @@ void qa_block_tags::t5() { int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr::blocks::null_source::make(sizeof(float))); - gr_block_sptr head (gr::blocks::head::make(sizeof(float), N)); + gr::top_block_sptr tb = gr::make_top_block("top"); + gr::block_sptr src (gr::blocks::null_source::make(sizeof(float))); + gr::block_sptr head (gr::blocks::head::make(sizeof(float), N)); gr::blocks::annotator_alltoall::sptr ann0(gr::blocks::annotator_alltoall::make(10000, sizeof(float))); gr::blocks::annotator_alltoall::sptr ann1(gr::blocks::annotator_alltoall::make(10000, sizeof(float))); gr::blocks::annotator_alltoall::sptr ann2(gr::blocks::annotator_alltoall::make(1000, sizeof(float))); - gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(float))); + gr::block_sptr snk0 (gr::blocks::null_sink::make(sizeof(float))); // Rate change blocks gr::blocks::keep_one_in_n::sptr dec10(gr::blocks::keep_one_in_n::make(sizeof(float), 10)); @@ -394,9 +392,9 @@ qa_block_tags::t5() tb->run(); - std::vector<gr_tag_t> tags0 = ann0->data(); - std::vector<gr_tag_t> tags1 = ann1->data(); - std::vector<gr_tag_t> tags2 = ann2->data(); + std::vector<gr::tag_t> tags0 = ann0->data(); + std::vector<gr::tag_t> tags1 = ann1->data(); + std::vector<gr::tag_t> tags2 = ann2->data(); // The first annotator does not receive any tags from the null sink upstream CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); diff --git a/gr-blocks/lib/qa_blocks.cc b/gr-blocks/lib/qa_blocks.cc index 409b5d5762..149ef7aa7c 100644 --- a/gr-blocks/lib/qa_blocks.cc +++ b/gr-blocks/lib/qa_blocks.cc @@ -30,7 +30,7 @@ #include <qa_rotator.h> CppUnit::TestSuite * -qa_gr_blocks::suite() +qa_blocks::suite() { CppUnit::TestSuite *s = new CppUnit::TestSuite("gr-blocks"); diff --git a/gr-blocks/lib/qa_blocks.h b/gr-blocks/lib/qa_blocks.h index ad538134bd..4d52878454 100644 --- a/gr-blocks/lib/qa_blocks.h +++ b/gr-blocks/lib/qa_blocks.h @@ -23,12 +23,12 @@ #ifndef _QA_GR_BLOCKS_H_ #define _QA_GR_BLOCKS_H_ -#include <attributes.h> +#include <gnuradio/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for the gr-blocks directory -class __GR_ATTR_EXPORT qa_gr_blocks +class __GR_ATTR_EXPORT qa_blocks { public: //! return suite of tests for all of gr-blocks directory diff --git a/gr-blocks/lib/qa_gr_block.cc b/gr-blocks/lib/qa_gr_block.cc index 7f4a01bbd0..5df1b217d4 100644 --- a/gr-blocks/lib/qa_gr_block.cc +++ b/gr-blocks/lib/qa_gr_block.cc @@ -25,20 +25,20 @@ #endif #include <qa_gr_block.h> -#include <gr_block.h> -#include <gr_io_signature.h> -#include <blocks/null_sink.h> -#include <blocks/null_source.h> +#include <gnuradio/block.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/blocks/null_sink.h> +#include <gnuradio/blocks/null_source.h> // ---------------------------------------------------------------- void -qa_gr_block::t0 () +qa_block::t0 () { // test creation of sources - gr_block_sptr src1(gr::blocks::null_source::make(sizeof (int))); + gr::block_sptr src1(gr::blocks::null_source::make(sizeof (int))); CPPUNIT_ASSERT_EQUAL(std::string("null_source"), src1->name ()); CPPUNIT_ASSERT_EQUAL(0, src1->input_signature()->max_streams ()); CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->min_streams ()); @@ -46,7 +46,7 @@ qa_gr_block::t0 () CPPUNIT_ASSERT_EQUAL((int) sizeof(int), src1->output_signature()->sizeof_stream_item (0)); - gr_block_sptr src2(gr::blocks::null_source::make(sizeof(short))); + gr::block_sptr src2(gr::blocks::null_source::make(sizeof(short))); CPPUNIT_ASSERT_EQUAL(std::string ("null_source"), src2->name ()); CPPUNIT_ASSERT_EQUAL(0, src2->input_signature()->max_streams ()); CPPUNIT_ASSERT_EQUAL(1, src2->output_signature()->min_streams ()); @@ -57,10 +57,10 @@ qa_gr_block::t0 () void -qa_gr_block::t1 () +qa_block::t1 () { // test creation of sinks - gr_block_sptr dst1 (gr::blocks::null_sink::make (sizeof (int))); + gr::block_sptr dst1 (gr::blocks::null_sink::make (sizeof (int))); CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst1->name ()); CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->min_streams ()); CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->max_streams ()); @@ -69,7 +69,7 @@ qa_gr_block::t1 () CPPUNIT_ASSERT_EQUAL (0, dst1->output_signature()->max_streams ()); - gr_block_sptr dst2 (gr::blocks::null_sink::make (sizeof (short))); + gr::block_sptr dst2 (gr::blocks::null_sink::make (sizeof (short))); CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst2->name ()); CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->min_streams ()); CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->max_streams ()); @@ -79,11 +79,11 @@ qa_gr_block::t1 () } void -qa_gr_block::t2 () +qa_block::t2 () { } void -qa_gr_block::t3 () +qa_block::t3 () { } diff --git a/gr-blocks/lib/qa_gr_block.h b/gr-blocks/lib/qa_gr_block.h index 14c7c40d1f..06eb60f6e6 100644 --- a/gr-blocks/lib/qa_gr_block.h +++ b/gr-blocks/lib/qa_gr_block.h @@ -27,9 +27,9 @@ #include <cppunit/TestCase.h> #include <stdexcept> -class qa_gr_block : public CppUnit::TestCase { +class qa_block : public CppUnit::TestCase { - CPPUNIT_TEST_SUITE (qa_gr_block); + CPPUNIT_TEST_SUITE (qa_block); CPPUNIT_TEST (t0); CPPUNIT_TEST (t1); CPPUNIT_TEST (t2); diff --git a/gr-blocks/lib/qa_gr_flowgraph.cc b/gr-blocks/lib/qa_gr_flowgraph.cc index 1a3006039b..a6d1516162 100644 --- a/gr-blocks/lib/qa_gr_flowgraph.cc +++ b/gr-blocks/lib/qa_gr_flowgraph.cc @@ -26,9 +26,9 @@ #include <qa_gr_flowgraph.h> #include <gr_flowgraph.h> -#include <blocks/nop.h> -#include <blocks/null_source.h> -#include <blocks/null_sink.h> +#include <gnuradio/blocks/nop.h> +#include <gnuradio/blocks/null_source.h> +#include <gnuradio/blocks/null_sink.h> void qa_gr_flowgraph::t0() { @@ -41,8 +41,8 @@ void qa_gr_flowgraph::t1_connect() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); } @@ -51,8 +51,8 @@ void qa_gr_flowgraph::t2_connect_invalid_src_port_neg() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); CPPUNIT_ASSERT_THROW(fg->connect(nop1, -1, nop2, 0), std::invalid_argument); } @@ -61,8 +61,8 @@ void qa_gr_flowgraph::t3_connect_src_port_exceeds() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + block_sptr src = gr::blocks::null_source::make(sizeof(int)); + block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); CPPUNIT_ASSERT_THROW(fg->connect(src, 1, dst, 0), std::invalid_argument); } @@ -71,8 +71,8 @@ void qa_gr_flowgraph::t4_connect_invalid_dst_port_neg() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); CPPUNIT_ASSERT_THROW(fg->connect(nop1, 0, nop2, -1), std::invalid_argument); } @@ -81,8 +81,8 @@ void qa_gr_flowgraph::t5_connect_dst_port_exceeds() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + block_sptr src = gr::blocks::null_source::make(sizeof(int)); + block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); CPPUNIT_ASSERT_THROW(fg->connect(src, 0, dst, 1), std::invalid_argument); } @@ -91,9 +91,9 @@ void qa_gr_flowgraph::t6_connect_dst_in_use() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr src1 = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr src2 = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + block_sptr src1 = gr::blocks::null_source::make(sizeof(int)); + block_sptr src2 = gr::blocks::null_source::make(sizeof(int)); + block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); fg->connect(src1, 0, dst, 0); CPPUNIT_ASSERT_THROW(fg->connect(src2, 0, dst, 0), std::invalid_argument); @@ -103,9 +103,9 @@ void qa_gr_flowgraph::t7_connect_one_src_two_dst() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr dst1 = gr::blocks::null_sink::make(sizeof(int)); - gr_block_sptr dst2 = gr::blocks::null_sink::make(sizeof(int)); + block_sptr src = gr::blocks::null_source::make(sizeof(int)); + block_sptr dst1 = gr::blocks::null_sink::make(sizeof(int)); + block_sptr dst2 = gr::blocks::null_sink::make(sizeof(int)); fg->connect(src, 0, dst1, 0); fg->connect(src, 0, dst2, 0); @@ -115,8 +115,8 @@ void qa_gr_flowgraph::t8_connect_type_mismatch() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(char)); - gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop1 = gr::blocks::nop::make(sizeof(char)); + block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); CPPUNIT_ASSERT_THROW(fg->connect(nop1, 0, nop2, 0), std::invalid_argument); } @@ -125,8 +125,8 @@ void qa_gr_flowgraph::t9_disconnect() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); fg->disconnect(nop1, 0, nop2, 0); @@ -136,9 +136,9 @@ void qa_gr_flowgraph::t10_disconnect_unconnected_block() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop3 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop3 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); CPPUNIT_ASSERT_THROW(fg->disconnect(nop1, 0, nop3, 0), std::invalid_argument); @@ -148,8 +148,8 @@ void qa_gr_flowgraph::t11_disconnect_unconnected_port() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); CPPUNIT_ASSERT_THROW(fg->disconnect(nop1, 0, nop2, 1), std::invalid_argument); @@ -159,8 +159,8 @@ void qa_gr_flowgraph::t12_validate() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); fg->validate(); @@ -170,8 +170,8 @@ void qa_gr_flowgraph::t13_validate_missing_input_assignment() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); fg->connect(nop1, 0, nop2, 2); @@ -182,8 +182,8 @@ void qa_gr_flowgraph::t14_validate_missing_output_assignment() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); fg->connect(nop1, 2, nop2, 1); @@ -194,8 +194,8 @@ void qa_gr_flowgraph::t15_clear() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); @@ -212,17 +212,17 @@ void qa_gr_flowgraph::t16_partition() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop11 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop12 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop13 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop14 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop11 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop12 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop13 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop14 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop21 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop22 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop23 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop21 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop22 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop23 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop31 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop32 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop31 = gr::blocks::nop::make(sizeof(int)); + block_sptr nop32 = gr::blocks::nop::make(sizeof(int)); // Build disjoint graph #1 fg->connect(nop11, 0, nop12, 0); @@ -236,7 +236,7 @@ void qa_gr_flowgraph::t16_partition() // Build disjoint graph #3 fg->connect(nop31, 0, nop32, 0); - std::vector<gr_basic_block_vector_t> graphs = fg->partition(); + std::vector<basic_block_vector_t> graphs = fg->partition(); CPPUNIT_ASSERT(graphs.size() == 3); CPPUNIT_ASSERT(graphs[0].size() == 4); diff --git a/gr-blocks/lib/qa_gr_hier_block2.cc b/gr-blocks/lib/qa_gr_hier_block2.cc index a3d599039c..bf9a167b14 100644 --- a/gr-blocks/lib/qa_gr_hier_block2.cc +++ b/gr-blocks/lib/qa_gr_hier_block2.cc @@ -25,14 +25,14 @@ #endif #include <qa_gr_hier_block2.h> -#include <gr_hier_block2.h> -#include <gr_io_signature.h> +#include <gnuradio/hier_block2.h> +#include <gnuradio/io_signature.h> -void qa_gr_hier_block2::test_make() +void qa_hier_block2::test_make() { - gr_hier_block2_sptr src1(gr_make_hier_block2("test", - gr_make_io_signature(1, 1, 1 * sizeof(int)), - gr_make_io_signature(1, 1, 1 * sizeof(int)))); + gr::hier_block2_sptr src1(gr::make_hier_block2("test", + gr::io_signature::make(1, 1, 1 * sizeof(int)), + gr::io_signature::make(1, 1, 1 * sizeof(int)))); CPPUNIT_ASSERT(src1); CPPUNIT_ASSERT_EQUAL(std::string("test"), src1->name()); diff --git a/gr-blocks/lib/qa_gr_hier_block2.h b/gr-blocks/lib/qa_gr_hier_block2.h index 653cd27251..34a77256c6 100644 --- a/gr-blocks/lib/qa_gr_hier_block2.h +++ b/gr-blocks/lib/qa_gr_hier_block2.h @@ -27,9 +27,9 @@ #include <cppunit/TestCase.h> #include <stdexcept> -class qa_gr_hier_block2 : public CppUnit::TestCase +class qa_hier_block2 : public CppUnit::TestCase { - CPPUNIT_TEST_SUITE(qa_gr_hier_block2); + CPPUNIT_TEST_SUITE(qa_hier_block2); CPPUNIT_TEST(test_make); diff --git a/gr-blocks/lib/qa_gr_hier_block2_derived.cc b/gr-blocks/lib/qa_gr_hier_block2_derived.cc index eb747d32cc..1d45c89233 100644 --- a/gr-blocks/lib/qa_gr_hier_block2_derived.cc +++ b/gr-blocks/lib/qa_gr_hier_block2_derived.cc @@ -25,12 +25,12 @@ #endif #include <qa_gr_hier_block2_derived.h> -#include <gr_top_block.h> -#include <gr_io_signature.h> -#include <blocks/null_source.h> -#include <blocks/null_sink.h> -#include <blocks/head.h> -#include <blocks/copy.h> +#include <gnuradio/top_block.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/blocks/null_source.h> +#include <gnuradio/blocks/null_sink.h> +#include <gnuradio/blocks/head.h> +#include <gnuradio/blocks/copy.h> // Declare a test C++ hierarchical block @@ -38,7 +38,7 @@ class gr_derived_block; typedef boost::shared_ptr<gr_derived_block> gr_derived_block_sptr; gr_derived_block_sptr gr_make_derived_block(); -class gr_derived_block : public gr_hier_block2 +class gr_derived_block : public gr::hier_block2 { private: friend gr_derived_block_sptr gr_make_derived_block(); @@ -56,11 +56,11 @@ gr_make_derived_block() } gr_derived_block::gr_derived_block() - : gr_hier_block2("gr_derived_block", - gr_make_io_signature(1, 1, sizeof(int)), // Input signature - gr_make_io_signature(1, 1, sizeof(int))) // Output signature + : gr::hier_block2("gr_derived_block", + gr::io_signature::make(1, 1, sizeof(int)), // Input signature + gr::io_signature::make(1, 1, sizeof(int))) // Output signature { - gr_block_sptr copy(gr::blocks::copy::make(sizeof(int))); + gr::block_sptr copy(gr::blocks::copy::make(sizeof(int))); connect(self(), 0, copy, 0); connect(copy, 0, self(), 0); @@ -70,14 +70,14 @@ gr_derived_block::~gr_derived_block() { } -void qa_gr_hier_block2_derived::test_1() +void qa_hier_block2_derived::test_1() { - gr_top_block_sptr tb(gr_make_top_block("test")); + gr::top_block_sptr tb(gr::make_top_block("test")); - gr_block_sptr src(gr::blocks::null_source::make(sizeof(int))); - gr_block_sptr head(gr::blocks::head::make(sizeof(int), 1000)); + gr::block_sptr src(gr::blocks::null_source::make(sizeof(int))); + gr::block_sptr head(gr::blocks::head::make(sizeof(int), 1000)); gr_derived_block_sptr blk(gr_make_derived_block()); - gr_block_sptr dst(gr::blocks::null_sink::make(sizeof(int))); + gr::block_sptr dst(gr::blocks::null_sink::make(sizeof(int))); tb->connect(src, 0, head, 0); tb->connect(head, 0, blk, 0); diff --git a/gr-blocks/lib/qa_gr_hier_block2_derived.h b/gr-blocks/lib/qa_gr_hier_block2_derived.h index 8e0a1880ce..2c0a74356f 100644 --- a/gr-blocks/lib/qa_gr_hier_block2_derived.h +++ b/gr-blocks/lib/qa_gr_hier_block2_derived.h @@ -28,9 +28,9 @@ #include <stdexcept> // Declare a QA test case -class qa_gr_hier_block2_derived : public CppUnit::TestCase +class qa_hier_block2_derived : public CppUnit::TestCase { - CPPUNIT_TEST_SUITE(qa_gr_hier_block2_derived); + CPPUNIT_TEST_SUITE(qa_hier_block2_derived); CPPUNIT_TEST(test_1); CPPUNIT_TEST_SUITE_END(); diff --git a/gr-blocks/lib/qa_gr_top_block.cc b/gr-blocks/lib/qa_gr_top_block.cc index cb75cd14d0..39709d23d2 100644 --- a/gr-blocks/lib/qa_gr_top_block.cc +++ b/gr-blocks/lib/qa_gr_top_block.cc @@ -25,48 +25,49 @@ #endif #include <qa_gr_top_block.h> -#include <gr_top_block.h> -#include <blocks/head.h> -#include <blocks/nop.h> -#include <blocks/null_source.h> -#include <blocks/null_sink.h> +#include <gnuradio/top_block.h> +#include <gnuradio/blocks/head.h> +#include <gnuradio/blocks/nop.h> +#include <gnuradio/blocks/null_source.h> +#include <gnuradio/blocks/null_sink.h> #include <iostream> #define VERBOSE 0 -void qa_gr_top_block::t0() +void qa_top_block::t0() { - if (VERBOSE) std::cout << "qa_gr_top_block::t0()\n"; + if (VERBOSE) std::cout << "qa_top_block::t0()\n"; - gr_top_block_sptr tb = gr_make_top_block("top"); + gr::top_block_sptr tb = gr::make_top_block("top"); CPPUNIT_ASSERT(tb); } -void qa_gr_top_block::t1_run() +void qa_top_block::t1_run() { - if (VERBOSE) std::cout << "qa_gr_top_block::t1()\n"; + if (VERBOSE) std::cout << "qa_top_block::t1()\n"; - gr_top_block_sptr tb = gr_make_top_block("top"); + gr::top_block_sptr tb = gr::make_top_block("top"); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + gr::block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr::block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr::block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); tb->connect(src, 0, head, 0); tb->connect(head, 0, dst, 0); tb->run(); } -void qa_gr_top_block::t2_start_stop_wait() +void qa_top_block::t2_start_stop_wait() { - if (VERBOSE) std::cout << "qa_gr_top_block::t2()\n"; + if(VERBOSE) + std::cout << "qa_top_block::t2()\n"; - gr_top_block_sptr tb = gr_make_top_block("top"); + gr::top_block_sptr tb = gr::make_top_block("top"); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + gr::block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr::block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr::block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); tb->connect(src, 0, head, 0); tb->connect(head, 0, dst, 0); @@ -76,14 +77,15 @@ void qa_gr_top_block::t2_start_stop_wait() tb->wait(); } -void qa_gr_top_block::t3_lock_unlock() +void qa_top_block::t3_lock_unlock() { - if (VERBOSE) std::cout << "qa_gr_top_block::t3()\n"; + if(VERBOSE) + std::cout << "qa_top_block::t3()\n"; - gr_top_block_sptr tb = gr_make_top_block("top"); + gr::top_block_sptr tb = gr::make_top_block("top"); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + gr::block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr::block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); tb->connect(src, 0, dst, 0); @@ -96,15 +98,16 @@ void qa_gr_top_block::t3_lock_unlock() tb->wait(); } -void qa_gr_top_block::t4_reconfigure() +void qa_top_block::t4_reconfigure() { - if (VERBOSE) std::cout << "qa_gr_top_block::t4()\n"; + if(VERBOSE) + std::cout << "qa_top_block::t4()\n"; - gr_top_block_sptr tb = gr_make_top_block("top"); + gr::top_block_sptr tb = gr::make_top_block("top"); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + gr::block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr::block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr::block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); // Start infinite flowgraph tb->connect(src, 0, dst, 0); @@ -122,15 +125,16 @@ void qa_gr_top_block::t4_reconfigure() } -void qa_gr_top_block::t5_max_noutputs() +void qa_top_block::t5_max_noutputs() { - if (VERBOSE) std::cout << "qa_gr_top_block::t5()\n"; + if(VERBOSE) + std::cout << "qa_top_block::t5()\n"; - gr_top_block_sptr tb = gr_make_top_block("top"); + gr::top_block_sptr tb = gr::make_top_block("top"); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + gr::block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr::block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr::block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); // Start infinite flowgraph tb->connect(src, 0, head, 0); @@ -139,15 +143,16 @@ void qa_gr_top_block::t5_max_noutputs() tb->wait(); } -void qa_gr_top_block::t6_reconfig_max_noutputs() +void qa_top_block::t6_reconfig_max_noutputs() { - if (VERBOSE) std::cout << "qa_gr_top_block::t6()\n"; + if(VERBOSE) + std::cout << "qa_top_block::t6()\n"; - gr_top_block_sptr tb = gr_make_top_block("top"); + gr::top_block_sptr tb = gr::make_top_block("top"); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + gr::block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr::block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr::block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); // Start infinite flowgraph tb->connect(src, 0, dst, 0); @@ -166,15 +171,16 @@ void qa_gr_top_block::t6_reconfig_max_noutputs() tb->wait(); } -void qa_gr_top_block::t7_max_noutputs_per_block() +void qa_top_block::t7_max_noutputs_per_block() { - if (VERBOSE) std::cout << "qa_gr_top_block::t7()\n"; + if(VERBOSE) + std::cout << "qa_top_block::t7()\n"; - gr_top_block_sptr tb = gr_make_top_block("top"); + gr::top_block_sptr tb = gr::make_top_block("top"); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + gr::block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr::block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr::block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); head->set_max_noutput_items(100); @@ -185,15 +191,16 @@ void qa_gr_top_block::t7_max_noutputs_per_block() tb->wait(); } -void qa_gr_top_block::t8_reconfig_max_noutputs_per_block() +void qa_top_block::t8_reconfig_max_noutputs_per_block() { - if (VERBOSE) std::cout << "qa_gr_top_block::t8()\n"; + if(VERBOSE) + std::cout << "qa_top_block::t8()\n"; - gr_top_block_sptr tb = gr_make_top_block("top"); + gr::top_block_sptr tb = gr::make_top_block("top"); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + gr::block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr::block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr::block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); head->set_max_noutput_items(99); @@ -214,15 +221,16 @@ void qa_gr_top_block::t8_reconfig_max_noutputs_per_block() tb->wait(); } -void qa_gr_top_block::t9_max_output_buffer() +void qa_top_block::t9_max_output_buffer() { - if (VERBOSE) std::cout << "qa_gr_top_block::t9()\n"; + if(VERBOSE) + std::cout << "qa_top_block::t9()\n"; - gr_top_block_sptr tb = gr_make_top_block("top"); + gr::top_block_sptr tb = gr::make_top_block("top"); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + gr::block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr::block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr::block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); head->set_max_output_buffer(1024); @@ -233,15 +241,16 @@ void qa_gr_top_block::t9_max_output_buffer() tb->wait(); } -void qa_gr_top_block::t10_reconfig_max_output_buffer() +void qa_top_block::t10_reconfig_max_output_buffer() { - if (VERBOSE) std::cout << "qa_gr_top_block::t10()\n"; + if(VERBOSE) + std::cout << "qa_top_block::t10()\n"; - gr_top_block_sptr tb = gr_make_top_block("top"); + gr::top_block_sptr tb = gr::make_top_block("top"); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); - gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + gr::block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr::block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr::block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); head->set_max_output_buffer(1000); @@ -251,7 +260,7 @@ void qa_gr_top_block::t10_reconfig_max_output_buffer() // Reconfigure with gr_head in the middle tb->lock(); - gr_block_sptr nop = gr::blocks::nop::make(sizeof(int)); + gr::block_sptr nop = gr::blocks::nop::make(sizeof(int)); nop->set_max_output_buffer(4000); tb->disconnect(src, 0, dst, 0); tb->connect(src, 0, head, 0); @@ -263,11 +272,11 @@ void qa_gr_top_block::t10_reconfig_max_output_buffer() tb->wait(); } -void qa_gr_top_block::t11_set_block_affinity() +void qa_top_block::t11_set_block_affinity() { - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr::blocks::null_source::make(sizeof(float))); - gr_block_sptr snk (gr::blocks::null_sink::make(sizeof(float))); + gr::top_block_sptr tb = gr::make_top_block("top"); + gr::block_sptr src (gr::blocks::null_source::make(sizeof(float))); + gr::block_sptr snk (gr::blocks::null_sink::make(sizeof(float))); std::vector<int> set(1, 0), ret; src->set_processor_affinity(set); diff --git a/gr-blocks/lib/qa_gr_top_block.h b/gr-blocks/lib/qa_gr_top_block.h index 634eeab1f8..e3ea3227e9 100644 --- a/gr-blocks/lib/qa_gr_top_block.h +++ b/gr-blocks/lib/qa_gr_top_block.h @@ -27,9 +27,9 @@ #include <cppunit/TestCase.h> #include <stdexcept> -class qa_gr_top_block : public CppUnit::TestCase +class qa_top_block : public CppUnit::TestCase { - CPPUNIT_TEST_SUITE(qa_gr_top_block); + CPPUNIT_TEST_SUITE(qa_top_block); CPPUNIT_TEST(t0); CPPUNIT_TEST(t1_run); diff --git a/gr-blocks/lib/qa_rotator.cc b/gr-blocks/lib/qa_rotator.cc index 877392075a..63cae39ca8 100644 --- a/gr-blocks/lib/qa_rotator.cc +++ b/gr-blocks/lib/qa_rotator.cc @@ -24,13 +24,13 @@ #include <config.h> #endif -#include <attributes.h> +#include <gnuradio/attributes.h> #include <cppunit/TestAssert.h> #include <qa_rotator.h> -#include <blocks/rotator.h> +#include <gnuradio/blocks/rotator.h> #include <stdio.h> #include <cmath> -#include <gr_expj.h> +#include <gnuradio/expj.h> // error vector magnitude __GR_ATTR_UNUSED static float diff --git a/gr-blocks/lib/qa_set_msg_handler.cc b/gr-blocks/lib/qa_set_msg_handler.cc index cc94243d89..47e5698787 100644 --- a/gr-blocks/lib/qa_set_msg_handler.cc +++ b/gr-blocks/lib/qa_set_msg_handler.cc @@ -25,12 +25,12 @@ #endif #include <qa_set_msg_handler.h> -#include <gr_top_block.h> -#include <blocks/head.h> -#include <blocks/null_source.h> -#include <blocks/null_sink.h> -#include <blocks/nop.h> -#include <messages/msg_passing.h> +#include <gnuradio/top_block.h> +#include <gnuradio/blocks/head.h> +#include <gnuradio/blocks/null_source.h> +#include <gnuradio/blocks/null_sink.h> +#include <gnuradio/blocks/nop.h> +#include <gnuradio/messages/msg_passing.h> #include <iostream> #include <boost/thread/thread.hpp> @@ -49,11 +49,11 @@ void qa_set_msg_handler::t0() if (VERBOSE) std::cout << "qa_set_msg_handler::t0()\n"; - gr_top_block_sptr tb = gr_make_top_block("top"); + top_block_sptr tb = make_top_block("top"); - gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + block_sptr src = gr::blocks::null_source::make(sizeof(int)); gr::blocks::nop::sptr nop = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); + block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); tb->connect(src, 0, nop, 0); tb->connect(nop, 0, dst, 0); diff --git a/gr-blocks/lib/random_pdu_impl.cc b/gr-blocks/lib/random_pdu_impl.cc index 0b194a0537..6941beae85 100644 --- a/gr-blocks/lib/random_pdu_impl.cc +++ b/gr-blocks/lib/random_pdu_impl.cc @@ -25,8 +25,8 @@ #endif #include "random_pdu_impl.h" -#include <gr_io_signature.h> -#include <blocks/pdu.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/blocks/pdu.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } random_pdu_impl::random_pdu_impl(int min_items, int max_items) - : gr_block("random_pdu", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (0, 0, 0)), + : block("random_pdu", + io_signature::make (0, 0, 0), + io_signature::make (0, 0, 0)), d_urange(min_items, max_items), d_brange(0, 255), d_rvar(d_rng, d_urange), diff --git a/gr-blocks/lib/random_pdu_impl.h b/gr-blocks/lib/random_pdu_impl.h index 3197f740a0..77e7bdd525 100644 --- a/gr-blocks/lib/random_pdu_impl.h +++ b/gr-blocks/lib/random_pdu_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_BLOCKS_SOCKET_PDU_IMPL_H #define INCLUDED_BLOCKS_RANDOM_PDU_IMPL_H -#include <blocks/random_pdu.h> +#include <gnuradio/blocks/random_pdu.h> #include <boost/random.hpp> #include <boost/generator_iterator.hpp> diff --git a/gr-blocks/lib/regenerate_bb_impl.cc b/gr-blocks/lib/regenerate_bb_impl.cc index 4472efb6d4..8b65940749 100644 --- a/gr-blocks/lib/regenerate_bb_impl.cc +++ b/gr-blocks/lib/regenerate_bb_impl.cc @@ -25,7 +25,7 @@ #endif #include "regenerate_bb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } regenerate_bb_impl::regenerate_bb_impl(int period, unsigned int max_regen) - : gr_sync_block("regenerate_bb", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(1, 1, sizeof(char))), + : sync_block("regenerate_bb", + io_signature::make(1, 1, sizeof(char)), + io_signature::make(1, 1, sizeof(char))), d_period(period), d_countdown(0), d_max_regen(max_regen), diff --git a/gr-blocks/lib/regenerate_bb_impl.h b/gr-blocks/lib/regenerate_bb_impl.h index bcfa18391f..22b963c491 100644 --- a/gr-blocks/lib/regenerate_bb_impl.h +++ b/gr-blocks/lib/regenerate_bb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_REGENERATE_BB_H #define INCLUDED_GR_REGENERATE_BB_IMPL_H -#include <blocks/regenerate_bb.h> +#include <gnuradio/blocks/regenerate_bb.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/repack_bits_bb_impl.cc b/gr-blocks/lib/repack_bits_bb_impl.cc index c7ed054c8a..af83187e92 100644 --- a/gr-blocks/lib/repack_bits_bb_impl.cc +++ b/gr-blocks/lib/repack_bits_bb_impl.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "repack_bits_bb_impl.h" namespace gr { @@ -37,9 +37,9 @@ namespace gr { } repack_bits_bb_impl::repack_bits_bb_impl(int k, int l, const std::string &len_tag_key, bool align_output) - : gr_tagged_stream_block("repack_bits_bb", - gr_make_io_signature(1, 1, sizeof (char)), - gr_make_io_signature(1, 1, sizeof (char)), + : tagged_stream_block("repack_bits_bb", + io_signature::make(1, 1, sizeof (char)), + io_signature::make(1, 1, sizeof (char)), len_tag_key), d_k(k), d_l(l), d_packet_mode(!len_tag_key.empty()), diff --git a/gr-blocks/lib/repack_bits_bb_impl.h b/gr-blocks/lib/repack_bits_bb_impl.h index bf39f8cb0f..ffb8349d35 100644 --- a/gr-blocks/lib/repack_bits_bb_impl.h +++ b/gr-blocks/lib/repack_bits_bb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_BLOCKS_REPACK_BITS_BB_IMPL_H #define INCLUDED_BLOCKS_REPACK_BITS_BB_IMPL_H -#include <blocks/repack_bits_bb.h> +#include <gnuradio/blocks/repack_bits_bb.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/repeat_impl.cc b/gr-blocks/lib/repeat_impl.cc index 939a33b878..f77903544f 100644 --- a/gr-blocks/lib/repeat_impl.cc +++ b/gr-blocks/lib/repeat_impl.cc @@ -25,7 +25,7 @@ #endif #include "repeat_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -36,9 +36,9 @@ namespace gr { } repeat_impl::repeat_impl(size_t itemsize, int interp) - : gr_sync_interpolator("repeat", - gr_make_io_signature (1, 1, itemsize), - gr_make_io_signature (1, 1, itemsize), + : sync_interpolator("repeat", + io_signature::make (1, 1, itemsize), + io_signature::make (1, 1, itemsize), interp), d_itemsize(itemsize), d_interp(interp) diff --git a/gr-blocks/lib/repeat_impl.h b/gr-blocks/lib/repeat_impl.h index 6451d0d988..1942729194 100644 --- a/gr-blocks/lib/repeat_impl.h +++ b/gr-blocks/lib/repeat_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_REPEAT_IMPL_H #define INCLUDED_REPEAT_IMPL_H -#include <blocks/repeat.h> +#include <gnuradio/blocks/repeat.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/rms_cf_impl.cc b/gr-blocks/lib/rms_cf_impl.cc index 9b2c031e10..9ef243beba 100644 --- a/gr-blocks/lib/rms_cf_impl.cc +++ b/gr-blocks/lib/rms_cf_impl.cc @@ -25,7 +25,7 @@ #endif #include "rms_cf_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cmath> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } rms_cf_impl::rms_cf_impl(double alpha) - : gr_sync_block("rms_cf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(float))) + : sync_block("rms_cf", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(float))) { set_alpha(alpha); } diff --git a/gr-blocks/lib/rms_cf_impl.h b/gr-blocks/lib/rms_cf_impl.h index 316ab2f304..66ee12463e 100644 --- a/gr-blocks/lib/rms_cf_impl.h +++ b/gr-blocks/lib/rms_cf_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_BLOCKS_RMS_CF_IMPL_H #define INCLUDED_BLOCKS_RMS_CF_IMPL_H -#include <blocks/rms_cf.h> +#include <gnuradio/blocks/rms_cf.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/rms_ff_impl.cc b/gr-blocks/lib/rms_ff_impl.cc index 8e004ad61e..c84193c9f3 100644 --- a/gr-blocks/lib/rms_ff_impl.cc +++ b/gr-blocks/lib/rms_ff_impl.cc @@ -25,7 +25,7 @@ #endif #include "rms_ff_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cmath> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } rms_ff_impl::rms_ff_impl(double alpha) - : gr_sync_block("rms_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))) + : sync_block("rms_ff", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))) { set_alpha(alpha); } diff --git a/gr-blocks/lib/rms_ff_impl.h b/gr-blocks/lib/rms_ff_impl.h index 34d7d986c0..49ef1e07b3 100644 --- a/gr-blocks/lib/rms_ff_impl.h +++ b/gr-blocks/lib/rms_ff_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_BLOCKS_RMS_FF_IMPL_H #define INCLUDED_BLOCKS_RMS_FF_IMPL_H -#include <blocks/rms_ff.h> +#include <gnuradio/blocks/rms_ff.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/sample_and_hold_XX_impl.cc.t b/gr-blocks/lib/sample_and_hold_XX_impl.cc.t index 617b2d6ee5..27597b67dd 100644 --- a/gr-blocks/lib/sample_and_hold_XX_impl.cc.t +++ b/gr-blocks/lib/sample_and_hold_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -40,9 +40,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@() - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature2(2, 2, sizeof(@I_TYPE@), sizeof(char)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@))), + : sync_block("@BASE_NAME@", + io_signature::make2(2, 2, sizeof(@I_TYPE@), sizeof(char)), + io_signature::make(1, 1, sizeof(@O_TYPE@))), d_data(0) { } diff --git a/gr-blocks/lib/sample_and_hold_XX_impl.h.t b/gr-blocks/lib/sample_and_hold_XX_impl.h.t index 048bf0d0e7..ed7d6f4d40 100644 --- a/gr-blocks/lib/sample_and_hold_XX_impl.h.t +++ b/gr-blocks/lib/sample_and_hold_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/short_to_char_impl.cc b/gr-blocks/lib/short_to_char_impl.cc index 54875a2b3e..f4a5c80c32 100644 --- a/gr-blocks/lib/short_to_char_impl.cc +++ b/gr-blocks/lib/short_to_char_impl.cc @@ -25,7 +25,7 @@ #endif #include "short_to_char_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } short_to_char_impl::short_to_char_impl(size_t vlen) - : gr_sync_block("short_to_char", - gr_make_io_signature (1, 1, sizeof(short)*vlen), - gr_make_io_signature (1, 1, sizeof(char)*vlen)), + : sync_block("short_to_char", + io_signature::make (1, 1, sizeof(short)*vlen), + io_signature::make (1, 1, sizeof(char)*vlen)), d_vlen(vlen) { const int alignment_multiple = diff --git a/gr-blocks/lib/short_to_char_impl.h b/gr-blocks/lib/short_to_char_impl.h index 37474094d6..491d9bb250 100644 --- a/gr-blocks/lib/short_to_char_impl.h +++ b/gr-blocks/lib/short_to_char_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_SHORT_TO_CHAR_IMPL_H #define INCLUDED_SHORT_TO_CHAR_IMPL_H -#include <blocks/short_to_char.h> +#include <gnuradio/blocks/short_to_char.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/short_to_float_impl.cc b/gr-blocks/lib/short_to_float_impl.cc index 6186018168..147b0c07f4 100644 --- a/gr-blocks/lib/short_to_float_impl.cc +++ b/gr-blocks/lib/short_to_float_impl.cc @@ -25,7 +25,7 @@ #endif #include "short_to_float_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } short_to_float_impl::short_to_float_impl(size_t vlen, float scale) - : gr_sync_block("short_to_float", - gr_make_io_signature (1, 1, sizeof(short)*vlen), - gr_make_io_signature (1, 1, sizeof(float)*vlen)), + : sync_block("short_to_float", + io_signature::make (1, 1, sizeof(short)*vlen), + io_signature::make (1, 1, sizeof(float)*vlen)), d_vlen(vlen), d_scale(scale) { const int alignment_multiple = diff --git a/gr-blocks/lib/short_to_float_impl.h b/gr-blocks/lib/short_to_float_impl.h index c36b42a8c1..1b34a4f420 100644 --- a/gr-blocks/lib/short_to_float_impl.h +++ b/gr-blocks/lib/short_to_float_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_SHORT_TO_FLOAT_IMPL_H #define INCLUDED_SHORT_TO_FLOAT_IMPL_H -#include <blocks/short_to_float.h> +#include <gnuradio/blocks/short_to_float.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/skiphead_impl.cc b/gr-blocks/lib/skiphead_impl.cc index feb39eb8f4..da9cb11280 100644 --- a/gr-blocks/lib/skiphead_impl.cc +++ b/gr-blocks/lib/skiphead_impl.cc @@ -25,7 +25,7 @@ #endif #include "skiphead_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } skiphead_impl::skiphead_impl(size_t itemsize, uint64_t nitems_to_skip) - : gr_block("skiphead", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(1, 1, itemsize)), + : block("skiphead", + io_signature::make(1, 1, itemsize), + io_signature::make(1, 1, itemsize)), d_nitems_to_skip(nitems_to_skip), d_nitems(0) { } diff --git a/gr-blocks/lib/skiphead_impl.h b/gr-blocks/lib/skiphead_impl.h index d8e0870cb1..db4df50adb 100644 --- a/gr-blocks/lib/skiphead_impl.h +++ b/gr-blocks/lib/skiphead_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_SKIPHEAD_IMPL_H #define INCLUDED_GR_SKIPHEAD_IMPL_H -#include <blocks/skiphead.h> +#include <gnuradio/blocks/skiphead.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/socket_pdu_impl.cc b/gr-blocks/lib/socket_pdu_impl.cc index e4ef40f87a..9daf8c30c9 100644 --- a/gr-blocks/lib/socket_pdu_impl.cc +++ b/gr-blocks/lib/socket_pdu_impl.cc @@ -26,8 +26,8 @@ #include "socket_pdu_impl.h" #include "tcp_connection.h" -#include <gr_io_signature.h> -#include <blocks/pdu.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/blocks/pdu.h> namespace gr { namespace blocks { @@ -39,9 +39,9 @@ namespace gr { } socket_pdu_impl::socket_pdu_impl(std::string type, std::string addr, std::string port, int MTU) - : gr_block("socket_pdu", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (0, 0, 0)) + : block("socket_pdu", + io_signature::make (0, 0, 0), + io_signature::make (0, 0, 0)) { message_port_register_in(PDU_PORT_ID); message_port_register_out(PDU_PORT_ID); diff --git a/gr-blocks/lib/socket_pdu_impl.h b/gr-blocks/lib/socket_pdu_impl.h index 78602754c7..3099d90e00 100644 --- a/gr-blocks/lib/socket_pdu_impl.h +++ b/gr-blocks/lib/socket_pdu_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_BLOCKS_SOCKET_PDU_IMPL_H #define INCLUDED_BLOCKS_SOCKET_PDU_IMPL_H -#include <blocks/socket_pdu.h> +#include <gnuradio/blocks/socket_pdu.h> #include "stream_pdu_base.h" #include "tcp_connection.h" diff --git a/gr-blocks/lib/stream_mux_impl.cc b/gr-blocks/lib/stream_mux_impl.cc index 214734c4bc..1e42c2504f 100644 --- a/gr-blocks/lib/stream_mux_impl.cc +++ b/gr-blocks/lib/stream_mux_impl.cc @@ -25,7 +25,7 @@ #endif #include "stream_mux_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <cstdio> @@ -40,9 +40,9 @@ namespace gr { } stream_mux_impl::stream_mux_impl(size_t itemsize, const std::vector<int> &lengths) - : gr_block("stream_mux", - gr_make_io_signature (1, -1, itemsize), - gr_make_io_signature (1, 1, itemsize)), + : block("stream_mux", + io_signature::make (1, -1, itemsize), + io_signature::make (1, 1, itemsize)), d_itemsize(itemsize), d_stream(0), d_residual(0), diff --git a/gr-blocks/lib/stream_mux_impl.h b/gr-blocks/lib/stream_mux_impl.h index 7b2dac95c2..328eb0710e 100644 --- a/gr-blocks/lib/stream_mux_impl.h +++ b/gr-blocks/lib/stream_mux_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_STREAM_MUX_IMPL_H #define INCLUDED_STREAM_MUX_IMPL_H -#include <blocks/stream_mux.h> +#include <gnuradio/blocks/stream_mux.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/stream_pdu_base.cc b/gr-blocks/lib/stream_pdu_base.cc index c887ad2fac..a07fa86950 100644 --- a/gr-blocks/lib/stream_pdu_base.cc +++ b/gr-blocks/lib/stream_pdu_base.cc @@ -32,8 +32,8 @@ #include <winsock2.h> #endif -#include <blocks/pdu.h> -#include <gr_basic_block.h> +#include <gnuradio/blocks/pdu.h> +#include <gnuradio/basic_block.h> #include "stream_pdu_base.h" #include <boost/format.hpp> @@ -57,7 +57,7 @@ namespace gr { } void - stream_pdu_base::start_rxthread(gr_basic_block *blk, pmt::pmt_t port) + stream_pdu_base::start_rxthread(basic_block *blk, pmt::pmt_t port) { d_blk = blk; d_port = port; diff --git a/gr-blocks/lib/stream_pdu_base.h b/gr-blocks/lib/stream_pdu_base.h index c305880b07..cd976eed42 100644 --- a/gr-blocks/lib/stream_pdu_base.h +++ b/gr-blocks/lib/stream_pdu_base.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_STREAM_PDU_BASE_H #define INCLUDED_STREAM_PDU_BASE_H -#include <thread/thread.h> +#include <gnuradio/thread/thread.h> #include <pmt/pmt.h> -class gr_basic_block; +class basic_block; namespace gr { namespace blocks { @@ -45,12 +45,12 @@ namespace gr { gr::thread::thread d_thread; pmt::pmt_t d_port; - gr_basic_block *d_blk; + basic_block *d_blk; void run(); void send(pmt::pmt_t msg); bool wait_ready(); - void start_rxthread(gr_basic_block *blk, pmt::pmt_t rxport); + void start_rxthread(basic_block *blk, pmt::pmt_t rxport); void stop_rxthread(); }; diff --git a/gr-blocks/lib/stream_to_streams_impl.cc b/gr-blocks/lib/stream_to_streams_impl.cc index 9e9052e7d5..76974ce0ad 100644 --- a/gr-blocks/lib/stream_to_streams_impl.cc +++ b/gr-blocks/lib/stream_to_streams_impl.cc @@ -25,29 +25,31 @@ #endif #include "stream_to_streams_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> namespace gr { namespace blocks { - stream_to_streams::sptr stream_to_streams::make(size_t itemsize, size_t nstreams) + stream_to_streams::sptr + stream_to_streams::make(size_t itemsize, size_t nstreams) { - return gnuradio::get_initial_sptr(new stream_to_streams_impl(itemsize, nstreams)); + return gnuradio::get_initial_sptr + (new stream_to_streams_impl(itemsize, nstreams)); } stream_to_streams_impl::stream_to_streams_impl(size_t itemsize, size_t nstreams) - : gr_sync_decimator("stream_to_streams", - gr_make_io_signature (1, 1, itemsize), - gr_make_io_signature (nstreams, nstreams, itemsize), - nstreams) + : sync_decimator("stream_to_streams", + io_signature::make(1, 1, itemsize), + io_signature::make(nstreams, nstreams, itemsize), + nstreams) { } int stream_to_streams_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { size_t item_size = output_signature()->sizeof_stream_item(0); diff --git a/gr-blocks/lib/stream_to_streams_impl.h b/gr-blocks/lib/stream_to_streams_impl.h index 9a96983ff2..bd3763572b 100644 --- a/gr-blocks/lib/stream_to_streams_impl.h +++ b/gr-blocks/lib/stream_to_streams_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_STREAM_TO_STREAMS_IMPL_H #define INCLUDED_STREAM_TO_STREAMS_IMPL_H -#include <blocks/stream_to_streams.h> +#include <gnuradio/blocks/stream_to_streams.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/stream_to_vector_impl.cc b/gr-blocks/lib/stream_to_vector_impl.cc index 80ced5a74b..8576c7fbf5 100644 --- a/gr-blocks/lib/stream_to_vector_impl.cc +++ b/gr-blocks/lib/stream_to_vector_impl.cc @@ -25,7 +25,7 @@ #endif #include "stream_to_vector_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -36,9 +36,9 @@ namespace gr { } stream_to_vector_impl::stream_to_vector_impl(size_t itemsize, size_t nitems_per_block) - : gr_sync_decimator ("stream_to_vector", - gr_make_io_signature (1, 1, itemsize), - gr_make_io_signature (1, 1, itemsize * nitems_per_block), + : sync_decimator ("stream_to_vector", + io_signature::make (1, 1, itemsize), + io_signature::make (1, 1, itemsize * nitems_per_block), nitems_per_block) { } diff --git a/gr-blocks/lib/stream_to_vector_impl.h b/gr-blocks/lib/stream_to_vector_impl.h index f8031f0058..3484d397ed 100644 --- a/gr-blocks/lib/stream_to_vector_impl.h +++ b/gr-blocks/lib/stream_to_vector_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_STREAM_TO_VECTOR_IMPL_H #define INCLUDED_STREAM_TO_VECTOR_IMPL_H -#include <blocks/stream_to_vector.h> +#include <gnuradio/blocks/stream_to_vector.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/streams_to_stream_impl.cc b/gr-blocks/lib/streams_to_stream_impl.cc index 09c593e815..8d2f330443 100644 --- a/gr-blocks/lib/streams_to_stream_impl.cc +++ b/gr-blocks/lib/streams_to_stream_impl.cc @@ -25,7 +25,7 @@ #endif #include "streams_to_stream_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -36,9 +36,9 @@ namespace gr { } streams_to_stream_impl::streams_to_stream_impl(size_t itemsize, size_t nstreams) - : gr_sync_interpolator ("streams_to_stream", - gr_make_io_signature (nstreams, nstreams, itemsize), - gr_make_io_signature (1, 1, itemsize), + : sync_interpolator ("streams_to_stream", + io_signature::make (nstreams, nstreams, itemsize), + io_signature::make (1, 1, itemsize), nstreams) { } diff --git a/gr-blocks/lib/streams_to_stream_impl.h b/gr-blocks/lib/streams_to_stream_impl.h index 6f686172c9..e3ffde504c 100644 --- a/gr-blocks/lib/streams_to_stream_impl.h +++ b/gr-blocks/lib/streams_to_stream_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_STREAMS_TO_STREAM_IMPL_H #define INCLUDED_STREAMS_TO_STREAM_IMPL_H -#include <blocks/streams_to_stream.h> +#include <gnuradio/blocks/streams_to_stream.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/streams_to_vector_impl.cc b/gr-blocks/lib/streams_to_vector_impl.cc index c524a78e49..a65e11b57c 100644 --- a/gr-blocks/lib/streams_to_vector_impl.cc +++ b/gr-blocks/lib/streams_to_vector_impl.cc @@ -25,7 +25,7 @@ #endif #include "streams_to_vector_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -36,9 +36,9 @@ namespace gr { } streams_to_vector_impl::streams_to_vector_impl(size_t itemsize, size_t nstreams) - : gr_sync_block ("streams_to_vector", - gr_make_io_signature (nstreams, nstreams, itemsize), - gr_make_io_signature (1, 1, nstreams * itemsize)) + : sync_block ("streams_to_vector", + io_signature::make (nstreams, nstreams, itemsize), + io_signature::make (1, 1, nstreams * itemsize)) { } diff --git a/gr-blocks/lib/streams_to_vector_impl.h b/gr-blocks/lib/streams_to_vector_impl.h index 4a14e9d4f5..5590e416b2 100644 --- a/gr-blocks/lib/streams_to_vector_impl.h +++ b/gr-blocks/lib/streams_to_vector_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_STREAMS_TO_VECTOR_IMPL_H #define INCLUDED_STREAMS_TO_VECTOR_IMPL_H -#include <blocks/streams_to_vector.h> +#include <gnuradio/blocks/streams_to_vector.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/stretch_ff_impl.cc b/gr-blocks/lib/stretch_ff_impl.cc index 90bbc7ee5a..4d43d13d68 100644 --- a/gr-blocks/lib/stretch_ff_impl.cc +++ b/gr-blocks/lib/stretch_ff_impl.cc @@ -25,7 +25,7 @@ #endif #include "stretch_ff_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } stretch_ff_impl::stretch_ff_impl(float lo, size_t vlen) - : gr_sync_block("stretch_ff", - gr_make_io_signature(1, 1, vlen * sizeof(float)), - gr_make_io_signature(1, 1, vlen * sizeof(float))), + : sync_block("stretch_ff", + io_signature::make(1, 1, vlen * sizeof(float)), + io_signature::make(1, 1, vlen * sizeof(float))), d_lo(lo), d_vlen(vlen) { } diff --git a/gr-blocks/lib/stretch_ff_impl.h b/gr-blocks/lib/stretch_ff_impl.h index af69d835a5..b44de80314 100644 --- a/gr-blocks/lib/stretch_ff_impl.h +++ b/gr-blocks/lib/stretch_ff_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_STRETCH_FF_IMPL_H #define INCLUDED_GR_STRETCH_FF_IMPL_H -#include <blocks/stretch_ff.h> +#include <gnuradio/blocks/stretch_ff.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/sub_XX_impl.cc.t b/gr-blocks/lib/sub_XX_impl.cc.t index 35ae31452d..d0fa167495 100644 --- a/gr-blocks/lib/sub_XX_impl.cc.t +++ b/gr-blocks/lib/sub_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(size_t vlen) - : gr_sync_block ("@NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)), + : sync_block ("@NAME@", + io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen), + io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)), d_vlen(vlen) { } diff --git a/gr-blocks/lib/sub_XX_impl.h.t b/gr-blocks/lib/sub_XX_impl.h.t index a1c486b859..2680ef7012 100644 --- a/gr-blocks/lib/sub_XX_impl.h.t +++ b/gr-blocks/lib/sub_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/tag_debug_impl.cc b/gr-blocks/lib/tag_debug_impl.cc index 3bcffb664f..56f701b9d7 100644 --- a/gr-blocks/lib/tag_debug_impl.cc +++ b/gr-blocks/lib/tag_debug_impl.cc @@ -25,7 +25,7 @@ #endif #include "tag_debug_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> #include <iomanip> @@ -42,9 +42,9 @@ namespace gr { tag_debug_impl::tag_debug_impl(size_t sizeof_stream_item, const std::string &name) - : gr_sync_block("tag_debug", - gr_make_io_signature(1, -1, sizeof_stream_item), - gr_make_io_signature(0, 0, 0)), + : sync_block("tag_debug", + io_signature::make(1, -1, sizeof_stream_item), + io_signature::make(0, 0, 0)), d_name(name), d_display(true) { } @@ -53,7 +53,7 @@ namespace gr { { } - std::vector<gr_tag_t> + std::vector<tag_t> tag_debug_impl::current_tags() { gr::thread::scoped_lock l(d_mutex); diff --git a/gr-blocks/lib/tag_debug_impl.h b/gr-blocks/lib/tag_debug_impl.h index caf5b6b4f5..80d714edc2 100644 --- a/gr-blocks/lib/tag_debug_impl.h +++ b/gr-blocks/lib/tag_debug_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_TAG_DEBUG_IMPL_H #define INCLUDED_GR_TAG_DEBUG_IMPL_H -#include <blocks/tag_debug.h> -#include <thread/thread.h> +#include <gnuradio/blocks/tag_debug.h> +#include <gnuradio/thread/thread.h> #include <stddef.h> namespace gr { @@ -34,8 +34,8 @@ namespace gr { { private: std::string d_name; - std::vector<gr_tag_t> d_tags; - std::vector<gr_tag_t>::iterator d_tags_itr; + std::vector<tag_t> d_tags; + std::vector<tag_t>::iterator d_tags_itr; bool d_display; gr::thread::mutex d_mutex; @@ -43,7 +43,7 @@ namespace gr { tag_debug_impl(size_t sizeof_stream_item, const std::string &name); ~tag_debug_impl(); - std::vector<gr_tag_t> current_tags(); + std::vector<tag_t> current_tags(); void set_display(bool d); diff --git a/gr-blocks/lib/tagged_file_sink_impl.cc b/gr-blocks/lib/tagged_file_sink_impl.cc index 7d011e45f0..830791181b 100644 --- a/gr-blocks/lib/tagged_file_sink_impl.cc +++ b/gr-blocks/lib/tagged_file_sink_impl.cc @@ -25,7 +25,7 @@ #endif #include "tagged_file_sink_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> @@ -61,9 +61,9 @@ namespace gr { } tagged_file_sink_impl::tagged_file_sink_impl(size_t itemsize, double samp_rate) - : gr_sync_block("tagged_file_sink", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(0, 0, 0)), + : sync_block("tagged_file_sink", + io_signature::make(1, 1, itemsize), + io_signature::make(0, 0, 0)), d_itemsize (itemsize), d_n(0), d_sample_rate(samp_rate) { d_state = NOT_IN_BURST; @@ -87,18 +87,18 @@ namespace gr { pmt::pmt_t bkey = pmt::string_to_symbol("burst"); pmt::pmt_t tkey = pmt::string_to_symbol("rx_time"); // use gr_tags::key_time - std::vector<gr_tag_t> all_tags; + std::vector<tag_t> all_tags; get_tags_in_range(all_tags, 0, start_N, end_N); - std::sort(all_tags.begin(), all_tags.end(), gr_tag_t::offset_compare); + std::sort(all_tags.begin(), all_tags.end(), tag_t::offset_compare); - std::vector<gr_tag_t>::iterator vitr = all_tags.begin(); + std::vector<tag_t>::iterator vitr = all_tags.begin(); // Look for a time tag and initialize d_timeval. - std::vector<gr_tag_t> time_tags_outer; + std::vector<tag_t> time_tags_outer; get_tags_in_range(time_tags_outer, 0, start_N, end_N, tkey); if(time_tags_outer.size() > 0) { - const gr_tag_t tag = time_tags_outer[0]; + const tag_t tag = time_tags_outer[0]; uint64_t offset = tag.offset; pmt::pmt_t time = tag.value; uint64_t tsecs = pmt::to_uint64(pmt::tuple_ref(time, 0)); @@ -123,11 +123,11 @@ namespace gr { // Find time burst occurred by getting latest time tag and extrapolating // to new time based on sample rate of this block. - std::vector<gr_tag_t> time_tags; + std::vector<tag_t> time_tags; //get_tags_in_range(time_tags, 0, d_last_N, N, gr_tags::key_time); get_tags_in_range(time_tags, 0, d_last_N, N, tkey); if(time_tags.size() > 0) { - const gr_tag_t tag = time_tags[time_tags.size()-1]; + const tag_t tag = time_tags[time_tags.size()-1]; uint64_t time_nitems = tag.offset; diff --git a/gr-blocks/lib/tagged_file_sink_impl.h b/gr-blocks/lib/tagged_file_sink_impl.h index f64cedf2f9..7b1d43e641 100644 --- a/gr-blocks/lib/tagged_file_sink_impl.h +++ b/gr-blocks/lib/tagged_file_sink_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_TAGGED_FILE_SINK_IMPL_H #define INCLUDED_GR_TAGGED_FILE_SINK_IMPL_H -#include <blocks/tagged_file_sink.h> +#include <gnuradio/blocks/tagged_file_sink.h> #include <cstdio> // for FILE namespace gr { diff --git a/gr-blocks/lib/tagged_stream_mux_impl.cc b/gr-blocks/lib/tagged_stream_mux_impl.cc index 59e36fa07e..78b573016e 100644 --- a/gr-blocks/lib/tagged_stream_mux_impl.cc +++ b/gr-blocks/lib/tagged_stream_mux_impl.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "tagged_stream_mux_impl.h" namespace gr { @@ -37,9 +37,9 @@ namespace gr { } tagged_stream_mux_impl::tagged_stream_mux_impl(size_t itemsize, const std::string &lengthtagname) - : gr_tagged_stream_block("tagged_stream_mux", - gr_make_io_signature(1, -1, itemsize), - gr_make_io_signature(1, 1, itemsize), + : tagged_stream_block("tagged_stream_mux", + io_signature::make(1, -1, itemsize), + io_signature::make(1, 1, itemsize), lengthtagname), d_itemsize(itemsize) { @@ -74,7 +74,7 @@ namespace gr { for (unsigned int i = 0; i < input_items.size(); i++) { const unsigned char *in = (const unsigned char *) input_items[i]; - std::vector<gr_tag_t> tags; + std::vector<tag_t> tags; get_tags_in_range(tags, i, nitems_read(i), nitems_read(i)+ninput_items[i]); for (unsigned int j = 0; j < tags.size(); j++) { const uint64_t offset = tags[j].offset - nitems_read(i) + nitems_written(0) + n_produced; diff --git a/gr-blocks/lib/tagged_stream_mux_impl.h b/gr-blocks/lib/tagged_stream_mux_impl.h index 19862e6868..dd7eaf6352 100644 --- a/gr-blocks/lib/tagged_stream_mux_impl.h +++ b/gr-blocks/lib/tagged_stream_mux_impl.h @@ -24,7 +24,7 @@ #define INCLUDED_TAGGED_STREAM_MUX_IMPL_H #include <vector> -#include <blocks/tagged_stream_mux.h> +#include <gnuradio/blocks/tagged_stream_mux.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/tagged_stream_to_pdu_impl.cc b/gr-blocks/lib/tagged_stream_to_pdu_impl.cc index 4abc5818b0..b452470efa 100644 --- a/gr-blocks/lib/tagged_stream_to_pdu_impl.cc +++ b/gr-blocks/lib/tagged_stream_to_pdu_impl.cc @@ -25,8 +25,8 @@ #endif #include "tagged_stream_to_pdu_impl.h" -#include <blocks/pdu.h> -#include <gr_io_signature.h> +#include <gnuradio/blocks/pdu.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } tagged_stream_to_pdu_impl::tagged_stream_to_pdu_impl(pdu::vector_type type) - : gr_sync_block("tagged_stream_to_pdu", - gr_make_io_signature(1, 1, pdu::itemsize(type)), - gr_make_io_signature(0, 0, 0)), + : sync_block("tagged_stream_to_pdu", + io_signature::make(1, 1, pdu::itemsize(type)), + io_signature::make(0, 0, 0)), d_itemsize(pdu::itemsize(type)), d_inpdu(false), d_type(type), diff --git a/gr-blocks/lib/tagged_stream_to_pdu_impl.h b/gr-blocks/lib/tagged_stream_to_pdu_impl.h index 84d7f6c3cb..4e9568a1c5 100644 --- a/gr-blocks/lib/tagged_stream_to_pdu_impl.h +++ b/gr-blocks/lib/tagged_stream_to_pdu_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_TAGGED_STREAM_TO_PDU_IMPL_H #define INCLUDED_TAGGED_STREAM_TO_PDU_IMPL_H -#include <blocks/tagged_stream_to_pdu.h> +#include <gnuradio/blocks/tagged_stream_to_pdu.h> namespace gr { namespace blocks { @@ -39,8 +39,8 @@ namespace gr { pmt::pmt_t d_pdu_meta; pmt::pmt_t d_pdu_vector; - std::vector<gr_tag_t>::iterator d_tags_itr; - std::vector<gr_tag_t> d_tags; + std::vector<tag_t>::iterator d_tags_itr; + std::vector<tag_t> d_tags; public: tagged_stream_to_pdu_impl(pdu::vector_type type); diff --git a/gr-blocks/lib/tcp_connection.cc b/gr-blocks/lib/tcp_connection.cc index 33bb6f10f1..ce719d1843 100644 --- a/gr-blocks/lib/tcp_connection.cc +++ b/gr-blocks/lib/tcp_connection.cc @@ -25,8 +25,8 @@ #endif #include "tcp_connection.h" -#include <gr_basic_block.h> -#include <blocks/pdu.h> +#include <gnuradio/basic_block.h> +#include <gnuradio/blocks/pdu.h> namespace gr { namespace blocks { @@ -55,7 +55,7 @@ namespace gr { } void - tcp_connection::start(gr_basic_block *block) + tcp_connection::start(gr::basic_block *block) { d_block = block; d_socket.async_read_some(boost::asio::buffer(d_buf), diff --git a/gr-blocks/lib/tcp_connection.h b/gr-blocks/lib/tcp_connection.h index 32a5ef8c79..f4d32fa90a 100644 --- a/gr-blocks/lib/tcp_connection.h +++ b/gr-blocks/lib/tcp_connection.h @@ -27,9 +27,10 @@ #include <boost/asio.hpp> #include <pmt/pmt.h> -class gr_basic_block; - namespace gr { + + class basic_block; + namespace blocks { class tcp_connection @@ -38,7 +39,7 @@ namespace gr { boost::asio::ip::tcp::socket d_socket; boost::array<char, 10000> d_buf; std::string d_message; - gr_basic_block *d_block; + basic_block *d_block; tcp_connection(boost::asio::io_service& io_service); @@ -49,7 +50,7 @@ namespace gr { boost::asio::ip::tcp::socket& socket() { return d_socket; }; - void start(gr_basic_block *block); + void start(gr::basic_block *block); void send(pmt::pmt_t vector); void handle_read(const boost::system::error_code& error, size_t bytes_transferred); void handle_write(const boost::system::error_code& error, size_t bytes_transferred) { } diff --git a/gr-blocks/lib/test_gr_blocks.cc b/gr-blocks/lib/test_gr_blocks.cc index 14f047fb7b..2d8f0d6d2a 100644 --- a/gr-blocks/lib/test_gr_blocks.cc +++ b/gr-blocks/lib/test_gr_blocks.cc @@ -27,7 +27,7 @@ #include <cppunit/TextTestRunner.h> #include <cppunit/XmlOutputter.h> -#include <gr_unittests.h> +#include <gnuradio/unittests.h> #include <qa_blocks.h> #include <iostream> @@ -35,10 +35,10 @@ int main(int argc, char **argv) { CppUnit::TextTestRunner runner; - std::ofstream xmlfile(get_unittest_path("gr_blocks.xml").c_str()); + std::ofstream xmlfile(get_unittest_path("blocks.xml").c_str()); CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); - runner.addTest(qa_gr_blocks::suite()); + runner.addTest(qa_blocks::suite()); runner.setOutputter(xmlout); bool was_successful = runner.run("", false); diff --git a/gr-blocks/lib/threshold_ff_impl.cc b/gr-blocks/lib/threshold_ff_impl.cc index 477f2b1c89..86432de113 100644 --- a/gr-blocks/lib/threshold_ff_impl.cc +++ b/gr-blocks/lib/threshold_ff_impl.cc @@ -25,7 +25,7 @@ #endif #include "threshold_ff_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -39,9 +39,9 @@ namespace gr { threshold_ff_impl::threshold_ff_impl(float lo, float hi, float initial_state) - : gr_sync_block("threshold_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), + : sync_block("threshold_ff", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))), d_lo(lo), d_hi(hi), d_last_state(initial_state) { } diff --git a/gr-blocks/lib/threshold_ff_impl.h b/gr-blocks/lib/threshold_ff_impl.h index 41afaa52aa..13d71c433f 100644 --- a/gr-blocks/lib/threshold_ff_impl.h +++ b/gr-blocks/lib/threshold_ff_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_THRESHOLD_FF_IMPL_H #define INCLUDED_GR_THRESHOLD_FF_IMPL_H -#include <blocks/threshold_ff.h> +#include <gnuradio/blocks/threshold_ff.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/throttle_impl.cc b/gr-blocks/lib/throttle_impl.cc index b1cfe4b3c8..42f3665c86 100644 --- a/gr-blocks/lib/throttle_impl.cc +++ b/gr-blocks/lib/throttle_impl.cc @@ -25,7 +25,7 @@ #endif #include "throttle_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstring> #include <boost/thread/thread.hpp> @@ -41,9 +41,9 @@ namespace gr { throttle_impl::throttle_impl(size_t itemsize, double samples_per_second) - : gr_sync_block("throttle", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(1, 1, itemsize)), + : sync_block("throttle", + io_signature::make(1, 1, itemsize), + io_signature::make(1, 1, itemsize)), d_itemsize(itemsize) { set_sample_rate(samples_per_second); diff --git a/gr-blocks/lib/throttle_impl.h b/gr-blocks/lib/throttle_impl.h index 2f2cdf108b..797cb7d942 100644 --- a/gr-blocks/lib/throttle_impl.h +++ b/gr-blocks/lib/throttle_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_THROTTLE_IMPL_H #define INCLUDED_GR_THROTTLE_IMPL_H -#include <blocks/throttle.h> +#include <gnuradio/blocks/throttle.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/transcendental_impl.cc b/gr-blocks/lib/transcendental_impl.cc index 725899ca85..d9a635fdc2 100644 --- a/gr-blocks/lib/transcendental_impl.cc +++ b/gr-blocks/lib/transcendental_impl.cc @@ -21,7 +21,7 @@ */ #include "transcendental_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> #include <complex> //complex math #include <cmath> //real math @@ -126,9 +126,9 @@ namespace gr { transcendental_impl::transcendental_impl(const work_fcn_type &work_fcn, const size_t io_size) - : gr_sync_block("transcendental", - gr_make_io_signature(1, 1, io_size), - gr_make_io_signature(1, 1, io_size)), + : sync_block("transcendental", + io_signature::make(1, 1, io_size), + io_signature::make(1, 1, io_size)), _work_fcn(work_fcn) { // NOP diff --git a/gr-blocks/lib/transcendental_impl.h b/gr-blocks/lib/transcendental_impl.h index 47055551e4..bb82b23b66 100644 --- a/gr-blocks/lib/transcendental_impl.h +++ b/gr-blocks/lib/transcendental_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_TRANSCENDENTAL_IMPL_H #define INCLUDED_GR_TRANSCENDENTAL_IMPL_H -#include <blocks/transcendental.h> +#include <gnuradio/blocks/transcendental.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/tuntap_pdu_impl.cc b/gr-blocks/lib/tuntap_pdu_impl.cc index 8de817738f..0e2b63fab7 100644 --- a/gr-blocks/lib/tuntap_pdu_impl.cc +++ b/gr-blocks/lib/tuntap_pdu_impl.cc @@ -25,8 +25,8 @@ #endif #include "tuntap_pdu_impl.h" -#include <gr_io_signature.h> -#include <blocks/pdu.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/blocks/pdu.h> #include <boost/format.hpp> #include <sys/types.h> @@ -54,9 +54,9 @@ namespace gr { #if (defined(linux) || defined(__linux) || defined(__linux__)) tuntap_pdu_impl::tuntap_pdu_impl(std::string dev, int MTU) - : gr_block("tuntap_pdu", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (0, 0, 0)), + : block("tuntap_pdu", + io_signature::make (0, 0, 0), + io_signature::make (0, 0, 0)), stream_pdu_base(MTU), d_dev(dev) { diff --git a/gr-blocks/lib/tuntap_pdu_impl.h b/gr-blocks/lib/tuntap_pdu_impl.h index 396d9d51c8..41e4587ac4 100644 --- a/gr-blocks/lib/tuntap_pdu_impl.h +++ b/gr-blocks/lib/tuntap_pdu_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_BLOCKS_TUNTAP_PDU_IMPL_H #define INCLUDED_BLOCKS_TUNTAP_PDU_IMPL_H -#include <blocks/tuntap_pdu.h> +#include <gnuradio/blocks/tuntap_pdu.h> #include "stream_pdu_base.h" #if (defined(linux) || defined(__linux) || defined(__linux__)) diff --git a/gr-blocks/lib/uchar_array_to_float.h b/gr-blocks/lib/uchar_array_to_float.h index e6772c2a8d..9b499760aa 100644 --- a/gr-blocks/lib/uchar_array_to_float.h +++ b/gr-blocks/lib/uchar_array_to_float.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_UCHAR_ARRAY_TO_FLOAT_H #define INCLUDED_UCHAR_ARRAY_TO_FLOAT_H -#include <blocks/api.h> +#include <gnuradio/blocks/api.h> /* * convert array of unsigned chars to floats diff --git a/gr-blocks/lib/uchar_to_float_impl.cc b/gr-blocks/lib/uchar_to_float_impl.cc index 608c05ad47..20887881d9 100644 --- a/gr-blocks/lib/uchar_to_float_impl.cc +++ b/gr-blocks/lib/uchar_to_float_impl.cc @@ -26,7 +26,7 @@ #include "uchar_to_float_impl.h" #include "uchar_array_to_float.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -37,9 +37,9 @@ namespace gr { } uchar_to_float_impl::uchar_to_float_impl() - : gr_sync_block("uchar_to_float", - gr_make_io_signature (1, 1, sizeof(unsigned char)), - gr_make_io_signature (1, 1, sizeof(float))) + : sync_block("uchar_to_float", + io_signature::make (1, 1, sizeof(unsigned char)), + io_signature::make (1, 1, sizeof(float))) { } diff --git a/gr-blocks/lib/uchar_to_float_impl.h b/gr-blocks/lib/uchar_to_float_impl.h index 250dc2c86e..1e3f4d59c5 100644 --- a/gr-blocks/lib/uchar_to_float_impl.h +++ b/gr-blocks/lib/uchar_to_float_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_UCHAR_TO_FLOAT_IMPL_H #define INCLUDED_UCHAR_TO_FLOAT_IMPL_H -#include <blocks/uchar_to_float.h> +#include <gnuradio/blocks/uchar_to_float.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/udp_sink_impl.cc b/gr-blocks/lib/udp_sink_impl.cc index 7c1b0ed9e3..a23d3274cb 100644 --- a/gr-blocks/lib/udp_sink_impl.cc +++ b/gr-blocks/lib/udp_sink_impl.cc @@ -25,11 +25,11 @@ #endif #include "udp_sink_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <boost/array.hpp> #include <boost/asio.hpp> #include <boost/format.hpp> -#include <thread/thread.h> +#include <gnuradio/thread/thread.h> #include <stdexcept> #include <stdio.h> #include <string.h> @@ -50,9 +50,9 @@ namespace gr { udp_sink_impl::udp_sink_impl(size_t itemsize, const std::string &host, int port, int payload_size, bool eof) - : gr_sync_block("udp_sink", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(0, 0, 0)), + : sync_block("udp_sink", + io_signature::make(1, 1, itemsize), + io_signature::make(0, 0, 0)), d_itemsize(itemsize), d_payload_size(payload_size), d_eof(eof), d_connected(false) { diff --git a/gr-blocks/lib/udp_sink_impl.h b/gr-blocks/lib/udp_sink_impl.h index 0f0d081422..c593e6e809 100644 --- a/gr-blocks/lib/udp_sink_impl.h +++ b/gr-blocks/lib/udp_sink_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_UDP_SINK_IMPL_H #define INCLUDED_GR_UDP_SINK_IMPL_H -#include <blocks/udp_sink.h> +#include <gnuradio/blocks/udp_sink.h> #include <boost/asio.hpp> namespace gr { diff --git a/gr-blocks/lib/udp_source_impl.cc b/gr-blocks/lib/udp_source_impl.cc index 5b108c393e..e62c2b0df1 100644 --- a/gr-blocks/lib/udp_source_impl.cc +++ b/gr-blocks/lib/udp_source_impl.cc @@ -25,8 +25,8 @@ #endif #include "udp_source_impl.h" -#include <gr_io_signature.h> -#include <gr_math.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/math.h> #include <stdexcept> #include <errno.h> #include <stdio.h> @@ -48,9 +48,9 @@ namespace gr { udp_source_impl::udp_source_impl(size_t itemsize, const std::string &host, int port, int payload_size, bool eof) - : gr_sync_block("udp_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), + : sync_block("udp_source", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, itemsize)), d_itemsize(itemsize), d_payload_size(payload_size), d_eof(eof), d_connected(false), d_residual(0), d_sent(0), d_offset(0) { diff --git a/gr-blocks/lib/udp_source_impl.h b/gr-blocks/lib/udp_source_impl.h index d6c773726b..949364cf29 100644 --- a/gr-blocks/lib/udp_source_impl.h +++ b/gr-blocks/lib/udp_source_impl.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_GR_UDP_SOURCE_IMPL_H #define INCLUDED_GR_UDP_SOURCE_IMPL_H -#include <blocks/udp_source.h> +#include <gnuradio/blocks/udp_source.h> #include <boost/asio.hpp> #include <boost/format.hpp> -#include <thread/thread.h> +#include <gnuradio/thread/thread.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/unpack_k_bits_bb_impl.cc b/gr-blocks/lib/unpack_k_bits_bb_impl.cc index 367100be84..70055f9381 100644 --- a/gr-blocks/lib/unpack_k_bits_bb_impl.cc +++ b/gr-blocks/lib/unpack_k_bits_bb_impl.cc @@ -25,7 +25,7 @@ #endif #include "unpack_k_bits_bb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> #include <iostream> @@ -40,9 +40,9 @@ namespace gr { } unpack_k_bits_bb_impl::unpack_k_bits_bb_impl(unsigned k) - : gr_sync_interpolator("unpack_k_bits_bb", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(unsigned char)), + : sync_interpolator("unpack_k_bits_bb", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(unsigned char)), k), d_k(k) { diff --git a/gr-blocks/lib/unpack_k_bits_bb_impl.h b/gr-blocks/lib/unpack_k_bits_bb_impl.h index c72d16ebf8..7355d235c5 100644 --- a/gr-blocks/lib/unpack_k_bits_bb_impl.h +++ b/gr-blocks/lib/unpack_k_bits_bb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_UNPACK_K_BITS_BB_IMPL_H #define INCLUDED_GR_UNPACK_K_BITS_BB_IMPL_H -#include <blocks/unpack_k_bits_bb.h> +#include <gnuradio/blocks/unpack_k_bits_bb.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/unpacked_to_packed_XX_impl.cc.t b/gr-blocks/lib/unpacked_to_packed_XX_impl.cc.t index 3a7428fd8f..8e06570740 100644 --- a/gr-blocks/lib/unpacked_to_packed_XX_impl.cc.t +++ b/gr-blocks/lib/unpacked_to_packed_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@NAME_IMPL@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <assert.h> namespace gr { @@ -37,17 +37,17 @@ namespace gr { @NAME@::sptr @NAME@::make(unsigned int bits_per_chunk, - gr_endianness_t endianness) + endianness_t endianness) { return gnuradio::get_initial_sptr (new @NAME_IMPL@(bits_per_chunk, endianness)); } @NAME_IMPL@::@NAME_IMPL@(unsigned int bits_per_chunk, - gr_endianness_t endianness) - : gr_block("@NAME@", - gr_make_io_signature(1, -1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, -1, sizeof(@O_TYPE@))), + endianness_t endianness) + : block("@NAME@", + io_signature::make(1, -1, sizeof(@I_TYPE@)), + io_signature::make(1, -1, sizeof(@O_TYPE@))), d_bits_per_chunk(bits_per_chunk), d_endianness(endianness), d_index(0) { assert(bits_per_chunk <= BITS_PER_TYPE); diff --git a/gr-blocks/lib/unpacked_to_packed_XX_impl.h.t b/gr-blocks/lib/unpacked_to_packed_XX_impl.h.t index c8f414c559..2076c65e9b 100644 --- a/gr-blocks/lib/unpacked_to_packed_XX_impl.h.t +++ b/gr-blocks/lib/unpacked_to_packed_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { @@ -34,12 +34,12 @@ namespace gr { { private: unsigned int d_bits_per_chunk; - gr_endianness_t d_endianness; + endianness_t d_endianness; unsigned int d_index; public: @NAME_IMPL@(unsigned int bits_per_chunk, - gr_endianness_t endianness); + endianness_t endianness); ~@NAME_IMPL@(); void forecast(int noutput_items, diff --git a/gr-blocks/lib/vco_f_impl.cc b/gr-blocks/lib/vco_f_impl.cc index 21e7d0a0f2..42be98ad4e 100644 --- a/gr-blocks/lib/vco_f_impl.cc +++ b/gr-blocks/lib/vco_f_impl.cc @@ -25,7 +25,7 @@ #endif #include "vco_f_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <math.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } vco_f_impl::vco_f_impl(double sampling_rate, double sensitivity, double amplitude) - : gr_sync_block("vco_f", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), + : sync_block("vco_f", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))), d_sampling_rate(sampling_rate), d_sensitivity(sensitivity), d_amplitude(amplitude), d_k(d_sensitivity/d_sampling_rate) { diff --git a/gr-blocks/lib/vco_f_impl.h b/gr-blocks/lib/vco_f_impl.h index 37435b7736..6e7a6dd7b6 100644 --- a/gr-blocks/lib/vco_f_impl.h +++ b/gr-blocks/lib/vco_f_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_VCO_F_IMPL_H #define INCLUDED_GR_VCO_F_IMPL_H -#include <blocks/vco_f.h> -#include <gr_fxpt_vco.h> +#include <gnuradio/blocks/vco_f.h> +#include <gnuradio/fxpt_vco.h> namespace gr { namespace blocks { @@ -36,7 +36,7 @@ namespace gr { double d_sensitivity; double d_amplitude; double d_k; - gr_fxpt_vco d_vco; + gr::fxpt_vco d_vco; public: vco_f_impl(double sampling_rate, double sensitivity, double amplitude); diff --git a/gr-blocks/lib/vector_insert_X_impl.cc.t b/gr-blocks/lib/vector_insert_X_impl.cc.t index adf31fe05a..a4645816d8 100644 --- a/gr-blocks/lib/vector_insert_X_impl.cc.t +++ b/gr-blocks/lib/vector_insert_X_impl.cc.t @@ -28,7 +28,7 @@ #include <@NAME_IMPL@.h> #include <algorithm> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> #include <stdio.h> @@ -44,9 +44,9 @@ namespace gr { @NAME_IMPL@::@NAME_IMPL@(const std::vector<@TYPE@> &data, int periodicity, int offset) - : gr_block("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(@TYPE@)), - gr_make_io_signature(1, 1, sizeof(@TYPE@))), + : block("@BASE_NAME@", + io_signature::make(1, 1, sizeof(@TYPE@)), + io_signature::make(1, 1, sizeof(@TYPE@))), d_data(data), d_offset(offset), d_periodicity(periodicity) diff --git a/gr-blocks/lib/vector_insert_X_impl.h.t b/gr-blocks/lib/vector_insert_X_impl.h.t index f447ef1e80..12a7bbe6bc 100644 --- a/gr-blocks/lib/vector_insert_X_impl.h.t +++ b/gr-blocks/lib/vector_insert_X_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/vector_map_impl.cc b/gr-blocks/lib/vector_map_impl.cc index 19b57bac8b..d50dcb56bc 100644 --- a/gr-blocks/lib/vector_map_impl.cc +++ b/gr-blocks/lib/vector_map_impl.cc @@ -25,7 +25,7 @@ #endif #include "vector_map_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> namespace gr { @@ -62,10 +62,10 @@ namespace gr { vector_map_impl::vector_map_impl(size_t item_size, std::vector<size_t> in_vlens, std::vector< std::vector< std::vector<size_t> > > mapping) - : gr_sync_block("vector_map", - gr_make_io_signaturev(in_vlens.size(), in_vlens.size(), + : sync_block("vector_map", + io_signature::makev(in_vlens.size(), in_vlens.size(), get_in_sizeofs(item_size, in_vlens)), - gr_make_io_signaturev(mapping.size(), mapping.size(), + io_signature::makev(mapping.size(), mapping.size(), get_out_sizeofs(item_size, mapping))), d_item_size(item_size), d_in_vlens(in_vlens) { diff --git a/gr-blocks/lib/vector_map_impl.h b/gr-blocks/lib/vector_map_impl.h index 08faa2ce09..64f5e091e6 100644 --- a/gr-blocks/lib/vector_map_impl.h +++ b/gr-blocks/lib/vector_map_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_VECTOR_MAP_IMPL_H #define INCLUDED_GR_VECTOR_MAP_IMPL_H -#include <blocks/vector_map.h> -#include <thread/thread.h> +#include <gnuradio/blocks/vector_map.h> +#include <gnuradio/thread/thread.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/vector_sink_X_impl.cc.t b/gr-blocks/lib/vector_sink_X_impl.cc.t index 3be2861025..a8d674f15a 100644 --- a/gr-blocks/lib/vector_sink_X_impl.cc.t +++ b/gr-blocks/lib/vector_sink_X_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <algorithm> #include <iostream> @@ -42,9 +42,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(int vlen) - : gr_sync_block("@NAME@", - gr_make_io_signature(1, 1, sizeof(@TYPE@) * vlen), - gr_make_io_signature(0, 0, 0)), + : sync_block("@NAME@", + io_signature::make(1, 1, sizeof(@TYPE@) * vlen), + io_signature::make(0, 0, 0)), d_vlen(vlen) { } @@ -58,7 +58,7 @@ namespace gr { return d_data; } - std::vector<gr_tag_t> + std::vector<tag_t> @NAME_IMPL@::tags() const { return d_tags; @@ -73,7 +73,7 @@ namespace gr { for(int i = 0; i < noutput_items * d_vlen; i++) d_data.push_back (iptr[i]); - std::vector<gr_tag_t> tags; + std::vector<tag_t> tags; get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0) + noutput_items); d_tags.insert(d_tags.end(), tags.begin(), tags.end()); return noutput_items; diff --git a/gr-blocks/lib/vector_sink_X_impl.h.t b/gr-blocks/lib/vector_sink_X_impl.h.t index 60d21e0c8c..b5d3bd6432 100644 --- a/gr-blocks/lib/vector_sink_X_impl.h.t +++ b/gr-blocks/lib/vector_sink_X_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { @@ -34,7 +34,7 @@ namespace gr { { private: std::vector<@TYPE@> d_data; - std::vector<gr_tag_t> d_tags; + std::vector<tag_t> d_tags; int d_vlen; public: @@ -43,7 +43,7 @@ namespace gr { void reset() { d_data.clear(); } std::vector<@TYPE@> data() const; - std::vector<gr_tag_t> tags() const; + std::vector<tag_t> tags() const; int work(int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gr-blocks/lib/vector_source_X_impl.cc.t b/gr-blocks/lib/vector_source_X_impl.cc.t index 9c1c63a213..93f672bfb9 100644 --- a/gr-blocks/lib/vector_source_X_impl.cc.t +++ b/gr-blocks/lib/vector_source_X_impl.cc.t @@ -28,7 +28,7 @@ #include <@NAME_IMPL@.h> #include <algorithm> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> namespace gr { @@ -37,7 +37,7 @@ namespace gr { @NAME@::sptr @NAME@::make(const std::vector<@TYPE@> &data, bool repeat, int vlen, - const std::vector<gr_tag_t> &tags) + const std::vector<tag_t> &tags) { return gnuradio::get_initial_sptr (new @NAME_IMPL@(data, repeat, vlen, tags)); @@ -45,10 +45,10 @@ namespace gr { @NAME_IMPL@::@NAME_IMPL@(const std::vector<@TYPE@> &data, bool repeat, int vlen, - const std::vector<gr_tag_t> &tags) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, sizeof(@TYPE@) * vlen)), + const std::vector<tag_t> &tags) + : sync_block("@BASE_NAME@", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, sizeof(@TYPE@) * vlen)), d_data(data), d_repeat(repeat), d_offset(0), @@ -72,7 +72,7 @@ namespace gr { void @NAME_IMPL@::set_data (const std::vector<@TYPE@> &data, - const std::vector<gr_tag_t> &tags) + const std::vector<tag_t> &tags) { d_data = data; d_tags = tags; diff --git a/gr-blocks/lib/vector_source_X_impl.h.t b/gr-blocks/lib/vector_source_X_impl.h.t index 78ec52bacf..2641c6661b 100644 --- a/gr-blocks/lib/vector_source_X_impl.h.t +++ b/gr-blocks/lib/vector_source_X_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { @@ -38,18 +38,18 @@ namespace gr { unsigned int d_offset; int d_vlen; bool d_settags; - std::vector<gr_tag_t> d_tags; + std::vector<tag_t> d_tags; unsigned int d_tagpos; public: @NAME_IMPL@(const std::vector<@TYPE@> &data, bool repeat, int vlen, - const std::vector<gr_tag_t> &tags); + const std::vector<tag_t> &tags); ~@NAME_IMPL@(); void rewind() { d_offset=0; } void set_data(const std::vector<@TYPE@> &data, - const std::vector<gr_tag_t> &tags); + const std::vector<tag_t> &tags); int work(int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gr-blocks/lib/vector_to_stream_impl.cc b/gr-blocks/lib/vector_to_stream_impl.cc index fa833a3ec8..637a252052 100644 --- a/gr-blocks/lib/vector_to_stream_impl.cc +++ b/gr-blocks/lib/vector_to_stream_impl.cc @@ -25,7 +25,7 @@ #endif #include "vector_to_stream_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -36,9 +36,9 @@ namespace gr { } vector_to_stream_impl::vector_to_stream_impl(size_t itemsize, size_t nitems_per_block) - : gr_sync_interpolator ("vector_to_stream", - gr_make_io_signature (1, 1, itemsize * nitems_per_block), - gr_make_io_signature (1, 1, itemsize), + : sync_interpolator ("vector_to_stream", + io_signature::make (1, 1, itemsize * nitems_per_block), + io_signature::make (1, 1, itemsize), nitems_per_block) { } diff --git a/gr-blocks/lib/vector_to_stream_impl.h b/gr-blocks/lib/vector_to_stream_impl.h index 4128f60900..d2f4759cd9 100644 --- a/gr-blocks/lib/vector_to_stream_impl.h +++ b/gr-blocks/lib/vector_to_stream_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VECTOR_TO_STREAM_IMPL_H #define INCLUDED_VECTOR_TO_STREAM_IMPL_H -#include <blocks/vector_to_stream.h> +#include <gnuradio/blocks/vector_to_stream.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/vector_to_streams_impl.cc b/gr-blocks/lib/vector_to_streams_impl.cc index 09d32c5c52..99f35b0ab3 100644 --- a/gr-blocks/lib/vector_to_streams_impl.cc +++ b/gr-blocks/lib/vector_to_streams_impl.cc @@ -25,7 +25,7 @@ #endif #include "vector_to_streams_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -36,9 +36,9 @@ namespace gr { } vector_to_streams_impl::vector_to_streams_impl(size_t itemsize, size_t nstreams) - : gr_sync_block ("vector_to_streams", - gr_make_io_signature (1, 1, nstreams * itemsize), - gr_make_io_signature (nstreams, nstreams, itemsize)) + : sync_block ("vector_to_streams", + io_signature::make (1, 1, nstreams * itemsize), + io_signature::make (nstreams, nstreams, itemsize)) { } diff --git a/gr-blocks/lib/vector_to_streams_impl.h b/gr-blocks/lib/vector_to_streams_impl.h index 81bcfd0762..b5393729eb 100644 --- a/gr-blocks/lib/vector_to_streams_impl.h +++ b/gr-blocks/lib/vector_to_streams_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VECTOR_TO_STREAMS_IMPL_H #define INCLUDED_VECTOR_TO_STREAMS_IMPL_H -#include <blocks/vector_to_streams.h> +#include <gnuradio/blocks/vector_to_streams.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/wavfile.cc b/gr-blocks/lib/wavfile.cc index 16d80adc83..e741cbab4e 100644 --- a/gr-blocks/lib/wavfile.cc +++ b/gr-blocks/lib/wavfile.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <blocks/wavfile.h> +#include <gnuradio/blocks/wavfile.h> #include <cstring> #include <stdint.h> #include <boost/detail/endian.hpp> //BOOST_BIG_ENDIAN diff --git a/gr-blocks/lib/wavfile_sink_impl.cc b/gr-blocks/lib/wavfile_sink_impl.cc index 4591b1f9fa..9a96f7ca3d 100644 --- a/gr-blocks/lib/wavfile_sink_impl.cc +++ b/gr-blocks/lib/wavfile_sink_impl.cc @@ -25,14 +25,14 @@ #endif #include "wavfile_sink_impl.h" -#include <blocks/wavfile.h> -#include <gr_io_signature.h> +#include <gnuradio/blocks/wavfile.h> +#include <gnuradio/io_signature.h> #include <stdexcept> #include <climits> #include <cstring> #include <cmath> #include <fcntl.h> -#include <thread/thread.h> +#include <gnuradio/thread/thread.h> #include <boost/math/special_functions/round.hpp> // win32 (mingw/msvc) specific @@ -70,9 +70,9 @@ namespace gr { int n_channels, unsigned int sample_rate, int bits_per_sample) - : gr_sync_block("wavfile_sink", - gr_make_io_signature(1, n_channels, sizeof(float)), - gr_make_io_signature(0, 0, 0)), + : sync_block("wavfile_sink", + io_signature::make(1, n_channels, sizeof(float)), + io_signature::make(0, 0, 0)), d_sample_rate(sample_rate), d_nchans(n_channels), d_fp(0), d_new_fp(0), d_updated(false) { diff --git a/gr-blocks/lib/wavfile_sink_impl.h b/gr-blocks/lib/wavfile_sink_impl.h index 4ad9958884..52dfd2259b 100644 --- a/gr-blocks/lib/wavfile_sink_impl.h +++ b/gr-blocks/lib/wavfile_sink_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_WAVFILE_SINK_IMPL_H #define INCLUDED_GR_WAVFILE_SINK_IMPL_H -#include <blocks/wavfile_sink.h> +#include <gnuradio/blocks/wavfile_sink.h> namespace gr { namespace blocks { diff --git a/gr-blocks/lib/wavfile_source_impl.cc b/gr-blocks/lib/wavfile_source_impl.cc index 2e3b0e240c..7538792d1c 100644 --- a/gr-blocks/lib/wavfile_source_impl.cc +++ b/gr-blocks/lib/wavfile_source_impl.cc @@ -25,8 +25,8 @@ #endif #include "wavfile_source_impl.h" -#include <gr_io_signature.h> -#include <blocks/wavfile.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/blocks/wavfile.h> #include <sys/types.h> #include <fcntl.h> #include <stdexcept> @@ -58,9 +58,9 @@ namespace gr { } wavfile_source_impl::wavfile_source_impl (const char *filename, bool repeat) - : gr_sync_block("wavfile_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 2, sizeof(float))), + : sync_block("wavfile_source", + io_signature::make(0, 0, 0), + io_signature::make(1, 2, sizeof(float))), d_fp(NULL), d_repeat(repeat), d_sample_rate(1), d_nchans(1), d_bytes_per_sample(2), d_first_sample_pos(0), d_samples_per_chan(0), d_sample_idx(0) @@ -102,7 +102,7 @@ namespace gr { } // Re-set the output signature - set_output_signature(gr_make_io_signature(1, d_nchans, sizeof(float))); + set_output_signature(io_signature::make(1, d_nchans, sizeof(float))); } wavfile_source_impl::~wavfile_source_impl () diff --git a/gr-blocks/lib/wavfile_source_impl.h b/gr-blocks/lib/wavfile_source_impl.h index 4875731a08..3996cb0606 100644 --- a/gr-blocks/lib/wavfile_source_impl.h +++ b/gr-blocks/lib/wavfile_source_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_WAVFILE_SOURCE_IMPL_H #define INCLUDED_GR_WAVFILE_SOURCE_IMPL_H -#include <blocks/wavfile_source.h> +#include <gnuradio/blocks/wavfile_source.h> #include <cstdio> // for FILE namespace gr { diff --git a/gr-blocks/lib/xor_XX_impl.cc.t b/gr-blocks/lib/xor_XX_impl.cc.t index eea9265126..6b9df4f4fb 100644 --- a/gr-blocks/lib/xor_XX_impl.cc.t +++ b/gr-blocks/lib/xor_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include <@NAME_IMPL@.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace blocks { @@ -38,9 +38,9 @@ namespace gr { } @NAME_IMPL@::@NAME_IMPL@(size_t vlen) - : gr_sync_block ("@NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)), + : sync_block ("@NAME@", + io_signature::make (1, -1, sizeof (@I_TYPE@)*vlen), + io_signature::make (1, 1, sizeof (@O_TYPE@)*vlen)), d_vlen(vlen) { } diff --git a/gr-blocks/lib/xor_XX_impl.h.t b/gr-blocks/lib/xor_XX_impl.h.t index 25f0da0c85..f7db3f2162 100644 --- a/gr-blocks/lib/xor_XX_impl.h.t +++ b/gr-blocks/lib/xor_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME_IMPL@ #define @GUARD_NAME_IMPL@ -#include <blocks/@NAME@.h> +#include <gnuradio/blocks/@NAME@.h> namespace gr { namespace blocks { diff --git a/gr-blocks/python/qa_keep_one_in_n.py b/gr-blocks/python/qa_keep_one_in_n.py index f06ed33d6b..a96f0a9518 100755 --- a/gr-blocks/python/qa_keep_one_in_n.py +++ b/gr-blocks/python/qa_keep_one_in_n.py @@ -37,6 +37,7 @@ class test_keep_one_in_n(gr_unittest.TestCase): src = blocks.vector_source_b(src_data); op = blocks.keep_one_in_n(gr.sizeof_char, 5) dst = blocks.vector_sink_b() + print "HERE" self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(dst.data(), expected_data) diff --git a/gr-blocks/python/qa_message_tags.py b/gr-blocks/python/qa_message_tags.py index 0ab857b1aa..952c699455 100644 --- a/gr-blocks/python/qa_message_tags.py +++ b/gr-blocks/python/qa_message_tags.py @@ -7,8 +7,8 @@ class test_message_tags (gr_unittest.TestCase): def test_1 (self): data = ('hello', 'you', 'there') - tx_msgq = gr.msg_queue () - rx_msgq = gr.msg_queue () + tx_msgq = gr.msg_queue() + rx_msgq = gr.msg_queue() for d in data: tx_msgq.insert_tail(gr.message_from_string(d)) tb = gr.top_block() diff --git a/gr-blocks/python/qa_repack_bits_bb.py b/gr-blocks/python/qa_repack_bits_bb.py index 9da6cf26c6..209b6e1324 100755 --- a/gr-blocks/python/qa_repack_bits_bb.py +++ b/gr-blocks/python/qa_repack_bits_bb.py @@ -79,7 +79,7 @@ class qa_repack_bits_bb (gr_unittest.TestCase): k = 8 l = 3 tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(src_data)) @@ -104,7 +104,7 @@ class qa_repack_bits_bb (gr_unittest.TestCase): k = 3 l = 8 tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(src_data)) diff --git a/gr-blocks/python/qa_tagged_stream_mux.py b/gr-blocks/python/qa_tagged_stream_mux.py index 1759c44623..e9c3343000 100755 --- a/gr-blocks/python/qa_tagged_stream_mux.py +++ b/gr-blocks/python/qa_tagged_stream_mux.py @@ -27,7 +27,7 @@ import numpy def make_len_tags(tupl, key): tags = [] - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.key = pmt.string_to_symbol(key) n_read = 0 for element in tupl: @@ -38,7 +38,7 @@ def make_len_tags(tupl, key): return tags def make_len_tag(offset, key, value): - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = offset tag.key = pmt.string_to_symbol(key) tag.value = pmt.to_pmt(value) @@ -73,11 +73,11 @@ class qa_tagged_stream_mux (gr_unittest.TestCase): make_len_tag(5, tagname, 3), make_len_tag(8, tagname, 1) ) - test_tag_0 = gr.gr_tag_t() + test_tag_0 = gr.tag_t() test_tag_0.key = pmt.string_to_symbol('spam') test_tag_0.offset = 4 # On the second '1' test_tag_0.value = pmt.to_pmt(42) - test_tag_1 = gr.gr_tag_t() + test_tag_1 = gr.tag_t() test_tag_1.key = pmt.string_to_symbol('eggs') test_tag_1.offset = 3 # On the first '3' of the 2nd stream test_tag_1.value = pmt.to_pmt(23) diff --git a/gr-blocks/swig/CMakeLists.txt b/gr-blocks/swig/CMakeLists.txt index 09fcf7692a..a68f01b692 100644 --- a/gr-blocks/swig/CMakeLists.txt +++ b/gr-blocks/swig/CMakeLists.txt @@ -24,7 +24,6 @@ include(GrPython) include(GrSwig) set(GR_SWIG_INCLUDE_DIRS - ${CMAKE_CURRENT_BINARY_DIR}/../include ${GR_BLOCKS_INCLUDE_DIRS} ${GNURADIO_RUNTIME_INCLUDE_DIRS} ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS} @@ -51,11 +50,14 @@ set(GR_SWIG_BLOCK_IFILES blocks_swig0 blocks_swig1 blocks_swig2 + blocks_swig3 + blocks_swig4 + blocks_swig5 ) foreach(swigfile ${GR_SWIG_BLOCK_IFILES}) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${swigfile}_doc.i) - set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/blocks) + set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/blocks) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_TARGET_DEPS blocks_generated_includes) set(GR_SWIG_LIBRARIES gnuradio-blocks) diff --git a/gr-blocks/swig/blocks_swig.i b/gr-blocks/swig/blocks_swig.i deleted file mode 100644 index f808d1e771..0000000000 --- a/gr-blocks/swig/blocks_swig.i +++ /dev/null @@ -1,638 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012-2013 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. - */ - -#define BLOCKS_API - -%include "runtime_swig.i" -%include "blocks/pdu.h" - -//load generated python docstrings -%include "blocks_swig_doc.i" - -%include <gr_endianness.h> - -// For vector_map. -%template() std::vector< std::vector< std::vector<size_t> > >; - -%{ -#include "blocks/add_ff.h" -#include "blocks/add_ss.h" -#include "blocks/add_ii.h" -#include "blocks/add_cc.h" -#include "blocks/add_const_ff.h" -#include "blocks/add_const_bb.h" -#include "blocks/add_const_ss.h" -#include "blocks/add_const_ii.h" -#include "blocks/add_const_cc.h" -#include "blocks/add_const_vff.h" -#include "blocks/add_const_vbb.h" -#include "blocks/add_const_vss.h" -#include "blocks/add_const_vii.h" -#include "blocks/add_const_vcc.h" -#include "blocks/and_bb.h" -#include "blocks/and_ss.h" -#include "blocks/and_ii.h" -#include "blocks/and_const_bb.h" -#include "blocks/and_const_ss.h" -#include "blocks/and_const_ii.h" -#include "blocks/annotator_1to1.h" -#include "blocks/annotator_alltoall.h" -#include "blocks/annotator_raw.h" -#include "blocks/argmax_fs.h" -#include "blocks/argmax_is.h" -#include "blocks/argmax_ss.h" -#include "blocks/bin_statistics_f.h" -#include "blocks/burst_tagger.h" -#include "blocks/char_to_float.h" -#include "blocks/char_to_short.h" -#include "blocks/check_lfsr_32k_s.h" -#include "blocks/complex_to_interleaved_short.h" -#include "blocks/complex_to_float.h" -#include "blocks/complex_to_real.h" -#include "blocks/complex_to_imag.h" -#include "blocks/complex_to_mag.h" -#include "blocks/complex_to_mag_squared.h" -#include "blocks/complex_to_arg.h" -#include "blocks/conjugate_cc.h" -#include "blocks/control_loop.h" -#include "blocks/copy.h" -#include "blocks/deinterleave.h" -#include "blocks/delay.h" -#include "blocks/divide_ff.h" -#include "blocks/divide_ss.h" -#include "blocks/divide_ii.h" -#include "blocks/divide_cc.h" -#include "blocks/endian_swap.h" -#include "blocks/file_descriptor_sink.h" -#include "blocks/file_descriptor_source.h" -#include "blocks/file_sink_base.h" -#include "blocks/file_sink.h" -#include "blocks/file_source.h" -#include "blocks/file_meta_sink.h" -#include "blocks/file_meta_source.h" -#include "blocks/float_to_char.h" -#include "blocks/float_to_complex.h" -#include "blocks/float_to_int.h" -#include "blocks/float_to_short.h" -#include "blocks/float_to_uchar.h" -#include "blocks/head.h" -#include "blocks/int_to_float.h" -#include "blocks/integrate_ss.h" -#include "blocks/integrate_ii.h" -#include "blocks/integrate_ff.h" -#include "blocks/integrate_cc.h" -#include "blocks/interleave.h" -#include "blocks/interleaved_short_to_complex.h" -#include "blocks/keep_m_in_n.h" -#include "blocks/keep_one_in_n.h" -#include "blocks/lfsr_32k_source_s.h" -#include "blocks/max_ff.h" -#include "blocks/max_ii.h" -#include "blocks/max_ss.h" -#include "blocks/message_debug.h" -#include "blocks/message_sink.h" -#include "blocks/message_source.h" -#include "blocks/message_strobe.h" -#include "blocks/message_burst_source.h" -#include "blocks/moving_average_cc.h" -#include "blocks/moving_average_ff.h" -#include "blocks/moving_average_ii.h" -#include "blocks/moving_average_ss.h" -#include "blocks/multiply_ss.h" -#include "blocks/multiply_ii.h" -#include "blocks/multiply_ff.h" -#include "blocks/multiply_cc.h" -#include "blocks/multiply_conjugate_cc.h" -#include "blocks/multiply_const_ss.h" -#include "blocks/multiply_const_ii.h" -#include "blocks/multiply_const_ff.h" -#include "blocks/multiply_const_cc.h" -#include "blocks/multiply_const_vss.h" -#include "blocks/multiply_const_vii.h" -#include "blocks/multiply_const_vff.h" -#include "blocks/multiply_const_vcc.h" -#include "blocks/mute_ss.h" -#include "blocks/mute_ii.h" -#include "blocks/mute_ff.h" -#include "blocks/mute_cc.h" -#include "blocks/nlog10_ff.h" -#include "blocks/nop.h" -#include "blocks/not_bb.h" -#include "blocks/not_ss.h" -#include "blocks/not_ii.h" -#include "blocks/null_sink.h" -#include "blocks/null_source.h" -#include "blocks/patterned_interleaver.h" -#include "blocks/pack_k_bits_bb.h" -#include "blocks/packed_to_unpacked_bb.h" -#include "blocks/packed_to_unpacked_ss.h" -#include "blocks/packed_to_unpacked_ii.h" -#include "blocks/pdu_to_tagged_stream.h" -#include "blocks/peak_detector_fb.h" -#include "blocks/peak_detector_ib.h" -#include "blocks/peak_detector_sb.h" -#include "blocks/peak_detector2_fb.h" -#include "blocks/plateau_detector_fb.h" -#include "blocks/probe_rate.h" -#include "blocks/probe_signal_b.h" -#include "blocks/probe_signal_s.h" -#include "blocks/probe_signal_i.h" -#include "blocks/probe_signal_f.h" -#include "blocks/probe_signal_c.h" -#include "blocks/probe_signal_vb.h" -#include "blocks/probe_signal_vs.h" -#include "blocks/probe_signal_vi.h" -#include "blocks/probe_signal_vf.h" -#include "blocks/probe_signal_vc.h" -#include "blocks/or_bb.h" -#include "blocks/or_ss.h" -#include "blocks/or_ii.h" -#include "blocks/random_pdu.h" -#include "blocks/regenerate_bb.h" -#include "blocks/repack_bits_bb.h" -#include "blocks/repeat.h" -#include "blocks/rms_cf.h" -#include "blocks/rms_ff.h" -#include "blocks/sample_and_hold_bb.h" -#include "blocks/sample_and_hold_ss.h" -#include "blocks/sample_and_hold_ii.h" -#include "blocks/sample_and_hold_ff.h" -#include "blocks/short_to_char.h" -#include "blocks/short_to_float.h" -#include "blocks/skiphead.h" -#include "blocks/socket_pdu.h" -#include "blocks/stream_mux.h" -#include "blocks/stream_to_streams.h" -#include "blocks/stream_to_vector.h" -#include "blocks/streams_to_stream.h" -#include "blocks/streams_to_vector.h" -#include "blocks/stretch_ff.h" -#include "blocks/sub_ff.h" -#include "blocks/sub_ss.h" -#include "blocks/sub_ii.h" -#include "blocks/sub_cc.h" -#include "blocks/tag_debug.h" -#include "blocks/tagged_file_sink.h" -#include "blocks/tagged_stream_mux.h" -#include "blocks/tagged_stream_to_pdu.h" -#include "blocks/threshold_ff.h" -#include "blocks/throttle.h" -#include "blocks/transcendental.h" -#include "blocks/tuntap_pdu.h" -#include "blocks/uchar_to_float.h" -#include "blocks/udp_sink.h" -#include "blocks/udp_source.h" -#include "blocks/unpack_k_bits_bb.h" -#include "blocks/unpacked_to_packed_bb.h" -#include "blocks/unpacked_to_packed_ss.h" -#include "blocks/unpacked_to_packed_ii.h" -#include "blocks/vco_f.h" -#include "blocks/vector_map.h" -#include "blocks/vector_to_stream.h" -#include "blocks/vector_to_streams.h" -#include "blocks/vector_insert_b.h" -#include "blocks/vector_insert_s.h" -#include "blocks/vector_insert_i.h" -#include "blocks/vector_insert_f.h" -#include "blocks/vector_insert_c.h" -#include "blocks/vector_sink_b.h" -#include "blocks/vector_sink_s.h" -#include "blocks/vector_sink_i.h" -#include "blocks/vector_sink_f.h" -#include "blocks/vector_sink_c.h" -#include "blocks/vector_source_b.h" -#include "blocks/vector_source_s.h" -#include "blocks/vector_source_i.h" -#include "blocks/vector_source_f.h" -#include "blocks/vector_source_c.h" -#include "blocks/wavfile_sink.h" -#include "blocks/wavfile_source.h" -#include "blocks/xor_bb.h" -#include "blocks/xor_ss.h" -#include "blocks/xor_ii.h" -%} - -%include "blocks/add_ff.h" -%include "blocks/add_ss.h" -%include "blocks/add_ii.h" -%include "blocks/add_cc.h" -%include "blocks/add_const_ff.h" -%include "blocks/add_const_bb.h" -%include "blocks/add_const_ss.h" -%include "blocks/add_const_ii.h" -%include "blocks/add_const_cc.h" -%include "blocks/add_const_vff.h" -%include "blocks/add_const_vbb.h" -%include "blocks/add_const_vss.h" -%include "blocks/add_const_vii.h" -%include "blocks/add_const_vcc.h" -%include "blocks/and_bb.h" -%include "blocks/and_ss.h" -%include "blocks/and_ii.h" -%include "blocks/and_const_bb.h" -%include "blocks/and_const_ss.h" -%include "blocks/and_const_ii.h" -%include "blocks/annotator_1to1.h" -%include "blocks/annotator_alltoall.h" -%include "blocks/annotator_raw.h" -%include "blocks/argmax_fs.h" -%include "blocks/argmax_is.h" -%include "blocks/argmax_ss.h" -%include "blocks/char_to_float.h" -%include "blocks/bin_statistics_f.h" -%include "blocks/burst_tagger.h" -%include "blocks/char_to_short.h" -%include "blocks/check_lfsr_32k_s.h" -%include "blocks/complex_to_interleaved_short.h" -%include "blocks/complex_to_float.h" -%include "blocks/complex_to_real.h" -%include "blocks/complex_to_imag.h" -%include "blocks/complex_to_mag.h" -%include "blocks/complex_to_mag_squared.h" -%include "blocks/complex_to_arg.h" -%include "blocks/conjugate_cc.h" -%include "blocks/control_loop.h" -%include "blocks/copy.h" -%include "blocks/deinterleave.h" -%include "blocks/delay.h" -%include "blocks/file_descriptor_sink.h" -%include "blocks/file_descriptor_source.h" -%include "blocks/file_sink_base.h" -%include "blocks/file_sink.h" -%include "blocks/file_source.h" -%include "blocks/file_meta_sink.h" -%include "blocks/file_meta_source.h" -%include "blocks/divide_ff.h" -%include "blocks/divide_ss.h" -%include "blocks/divide_ii.h" -%include "blocks/divide_cc.h" -%include "blocks/endian_swap.h" -%include "blocks/float_to_char.h" -%include "blocks/float_to_complex.h" -%include "blocks/float_to_int.h" -%include "blocks/float_to_short.h" -%include "blocks/float_to_uchar.h" -%include "blocks/head.h" -%include "blocks/int_to_float.h" -%include "blocks/integrate_ss.h" -%include "blocks/integrate_ii.h" -%include "blocks/integrate_ff.h" -%include "blocks/integrate_cc.h" -%include "blocks/interleave.h" -%include "blocks/interleaved_short_to_complex.h" -%include "blocks/keep_m_in_n.h" -%include "blocks/keep_one_in_n.h" -%include "blocks/lfsr_32k_source_s.h" -%include "blocks/max_ff.h" -%include "blocks/max_ii.h" -%include "blocks/max_ss.h" -%include "blocks/message_debug.h" -%include "blocks/message_sink.h" -%include "blocks/message_source.h" -%include "blocks/message_strobe.h" -%include "blocks/message_burst_source.h" -%include "blocks/moving_average_cc.h" -%include "blocks/moving_average_ff.h" -%include "blocks/moving_average_ii.h" -%include "blocks/moving_average_ss.h" -%include "blocks/multiply_ss.h" -%include "blocks/multiply_ii.h" -%include "blocks/multiply_ff.h" -%include "blocks/multiply_cc.h" -%include "blocks/multiply_conjugate_cc.h" -%include "blocks/multiply_const_ss.h" -%include "blocks/multiply_const_ii.h" -%include "blocks/multiply_const_ff.h" -%include "blocks/multiply_const_cc.h" -%include "blocks/multiply_const_vss.h" -%include "blocks/multiply_const_vii.h" -%include "blocks/multiply_const_vff.h" -%include "blocks/multiply_const_vcc.h" -%include "blocks/mute_ss.h" -%include "blocks/mute_ii.h" -%include "blocks/mute_ff.h" -%include "blocks/mute_cc.h" -%include "blocks/nlog10_ff.h" -%include "blocks/nop.h" -%include "blocks/not_bb.h" -%include "blocks/not_ss.h" -%include "blocks/not_ii.h" -%include "blocks/null_sink.h" -%include "blocks/null_source.h" -%include "blocks/probe_signal_b.h" -%include "blocks/probe_signal_s.h" -%include "blocks/probe_signal_i.h" -%include "blocks/probe_signal_f.h" -%include "blocks/probe_signal_c.h" -%include "blocks/probe_signal_vb.h" -%include "blocks/probe_signal_vs.h" -%include "blocks/probe_signal_vi.h" -%include "blocks/probe_signal_vf.h" -%include "blocks/probe_signal_vc.h" -%include "blocks/or_bb.h" -%include "blocks/or_ss.h" -%include "blocks/or_ii.h" -%include "blocks/pack_k_bits_bb.h" -%include "blocks/packed_to_unpacked_bb.h" -%include "blocks/packed_to_unpacked_ss.h" -%include "blocks/packed_to_unpacked_ii.h" -%include "blocks/patterned_interleaver.h" -%include "blocks/tag_debug.h" -%include "blocks/pdu_to_tagged_stream.h" -%include "blocks/peak_detector_fb.h" -%include "blocks/peak_detector_ib.h" -%include "blocks/peak_detector_sb.h" -%include "blocks/peak_detector2_fb.h" -%include "blocks/random_pdu.h" -%include "blocks/plateau_detector_fb.h" -%include "blocks/probe_rate.h" -%include "blocks/regenerate_bb.h" -%include "blocks/repack_bits_bb.h" -%include "blocks/repeat.h" -%include "blocks/rms_cf.h" -%include "blocks/rms_ff.h" -%include "blocks/sample_and_hold_bb.h" -%include "blocks/sample_and_hold_ss.h" -%include "blocks/sample_and_hold_ii.h" -%include "blocks/sample_and_hold_ff.h" -%include "blocks/short_to_char.h" -%include "blocks/short_to_float.h" -%include "blocks/skiphead.h" -%include "blocks/socket_pdu.h" -%include "blocks/stream_mux.h" -%include "blocks/stream_to_streams.h" -%include "blocks/stream_to_vector.h" -%include "blocks/streams_to_stream.h" -%include "blocks/streams_to_vector.h" -%include "blocks/stretch_ff.h" -%include "blocks/sub_ff.h" -%include "blocks/sub_ss.h" -%include "blocks/sub_ii.h" -%include "blocks/sub_cc.h" -%include "blocks/tagged_file_sink.h" -%include "blocks/tagged_stream_mux.h" -%include "blocks/tagged_stream_to_pdu.h" -%include "blocks/threshold_ff.h" -%include "blocks/throttle.h" -%include "blocks/transcendental.h" -%include "blocks/tuntap_pdu.h" -%include "blocks/uchar_to_float.h" -%include "blocks/udp_sink.h" -%include "blocks/udp_source.h" -%include "blocks/unpack_k_bits_bb.h" -%include "blocks/unpacked_to_packed_bb.h" -%include "blocks/unpacked_to_packed_ss.h" -%include "blocks/unpacked_to_packed_ii.h" -%include "blocks/vco_f.h" -%include "blocks/vector_map.h" -%include "blocks/vector_to_stream.h" -%include "blocks/vector_to_streams.h" -%include "blocks/vector_insert_b.h" -%include "blocks/vector_insert_s.h" -%include "blocks/vector_insert_i.h" -%include "blocks/vector_insert_f.h" -%include "blocks/vector_insert_c.h" -%include "blocks/vector_sink_b.h" -%include "blocks/vector_sink_s.h" -%include "blocks/vector_sink_i.h" -%include "blocks/vector_sink_f.h" -%include "blocks/vector_sink_c.h" -%include "blocks/vector_source_b.h" -%include "blocks/vector_source_s.h" -%include "blocks/vector_source_i.h" -%include "blocks/vector_source_f.h" -%include "blocks/vector_source_c.h" -%include "blocks/wavfile_sink.h" -%include "blocks/wavfile_source.h" -%include "blocks/xor_bb.h" -%include "blocks/xor_ss.h" -%include "blocks/xor_ii.h" - -GR_SWIG_BLOCK_MAGIC2(blocks, add_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, add_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, add_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, add_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vff); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vbb); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vss); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vii); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vcc); -GR_SWIG_BLOCK_MAGIC2(blocks, and_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, and_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, and_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, and_const_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, and_const_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, and_const_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, annotator_1to1); -GR_SWIG_BLOCK_MAGIC2(blocks, annotator_alltoall); -GR_SWIG_BLOCK_MAGIC2(blocks, annotator_raw); -GR_SWIG_BLOCK_MAGIC2(blocks, argmax_fs); -GR_SWIG_BLOCK_MAGIC2(blocks, argmax_is); -GR_SWIG_BLOCK_MAGIC2(blocks, argmax_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, bin_statistics_f); -GR_SWIG_BLOCK_MAGIC2(blocks, burst_tagger); -GR_SWIG_BLOCK_MAGIC2(blocks, char_to_float); -GR_SWIG_BLOCK_MAGIC2(blocks, char_to_short); -GR_SWIG_BLOCK_MAGIC2(blocks, check_lfsr_32k_s); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_interleaved_short); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_float); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_real); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_imag); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_mag); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_mag_squared); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_arg); -GR_SWIG_BLOCK_MAGIC2(blocks, conjugate_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, copy); -GR_SWIG_BLOCK_MAGIC2(blocks, deinterleave); -GR_SWIG_BLOCK_MAGIC2(blocks, delay); -GR_SWIG_BLOCK_MAGIC2(blocks, endian_swap); -GR_SWIG_BLOCK_MAGIC2(blocks, divide_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, divide_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, divide_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, divide_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, file_descriptor_sink); -GR_SWIG_BLOCK_MAGIC2(blocks, file_descriptor_source); -GR_SWIG_BLOCK_MAGIC2(blocks, file_sink); -GR_SWIG_BLOCK_MAGIC2(blocks, file_source); -GR_SWIG_BLOCK_MAGIC2(blocks, file_meta_sink); -GR_SWIG_BLOCK_MAGIC2(blocks, file_meta_source); -GR_SWIG_BLOCK_MAGIC2(blocks, float_to_char); -GR_SWIG_BLOCK_MAGIC2(blocks, float_to_complex); -GR_SWIG_BLOCK_MAGIC2(blocks, float_to_int); -GR_SWIG_BLOCK_MAGIC2(blocks, float_to_short); -GR_SWIG_BLOCK_MAGIC2(blocks, float_to_uchar); -GR_SWIG_BLOCK_MAGIC2(blocks, head); -GR_SWIG_BLOCK_MAGIC2(blocks, int_to_float); -GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, integrate_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, interleave); -GR_SWIG_BLOCK_MAGIC2(blocks, interleaved_short_to_complex); -GR_SWIG_BLOCK_MAGIC2(blocks, keep_m_in_n); -GR_SWIG_BLOCK_MAGIC2(blocks, keep_one_in_n); -GR_SWIG_BLOCK_MAGIC2(blocks, lfsr_32k_source_s); -GR_SWIG_BLOCK_MAGIC2(blocks, max_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, max_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, max_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, message_debug); -GR_SWIG_BLOCK_MAGIC2(blocks, message_sink); -GR_SWIG_BLOCK_MAGIC2(blocks, message_source); -GR_SWIG_BLOCK_MAGIC2(blocks, message_strobe); -GR_SWIG_BLOCK_MAGIC2(blocks, message_burst_source); -GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_conjugate_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vss); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vii); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vff); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vcc); -GR_SWIG_BLOCK_MAGIC2(blocks, mute_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, mute_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, mute_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, mute_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, nlog10_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, nop); -GR_SWIG_BLOCK_MAGIC2(blocks, not_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, not_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, not_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, null_sink); -GR_SWIG_BLOCK_MAGIC2(blocks, null_source); -GR_SWIG_BLOCK_MAGIC2(blocks, patterned_interleaver); -GR_SWIG_BLOCK_MAGIC2(blocks, pack_k_bits_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_fb); -GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_ib); -GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_sb); -GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector2_fb); -GR_SWIG_BLOCK_MAGIC2(blocks, plateau_detector_fb); -GR_SWIG_BLOCK_MAGIC2(blocks, pdu_to_tagged_stream); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_rate); -GR_SWIG_BLOCK_MAGIC2(blocks, or_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, or_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, or_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, random_pdu); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_b); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_s); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_i); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_f); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_c); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vb); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vs); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vi); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vf); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vc); -GR_SWIG_BLOCK_MAGIC2(blocks, regenerate_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, repack_bits_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, repeat); -GR_SWIG_BLOCK_MAGIC2(blocks, rms_cf); -GR_SWIG_BLOCK_MAGIC2(blocks, rms_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, short_to_char); -GR_SWIG_BLOCK_MAGIC2(blocks, short_to_float); -GR_SWIG_BLOCK_MAGIC2(blocks, skiphead); -GR_SWIG_BLOCK_MAGIC2(blocks, socket_pdu); -GR_SWIG_BLOCK_MAGIC2(blocks, stream_mux); -GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_streams); -GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_vector); -GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_stream); -GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_vector); -GR_SWIG_BLOCK_MAGIC2(blocks, stretch_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, sub_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, sub_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, sub_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, sub_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, tag_debug); -GR_SWIG_BLOCK_MAGIC2(blocks, tagged_file_sink); -GR_SWIG_BLOCK_MAGIC2(blocks, tagged_stream_mux); -GR_SWIG_BLOCK_MAGIC2(blocks, tagged_stream_to_pdu); -GR_SWIG_BLOCK_MAGIC2(blocks, threshold_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, throttle); -GR_SWIG_BLOCK_MAGIC2(blocks, transcendental); -GR_SWIG_BLOCK_MAGIC2(blocks, tuntap_pdu); -GR_SWIG_BLOCK_MAGIC2(blocks, uchar_to_float); -GR_SWIG_BLOCK_MAGIC2(blocks, udp_sink); -GR_SWIG_BLOCK_MAGIC2(blocks, udp_source); -GR_SWIG_BLOCK_MAGIC2(blocks, unpack_k_bits_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, vco_f); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_map); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_stream); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_streams); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_b); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_s); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_i); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_f); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_c); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_b); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_s); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_i); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_f); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_c); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_b); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_s); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_i); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_f); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_c); -GR_SWIG_BLOCK_MAGIC2(blocks, wavfile_sink); -GR_SWIG_BLOCK_MAGIC2(blocks, wavfile_source); -GR_SWIG_BLOCK_MAGIC2(blocks, xor_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, xor_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, xor_ii); - - -#ifdef GR_CTRLPORT - -%{ -#include "blocks/ctrlport_probe_c.h" -#include "blocks/ctrlport_probe2_c.h" -%} - -%include "blocks/ctrlport_probe_c.h" -%include "blocks/ctrlport_probe2_c.h" - -GR_SWIG_BLOCK_MAGIC2(blocks, ctrlport_probe_c); -GR_SWIG_BLOCK_MAGIC2(blocks, ctrlport_probe2_c); - -#endif /* GR_CTRLPORT */ diff --git a/gr-blocks/swig/blocks_swig.py.in b/gr-blocks/swig/blocks_swig.py.in index 287413b594..a0bd574c18 100644 --- a/gr-blocks/swig/blocks_swig.py.in +++ b/gr-blocks/swig/blocks_swig.py.in @@ -22,3 +22,6 @@ from blocks_swig0 import * from blocks_swig1 import * from blocks_swig2 import * +from blocks_swig3 import * +from blocks_swig4 import * +from blocks_swig5 import * diff --git a/gr-blocks/swig/blocks_swig0.i b/gr-blocks/swig/blocks_swig0.i index 353fef0412..f87cb9c5e4 100644 --- a/gr-blocks/swig/blocks_swig0.i +++ b/gr-blocks/swig/blocks_swig0.i @@ -26,116 +26,55 @@ %include "blocks_swig0_doc.i" -%template() std::vector<size_t>; -%template() std::vector< std::vector< std::vector<size_t> > >; - %{ -#include "blocks/annotator_1to1.h" -#include "blocks/annotator_alltoall.h" -#include "blocks/annotator_raw.h" -#include "blocks/control_loop.h" -#include "blocks/copy.h" -#include "blocks/delay.h" -#include "blocks/endian_swap.h" -#include "blocks/file_descriptor_sink.h" -#include "blocks/file_descriptor_source.h" -#include "blocks/file_sink_base.h" -#include "blocks/file_sink.h" -#include "blocks/file_source.h" -#include "blocks/file_meta_sink.h" -#include "blocks/file_meta_source.h" -#include "blocks/head.h" -#include "blocks/message_debug.h" -#include "blocks/message_sink.h" -#include "blocks/message_source.h" -#include "blocks/message_strobe.h" -#include "blocks/message_burst_source.h" -#include "blocks/nop.h" -#include "blocks/null_sink.h" -#include "blocks/null_source.h" -#include "blocks/skiphead.h" -#include "blocks/stream_mux.h" -#include "blocks/stream_to_streams.h" -#include "blocks/stream_to_vector.h" -#include "blocks/streams_to_stream.h" -#include "blocks/streams_to_vector.h" -#include "blocks/tag_debug.h" -#include "blocks/tagged_file_sink.h" -#include "blocks/throttle.h" -#include "blocks/vector_map.h" -#include "blocks/vector_to_stream.h" -#include "blocks/vector_to_streams.h" -#include "blocks/vector_insert_b.h" -#include "blocks/vector_insert_s.h" -#include "blocks/vector_insert_i.h" -#include "blocks/vector_insert_f.h" -#include "blocks/vector_insert_c.h" -#include "blocks/vector_sink_b.h" -#include "blocks/vector_sink_s.h" -#include "blocks/vector_sink_i.h" -#include "blocks/vector_sink_f.h" -#include "blocks/vector_sink_c.h" -#include "blocks/vector_source_b.h" -#include "blocks/vector_source_s.h" -#include "blocks/vector_source_i.h" -#include "blocks/vector_source_f.h" -#include "blocks/vector_source_c.h" -#include "blocks/wavfile_sink.h" -#include "blocks/wavfile_source.h" +#include "gnuradio/blocks/annotator_1to1.h" +#include "gnuradio/blocks/annotator_alltoall.h" +#include "gnuradio/blocks/annotator_raw.h" +#include "gnuradio/blocks/control_loop.h" +#include "gnuradio/blocks/copy.h" +#include "gnuradio/blocks/delay.h" +#include "gnuradio/blocks/endian_swap.h" +#include "gnuradio/blocks/file_descriptor_sink.h" +#include "gnuradio/blocks/file_descriptor_source.h" +#include "gnuradio/blocks/file_sink_base.h" +#include "gnuradio/blocks/file_sink.h" +#include "gnuradio/blocks/file_source.h" +#include "gnuradio/blocks/file_meta_sink.h" +#include "gnuradio/blocks/file_meta_source.h" +#include "gnuradio/blocks/head.h" +#include "gnuradio/blocks/message_debug.h" +#include "gnuradio/blocks/message_sink.h" +#include "gnuradio/blocks/message_source.h" +#include "gnuradio/blocks/message_strobe.h" +#include "gnuradio/blocks/message_burst_source.h" +#include "gnuradio/blocks/nop.h" +#include "gnuradio/blocks/null_sink.h" +#include "gnuradio/blocks/null_source.h" %} -%include "blocks/annotator_1to1.h" -%include "blocks/annotator_alltoall.h" -%include "blocks/annotator_raw.h" -%include "blocks/control_loop.h" -%include "blocks/copy.h" -%include "blocks/delay.h" -%include "blocks/endian_swap.h" -%include "blocks/file_descriptor_sink.h" -%include "blocks/file_descriptor_source.h" -%include "blocks/file_sink_base.h" -%include "blocks/file_sink.h" -%include "blocks/file_source.h" -%include "blocks/file_meta_sink.h" -%include "blocks/file_meta_source.h" -%include "blocks/head.h" -%include "blocks/message_debug.h" -%include "blocks/message_sink.h" -%include "blocks/message_source.h" -%include "blocks/message_strobe.h" -%include "blocks/message_burst_source.h" -%include "blocks/nop.h" -%include "blocks/null_sink.h" -%include "blocks/null_source.h" -%include "blocks/skiphead.h" -%include "blocks/stream_mux.h" -%include "blocks/stream_to_streams.h" -%include "blocks/stream_to_vector.h" -%include "blocks/streams_to_stream.h" -%include "blocks/streams_to_vector.h" -%include "blocks/tag_debug.h" -%include "blocks/tagged_file_sink.h" -%include "blocks/throttle.h" -%include "blocks/vector_map.h" -%include "blocks/vector_to_stream.h" -%include "blocks/vector_to_streams.h" -%include "blocks/vector_insert_b.h" -%include "blocks/vector_insert_s.h" -%include "blocks/vector_insert_i.h" -%include "blocks/vector_insert_f.h" -%include "blocks/vector_insert_c.h" -%include "blocks/vector_sink_b.h" -%include "blocks/vector_sink_s.h" -%include "blocks/vector_sink_i.h" -%include "blocks/vector_sink_f.h" -%include "blocks/vector_sink_c.h" -%include "blocks/vector_source_b.h" -%include "blocks/vector_source_s.h" -%include "blocks/vector_source_i.h" -%include "blocks/vector_source_f.h" -%include "blocks/vector_source_c.h" -%include "blocks/wavfile_sink.h" -%include "blocks/wavfile_source.h" +%include "gnuradio/blocks/annotator_1to1.h" +%include "gnuradio/blocks/annotator_alltoall.h" +%include "gnuradio/blocks/annotator_raw.h" +%include "gnuradio/blocks/control_loop.h" +%include "gnuradio/blocks/copy.h" +%include "gnuradio/blocks/delay.h" +%include "gnuradio/blocks/endian_swap.h" +%include "gnuradio/blocks/file_descriptor_sink.h" +%include "gnuradio/blocks/file_descriptor_source.h" +%include "gnuradio/blocks/file_sink_base.h" +%include "gnuradio/blocks/file_sink.h" +%include "gnuradio/blocks/file_source.h" +%include "gnuradio/blocks/file_meta_sink.h" +%include "gnuradio/blocks/file_meta_source.h" +%include "gnuradio/blocks/head.h" +%include "gnuradio/blocks/message_debug.h" +%include "gnuradio/blocks/message_sink.h" +%include "gnuradio/blocks/message_source.h" +%include "gnuradio/blocks/message_strobe.h" +%include "gnuradio/blocks/message_burst_source.h" +%include "gnuradio/blocks/nop.h" +%include "gnuradio/blocks/null_sink.h" +%include "gnuradio/blocks/null_source.h" GR_SWIG_BLOCK_MAGIC2(blocks, annotator_1to1); GR_SWIG_BLOCK_MAGIC2(blocks, annotator_alltoall); @@ -158,45 +97,16 @@ GR_SWIG_BLOCK_MAGIC2(blocks, message_burst_source); GR_SWIG_BLOCK_MAGIC2(blocks, nop); GR_SWIG_BLOCK_MAGIC2(blocks, null_sink); GR_SWIG_BLOCK_MAGIC2(blocks, null_source); -GR_SWIG_BLOCK_MAGIC2(blocks, skiphead); -GR_SWIG_BLOCK_MAGIC2(blocks, stream_mux); -GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_streams); -GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_vector); -GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_stream); -GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_vector); -GR_SWIG_BLOCK_MAGIC2(blocks, tag_debug); -GR_SWIG_BLOCK_MAGIC2(blocks, tagged_file_sink); -GR_SWIG_BLOCK_MAGIC2(blocks, throttle); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_map); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_stream); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_streams); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_b); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_s); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_i); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_f); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_c); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_b); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_s); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_i); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_f); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_c); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_b); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_s); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_i); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_f); -GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_c); -GR_SWIG_BLOCK_MAGIC2(blocks, wavfile_sink); -GR_SWIG_BLOCK_MAGIC2(blocks, wavfile_source); #ifdef GR_CTRLPORT %{ -#include "blocks/ctrlport_probe_c.h" -#include "blocks/ctrlport_probe2_c.h" +#include "gnuradio/blocks/ctrlport_probe_c.h" +#include "gnuradio/blocks/ctrlport_probe2_c.h" %} -%include "blocks/ctrlport_probe_c.h" -%include "blocks/ctrlport_probe2_c.h" +%include "gnuradio/blocks/ctrlport_probe_c.h" +%include "gnuradio/blocks/ctrlport_probe2_c.h" GR_SWIG_BLOCK_MAGIC2(blocks, ctrlport_probe_c); GR_SWIG_BLOCK_MAGIC2(blocks, ctrlport_probe2_c); diff --git a/gr-blocks/swig/blocks_swig1.i b/gr-blocks/swig/blocks_swig1.i index 557afca97b..328b2b1a08 100644 --- a/gr-blocks/swig/blocks_swig1.i +++ b/gr-blocks/swig/blocks_swig1.i @@ -24,250 +24,96 @@ %include "runtime_swig.i" -//load generated python docstrings %include "blocks_swig1_doc.i" %{ -#include "blocks/add_ff.h" -#include "blocks/add_ss.h" -#include "blocks/add_ii.h" -#include "blocks/add_cc.h" -#include "blocks/add_const_bb.h" -#include "blocks/add_const_ff.h" -#include "blocks/add_const_ss.h" -#include "blocks/add_const_ii.h" -#include "blocks/add_const_cc.h" -#include "blocks/add_const_vbb.h" -#include "blocks/add_const_vff.h" -#include "blocks/add_const_vss.h" -#include "blocks/add_const_vii.h" -#include "blocks/add_const_vcc.h" -#include "blocks/and_bb.h" -#include "blocks/and_ss.h" -#include "blocks/and_ii.h" -#include "blocks/and_const_bb.h" -#include "blocks/and_const_ss.h" -#include "blocks/and_const_ii.h" -#include "blocks/argmax_fs.h" -#include "blocks/argmax_is.h" -#include "blocks/argmax_ss.h" -#include "blocks/bin_statistics_f.h" -#include "blocks/burst_tagger.h" -#include "blocks/char_to_float.h" -#include "blocks/char_to_short.h" -#include "blocks/check_lfsr_32k_s.h" -#include "blocks/complex_to_interleaved_short.h" -#include "blocks/complex_to_float.h" -#include "blocks/complex_to_real.h" -#include "blocks/complex_to_imag.h" -#include "blocks/complex_to_mag.h" -#include "blocks/complex_to_mag_squared.h" -#include "blocks/complex_to_arg.h" -#include "blocks/conjugate_cc.h" -#include "blocks/deinterleave.h" -#include "blocks/divide_ff.h" -#include "blocks/divide_ss.h" -#include "blocks/divide_ii.h" -#include "blocks/divide_cc.h" -#include "blocks/float_to_char.h" -#include "blocks/float_to_complex.h" -#include "blocks/float_to_int.h" -#include "blocks/float_to_short.h" -#include "blocks/float_to_uchar.h" -#include "blocks/int_to_float.h" -#include "blocks/integrate_ss.h" -#include "blocks/integrate_ii.h" -#include "blocks/integrate_ff.h" -#include "blocks/integrate_cc.h" -#include "blocks/interleave.h" -#include "blocks/interleaved_short_to_complex.h" -#include "blocks/keep_m_in_n.h" -#include "blocks/keep_one_in_n.h" -#include "blocks/lfsr_32k_source_s.h" -#include "blocks/max_ff.h" -#include "blocks/max_ii.h" -#include "blocks/max_ss.h" -#include "blocks/moving_average_cc.h" -#include "blocks/moving_average_ff.h" -#include "blocks/moving_average_ii.h" -#include "blocks/moving_average_ss.h" -#include "blocks/multiply_ss.h" -#include "blocks/multiply_ii.h" -#include "blocks/multiply_ff.h" -#include "blocks/multiply_cc.h" -#include "blocks/multiply_conjugate_cc.h" -#include "blocks/multiply_const_ss.h" -#include "blocks/multiply_const_ii.h" -#include "blocks/multiply_const_ff.h" -#include "blocks/multiply_const_cc.h" -#include "blocks/multiply_const_vss.h" -#include "blocks/multiply_const_vii.h" -#include "blocks/multiply_const_vff.h" -#include "blocks/multiply_const_vcc.h" -#include "blocks/mute_ss.h" -#include "blocks/mute_ii.h" -#include "blocks/mute_ff.h" -#include "blocks/mute_cc.h" +#include "gnuradio/blocks/skiphead.h" +#include "gnuradio/blocks/stream_mux.h" +#include "gnuradio/blocks/stream_to_streams.h" +#include "gnuradio/blocks/stream_to_vector.h" +#include "gnuradio/blocks/streams_to_stream.h" +#include "gnuradio/blocks/streams_to_vector.h" +#include "gnuradio/blocks/tag_debug.h" +#include "gnuradio/blocks/tagged_file_sink.h" +#include "gnuradio/blocks/throttle.h" +#include "gnuradio/blocks/vector_map.h" +#include "gnuradio/blocks/vector_to_stream.h" +#include "gnuradio/blocks/vector_to_streams.h" +#include "gnuradio/blocks/vector_insert_b.h" +#include "gnuradio/blocks/vector_insert_s.h" +#include "gnuradio/blocks/vector_insert_i.h" +#include "gnuradio/blocks/vector_insert_f.h" +#include "gnuradio/blocks/vector_insert_c.h" +#include "gnuradio/blocks/vector_sink_b.h" +#include "gnuradio/blocks/vector_sink_s.h" +#include "gnuradio/blocks/vector_sink_i.h" +#include "gnuradio/blocks/vector_sink_f.h" +#include "gnuradio/blocks/vector_sink_c.h" +#include "gnuradio/blocks/vector_source_b.h" +#include "gnuradio/blocks/vector_source_s.h" +#include "gnuradio/blocks/vector_source_i.h" +#include "gnuradio/blocks/vector_source_f.h" +#include "gnuradio/blocks/vector_source_c.h" +#include "gnuradio/blocks/wavfile_sink.h" +#include "gnuradio/blocks/wavfile_source.h" %} -%include "blocks/add_ff.h" -%include "blocks/add_ss.h" -%include "blocks/add_ii.h" -%include "blocks/add_cc.h" -%include "blocks/add_const_bb.h" -%include "blocks/add_const_ff.h" -%include "blocks/add_const_ss.h" -%include "blocks/add_const_ii.h" -%include "blocks/add_const_cc.h" -%include "blocks/add_const_vbb.h" -%include "blocks/add_const_vff.h" -%include "blocks/add_const_vss.h" -%include "blocks/add_const_vii.h" -%include "blocks/add_const_vcc.h" -%include "blocks/and_bb.h" -%include "blocks/and_ss.h" -%include "blocks/and_ii.h" -%include "blocks/and_const_bb.h" -%include "blocks/and_const_ss.h" -%include "blocks/and_const_ii.h" -%include "blocks/argmax_fs.h" -%include "blocks/argmax_is.h" -%include "blocks/argmax_ss.h" -%include "blocks/char_to_float.h" -%include "blocks/bin_statistics_f.h" -%include "blocks/burst_tagger.h" -%include "blocks/char_to_short.h" -%include "blocks/check_lfsr_32k_s.h" -%include "blocks/complex_to_interleaved_short.h" -%include "blocks/complex_to_float.h" -%include "blocks/complex_to_real.h" -%include "blocks/complex_to_imag.h" -%include "blocks/complex_to_mag.h" -%include "blocks/complex_to_mag_squared.h" -%include "blocks/complex_to_arg.h" -%include "blocks/conjugate_cc.h" -%include "blocks/deinterleave.h" -%include "blocks/divide_ff.h" -%include "blocks/divide_ss.h" -%include "blocks/divide_ii.h" -%include "blocks/divide_cc.h" -%include "blocks/float_to_char.h" -%include "blocks/float_to_complex.h" -%include "blocks/float_to_int.h" -%include "blocks/float_to_short.h" -%include "blocks/float_to_uchar.h" -%include "blocks/int_to_float.h" -%include "blocks/integrate_ss.h" -%include "blocks/integrate_ii.h" -%include "blocks/integrate_ff.h" -%include "blocks/integrate_cc.h" -%include "blocks/interleave.h" -%include "blocks/interleaved_short_to_complex.h" -%include "blocks/keep_m_in_n.h" -%include "blocks/keep_one_in_n.h" -%include "blocks/lfsr_32k_source_s.h" -%include "blocks/max_ff.h" -%include "blocks/max_ii.h" -%include "blocks/max_ss.h" -%include "blocks/moving_average_cc.h" -%include "blocks/moving_average_ff.h" -%include "blocks/moving_average_ii.h" -%include "blocks/moving_average_ss.h" -%include "blocks/multiply_ss.h" -%include "blocks/multiply_ii.h" -%include "blocks/multiply_ff.h" -%include "blocks/multiply_cc.h" -%include "blocks/multiply_conjugate_cc.h" -%include "blocks/multiply_const_ss.h" -%include "blocks/multiply_const_ii.h" -%include "blocks/multiply_const_ff.h" -%include "blocks/multiply_const_cc.h" -%include "blocks/multiply_const_vss.h" -%include "blocks/multiply_const_vii.h" -%include "blocks/multiply_const_vff.h" -%include "blocks/multiply_const_vcc.h" -%include "blocks/mute_ss.h" -%include "blocks/mute_ii.h" -%include "blocks/mute_ff.h" -%include "blocks/mute_cc.h" +%include "gnuradio/blocks/skiphead.h" +%include "gnuradio/blocks/stream_mux.h" +%include "gnuradio/blocks/stream_to_streams.h" +%include "gnuradio/blocks/stream_to_vector.h" +%include "gnuradio/blocks/streams_to_stream.h" +%include "gnuradio/blocks/streams_to_vector.h" +%include "gnuradio/blocks/tag_debug.h" +%include "gnuradio/blocks/tagged_file_sink.h" +%include "gnuradio/blocks/throttle.h" +%include "gnuradio/blocks/vector_map.h" +%include "gnuradio/blocks/vector_to_stream.h" +%include "gnuradio/blocks/vector_to_streams.h" +%include "gnuradio/blocks/vector_insert_b.h" +%include "gnuradio/blocks/vector_insert_s.h" +%include "gnuradio/blocks/vector_insert_i.h" +%include "gnuradio/blocks/vector_insert_f.h" +%include "gnuradio/blocks/vector_insert_c.h" +%include "gnuradio/blocks/vector_sink_b.h" +%include "gnuradio/blocks/vector_sink_s.h" +%include "gnuradio/blocks/vector_sink_i.h" +%include "gnuradio/blocks/vector_sink_f.h" +%include "gnuradio/blocks/vector_sink_c.h" +%include "gnuradio/blocks/vector_source_b.h" +%include "gnuradio/blocks/vector_source_s.h" +%include "gnuradio/blocks/vector_source_i.h" +%include "gnuradio/blocks/vector_source_f.h" +%include "gnuradio/blocks/vector_source_c.h" +%include "gnuradio/blocks/wavfile_sink.h" +%include "gnuradio/blocks/wavfile_source.h" -GR_SWIG_BLOCK_MAGIC2(blocks, add_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, add_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, add_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, add_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vbb); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vff); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vss); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vii); -GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vcc); -GR_SWIG_BLOCK_MAGIC2(blocks, and_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, and_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, and_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, and_const_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, and_const_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, and_const_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, argmax_fs); -GR_SWIG_BLOCK_MAGIC2(blocks, argmax_is); -GR_SWIG_BLOCK_MAGIC2(blocks, argmax_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, bin_statistics_f); -GR_SWIG_BLOCK_MAGIC2(blocks, burst_tagger); -GR_SWIG_BLOCK_MAGIC2(blocks, char_to_float); -GR_SWIG_BLOCK_MAGIC2(blocks, char_to_short); -GR_SWIG_BLOCK_MAGIC2(blocks, check_lfsr_32k_s); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_interleaved_short); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_float); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_real); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_imag); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_mag); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_mag_squared); -GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_arg); -GR_SWIG_BLOCK_MAGIC2(blocks, conjugate_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, deinterleave); -GR_SWIG_BLOCK_MAGIC2(blocks, divide_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, divide_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, divide_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, divide_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, float_to_char); -GR_SWIG_BLOCK_MAGIC2(blocks, float_to_complex); -GR_SWIG_BLOCK_MAGIC2(blocks, float_to_int); -GR_SWIG_BLOCK_MAGIC2(blocks, float_to_short); -GR_SWIG_BLOCK_MAGIC2(blocks, float_to_uchar); -GR_SWIG_BLOCK_MAGIC2(blocks, int_to_float); -GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, integrate_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, interleave); -GR_SWIG_BLOCK_MAGIC2(blocks, interleaved_short_to_complex); -GR_SWIG_BLOCK_MAGIC2(blocks, keep_m_in_n); -GR_SWIG_BLOCK_MAGIC2(blocks, keep_one_in_n); -GR_SWIG_BLOCK_MAGIC2(blocks, lfsr_32k_source_s); -GR_SWIG_BLOCK_MAGIC2(blocks, max_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, max_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, max_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_conjugate_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vss); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vii); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vff); -GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vcc); -GR_SWIG_BLOCK_MAGIC2(blocks, mute_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, mute_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, mute_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, mute_cc); +GR_SWIG_BLOCK_MAGIC2(blocks, skiphead); +GR_SWIG_BLOCK_MAGIC2(blocks, stream_mux); +GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_streams); +GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_vector); +GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_stream); +GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_vector); +GR_SWIG_BLOCK_MAGIC2(blocks, tag_debug); +GR_SWIG_BLOCK_MAGIC2(blocks, tagged_file_sink); +GR_SWIG_BLOCK_MAGIC2(blocks, throttle); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_map); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_stream); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_streams); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_b); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_s); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_i); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_f); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_c); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_b); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_s); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_i); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_f); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_c); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_b); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_s); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_i); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_f); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_c); +GR_SWIG_BLOCK_MAGIC2(blocks, wavfile_sink); +GR_SWIG_BLOCK_MAGIC2(blocks, wavfile_source); diff --git a/gr-blocks/swig/blocks_swig2.i b/gr-blocks/swig/blocks_swig2.i index bfc1075cd7..d41b3f02a1 100644 --- a/gr-blocks/swig/blocks_swig2.i +++ b/gr-blocks/swig/blocks_swig2.i @@ -23,203 +23,134 @@ #define BLOCKS_API %include "runtime_swig.i" -%include "blocks/pdu.h" - -%include <gr_endianness.h> //load generated python docstrings -%include "blocks_swig1_doc.i" +%include "blocks_swig2_doc.i" %{ -#include "blocks/nlog10_ff.h" -#include "blocks/not_bb.h" -#include "blocks/not_ss.h" -#include "blocks/not_ii.h" -#include "blocks/patterned_interleaver.h" -#include "blocks/pack_k_bits_bb.h" -#include "blocks/packed_to_unpacked_bb.h" -#include "blocks/packed_to_unpacked_ss.h" -#include "blocks/packed_to_unpacked_ii.h" -#include "blocks/pdu_to_tagged_stream.h" -#include "blocks/peak_detector_fb.h" -#include "blocks/peak_detector_ib.h" -#include "blocks/peak_detector_sb.h" -#include "blocks/peak_detector2_fb.h" -#include "blocks/plateau_detector_fb.h" -#include "blocks/probe_rate.h" -#include "blocks/probe_signal_b.h" -#include "blocks/probe_signal_s.h" -#include "blocks/probe_signal_i.h" -#include "blocks/probe_signal_f.h" -#include "blocks/probe_signal_c.h" -#include "blocks/probe_signal_vb.h" -#include "blocks/probe_signal_vs.h" -#include "blocks/probe_signal_vi.h" -#include "blocks/probe_signal_vf.h" -#include "blocks/probe_signal_vc.h" -#include "blocks/or_bb.h" -#include "blocks/or_ss.h" -#include "blocks/or_ii.h" -#include "blocks/random_pdu.h" -#include "blocks/regenerate_bb.h" -#include "blocks/repack_bits_bb.h" -#include "blocks/repeat.h" -#include "blocks/rms_cf.h" -#include "blocks/rms_ff.h" -#include "blocks/sample_and_hold_bb.h" -#include "blocks/sample_and_hold_ss.h" -#include "blocks/sample_and_hold_ii.h" -#include "blocks/sample_and_hold_ff.h" -#include "blocks/short_to_char.h" -#include "blocks/short_to_float.h" -#include "blocks/socket_pdu.h" -#include "blocks/stretch_ff.h" -#include "blocks/sub_ff.h" -#include "blocks/sub_ss.h" -#include "blocks/sub_ii.h" -#include "blocks/sub_cc.h" -#include "blocks/tagged_stream_mux.h" -#include "blocks/tagged_stream_to_pdu.h" -#include "blocks/threshold_ff.h" -#include "blocks/transcendental.h" -#include "blocks/tuntap_pdu.h" -#include "blocks/uchar_to_float.h" -#include "blocks/udp_sink.h" -#include "blocks/udp_source.h" -#include "blocks/unpack_k_bits_bb.h" -#include "blocks/unpacked_to_packed_bb.h" -#include "blocks/unpacked_to_packed_ss.h" -#include "blocks/unpacked_to_packed_ii.h" -#include "blocks/vco_f.h" -#include "blocks/xor_bb.h" -#include "blocks/xor_ss.h" -#include "blocks/xor_ii.h" +#include "gnuradio/blocks/add_ff.h" +#include "gnuradio/blocks/add_ss.h" +#include "gnuradio/blocks/add_ii.h" +#include "gnuradio/blocks/add_cc.h" +#include "gnuradio/blocks/add_const_bb.h" +#include "gnuradio/blocks/add_const_ff.h" +#include "gnuradio/blocks/add_const_ss.h" +#include "gnuradio/blocks/add_const_ii.h" +#include "gnuradio/blocks/add_const_cc.h" +#include "gnuradio/blocks/add_const_vbb.h" +#include "gnuradio/blocks/add_const_vff.h" +#include "gnuradio/blocks/add_const_vss.h" +#include "gnuradio/blocks/add_const_vii.h" +#include "gnuradio/blocks/add_const_vcc.h" +#include "gnuradio/blocks/and_bb.h" +#include "gnuradio/blocks/and_ss.h" +#include "gnuradio/blocks/and_ii.h" +#include "gnuradio/blocks/and_const_bb.h" +#include "gnuradio/blocks/and_const_ss.h" +#include "gnuradio/blocks/and_const_ii.h" +#include "gnuradio/blocks/argmax_fs.h" +#include "gnuradio/blocks/argmax_is.h" +#include "gnuradio/blocks/argmax_ss.h" +#include "gnuradio/blocks/bin_statistics_f.h" +#include "gnuradio/blocks/burst_tagger.h" +#include "gnuradio/blocks/char_to_float.h" +#include "gnuradio/blocks/char_to_short.h" +#include "gnuradio/blocks/check_lfsr_32k_s.h" +#include "gnuradio/blocks/complex_to_interleaved_short.h" +#include "gnuradio/blocks/complex_to_float.h" +#include "gnuradio/blocks/complex_to_real.h" +#include "gnuradio/blocks/complex_to_imag.h" +#include "gnuradio/blocks/complex_to_mag.h" +#include "gnuradio/blocks/complex_to_mag_squared.h" +#include "gnuradio/blocks/complex_to_arg.h" +#include "gnuradio/blocks/conjugate_cc.h" +#include "gnuradio/blocks/deinterleave.h" +#include "gnuradio/blocks/divide_ff.h" +#include "gnuradio/blocks/divide_ss.h" +#include "gnuradio/blocks/divide_ii.h" +#include "gnuradio/blocks/divide_cc.h" %} -%include "blocks/nlog10_ff.h" -%include "blocks/not_bb.h" -%include "blocks/not_ss.h" -%include "blocks/not_ii.h" -%include "blocks/probe_signal_b.h" -%include "blocks/probe_signal_s.h" -%include "blocks/probe_signal_i.h" -%include "blocks/probe_signal_f.h" -%include "blocks/probe_signal_c.h" -%include "blocks/probe_signal_vb.h" -%include "blocks/probe_signal_vs.h" -%include "blocks/probe_signal_vi.h" -%include "blocks/probe_signal_vf.h" -%include "blocks/probe_signal_vc.h" -%include "blocks/or_bb.h" -%include "blocks/or_ss.h" -%include "blocks/or_ii.h" -%include "blocks/pack_k_bits_bb.h" -%include "blocks/packed_to_unpacked_bb.h" -%include "blocks/packed_to_unpacked_ss.h" -%include "blocks/packed_to_unpacked_ii.h" -%include "blocks/patterned_interleaver.h" -%include "blocks/pdu_to_tagged_stream.h" -%include "blocks/peak_detector_fb.h" -%include "blocks/peak_detector_ib.h" -%include "blocks/peak_detector_sb.h" -%include "blocks/peak_detector2_fb.h" -%include "blocks/plateau_detector_fb.h" -%include "blocks/probe_rate.h" -%include "blocks/random_pdu.h" -%include "blocks/regenerate_bb.h" -%include "blocks/repack_bits_bb.h" -%include "blocks/repeat.h" -%include "blocks/rms_cf.h" -%include "blocks/rms_ff.h" -%include "blocks/sample_and_hold_bb.h" -%include "blocks/sample_and_hold_ss.h" -%include "blocks/sample_and_hold_ii.h" -%include "blocks/sample_and_hold_ff.h" -%include "blocks/short_to_char.h" -%include "blocks/short_to_float.h" -%include "blocks/socket_pdu.h" -%include "blocks/stretch_ff.h" -%include "blocks/sub_ff.h" -%include "blocks/sub_ss.h" -%include "blocks/sub_ii.h" -%include "blocks/sub_cc.h" -%include "blocks/tagged_stream_mux.h" -%include "blocks/tagged_stream_to_pdu.h" -%include "blocks/threshold_ff.h" -%include "blocks/transcendental.h" -%include "blocks/tuntap_pdu.h" -%include "blocks/uchar_to_float.h" -%include "blocks/udp_sink.h" -%include "blocks/udp_source.h" -%include "blocks/unpack_k_bits_bb.h" -%include "blocks/unpacked_to_packed_bb.h" -%include "blocks/unpacked_to_packed_ss.h" -%include "blocks/unpacked_to_packed_ii.h" -%include "blocks/vco_f.h" -%include "blocks/xor_bb.h" -%include "blocks/xor_ss.h" -%include "blocks/xor_ii.h" +%include "gnuradio/blocks/add_ff.h" +%include "gnuradio/blocks/add_ss.h" +%include "gnuradio/blocks/add_ii.h" +%include "gnuradio/blocks/add_cc.h" +%include "gnuradio/blocks/add_const_bb.h" +%include "gnuradio/blocks/add_const_ff.h" +%include "gnuradio/blocks/add_const_ss.h" +%include "gnuradio/blocks/add_const_ii.h" +%include "gnuradio/blocks/add_const_cc.h" +%include "gnuradio/blocks/add_const_vbb.h" +%include "gnuradio/blocks/add_const_vff.h" +%include "gnuradio/blocks/add_const_vss.h" +%include "gnuradio/blocks/add_const_vii.h" +%include "gnuradio/blocks/add_const_vcc.h" +%include "gnuradio/blocks/and_bb.h" +%include "gnuradio/blocks/and_ss.h" +%include "gnuradio/blocks/and_ii.h" +%include "gnuradio/blocks/and_const_bb.h" +%include "gnuradio/blocks/and_const_ss.h" +%include "gnuradio/blocks/and_const_ii.h" +%include "gnuradio/blocks/argmax_fs.h" +%include "gnuradio/blocks/argmax_is.h" +%include "gnuradio/blocks/argmax_ss.h" +%include "gnuradio/blocks/char_to_float.h" +%include "gnuradio/blocks/bin_statistics_f.h" +%include "gnuradio/blocks/burst_tagger.h" +%include "gnuradio/blocks/char_to_short.h" +%include "gnuradio/blocks/check_lfsr_32k_s.h" +%include "gnuradio/blocks/complex_to_interleaved_short.h" +%include "gnuradio/blocks/complex_to_float.h" +%include "gnuradio/blocks/complex_to_real.h" +%include "gnuradio/blocks/complex_to_imag.h" +%include "gnuradio/blocks/complex_to_mag.h" +%include "gnuradio/blocks/complex_to_mag_squared.h" +%include "gnuradio/blocks/complex_to_arg.h" +%include "gnuradio/blocks/conjugate_cc.h" +%include "gnuradio/blocks/deinterleave.h" +%include "gnuradio/blocks/divide_ff.h" +%include "gnuradio/blocks/divide_ss.h" +%include "gnuradio/blocks/divide_ii.h" +%include "gnuradio/blocks/divide_cc.h" -GR_SWIG_BLOCK_MAGIC2(blocks, nlog10_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, not_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, not_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, not_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, patterned_interleaver); -GR_SWIG_BLOCK_MAGIC2(blocks, pack_k_bits_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_fb); -GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_ib); -GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_sb); -GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector2_fb); -GR_SWIG_BLOCK_MAGIC2(blocks, plateau_detector_fb); -GR_SWIG_BLOCK_MAGIC2(blocks, pdu_to_tagged_stream); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_rate); -GR_SWIG_BLOCK_MAGIC2(blocks, or_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, or_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, or_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_b); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_s); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_i); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_f); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_c); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vb); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vs); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vi); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vf); -GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vc); -GR_SWIG_BLOCK_MAGIC2(blocks, random_pdu); -GR_SWIG_BLOCK_MAGIC2(blocks, regenerate_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, repack_bits_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, repeat); -GR_SWIG_BLOCK_MAGIC2(blocks, rms_cf); -GR_SWIG_BLOCK_MAGIC2(blocks, rms_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, short_to_char); -GR_SWIG_BLOCK_MAGIC2(blocks, short_to_float); -GR_SWIG_BLOCK_MAGIC2(blocks, socket_pdu); -GR_SWIG_BLOCK_MAGIC2(blocks, stretch_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, sub_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, sub_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, sub_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, sub_cc); -GR_SWIG_BLOCK_MAGIC2(blocks, tagged_stream_mux); -GR_SWIG_BLOCK_MAGIC2(blocks, tagged_stream_to_pdu); -GR_SWIG_BLOCK_MAGIC2(blocks, threshold_ff); -GR_SWIG_BLOCK_MAGIC2(blocks, transcendental); -GR_SWIG_BLOCK_MAGIC2(blocks, tuntap_pdu); -GR_SWIG_BLOCK_MAGIC2(blocks, uchar_to_float); -GR_SWIG_BLOCK_MAGIC2(blocks, udp_sink); -GR_SWIG_BLOCK_MAGIC2(blocks, udp_source); -GR_SWIG_BLOCK_MAGIC2(blocks, unpack_k_bits_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ii); -GR_SWIG_BLOCK_MAGIC2(blocks, vco_f); -GR_SWIG_BLOCK_MAGIC2(blocks, xor_bb); -GR_SWIG_BLOCK_MAGIC2(blocks, xor_ss); -GR_SWIG_BLOCK_MAGIC2(blocks, xor_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, add_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, add_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, add_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, add_cc); +GR_SWIG_BLOCK_MAGIC2(blocks, add_const_bb); +GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, add_const_cc); +GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vbb); +GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vff); +GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vss); +GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vii); +GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vcc); +GR_SWIG_BLOCK_MAGIC2(blocks, and_bb); +GR_SWIG_BLOCK_MAGIC2(blocks, and_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, and_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, and_const_bb); +GR_SWIG_BLOCK_MAGIC2(blocks, and_const_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, and_const_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, argmax_fs); +GR_SWIG_BLOCK_MAGIC2(blocks, argmax_is); +GR_SWIG_BLOCK_MAGIC2(blocks, argmax_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, bin_statistics_f); +GR_SWIG_BLOCK_MAGIC2(blocks, burst_tagger); +GR_SWIG_BLOCK_MAGIC2(blocks, char_to_float); +GR_SWIG_BLOCK_MAGIC2(blocks, char_to_short); +GR_SWIG_BLOCK_MAGIC2(blocks, check_lfsr_32k_s); +GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_interleaved_short); +GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_float); +GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_real); +GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_imag); +GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_mag); +GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_mag_squared); +GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_arg); +GR_SWIG_BLOCK_MAGIC2(blocks, conjugate_cc); +GR_SWIG_BLOCK_MAGIC2(blocks, deinterleave); +GR_SWIG_BLOCK_MAGIC2(blocks, divide_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, divide_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, divide_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, divide_cc); diff --git a/gr-blocks/swig/blocks_swig3.i b/gr-blocks/swig/blocks_swig3.i new file mode 100644 index 0000000000..bfa2e68a40 --- /dev/null +++ b/gr-blocks/swig/blocks_swig3.i @@ -0,0 +1,150 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 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. + */ + +#define BLOCKS_API + +%include "runtime_swig.i" + +//load generated python docstrings +%include "blocks_swig3_doc.i" + +%{ +#include "gnuradio/blocks/float_to_char.h" +#include "gnuradio/blocks/float_to_complex.h" +#include "gnuradio/blocks/float_to_int.h" +#include "gnuradio/blocks/float_to_short.h" +#include "gnuradio/blocks/float_to_uchar.h" +#include "gnuradio/blocks/int_to_float.h" +#include "gnuradio/blocks/integrate_ss.h" +#include "gnuradio/blocks/integrate_ii.h" +#include "gnuradio/blocks/integrate_ff.h" +#include "gnuradio/blocks/integrate_cc.h" +#include "gnuradio/blocks/interleave.h" +#include "gnuradio/blocks/interleaved_short_to_complex.h" +#include "gnuradio/blocks/keep_m_in_n.h" +#include "gnuradio/blocks/keep_one_in_n.h" +#include "gnuradio/blocks/lfsr_32k_source_s.h" +#include "gnuradio/blocks/max_ff.h" +#include "gnuradio/blocks/max_ii.h" +#include "gnuradio/blocks/max_ss.h" +#include "gnuradio/blocks/moving_average_cc.h" +#include "gnuradio/blocks/moving_average_ff.h" +#include "gnuradio/blocks/moving_average_ii.h" +#include "gnuradio/blocks/moving_average_ss.h" +#include "gnuradio/blocks/multiply_ss.h" +#include "gnuradio/blocks/multiply_ii.h" +#include "gnuradio/blocks/multiply_ff.h" +#include "gnuradio/blocks/multiply_cc.h" +#include "gnuradio/blocks/multiply_conjugate_cc.h" +#include "gnuradio/blocks/multiply_const_ss.h" +#include "gnuradio/blocks/multiply_const_ii.h" +#include "gnuradio/blocks/multiply_const_ff.h" +#include "gnuradio/blocks/multiply_const_cc.h" +#include "gnuradio/blocks/multiply_const_vss.h" +#include "gnuradio/blocks/multiply_const_vii.h" +#include "gnuradio/blocks/multiply_const_vff.h" +#include "gnuradio/blocks/multiply_const_vcc.h" +#include "gnuradio/blocks/mute_ss.h" +#include "gnuradio/blocks/mute_ii.h" +#include "gnuradio/blocks/mute_ff.h" +#include "gnuradio/blocks/mute_cc.h" +%} + +%include "gnuradio/blocks/float_to_char.h" +%include "gnuradio/blocks/float_to_complex.h" +%include "gnuradio/blocks/float_to_int.h" +%include "gnuradio/blocks/float_to_short.h" +%include "gnuradio/blocks/float_to_uchar.h" +%include "gnuradio/blocks/int_to_float.h" +%include "gnuradio/blocks/integrate_ss.h" +%include "gnuradio/blocks/integrate_ii.h" +%include "gnuradio/blocks/integrate_ff.h" +%include "gnuradio/blocks/integrate_cc.h" +%include "gnuradio/blocks/interleave.h" +%include "gnuradio/blocks/interleaved_short_to_complex.h" +%include "gnuradio/blocks/keep_m_in_n.h" +%include "gnuradio/blocks/keep_one_in_n.h" +%include "gnuradio/blocks/lfsr_32k_source_s.h" +%include "gnuradio/blocks/max_ff.h" +%include "gnuradio/blocks/max_ii.h" +%include "gnuradio/blocks/max_ss.h" +%include "gnuradio/blocks/moving_average_cc.h" +%include "gnuradio/blocks/moving_average_ff.h" +%include "gnuradio/blocks/moving_average_ii.h" +%include "gnuradio/blocks/moving_average_ss.h" +%include "gnuradio/blocks/multiply_ss.h" +%include "gnuradio/blocks/multiply_ii.h" +%include "gnuradio/blocks/multiply_ff.h" +%include "gnuradio/blocks/multiply_cc.h" +%include "gnuradio/blocks/multiply_conjugate_cc.h" +%include "gnuradio/blocks/multiply_const_ss.h" +%include "gnuradio/blocks/multiply_const_ii.h" +%include "gnuradio/blocks/multiply_const_ff.h" +%include "gnuradio/blocks/multiply_const_cc.h" +%include "gnuradio/blocks/multiply_const_vss.h" +%include "gnuradio/blocks/multiply_const_vii.h" +%include "gnuradio/blocks/multiply_const_vff.h" +%include "gnuradio/blocks/multiply_const_vcc.h" +%include "gnuradio/blocks/mute_ss.h" +%include "gnuradio/blocks/mute_ii.h" +%include "gnuradio/blocks/mute_ff.h" +%include "gnuradio/blocks/mute_cc.h" + +GR_SWIG_BLOCK_MAGIC2(blocks, float_to_char); +GR_SWIG_BLOCK_MAGIC2(blocks, float_to_complex); +GR_SWIG_BLOCK_MAGIC2(blocks, float_to_int); +GR_SWIG_BLOCK_MAGIC2(blocks, float_to_short); +GR_SWIG_BLOCK_MAGIC2(blocks, float_to_uchar); +GR_SWIG_BLOCK_MAGIC2(blocks, int_to_float); +GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, integrate_cc); +GR_SWIG_BLOCK_MAGIC2(blocks, interleave); +GR_SWIG_BLOCK_MAGIC2(blocks, interleaved_short_to_complex); +GR_SWIG_BLOCK_MAGIC2(blocks, keep_m_in_n); +GR_SWIG_BLOCK_MAGIC2(blocks, keep_one_in_n); +GR_SWIG_BLOCK_MAGIC2(blocks, lfsr_32k_source_s); +GR_SWIG_BLOCK_MAGIC2(blocks, max_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, max_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, max_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_cc); +GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, moving_average_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, multiply_cc); +GR_SWIG_BLOCK_MAGIC2(blocks, multiply_conjugate_cc); +GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_cc); +GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vss); +GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vii); +GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vff); +GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vcc); +GR_SWIG_BLOCK_MAGIC2(blocks, mute_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, mute_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, mute_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, mute_cc); diff --git a/gr-blocks/swig/blocks_swig4.i b/gr-blocks/swig/blocks_swig4.i new file mode 100644 index 0000000000..ecd63dd3ac --- /dev/null +++ b/gr-blocks/swig/blocks_swig4.i @@ -0,0 +1,123 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 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. + */ + +#define BLOCKS_API + +%include "runtime_swig.i" +%include "gnuradio/blocks/pdu.h" + +%include <gnuradio/endianness.h> + +//load generated python docstrings +%include "blocks_swig4_doc.i" + +%{ +#include "gnuradio/blocks/nlog10_ff.h" +#include "gnuradio/blocks/not_bb.h" +#include "gnuradio/blocks/not_ss.h" +#include "gnuradio/blocks/not_ii.h" +#include "gnuradio/blocks/patterned_interleaver.h" +#include "gnuradio/blocks/pack_k_bits_bb.h" +#include "gnuradio/blocks/packed_to_unpacked_bb.h" +#include "gnuradio/blocks/packed_to_unpacked_ss.h" +#include "gnuradio/blocks/packed_to_unpacked_ii.h" +#include "gnuradio/blocks/pdu_to_tagged_stream.h" +#include "gnuradio/blocks/peak_detector_fb.h" +#include "gnuradio/blocks/peak_detector_ib.h" +#include "gnuradio/blocks/peak_detector_sb.h" +#include "gnuradio/blocks/peak_detector2_fb.h" +#include "gnuradio/blocks/plateau_detector_fb.h" +#include "gnuradio/blocks/probe_rate.h" +#include "gnuradio/blocks/probe_signal_b.h" +#include "gnuradio/blocks/probe_signal_s.h" +#include "gnuradio/blocks/probe_signal_i.h" +#include "gnuradio/blocks/probe_signal_f.h" +#include "gnuradio/blocks/probe_signal_c.h" +#include "gnuradio/blocks/probe_signal_vb.h" +#include "gnuradio/blocks/probe_signal_vs.h" +#include "gnuradio/blocks/probe_signal_vi.h" +#include "gnuradio/blocks/probe_signal_vf.h" +#include "gnuradio/blocks/probe_signal_vc.h" +#include "gnuradio/blocks/or_bb.h" +#include "gnuradio/blocks/or_ss.h" +#include "gnuradio/blocks/or_ii.h" +%} + +%include "gnuradio/blocks/nlog10_ff.h" +%include "gnuradio/blocks/not_bb.h" +%include "gnuradio/blocks/not_ss.h" +%include "gnuradio/blocks/not_ii.h" +%include "gnuradio/blocks/probe_signal_b.h" +%include "gnuradio/blocks/probe_signal_s.h" +%include "gnuradio/blocks/probe_signal_i.h" +%include "gnuradio/blocks/probe_signal_f.h" +%include "gnuradio/blocks/probe_signal_c.h" +%include "gnuradio/blocks/probe_signal_vb.h" +%include "gnuradio/blocks/probe_signal_vs.h" +%include "gnuradio/blocks/probe_signal_vi.h" +%include "gnuradio/blocks/probe_signal_vf.h" +%include "gnuradio/blocks/probe_signal_vc.h" +%include "gnuradio/blocks/or_bb.h" +%include "gnuradio/blocks/or_ss.h" +%include "gnuradio/blocks/or_ii.h" +%include "gnuradio/blocks/pack_k_bits_bb.h" +%include "gnuradio/blocks/packed_to_unpacked_bb.h" +%include "gnuradio/blocks/packed_to_unpacked_ss.h" +%include "gnuradio/blocks/packed_to_unpacked_ii.h" +%include "gnuradio/blocks/patterned_interleaver.h" +%include "gnuradio/blocks/pdu_to_tagged_stream.h" +%include "gnuradio/blocks/peak_detector_fb.h" +%include "gnuradio/blocks/peak_detector_ib.h" +%include "gnuradio/blocks/peak_detector_sb.h" +%include "gnuradio/blocks/peak_detector2_fb.h" +%include "gnuradio/blocks/plateau_detector_fb.h" +%include "gnuradio/blocks/probe_rate.h" + +GR_SWIG_BLOCK_MAGIC2(blocks, nlog10_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, not_bb); +GR_SWIG_BLOCK_MAGIC2(blocks, not_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, not_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, patterned_interleaver); +GR_SWIG_BLOCK_MAGIC2(blocks, pack_k_bits_bb); +GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_bb); +GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_fb); +GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_ib); +GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_sb); +GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector2_fb); +GR_SWIG_BLOCK_MAGIC2(blocks, plateau_detector_fb); +GR_SWIG_BLOCK_MAGIC2(blocks, pdu_to_tagged_stream); +GR_SWIG_BLOCK_MAGIC2(blocks, probe_rate); +GR_SWIG_BLOCK_MAGIC2(blocks, or_bb); +GR_SWIG_BLOCK_MAGIC2(blocks, or_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, or_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_b); +GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_s); +GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_i); +GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_f); +GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_c); +GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vb); +GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vs); +GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vi); +GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vf); +GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vc); diff --git a/gr-blocks/swig/blocks_swig5.i b/gr-blocks/swig/blocks_swig5.i new file mode 100644 index 0000000000..2eefe88d05 --- /dev/null +++ b/gr-blocks/swig/blocks_swig5.i @@ -0,0 +1,138 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 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. + */ + +#define BLOCKS_API + +%include "runtime_swig.i" +%include "gnuradio/blocks/pdu.h" + +%include <gnuradio/endianness.h> + +//load generated python docstrings +%include "blocks_swig5_doc.i" + +%{ +#include "gnuradio/blocks/random_pdu.h" +#include "gnuradio/blocks/regenerate_bb.h" +#include "gnuradio/blocks/repack_bits_bb.h" +#include "gnuradio/blocks/repeat.h" +#include "gnuradio/blocks/rms_cf.h" +#include "gnuradio/blocks/rms_ff.h" +#include "gnuradio/blocks/sample_and_hold_bb.h" +#include "gnuradio/blocks/sample_and_hold_ss.h" +#include "gnuradio/blocks/sample_and_hold_ii.h" +#include "gnuradio/blocks/sample_and_hold_ff.h" +#include "gnuradio/blocks/short_to_char.h" +#include "gnuradio/blocks/short_to_float.h" +#include "gnuradio/blocks/socket_pdu.h" +#include "gnuradio/blocks/stretch_ff.h" +#include "gnuradio/blocks/sub_ff.h" +#include "gnuradio/blocks/sub_ss.h" +#include "gnuradio/blocks/sub_ii.h" +#include "gnuradio/blocks/sub_cc.h" +#include "gnuradio/blocks/tagged_stream_mux.h" +#include "gnuradio/blocks/tagged_stream_to_pdu.h" +#include "gnuradio/blocks/threshold_ff.h" +#include "gnuradio/blocks/transcendental.h" +#include "gnuradio/blocks/tuntap_pdu.h" +#include "gnuradio/blocks/uchar_to_float.h" +#include "gnuradio/blocks/udp_sink.h" +#include "gnuradio/blocks/udp_source.h" +#include "gnuradio/blocks/unpack_k_bits_bb.h" +#include "gnuradio/blocks/unpacked_to_packed_bb.h" +#include "gnuradio/blocks/unpacked_to_packed_ss.h" +#include "gnuradio/blocks/unpacked_to_packed_ii.h" +#include "gnuradio/blocks/vco_f.h" +#include "gnuradio/blocks/xor_bb.h" +#include "gnuradio/blocks/xor_ss.h" +#include "gnuradio/blocks/xor_ii.h" +%} + +%include "gnuradio/blocks/random_pdu.h" +%include "gnuradio/blocks/regenerate_bb.h" +%include "gnuradio/blocks/repack_bits_bb.h" +%include "gnuradio/blocks/repeat.h" +%include "gnuradio/blocks/rms_cf.h" +%include "gnuradio/blocks/rms_ff.h" +%include "gnuradio/blocks/sample_and_hold_bb.h" +%include "gnuradio/blocks/sample_and_hold_ss.h" +%include "gnuradio/blocks/sample_and_hold_ii.h" +%include "gnuradio/blocks/sample_and_hold_ff.h" +%include "gnuradio/blocks/short_to_char.h" +%include "gnuradio/blocks/short_to_float.h" +%include "gnuradio/blocks/socket_pdu.h" +%include "gnuradio/blocks/stretch_ff.h" +%include "gnuradio/blocks/sub_ff.h" +%include "gnuradio/blocks/sub_ss.h" +%include "gnuradio/blocks/sub_ii.h" +%include "gnuradio/blocks/sub_cc.h" +%include "gnuradio/blocks/tagged_stream_mux.h" +%include "gnuradio/blocks/tagged_stream_to_pdu.h" +%include "gnuradio/blocks/threshold_ff.h" +%include "gnuradio/blocks/transcendental.h" +%include "gnuradio/blocks/tuntap_pdu.h" +%include "gnuradio/blocks/uchar_to_float.h" +%include "gnuradio/blocks/udp_sink.h" +%include "gnuradio/blocks/udp_source.h" +%include "gnuradio/blocks/unpack_k_bits_bb.h" +%include "gnuradio/blocks/unpacked_to_packed_bb.h" +%include "gnuradio/blocks/unpacked_to_packed_ss.h" +%include "gnuradio/blocks/unpacked_to_packed_ii.h" +%include "gnuradio/blocks/vco_f.h" +%include "gnuradio/blocks/xor_bb.h" +%include "gnuradio/blocks/xor_ss.h" +%include "gnuradio/blocks/xor_ii.h" + +GR_SWIG_BLOCK_MAGIC2(blocks, random_pdu); +GR_SWIG_BLOCK_MAGIC2(blocks, regenerate_bb); +GR_SWIG_BLOCK_MAGIC2(blocks, repack_bits_bb); +GR_SWIG_BLOCK_MAGIC2(blocks, repeat); +GR_SWIG_BLOCK_MAGIC2(blocks, rms_cf); +GR_SWIG_BLOCK_MAGIC2(blocks, rms_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_bb); +GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, short_to_char); +GR_SWIG_BLOCK_MAGIC2(blocks, short_to_float); +GR_SWIG_BLOCK_MAGIC2(blocks, socket_pdu); +GR_SWIG_BLOCK_MAGIC2(blocks, stretch_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, sub_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, sub_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, sub_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, sub_cc); +GR_SWIG_BLOCK_MAGIC2(blocks, tagged_stream_mux); +GR_SWIG_BLOCK_MAGIC2(blocks, tagged_stream_to_pdu); +GR_SWIG_BLOCK_MAGIC2(blocks, threshold_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, transcendental); +GR_SWIG_BLOCK_MAGIC2(blocks, tuntap_pdu); +GR_SWIG_BLOCK_MAGIC2(blocks, uchar_to_float); +GR_SWIG_BLOCK_MAGIC2(blocks, udp_sink); +GR_SWIG_BLOCK_MAGIC2(blocks, udp_source); +GR_SWIG_BLOCK_MAGIC2(blocks, unpack_k_bits_bb); +GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_bb); +GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, vco_f); +GR_SWIG_BLOCK_MAGIC2(blocks, xor_bb); +GR_SWIG_BLOCK_MAGIC2(blocks, xor_ss); +GR_SWIG_BLOCK_MAGIC2(blocks, xor_ii); diff --git a/gr-blocks/tests/benchmark_nco.cc b/gr-blocks/tests/benchmark_nco.cc index 4c2ed120db..593972494d 100644 --- a/gr-blocks/tests/benchmark_nco.cc +++ b/gr-blocks/tests/benchmark_nco.cc @@ -33,8 +33,8 @@ #endif #include <unistd.h> -#include <blocks/nco.h> -#include <blocks/fxpt_nco.h> +#include <gnuradio/blocks/nco.h> +#include <gnuradio/blocks/fxpt_nco.h> #include <string.h> #define ITERATIONS 20000000 diff --git a/gr-blocks/tests/benchmark_vco.cc b/gr-blocks/tests/benchmark_vco.cc index 955dc08051..865e36df4e 100644 --- a/gr-blocks/tests/benchmark_vco.cc +++ b/gr-blocks/tests/benchmark_vco.cc @@ -33,8 +33,8 @@ #endif #include <unistd.h> -#include <blocks/vco.h> -#include <blocks/fxpt_vco.h> +#include <gnuradio/blocks/vco.h> +#include <gnuradio/blocks/fxpt_vco.h> #include <string.h> #define ITERATIONS 5000000 diff --git a/gr-channels/CMakeLists.txt b/gr-channels/CMakeLists.txt index f73f49565f..b7df5deee7 100644 --- a/gr-channels/CMakeLists.txt +++ b/gr-channels/CMakeLists.txt @@ -84,7 +84,7 @@ CPACK_COMPONENT("channels_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/channels) +add_subdirectory(include/gnuradio/channels) add_subdirectory(lib) if(ENABLE_PYTHON) add_subdirectory(swig) diff --git a/gr-channels/include/channels/CMakeLists.txt b/gr-channels/include/gnuradio/channels/CMakeLists.txt index c0c70e2b00..c0c70e2b00 100644 --- a/gr-channels/include/channels/CMakeLists.txt +++ b/gr-channels/include/gnuradio/channels/CMakeLists.txt diff --git a/gr-channels/include/channels/api.h b/gr-channels/include/gnuradio/channels/api.h index 808336b042..1fd1d9ba8f 100644 --- a/gr-channels/include/channels/api.h +++ b/gr-channels/include/gnuradio/channels/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_CHANNELS_API_H #define INCLUDED_CHANNELS_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_channels_EXPORTS # define CHANNELS_API __GR_ATTR_EXPORT diff --git a/gr-channels/include/channels/channel_model.h b/gr-channels/include/gnuradio/channels/channel_model.h index 8e5430f05c..8b533ac7da 100644 --- a/gr-channels/include/channels/channel_model.h +++ b/gr-channels/include/gnuradio/channels/channel_model.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_CHANNELS_CHANNEL_MODEL_H #define INCLUDED_CHANNELS_CHANNEL_MODEL_H -#include <channels/api.h> -#include <gr_hier_block2.h> -#include <gr_types.h> +#include <gnuradio/channels/api.h> +#include <gnuradio/hier_block2.h> +#include <gnuradio/types.h> namespace gr { namespace channels { @@ -45,7 +45,7 @@ namespace gr { * Multipath can be approximated in this model by using a FIR * filter representation of a multipath delay profile.. */ - class CHANNELS_API channel_model : virtual public gr_hier_block2 + class CHANNELS_API channel_model : virtual public hier_block2 { public: // gr::channels::channel_model::sptr diff --git a/gr-channels/include/channels/fading_model.h b/gr-channels/include/gnuradio/channels/fading_model.h index 50632a61fc..c5946d3598 100644 --- a/gr-channels/include/channels/fading_model.h +++ b/gr-channels/include/gnuradio/channels/fading_model.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_CHANNELS_FADING_MODEL_H #define INCLUDED_CHANNELS_FADING_MODEL_H -#include <channels/api.h> -#include <gr_sync_block.h> -#include <gr_types.h> +#include <gnuradio/channels/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/types.h> namespace gr { namespace channels { @@ -39,7 +39,7 @@ namespace gr { * be used to help evaluate, design, and test various signals, * waveforms, and algorithms. */ - class CHANNELS_API fading_model : virtual public gr_sync_block + class CHANNELS_API fading_model : virtual public sync_block { public: // gr::channels::channel_model::sptr diff --git a/gr-channels/lib/channel_model_impl.cc b/gr-channels/lib/channel_model_impl.cc index aafab12f37..450c925eb1 100644 --- a/gr-channels/lib/channel_model_impl.cc +++ b/gr-channels/lib/channel_model_impl.cc @@ -21,7 +21,7 @@ */ #include "channel_model_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> namespace gr { @@ -48,9 +48,9 @@ namespace gr { double epsilon, const std::vector<gr_complex> &taps, double noise_seed) - : gr_hier_block2("channel_model", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))) + : hier_block2("channel_model", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))) { d_taps = taps; while(d_taps.size() < 2) { diff --git a/gr-channels/lib/channel_model_impl.h b/gr-channels/lib/channel_model_impl.h index b94555f122..e0feb91437 100644 --- a/gr-channels/lib/channel_model_impl.h +++ b/gr-channels/lib/channel_model_impl.h @@ -23,14 +23,14 @@ #ifndef INCLUDED_CHANNELS_CHANNEL_MODEL_IMPL_H #define INCLUDED_CHANNELS_CHANNEL_MODEL_IMPL_H -#include <gr_top_block.h> -#include <blocks/add_cc.h> -#include <blocks/multiply_cc.h> -#include <analog/sig_source_c.h> -#include <analog/fastnoise_source_c.h> -#include <channels/channel_model.h> -#include <filter/fractional_interpolator_cc.h> -#include <filter/fir_filter_ccc.h> +#include <gnuradio/top_block.h> +#include <gnuradio/blocks/add_cc.h> +#include <gnuradio/blocks/multiply_cc.h> +#include <gnuradio/analog/sig_source_c.h> +#include <gnuradio/analog/fastnoise_source_c.h> +#include <gnuradio/channels/channel_model.h> +#include <gnuradio/filter/fractional_interpolator_cc.h> +#include <gnuradio/filter/fir_filter_ccc.h> namespace gr { namespace channels { diff --git a/gr-channels/lib/fading_model_impl.cc b/gr-channels/lib/fading_model_impl.cc index ecebe4a069..a39a6cf44f 100644 --- a/gr-channels/lib/fading_model_impl.cc +++ b/gr-channels/lib/fading_model_impl.cc @@ -21,17 +21,17 @@ */ #include "fading_model_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> #include <boost/format.hpp> #include <boost/random.hpp> -#include <gr_fxpt.h> +#include <gnuradio/fxpt.h> #include <sincostable.h> -// FASTSINCOS: 0 = slow native, 1 = gr_fxpt impl, 2 = sincostable.h +// FASTSINCOS: 0 = slow native, 1 = gr::fxpt impl, 2 = sincostable.h #define FASTSINCOS 2 @@ -47,9 +47,9 @@ namespace gr { // Block constructor fading_model_impl::fading_model_impl( unsigned int N, float fDTs, bool LOS, float K, int seed ) - : gr_sync_block("fading_model", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : sync_block("fading_model", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), seed_1((int)seed), dist_1(-M_PI, M_PI), rv_1( seed_1, dist_1 ), // U(-pi,pi) @@ -163,8 +163,8 @@ namespace gr { for(int n=1; n<d_N; n++){ float alpha_n = (2*M_PI*n - M_PI + d_theta)/4*d_N; #if FASTSINCOS == 1 - float s_i = scale_sin*gr_fxpt::cos(gr_fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr_fxpt::cos(gr_fxpt::float_to_fixed(alpha_n))+d_psi[n+1])); - float s_q = scale_sin*gr_fxpt::cos(gr_fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr_fxpt::sin(gr_fxpt::float_to_fixed(alpha_n))+d_phi[n+1])); + float s_i = scale_sin*gr::fxpt::cos(gr::fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr::fxpt::cos(gr::fxpt::float_to_fixed(alpha_n))+d_psi[n+1])); + float s_q = scale_sin*gr::fxpt::cos(gr::fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr::fxpt::sin(gr::fxpt::float_to_fixed(alpha_n))+d_phi[n+1])); #elif FASTSINCOS == 2 float s_i = scale_sin*d_table.cos(2*M_PI*d_fDTs*d_m*d_table.cos(alpha_n)+d_psi[n+1]); float s_q = scale_sin*d_table.cos(2*M_PI*d_fDTs*d_m*d_table.sin(alpha_n)+d_phi[n+1]); @@ -179,8 +179,8 @@ namespace gr { if(d_LOS){ #if FASTSINCOS == 1 - float los_i = gr_fxpt::cos(gr_fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr_fxpt::cos(gr_fxpt::float_to_fixed(d_theta_los)) + d_psi[0])); - float los_q = gr_fxpt::sin(gr_fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr_fxpt::cos(gr_fxpt::float_to_fixed(d_theta_los)) + d_psi[0])); + float los_i = gr::fxpt::cos(gr::fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr::fxpt::cos(gr::fxpt::float_to_fixed(d_theta_los)) + d_psi[0])); + float los_q = gr::fxpt::sin(gr::fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr::fxpt::cos(gr::fxpt::float_to_fixed(d_theta_los)) + d_psi[0])); #elif FASTSINCOS == 2 float los_i = d_table.cos(2*M_PI*d_fDTs*d_m*d_table.cos(d_theta_los) + d_psi[0]); float los_q = d_table.sin(2*M_PI*d_fDTs*d_m*d_table.cos(d_theta_los) + d_psi[0]); diff --git a/gr-channels/lib/fading_model_impl.h b/gr-channels/lib/fading_model_impl.h index 5c2d7f3877..3b816b6679 100644 --- a/gr-channels/lib/fading_model_impl.h +++ b/gr-channels/lib/fading_model_impl.h @@ -23,14 +23,14 @@ #ifndef INCLUDED_CHANNELS_CHANNEL_MODEL_IMPL_H #define INCLUDED_CHANNELS_CHANNEL_MODEL_IMPL_H -#include <gr_sync_block.h> -#include <channels/fading_model.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/channels/fading_model.h> //#include <iostream> #include <boost/format.hpp> #include <boost/random.hpp> -#include <gr_fxpt.h> +#include <gnuradio/fxpt.h> #include <sincostable.h> namespace gr { diff --git a/gr-channels/swig/CMakeLists.txt b/gr-channels/swig/CMakeLists.txt index fda2da66f2..5f5091f342 100644 --- a/gr-channels/swig/CMakeLists.txt +++ b/gr-channels/swig/CMakeLists.txt @@ -36,7 +36,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/channels_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/channels) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/channels) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_LIBRARIES gnuradio-channels) diff --git a/gr-channels/swig/channels_swig.i b/gr-channels/swig/channels_swig.i index bfd0f9a10a..4cf3e13638 100644 --- a/gr-channels/swig/channels_swig.i +++ b/gr-channels/swig/channels_swig.i @@ -28,12 +28,12 @@ %include "channels_swig_doc.i" %{ -#include "channels/channel_model.h" -#include "channels/fading_model.h" +#include "gnuradio/channels/channel_model.h" +#include "gnuradio/channels/fading_model.h" %} -%include "channels/channel_model.h" -%include "channels/fading_model.h" +%include "gnuradio/channels/channel_model.h" +%include "gnuradio/channels/fading_model.h" GR_SWIG_BLOCK_MAGIC2(channels, channel_model); GR_SWIG_BLOCK_MAGIC2(channels, fading_model); diff --git a/gr-comedi/CMakeLists.txt b/gr-comedi/CMakeLists.txt index 1cd89b8144..d54f44c29d 100644 --- a/gr-comedi/CMakeLists.txt +++ b/gr-comedi/CMakeLists.txt @@ -88,7 +88,7 @@ CPACK_COMPONENT("comedi_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/comedi) +add_subdirectory(include/gnuradio/comedi) add_subdirectory(lib) if(ENABLE_PYTHON) add_subdirectory(swig) diff --git a/gr-comedi/include/comedi/CMakeLists.txt b/gr-comedi/include/gnuradio/comedi/CMakeLists.txt index 51a609e421..51a609e421 100644 --- a/gr-comedi/include/comedi/CMakeLists.txt +++ b/gr-comedi/include/gnuradio/comedi/CMakeLists.txt diff --git a/gr-comedi/include/comedi/api.h b/gr-comedi/include/gnuradio/comedi/api.h index 54aa18f317..1afaf0d18c 100644 --- a/gr-comedi/include/comedi/api.h +++ b/gr-comedi/include/gnuradio/comedi/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_COMEDI_API_H #define INCLUDED_COMEDI_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_comedi_EXPORTS # define COMEDI_API __GR_ATTR_EXPORT diff --git a/gr-comedi/include/comedi/sink_s.h b/gr-comedi/include/gnuradio/comedi/sink_s.h index 309bce17e5..e5aa6dcd33 100644 --- a/gr-comedi/include/comedi/sink_s.h +++ b/gr-comedi/include/gnuradio/comedi/sink_s.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_COMEDI_SINK_H #define INCLUDED_COMEDI_SINK_H -#include <comedi/api.h> -#include <gr_sync_block.h> +#include <gnuradio/comedi/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace comedi { @@ -36,7 +36,7 @@ namespace gr { * * Input samples must be in the range [-32768,32767]. */ - class COMEDI_API sink_s : virtual public gr_sync_block + class COMEDI_API sink_s : virtual public sync_block { public: // gr::comedi::sink_s::sptr diff --git a/gr-comedi/include/comedi/source_s.h b/gr-comedi/include/gnuradio/comedi/source_s.h index 6608e45446..84c98517ce 100644 --- a/gr-comedi/include/comedi/source_s.h +++ b/gr-comedi/include/gnuradio/comedi/source_s.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_COMEDI_SOURCE_S_H #define INCLUDED_COMEDI_SOURCE_S_H -#include <comedi/api.h> -#include <gr_sync_block.h> +#include <gnuradio/comedi/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace comedi { @@ -36,7 +36,7 @@ namespace gr { * * Output samples will be in the range [-32768,32767]. */ - class COMEDI_API source_s : virtual public gr_sync_block + class COMEDI_API source_s : virtual public sync_block { public: // gr::comedi::source_s::sptr diff --git a/gr-comedi/lib/sink_s_impl.cc b/gr-comedi/lib/sink_s_impl.cc index bc7ec5022a..df2040adf9 100644 --- a/gr-comedi/lib/sink_s_impl.cc +++ b/gr-comedi/lib/sink_s_impl.cc @@ -27,7 +27,7 @@ #include <sys/mman.h> #include "sink_s_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdio.h> #include <errno.h> #include <iostream> @@ -58,9 +58,9 @@ namespace gr { sink_s_impl::sink_s_impl(int sampling_freq, const std::string device_name) - : gr_sync_block("comedi_sink_s", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), + : sync_block("comedi_sink_s", + io_signature::make(0, 0, 0), + io_signature::make(0, 0, 0)), d_sampling_freq(sampling_freq), d_device_name(device_name.empty() ? default_device_name() : device_name), d_dev(0), @@ -142,7 +142,7 @@ namespace gr { set_output_multiple(d_n_chan*sizeof(sampl_t)); assert(sizeof(sampl_t) == sizeof(short)); - set_output_signature(gr_make_io_signature(1, 1, sizeof(sampl_t))); + set_output_signature(io_signature::make(1, 1, sizeof(sampl_t))); } bool diff --git a/gr-comedi/lib/sink_s_impl.h b/gr-comedi/lib/sink_s_impl.h index 6d57591ed0..22838a812b 100644 --- a/gr-comedi/lib/sink_s_impl.h +++ b/gr-comedi/lib/sink_s_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_COMEDI_SINK_IMPL_H #define INCLUDED_COMEDI_SINK_IMPL_H -#include <comedi/sink_s.h> +#include <gnuradio/comedi/sink_s.h> #include <string> #include <comedilib.h> #include <stdexcept> diff --git a/gr-comedi/lib/source_s_impl.cc b/gr-comedi/lib/source_s_impl.cc index 2082177933..2c839208be 100644 --- a/gr-comedi/lib/source_s_impl.cc +++ b/gr-comedi/lib/source_s_impl.cc @@ -27,7 +27,7 @@ #include <sys/mman.h> #include "source_s_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdio.h> #include <errno.h> #include <iostream> @@ -55,9 +55,9 @@ namespace gr { source_s_impl::source_s_impl(int sampling_freq, const std::string device_name) - : gr_sync_block("comedi_source_s", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), + : sync_block("comedi_source_s", + io_signature::make(0, 0, 0), + io_signature::make(0, 0, 0)), d_sampling_freq(sampling_freq), d_device_name(device_name.empty() ? default_device_name() : device_name), d_dev(0), @@ -139,7 +139,7 @@ namespace gr { set_output_multiple(d_n_chan*sizeof(sampl_t)); assert(sizeof(sampl_t) == sizeof(short)); - set_output_signature(gr_make_io_signature(1, 1, sizeof(sampl_t))); + set_output_signature(io_signature::make(1, 1, sizeof(sampl_t))); } bool diff --git a/gr-comedi/lib/source_s_impl.h b/gr-comedi/lib/source_s_impl.h index e5b062323f..47e78c70e7 100644 --- a/gr-comedi/lib/source_s_impl.h +++ b/gr-comedi/lib/source_s_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_COMEDI_SOURCE_S_IMPL_H #define INCLUDED_COMEDI_SOURCE_S_IMPL_H -#include <comedi/source_s.h> +#include <gnuradio/comedi/source_s.h> #include <string> #include <comedilib.h> #include <stdexcept> diff --git a/gr-comedi/swig/CMakeLists.txt b/gr-comedi/swig/CMakeLists.txt index 42e6286709..0c275cc48e 100644 --- a/gr-comedi/swig/CMakeLists.txt +++ b/gr-comedi/swig/CMakeLists.txt @@ -37,7 +37,7 @@ endif(ENABLE_GR_CTRLPORT) # Setup swig docs to depend on includes and pull in from build directory set(GR_SWIG_TARGET_DEPS comedi_generated_includes) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/comedi_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/comedi) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/comedi) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_LIBRARIES gnuradio-comedi) diff --git a/gr-comedi/swig/comedi_swig.i b/gr-comedi/swig/comedi_swig.i index 179882991a..f15873b830 100644 --- a/gr-comedi/swig/comedi_swig.i +++ b/gr-comedi/swig/comedi_swig.i @@ -28,12 +28,12 @@ %include "comedi_swig_doc.i" %{ -#include "comedi/sink_s.h" -#include "comedi/source_s.h" +#include "gnuradio/comedi/sink_s.h" +#include "gnuradio/comedi/source_s.h" %} -%include "comedi/sink_s.h" -%include "comedi/source_s.h" +%include "gnuradio/comedi/sink_s.h" +%include "gnuradio/comedi/source_s.h" GR_SWIG_BLOCK_MAGIC2(comedi, sink_s); GR_SWIG_BLOCK_MAGIC2(comedi, source_s); diff --git a/gr-digital/CMakeLists.txt b/gr-digital/CMakeLists.txt index 7d5a7541d1..4c7647a4db 100644 --- a/gr-digital/CMakeLists.txt +++ b/gr-digital/CMakeLists.txt @@ -91,7 +91,7 @@ CPACK_COMPONENT("digital_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/digital) +add_subdirectory(include/gnuradio/digital) add_subdirectory(lib) add_subdirectory(doc) if(ENABLE_PYTHON) diff --git a/gr-digital/include/digital/CMakeLists.txt b/gr-digital/include/gnuradio/digital/CMakeLists.txt index 275da16d87..275da16d87 100644 --- a/gr-digital/include/digital/CMakeLists.txt +++ b/gr-digital/include/gnuradio/digital/CMakeLists.txt diff --git a/gr-digital/include/digital/additive_scrambler_bb.h b/gr-digital/include/gnuradio/digital/additive_scrambler_bb.h index bc4d4b36e9..73fd395d67 100644 --- a/gr-digital/include/digital/additive_scrambler_bb.h +++ b/gr-digital/include/gnuradio/digital/additive_scrambler_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H #define INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -45,7 +45,7 @@ namespace gr { * processed, the shift register is reset to the seed value. * This allows processing fixed length vectors of samples. */ - class DIGITAL_API additive_scrambler_bb : virtual public gr_sync_block + class DIGITAL_API additive_scrambler_bb : virtual public sync_block { public: // gr::digital::additive_scrambler_bb::sptr diff --git a/gr-digital/include/digital/api.h b/gr-digital/include/gnuradio/digital/api.h index 815f7b6627..71ca19ad58 100644 --- a/gr-digital/include/digital/api.h +++ b/gr-digital/include/gnuradio/digital/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_DIGITAL_API_H #define INCLUDED_DIGITAL_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_digital_EXPORTS # define DIGITAL_API __GR_ATTR_EXPORT diff --git a/gr-digital/include/digital/binary_slicer_fb.h b/gr-digital/include/gnuradio/digital/binary_slicer_fb.h index 47e0246094..ef83a9dbd4 100644 --- a/gr-digital/include/digital/binary_slicer_fb.h +++ b/gr-digital/include/gnuradio/digital/binary_slicer_fb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_BINARY_SLICER_FB_H #define INCLUDED_DIGITAL_BINARY_SLICER_FB_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -37,7 +37,7 @@ namespace gr { * x < 0 --> 0 * x >= 0 --> 1 */ - class DIGITAL_API binary_slicer_fb : virtual public gr_sync_block + class DIGITAL_API binary_slicer_fb : virtual public sync_block { public: // gr::digital::binary_slicer_fb::sptr diff --git a/gr-digital/include/digital/chunks_to_symbols_XX.h.t b/gr-digital/include/gnuradio/digital/chunks_to_symbols_XX.h.t index 6ad10ae261..3835c80bee 100644 --- a/gr-digital/include/digital/chunks_to_symbols_XX.h.t +++ b/gr-digital/include/gnuradio/digital/chunks_to_symbols_XX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <digital/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace digital { @@ -52,7 +52,7 @@ namespace gr { * \sa gr::digital::chunks_to_symbols_sf, gr::digital::chunks_to_symbols_sc. */ - class DIGITAL_API @NAME@ : virtual public gr_sync_interpolator + class DIGITAL_API @NAME@ : virtual public sync_interpolator { public: // gr::digital::@BASE_NAME@::sptr diff --git a/gr-digital/include/digital/clock_recovery_mm_cc.h b/gr-digital/include/gnuradio/digital/clock_recovery_mm_cc.h index a7917e528a..9bca249afd 100644 --- a/gr-digital/include/digital/clock_recovery_mm_cc.h +++ b/gr-digital/include/gnuradio/digital/clock_recovery_mm_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H #define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H -#include <digital/api.h> -#include <gr_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/block.h> namespace gr { namespace digital { @@ -44,7 +44,7 @@ namespace gr { * and Muller algorithm," Electronics Letters, Vol. 31, no. 13, 22 * June 1995, pp. 1032 - 1033. */ - class DIGITAL_API clock_recovery_mm_cc : virtual public gr_block + class DIGITAL_API clock_recovery_mm_cc : virtual public block { public: // gr::digital::clock_recovery_mm_cc::sptr diff --git a/gr-digital/include/digital/clock_recovery_mm_ff.h b/gr-digital/include/gnuradio/digital/clock_recovery_mm_ff.h index 491f3ec21a..9637546ed4 100644 --- a/gr-digital/include/digital/clock_recovery_mm_ff.h +++ b/gr-digital/include/gnuradio/digital/clock_recovery_mm_ff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_H #define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_H -#include <digital/api.h> -#include <gr_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/block.h> namespace gr { namespace digital { @@ -41,7 +41,7 @@ namespace gr { * Estimation and Signal Processing" by Heinrich Meyr, Marc * Moeneclaey, & Stefan Fechtel. ISBN 0-471-50275-8. */ - class DIGITAL_API clock_recovery_mm_ff : virtual public gr_block + class DIGITAL_API clock_recovery_mm_ff : virtual public block { public: // gr::digital::clock_recovery_mm_ff::sptr diff --git a/gr-digital/include/digital/cma_equalizer_cc.h b/gr-digital/include/gnuradio/digital/cma_equalizer_cc.h index 0ccd1c21ba..108c2cfc7d 100644 --- a/gr-digital/include/digital/cma_equalizer_cc.h +++ b/gr-digital/include/gnuradio/digital/cma_equalizer_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_CMA_EQUALIZER_CC_H #define INCLUDED_DIGITAL_CMA_EQUALIZER_CC_H -#include <digital/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace digital { @@ -41,7 +41,7 @@ namespace gr { * Transactions on Communications, Vol. 28, No. 11, pp. 1867 - * 1875, 1980. */ - class DIGITAL_API cma_equalizer_cc: virtual public gr_sync_decimator + class DIGITAL_API cma_equalizer_cc: virtual public sync_decimator { protected: virtual gr_complex error(const gr_complex &out) = 0; diff --git a/gr-digital/include/digital/constellation.h b/gr-digital/include/gnuradio/digital/constellation.h index a5e490b428..f8b99bb9c5 100644 --- a/gr-digital/include/digital/constellation.h +++ b/gr-digital/include/gnuradio/digital/constellation.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_DIGITAL_CONSTELLATION_H #define INCLUDED_DIGITAL_CONSTELLATION_H -#include <digital/api.h> -#include <digital/metric_type.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/digital/metric_type.h> #include <boost/enable_shared_from_this.hpp> -#include <gr_complex.h> +#include <gnuradio/gr_complex.h> #include <vector> namespace gr { diff --git a/gr-digital/include/digital/constellation_decoder_cb.h b/gr-digital/include/gnuradio/digital/constellation_decoder_cb.h index 39cc6ac822..51feb95b7c 100644 --- a/gr-digital/include/digital/constellation_decoder_cb.h +++ b/gr-digital/include/gnuradio/digital/constellation_decoder_cb.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_H #define INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_H -#include <digital/api.h> -#include <digital/constellation.h> -#include <gr_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/digital/constellation.h> +#include <gnuradio/block.h> namespace gr { namespace digital { @@ -40,7 +40,7 @@ namespace gr { * object. */ class DIGITAL_API constellation_decoder_cb - : virtual public gr_block + : virtual public block { public: // gr::digital::constellation_decoder_cb::sptr diff --git a/gr-digital/include/digital/constellation_receiver_cb.h b/gr-digital/include/gnuradio/digital/constellation_receiver_cb.h index 31138974ef..e8f269a139 100644 --- a/gr-digital/include/digital/constellation_receiver_cb.h +++ b/gr-digital/include/gnuradio/digital/constellation_receiver_cb.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_H #define INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_H -#include <digital/api.h> -#include <digital/constellation.h> -#include <gr_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/digital/constellation.h> +#include <gnuradio/block.h> namespace gr { namespace digital { @@ -43,7 +43,7 @@ namespace gr { * the NCO are updated according to this error. */ class DIGITAL_API constellation_receiver_cb - : virtual public gr_block + : virtual public block { public: // gr::digital::constellation_receiver_cb::sptr diff --git a/gr-digital/include/digital/correlate_access_code_bb.h b/gr-digital/include/gnuradio/digital/correlate_access_code_bb.h index 12c0f39961..2f7b700ac9 100644 --- a/gr-digital/include/digital/correlate_access_code_bb.h +++ b/gr-digital/include/gnuradio/digital/correlate_access_code_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_H #define INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> #include <string> namespace gr { @@ -45,7 +45,7 @@ namespace gr { * the corresponding data bit is the first data bit following the * access code. Otherwise the flag bit is 0. */ - class DIGITAL_API correlate_access_code_bb : virtual public gr_sync_block + class DIGITAL_API correlate_access_code_bb : virtual public sync_block { public: // gr::digital::correlate_access_code_bb::sptr diff --git a/gr-digital/include/digital/correlate_access_code_tag_bb.h b/gr-digital/include/gnuradio/digital/correlate_access_code_tag_bb.h index 5e04aa0b6e..475c038dc7 100644 --- a/gr-digital/include/digital/correlate_access_code_tag_bb.h +++ b/gr-digital/include/gnuradio/digital/correlate_access_code_tag_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_TAG_BB_H #define INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_TAG_BB_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> #include <string> namespace gr { @@ -42,7 +42,7 @@ namespace gr { * key name [tag_name], specified in the constructor. Used for * searching an input data stream for preambles, etc. */ - class DIGITAL_API correlate_access_code_tag_bb : virtual public gr_sync_block + class DIGITAL_API correlate_access_code_tag_bb : virtual public sync_block { public: // gr::digital::correlate_access_code_tag_bb::sptr diff --git a/gr-digital/include/digital/costas_loop_cc.h b/gr-digital/include/gnuradio/digital/costas_loop_cc.h index 8ac0444cb8..38a41a5db5 100644 --- a/gr-digital/include/digital/costas_loop_cc.h +++ b/gr-digital/include/gnuradio/digital/costas_loop_cc.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_COSTAS_LOOP_CC_H #define INCLUDED_DIGITAL_COSTAS_LOOP_CC_H -#include <digital/api.h> -#include <blocks/control_loop.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/blocks/control_loop.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -56,7 +56,7 @@ namespace gr { * stream 2 is the normalized frequency of the loop */ class DIGITAL_API costas_loop_cc - : virtual public gr_sync_block, + : virtual public sync_block, virtual public blocks::control_loop { public: diff --git a/gr-digital/include/digital/cpmmod_bc.h b/gr-digital/include/gnuradio/digital/cpmmod_bc.h index 85fb0fae81..885c653de4 100644 --- a/gr-digital/include/digital/cpmmod_bc.h +++ b/gr-digital/include/gnuradio/digital/cpmmod_bc.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_CPMMOD_BC_H #define INCLUDED_DIGITAL_CPMMOD_BC_H -#include <digital/api.h> -#include <gr_hier_block2.h> -#include <analog/cpm.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/hier_block2.h> +#include <gnuradio/analog/cpm.h> namespace gr { namespace digital { @@ -46,7 +46,7 @@ namespace gr { * The modulator will silently accept any other inputs, though. * The output is the phase-modulated signal. */ - class DIGITAL_API cpmmod_bc : virtual public gr_hier_block2 + class DIGITAL_API cpmmod_bc : virtual public hier_block2 { public: // gr::digital::cpmmod_bc::sptr diff --git a/gr-digital/include/digital/crc32.h b/gr-digital/include/gnuradio/digital/crc32.h index 180719bf73..1f7581fd69 100644 --- a/gr-digital/include/digital/crc32.h +++ b/gr-digital/include/gnuradio/digital/crc32.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_CRC32_H #define INCLUDED_DIGITAL_CRC32_H -#include <digital/api.h> +#include <gnuradio/digital/api.h> #include <string> -#include <gr_types.h> +#include <gnuradio/types.h> namespace gr { namespace digital { diff --git a/gr-digital/include/digital/crc32_bb.h b/gr-digital/include/gnuradio/digital/crc32_bb.h index 52f056c716..79e8a974b8 100644 --- a/gr-digital/include/digital/crc32_bb.h +++ b/gr-digital/include/gnuradio/digital/crc32_bb.h @@ -24,8 +24,8 @@ #ifndef INCLUDED_DIGITAL_CRC32_BB_H #define INCLUDED_DIGITAL_CRC32_BB_H -#include <digital/api.h> -#include <gr_tagged_stream_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/tagged_stream_block.h> namespace gr { namespace digital { @@ -42,7 +42,7 @@ namespace gr { * Output: The same bytes as incoming, but trailing a CRC32 of the packet. * The tag is re-set to the new length. */ - class DIGITAL_API crc32_bb : virtual public gr_tagged_stream_block + class DIGITAL_API crc32_bb : virtual public tagged_stream_block { public: typedef boost::shared_ptr<crc32_bb> sptr; diff --git a/gr-digital/include/digital/descrambler_bb.h b/gr-digital/include/gnuradio/digital/descrambler_bb.h index 9fa1d68425..10efde275e 100644 --- a/gr-digital/include/digital/descrambler_bb.h +++ b/gr-digital/include/gnuradio/digital/descrambler_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_DESCRAMBLER_BB_H #define INCLUDED_GR_DESCRAMBLER_BB_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -38,7 +38,7 @@ namespace gr { * the LSB only of the input data stream, i.e., on an "unpacked * binary" stream, and produces the same format on its output. */ - class DIGITAL_API descrambler_bb : virtual public gr_sync_block + class DIGITAL_API descrambler_bb : virtual public sync_block { public: // gr::digital::descrambler_bb::sptr diff --git a/gr-digital/include/digital/diff_decoder_bb.h b/gr-digital/include/gnuradio/digital/diff_decoder_bb.h index 0b28b2a553..463e65756f 100644 --- a/gr-digital/include/digital/diff_decoder_bb.h +++ b/gr-digital/include/gnuradio/digital/diff_decoder_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_DIFF_DECODER_BB_H #define INCLUDED_GR_DIFF_DECODER_BB_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -37,7 +37,7 @@ namespace gr { * Uses current and previous symbols and the alphabet modulus to * perform differential decoding. */ - class DIGITAL_API diff_decoder_bb : virtual public gr_sync_block + class DIGITAL_API diff_decoder_bb : virtual public sync_block { public: // gr::digital::diff_decoder_bb::sptr diff --git a/gr-digital/include/digital/diff_encoder_bb.h b/gr-digital/include/gnuradio/digital/diff_encoder_bb.h index ef9d0970a0..e59c6e82bd 100644 --- a/gr-digital/include/digital/diff_encoder_bb.h +++ b/gr-digital/include/gnuradio/digital/diff_encoder_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_DIFF_ENCODER_BB_H #define INCLUDED_GR_DIFF_ENCODER_BB_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -37,7 +37,7 @@ namespace gr { * Uses current and previous symbols and the alphabet modulus to * perform differential encoding. */ - class DIGITAL_API diff_encoder_bb : virtual public gr_sync_block + class DIGITAL_API diff_encoder_bb : virtual public sync_block { public: // gr::digital::diff_encoder_bb::sptr diff --git a/gr-digital/include/digital/diff_phasor_cc.h b/gr-digital/include/gnuradio/digital/diff_phasor_cc.h index e2bf2bce59..efcc3b367a 100644 --- a/gr-digital/include/digital/diff_phasor_cc.h +++ b/gr-digital/include/gnuradio/digital/diff_phasor_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_DIFF_PHASOR_CC_H #define INCLUDED_GR_DIFF_PHASOR_CC_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -39,7 +39,7 @@ namespace gr { * * out[i] = in[i] * conj(in[i-1]); */ - class DIGITAL_API diff_phasor_cc : virtual public gr_sync_block + class DIGITAL_API diff_phasor_cc : virtual public sync_block { public: // gr::digital::diff_phasor_cc::sptr diff --git a/gr-digital/include/digital/fll_band_edge_cc.h b/gr-digital/include/gnuradio/digital/fll_band_edge_cc.h index 0bf3471112..309c23a496 100644 --- a/gr-digital/include/digital/fll_band_edge_cc.h +++ b/gr-digital/include/gnuradio/digital/fll_band_edge_cc.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_H #define INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_H -#include <digital/api.h> -#include <gr_sync_block.h> -#include <blocks/control_loop.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/blocks/control_loop.h> namespace gr { namespace digital { @@ -81,7 +81,7 @@ namespace gr { * large. */ class DIGITAL_API fll_band_edge_cc - : virtual public gr_sync_block, + : virtual public sync_block, virtual public blocks::control_loop { public: diff --git a/gr-digital/include/digital/framer_sink_1.h b/gr-digital/include/gnuradio/digital/framer_sink_1.h index b562778704..7d13e4d6c0 100644 --- a/gr-digital/include/digital/framer_sink_1.h +++ b/gr-digital/include/gnuradio/digital/framer_sink_1.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_FRAMER_SINK_1_H #define INCLUDED_GR_FRAMER_SINK_1_H -#include <digital/api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> namespace gr { namespace digital { @@ -48,7 +48,7 @@ namespace gr { * the corresponding bit is the the first bit of the packet. That * is, this bit is the first one after the access code. */ - class DIGITAL_API framer_sink_1 : virtual public gr_sync_block + class DIGITAL_API framer_sink_1 : virtual public sync_block { public: // gr::digital::framer_sink_1::sptr @@ -59,7 +59,7 @@ namespace gr { * * \param target_queue The message queue where frames go. */ - static sptr make(gr_msg_queue_sptr target_queue); + static sptr make(msg_queue::sptr target_queue); }; } /* namespace digital */ diff --git a/gr-digital/include/digital/glfsr.h b/gr-digital/include/gnuradio/digital/glfsr.h index 4c7701d7ee..445904969e 100644 --- a/gr-digital/include/digital/glfsr.h +++ b/gr-digital/include/gnuradio/digital/glfsr.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_GLFSR_H #define INCLUDED_DIGITAL_GLFSR_H -#include <digital/api.h> +#include <gnuradio/digital/api.h> namespace gr { namespace digital { diff --git a/gr-digital/include/digital/glfsr_source_b.h b/gr-digital/include/gnuradio/digital/glfsr_source_b.h index 7fefb747aa..3491d73315 100644 --- a/gr-digital/include/digital/glfsr_source_b.h +++ b/gr-digital/include/gnuradio/digital/glfsr_source_b.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_GLFSR_SOURCE_B_H #define INCLUDED_GR_GLFSR_SOURCE_B_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -33,7 +33,7 @@ namespace gr { * \brief Galois LFSR pseudo-random source * \ingroup waveform_generators_blk */ - class DIGITAL_API glfsr_source_b : virtual public gr_sync_block + class DIGITAL_API glfsr_source_b : virtual public sync_block { public: // gr::digital::glfsr_source_b::sptr diff --git a/gr-digital/include/digital/glfsr_source_f.h b/gr-digital/include/gnuradio/digital/glfsr_source_f.h index e591498d8c..24c0713792 100644 --- a/gr-digital/include/digital/glfsr_source_f.h +++ b/gr-digital/include/gnuradio/digital/glfsr_source_f.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_GLFSR_SOURCE_F_H #define INCLUDED_GR_GLFSR_SOURCE_F_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -33,7 +33,7 @@ namespace gr { * \brief Galois LFSR pseudo-random source generating float outputs -1.0 - 1.0. * \ingroup waveform_generators_blk */ - class DIGITAL_API glfsr_source_f : virtual public gr_sync_block + class DIGITAL_API glfsr_source_f : virtual public sync_block { public: // gr::digital::glfsr_source_f::sptr diff --git a/gr-digital/include/digital/header_payload_demux.h b/gr-digital/include/gnuradio/digital/header_payload_demux.h index 1427062d77..b3b7c596ef 100644 --- a/gr-digital/include/digital/header_payload_demux.h +++ b/gr-digital/include/gnuradio/digital/header_payload_demux.h @@ -22,8 +22,8 @@ #ifndef INCLUDED_DIGITAL_HEADER_PAYLOAD_DEMUX_H #define INCLUDED_DIGITAL_HEADER_PAYLOAD_DEMUX_H -#include <digital/api.h> -#include <gr_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/block.h> namespace gr { namespace digital { @@ -59,7 +59,7 @@ namespace gr { * A special case are tags on items that make up the guard interval. These are copied * to the first item of the following symbol. */ - class DIGITAL_API header_payload_demux : virtual public gr_block + class DIGITAL_API header_payload_demux : virtual public block { public: typedef boost::shared_ptr<header_payload_demux> sptr; diff --git a/gr-digital/include/digital/kurtotic_equalizer_cc.h b/gr-digital/include/gnuradio/digital/kurtotic_equalizer_cc.h index be8c5f5cc2..a23cfa1377 100644 --- a/gr-digital/include/digital/kurtotic_equalizer_cc.h +++ b/gr-digital/include/gnuradio/digital/kurtotic_equalizer_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_H #define INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_H -#include <digital/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace digital { @@ -41,7 +41,7 @@ namespace gr { * Robotics and Vision, Vol. 3, Dec. 2004, pp. 2052 - 2057." */ class DIGITAL_API kurtotic_equalizer_cc : - virtual public gr_sync_decimator + virtual public sync_decimator { protected: virtual gr_complex error(const gr_complex &out) = 0; diff --git a/gr-digital/include/digital/lfsr.h b/gr-digital/include/gnuradio/digital/lfsr.h index 0dd419b791..ce82f6f5e1 100644 --- a/gr-digital/include/digital/lfsr.h +++ b/gr-digital/include/gnuradio/digital/lfsr.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_LFSR_H #define INCLUDED_DIGITAL_LFSR_H -#include <digital/api.h> +#include <gnuradio/digital/api.h> #include <stdexcept> #include <stdint.h> diff --git a/gr-digital/include/digital/lms_dd_equalizer_cc.h b/gr-digital/include/gnuradio/digital/lms_dd_equalizer_cc.h index 7286c9ad3c..01e5b6e71a 100644 --- a/gr-digital/include/digital/lms_dd_equalizer_cc.h +++ b/gr-digital/include/gnuradio/digital/lms_dd_equalizer_cc.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_H #define INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_H -#include <digital/api.h> -#include <gr_sync_decimator.h> -#include <digital/constellation.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_decimator.h> +#include <gnuradio/digital/constellation.h> namespace gr { namespace digital { @@ -65,7 +65,7 @@ namespace gr { * Prentice Hall, 1996. */ class DIGITAL_API lms_dd_equalizer_cc : - virtual public gr_sync_decimator + virtual public sync_decimator { protected: virtual gr_complex error(const gr_complex &out) = 0; diff --git a/gr-digital/include/digital/map_bb.h b/gr-digital/include/gnuradio/digital/map_bb.h index 0a55a61213..e1bbb1d9b5 100644 --- a/gr-digital/include/digital/map_bb.h +++ b/gr-digital/include/gnuradio/digital/map_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_MAP_BB_H #define INCLUDED_GR_MAP_BB_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -40,7 +40,7 @@ namespace gr { * * -> output[i] = map[input[i]] */ - class DIGITAL_API map_bb : virtual public gr_sync_block + class DIGITAL_API map_bb : virtual public sync_block { public: // gr::digital::map_bb::sptr diff --git a/gr-digital/include/digital/metric_type.h b/gr-digital/include/gnuradio/digital/metric_type.h index c277f01d27..c277f01d27 100644 --- a/gr-digital/include/digital/metric_type.h +++ b/gr-digital/include/gnuradio/digital/metric_type.h diff --git a/gr-digital/include/digital/mpsk_receiver_cc.h b/gr-digital/include/gnuradio/digital/mpsk_receiver_cc.h index 68874d178e..94e765d4ac 100644 --- a/gr-digital/include/digital/mpsk_receiver_cc.h +++ b/gr-digital/include/gnuradio/digital/mpsk_receiver_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_MPSK_RECEIVER_CC_H #define INCLUDED_DIGITAL_MPSK_RECEIVER_CC_H -#include <digital/api.h> -#include <gr_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/block.h> namespace gr { namespace digital { @@ -65,7 +65,7 @@ namespace gr { * self-noise. * */ - class DIGITAL_API mpsk_receiver_cc : virtual public gr_block + class DIGITAL_API mpsk_receiver_cc : virtual public block { public: // gr::digital::mpsk_receiver_cc::sptr diff --git a/gr-digital/include/digital/mpsk_snr_est.h b/gr-digital/include/gnuradio/digital/mpsk_snr_est.h index f9edcbd05a..46df06164d 100644 --- a/gr-digital/include/digital/mpsk_snr_est.h +++ b/gr-digital/include/gnuradio/digital/mpsk_snr_est.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_MPSK_SNR_EST_H #define INCLUDED_DIGITAL_MPSK_SNR_EST_H -#include <digital/api.h> -#include <gr_complex.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/gr_complex.h> namespace gr { namespace digital { diff --git a/gr-digital/include/digital/mpsk_snr_est_cc.h b/gr-digital/include/gnuradio/digital/mpsk_snr_est_cc.h index 14e8ca3b20..41a649cf58 100644 --- a/gr-digital/include/digital/mpsk_snr_est_cc.h +++ b/gr-digital/include/gnuradio/digital/mpsk_snr_est_cc.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_MPSK_SNR_EST_CC_H #define INCLUDED_DIGITAL_MPSK_SNR_EST_CC_H -#include <digital/api.h> -#include <digital/mpsk_snr_est.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/digital/mpsk_snr_est.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -49,7 +49,7 @@ namespace gr { * amount of error should be assumed and/or estimated for real * channel conditions. */ - class DIGITAL_API mpsk_snr_est_cc : virtual public gr_sync_block + class DIGITAL_API mpsk_snr_est_cc : virtual public sync_block { public: // gr::digital::mpsk_snr_est_cc::sptr diff --git a/gr-digital/include/digital/ofdm_carrier_allocator_cvc.h b/gr-digital/include/gnuradio/digital/ofdm_carrier_allocator_cvc.h index 2eaeb75611..26b11fceb4 100644 --- a/gr-digital/include/digital/ofdm_carrier_allocator_cvc.h +++ b/gr-digital/include/gnuradio/digital/ofdm_carrier_allocator_cvc.h @@ -24,8 +24,8 @@ #ifndef INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H #define INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H -#include <digital/api.h> -#include <gr_tagged_stream_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/tagged_stream_block.h> namespace gr { namespace digital { @@ -57,7 +57,7 @@ namespace gr { * \p fft_len-1 both identify the carrier below the DC carrier. * */ - class DIGITAL_API ofdm_carrier_allocator_cvc : virtual public gr_tagged_stream_block + class DIGITAL_API ofdm_carrier_allocator_cvc : virtual public tagged_stream_block { public: typedef boost::shared_ptr<ofdm_carrier_allocator_cvc> sptr; diff --git a/gr-digital/include/digital/ofdm_chanest_vcvc.h b/gr-digital/include/gnuradio/digital/ofdm_chanest_vcvc.h index 0607743d57..e3f9975d8f 100644 --- a/gr-digital/include/digital/ofdm_chanest_vcvc.h +++ b/gr-digital/include/gnuradio/digital/ofdm_chanest_vcvc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_OFDM_CHANEST_VCVC_H #define INCLUDED_DIGITAL_OFDM_CHANEST_VCVC_H -#include <digital/api.h> -#include <gr_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/block.h> namespace gr { namespace digital { @@ -53,7 +53,7 @@ namespace gr { * Communications, IEEE Transactions on, 1997. * [2] K.D. Kammeyer, "Nachrichtenuebertragung," Chapter. 16.3.2. */ - class DIGITAL_API ofdm_chanest_vcvc : virtual public gr_block + class DIGITAL_API ofdm_chanest_vcvc : virtual public block { public: typedef boost::shared_ptr<ofdm_chanest_vcvc> sptr; diff --git a/gr-digital/include/digital/ofdm_cyclic_prefixer.h b/gr-digital/include/gnuradio/digital/ofdm_cyclic_prefixer.h index f8e45edd90..70d37a6bc1 100644 --- a/gr-digital/include/digital/ofdm_cyclic_prefixer.h +++ b/gr-digital/include/gnuradio/digital/ofdm_cyclic_prefixer.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H #define INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H -#include <digital/api.h> -#include <gr_tagged_stream_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/tagged_stream_block.h> namespace gr { namespace digital { @@ -46,7 +46,7 @@ namespace gr { * * The pulse shape is a raised cosine in the time domain. */ - class DIGITAL_API ofdm_cyclic_prefixer : virtual public gr_tagged_stream_block + class DIGITAL_API ofdm_cyclic_prefixer : virtual public tagged_stream_block { public: typedef boost::shared_ptr<ofdm_cyclic_prefixer> sptr; diff --git a/gr-digital/include/digital/ofdm_equalizer_base.h b/gr-digital/include/gnuradio/digital/ofdm_equalizer_base.h index 4e3a88d589..c1e47ea1d5 100644 --- a/gr-digital/include/digital/ofdm_equalizer_base.h +++ b/gr-digital/include/gnuradio/digital/ofdm_equalizer_base.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_DIGITAL_OFDM_EQUALIZER_BASE_H #define INCLUDED_DIGITAL_OFDM_EQUALIZER_BASE_H -#include <digital/api.h> -#include <gr_tags.h> -#include <gr_complex.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/tags.h> +#include <gnuradio/gr_complex.h> #include <boost/enable_shared_from_this.hpp> namespace gr { @@ -55,7 +55,7 @@ namespace gr { gr_complex *frame, int n_sym, const std::vector<gr_complex> &initial_taps = std::vector<gr_complex>(), - const std::vector<gr_tag_t> &tags = std::vector<gr_tag_t>()) = 0; + const std::vector<tag_t> &tags = std::vector<tag_t>()) = 0; //! Return the current channel state virtual void get_channel_state(std::vector<gr_complex> &taps) = 0; int fft_len() { return d_fft_len; }; diff --git a/gr-digital/include/digital/ofdm_equalizer_simpledfe.h b/gr-digital/include/gnuradio/digital/ofdm_equalizer_simpledfe.h index 7bf6950965..d526f9f157 100644 --- a/gr-digital/include/digital/ofdm_equalizer_simpledfe.h +++ b/gr-digital/include/gnuradio/digital/ofdm_equalizer_simpledfe.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_DIGITAL_OFDM_EQUALIZER_SIMPLEDFE_H #define INCLUDED_DIGITAL_OFDM_EQUALIZER_SIMPLEDFE_H -#include <digital/api.h> -#include <digital/constellation.h> -#include <digital/ofdm_equalizer_base.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/digital/constellation.h> +#include <gnuradio/digital/ofdm_equalizer_base.h> namespace gr { namespace digital { @@ -80,7 +80,7 @@ namespace gr { void equalize(gr_complex *frame, int n_sym, const std::vector<gr_complex> &initial_taps = std::vector<gr_complex>(), - const std::vector<gr_tag_t> &tags = std::vector<gr_tag_t>()); + const std::vector<tag_t> &tags = std::vector<tag_t>()); /* * \param fft_len FFT length diff --git a/gr-digital/include/digital/ofdm_equalizer_static.h b/gr-digital/include/gnuradio/digital/ofdm_equalizer_static.h index 6507479f4b..892025c2b0 100644 --- a/gr-digital/include/digital/ofdm_equalizer_static.h +++ b/gr-digital/include/gnuradio/digital/ofdm_equalizer_static.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_DIGITAL_OFDM_EQUALIZER_STATIC_H #define INCLUDED_DIGITAL_OFDM_EQUALIZER_STATIC_H -#include <digital/api.h> -#include <digital/constellation.h> -#include <digital/ofdm_equalizer_base.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/digital/constellation.h> +#include <gnuradio/digital/ofdm_equalizer_base.h> namespace gr { namespace digital { @@ -67,7 +67,7 @@ namespace gr { void equalize(gr_complex *frame, int n_sym, const std::vector<gr_complex> &initial_taps = std::vector<gr_complex>(), - const std::vector<gr_tag_t> &tags = std::vector<gr_tag_t>()); + const std::vector<tag_t> &tags = std::vector<tag_t>()); /* * \param fft_len FFT length diff --git a/gr-digital/include/digital/ofdm_frame_acquisition.h b/gr-digital/include/gnuradio/digital/ofdm_frame_acquisition.h index b8f8ff7662..a398e18454 100644 --- a/gr-digital/include/digital/ofdm_frame_acquisition.h +++ b/gr-digital/include/gnuradio/digital/ofdm_frame_acquisition.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_H #define INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_H -#include <digital/api.h> -#include <gr_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/block.h> #include <vector> namespace gr { @@ -49,7 +49,7 @@ namespace gr { * equalization on all subcarriers. This corrects for the phase * and amplitude distortion caused by the channel. */ - class DIGITAL_API ofdm_frame_acquisition : virtual public gr_block + class DIGITAL_API ofdm_frame_acquisition : virtual public block { public: // gr::digital::ofdm_frame_acquisition::sptr diff --git a/gr-digital/include/digital/ofdm_frame_equalizer_vcvc.h b/gr-digital/include/gnuradio/digital/ofdm_frame_equalizer_vcvc.h index 3be014d455..afc8b0ff6e 100644 --- a/gr-digital/include/digital/ofdm_frame_equalizer_vcvc.h +++ b/gr-digital/include/gnuradio/digital/ofdm_frame_equalizer_vcvc.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_OFDM_FRAME_EQUALIZER_VCVC_H #define INCLUDED_OFDM_FRAME_EQUALIZER_VCVC_H -#include <digital/api.h> -#include <digital/ofdm_equalizer_base.h> -#include <gr_tagged_stream_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/digital/ofdm_equalizer_base.h> +#include <gnuradio/tagged_stream_block.h> namespace gr { namespace digital { @@ -38,7 +38,7 @@ namespace gr { * Input: a tagged series of OFDM symbols. * Output: The same as the input, but equalized. */ - class DIGITAL_API ofdm_frame_equalizer_vcvc : virtual public gr_tagged_stream_block + class DIGITAL_API ofdm_frame_equalizer_vcvc : virtual public tagged_stream_block { public: typedef boost::shared_ptr<ofdm_frame_equalizer_vcvc> sptr; diff --git a/gr-digital/include/digital/ofdm_frame_sink.h b/gr-digital/include/gnuradio/digital/ofdm_frame_sink.h index ff31bad919..439e1ca135 100644 --- a/gr-digital/include/digital/ofdm_frame_sink.h +++ b/gr-digital/include/gnuradio/digital/ofdm_frame_sink.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_OFDM_FRAME_SINK_H #define INCLUDED_DIGITAL_OFDM_FRAME_SINK_H -#include <digital/api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> namespace gr { namespace digital { @@ -42,7 +42,7 @@ namespace gr { * reference to an object to do the demapping and slicing for a * given modulation type. */ - class DIGITAL_API ofdm_frame_sink : virtual public gr_sync_block + class DIGITAL_API ofdm_frame_sink : virtual public sync_block { public: // gr::digital::ofdm_frame_sink::sptr @@ -60,7 +60,7 @@ namespace gr { */ static sptr make(const std::vector<gr_complex> &sym_position, const std::vector<char> &sym_value_out, - gr_msg_queue_sptr target_queue, + msg_queue::sptr target_queue, int occupied_tones, float phase_gain=0.25, float freq_gain=0.25*0.25/4); }; diff --git a/gr-digital/include/digital/ofdm_insert_preamble.h b/gr-digital/include/gnuradio/digital/ofdm_insert_preamble.h index a9ad61e1d0..a98e7cf814 100644 --- a/gr-digital/include/digital/ofdm_insert_preamble.h +++ b/gr-digital/include/gnuradio/digital/ofdm_insert_preamble.h @@ -22,8 +22,8 @@ #ifndef INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H #define INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H -#include <digital/api.h> -#include <gr_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/block.h> #include <vector> namespace gr { @@ -55,7 +55,7 @@ namespace gr { * symbol is the first symbol, otherwise 0. * </pre> */ - class DIGITAL_API ofdm_insert_preamble : virtual public gr_block + class DIGITAL_API ofdm_insert_preamble : virtual public block { public: // gr::digital::ofdm_insert_preamble::sptr diff --git a/gr-digital/include/digital/ofdm_mapper_bcv.h b/gr-digital/include/gnuradio/digital/ofdm_mapper_bcv.h index 49ae9adc92..cdd4a60bc2 100644 --- a/gr-digital/include/digital/ofdm_mapper_bcv.h +++ b/gr-digital/include/gnuradio/digital/ofdm_mapper_bcv.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_OFDM_MAPPER_BCV_H #define INCLUDED_DIGITAL_OFDM_MAPPER_BCV_H -#include <digital/api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> namespace gr { namespace digital { @@ -39,7 +39,7 @@ namespace gr { * \details * Abstract class must be subclassed with specific mapping. */ - class DIGITAL_API ofdm_mapper_bcv : virtual public gr_sync_block + class DIGITAL_API ofdm_mapper_bcv : virtual public sync_block { public: // gr::digital::ofdm_mapper_bcv::sptr @@ -58,7 +58,7 @@ namespace gr { unsigned occupied_carriers, unsigned int fft_length); - virtual gr_msg_queue_sptr msgq() const = 0; + virtual msg_queue::sptr msgq() const = 0; }; } /* namespace digital */ diff --git a/gr-digital/include/digital/ofdm_sampler.h b/gr-digital/include/gnuradio/digital/ofdm_sampler.h index 5df16be3e4..59bc36a7c2 100644 --- a/gr-digital/include/digital/ofdm_sampler.h +++ b/gr-digital/include/gnuradio/digital/ofdm_sampler.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_OFDM_SAMPLER_H #define INCLUDED_DIGITAL_OFDM_SAMPLER_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -33,7 +33,7 @@ namespace gr { * \brief does the rest of the OFDM stuff * \ingroup ofdm_blk */ - class DIGITAL_API ofdm_sampler : virtual public gr_block + class DIGITAL_API ofdm_sampler : virtual public block { public: // gr::digital::ofdm_sampler::sptr diff --git a/gr-digital/include/digital/ofdm_serializer_vcc.h b/gr-digital/include/gnuradio/digital/ofdm_serializer_vcc.h index f02b0f85bb..bfaefbc96e 100644 --- a/gr-digital/include/digital/ofdm_serializer_vcc.h +++ b/gr-digital/include/gnuradio/digital/ofdm_serializer_vcc.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_DIGITAL_OFDM_SERIALIZER_VCC_H #define INCLUDED_DIGITAL_OFDM_SERIALIZER_VCC_H -#include <digital/api.h> -#include <gr_tagged_stream_block.h> -#include <digital/ofdm_carrier_allocator_cvc.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/tagged_stream_block.h> +#include <gnuradio/digital/ofdm_carrier_allocator_cvc.h> namespace gr { namespace digital { @@ -49,7 +49,7 @@ namespace gr { * Input: Complex vectors of length \p fft_len * Output: Complex scalars, in the same order as specified in occupied_carriers. */ - class DIGITAL_API ofdm_serializer_vcc : virtual public gr_tagged_stream_block + class DIGITAL_API ofdm_serializer_vcc : virtual public tagged_stream_block { public: typedef boost::shared_ptr<ofdm_serializer_vcc> sptr; diff --git a/gr-digital/include/digital/ofdm_sync_sc_cfb.h b/gr-digital/include/gnuradio/digital/ofdm_sync_sc_cfb.h index 84f3e704a3..822e109221 100644 --- a/gr-digital/include/digital/ofdm_sync_sc_cfb.h +++ b/gr-digital/include/gnuradio/digital/ofdm_sync_sc_cfb.h @@ -24,8 +24,8 @@ #ifndef INCLUDED_DIGITAL_OFDM_SYNC_SC_CFB_H #define INCLUDED_DIGITAL_OFDM_SYNC_SC_CFB_H -#include <digital/api.h> -#include <gr_hier_block2.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/hier_block2.h> namespace gr { namespace digital { @@ -61,7 +61,7 @@ namespace gr { * [1] Schmidl, T.M. and Cox, D.C., "Robust frequency and timing synchronization for OFDM", * Communications, IEEE Transactions on, 1997. */ - class DIGITAL_API ofdm_sync_sc_cfb : virtual public gr_hier_block2 + class DIGITAL_API ofdm_sync_sc_cfb : virtual public hier_block2 { public: typedef boost::shared_ptr<ofdm_sync_sc_cfb> sptr; diff --git a/gr-digital/include/digital/packet_header_default.h b/gr-digital/include/gnuradio/digital/packet_header_default.h index e4c994593f..c7f1833d11 100644 --- a/gr-digital/include/digital/packet_header_default.h +++ b/gr-digital/include/gnuradio/digital/packet_header_default.h @@ -22,8 +22,8 @@ #ifndef INCLUDED_DIGITAL_PACKET_HEADER_DEFAULT_H #define INCLUDED_DIGITAL_PACKET_HEADER_DEFAULT_H -#include <gr_tags.h> -#include <digital/api.h> +#include <gnuradio/tags.h> +#include <gnuradio/digital/api.h> #include <boost/enable_shared_from_this.hpp> namespace gr { @@ -79,7 +79,7 @@ namespace gr { virtual bool header_formatter( long packet_len, unsigned char *out, - const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>() + const std::vector<tag_t> &tags=std::vector<tag_t>() ); /*! @@ -89,7 +89,7 @@ namespace gr { */ virtual bool header_parser( const unsigned char *header, - std::vector<gr_tag_t> &tags); + std::vector<tag_t> &tags); static sptr make( long header_len, diff --git a/gr-digital/include/digital/packet_header_ofdm.h b/gr-digital/include/gnuradio/digital/packet_header_ofdm.h index 3a477580ce..4603450915 100644 --- a/gr-digital/include/digital/packet_header_ofdm.h +++ b/gr-digital/include/gnuradio/digital/packet_header_ofdm.h @@ -23,8 +23,8 @@ #define INCLUDED_DIGITAL_PACKET_HEADER_OFDM_H #include <vector> -#include <digital/api.h> -#include <digital/packet_header_default.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/digital/packet_header_default.h> namespace gr { namespace digital { @@ -60,7 +60,7 @@ namespace gr { */ bool header_parser( const unsigned char *header, - std::vector<gr_tag_t> &tags); + std::vector<tag_t> &tags); /*! * \param occupied_carriers See carrier allocator diff --git a/gr-digital/include/digital/packet_headergenerator_bb.h b/gr-digital/include/gnuradio/digital/packet_headergenerator_bb.h index 426f49dee5..1ad67b7031 100644 --- a/gr-digital/include/digital/packet_headergenerator_bb.h +++ b/gr-digital/include/gnuradio/digital/packet_headergenerator_bb.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_PACKET_HEADERGENERATOR_BB_H #define INCLUDED_PACKET_HEADERGENERATOR_BB_H -#include <digital/api.h> -#include <gr_tagged_stream_block.h> -#include <digital/packet_header_default.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/tagged_stream_block.h> +#include <gnuradio/digital/packet_header_default.h> namespace gr { namespace digital { @@ -41,7 +41,7 @@ namespace gr { * or a subclass thereof). If only a number of bits is specified, a * default header is generated (see packet_header_default). */ - class DIGITAL_API packet_headergenerator_bb : virtual public gr_tagged_stream_block + class DIGITAL_API packet_headergenerator_bb : virtual public tagged_stream_block { public: typedef boost::shared_ptr<packet_headergenerator_bb> sptr; diff --git a/gr-digital/include/digital/packet_headerparser_b.h b/gr-digital/include/gnuradio/digital/packet_headerparser_b.h index cdf76f1209..a0ca48f192 100644 --- a/gr-digital/include/digital/packet_headerparser_b.h +++ b/gr-digital/include/gnuradio/digital/packet_headerparser_b.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_DIGITAL_PACKET_HEADERPARSER_B_H #define INCLUDED_DIGITAL_PACKET_HEADERPARSER_B_H -#include <digital/api.h> -#include <gr_sync_block.h> -#include <digital/packet_header_default.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/digital/packet_header_default.h> namespace gr { namespace digital { @@ -46,7 +46,7 @@ namespace gr { * If only a header length is given, this block uses the default header * format. */ - class DIGITAL_API packet_headerparser_b : virtual public gr_sync_block + class DIGITAL_API packet_headerparser_b : virtual public sync_block { public: typedef boost::shared_ptr<packet_headerparser_b> sptr; diff --git a/gr-digital/include/digital/packet_sink.h b/gr-digital/include/gnuradio/digital/packet_sink.h index 42f826535f..a0a56bc4ff 100644 --- a/gr-digital/include/digital/packet_sink.h +++ b/gr-digital/include/gnuradio/digital/packet_sink.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_PACKET_SINK_H #define INCLUDED_GR_PACKET_SINK_H -#include <digital/api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> namespace gr { namespace digital { @@ -53,7 +53,7 @@ namespace gr { * generally be replaced with a correlate access code and frame * sink blocks. */ - class DIGITAL_API packet_sink : virtual public gr_sync_block + class DIGITAL_API packet_sink : virtual public sync_block { public: // gr::digital::packet_sink::sptr @@ -67,7 +67,7 @@ namespace gr { * \param threshold Number of bits that can be incorrect in the \p sync_vector. */ static sptr make(const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, + msg_queue::sptr target_queue, int threshold=-1); //! return true if we detect carrier diff --git a/gr-digital/include/digital/pfb_clock_sync_ccf.h b/gr-digital/include/gnuradio/digital/pfb_clock_sync_ccf.h index 2cdb55ca4a..d4d61bbf4f 100644 --- a/gr-digital/include/digital/pfb_clock_sync_ccf.h +++ b/gr-digital/include/gnuradio/digital/pfb_clock_sync_ccf.h @@ -24,9 +24,9 @@ #ifndef INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_H #define INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_H -#include <digital/api.h> -#include <filter/fir_filter.h> -#include <gr_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/block.h> namespace gr { namespace digital { @@ -146,7 +146,7 @@ namespace gr { * was added to better work with equalizers, which do a better job * of modeling the channel if they have 2 samps/sym. */ - class DIGITAL_API pfb_clock_sync_ccf : virtual public gr_block + class DIGITAL_API pfb_clock_sync_ccf : virtual public block { public: // gr::digital::pfb_clock_sync_ccf::sptr diff --git a/gr-digital/include/digital/pfb_clock_sync_fff.h b/gr-digital/include/gnuradio/digital/pfb_clock_sync_fff.h index f0fc6df314..38d8f69f2f 100644 --- a/gr-digital/include/digital/pfb_clock_sync_fff.h +++ b/gr-digital/include/gnuradio/digital/pfb_clock_sync_fff.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_H #define INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_H -#include <digital/api.h> -#include <filter/fir_filter.h> -#include <gr_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/block.h> namespace gr { namespace digital { @@ -145,7 +145,7 @@ namespace gr { * was added to better work with equalizers, which do a better job * of modeling the channel if they have 2 samps/sym. */ - class DIGITAL_API pfb_clock_sync_fff : virtual public gr_block + class DIGITAL_API pfb_clock_sync_fff : virtual public block { public: // gr::digital::pfb_clock_sync_fff::sptr diff --git a/gr-digital/include/digital/pn_correlator_cc.h b/gr-digital/include/gnuradio/digital/pn_correlator_cc.h index 147983f892..c98f086aa0 100644 --- a/gr-digital/include/digital/pn_correlator_cc.h +++ b/gr-digital/include/gnuradio/digital/pn_correlator_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_PN_CORRELATOR_CC_H #define INCLUDED_GR_PN_CORRELATOR_CC_H -#include <digital/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace digital { @@ -38,7 +38,7 @@ namespace gr { * against reference PN code, one sample per PN code period. The * PN sequence is generated using a GLFSR. */ - class DIGITAL_API pn_correlator_cc : virtual public gr_sync_decimator + class DIGITAL_API pn_correlator_cc : virtual public sync_decimator { public: // gr::digital::pn_correlator_cc::sptr diff --git a/gr-digital/include/digital/probe_density_b.h b/gr-digital/include/gnuradio/digital/probe_density_b.h index b0343d2cfb..ff5ce22080 100644 --- a/gr-digital/include/digital/probe_density_b.h +++ b/gr-digital/include/gnuradio/digital/probe_density_b.h @@ -21,8 +21,8 @@ #ifndef INCLUDED_GR_PROBE_DENSITY_B_H #define INCLUDED_GR_PROBE_DENSITY_B_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -37,7 +37,7 @@ namespace gr { * If you send this block a stream of unpacked bytes, it will tell * you what the bit density is. */ - class DIGITAL_API probe_density_b : virtual public gr_sync_block + class DIGITAL_API probe_density_b : virtual public sync_block { public: // gr::digital::probe_density_b::sptr diff --git a/gr-digital/include/digital/probe_mpsk_snr_est_c.h b/gr-digital/include/gnuradio/digital/probe_mpsk_snr_est_c.h index 289940cdd1..f78c767bf1 100644 --- a/gr-digital/include/digital/probe_mpsk_snr_est_c.h +++ b/gr-digital/include/gnuradio/digital/probe_mpsk_snr_est_c.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_H #define INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_H -#include <digital/api.h> -#include <digital/mpsk_snr_est.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/digital/mpsk_snr_est.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -46,7 +46,7 @@ namespace gr { * conditions; some amount of error should be assumed and/or * estimated for real channel conditions. */ - class DIGITAL_API probe_mpsk_snr_est_c : virtual public gr_sync_block + class DIGITAL_API probe_mpsk_snr_est_c : virtual public sync_block { public: // gr::digital::probe_mpsk_snr_est_c::sptr diff --git a/gr-digital/include/digital/scrambler_bb.h b/gr-digital/include/gnuradio/digital/scrambler_bb.h index 6360662dae..4ba83daf60 100644 --- a/gr-digital/include/digital/scrambler_bb.h +++ b/gr-digital/include/gnuradio/digital/scrambler_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_SCRAMBLER_BB_H #define INCLUDED_GR_SCRAMBLER_BB_H -#include <digital/api.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { @@ -38,7 +38,7 @@ namespace gr { * i.e., on an "unpacked binary" stream, and produces the same * format on its output. */ - class DIGITAL_API scrambler_bb : virtual public gr_sync_block + class DIGITAL_API scrambler_bb : virtual public sync_block { public: // gr::digital::scrambler_bb::sptr diff --git a/gr-digital/include/digital/simple_correlator.h b/gr-digital/include/gnuradio/digital/simple_correlator.h index 5cb7ddc6ee..763705c6b9 100644 --- a/gr-digital/include/digital/simple_correlator.h +++ b/gr-digital/include/gnuradio/digital/simple_correlator.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_SIMPLE_CORRELATOR_H #define INCLUDED_GR_SIMPLE_CORRELATOR_H -#include <digital/api.h> -#include <gr_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/block.h> namespace gr { namespace digital { @@ -34,7 +34,7 @@ namespace gr { * \ingroup packet_operators_blk * \ingroup deprecated_blk */ - class DIGITAL_API simple_correlator : virtual public gr_block + class DIGITAL_API simple_correlator : virtual public block { public: // gr::digital::simple_correlator::sptr diff --git a/gr-digital/include/digital/simple_framer.h b/gr-digital/include/gnuradio/digital/simple_framer.h index 951e13d8f2..f0588eb20e 100644 --- a/gr-digital/include/digital/simple_framer.h +++ b/gr-digital/include/gnuradio/digital/simple_framer.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_SIMPLE_FRAMER_H #define INCLUDED_GR_SIMPLE_FRAMER_H -#include <digital/api.h> -#include <gr_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/block.h> namespace gr { namespace digital { @@ -39,7 +39,7 @@ namespace gr { * frame is prepended with the GRSF_SYNC (defind in * simple_framer_sync.h) and an 8-bit sequence number. */ - class DIGITAL_API simple_framer : virtual public gr_block + class DIGITAL_API simple_framer : virtual public block { public: // gr::digital::simple_framer::sptr diff --git a/gr-digital/include/digital/simple_framer_sync.h b/gr-digital/include/gnuradio/digital/simple_framer_sync.h index f6c8f148e6..f6c8f148e6 100644 --- a/gr-digital/include/digital/simple_framer_sync.h +++ b/gr-digital/include/gnuradio/digital/simple_framer_sync.h diff --git a/gr-digital/lib/additive_scrambler_bb_impl.cc b/gr-digital/lib/additive_scrambler_bb_impl.cc index 8238f2d988..8f2229e6b6 100644 --- a/gr-digital/lib/additive_scrambler_bb_impl.cc +++ b/gr-digital/lib/additive_scrambler_bb_impl.cc @@ -25,7 +25,7 @@ #endif #include "additive_scrambler_bb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace digital { @@ -41,9 +41,9 @@ namespace gr { int seed, int len, int count) - : gr_sync_block("additive_scrambler_bb", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(unsigned char))), + : sync_block("additive_scrambler_bb", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(unsigned char))), d_lfsr(mask, seed, len), d_count(count), d_bits(0), d_len(len), d_seed(seed) diff --git a/gr-digital/lib/additive_scrambler_bb_impl.h b/gr-digital/lib/additive_scrambler_bb_impl.h index 5a4c2f5025..b621637e67 100644 --- a/gr-digital/lib/additive_scrambler_bb_impl.h +++ b/gr-digital/lib/additive_scrambler_bb_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_IMPL_H #define INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_IMPL_H -#include <digital/additive_scrambler_bb.h> -#include <digital/lfsr.h> +#include <gnuradio/digital/additive_scrambler_bb.h> +#include <gnuradio/digital/lfsr.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/binary_slicer_fb_impl.cc b/gr-digital/lib/binary_slicer_fb_impl.cc index f8a9cf22de..335e2e549a 100644 --- a/gr-digital/lib/binary_slicer_fb_impl.cc +++ b/gr-digital/lib/binary_slicer_fb_impl.cc @@ -25,8 +25,8 @@ #endif #include "binary_slicer_fb_impl.h" -#include <gr_io_signature.h> -#include <gr_math.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/math.h> namespace gr { namespace digital { @@ -37,9 +37,9 @@ namespace gr { } binary_slicer_fb_impl::binary_slicer_fb_impl() - : gr_sync_block("binary_slicer_fb", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(unsigned char))) + : sync_block("binary_slicer_fb", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(unsigned char))) { } @@ -56,7 +56,7 @@ namespace gr { unsigned char *out = (unsigned char *)output_items[0]; for(int i = 0; i < noutput_items; i++) { - out[i] = gr_binary_slicer(in[i]); + out[i] = gr::binary_slicer(in[i]); } return noutput_items; diff --git a/gr-digital/lib/binary_slicer_fb_impl.h b/gr-digital/lib/binary_slicer_fb_impl.h index 7416d9cd52..c3ae16c7d5 100644 --- a/gr-digital/lib/binary_slicer_fb_impl.h +++ b/gr-digital/lib/binary_slicer_fb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_BINARY_SLICER_FB_IMPL_H #define INCLUDED_DIGITAL_BINARY_SLICER_FB_IMPL_H -#include <digital/binary_slicer_fb.h> +#include <gnuradio/digital/binary_slicer_fb.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/chunks_to_symbols_XX_impl.cc.t b/gr-digital/lib/chunks_to_symbols_XX_impl.cc.t index 39eca32db6..3ecb8c17e5 100644 --- a/gr-digital/lib/chunks_to_symbols_XX_impl.cc.t +++ b/gr-digital/lib/chunks_to_symbols_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <assert.h> namespace gr { @@ -41,9 +41,9 @@ namespace gr { } @IMPL_NAME@::@IMPL_NAME@(const std::vector<@O_TYPE@> &symbol_table, const int D) - : gr_sync_interpolator("@BASE_NAME@", - gr_make_io_signature(1, -1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, -1, sizeof(@O_TYPE@)), + : sync_interpolator("@BASE_NAME@", + io_signature::make(1, -1, sizeof(@I_TYPE@)), + io_signature::make(1, -1, sizeof(@O_TYPE@)), D), d_D(D), d_symbol_table(symbol_table) { diff --git a/gr-digital/lib/chunks_to_symbols_XX_impl.h.t b/gr-digital/lib/chunks_to_symbols_XX_impl.h.t index ea44c71ad4..0e80754d10 100644 --- a/gr-digital/lib/chunks_to_symbols_XX_impl.h.t +++ b/gr-digital/lib/chunks_to_symbols_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <digital/@BASE_NAME@.h> +#include <gnuradio/digital/@BASE_NAME@.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/clock_recovery_mm_cc_impl.cc b/gr-digital/lib/clock_recovery_mm_cc_impl.cc index 168d9f7772..124b85efb6 100644 --- a/gr-digital/lib/clock_recovery_mm_cc_impl.cc +++ b/gr-digital/lib/clock_recovery_mm_cc_impl.cc @@ -25,9 +25,9 @@ #endif #include "clock_recovery_mm_cc_impl.h" -#include <gr_io_signature.h> -#include <gr_prefs.h> -#include <gr_math.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/prefs.h> +#include <gnuradio/math.h> #include <stdexcept> #include <iostream> @@ -50,13 +50,13 @@ namespace gr { clock_recovery_mm_cc_impl::clock_recovery_mm_cc_impl(float omega, float gain_omega, float mu, float gain_mu, float omega_relative_limit) - : gr_block("clock_recovery_mm_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature2(1, 2, sizeof(gr_complex), sizeof(float))), + : block("clock_recovery_mm_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make2(1, 2, sizeof(gr_complex), sizeof(float))), d_mu(mu), d_omega(omega), d_gain_omega(gain_omega), d_omega_relative_limit(omega_relative_limit), d_gain_mu(gain_mu), d_last_sample(0), d_interp(new filter::mmse_fir_interpolator_cc()), - d_verbose(gr_prefs::singleton()->get_bool("clock_recovery_mm_cc", "verbose", false)), + d_verbose(prefs::singleton()->get_bool("clock_recovery_mm_cc", "verbose", false)), d_p_2T(0), d_p_1T(0), d_p_0T(0), d_c_2T(0), d_c_1T(0), d_c_0T(0) { if(omega <= 0.0) @@ -147,9 +147,9 @@ namespace gr { out[oo++] = d_p_0T; // limit mm_val - mm_val = gr_branchless_clip(mm_val,4.0); + mm_val = gr::branchless_clip(mm_val,4.0); d_omega = d_omega + d_gain_omega * mm_val; - d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); + d_omega = d_omega_mid + gr::branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); d_mu = d_mu + d_omega + d_gain_mu * mm_val; ii += (int)floor(d_mu); @@ -180,10 +180,10 @@ namespace gr { out[oo++] = d_p_0T; // limit mm_val - mm_val = gr_branchless_clip(mm_val,1.0); + mm_val = gr::branchless_clip(mm_val,1.0); d_omega = d_omega + d_gain_omega * mm_val; - d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); + d_omega = d_omega_mid + gr::branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); d_mu = d_mu + d_omega + d_gain_mu * mm_val; ii += (int)floor(d_mu); diff --git a/gr-digital/lib/clock_recovery_mm_cc_impl.h b/gr-digital/lib/clock_recovery_mm_cc_impl.h index fa62bd127f..a2208350dd 100644 --- a/gr-digital/lib/clock_recovery_mm_cc_impl.h +++ b/gr-digital/lib/clock_recovery_mm_cc_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_IMPL_H #define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_IMPL_H -#include <digital/clock_recovery_mm_cc.h> -#include <filter/mmse_fir_interpolator_cc.h> +#include <gnuradio/digital/clock_recovery_mm_cc.h> +#include <gnuradio/filter/mmse_fir_interpolator_cc.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/clock_recovery_mm_ff_impl.cc b/gr-digital/lib/clock_recovery_mm_ff_impl.cc index 4ac3e40c5d..6c16777ed7 100644 --- a/gr-digital/lib/clock_recovery_mm_ff_impl.cc +++ b/gr-digital/lib/clock_recovery_mm_ff_impl.cc @@ -25,8 +25,8 @@ #endif #include "clock_recovery_mm_ff_impl.h" -#include <gr_io_signature.h> -#include <gr_math.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/math.h> #include <stdexcept> namespace gr { @@ -46,9 +46,9 @@ namespace gr { clock_recovery_mm_ff_impl::clock_recovery_mm_ff_impl(float omega, float gain_omega, float mu, float gain_mu, float omega_relative_limit) - : gr_block("clock_recovery_mm_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), + : block("clock_recovery_mm_ff", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))), d_mu(mu), d_gain_mu(gain_mu), d_gain_omega(gain_omega), d_omega_relative_limit(omega_relative_limit), d_last_sample(0), d_interp(new filter::mmse_fir_interpolator_ff()) @@ -104,7 +104,7 @@ namespace gr { d_last_sample = out[oo]; d_omega = d_omega + d_gain_omega * mm_val; - d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); + d_omega = d_omega_mid + gr::branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); d_mu = d_mu + d_omega + d_gain_mu * mm_val; ii += (int)floor(d_mu); diff --git a/gr-digital/lib/clock_recovery_mm_ff_impl.h b/gr-digital/lib/clock_recovery_mm_ff_impl.h index 920a05a496..13bed5d070 100644 --- a/gr-digital/lib/clock_recovery_mm_ff_impl.h +++ b/gr-digital/lib/clock_recovery_mm_ff_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_IMPL_H #define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_IMPL_H -#include <digital/clock_recovery_mm_ff.h> -#include <filter/mmse_fir_interpolator_ff.h> +#include <gnuradio/digital/clock_recovery_mm_ff.h> +#include <gnuradio/filter/mmse_fir_interpolator_ff.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/cma_equalizer_cc_impl.cc b/gr-digital/lib/cma_equalizer_cc_impl.cc index e4e6c56466..6f11e617bb 100644 --- a/gr-digital/lib/cma_equalizer_cc_impl.cc +++ b/gr-digital/lib/cma_equalizer_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include "cma_equalizer_cc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace digital { @@ -41,9 +41,9 @@ namespace gr { cma_equalizer_cc_impl::cma_equalizer_cc_impl(int num_taps, float modulus, float mu, int sps) - : gr_sync_decimator("cma_equalizer_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex)), + : sync_decimator("cma_equalizer_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex)), sps), fir_filter_ccc(sps, std::vector<gr_complex>(num_taps, gr_complex(0,0))), d_new_taps(num_taps, gr_complex(0,0)), @@ -79,8 +79,8 @@ namespace gr { cma_equalizer_cc_impl::error(const gr_complex &out) { gr_complex error = out*(norm(out) - d_modulus); - float re = gr_clip(error.real(), 1.0); - float im = gr_clip(error.imag(), 1.0); + float re = gr::clip(error.real(), 1.0); + float im = gr::clip(error.imag(), 1.0); return gr_complex(re, im); } diff --git a/gr-digital/lib/cma_equalizer_cc_impl.h b/gr-digital/lib/cma_equalizer_cc_impl.h index 553501bf46..71a78e6d72 100644 --- a/gr-digital/lib/cma_equalizer_cc_impl.h +++ b/gr-digital/lib/cma_equalizer_cc_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_CMA_EQUALIZER_CC_IMPL_H #define INCLUDED_DIGITAL_CMA_EQUALIZER_CC_IMPL_H -#include <digital/cma_equalizer_cc.h> -#include <filter/fir_filter.h> -#include <gr_math.h> +#include <gnuradio/digital/cma_equalizer_cc.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/math.h> #include <stdexcept> namespace gr { diff --git a/gr-digital/lib/constellation.cc b/gr-digital/lib/constellation.cc index d249c493ad..2c70bb0944 100644 --- a/gr-digital/lib/constellation.cc +++ b/gr-digital/lib/constellation.cc @@ -24,10 +24,10 @@ #include "config.h" #endif -#include <gr_io_signature.h> -#include <digital/constellation.h> -#include <gr_math.h> -#include <gr_complex.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/digital/constellation.h> +#include <gnuradio/math.h> +#include <gnuradio/gr_complex.h> #include <math.h> #include <iostream> #include <stdlib.h> diff --git a/gr-digital/lib/constellation_decoder_cb_impl.cc b/gr-digital/lib/constellation_decoder_cb_impl.cc index e764ccc629..e8075d2225 100644 --- a/gr-digital/lib/constellation_decoder_cb_impl.cc +++ b/gr-digital/lib/constellation_decoder_cb_impl.cc @@ -25,7 +25,7 @@ #endif #include "constellation_decoder_cb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace digital { @@ -39,9 +39,9 @@ namespace gr { constellation_decoder_cb_impl:: constellation_decoder_cb_impl(constellation_sptr constellation) - : gr_block("constellation_decoder_cb", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(unsigned char))), + : block("constellation_decoder_cb", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(unsigned char))), d_constellation(constellation), d_dim(constellation->dimensionality()) { diff --git a/gr-digital/lib/constellation_decoder_cb_impl.h b/gr-digital/lib/constellation_decoder_cb_impl.h index 5972760507..286a281171 100644 --- a/gr-digital/lib/constellation_decoder_cb_impl.h +++ b/gr-digital/lib/constellation_decoder_cb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_IMPL_H #define INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_IMPL_H -#include <digital/constellation_decoder_cb.h> +#include <gnuradio/digital/constellation_decoder_cb.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/constellation_receiver_cb_impl.cc b/gr-digital/lib/constellation_receiver_cb_impl.cc index 30be24aab9..cd44386ea0 100644 --- a/gr-digital/lib/constellation_receiver_cb_impl.cc +++ b/gr-digital/lib/constellation_receiver_cb_impl.cc @@ -25,10 +25,9 @@ #endif #include "constellation_receiver_cb_impl.h" -#include <gr_io_signature.h> -#include <gr_prefs.h> -#include <gr_math.h> -#include <gr_expj.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/math.h> +#include <gnuradio/expj.h> #include <stdexcept> namespace gr { @@ -51,9 +50,9 @@ namespace gr { static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int)); constellation_receiver_cb_impl::constellation_receiver_cb_impl(constellation_sptr constellation, float loop_bw, float fmin, float fmax) - : gr_block("constellation_receiver_cb", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signaturev(1, 5, iosig)), + : block("constellation_receiver_cb", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::makev(1, 5, iosig)), blocks::control_loop(loop_bw, fmax, fmin), d_constellation(constellation), d_current_const_point(0) diff --git a/gr-digital/lib/constellation_receiver_cb_impl.h b/gr-digital/lib/constellation_receiver_cb_impl.h index 7c34518340..4cd5f72bfa 100644 --- a/gr-digital/lib/constellation_receiver_cb_impl.h +++ b/gr-digital/lib/constellation_receiver_cb_impl.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_IMPL_H #define INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_IMPL_H -#include <digital/constellation_receiver_cb.h> -#include <attributes.h> -#include <gr_complex.h> -#include <blocks/control_loop.h> +#include <gnuradio/digital/constellation_receiver_cb.h> +#include <gnuradio/attributes.h> +#include <gnuradio/gr_complex.h> +#include <gnuradio/blocks/control_loop.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/correlate_access_code_bb_impl.cc b/gr-digital/lib/correlate_access_code_bb_impl.cc index 0ada203c65..dea831dfbc 100644 --- a/gr-digital/lib/correlate_access_code_bb_impl.cc +++ b/gr-digital/lib/correlate_access_code_bb_impl.cc @@ -25,8 +25,8 @@ #endif #include "correlate_access_code_bb_impl.h" -#include <gr_io_signature.h> -#include <blocks/count_bits.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/blocks/count_bits.h> #include <stdexcept> #include <cstdio> @@ -44,9 +44,9 @@ namespace gr { correlate_access_code_bb_impl::correlate_access_code_bb_impl( const std::string &access_code, int threshold) - : gr_sync_block("correlate_access_code_bb", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(1, 1, sizeof(char))), + : sync_block("correlate_access_code_bb", + io_signature::make(1, 1, sizeof(char)), + io_signature::make(1, 1, sizeof(char))), d_data_reg(0), d_flag_reg(0), d_flag_bit(0), d_mask(0), d_threshold(threshold) { diff --git a/gr-digital/lib/correlate_access_code_bb_impl.h b/gr-digital/lib/correlate_access_code_bb_impl.h index ad44b36400..5c46565a1c 100644 --- a/gr-digital/lib/correlate_access_code_bb_impl.h +++ b/gr-digital/lib/correlate_access_code_bb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_IMPL_H #define INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_IMPL_H -#include <digital/correlate_access_code_bb.h> +#include <gnuradio/digital/correlate_access_code_bb.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/correlate_access_code_tag_bb_impl.cc b/gr-digital/lib/correlate_access_code_tag_bb_impl.cc index 8ac601bb9d..0d64caa7ab 100644 --- a/gr-digital/lib/correlate_access_code_tag_bb_impl.cc +++ b/gr-digital/lib/correlate_access_code_tag_bb_impl.cc @@ -25,9 +25,9 @@ #endif #include "correlate_access_code_tag_bb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> -#include <blocks/count_bits.h> +#include <gnuradio/blocks/count_bits.h> #include <cstdio> #include <iostream> @@ -49,9 +49,9 @@ namespace gr { correlate_access_code_tag_bb_impl::correlate_access_code_tag_bb_impl( const std::string &access_code, int threshold, const std::string &tag_name) - : gr_sync_block("correlate_access_code_tag_bb", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(1, 1, sizeof(char))), + : sync_block("correlate_access_code_tag_bb", + io_signature::make(1, 1, sizeof(char)), + io_signature::make(1, 1, sizeof(char))), d_data_reg(0), d_mask(0), d_threshold(threshold), d_len(0) { diff --git a/gr-digital/lib/correlate_access_code_tag_bb_impl.h b/gr-digital/lib/correlate_access_code_tag_bb_impl.h index 17a016fc9c..df558dd17e 100644 --- a/gr-digital/lib/correlate_access_code_tag_bb_impl.h +++ b/gr-digital/lib/correlate_access_code_tag_bb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_TAG_BB_IMPL_H #define INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_TAG_BB_IMPL_H -#include <digital/correlate_access_code_tag_bb.h> +#include <gnuradio/digital/correlate_access_code_tag_bb.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/costas_loop_cc_impl.cc b/gr-digital/lib/costas_loop_cc_impl.cc index fcdd45045b..a0b1edf509 100644 --- a/gr-digital/lib/costas_loop_cc_impl.cc +++ b/gr-digital/lib/costas_loop_cc_impl.cc @@ -25,10 +25,10 @@ #endif #include "costas_loop_cc_impl.h" -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <gr_sincos.h> -#include <gr_math.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/expj.h> +#include <gnuradio/sincos.h> +#include <gnuradio/math.h> namespace gr { namespace digital { @@ -41,9 +41,9 @@ namespace gr { } costas_loop_cc_impl::costas_loop_cc_impl(float loop_bw, int order) - : gr_sync_block("costas_loop_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature2(1, 2, sizeof(gr_complex), sizeof(float))), + : sync_block("costas_loop_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make2(1, 2, sizeof(gr_complex), sizeof(float))), blocks::control_loop(loop_bw, 1.0, -1.0), d_order(order), d_phase_detector(NULL) { @@ -132,7 +132,7 @@ namespace gr { optr[i] = iptr[i] * nco_out; error = (*this.*d_phase_detector)(optr[i]); - error = gr_branchless_clip(error, 1.0); + error = gr::branchless_clip(error, 1.0); advance_loop(error); phase_wrap(); @@ -147,7 +147,7 @@ namespace gr { optr[i] = iptr[i] * nco_out; error = (*this.*d_phase_detector)(optr[i]); - error = gr_branchless_clip(error, 1.0); + error = gr::branchless_clip(error, 1.0); advance_loop(error); phase_wrap(); diff --git a/gr-digital/lib/costas_loop_cc_impl.h b/gr-digital/lib/costas_loop_cc_impl.h index ecba2cdd4f..ceb45ce32f 100644 --- a/gr-digital/lib/costas_loop_cc_impl.h +++ b/gr-digital/lib/costas_loop_cc_impl.h @@ -24,7 +24,7 @@ #ifndef INCLUDED_DIGITAL_COSTAS_LOOP_CC_IMPL_H #define INCLUDED_DIGITAL_COSTAS_LOOP_CC_IMPL_H -#include <digital/costas_loop_cc.h> +#include <gnuradio/digital/costas_loop_cc.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/cpmmod_bc_impl.cc b/gr-digital/lib/cpmmod_bc_impl.cc index 763a4cc1e2..4b2457f90e 100644 --- a/gr-digital/lib/cpmmod_bc_impl.cc +++ b/gr-digital/lib/cpmmod_bc_impl.cc @@ -23,7 +23,7 @@ #endif #include "cpmmod_bc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace digital { @@ -55,9 +55,9 @@ namespace gr { analog::cpm::cpm_type type, float h, int samples_per_sym, int L, double beta) - : gr_hier_block2(name, - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature2(1, 1, sizeof(gr_complex), sizeof(float))), + : hier_block2(name, + io_signature::make(1, 1, sizeof(char)), + io_signature::make2(1, 1, sizeof(gr_complex), sizeof(float))), d_type(type), d_index(h), d_sps(samples_per_sym), d_length(L), d_beta(beta), d_taps(analog::cpm::phase_response(type, samples_per_sym, L, beta)), d_char_to_float(blocks::char_to_float::make()), diff --git a/gr-digital/lib/cpmmod_bc_impl.h b/gr-digital/lib/cpmmod_bc_impl.h index 9cfec4959e..3402e6e2bb 100644 --- a/gr-digital/lib/cpmmod_bc_impl.h +++ b/gr-digital/lib/cpmmod_bc_impl.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_DIGITAL_CPMMOD_BC_IMPL_H #define INCLUDED_DIGITAL_CPMMOD_BC_IMPL_H -#include <digital/cpmmod_bc.h> -#include <blocks/char_to_float.h> -#include <analog/frequency_modulator_fc.h> -#include <filter/interp_fir_filter_fff.h> +#include <gnuradio/digital/cpmmod_bc.h> +#include <gnuradio/blocks/char_to_float.h> +#include <gnuradio/analog/frequency_modulator_fc.h> +#include <gnuradio/filter/interp_fir_filter_fff.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/crc32.cc b/gr-digital/lib/crc32.cc index b203727114..cdff9f7e7a 100644 --- a/gr-digital/lib/crc32.cc +++ b/gr-digital/lib/crc32.cc @@ -28,7 +28,7 @@ #include <config.h> #endif -#include <digital/crc32.h> +#include <gnuradio/digital/crc32.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/crc32_bb_impl.cc b/gr-digital/lib/crc32_bb_impl.cc index 89cc0d1083..67dbfd328b 100644 --- a/gr-digital/lib/crc32_bb_impl.cc +++ b/gr-digital/lib/crc32_bb_impl.cc @@ -24,9 +24,9 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "crc32_bb_impl.h" -#include <digital/crc32.h> +#include <gnuradio/digital/crc32.h> namespace gr { namespace digital { @@ -38,9 +38,9 @@ namespace gr { } crc32_bb_impl::crc32_bb_impl(bool check, const std::string& lengthtagname) - : gr_tagged_stream_block("crc32_bb", - gr_make_io_signature(1, 1, sizeof (char)), - gr_make_io_signature(1, 1, sizeof (char)), + : tagged_stream_block("crc32_bb", + io_signature::make(1, 1, sizeof (char)), + io_signature::make(1, 1, sizeof (char)), lengthtagname), d_check(check) { @@ -85,7 +85,7 @@ namespace gr { memcpy((void *) (out + packet_length), &crc, 4); // FIXME big-endian/little-endian, this might be wrong } - std::vector<gr_tag_t> tags; + std::vector<tag_t> tags; get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+packet_length); for (size_t i = 0; i < tags.size(); i++) { tags[i].offset -= nitems_read(0); diff --git a/gr-digital/lib/crc32_bb_impl.h b/gr-digital/lib/crc32_bb_impl.h index 7b9dbb6351..9d5fddc557 100644 --- a/gr-digital/lib/crc32_bb_impl.h +++ b/gr-digital/lib/crc32_bb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_CRC32_BB_IMPL_H #define INCLUDED_DIGITAL_CRC32_BB_IMPL_H -#include <digital/crc32_bb.h> +#include <gnuradio/digital/crc32_bb.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/descrambler_bb_impl.cc b/gr-digital/lib/descrambler_bb_impl.cc index 8124df37ef..69e9dd0cef 100644 --- a/gr-digital/lib/descrambler_bb_impl.cc +++ b/gr-digital/lib/descrambler_bb_impl.cc @@ -25,7 +25,7 @@ #endif #include "descrambler_bb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace digital { @@ -38,9 +38,9 @@ namespace gr { } descrambler_bb_impl::descrambler_bb_impl(int mask, int seed, int len) - : gr_sync_block("descrambler_bb", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(unsigned char))), + : sync_block("descrambler_bb", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(unsigned char))), d_lfsr(mask, seed, len) { } diff --git a/gr-digital/lib/descrambler_bb_impl.h b/gr-digital/lib/descrambler_bb_impl.h index 4f07b7c329..aeada30566 100644 --- a/gr-digital/lib/descrambler_bb_impl.h +++ b/gr-digital/lib/descrambler_bb_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_DESCRAMBLER_BB_IMPL_H #define INCLUDED_GR_DESCRAMBLER_BB_IMPL_H -#include <digital/descrambler_bb.h> -#include <digital/lfsr.h> +#include <gnuradio/digital/descrambler_bb.h> +#include <gnuradio/digital/lfsr.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/diff_decoder_bb_impl.cc b/gr-digital/lib/diff_decoder_bb_impl.cc index 74c247a830..f0e1de0935 100644 --- a/gr-digital/lib/diff_decoder_bb_impl.cc +++ b/gr-digital/lib/diff_decoder_bb_impl.cc @@ -25,7 +25,7 @@ #endif #include "diff_decoder_bb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace digital { @@ -37,9 +37,9 @@ namespace gr { } diff_decoder_bb_impl::diff_decoder_bb_impl(unsigned int modulus) - : gr_sync_block("diff_decoder_bb", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(unsigned char))), + : sync_block("diff_decoder_bb", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(unsigned char))), d_modulus(modulus) { set_history(2); // need to look at two inputs diff --git a/gr-digital/lib/diff_decoder_bb_impl.h b/gr-digital/lib/diff_decoder_bb_impl.h index 56a15ba128..c827c8e35f 100644 --- a/gr-digital/lib/diff_decoder_bb_impl.h +++ b/gr-digital/lib/diff_decoder_bb_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_DIFF_DECODER_BB_IMPL_H #define INCLUDED_GR_DIFF_DECODER_BB_IMPL_H -#include <digital/diff_decoder_bb.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/diff_decoder_bb.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/diff_encoder_bb_impl.cc b/gr-digital/lib/diff_encoder_bb_impl.cc index 411efe006c..529aade3db 100644 --- a/gr-digital/lib/diff_encoder_bb_impl.cc +++ b/gr-digital/lib/diff_encoder_bb_impl.cc @@ -25,7 +25,7 @@ #endif #include "diff_encoder_bb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace digital { @@ -38,9 +38,9 @@ namespace gr { } diff_encoder_bb_impl::diff_encoder_bb_impl(unsigned int modulus) - : gr_sync_block("diff_encoder_bb", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(unsigned char))), + : sync_block("diff_encoder_bb", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(unsigned char))), d_last_out(0), d_modulus(modulus) { } diff --git a/gr-digital/lib/diff_encoder_bb_impl.h b/gr-digital/lib/diff_encoder_bb_impl.h index e088d79f86..7c761b235b 100644 --- a/gr-digital/lib/diff_encoder_bb_impl.h +++ b/gr-digital/lib/diff_encoder_bb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_DIFF_ENCODER_BB_IMPL_H #define INCLUDED_GR_DIFF_ENCODER_BB_IMPL_H -#include <digital/diff_encoder_bb.h> +#include <gnuradio/digital/diff_encoder_bb.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/diff_phasor_cc_impl.cc b/gr-digital/lib/diff_phasor_cc_impl.cc index 0e7a108121..0e70a4bf62 100644 --- a/gr-digital/lib/diff_phasor_cc_impl.cc +++ b/gr-digital/lib/diff_phasor_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include "diff_phasor_cc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace digital { @@ -38,9 +38,9 @@ namespace gr { } diff_phasor_cc_impl::diff_phasor_cc_impl() - : gr_sync_block("diff_phasor_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))) + : sync_block("diff_phasor_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))) { set_history(2); } diff --git a/gr-digital/lib/diff_phasor_cc_impl.h b/gr-digital/lib/diff_phasor_cc_impl.h index 844fc826d8..4b54e11f44 100644 --- a/gr-digital/lib/diff_phasor_cc_impl.h +++ b/gr-digital/lib/diff_phasor_cc_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_DIFF_PHASOR_CC_IMPL_H #define INCLUDED_GR_DIFF_PHASOR_CC_IMPL_H -#include <digital/diff_phasor_cc.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/diff_phasor_cc.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/fll_band_edge_cc_impl.cc b/gr-digital/lib/fll_band_edge_cc_impl.cc index c438b813f4..d67f13a412 100644 --- a/gr-digital/lib/fll_band_edge_cc_impl.cc +++ b/gr-digital/lib/fll_band_edge_cc_impl.cc @@ -25,8 +25,8 @@ #endif #include "fll_band_edge_cc_impl.h" -#include <gr_io_signature.h> -#include <gr_expj.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/expj.h> #include <cstdio> namespace gr { @@ -55,9 +55,9 @@ namespace gr { static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int)); fll_band_edge_cc_impl::fll_band_edge_cc_impl(float samps_per_sym, float rolloff, int filter_size, float bandwidth) - : gr_sync_block("fll_band_edge_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signaturev(1, 4, iosig)), + : sync_block("fll_band_edge_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::makev(1, 4, iosig)), blocks::control_loop(bandwidth, M_TWOPI*(2.0/samps_per_sym), -M_TWOPI*(2.0/samps_per_sym)), d_updated(false) diff --git a/gr-digital/lib/fll_band_edge_cc_impl.h b/gr-digital/lib/fll_band_edge_cc_impl.h index 9eb3e6e7ae..7bec745262 100644 --- a/gr-digital/lib/fll_band_edge_cc_impl.h +++ b/gr-digital/lib/fll_band_edge_cc_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_IMPL_H #define INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_IMPL_H -#include <digital/fll_band_edge_cc.h> -#include <blocks/control_loop.h> -#include <filter/fir_filter.h> +#include <gnuradio/digital/fll_band_edge_cc.h> +#include <gnuradio/blocks/control_loop.h> +#include <gnuradio/filter/fir_filter.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/framer_sink_1_impl.cc b/gr-digital/lib/framer_sink_1_impl.cc index 1dda5ca50c..76347101a4 100644 --- a/gr-digital/lib/framer_sink_1_impl.cc +++ b/gr-digital/lib/framer_sink_1_impl.cc @@ -25,7 +25,7 @@ #endif #include "framer_sink_1_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> #include <string> @@ -71,16 +71,16 @@ namespace gr { } framer_sink_1::sptr - framer_sink_1::make(gr_msg_queue_sptr target_queue) + framer_sink_1::make(msg_queue::sptr target_queue) { return gnuradio::get_initial_sptr (new framer_sink_1_impl(target_queue)); } - framer_sink_1_impl::framer_sink_1_impl(gr_msg_queue_sptr target_queue) - : gr_sync_block("framer_sink_1", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(0, 0, 0)), + framer_sink_1_impl::framer_sink_1_impl(msg_queue::sptr target_queue) + : sync_block("framer_sink_1", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(0, 0, 0)), d_target_queue(target_queue) { enter_search(); @@ -139,8 +139,8 @@ namespace gr { if(d_packetlen == 0) { // check for zero-length payload // build a zero-length message // NOTE: passing header field as arg1 is not scalable - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, 0); + message::sptr msg = + message::make(0, d_packet_whitener_offset, 0, 0); d_target_queue->insert_tail(msg); // send it msg.reset(); // free it up @@ -168,8 +168,8 @@ namespace gr { if(d_packetlen_cnt == d_packetlen) { // packet is filled // build a message // NOTE: passing header field as arg1 is not scalable - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen_cnt); + message::sptr msg = + message::make(0, d_packet_whitener_offset, 0, d_packetlen_cnt); memcpy(msg->msg(), d_packet, d_packetlen_cnt); d_target_queue->insert_tail(msg); // send it diff --git a/gr-digital/lib/framer_sink_1_impl.h b/gr-digital/lib/framer_sink_1_impl.h index ff2839acbf..e33c93de16 100644 --- a/gr-digital/lib/framer_sink_1_impl.h +++ b/gr-digital/lib/framer_sink_1_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_FRAMER_SINK_1_IMPL_H #define INCLUDED_GR_FRAMER_SINK_1_IMPL_H -#include <digital/framer_sink_1.h> +#include <gnuradio/digital/framer_sink_1.h> namespace gr { namespace digital { @@ -36,17 +36,17 @@ namespace gr { static const int MAX_PKT_LEN = 4096; static const int HEADERBITLEN = 32; - gr_msg_queue_sptr d_target_queue; // where to send the packet when received - state_t d_state; - unsigned int d_header; // header bits - int d_headerbitlen_cnt; // how many so far + msg_queue::sptr d_target_queue; // where to send the packet when received + state_t d_state; + unsigned int d_header; // header bits + int d_headerbitlen_cnt; // how many so far - unsigned char d_packet[MAX_PKT_LEN]; // assembled payload - unsigned char d_packet_byte; // byte being assembled - int d_packet_byte_index; // which bit of d_packet_byte we're working on - int d_packetlen; // length of packet - int d_packet_whitener_offset; // offset into whitener string to use - int d_packetlen_cnt; // how many so far + unsigned char d_packet[MAX_PKT_LEN]; // assembled payload + unsigned char d_packet_byte; // byte being assembled + int d_packet_byte_index; // which bit of d_packet_byte we're working on + int d_packetlen; // length of packet + int d_packet_whitener_offset; // offset into whitener string to use + int d_packetlen_cnt; // how many so far protected: void enter_search(); @@ -69,7 +69,7 @@ namespace gr { } public: - framer_sink_1_impl(gr_msg_queue_sptr target_queue); + framer_sink_1_impl(msg_queue::sptr target_queue); ~framer_sink_1_impl(); int work(int noutput_items, diff --git a/gr-digital/lib/glfsr.cc b/gr-digital/lib/glfsr.cc index 5c9d22af88..fc2762fd5b 100644 --- a/gr-digital/lib/glfsr.cc +++ b/gr-digital/lib/glfsr.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <digital/glfsr.h> +#include <gnuradio/digital/glfsr.h> #include <stdexcept> namespace gr { diff --git a/gr-digital/lib/glfsr_source_b_impl.cc b/gr-digital/lib/glfsr_source_b_impl.cc index e4171d80e7..260bd45c24 100644 --- a/gr-digital/lib/glfsr_source_b_impl.cc +++ b/gr-digital/lib/glfsr_source_b_impl.cc @@ -25,7 +25,7 @@ #endif #include "glfsr_source_b_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> namespace gr { @@ -40,9 +40,9 @@ namespace gr { glfsr_source_b_impl::glfsr_source_b_impl(int degree, bool repeat, int mask, int seed) - : gr_sync_block("glfsr_source_b", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, sizeof(unsigned char))), + : sync_block("glfsr_source_b", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, sizeof(unsigned char))), d_repeat(repeat), d_index(0) { if(degree < 1 || degree > 32) diff --git a/gr-digital/lib/glfsr_source_b_impl.h b/gr-digital/lib/glfsr_source_b_impl.h index f52cfa0f20..a063eb7c0a 100644 --- a/gr-digital/lib/glfsr_source_b_impl.h +++ b/gr-digital/lib/glfsr_source_b_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_GLFSR_SOURCE_B_IMPL_H #define INCLUDED_GR_GLFSR_SOURCE_B_IMPL_H -#include <digital/glfsr_source_b.h> -#include <digital/glfsr.h> +#include <gnuradio/digital/glfsr_source_b.h> +#include <gnuradio/digital/glfsr.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/glfsr_source_f_impl.cc b/gr-digital/lib/glfsr_source_f_impl.cc index 1e0ee2d85e..cb637df4ea 100644 --- a/gr-digital/lib/glfsr_source_f_impl.cc +++ b/gr-digital/lib/glfsr_source_f_impl.cc @@ -26,7 +26,7 @@ #endif #include "glfsr_source_f_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> namespace gr { @@ -41,9 +41,9 @@ namespace gr { glfsr_source_f_impl::glfsr_source_f_impl(int degree, bool repeat, int mask, int seed) - : gr_sync_block("glfsr_source_f", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, sizeof(float))), + : sync_block("glfsr_source_f", + io_signature::make(0, 0, 0), + io_signature::make(1, 1, sizeof(float))), d_repeat(repeat), d_index(0) { if(degree < 1 || degree > 32) diff --git a/gr-digital/lib/glfsr_source_f_impl.h b/gr-digital/lib/glfsr_source_f_impl.h index 4168016097..194e2ff3b9 100644 --- a/gr-digital/lib/glfsr_source_f_impl.h +++ b/gr-digital/lib/glfsr_source_f_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_GLFSR_SOURCE_F_IMPL_H #define INCLUDED_GR_GLFSR_SOURCE_F_IMPL_H -#include <digital/glfsr_source_f.h> -#include <digital/glfsr.h> +#include <gnuradio/digital/glfsr_source_f.h> +#include <gnuradio/digital/glfsr.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/header_payload_demux_impl.cc b/gr-digital/lib/header_payload_demux_impl.cc index a2e81c5b8e..79e2d3770d 100644 --- a/gr-digital/lib/header_payload_demux_impl.cc +++ b/gr-digital/lib/header_payload_demux_impl.cc @@ -24,7 +24,7 @@ #endif #include <climits> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "header_payload_demux_impl.h" namespace gr { @@ -70,9 +70,9 @@ namespace gr { const std::string &trigger_tag_key, bool output_symbols, size_t itemsize - ) : gr_block("header_payload_demux", - gr_make_io_signature2(1, 2, itemsize, sizeof(char)), - gr_make_io_signature(2, 2, (output_symbols ? itemsize * items_per_symbol : itemsize))), + ) : block("header_payload_demux", + io_signature::make2(1, 2, itemsize, sizeof(char)), + io_signature::make(2, 2, (output_symbols ? itemsize * items_per_symbol : itemsize))), d_header_len(header_len), d_items_per_symbol(items_per_symbol), d_gi(guard_interval), @@ -199,7 +199,7 @@ namespace gr { } } if (d_uses_trigger_tag) { - std::vector<gr_tag_t> tags; + std::vector<tag_t> tags; get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+noutput_items); uint64_t min_offset = ULLONG_MAX; int tag_index = -1; @@ -250,7 +250,7 @@ namespace gr { void header_payload_demux_impl::copy_symbol(const unsigned char *&in, unsigned char *&out, int port, int &nread, int &nproduced) { - std::vector<gr_tag_t> tags; + std::vector<tag_t> tags; memcpy((void *) out, (void *) (in + d_gi * d_itemsize), d_itemsize * d_items_per_symbol diff --git a/gr-digital/lib/header_payload_demux_impl.h b/gr-digital/lib/header_payload_demux_impl.h index dc8cc7883a..a11430b175 100644 --- a/gr-digital/lib/header_payload_demux_impl.h +++ b/gr-digital/lib/header_payload_demux_impl.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_DIGITAL_HEADER_PAYLOAD_DEMUX_IMPL_H #define INCLUDED_DIGITAL_HEADER_PAYLOAD_DEMUX_IMPL_H -#include <digital/header_payload_demux.h> +#include <gnuradio/digital/header_payload_demux.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/kurtotic_equalizer_cc_impl.cc b/gr-digital/lib/kurtotic_equalizer_cc_impl.cc index c3be3b5d06..edf2f34452 100644 --- a/gr-digital/lib/kurtotic_equalizer_cc_impl.cc +++ b/gr-digital/lib/kurtotic_equalizer_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include "kurtotic_equalizer_cc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } kurtotic_equalizer_cc_impl::kurtotic_equalizer_cc_impl(int num_taps, float mu) - : gr_sync_decimator("kurtotic_equalizer_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex)), + : sync_decimator("kurtotic_equalizer_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex)), 1), filter::kernel::fir_filter_ccc(1, std::vector<gr_complex>(num_taps, gr_complex(0,0))) { diff --git a/gr-digital/lib/kurtotic_equalizer_cc_impl.h b/gr-digital/lib/kurtotic_equalizer_cc_impl.h index 0f2ff23808..cab828d89b 100644 --- a/gr-digital/lib/kurtotic_equalizer_cc_impl.h +++ b/gr-digital/lib/kurtotic_equalizer_cc_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_IMPL_H #define INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_IMPL_H -#include <digital/kurtotic_equalizer_cc.h> -#include <filter/fir_filter.h> -#include <gr_math.h> +#include <gnuradio/digital/kurtotic_equalizer_cc.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/math.h> #include <stdexcept> namespace gr { @@ -73,8 +73,8 @@ namespace gr { (sign(d_u) * (nrm*cnj - 2.0f*d_p*cnj - conj(d_q)*out) - abs(d_u)*cnj); - float re = gr_clip(F.real(), 1.0); - float im = gr_clip(F.imag(), 1.0); + float re = gr::clip(F.real(), 1.0); + float im = gr::clip(F.imag(), 1.0); return gr_complex(re, im); } diff --git a/gr-digital/lib/lms_dd_equalizer_cc_impl.cc b/gr-digital/lib/lms_dd_equalizer_cc_impl.cc index 15008ca8e7..530b3aa6fd 100644 --- a/gr-digital/lib/lms_dd_equalizer_cc_impl.cc +++ b/gr-digital/lib/lms_dd_equalizer_cc_impl.cc @@ -25,8 +25,8 @@ #endif #include "lms_dd_equalizer_cc_impl.h" -#include <gr_io_signature.h> -#include <gr_misc.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/misc.h> #include <volk/volk.h> namespace gr { @@ -45,9 +45,9 @@ namespace gr { lms_dd_equalizer_cc_impl::lms_dd_equalizer_cc_impl(int num_taps, float mu, int sps, constellation_sptr cnst) - : gr_sync_decimator("lms_dd_equalizer_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex)), + : sync_decimator("lms_dd_equalizer_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex)), sps), fir_filter_ccc(sps, std::vector<gr_complex>(num_taps, gr_complex(0,0))), d_new_taps(num_taps, gr_complex(0,0)), diff --git a/gr-digital/lib/lms_dd_equalizer_cc_impl.h b/gr-digital/lib/lms_dd_equalizer_cc_impl.h index ca6ba4d84c..a20cf1c170 100644 --- a/gr-digital/lib/lms_dd_equalizer_cc_impl.h +++ b/gr-digital/lib/lms_dd_equalizer_cc_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_IMPL_H #define INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_IMPL_H -#include <digital/lms_dd_equalizer_cc.h> -#include <filter/fir_filter.h> +#include <gnuradio/digital/lms_dd_equalizer_cc.h> +#include <gnuradio/filter/fir_filter.h> #include <stdexcept> namespace gr { diff --git a/gr-digital/lib/map_bb_impl.cc b/gr-digital/lib/map_bb_impl.cc index 4ea91835a9..c4f9209a88 100644 --- a/gr-digital/lib/map_bb_impl.cc +++ b/gr-digital/lib/map_bb_impl.cc @@ -25,7 +25,7 @@ #endif #include "map_bb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace digital { @@ -37,9 +37,9 @@ namespace gr { } map_bb_impl::map_bb_impl(const std::vector<int> &map) - : gr_sync_block("map_bb", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(unsigned char))) + : sync_block("map_bb", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(unsigned char))) { set_map(map); } diff --git a/gr-digital/lib/map_bb_impl.h b/gr-digital/lib/map_bb_impl.h index 59f1e834b7..18a82d18e9 100644 --- a/gr-digital/lib/map_bb_impl.h +++ b/gr-digital/lib/map_bb_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_MAP_BB_IMPL_H #define INCLUDED_GR_MAP_BB_IMPL_H -#include <digital/map_bb.h> -#include <thread/thread.h> +#include <gnuradio/digital/map_bb.h> +#include <gnuradio/thread/thread.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/mpsk_receiver_cc_impl.cc b/gr-digital/lib/mpsk_receiver_cc_impl.cc index ea11b7cdaa..0d7464a0fb 100644 --- a/gr-digital/lib/mpsk_receiver_cc_impl.cc +++ b/gr-digital/lib/mpsk_receiver_cc_impl.cc @@ -25,10 +25,9 @@ #endif #include "mpsk_receiver_cc_impl.h" -#include <gr_io_signature.h> -#include <gr_prefs.h> -#include <gr_math.h> -#include <gr_expj.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/math.h> +#include <gnuradio/expj.h> #include <stdexcept> namespace gr { @@ -60,9 +59,9 @@ namespace gr { float mu, float gain_mu, float omega, float gain_omega, float omega_rel) - : gr_block("mpsk_receiver_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : block("mpsk_receiver_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), blocks::control_loop(loop_bw, fmax, fmin), d_M(M), d_theta(theta), d_current_const_point(0), @@ -163,14 +162,14 @@ namespace gr { float mpsk_receiver_cc_impl::phase_error_detector_generic(gr_complex sample) const { - //return gr_fast_atan2f(sample*conj(d_constellation[d_current_const_point])); + //return gr::fast_atan2f(sample*conj(d_constellation[d_current_const_point])); return -arg(sample*conj(d_constellation[d_current_const_point])); } unsigned int mpsk_receiver_cc_impl::decision_bpsk(gr_complex sample) const { - return (gr_branchless_binary_slicer(sample.real()) ^ 1); + return (gr::branchless_binary_slicer(sample.real()) ^ 1); //return gr_binary_slicer(sample.real()) ^ 1; } @@ -179,8 +178,8 @@ namespace gr { { unsigned int index; - //index = gr_branchless_quad_0deg_slicer(sample); - index = gr_quad_0deg_slicer(sample); + //index = gr::branchless_quad_0deg_slicer(sample); + index = gr::quad_0deg_slicer(sample); return index; } @@ -257,10 +256,10 @@ namespace gr { y = (d_p_0T - d_p_2T) * conj(d_c_1T); u = y - x; mm_error = u.real(); // the error signal is in the real part - mm_error = gr_branchless_clip(mm_error, 1.0); // limit mm_val + mm_error = gr::branchless_clip(mm_error, 1.0); // limit mm_val d_omega = d_omega + d_gain_omega * mm_error; // update omega based on loop error - d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_rel); // make sure we don't walk away + d_omega = d_omega_mid + gr::branchless_clip(d_omega-d_omega_mid, d_omega_rel); // make sure we don't walk away d_mu += d_omega + d_gain_mu * mm_error; // update mu based on loop error diff --git a/gr-digital/lib/mpsk_receiver_cc_impl.h b/gr-digital/lib/mpsk_receiver_cc_impl.h index ed53d0f2e4..f17f88cb98 100644 --- a/gr-digital/lib/mpsk_receiver_cc_impl.h +++ b/gr-digital/lib/mpsk_receiver_cc_impl.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_DIGITAL_MPSK_RECEIVER_CC_IMPL_H #define INCLUDED_DIGITAL_MPSK_RECEIVER_CC_IMPL_H -#include <digital/mpsk_receiver_cc.h> -#include <attributes.h> -#include <blocks/control_loop.h> -#include <gr_complex.h> +#include <gnuradio/digital/mpsk_receiver_cc.h> +#include <gnuradio/attributes.h> +#include <gnuradio/blocks/control_loop.h> +#include <gnuradio/gr_complex.h> #include <fstream> -#include <filter/mmse_fir_interpolator_cc.h> +#include <gnuradio/filter/mmse_fir_interpolator_cc.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/mpsk_snr_est.cc b/gr-digital/lib/mpsk_snr_est.cc index 9b52334806..6edb0274f5 100644 --- a/gr-digital/lib/mpsk_snr_est.cc +++ b/gr-digital/lib/mpsk_snr_est.cc @@ -24,7 +24,7 @@ #include <config.h> #endif -#include <digital/mpsk_snr_est.h> +#include <gnuradio/digital/mpsk_snr_est.h> #include <stdexcept> #include <cstdio> diff --git a/gr-digital/lib/mpsk_snr_est_cc_impl.cc b/gr-digital/lib/mpsk_snr_est_cc_impl.cc index 6d11dd315c..07a411e4c5 100644 --- a/gr-digital/lib/mpsk_snr_est_cc_impl.cc +++ b/gr-digital/lib/mpsk_snr_est_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include "mpsk_snr_est_cc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> namespace gr { @@ -43,9 +43,9 @@ namespace gr { mpsk_snr_est_cc_impl::mpsk_snr_est_cc_impl(snr_est_type_t type, int tag_nsamples, double alpha) - : gr_sync_block("mpsk_snr_est_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))) + : sync_block("mpsk_snr_est_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))) { d_snr_est = NULL; diff --git a/gr-digital/lib/mpsk_snr_est_cc_impl.h b/gr-digital/lib/mpsk_snr_est_cc_impl.h index 530d223aec..36a6daa9d0 100644 --- a/gr-digital/lib/mpsk_snr_est_cc_impl.h +++ b/gr-digital/lib/mpsk_snr_est_cc_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_DIGITAL_MPSK_SNR_EST_CC_IMPL_H #define INCLUDED_DIGITAL_MPSK_SNR_EST_CC_IMPL_H -#include <digital/api.h> -#include <digital/mpsk_snr_est_cc.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/api.h> +#include <gnuradio/digital/mpsk_snr_est_cc.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/ofdm_carrier_allocator_cvc_impl.cc b/gr-digital/lib/ofdm_carrier_allocator_cvc_impl.cc index afeb10e1d5..467718e424 100644 --- a/gr-digital/lib/ofdm_carrier_allocator_cvc_impl.cc +++ b/gr-digital/lib/ofdm_carrier_allocator_cvc_impl.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "ofdm_carrier_allocator_cvc_impl.h" namespace gr { @@ -62,9 +62,9 @@ namespace gr { const std::vector<std::vector<gr_complex> > &sync_words, const std::string &len_tag_key, const bool output_is_shifted - ) : gr_tagged_stream_block("ofdm_carrier_allocator_cvc", - gr_make_io_signature(1, 1, sizeof (gr_complex)), - gr_make_io_signature(1, 1, sizeof (gr_complex) * fft_len), len_tag_key), + ) : tagged_stream_block("ofdm_carrier_allocator_cvc", + io_signature::make(1, 1, sizeof (gr_complex)), + io_signature::make(1, 1, sizeof (gr_complex) * fft_len), len_tag_key), d_fft_len(fft_len), d_occupied_carriers(occupied_carriers), d_pilot_carriers(pilot_carriers), @@ -140,7 +140,7 @@ namespace gr { { const gr_complex *in = (const gr_complex *) input_items[0]; gr_complex *out = (gr_complex *) output_items[0]; - std::vector<gr_tag_t> tags; + std::vector<tag_t> tags; memset((void *) out, 0x00, sizeof(gr_complex) * d_fft_len * noutput_items); // Copy Sync word diff --git a/gr-digital/lib/ofdm_carrier_allocator_cvc_impl.h b/gr-digital/lib/ofdm_carrier_allocator_cvc_impl.h index 6e478b3389..8599355ebb 100644 --- a/gr-digital/lib/ofdm_carrier_allocator_cvc_impl.h +++ b/gr-digital/lib/ofdm_carrier_allocator_cvc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_IMPL_H #define INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_IMPL_H -#include <digital/ofdm_carrier_allocator_cvc.h> +#include <gnuradio/digital/ofdm_carrier_allocator_cvc.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/ofdm_chanest_vcvc_impl.cc b/gr-digital/lib/ofdm_chanest_vcvc_impl.cc index d0d8faba59..a4025cc381 100644 --- a/gr-digital/lib/ofdm_chanest_vcvc_impl.cc +++ b/gr-digital/lib/ofdm_chanest_vcvc_impl.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "ofdm_chanest_vcvc_impl.h" namespace gr { @@ -46,9 +46,9 @@ namespace gr { } ofdm_chanest_vcvc_impl::ofdm_chanest_vcvc_impl(const std::vector<gr_complex> &sync_symbol1, const std::vector<gr_complex> &sync_symbol2, int n_data_symbols, int eq_noise_red_len, int max_carr_offset, bool force_one_sync_symbol) - : gr_block("ofdm_chanest_vcvc", - gr_make_io_signature(1, 1, sizeof (gr_complex) * sync_symbol1.size()), - gr_make_io_signature(1, 1, sizeof (gr_complex) * sync_symbol1.size())), + : block("ofdm_chanest_vcvc", + io_signature::make(1, 1, sizeof (gr_complex) * sync_symbol1.size()), + io_signature::make(1, 1, sizeof (gr_complex) * sync_symbol1.size())), d_fft_len(sync_symbol1.size()), d_n_data_syms(n_data_symbols), d_n_sync_syms(1), @@ -241,7 +241,7 @@ namespace gr { in += framesize * d_fft_len; out += d_n_data_syms * d_fft_len; - std::vector<gr_tag_t> tags; + std::vector<tag_t> tags; this->get_tags_in_range(tags, 0, this->nitems_read(0)+i*framesize, this->nitems_read(0)+(i+1)*framesize); diff --git a/gr-digital/lib/ofdm_chanest_vcvc_impl.h b/gr-digital/lib/ofdm_chanest_vcvc_impl.h index def8734e64..9a21fbdf87 100644 --- a/gr-digital/lib/ofdm_chanest_vcvc_impl.h +++ b/gr-digital/lib/ofdm_chanest_vcvc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_OFDM_CHANEST_VCVC_IMPL_H #define INCLUDED_DIGITAL_OFDM_CHANEST_VCVC_IMPL_H -#include <digital/ofdm_chanest_vcvc.h> +#include <gnuradio/digital/ofdm_chanest_vcvc.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/ofdm_cyclic_prefixer_impl.cc b/gr-digital/lib/ofdm_cyclic_prefixer_impl.cc index d48c5f7e45..9db7273e26 100644 --- a/gr-digital/lib/ofdm_cyclic_prefixer_impl.cc +++ b/gr-digital/lib/ofdm_cyclic_prefixer_impl.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "ofdm_cyclic_prefixer_impl.h" namespace gr { @@ -38,9 +38,9 @@ namespace gr { ofdm_cyclic_prefixer_impl::ofdm_cyclic_prefixer_impl(size_t input_size, size_t output_size, int rolloff_len, const std::string &len_tag_key) - : gr_tagged_stream_block ("ofdm_cyclic_prefixer", - gr_make_io_signature (1, 1, input_size*sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), + : tagged_stream_block ("ofdm_cyclic_prefixer", + io_signature::make (1, 1, input_size*sizeof(gr_complex)), + io_signature::make (1, 1, sizeof(gr_complex)), len_tag_key), d_fft_len(input_size), d_output_size(output_size), @@ -140,7 +140,7 @@ namespace gr { } d_delay_line.assign(d_delay_line.size(), 0); } - std::vector<gr_tag_t> tags; + std::vector<tag_t> tags; get_tags_in_range( tags, 0, nitems_read(0), nitems_read(0)+symbols_to_read diff --git a/gr-digital/lib/ofdm_cyclic_prefixer_impl.h b/gr-digital/lib/ofdm_cyclic_prefixer_impl.h index 5a5766f131..936fe995f4 100644 --- a/gr-digital/lib/ofdm_cyclic_prefixer_impl.h +++ b/gr-digital/lib/ofdm_cyclic_prefixer_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_IMPL_H #define INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_IMPL_H -#include <digital/ofdm_cyclic_prefixer.h> +#include <gnuradio/digital/ofdm_cyclic_prefixer.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/ofdm_equalizer_base.cc b/gr-digital/lib/ofdm_equalizer_base.cc index 5209b09c29..7e69b07634 100644 --- a/gr-digital/lib/ofdm_equalizer_base.cc +++ b/gr-digital/lib/ofdm_equalizer_base.cc @@ -23,7 +23,7 @@ #include "config.h" #endif -#include <digital/ofdm_equalizer_base.h> +#include <gnuradio/digital/ofdm_equalizer_base.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/ofdm_equalizer_simpledfe.cc b/gr-digital/lib/ofdm_equalizer_simpledfe.cc index fcb0e18cbf..8f518aa454 100644 --- a/gr-digital/lib/ofdm_equalizer_simpledfe.cc +++ b/gr-digital/lib/ofdm_equalizer_simpledfe.cc @@ -23,7 +23,7 @@ #include "config.h" #endif -#include <digital/ofdm_equalizer_simpledfe.h> +#include <gnuradio/digital/ofdm_equalizer_simpledfe.h> namespace gr { namespace digital { @@ -78,7 +78,7 @@ namespace gr { ofdm_equalizer_simpledfe::equalize(gr_complex *frame, int n_sym, const std::vector<gr_complex> &initial_taps, - const std::vector<gr_tag_t> &tags) + const std::vector<tag_t> &tags) { if (!initial_taps.empty()) { d_channel_state = initial_taps; diff --git a/gr-digital/lib/ofdm_equalizer_static.cc b/gr-digital/lib/ofdm_equalizer_static.cc index 8601eff430..ed24f1fe26 100644 --- a/gr-digital/lib/ofdm_equalizer_static.cc +++ b/gr-digital/lib/ofdm_equalizer_static.cc @@ -23,7 +23,7 @@ #include "config.h" #endif -#include <digital/ofdm_equalizer_static.h> +#include <gnuradio/digital/ofdm_equalizer_static.h> namespace gr { namespace digital { @@ -70,7 +70,7 @@ namespace gr { ofdm_equalizer_static::equalize(gr_complex *frame, int n_sym, const std::vector<gr_complex> &initial_taps, - const std::vector<gr_tag_t> &tags) + const std::vector<tag_t> &tags) { d_channel_state = initial_taps; diff --git a/gr-digital/lib/ofdm_frame_acquisition_impl.cc b/gr-digital/lib/ofdm_frame_acquisition_impl.cc index 1f45338d8f..2c2d6eff7a 100644 --- a/gr-digital/lib/ofdm_frame_acquisition_impl.cc +++ b/gr-digital/lib/ofdm_frame_acquisition_impl.cc @@ -25,9 +25,9 @@ #endif #include "ofdm_frame_acquisition_impl.h" -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <gr_math.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/expj.h> +#include <gnuradio/math.h> #include <cstdio> namespace gr { @@ -54,9 +54,9 @@ namespace gr { unsigned int cplen, const std::vector<gr_complex> &known_symbol, unsigned int max_fft_shift_len) - : gr_block("ofdm_frame_acquisition", - gr_make_io_signature2(2, 2, sizeof(gr_complex)*fft_length, sizeof(char)*fft_length), - gr_make_io_signature2(2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char))), + : block("ofdm_frame_acquisition", + io_signature::make2(2, 2, sizeof(gr_complex)*fft_length, sizeof(char)*fft_length), + io_signature::make2(2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char))), d_occupied_carriers(occupied_carriers), d_fft_length(fft_length), d_cplen(cplen), diff --git a/gr-digital/lib/ofdm_frame_acquisition_impl.h b/gr-digital/lib/ofdm_frame_acquisition_impl.h index 867d86736f..a28fc7177d 100644 --- a/gr-digital/lib/ofdm_frame_acquisition_impl.h +++ b/gr-digital/lib/ofdm_frame_acquisition_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_IMPL_H #define INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_IMPL_H -#include <digital/ofdm_frame_acquisition.h> +#include <gnuradio/digital/ofdm_frame_acquisition.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc b/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc index 68050f24b1..8546eb119b 100644 --- a/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc +++ b/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc @@ -23,7 +23,7 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "ofdm_frame_equalizer_vcvc_impl.h" namespace gr { @@ -49,9 +49,9 @@ namespace gr { const std::string &len_tag_key, bool propagate_channel_state, int fixed_frame_len - ) : gr_tagged_stream_block("ofdm_frame_equalizer_vcvc", - gr_make_io_signature(1, 1, sizeof (gr_complex) * equalizer->fft_len()), - gr_make_io_signature(1, 1, sizeof (gr_complex) * equalizer->fft_len()), + ) : tagged_stream_block("ofdm_frame_equalizer_vcvc", + io_signature::make(1, 1, sizeof (gr_complex) * equalizer->fft_len()), + io_signature::make(1, 1, sizeof (gr_complex) * equalizer->fft_len()), len_tag_key), d_fft_len(equalizer->fft_len()), d_eq(equalizer), @@ -85,7 +85,7 @@ namespace gr { frame_len = ninput_items[0]; } - std::vector<gr_tag_t> tags; + std::vector<tag_t> tags; get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+1); for (unsigned i = 0; i < tags.size(); i++) { if (pmt::symbol_to_string(tags[i].key) == "ofdm_sync_chan_taps") { diff --git a/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.h b/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.h index 81789e22c4..c5f039d1a6 100644 --- a/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.h +++ b/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_DIGITAL_OFDM_FRAME_EQUALIZER_VCVC_IMPL_H #define INCLUDED_DIGITAL_OFDM_FRAME_EQUALIZER_VCVC_IMPL_H -#include <digital/ofdm_frame_equalizer_vcvc.h> +#include <gnuradio/digital/ofdm_frame_equalizer_vcvc.h> namespace gr { namespace digital { @@ -38,7 +38,7 @@ namespace gr { protected: // These aren't really necessary, so let's override them with nuthin' - void remove_length_tags(const std::vector<std::vector<gr_tag_t> > &tags) {}; + void remove_length_tags(const std::vector<std::vector<tag_t> > &tags) {}; void update_length_tags(int n_produced, int n_ports) {}; public: diff --git a/gr-digital/lib/ofdm_frame_sink_impl.cc b/gr-digital/lib/ofdm_frame_sink_impl.cc index d2f00d3a45..b2e4f44ec9 100644 --- a/gr-digital/lib/ofdm_frame_sink_impl.cc +++ b/gr-digital/lib/ofdm_frame_sink_impl.cc @@ -25,9 +25,9 @@ #endif #include "ofdm_frame_sink_impl.h" -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <gr_math.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/expj.h> +#include <gnuradio/math.h> #include <cmath> #include <cstdio> #include <stdexcept> @@ -186,7 +186,7 @@ namespace gr { ofdm_frame_sink::sptr ofdm_frame_sink::make(const std::vector<gr_complex> &sym_position, const std::vector<char> &sym_value_out, - gr_msg_queue_sptr target_queue, + msg_queue::sptr target_queue, int occupied_carriers, float phase_gain, float freq_gain) { @@ -198,12 +198,12 @@ namespace gr { ofdm_frame_sink_impl::ofdm_frame_sink_impl(const std::vector<gr_complex> &sym_position, const std::vector<char> &sym_value_out, - gr_msg_queue_sptr target_queue, + msg_queue::sptr target_queue, int occupied_carriers, float phase_gain, float freq_gain) - : gr_sync_block("ofdm_frame_sink", - gr_make_io_signature2(2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char)), - gr_make_io_signature(1, 1, sizeof(gr_complex)*occupied_carriers)), + : sync_block("ofdm_frame_sink", + io_signature::make2(2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char)), + io_signature::make(1, 1, sizeof(gr_complex)*occupied_carriers)), d_target_queue(target_queue), d_occupied_carriers(occupied_carriers), d_byte_offset(0), d_partial_byte(0), d_resid(0), d_nresid(0),d_phase(0),d_freq(0), @@ -357,8 +357,8 @@ namespace gr { } if(d_packetlen_cnt == d_packetlen) { - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen); + message::sptr msg = + message::make(0, d_packet_whitener_offset, 0, d_packetlen); memcpy(msg->msg(), d_packet, d_packetlen_cnt); d_target_queue->insert_tail(msg); // send it msg.reset(); // free it up @@ -389,8 +389,8 @@ namespace gr { if (d_packetlen_cnt == d_packetlen){ // packet is filled // build a message // NOTE: passing header field as arg1 is not scalable - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen_cnt); + message::sptr msg = + message::make(0, d_packet_whitener_offset, 0, d_packetlen_cnt); memcpy(msg->msg(), d_packet, d_packetlen_cnt); d_target_queue->insert_tail(msg); // send it diff --git a/gr-digital/lib/ofdm_frame_sink_impl.h b/gr-digital/lib/ofdm_frame_sink_impl.h index 49d5d6b5c0..4f16a29701 100644 --- a/gr-digital/lib/ofdm_frame_sink_impl.h +++ b/gr-digital/lib/ofdm_frame_sink_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_OFDM_FRAME_SINK_IMPL_H #define INCLUDED_DIGITAL_OFDM_FRAME_SINK_IMPL_H -#include <digital/ofdm_frame_sink.h> +#include <gnuradio/digital/ofdm_frame_sink.h> namespace gr { namespace digital { @@ -36,7 +36,7 @@ namespace gr { static const int MAX_PKT_LEN = 4096; static const int HEADERBYTELEN = 4; - gr_msg_queue_sptr d_target_queue; // where to send the packet when received + msg_queue::sptr d_target_queue; // where to send the packet when received state_t d_state; unsigned int d_header; // header bits int d_headerbytelen_cnt; // how many so far @@ -90,7 +90,7 @@ namespace gr { public: ofdm_frame_sink_impl(const std::vector<gr_complex> &sym_position, const std::vector<char> &sym_value_out, - gr_msg_queue_sptr target_queue, + msg_queue::sptr target_queue, int occupied_tones, float phase_gain=0.25, float freq_gain=0.25*0.25/4); ~ofdm_frame_sink_impl(); diff --git a/gr-digital/lib/ofdm_insert_preamble_impl.cc b/gr-digital/lib/ofdm_insert_preamble_impl.cc index 100e69e22c..dcc3a900a4 100644 --- a/gr-digital/lib/ofdm_insert_preamble_impl.cc +++ b/gr-digital/lib/ofdm_insert_preamble_impl.cc @@ -24,7 +24,7 @@ #endif #include "ofdm_insert_preamble_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> #include <iostream> #include <string> @@ -42,11 +42,11 @@ namespace gr { ofdm_insert_preamble_impl::ofdm_insert_preamble_impl(int fft_length, const std::vector<std::vector<gr_complex> > &preamble) - : gr_block("ofdm_insert_preamble", - gr_make_io_signature2(1, 2, + : block("ofdm_insert_preamble", + io_signature::make2(1, 2, sizeof(gr_complex)*fft_length, sizeof(char)), - gr_make_io_signature2(1, 2, + io_signature::make2(1, 2, sizeof(gr_complex)*fft_length, sizeof(char))), d_fft_length(fft_length), diff --git a/gr-digital/lib/ofdm_insert_preamble_impl.h b/gr-digital/lib/ofdm_insert_preamble_impl.h index cd47810daf..f926d1a16b 100644 --- a/gr-digital/lib/ofdm_insert_preamble_impl.h +++ b/gr-digital/lib/ofdm_insert_preamble_impl.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_IMPL_H #define INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_IMPL_H -#include <digital/ofdm_insert_preamble.h> +#include <gnuradio/digital/ofdm_insert_preamble.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/ofdm_mapper_bcv_impl.cc b/gr-digital/lib/ofdm_mapper_bcv_impl.cc index 5b5359d7b9..b241a3be71 100644 --- a/gr-digital/lib/ofdm_mapper_bcv_impl.cc +++ b/gr-digital/lib/ofdm_mapper_bcv_impl.cc @@ -25,7 +25,7 @@ #endif #include "ofdm_mapper_bcv_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> #include <string> @@ -49,11 +49,11 @@ namespace gr { unsigned int msgq_limit, unsigned int occupied_carriers, unsigned int fft_length) - : gr_sync_block("ofdm_mapper_bcv", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature2(1, 2, sizeof(gr_complex)*fft_length, sizeof(char))), + : sync_block("ofdm_mapper_bcv", + io_signature::make(0, 0, 0), + io_signature::make2(1, 2, sizeof(gr_complex)*fft_length, sizeof(char))), d_constellation(constellation), - d_msgq(gr_make_msg_queue(msgq_limit)), d_msg_offset(0), d_eof(false), + d_msgq(msg_queue::make(msgq_limit)), d_msg_offset(0), d_eof(false), d_occupied_carriers(occupied_carriers), d_fft_length(fft_length), d_bit_offset(0), diff --git a/gr-digital/lib/ofdm_mapper_bcv_impl.h b/gr-digital/lib/ofdm_mapper_bcv_impl.h index 6459ed73d8..fc2daf5bd8 100644 --- a/gr-digital/lib/ofdm_mapper_bcv_impl.h +++ b/gr-digital/lib/ofdm_mapper_bcv_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_OFDM_MAPPER_BCV_IMPL_H #define INCLUDED_DIGITAL_OFDM_MAPPER_BCV_IMPL_H -#include <digital/ofdm_mapper_bcv.h> -#include <gr_message.h> +#include <gnuradio/digital/ofdm_mapper_bcv.h> +#include <gnuradio/message.h> #include <vector> namespace gr { @@ -34,10 +34,10 @@ namespace gr { { private: std::vector<gr_complex> d_constellation; - gr_msg_queue_sptr d_msgq; - gr_message_sptr d_msg; - unsigned d_msg_offset; - bool d_eof; + msg_queue::sptr d_msgq; + message::sptr d_msg; + unsigned d_msg_offset; + bool d_eof; unsigned int d_occupied_carriers; unsigned int d_fft_length; @@ -61,7 +61,7 @@ namespace gr { unsigned int fft_length); ~ofdm_mapper_bcv_impl(void); - gr_msg_queue_sptr msgq() const { return d_msgq; } + msg_queue::sptr msgq() const { return d_msgq; } int work(int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gr-digital/lib/ofdm_sampler_impl.cc b/gr-digital/lib/ofdm_sampler_impl.cc index 0724b7cf26..dd6197dfc7 100644 --- a/gr-digital/lib/ofdm_sampler_impl.cc +++ b/gr-digital/lib/ofdm_sampler_impl.cc @@ -25,8 +25,8 @@ #endif #include "ofdm_sampler_impl.h" -#include <gr_io_signature.h> -#include <gr_expj.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/expj.h> #include <cstdio> namespace gr { @@ -44,9 +44,9 @@ namespace gr { ofdm_sampler_impl::ofdm_sampler_impl(unsigned int fft_length, unsigned int symbol_length, unsigned int timeout) - : gr_block("ofdm_sampler", - gr_make_io_signature2(2, 2, sizeof(gr_complex), sizeof(char)), - gr_make_io_signature2(2, 2, sizeof(gr_complex)*fft_length, sizeof(char)*fft_length)), + : block("ofdm_sampler", + io_signature::make2(2, 2, sizeof(gr_complex), sizeof(char)), + io_signature::make2(2, 2, sizeof(gr_complex)*fft_length, sizeof(char)*fft_length)), d_state(STATE_NO_SIG), d_timeout_max(timeout), d_fft_length(fft_length), d_symbol_length(symbol_length) { diff --git a/gr-digital/lib/ofdm_sampler_impl.h b/gr-digital/lib/ofdm_sampler_impl.h index 369447465f..b1f57cb330 100644 --- a/gr-digital/lib/ofdm_sampler_impl.h +++ b/gr-digital/lib/ofdm_sampler_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_DIGITAL_OFDM_SAMPLER_IMPL_H #define INCLUDED_DIGITAL_OFDM_SAMPLER_IMPL_H -#include <digital/ofdm_sampler.h> -#include <gr_sync_block.h> +#include <gnuradio/digital/ofdm_sampler.h> +#include <gnuradio/sync_block.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/ofdm_serializer_vcc_impl.cc b/gr-digital/lib/ofdm_serializer_vcc_impl.cc index 09c0039a1c..9ca6d59ec9 100644 --- a/gr-digital/lib/ofdm_serializer_vcc_impl.cc +++ b/gr-digital/lib/ofdm_serializer_vcc_impl.cc @@ -23,7 +23,7 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "ofdm_serializer_vcc_impl.h" namespace gr { @@ -75,9 +75,9 @@ namespace gr { const std::string &packet_len_tag_key, int symbols_skipped, bool input_is_shifted) - : gr_tagged_stream_block ("ofdm_serializer_vcc", - gr_make_io_signature(1, 1, sizeof (gr_complex) * fft_len), - gr_make_io_signature(1, 1, sizeof (gr_complex)), + : tagged_stream_block ("ofdm_serializer_vcc", + io_signature::make(1, 1, sizeof (gr_complex) * fft_len), + io_signature::make(1, 1, sizeof (gr_complex)), len_tag_key), d_fft_len(fft_len), d_occupied_carriers(occupied_carriers), @@ -143,7 +143,7 @@ namespace gr { long packet_length = 0; // Output frame int carr_offset = 0; - std::vector<gr_tag_t> tags; + std::vector<tag_t> tags; // Packet mode if (!d_length_tag_key_str.empty()) { get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+1); diff --git a/gr-digital/lib/ofdm_serializer_vcc_impl.h b/gr-digital/lib/ofdm_serializer_vcc_impl.h index 4f750eac71..0ec0ec3505 100644 --- a/gr-digital/lib/ofdm_serializer_vcc_impl.h +++ b/gr-digital/lib/ofdm_serializer_vcc_impl.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_DIGITAL_OFDM_SERIALIZER_VCC_IMPL_H #define INCLUDED_DIGITAL_OFDM_SERIALIZER_VCC_IMPL_H -#include <digital/ofdm_serializer_vcc.h> +#include <gnuradio/digital/ofdm_serializer_vcc.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc b/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc index 822b9021e2..1a75883de7 100644 --- a/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc +++ b/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc @@ -24,20 +24,20 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "ofdm_sync_sc_cfb_impl.h" -#include <blocks/plateau_detector_fb.h> -#include <blocks/complex_to_arg.h> -#include <blocks/complex_to_mag_squared.h> -#include <blocks/conjugate_cc.h> -#include <blocks/delay.h> -#include <blocks/divide_ff.h> -#include <blocks/multiply_cc.h> -#include <blocks/multiply_ff.h> -#include <blocks/sample_and_hold_ff.h> -#include <filter/fir_filter_ccf.h> -#include <filter/fir_filter_fff.h> +#include <gnuradio/blocks/plateau_detector_fb.h> +#include <gnuradio/blocks/complex_to_arg.h> +#include <gnuradio/blocks/complex_to_mag_squared.h> +#include <gnuradio/blocks/conjugate_cc.h> +#include <gnuradio/blocks/delay.h> +#include <gnuradio/blocks/divide_ff.h> +#include <gnuradio/blocks/multiply_cc.h> +#include <gnuradio/blocks/multiply_ff.h> +#include <gnuradio/blocks/sample_and_hold_ff.h> +#include <gnuradio/filter/fir_filter_ccf.h> +#include <gnuradio/filter/fir_filter_fff.h> namespace gr { namespace digital { @@ -49,12 +49,12 @@ namespace gr { } ofdm_sync_sc_cfb_impl::ofdm_sync_sc_cfb_impl(int fft_len, int cp_len) - : gr_hier_block2 ("ofdm_sync_sc_cfb", - gr_make_io_signature(1, 1, sizeof (gr_complex)), + : hier_block2 ("ofdm_sync_sc_cfb", + io_signature::make(1, 1, sizeof (gr_complex)), #ifndef SYNC_ADD_DEBUG_OUTPUT - gr_make_io_signature2(2, 2, sizeof (float), sizeof (unsigned char))) + io_signature::make2(2, 2, sizeof (float), sizeof (unsigned char))) #else - gr_make_io_signature3(3, 3, sizeof (float), sizeof (unsigned char), sizeof (float))) + io_signature::make3(3, 3, sizeof (float), sizeof (unsigned char), sizeof (float))) #endif { std::vector<float> ma_taps(fft_len/2, 1.0); diff --git a/gr-digital/lib/ofdm_sync_sc_cfb_impl.h b/gr-digital/lib/ofdm_sync_sc_cfb_impl.h index 207ea41ae1..b217002038 100644 --- a/gr-digital/lib/ofdm_sync_sc_cfb_impl.h +++ b/gr-digital/lib/ofdm_sync_sc_cfb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_OFDM_SYNC_SC_CFB_IMPL_H #define INCLUDED_DIGITAL_OFDM_SYNC_SC_CFB_IMPL_H -#include <digital/ofdm_sync_sc_cfb.h> +#include <gnuradio/digital/ofdm_sync_sc_cfb.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/packet_header_default.cc b/gr-digital/lib/packet_header_default.cc index ef5e44ac8d..eb639260c6 100644 --- a/gr-digital/lib/packet_header_default.cc +++ b/gr-digital/lib/packet_header_default.cc @@ -24,7 +24,7 @@ #endif #include <string.h> -#include <digital/packet_header_default.h> +#include <gnuradio/digital/packet_header_default.h> namespace gr { namespace digital { @@ -64,7 +64,7 @@ namespace gr { bool packet_header_default::header_formatter( long packet_len, unsigned char *out, - const std::vector<gr_tag_t> &tags + const std::vector<tag_t> &tags ) { packet_len &= 0x0FFF; @@ -91,11 +91,11 @@ namespace gr { bool packet_header_default::header_parser( const unsigned char *in, - std::vector<gr_tag_t> &tags) + std::vector<tag_t> &tags) { unsigned header_len = 0; unsigned header_num = 0; - gr_tag_t tag; + tag_t tag; int k = 0; // Position in "in" for (int i = 0; i < 12 && k < d_header_len; i += d_bits_per_byte, k++) { diff --git a/gr-digital/lib/packet_header_ofdm.cc b/gr-digital/lib/packet_header_ofdm.cc index cd42273285..03a9581a6c 100644 --- a/gr-digital/lib/packet_header_ofdm.cc +++ b/gr-digital/lib/packet_header_ofdm.cc @@ -23,7 +23,7 @@ #include "config.h" #endif -#include <digital/packet_header_ofdm.h> +#include <gnuradio/digital/packet_header_ofdm.h> namespace gr { namespace digital { @@ -85,7 +85,7 @@ namespace gr { bool packet_header_ofdm::header_parser( const unsigned char *in, - std::vector<gr_tag_t> &tags) + std::vector<tag_t> &tags) { if (!packet_header_default::header_parser(in, tags)) { return false; @@ -108,7 +108,7 @@ namespace gr { frame_len++; i += d_occupied_carriers[k].size(); } - gr_tag_t tag; + tag_t tag; tag.key = d_frame_len_tag_key; tag.value = pmt::from_long(frame_len); tags.push_back(tag); diff --git a/gr-digital/lib/packet_headergenerator_bb_impl.cc b/gr-digital/lib/packet_headergenerator_bb_impl.cc index 3232858148..a0191fe85a 100644 --- a/gr-digital/lib/packet_headergenerator_bb_impl.cc +++ b/gr-digital/lib/packet_headergenerator_bb_impl.cc @@ -24,7 +24,7 @@ #endif #include <boost/format.hpp> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "packet_headergenerator_bb_impl.h" namespace gr { @@ -57,9 +57,9 @@ namespace gr { const gr::digital::packet_header_default::sptr &header_formatter, const std::string &len_tag_key ) - : gr_tagged_stream_block("packet_headergenerator_bb_impl", - gr_make_io_signature(1, 1, sizeof (char)), - gr_make_io_signature(1, 1, sizeof (char)), + : tagged_stream_block("packet_headergenerator_bb_impl", + io_signature::make(1, 1, sizeof (char)), + io_signature::make(1, 1, sizeof (char)), len_tag_key), d_formatter(header_formatter) { diff --git a/gr-digital/lib/packet_headergenerator_bb_impl.h b/gr-digital/lib/packet_headergenerator_bb_impl.h index ce60fdf76c..3cca23fc5e 100644 --- a/gr-digital/lib/packet_headergenerator_bb_impl.h +++ b/gr-digital/lib/packet_headergenerator_bb_impl.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_DIGITAL_PACKET_HEADERGENERATOR_BB_IMPL_H #define INCLUDED_DIGITAL_PACKET_HEADERGENERATOR_BB_IMPL_H -#include <digital/packet_headergenerator_bb.h> +#include <gnuradio/digital/packet_headergenerator_bb.h> namespace gr { namespace digital { @@ -39,7 +39,7 @@ namespace gr { ); ~packet_headergenerator_bb_impl(); - void remove_length_tags(const std::vector<std::vector<gr_tag_t> > &tags) {}; + void remove_length_tags(const std::vector<std::vector<tag_t> > &tags) {}; int calculate_output_stream_length(const gr_vector_int &ninput_items) { return d_formatter->header_len(); }; int work(int noutput_items, diff --git a/gr-digital/lib/packet_headerparser_b_impl.cc b/gr-digital/lib/packet_headerparser_b_impl.cc index 17e5e85091..d55a3bd303 100644 --- a/gr-digital/lib/packet_headerparser_b_impl.cc +++ b/gr-digital/lib/packet_headerparser_b_impl.cc @@ -24,7 +24,7 @@ #endif #include <boost/format.hpp> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "packet_headerparser_b_impl.h" #define msg_port_id pmt::mp("header_data") @@ -48,9 +48,9 @@ namespace gr { } packet_headerparser_b_impl::packet_headerparser_b_impl(const gr::digital::packet_header_default::sptr &header_formatter) - : gr_sync_block("packet_headerparser_b", - gr_make_io_signature(1, 1, sizeof (unsigned char)), - gr_make_io_signature(0, 0, 0)), + : sync_block("packet_headerparser_b", + io_signature::make(1, 1, sizeof (unsigned char)), + io_signature::make(0, 0, 0)), d_header_formatter(header_formatter) { message_port_register_out(msg_port_id); @@ -72,7 +72,7 @@ namespace gr { return 0; } - std::vector<gr_tag_t> tags; + std::vector<tag_t> tags; if (!d_header_formatter->header_parser(in, tags)) { GR_LOG_INFO(d_logger, boost::format("Detected an invalid packet at item %1%") % nitems_read(0)); message_port_pub(msg_port_id, pmt::PMT_F); diff --git a/gr-digital/lib/packet_headerparser_b_impl.h b/gr-digital/lib/packet_headerparser_b_impl.h index a7ded1143f..41641eda4d 100644 --- a/gr-digital/lib/packet_headerparser_b_impl.h +++ b/gr-digital/lib/packet_headerparser_b_impl.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_DIGITAL_PACKET_HEADERPARSER_B_IMPL_H #define INCLUDED_DIGITAL_PACKET_HEADERPARSER_B_IMPL_H -#include <digital/packet_headerparser_b.h> +#include <gnuradio/digital/packet_headerparser_b.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/packet_sink_impl.cc b/gr-digital/lib/packet_sink_impl.cc index 1d79b3d717..56a3d8b395 100644 --- a/gr-digital/lib/packet_sink_impl.cc +++ b/gr-digital/lib/packet_sink_impl.cc @@ -25,14 +25,14 @@ #endif #include "packet_sink_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdexcept> -#include <blocks/count_bits.h> +#include <gnuradio/blocks/count_bits.h> #include <string.h> namespace gr { @@ -79,17 +79,17 @@ static const int DEFAULT_THRESHOLD = 12; packet_sink::sptr packet_sink::make(const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, int threshold) + msg_queue::sptr target_queue, int threshold) { return gnuradio::get_initial_sptr (new packet_sink_impl(sync_vector, target_queue, threshold)); } packet_sink_impl::packet_sink_impl(const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, int threshold) - : gr_sync_block("packet_sink", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(0, 0, 0)), + msg_queue::sptr target_queue, int threshold) + : sync_block("packet_sink", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(0, 0, 0)), d_target_queue(target_queue), d_threshold(threshold == -1 ? DEFAULT_THRESHOLD : threshold) { d_sync_vector = 0; @@ -184,7 +184,7 @@ static const int DEFAULT_THRESHOLD = 12; if(d_packetlen_cnt == d_packetlen) { // packet is filled // build a message - gr_message_sptr msg = gr_make_message(0, 0, 0, d_packetlen_cnt); + message::sptr msg = message::make(0, 0, 0, d_packetlen_cnt); memcpy(msg->msg(), d_packet, d_packetlen_cnt); d_target_queue->insert_tail(msg); // send it diff --git a/gr-digital/lib/packet_sink_impl.h b/gr-digital/lib/packet_sink_impl.h index a63db7a142..2a1da67b7f 100644 --- a/gr-digital/lib/packet_sink_impl.h +++ b/gr-digital/lib/packet_sink_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_PACKET_SINK_IMPL_H #define INCLUDED_GR_PACKET_SINK_IMPL_H -#include <digital/packet_sink.h> +#include <gnuradio/digital/packet_sink.h> namespace gr { namespace digital { @@ -36,7 +36,7 @@ namespace gr { static const int MAX_PKT_LEN = 4096; static const int HEADERBITLEN = 32; - gr_msg_queue_sptr d_target_queue; // where to send the packet when received + msg_queue::sptr d_target_queue; // where to send the packet when received unsigned long long d_sync_vector; // access code to locate start of packet unsigned int d_threshold; // how many bits may be wrong in sync vector @@ -45,7 +45,7 @@ namespace gr { unsigned long long d_shift_reg; // used to look for sync_vector unsigned int d_header; // header bits - int d_headerbitlen_cnt;// how many so far + int d_headerbitlen_cnt;// how many so far unsigned char d_packet[MAX_PKT_LEN]; // assembled payload unsigned char d_packet_byte; // byte being assembled @@ -75,7 +75,7 @@ namespace gr { public: packet_sink_impl(const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, + msg_queue::sptr target_queue, int threshold=-1); ~packet_sink_impl(); diff --git a/gr-digital/lib/pfb_clock_sync_ccf_impl.cc b/gr-digital/lib/pfb_clock_sync_ccf_impl.cc index 3c4a0e8ad4..685c0e6150 100644 --- a/gr-digital/lib/pfb_clock_sync_ccf_impl.cc +++ b/gr-digital/lib/pfb_clock_sync_ccf_impl.cc @@ -28,8 +28,8 @@ #include <cmath> #include "pfb_clock_sync_ccf_impl.h" -#include <gr_io_signature.h> -#include <gr_math.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/math.h> namespace gr { namespace digital { @@ -58,9 +58,9 @@ namespace gr { float init_phase, float max_rate_deviation, int osps) - : gr_block("pfb_clock_sync_ccf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signaturev(1, 4, iosig)), + : block("pfb_clock_sync_ccf", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::makev(1, 4, iosig)), d_updated(false), d_nfilters(filter_size), d_max_dev(max_rate_deviation), d_osps(osps), d_error(0), d_out_idx(0) @@ -443,7 +443,7 @@ namespace gr { d_k = d_k + d_alpha*d_error; // Keep our rate within a good range - d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev); + d_rate_f = gr::branchless_clip(d_rate_f, d_max_dev); i+=d_osps; count += (int)floor(d_sps); diff --git a/gr-digital/lib/pfb_clock_sync_ccf_impl.h b/gr-digital/lib/pfb_clock_sync_ccf_impl.h index c7fdc9183e..7020dd0bd5 100644 --- a/gr-digital/lib/pfb_clock_sync_ccf_impl.h +++ b/gr-digital/lib/pfb_clock_sync_ccf_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_IMPL_H #define INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_IMPL_H -#include <digital/pfb_clock_sync_ccf.h> +#include <gnuradio/digital/pfb_clock_sync_ccf.h> using namespace gr::filter; diff --git a/gr-digital/lib/pfb_clock_sync_fff_impl.cc b/gr-digital/lib/pfb_clock_sync_fff_impl.cc index fb60192324..236738c550 100644 --- a/gr-digital/lib/pfb_clock_sync_fff_impl.cc +++ b/gr-digital/lib/pfb_clock_sync_fff_impl.cc @@ -28,8 +28,8 @@ #include <cmath> #include "pfb_clock_sync_fff_impl.h" -#include <gr_io_signature.h> -#include <gr_math.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/math.h> namespace gr { namespace digital { @@ -58,9 +58,9 @@ namespace gr { float init_phase, float max_rate_deviation, int osps) - : gr_block("pfb_clock_sync_fff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signaturev(1, 4, iosig)), + : block("pfb_clock_sync_fff", + io_signature::make(1, 1, sizeof(float)), + io_signature::makev(1, 4, iosig)), d_updated(false), d_nfilters(filter_size), d_max_dev(max_rate_deviation), d_osps(osps), d_error(0), d_out_idx(0) @@ -421,7 +421,7 @@ namespace gr { d_k = d_k + d_alpha*d_error; // Keep our rate within a good range - d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev); + d_rate_f = gr::branchless_clip(d_rate_f, d_max_dev); i+=d_osps; count += (int)floor(d_sps); diff --git a/gr-digital/lib/pfb_clock_sync_fff_impl.h b/gr-digital/lib/pfb_clock_sync_fff_impl.h index 2ade1e646f..7f78b4e60c 100644 --- a/gr-digital/lib/pfb_clock_sync_fff_impl.h +++ b/gr-digital/lib/pfb_clock_sync_fff_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_IMPL_H #define INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_IMPL_H -#include <digital/pfb_clock_sync_fff.h> +#include <gnuradio/digital/pfb_clock_sync_fff.h> using namespace gr::filter; diff --git a/gr-digital/lib/pn_correlator_cc_impl.cc b/gr-digital/lib/pn_correlator_cc_impl.cc index da0bdbefe9..649b73be14 100644 --- a/gr-digital/lib/pn_correlator_cc_impl.cc +++ b/gr-digital/lib/pn_correlator_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include "pn_correlator_cc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace digital { @@ -40,9 +40,9 @@ namespace gr { pn_correlator_cc_impl::pn_correlator_cc_impl(int degree, int mask, int seed) - : gr_sync_decimator("pn_correlator_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex)), + : sync_decimator("pn_correlator_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex)), (unsigned int)((1ULL << degree)-1)) // PN code length { d_len = (unsigned int)((1ULL << degree)-1); diff --git a/gr-digital/lib/pn_correlator_cc_impl.h b/gr-digital/lib/pn_correlator_cc_impl.h index bea9a30505..a98721eb70 100644 --- a/gr-digital/lib/pn_correlator_cc_impl.h +++ b/gr-digital/lib/pn_correlator_cc_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_PN_CORRELATOR_CC_IMPL_H #define INCLUDED_GR_PN_CORRELATOR_CC_IMPL_H -#include <digital/pn_correlator_cc.h> -#include <digital/glfsr.h> +#include <gnuradio/digital/pn_correlator_cc.h> +#include <gnuradio/digital/glfsr.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/probe_density_b_impl.cc b/gr-digital/lib/probe_density_b_impl.cc index 532930ad1b..d718d4b44d 100644 --- a/gr-digital/lib/probe_density_b_impl.cc +++ b/gr-digital/lib/probe_density_b_impl.cc @@ -23,7 +23,7 @@ #endif #include "probe_density_b_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> namespace gr { @@ -37,9 +37,9 @@ namespace gr { } probe_density_b_impl::probe_density_b_impl(double alpha) - : gr_sync_block("density_b", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(0, 0, 0)) + : sync_block("density_b", + io_signature::make(1, 1, sizeof(char)), + io_signature::make(0, 0, 0)) { set_alpha(alpha); d_density = 1.0; diff --git a/gr-digital/lib/probe_density_b_impl.h b/gr-digital/lib/probe_density_b_impl.h index e792403dc5..a7a6086dd1 100644 --- a/gr-digital/lib/probe_density_b_impl.h +++ b/gr-digital/lib/probe_density_b_impl.h @@ -21,7 +21,7 @@ #ifndef INCLUDED_GR_PROBE_DENSITY_B_IMPL_H #define INCLUDED_GR_PROBE_DENSITY_B_IMPL_H -#include <digital/probe_density_b.h> +#include <gnuradio/digital/probe_density_b.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/probe_mpsk_snr_est_c_impl.cc b/gr-digital/lib/probe_mpsk_snr_est_c_impl.cc index fb71bdc110..6fa7c1bd0d 100644 --- a/gr-digital/lib/probe_mpsk_snr_est_c_impl.cc +++ b/gr-digital/lib/probe_mpsk_snr_est_c_impl.cc @@ -25,7 +25,7 @@ #endif #include "probe_mpsk_snr_est_c_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> namespace gr { @@ -43,9 +43,9 @@ namespace gr { probe_mpsk_snr_est_c_impl::probe_mpsk_snr_est_c_impl(snr_est_type_t type, int msg_nsamples, double alpha) - : gr_sync_block("probe_mpsk_snr_est_c", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)) + : sync_block("probe_mpsk_snr_est_c", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(0, 0, 0)) { d_snr_est = NULL; diff --git a/gr-digital/lib/probe_mpsk_snr_est_c_impl.h b/gr-digital/lib/probe_mpsk_snr_est_c_impl.h index 90da85d21b..0663595928 100644 --- a/gr-digital/lib/probe_mpsk_snr_est_c_impl.h +++ b/gr-digital/lib/probe_mpsk_snr_est_c_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_IMPL_H #define INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_IMPL_H -#include <digital/probe_mpsk_snr_est_c.h> +#include <gnuradio/digital/probe_mpsk_snr_est_c.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/scrambler_bb_impl.cc b/gr-digital/lib/scrambler_bb_impl.cc index d656fe2430..3b32833419 100644 --- a/gr-digital/lib/scrambler_bb_impl.cc +++ b/gr-digital/lib/scrambler_bb_impl.cc @@ -25,7 +25,7 @@ #endif #include "scrambler_bb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace digital { @@ -38,9 +38,9 @@ namespace gr { } scrambler_bb_impl::scrambler_bb_impl(int mask, int seed, int len) - : gr_sync_block("scrambler_bb", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(unsigned char))), + : sync_block("scrambler_bb", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(unsigned char))), d_lfsr(mask, seed, len) { } diff --git a/gr-digital/lib/scrambler_bb_impl.h b/gr-digital/lib/scrambler_bb_impl.h index 8525e7ef5c..7d09e9709c 100644 --- a/gr-digital/lib/scrambler_bb_impl.h +++ b/gr-digital/lib/scrambler_bb_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_SCRAMBLER_BB_IMPL_H #define INCLUDED_GR_SCRAMBLER_BB_IMPL_H -#include <digital/scrambler_bb.h> -#include <gr_sync_block.h> -#include <digital/lfsr.h> +#include <gnuradio/digital/scrambler_bb.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/digital/lfsr.h> namespace gr { namespace digital { diff --git a/gr-digital/lib/simple_correlator_impl.cc b/gr-digital/lib/simple_correlator_impl.cc index 6b35b4cf0d..6524e906a4 100644 --- a/gr-digital/lib/simple_correlator_impl.cc +++ b/gr-digital/lib/simple_correlator_impl.cc @@ -25,9 +25,9 @@ #endif #include "simple_correlator_impl.h" -#include <digital/simple_framer_sync.h> -#include <gr_io_signature.h> -#include <blocks/count_bits.h> +#include <gnuradio/digital/simple_framer_sync.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/blocks/count_bits.h> #include <assert.h> #include <stdexcept> #include <string.h> @@ -46,9 +46,9 @@ namespace gr { } simple_correlator_impl::simple_correlator_impl(int payload_bytesize) - : gr_block("simple_correlator", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(unsigned char))), + : block("simple_correlator", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(unsigned char))), d_payload_bytesize(payload_bytesize), d_state(ST_LOOKING), d_osi(0), d_bblen((payload_bytesize + GRSF_PAYLOAD_OVERHEAD) * GRSF_BITS_PER_BYTE), diff --git a/gr-digital/lib/simple_correlator_impl.h b/gr-digital/lib/simple_correlator_impl.h index fe324131fd..09868682e7 100644 --- a/gr-digital/lib/simple_correlator_impl.h +++ b/gr-digital/lib/simple_correlator_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_SIMPLE_CORRELATOR_IMPL_H #define INCLUDED_GR_SIMPLE_CORRELATOR_IMPL_H -#include <digital/simple_correlator.h> +#include <gnuradio/digital/simple_correlator.h> //#define DEBUG_SIMPLE_CORRELATOR diff --git a/gr-digital/lib/simple_framer_impl.cc b/gr-digital/lib/simple_framer_impl.cc index ff7e3ab614..0f8a068276 100644 --- a/gr-digital/lib/simple_framer_impl.cc +++ b/gr-digital/lib/simple_framer_impl.cc @@ -25,8 +25,8 @@ #endif #include "simple_framer_impl.h" -#include <digital/simple_framer_sync.h> -#include <gr_io_signature.h> +#include <gnuradio/digital/simple_framer_sync.h> +#include <gnuradio/io_signature.h> #include <assert.h> #include <string> @@ -41,9 +41,9 @@ namespace gr { } simple_framer_impl::simple_framer_impl(int payload_bytesize) - : gr_block("simple_framer", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(unsigned char))), + : block("simple_framer", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(unsigned char))), d_seqno (0), d_payload_bytesize (payload_bytesize), d_input_block_size (payload_bytesize), d_output_block_size (payload_bytesize + GRSF_OVERHEAD) diff --git a/gr-digital/lib/simple_framer_impl.h b/gr-digital/lib/simple_framer_impl.h index fe967eb26a..25dda4429e 100644 --- a/gr-digital/lib/simple_framer_impl.h +++ b/gr-digital/lib/simple_framer_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_SIMPLE_FRAMER_IMPL_H #define INCLUDED_GR_SIMPLE_FRAMER_IMPL_H -#include <digital/simple_framer.h> +#include <gnuradio/digital/simple_framer.h> namespace gr { namespace digital { diff --git a/gr-digital/python/qa_crc32_bb.py b/gr-digital/python/qa_crc32_bb.py index 6f5249ca08..4991f49e14 100755 --- a/gr-digital/python/qa_crc32_bb.py +++ b/gr-digital/python/qa_crc32_bb.py @@ -36,7 +36,7 @@ class qa_crc32_bb (gr_unittest.TestCase): """ Make sure the output of a CRC set is 4 bytes longer than the input. """ data = range(16) tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(data)) @@ -53,7 +53,7 @@ class qa_crc32_bb (gr_unittest.TestCase): is the same as the input. """ data = (0, 1, 2, 3, 4, 5, 6, 7, 8) tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(data)) @@ -70,23 +70,23 @@ class qa_crc32_bb (gr_unittest.TestCase): tag_name = "length" pack_len = 8 packets = range(pack_len*2) - tag1 = gr.gr_tag_t() + tag1 = gr.tag_t() tag1.offset = 0 tag1.key = pmt.string_to_symbol(tag_name) tag1.value = pmt.from_long(pack_len) - tag2 = gr.gr_tag_t() + tag2 = gr.tag_t() tag2.offset = pack_len tag2.key = pmt.string_to_symbol(tag_name) tag2.value = pmt.from_long(pack_len) - testtag1 = gr.gr_tag_t() + testtag1 = gr.tag_t() testtag1.offset = 1 testtag1.key = pmt.string_to_symbol("tag1") testtag1.value = pmt.from_long(0) - testtag2 = gr.gr_tag_t() + testtag2 = gr.tag_t() testtag2.offset = pack_len testtag2.key = pmt.string_to_symbol("tag2") testtag2.value = pmt.from_long(0) - testtag3 = gr.gr_tag_t() + testtag3 = gr.tag_t() testtag3.offset = len(packets)-1 testtag3.key = pmt.string_to_symbol("tag3") testtag3.value = pmt.from_long(0) @@ -112,7 +112,7 @@ class qa_crc32_bb (gr_unittest.TestCase): """ Corrupt the data and make sure it fails CRC test. """ data = (0, 1, 2, 3, 4, 5, 6, 7) tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(data)) @@ -130,11 +130,11 @@ class qa_crc32_bb (gr_unittest.TestCase): """ Make sure tags on the CRC aren't lost. """ data = (0, 1, 2, 3, 4, 5, 6, 7, 8, 230, 166, 39, 8) tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(data)) - testtag = gr.gr_tag_t() + testtag = gr.tag_t() testtag.offset = len(data)-1 testtag.key = pmt.string_to_symbol('tag1') testtag.value = pmt.from_long(0) diff --git a/gr-digital/python/qa_ofdm_carrier_allocator_cvc.py b/gr-digital/python/qa_ofdm_carrier_allocator_cvc.py index f5c72fb87e..c0c9929646 100755 --- a/gr-digital/python/qa_ofdm_carrier_allocator_cvc.py +++ b/gr-digital/python/qa_ofdm_carrier_allocator_cvc.py @@ -46,7 +46,7 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase): expected_result = tuple(sync_word[0] + [1j, 0, 0, 1, 2, 3]) # ^ DC carrier tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(tx_symbols)) @@ -74,7 +74,7 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase): expected_result = (1j, 0, 1, 2, 3) # ^ DC carrier tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(tx_symbols)) @@ -100,7 +100,7 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase): pilot_carriers = ((3,),) expected_result = (1j, 0, 1, 0, 2, 3) tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(tx_symbols)) @@ -134,27 +134,27 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase): 0, 13, 1j, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 2j, 0, 0) fft_len = 16 tag_name = "len" - tag1 = gr.gr_tag_t() + tag1 = gr.tag_t() tag1.offset = 0 tag1.key = pmt.string_to_symbol(tag_name) tag1.value = pmt.from_long(len(tx_symbols)) - tag2 = gr.gr_tag_t() + tag2 = gr.tag_t() tag2.offset = len(tx_symbols) tag2.key = pmt.string_to_symbol(tag_name) tag2.value = pmt.from_long(len(tx_symbols)) - testtag1 = gr.gr_tag_t() + testtag1 = gr.tag_t() testtag1.offset = 0 testtag1.key = pmt.string_to_symbol('tag1') testtag1.value = pmt.from_long(0) - testtag2 = gr.gr_tag_t() + testtag2 = gr.tag_t() testtag2.offset = 7 # On the 2nd OFDM symbol testtag2.key = pmt.string_to_symbol('tag2') testtag2.value = pmt.from_long(0) - testtag3 = gr.gr_tag_t() + testtag3 = gr.tag_t() testtag3.offset = len(tx_symbols)+1 # First OFDM symbol of packet 2 testtag3.key = pmt.string_to_symbol('tag3') testtag3.value = pmt.from_long(0) - testtag4 = gr.gr_tag_t() + testtag4 = gr.tag_t() testtag4.offset = 2*len(tx_symbols)-1 # Last OFDM symbol of packet 2 testtag4.key = pmt.string_to_symbol('tag4') testtag4.value = pmt.from_long(0) diff --git a/gr-digital/python/qa_ofdm_chanest_vcvc.py b/gr-digital/python/qa_ofdm_chanest_vcvc.py index d095bbcd9c..b11bb4c556 100755 --- a/gr-digital/python/qa_ofdm_chanest_vcvc.py +++ b/gr-digital/python/qa_ofdm_chanest_vcvc.py @@ -61,11 +61,11 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase): tx_data = shift_tuple(sync_symbol1, carr_offset) + \ shift_tuple(sync_symbol2, carr_offset) + \ shift_tuple(data_symbol, carr_offset) - tag1 = gr.gr_tag_t() + tag1 = gr.tag_t() tag1.offset = 0 tag1.key = pmt.string_to_symbol("test_tag_1") tag1.value = pmt.from_long(23) - tag2 = gr.gr_tag_t() + tag2 = gr.tag_t() tag2.offset = 2 tag2.key = pmt.string_to_symbol("test_tag_2") tag2.value = pmt.from_long(42) diff --git a/gr-digital/python/qa_ofdm_cyclic_prefixer.py b/gr-digital/python/qa_ofdm_cyclic_prefixer.py index 0469b3f970..69091d8d00 100755 --- a/gr-digital/python/qa_ofdm_cyclic_prefixer.py +++ b/gr-digital/python/qa_ofdm_cyclic_prefixer.py @@ -67,11 +67,11 @@ class test_ofdm_cyclic_prefixer (gr_unittest.TestCase): tag_name = "length" expected_result = (7.0/2, 8, 1, 2, 3, 4, 5, 6, 7, 8, # 1.0/2 7.0/2+1.0/2, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1.0/2) - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(2) - tag2 = gr.gr_tag_t() + tag2 = gr.tag_t() tag2.offset = 1 tag2.key = pmt.string_to_symbol("random_tag") tag2.value = pmt.from_long(42) diff --git a/gr-digital/python/qa_ofdm_frame_equalizer_vcvc.py b/gr-digital/python/qa_ofdm_frame_equalizer_vcvc.py index cb087da2f4..a7cf78e928 100755 --- a/gr-digital/python/qa_ofdm_frame_equalizer_vcvc.py +++ b/gr-digital/python/qa_ofdm_frame_equalizer_vcvc.py @@ -40,11 +40,11 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase): n_syms = 3 len_tag_key = "frame_len" tx_data = (1,) * fft_len * n_syms - len_tag = gr.gr_tag_t() + len_tag = gr.tag_t() len_tag.offset = 0 len_tag.key = pmt.string_to_symbol(len_tag_key) len_tag.value = pmt.from_long(n_syms) - chan_tag = gr.gr_tag_t() + chan_tag = gr.tag_t() chan_tag.offset = 0 chan_tag.key = pmt.string_to_symbol("ofdm_sync_chan_taps") chan_tag.value = pmt.init_c32vector(fft_len, (1,) * fft_len) @@ -85,11 +85,11 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase): idx2 = idx+2*fft_len channel[idx2] = channel[idx2] * numpy.exp(1j * 0 * numpy.pi * (numpy.random.rand()-.5)) len_tag_key = "frame_len" - len_tag = gr.gr_tag_t() + len_tag = gr.tag_t() len_tag.offset = 0 len_tag.key = pmt.string_to_symbol(len_tag_key) len_tag.value = pmt.from_long(4) - chan_tag = gr.gr_tag_t() + chan_tag = gr.tag_t() chan_tag.offset = 0 chan_tag.key = pmt.string_to_symbol("ofdm_sync_chan_taps") chan_tag.value = pmt.init_c32vector(fft_len, channel[:fft_len]) @@ -167,11 +167,11 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase): idx2 = idx+2*fft_len channel[idx2] = channel[idx2] * numpy.exp(1j * 0 * numpy.pi * (numpy.random.rand()-.5)) len_tag_key = "frame_len" - len_tag = gr.gr_tag_t() + len_tag = gr.tag_t() len_tag.offset = 0 len_tag.key = pmt.string_to_symbol(len_tag_key) len_tag.value = pmt.from_long(4) - chan_tag = gr.gr_tag_t() + chan_tag = gr.tag_t() chan_tag.offset = 0 chan_tag.key = pmt.string_to_symbol("ofdm_sync_chan_taps") chan_tag.value = pmt.init_c32vector(fft_len, channel[:fft_len]) diff --git a/gr-digital/python/qa_ofdm_serializer_vcc.py b/gr-digital/python/qa_ofdm_serializer_vcc.py index d0f0bf6449..4449c1a24d 100755 --- a/gr-digital/python/qa_ofdm_serializer_vcc.py +++ b/gr-digital/python/qa_ofdm_serializer_vcc.py @@ -47,7 +47,7 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase): occupied_carriers = ((1, 3, 4, 11, 12, 14), (1, 2, 4, 11, 13, 14),) n_syms = len(tx_symbols)/fft_len tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(n_syms) @@ -74,11 +74,11 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase): occupied_carriers = ((1, 3, 4, 11, 12, 14), (1, 2, 4, 11, 13, 14),) n_syms = len(tx_symbols)/fft_len tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(n_syms) - offsettag = gr.gr_tag_t() + offsettag = gr.tag_t() offsettag.offset = 0 offsettag.key = pmt.string_to_symbol("ofdm_sync_carr_offset") offsettag.value = pmt.from_long(carr_offset) @@ -104,7 +104,7 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase): sync_word = (range(fft_len),) tx_data = tuple([numpy.random.randint(0, 10) for x in range(4 * n_syms)]) tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(tx_data)) @@ -139,11 +139,11 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase): tx_data = tuple([numpy.random.randint(0, 10) for x in range(4 * n_syms)]) #tx_data = (1,) * occupied_carriers[0] * n_syms tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(tx_data)) - offsettag = gr.gr_tag_t() + offsettag = gr.tag_t() offsettag.offset = 0 offsettag.key = pmt.string_to_symbol("ofdm_sync_carr_offset") offsettag.value = pmt.from_long(carr_offset) @@ -182,11 +182,11 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase): occupied_carriers = ((1, 3, 4, 11, 12, 14), (1, 2, 4, 11, 13, 14),) n_syms = len(tx_symbols)/fft_len tag_name = "len" - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(n_syms) - tag2 = gr.gr_tag_t() + tag2 = gr.tag_t() tag2.offset = 0 tag2.key = pmt.string_to_symbol("packet_len") tag2.value = pmt.from_long(len(expected_result)) diff --git a/gr-digital/python/qa_packet_headergenerator_bb.py b/gr-digital/python/qa_packet_headergenerator_bb.py index 03d3af3010..0471385afd 100755 --- a/gr-digital/python/qa_packet_headergenerator_bb.py +++ b/gr-digital/python/qa_packet_headergenerator_bb.py @@ -36,15 +36,15 @@ class qa_packet_headergenerator_bb (gr_unittest.TestCase): # 3 PDUs: | | | data = (1, 2, 3, 4, 1, 2) + tuple(range(25)) tagname = "packet_len" - tag1 = gr.gr_tag_t() + tag1 = gr.tag_t() tag1.offset = 0 tag1.key = pmt.string_to_symbol(tagname) tag1.value = pmt.from_long(4) - tag2 = gr.gr_tag_t() + tag2 = gr.tag_t() tag2.offset = 4 tag2.key = pmt.string_to_symbol(tagname) tag2.value = pmt.from_long(2) - tag3 = gr.gr_tag_t() + tag3 = gr.tag_t() tag3.offset = 6 tag3.key = pmt.string_to_symbol(tagname) tag3.value = pmt.from_long(25) @@ -65,15 +65,15 @@ class qa_packet_headergenerator_bb (gr_unittest.TestCase): # 3 PDUs: | | | | data = (1, 2, 3, 4, 1, 2, 1, 2, 3, 4) tagname = "packet_len" - tag1 = gr.gr_tag_t() + tag1 = gr.tag_t() tag1.offset = 0 tag1.key = pmt.string_to_symbol(tagname) tag1.value = pmt.from_long(4) - tag2 = gr.gr_tag_t() + tag2 = gr.tag_t() tag2.offset = 4 tag2.key = pmt.string_to_symbol(tagname) tag2.value = pmt.from_long(2) - tag3 = gr.gr_tag_t() + tag3 = gr.tag_t() tag3.offset = 6 tag3.key = pmt.string_to_symbol(tagname) tag3.value = pmt.from_long(4) @@ -95,15 +95,15 @@ class qa_packet_headergenerator_bb (gr_unittest.TestCase): # 3 PDUs: | | | | data = (1, 2, 3, 4, 1, 2, 1, 2, 3, 4) tagname = "packet_len" - tag1 = gr.gr_tag_t() + tag1 = gr.tag_t() tag1.offset = 0 tag1.key = pmt.string_to_symbol(tagname) tag1.value = pmt.from_long(4) - tag2 = gr.gr_tag_t() + tag2 = gr.tag_t() tag2.offset = 4 tag2.key = pmt.string_to_symbol(tagname) tag2.value = pmt.from_long(2) - tag3 = gr.gr_tag_t() + tag3 = gr.tag_t() tag3.offset = 6 tag3.key = pmt.string_to_symbol(tagname) tag3.value = pmt.from_long(4) @@ -125,15 +125,15 @@ class qa_packet_headergenerator_bb (gr_unittest.TestCase): # 3 PDUs: | | | | data = (1, 2, 3, 4, 1, 2, 1, 2, 3, 4) tagname = "packet_len" - tag1 = gr.gr_tag_t() + tag1 = gr.tag_t() tag1.offset = 0 tag1.key = pmt.string_to_symbol(tagname) tag1.value = pmt.from_long(4) - tag2 = gr.gr_tag_t() + tag2 = gr.tag_t() tag2.offset = 4 tag2.key = pmt.string_to_symbol(tagname) tag2.value = pmt.from_long(2) - tag3 = gr.gr_tag_t() + tag3 = gr.tag_t() tag3.offset = 6 tag3.key = pmt.string_to_symbol(tagname) tag3.value = pmt.from_long(4) diff --git a/gr-digital/python/utils/tagged_streams.py b/gr-digital/python/utils/tagged_streams.py index f2a58ffe1e..c7edbf61eb 100644 --- a/gr-digital/python/utils/tagged_streams.py +++ b/gr-digital/python/utils/tagged_streams.py @@ -27,7 +27,7 @@ def make_lengthtags(lengths, offsets, tagname='length', vlen=1): tags = [] assert(len(offsets) == len(lengths)) for offset, length in zip(offsets, lengths): - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = offset/vlen tag.key = pmt.string_to_symbol(tagname) tag.value = pmt.from_long(length/vlen) @@ -124,7 +124,7 @@ def packets_to_vectors(packets, lengthtagname, vlen=1): offset = 0 for packet in packets: data.extend(packet) - tag = gr.gr_tag_t() + tag = gr.tag_t() tag.offset = offset/vlen tag.key = pmt.string_to_symbol(lengthtagname) tag.value = pmt.from_long(len(packet)/vlen) diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt index a77627ca20..15922a34e4 100644 --- a/gr-digital/swig/CMakeLists.txt +++ b/gr-digital/swig/CMakeLists.txt @@ -41,7 +41,7 @@ endif(ENABLE_GR_CTRLPORT) # Setup swig docs to depend on includes and pull in from build directory set(GR_SWIG_TARGET_DEPS digital_generated_includes) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/digital_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/digital) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/digital) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_LIBRARIES gnuradio-digital diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i index 54f9c64e2d..253bc6f3b8 100644 --- a/gr-digital/swig/digital_swig.i +++ b/gr-digital/swig/digital_swig.i @@ -29,147 +29,147 @@ //load generated python docstrings %include "digital_swig_doc.i" -%include "analog/cpm.h" +%include "gnuradio/analog/cpm.h" %{ -#include <blocks/control_loop.h> +#include <gnuradio/blocks/control_loop.h> %} -%include <blocks/control_loop.h> +%include <gnuradio/blocks/control_loop.h> %{ -#include "digital/additive_scrambler_bb.h" -#include "digital/binary_slicer_fb.h" -#include "digital/chunks_to_symbols_bc.h" -#include "digital/chunks_to_symbols_bf.h" -#include "digital/chunks_to_symbols_ic.h" -#include "digital/chunks_to_symbols_if.h" -#include "digital/chunks_to_symbols_sc.h" -#include "digital/chunks_to_symbols_sf.h" -#include "digital/clock_recovery_mm_cc.h" -#include "digital/clock_recovery_mm_ff.h" -#include "digital/cma_equalizer_cc.h" -#include "digital/constellation.h" -#include "digital/constellation_decoder_cb.h" -#include "digital/constellation_receiver_cb.h" -#include "digital/correlate_access_code_bb.h" -#include "digital/correlate_access_code_tag_bb.h" -#include "digital/costas_loop_cc.h" -#include "digital/cpmmod_bc.h" -#include "digital/crc32.h" -#include "digital/crc32_bb.h" -#include "digital/descrambler_bb.h" -#include "digital/diff_decoder_bb.h" -#include "digital/diff_encoder_bb.h" -#include "digital/diff_phasor_cc.h" -#include "digital/fll_band_edge_cc.h" -#include "digital/framer_sink_1.h" -#include "digital/glfsr_source_b.h" -#include "digital/glfsr_source_f.h" -#include "digital/header_payload_demux.h" -#include "digital/kurtotic_equalizer_cc.h" -#include "digital/lfsr.h" -#include "digital/lms_dd_equalizer_cc.h" -#include "digital/map_bb.h" -#include "digital/metric_type.h" -#include "digital/mpsk_receiver_cc.h" -#include "digital/mpsk_snr_est.h" -#include "digital/mpsk_snr_est_cc.h" -#include "digital/ofdm_carrier_allocator_cvc.h" -#include "digital/ofdm_chanest_vcvc.h" -#include "digital/ofdm_cyclic_prefixer.h" -#include "digital/ofdm_equalizer_base.h" -#include "digital/ofdm_equalizer_simpledfe.h" -#include "digital/ofdm_equalizer_static.h" -#include "digital/ofdm_frame_acquisition.h" -#include "digital/ofdm_frame_equalizer_vcvc.h" -#include "digital/ofdm_frame_sink.h" -#include "digital/ofdm_insert_preamble.h" -#include "digital/ofdm_mapper_bcv.h" -#include "digital/ofdm_sampler.h" -#include "digital/ofdm_serializer_vcc.h" -#include "digital/ofdm_sync_sc_cfb.h" -#include "digital/packet_header_default.h" -#include "digital/packet_header_ofdm.h" -#include "digital/packet_headergenerator_bb.h" -#include "digital/packet_headerparser_b.h" -#include "digital/packet_sink.h" -#include "digital/pfb_clock_sync_ccf.h" -#include "digital/pfb_clock_sync_fff.h" -#include "digital/pn_correlator_cc.h" -#include "digital/probe_density_b.h" -#include "digital/probe_mpsk_snr_est_c.h" -#include "digital/scrambler_bb.h" -#include "digital/simple_correlator.h" -#include "digital/simple_framer.h" -#include "digital/ofdm_serializer_vcc.h" -#include "digital/packet_headerparser_b.h" -#include "digital/header_payload_demux.h" +#include "gnuradio/digital/additive_scrambler_bb.h" +#include "gnuradio/digital/binary_slicer_fb.h" +#include "gnuradio/digital/chunks_to_symbols_bc.h" +#include "gnuradio/digital/chunks_to_symbols_bf.h" +#include "gnuradio/digital/chunks_to_symbols_ic.h" +#include "gnuradio/digital/chunks_to_symbols_if.h" +#include "gnuradio/digital/chunks_to_symbols_sc.h" +#include "gnuradio/digital/chunks_to_symbols_sf.h" +#include "gnuradio/digital/clock_recovery_mm_cc.h" +#include "gnuradio/digital/clock_recovery_mm_ff.h" +#include "gnuradio/digital/cma_equalizer_cc.h" +#include "gnuradio/digital/constellation.h" +#include "gnuradio/digital/constellation_decoder_cb.h" +#include "gnuradio/digital/constellation_receiver_cb.h" +#include "gnuradio/digital/correlate_access_code_bb.h" +#include "gnuradio/digital/correlate_access_code_tag_bb.h" +#include "gnuradio/digital/costas_loop_cc.h" +#include "gnuradio/digital/cpmmod_bc.h" +#include "gnuradio/digital/crc32.h" +#include "gnuradio/digital/crc32_bb.h" +#include "gnuradio/digital/descrambler_bb.h" +#include "gnuradio/digital/diff_decoder_bb.h" +#include "gnuradio/digital/diff_encoder_bb.h" +#include "gnuradio/digital/diff_phasor_cc.h" +#include "gnuradio/digital/fll_band_edge_cc.h" +#include "gnuradio/digital/framer_sink_1.h" +#include "gnuradio/digital/glfsr_source_b.h" +#include "gnuradio/digital/glfsr_source_f.h" +#include "gnuradio/digital/header_payload_demux.h" +#include "gnuradio/digital/kurtotic_equalizer_cc.h" +#include "gnuradio/digital/lfsr.h" +#include "gnuradio/digital/lms_dd_equalizer_cc.h" +#include "gnuradio/digital/map_bb.h" +#include "gnuradio/digital/metric_type.h" +#include "gnuradio/digital/mpsk_receiver_cc.h" +#include "gnuradio/digital/mpsk_snr_est.h" +#include "gnuradio/digital/mpsk_snr_est_cc.h" +#include "gnuradio/digital/ofdm_carrier_allocator_cvc.h" +#include "gnuradio/digital/ofdm_chanest_vcvc.h" +#include "gnuradio/digital/ofdm_cyclic_prefixer.h" +#include "gnuradio/digital/ofdm_equalizer_base.h" +#include "gnuradio/digital/ofdm_equalizer_simpledfe.h" +#include "gnuradio/digital/ofdm_equalizer_static.h" +#include "gnuradio/digital/ofdm_frame_acquisition.h" +#include "gnuradio/digital/ofdm_frame_equalizer_vcvc.h" +#include "gnuradio/digital/ofdm_frame_sink.h" +#include "gnuradio/digital/ofdm_insert_preamble.h" +#include "gnuradio/digital/ofdm_mapper_bcv.h" +#include "gnuradio/digital/ofdm_sampler.h" +#include "gnuradio/digital/ofdm_serializer_vcc.h" +#include "gnuradio/digital/ofdm_sync_sc_cfb.h" +#include "gnuradio/digital/packet_header_default.h" +#include "gnuradio/digital/packet_header_ofdm.h" +#include "gnuradio/digital/packet_headergenerator_bb.h" +#include "gnuradio/digital/packet_headerparser_b.h" +#include "gnuradio/digital/packet_sink.h" +#include "gnuradio/digital/pfb_clock_sync_ccf.h" +#include "gnuradio/digital/pfb_clock_sync_fff.h" +#include "gnuradio/digital/pn_correlator_cc.h" +#include "gnuradio/digital/probe_density_b.h" +#include "gnuradio/digital/probe_mpsk_snr_est_c.h" +#include "gnuradio/digital/scrambler_bb.h" +#include "gnuradio/digital/simple_correlator.h" +#include "gnuradio/digital/simple_framer.h" +#include "gnuradio/digital/ofdm_serializer_vcc.h" +#include "gnuradio/digital/packet_headerparser_b.h" +#include "gnuradio/digital/header_payload_demux.h" %} -%include "digital/additive_scrambler_bb.h" -%include "digital/binary_slicer_fb.h" -%include "digital/chunks_to_symbols_bc.h" -%include "digital/chunks_to_symbols_bf.h" -%include "digital/chunks_to_symbols_ic.h" -%include "digital/chunks_to_symbols_if.h" -%include "digital/chunks_to_symbols_sc.h" -%include "digital/chunks_to_symbols_sf.h" -%include "digital/clock_recovery_mm_cc.h" -%include "digital/clock_recovery_mm_ff.h" -%include "digital/cma_equalizer_cc.h" -%include "digital/constellation.h" -%include "digital/constellation_decoder_cb.h" -%include "digital/constellation_receiver_cb.h" -%include "digital/correlate_access_code_bb.h" -%include "digital/correlate_access_code_tag_bb.h" -%include "digital/costas_loop_cc.h" -%include "digital/cpmmod_bc.h" -%include "digital/crc32.h" -%include "digital/crc32_bb.h" -%include "digital/descrambler_bb.h" -%include "digital/diff_decoder_bb.h" -%include "digital/diff_encoder_bb.h" -%include "digital/diff_phasor_cc.h" -%include "digital/fll_band_edge_cc.h" -%include "digital/framer_sink_1.h" -%include "digital/glfsr_source_b.h" -%include "digital/glfsr_source_f.h" -%include "digital/header_payload_demux.h" -%include "digital/kurtotic_equalizer_cc.h" -%include "digital/lfsr.h" -%include "digital/lms_dd_equalizer_cc.h" -%include "digital/map_bb.h" -%include "digital/metric_type.h" -%include "digital/mpsk_receiver_cc.h" -%include "digital/mpsk_snr_est.h" -%include "digital/mpsk_snr_est_cc.h" -%include "digital/ofdm_carrier_allocator_cvc.h" -%include "digital/ofdm_chanest_vcvc.h" -%include "digital/ofdm_cyclic_prefixer.h" -%include "digital/ofdm_equalizer_base.h" -%include "digital/ofdm_equalizer_simpledfe.h" -%include "digital/ofdm_equalizer_static.h" -%include "digital/ofdm_frame_acquisition.h" -%include "digital/ofdm_frame_equalizer_vcvc.h" -%include "digital/ofdm_frame_sink.h" -%include "digital/ofdm_insert_preamble.h" -%include "digital/ofdm_mapper_bcv.h" -%include "digital/ofdm_sampler.h" -%include "digital/ofdm_serializer_vcc.h" -%include "digital/ofdm_sync_sc_cfb.h" -%include "digital/packet_header_default.h" -%include "digital/packet_header_ofdm.h" -%include "digital/packet_headergenerator_bb.h" -%include "digital/packet_headerparser_b.h" -%include "digital/packet_sink.h" -%include "digital/pfb_clock_sync_ccf.h" -%include "digital/pfb_clock_sync_fff.h" -%include "digital/pn_correlator_cc.h" -%include "digital/probe_density_b.h" -%include "digital/probe_mpsk_snr_est_c.h" -%include "digital/scrambler_bb.h" -%include "digital/simple_correlator.h" -%include "digital/simple_framer.h" +%include "gnuradio/digital/additive_scrambler_bb.h" +%include "gnuradio/digital/binary_slicer_fb.h" +%include "gnuradio/digital/chunks_to_symbols_bc.h" +%include "gnuradio/digital/chunks_to_symbols_bf.h" +%include "gnuradio/digital/chunks_to_symbols_ic.h" +%include "gnuradio/digital/chunks_to_symbols_if.h" +%include "gnuradio/digital/chunks_to_symbols_sc.h" +%include "gnuradio/digital/chunks_to_symbols_sf.h" +%include "gnuradio/digital/clock_recovery_mm_cc.h" +%include "gnuradio/digital/clock_recovery_mm_ff.h" +%include "gnuradio/digital/cma_equalizer_cc.h" +%include "gnuradio/digital/constellation.h" +%include "gnuradio/digital/constellation_decoder_cb.h" +%include "gnuradio/digital/constellation_receiver_cb.h" +%include "gnuradio/digital/correlate_access_code_bb.h" +%include "gnuradio/digital/correlate_access_code_tag_bb.h" +%include "gnuradio/digital/costas_loop_cc.h" +%include "gnuradio/digital/cpmmod_bc.h" +%include "gnuradio/digital/crc32.h" +%include "gnuradio/digital/crc32_bb.h" +%include "gnuradio/digital/descrambler_bb.h" +%include "gnuradio/digital/diff_decoder_bb.h" +%include "gnuradio/digital/diff_encoder_bb.h" +%include "gnuradio/digital/diff_phasor_cc.h" +%include "gnuradio/digital/fll_band_edge_cc.h" +%include "gnuradio/digital/framer_sink_1.h" +%include "gnuradio/digital/glfsr_source_b.h" +%include "gnuradio/digital/glfsr_source_f.h" +%include "gnuradio/digital/header_payload_demux.h" +%include "gnuradio/digital/kurtotic_equalizer_cc.h" +%include "gnuradio/digital/lfsr.h" +%include "gnuradio/digital/lms_dd_equalizer_cc.h" +%include "gnuradio/digital/map_bb.h" +%include "gnuradio/digital/metric_type.h" +%include "gnuradio/digital/mpsk_receiver_cc.h" +%include "gnuradio/digital/mpsk_snr_est.h" +%include "gnuradio/digital/mpsk_snr_est_cc.h" +%include "gnuradio/digital/ofdm_carrier_allocator_cvc.h" +%include "gnuradio/digital/ofdm_chanest_vcvc.h" +%include "gnuradio/digital/ofdm_cyclic_prefixer.h" +%include "gnuradio/digital/ofdm_equalizer_base.h" +%include "gnuradio/digital/ofdm_equalizer_simpledfe.h" +%include "gnuradio/digital/ofdm_equalizer_static.h" +%include "gnuradio/digital/ofdm_frame_acquisition.h" +%include "gnuradio/digital/ofdm_frame_equalizer_vcvc.h" +%include "gnuradio/digital/ofdm_frame_sink.h" +%include "gnuradio/digital/ofdm_insert_preamble.h" +%include "gnuradio/digital/ofdm_mapper_bcv.h" +%include "gnuradio/digital/ofdm_sampler.h" +%include "gnuradio/digital/ofdm_serializer_vcc.h" +%include "gnuradio/digital/ofdm_sync_sc_cfb.h" +%include "gnuradio/digital/packet_header_default.h" +%include "gnuradio/digital/packet_header_ofdm.h" +%include "gnuradio/digital/packet_headergenerator_bb.h" +%include "gnuradio/digital/packet_headerparser_b.h" +%include "gnuradio/digital/packet_sink.h" +%include "gnuradio/digital/pfb_clock_sync_ccf.h" +%include "gnuradio/digital/pfb_clock_sync_fff.h" +%include "gnuradio/digital/pn_correlator_cc.h" +%include "gnuradio/digital/probe_density_b.h" +%include "gnuradio/digital/probe_mpsk_snr_est_c.h" +%include "gnuradio/digital/scrambler_bb.h" +%include "gnuradio/digital/simple_correlator.h" +%include "gnuradio/digital/simple_framer.h" GR_SWIG_BLOCK_MAGIC2(digital, additive_scrambler_bb); GR_SWIG_BLOCK_MAGIC2(digital, binary_slicer_fb); diff --git a/gr-fcd/CMakeLists.txt b/gr-fcd/CMakeLists.txt index bd87f9cf13..ebf7ba97b3 100644 --- a/gr-fcd/CMakeLists.txt +++ b/gr-fcd/CMakeLists.txt @@ -49,7 +49,7 @@ endif() GR_SET_GLOBAL(GR_FCD_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/lib - ${CMAKE_CURRENT_SOURCE_DIR}/include/fcd + ${CMAKE_CURRENT_SOURCE_DIR}/include ) SET(GR_PKG_FCD_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/fcd) @@ -103,7 +103,7 @@ CPACK_COMPONENT("fcd_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/fcd) +add_subdirectory(include/gnuradio/fcd) add_subdirectory(lib) if(ENABLE_PYTHON) add_subdirectory(swig) diff --git a/gr-fcd/examples/c++/fcd_nfm_rx.cc b/gr-fcd/examples/c++/fcd_nfm_rx.cc index 4f129add19..1c99a10d8c 100644 --- a/gr-fcd/examples/c++/fcd_nfm_rx.cc +++ b/gr-fcd/examples/c++/fcd_nfm_rx.cc @@ -32,12 +32,12 @@ #endif // Include header files for each block used in flowgraph -#include <gr_top_block.h> -#include <filter/firdes.h> -#include <filter/fir_filter_ccf.h> -#include <analog/quadrature_demod_cf.h> -#include <audio/sink.h> -#include <fcd_source_c.h> +#include <gnuradio/top_block.h> +#include <gnuradio/filter/firdes.h> +#include <gnuradio/filter/fir_filter_ccf.h> +#include <gnuradio/analog/quadrature_demod_cf.h> +#include <gnuradio/audio/sink.h> +#include <gnuradio/fcd/source_c.h> // other includes #include <iostream> @@ -77,10 +77,10 @@ int main(int argc, char **argv) // Construct a top block that will contain flowgraph blocks. - gr_top_block_sptr tb = gr_make_top_block("fcd_nfm_rx"); + top_block_sptr tb = make_top_block("fcd_nfm_rx"); // FCD source - fcd_source_c_sptr fcd = fcd_make_source_c(device); + gr::fcd::source_c::sptr fcd = gr::fcd::source_c::make(device); fcd->set_freq_khz(freq); fcd->set_lna_gain(gain); diff --git a/gr-fcd/include/fcd/fcd_source_c.h b/gr-fcd/include/fcd/fcd_source_c.h deleted file mode 100644 index 0fc7bb00d1..0000000000 --- a/gr-fcd/include/fcd/fcd_source_c.h +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011-2012 Free Software Foundation, Inc. - * - * 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. - */ - -#ifndef INCLUDED_FCD_SOURCE_C_H -#define INCLUDED_FCD_SOURCE_C_H - -#include <fcd_api.h> -#include <gr_hier_block2.h> - -class fcd_source_c; - -typedef boost::shared_ptr<fcd_source_c> fcd_source_c_sptr; - -/*! - * \brief Return a shared_ptr to a new instance of fcd_source_c. - * - * \details - * This is effectively the public constructor. To avoid accidental use - * of raw pointers, fcd_source_c's constructor is private. - * fcd_make_source_c is the public interface for creating new instances. - */ -FCD_API fcd_source_c_sptr fcd_make_source_c(const std::string device_name = ""); - -/*! - * \brief Funcube Dongle source block. - * \ingroup fcd_blk - * - * \details - * This class provides a Funcube Dongle soure block by wrapping the - * USB audio interface and the USB HID control interface of the Funcube - * Dongle into one convenient source block. - * - * The Funcube Dongle needs to have firmware 18f or later for the control - * interface to work properly. As of early 2011, FCDs still come with firmware - * 18b. You can use qthid 2.2 (not 3) to upgrade the firmware: http://qthid.sf.net - */ -class FCD_API fcd_source_c : virtual public gr_hier_block2 -{ -public: - /*! \brief Set frequency with Hz resolution. - * \param freq The frequency in Hz - * - * Set the frequency of the Funcube Dongle with 1 Hz resolution applying - * the frequency correction set by set_freq_corr(). - * - * \see set_freq_khz() - */ - virtual void set_freq(int freq) = 0; - - /*! \brief Set frequency with Hz resolution. - * \param freq The frequency in Hz - * - * This is a convenience function that uses float parameter in order to allow - * using engineering notation in GRC. - * - * \see set_freq_khz() - */ - virtual void set_freq(float freq) = 0; - - /*! \brief Set frequency with kHz resolution. - * \param freq The frequency in kHz - * - * Sets the frequency of the Funcube Dongle with 1 kHz resolution - * applying the frequency correction set by set_freq_corr(). - * - * \see set_freq() - */ - virtual void set_freq_khz(int freq) = 0; - - /*! \brief Set LNA gain. - * \param gain The new gain in dB. - * - * Set the LNA gain in the FCD. Valid range is -5 to 30. Although - * the LNA gain in the FCD takes enumerated values corresponding to - * 2.5 dB steps, you can can call this method with any float value - * and it will be rounded to the nearest valid value. - * - * By default the LNA gain is set to 20 dB and this is a good value for - * most cases. In noisy areas you may try to reduce the gain. - */ - virtual void set_lna_gain(float gain) = 0; - - /*! \brief Set mixer gain. - * \param gain The new gain in dB. - * - * Set the mixer gain in the FCD. Valid values are +4 and +12 dB. - * - * By default the mixer gain is set to +12 dB and this is a good value for - * most cases. In noisy areas you may try to reduce the gain. - */ - virtual void set_mixer_gain(float gain) = 0; - - /*! \brief Set new frequency correction. - * \param ppm The new frequency correction in parts per million - * - * Version 1.1 FCDs (S/N 810 or later) need a correction of -12 ppm. - * Earlier FCDs need roughly -120 ppm (default for gr-fcd). - * - * Ref: http://www.funcubedongle.com/?p=617 - */ - virtual void set_freq_corr(int ppm) = 0; - - /*! \brief Set DC offset correction. - * \param _dci DC correction for I component (-1.0 to 1.0) - * \param _dcq DC correction for Q component (-1.0 to 1.0) - * - * Set DC offset correction in the device. Default is 0.0. - */ - virtual void set_dc_corr(double _dci, double _dcq) = 0; - - /*! \brief Set IQ phase and gain balance. - * \param _gain The gain correction (-1.0 to 1.0) - * \param _phase The phase correction (-1.0 to 1.0) - * - * Set IQ phase and gain balance in the device. The default values - * are 0.0 for phase and 1.0 for gain. - */ - virtual void set_iq_corr(double _gain, double _phase) = 0; -}; - -#endif /* INCLUDED_FCD_SOURCE_C_H */ diff --git a/gr-fcd/include/fcd/CMakeLists.txt b/gr-fcd/include/gnuradio/fcd/CMakeLists.txt index 3ca70c2a1d..2fb6677e0d 100644 --- a/gr-fcd/include/fcd/CMakeLists.txt +++ b/gr-fcd/include/gnuradio/fcd/CMakeLists.txt @@ -21,8 +21,8 @@ # Install header files ######################################################################## install(FILES - fcd_api.h - fcd_source_c.h + api.h + source_c.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "fcd_devel" ) diff --git a/gr-fcd/include/fcd/fcd_api.h b/gr-fcd/include/gnuradio/fcd/api.h index 9b8a16639a..83afbbd694 100644 --- a/gr-fcd/include/fcd/fcd_api.h +++ b/gr-fcd/include/gnuradio/fcd/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_FCD_API_H #define INCLUDED_FCD_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_fcd_EXPORTS # define FCD_API __GR_ATTR_EXPORT diff --git a/gr-fcd/include/gnuradio/fcd/source_c.h b/gr-fcd/include/gnuradio/fcd/source_c.h new file mode 100644 index 0000000000..2c68b9b6a6 --- /dev/null +++ b/gr-fcd/include/gnuradio/fcd/source_c.h @@ -0,0 +1,149 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011-2013 Free Software Foundation, Inc. + * + * 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. + */ + +#ifndef INCLUDED_FCD_SOURCE_C_H +#define INCLUDED_FCD_SOURCE_C_H + +#include <gnuradio/fcd/api.h> +#include <gnuradio/hier_block2.h> + +namespace gr { + namespace fcd { + + /*! + * \brief Funcube Dongle source block. + * \ingroup fcd_blk + * + * \details + * This class provides a Funcube Dongle soure block by wrapping + * the USB audio interface and the USB HID control interface of + * the Funcube Dongle into one convenient source block. + * + * The Funcube Dongle needs to have firmware 18f or later for the + * control interface to work properly. As of early 2011, FCDs + * still come with firmware 18b. You can use qthid 2.2 (not 3) to + * upgrade the firmware: http://qthid.sf.net + */ + class FCD_API source_c : virtual public gr::hier_block2 + { + public: + // gr::fcd::source_c::sptr + typedef boost::shared_ptr<source_c> sptr; + + /*! + * \brief Return a shared_ptr to a new instance of fcd_source_c. + * + * \details + * This is effectively the public constructor. To avoid accidental + * use of raw pointers, fcd_source_c's constructor is private. + * fcd_make_source_c is the public interface for creating new + * instances. + */ + static sptr make(const std::string device_name = ""); + + /*! \brief Set frequency with Hz resolution. + * \param freq The frequency in Hz + * + * Set the frequency of the Funcube Dongle with 1 Hz resolution applying + * the frequency correction set by set_freq_corr(). + * + * \see set_freq_khz() + */ + virtual void set_freq(int freq) = 0; + + /*! \brief Set frequency with Hz resolution. + * \param freq The frequency in Hz + * + * This is a convenience function that uses float parameter in + * order to allow using engineering notation in GRC. + * + * \see set_freq_khz() + */ + virtual void set_freq(float freq) = 0; + + /*! \brief Set frequency with kHz resolution. + * \param freq The frequency in kHz + * + * Sets the frequency of the Funcube Dongle with 1 kHz + * resolution applying the frequency correction set by + * set_freq_corr(). + * + * \see set_freq() + */ + virtual void set_freq_khz(int freq) = 0; + + /*! \brief Set LNA gain. + * \param gain The new gain in dB. + * + * Set the LNA gain in the FCD. Valid range is -5 to + * 30. Although the LNA gain in the FCD takes enumerated values + * corresponding to 2.5 dB steps, you can can call this method + * with any float value and it will be rounded to the nearest + * valid value. + * + * By default the LNA gain is set to 20 dB and this is a good value for + * most cases. In noisy areas you may try to reduce the gain. + */ + virtual void set_lna_gain(float gain) = 0; + + /*! \brief Set mixer gain. + * \param gain The new gain in dB. + * + * Set the mixer gain in the FCD. Valid values are +4 and +12 dB. + * + * By default the mixer gain is set to +12 dB and this is a good + * value for most cases. In noisy areas you may try to reduce + * the gain. + */ + virtual void set_mixer_gain(float gain) = 0; + + /*! \brief Set new frequency correction. + * \param ppm The new frequency correction in parts per million + * + * Version 1.1 FCDs (S/N 810 or later) need a correction of -12 + * ppm. Earlier FCDs need roughly -120 ppm (default for + * gr-fcd). + * + * Ref: http://www.funcubedongle.com/?p=617 + */ + virtual void set_freq_corr(int ppm) = 0; + + /*! \brief Set DC offset correction. + * \param _dci DC correction for I component (-1.0 to 1.0) + * \param _dcq DC correction for Q component (-1.0 to 1.0) + * + * Set DC offset correction in the device. Default is 0.0. + */ + virtual void set_dc_corr(double _dci, double _dcq) = 0; + + /*! \brief Set IQ phase and gain balance. + * \param _gain The gain correction (-1.0 to 1.0) + * \param _phase The phase correction (-1.0 to 1.0) + * + * Set IQ phase and gain balance in the device. The default values + * are 0.0 for phase and 1.0 for gain. + */ + virtual void set_iq_corr(double _gain, double _phase) = 0; + }; + + } /* namespace fcd */ +} /* namespace gr */ + +#endif /* INCLUDED_FCD_SOURCE_C_H */ diff --git a/gr-fcd/lib/CMakeLists.txt b/gr-fcd/lib/CMakeLists.txt index 151bb401a8..9364c3d718 100644 --- a/gr-fcd/lib/CMakeLists.txt +++ b/gr-fcd/lib/CMakeLists.txt @@ -51,7 +51,7 @@ link_directories(${LOG4CPP_LIBRARY_DIRS}) # Setup library ######################################################################## list(APPEND gr_fcd_sources - fcd_source_c_impl.cc + source_c_impl.cc ) list(APPEND fcd_libs diff --git a/gr-fcd/lib/fcd/fcd.h b/gr-fcd/lib/fcd/fcd.h index 7cfe9b7ede..d089c2044f 100644 --- a/gr-fcd/lib/fcd/fcd.h +++ b/gr-fcd/lib/fcd/fcd.h @@ -23,7 +23,7 @@ #ifndef FCD_H #define FCD_H 1 -#include <fcd_api.h> +#include <gnuradio/fcd/api.h> #ifdef FCD #define EXTERN diff --git a/gr-fcd/lib/fcd_source_c_impl.cc b/gr-fcd/lib/fcd_source_c_impl.cc deleted file mode 100644 index eb61183115..0000000000 --- a/gr-fcd/lib/fcd_source_c_impl.cc +++ /dev/null @@ -1,238 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011-2012 Free Software Foundation, Inc. - * - * 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. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - - -#include <fcd_source_c_impl.h> -#include <fcd.h> -#include <fcdhidcmd.h> // needed for extended API -#include <gr_io_signature.h> -#include <blocks/float_to_complex.h> -#include <attributes.h> - -//#include <iostream> -//using namespace std; - -/* - * Create a new instance of fcd_source_c_impl and return - * an upcasted boost shared_ptr. This is effectively the public constructor. - */ -fcd_source_c_sptr fcd_make_source_c(const std::string device_name) -{ - return gnuradio::get_initial_sptr(new fcd_source_c_impl(device_name)); -} - -static const int MIN_IN = 0; /*!< Mininum number of input streams. */ -static const int MAX_IN = 0; /*!< Maximum number of input streams. */ -static const int MIN_OUT = 1; /*!< Minimum number of output streams. */ -static const int MAX_OUT = 1; /*!< Maximum number of output streams. */ - -fcd_source_c_impl::fcd_source_c_impl(const std::string device_name) - : gr_hier_block2 ("fcd_source_c", - gr_make_io_signature (MIN_IN, MAX_IN, sizeof (gr_complex)), - gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (gr_complex))), - d_freq_corr(-120), - d_freq_req(0) -{ - gr::blocks::float_to_complex::sptr f2c; - - /* Audio source; sample rate fixed at 96kHz */ - fcd = gr::audio::source::make(96000, device_name, true); - - /* block to convert stereo audio to a complex stream */ - f2c = gr::blocks::float_to_complex::make(1); - - connect(fcd, 0, f2c, 0); - connect(fcd, 1, f2c, 1); - connect(f2c, 0, self(), 0); -} - -// Set frequency with Hz resolution -void fcd_source_c_impl::set_freq(int freq) -{ - FCD_MODE_ENUM __GR_ATTR_UNUSED fme; - double f = (double)freq; - - /* valid range 50 MHz - 2.0 GHz */ - if ((freq < 50000000) || (freq > 2000000000)) { - return; - } - - d_freq_req = freq; - f *= 1.0 + d_freq_corr/1000000.0; - - fme = fcdAppSetFreq((int)f); - /* TODO: check fme */ -} - -// Set frequency with Hz resolution (type float) -void fcd_source_c_impl::set_freq(float freq) -{ - FCD_MODE_ENUM __GR_ATTR_UNUSED fme; - double f = (double)freq; - - /* valid range 50 MHz - 2.0 GHz */ - if ((freq < 50.0e6) || (freq > 2.0e9)) { - return; - } - - d_freq_req = (int)freq; - f *= 1.0 + d_freq_corr/1000000.0; - - fme = fcdAppSetFreq((int)f); - /* TODO: check fme */ -} - - -// Set frequency with kHz resolution. -void fcd_source_c_impl::set_freq_khz(int freq) -{ - FCD_MODE_ENUM __GR_ATTR_UNUSED fme; - double f = freq*1000.0; - - /* valid range 50 MHz - 2.0 GHz */ - if ((freq < 50000) || (freq > 2000000)) { - return; - } - - d_freq_req = freq*1000; - f *= 1.0 + d_freq_corr/1000000.0; - - fme = fcdAppSetFreqkHz((int)(f/1000.0)); - /* TODO: check fme */ -} - - -// Set LNA gain -void fcd_source_c_impl::set_lna_gain(float gain) -{ - FCD_MODE_ENUM __GR_ATTR_UNUSED fme; - unsigned char g; - - /* convert to nearest discrete value */ - if (gain > 27.5) { - g = 14; // 30.0 dB - } - else if (gain > 22.5) { - g = 13; // 25.0 dB - } - else if (gain > 18.75) { - g = 12; // 20.0 dB - } - else if (gain > 16.25) { - g = 11; // 17.5 dB - } - else if (gain > 13.75) { - g = 10; // 15.0 dB - } - else if (gain > 11.25) { - g = 9; // 12.5 dB - } - else if (gain > 8.75) { - g = 8; // 10.0 dB - } - else if (gain > 6.25) { - g = 7; // 7.5 dB - } - else if (gain > 3.75) { - g = 6; // 5.0 dB - } - else if (gain > 1.25) { - g = 5; // 2.5 dB - } - else if (gain > -1.25) { - g = 4; // 0.0 dB - } - else if (gain > -3.75) { - g = 1; // -2.5 dB - } - else { - g = 0; // -5.0 dB - } - - fme = fcdAppSetParam(FCD_CMD_APP_SET_LNA_GAIN, &g, 1); - /* TODO: check fme */ -} - -// Set mixer gain -void fcd_source_c_impl::set_mixer_gain(float gain) -{ - __GR_ATTR_UNUSED FCD_MODE_ENUM fme; - unsigned char g; - - if ( gain > 4.0 ) { - g = TMGE_P12_0DB; - } else { - g = TMGE_P4_0DB; - } - - fme = fcdAppSetParam(FCD_CMD_APP_SET_MIXER_GAIN, &g, 1); - /* TODO: check fme */ -} - -// Set new frequency correction -void fcd_source_c_impl::set_freq_corr(int ppm) -{ - d_freq_corr = ppm; - // re-tune with new correction value - set_freq(d_freq_req); -} - -// Set DC offset correction. -void fcd_source_c_impl::set_dc_corr(double _dci, double _dcq) -{ - union { - unsigned char auc[4]; - struct { - signed short dci; // equivalent of qint16 which should be 16 bit everywhere - signed short dcq; - }; - } dcinfo; - - if ((_dci < -1.0) || (_dci > 1.0) || (_dcq < -1.0) || (_dcq > 1.0)) - return; - - dcinfo.dci = static_cast<signed short>(_dci*32768.0); - dcinfo.dcq = static_cast<signed short>(_dcq*32768.0); - - fcdAppSetParam(FCD_CMD_APP_SET_DC_CORR, dcinfo.auc, 4); -} - -// Set IQ phase and gain balance. -void fcd_source_c_impl::set_iq_corr(double _gain, double _phase) -{ - union { - unsigned char auc[4]; - struct { - signed short phase; - signed short gain; - }; - } iqinfo; - - if ((_gain < -1.0) || (_gain > 1.0) || (_phase < -1.0) || (_phase > 1.0)) - return; - - iqinfo.phase = static_cast<signed short>(_phase*32768.0); - iqinfo.gain = static_cast<signed short>(_gain*32768.0); - - fcdAppSetParam(FCD_CMD_APP_SET_IQ_CORR, iqinfo.auc, 4); -} diff --git a/gr-fcd/lib/fcd_source_c_impl.h b/gr-fcd/lib/fcd_source_c_impl.h deleted file mode 100644 index 56afe2e614..0000000000 --- a/gr-fcd/lib/fcd_source_c_impl.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011-2012 Free Software Foundation, Inc. - * - * 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. - */ - -#ifndef INCLUDED_FCD_SOURCE_C_IMPL_H -#define INCLUDED_FCD_SOURCE_C_IMPL_H - -#include <fcd_source_c.h> -#include <audio/source.h> - -class FCD_API fcd_source_c_impl : public fcd_source_c -{ -public: - /* Public API functions documented in include/fcd_source_c.h */ - void set_freq(int freq); - void set_freq(float freq); - void set_freq_khz(int freq); - void set_lna_gain(float gain); - void set_mixer_gain(float gain); - void set_freq_corr(int ppm); - void set_dc_corr(double _dci, double _dcq); - void set_iq_corr(double _gain, double _phase); - -private: - fcd_source_c_impl(const std::string device_name = ""); - friend FCD_API fcd_source_c_sptr - fcd_make_source_c(const std::string device_name); - - gr::audio::source::sptr fcd; /*!< The audio input source */ - int d_freq_corr; /*!< The frequency correction in ppm */ - int d_freq_req; /*!< The latest requested frequency in Hz */ -}; - -#endif /* INCLUDED_FCD_SOURCE_C_IMPL_H */ diff --git a/gr-fcd/lib/source_c_impl.cc b/gr-fcd/lib/source_c_impl.cc new file mode 100644 index 0000000000..fddd05687c --- /dev/null +++ b/gr-fcd/lib/source_c_impl.cc @@ -0,0 +1,252 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011-2013 Free Software Foundation, Inc. + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "source_c_impl.h" +#include <fcd.h> +#include <fcdhidcmd.h> // needed for extended API +#include <gnuradio/io_signature.h> +#include <gnuradio/blocks/float_to_complex.h> +#include <gnuradio/attributes.h> + +//#include <iostream> +//using namespace std; + +namespace gr { + namespace fcd { + + /* + * Create a new instance of gr::fcd::source_c_impl and return an + * upcasted boost shared_ptr. This is effectively the public + * constructor. + */ + source_c::sptr + source_c::make(const std::string device_name) + { + return gnuradio::get_initial_sptr + (new source_c_impl(device_name)); + } + + static const int MIN_IN = 0; /*!< Mininum number of input streams. */ + static const int MAX_IN = 0; /*!< Maximum number of input streams. */ + static const int MIN_OUT = 1; /*!< Minimum number of output streams. */ + static const int MAX_OUT = 1; /*!< Maximum number of output streams. */ + + source_c_impl::source_c_impl(const std::string device_name) + : gr::hier_block2("fcd_source_c", + gr::io_signature::make(MIN_IN, MAX_IN, sizeof(gr_complex)), + gr::io_signature::make(MIN_OUT, MAX_OUT, sizeof(gr_complex))), + d_freq_corr(-120), + d_freq_req(0) + { + gr::blocks::float_to_complex::sptr f2c; + + /* Audio source; sample rate fixed at 96kHz */ + fcd = gr::audio::source::make(96000, device_name, true); + + /* block to convert stereo audio to a complex stream */ + f2c = gr::blocks::float_to_complex::make(1); + + connect(fcd, 0, f2c, 0); + connect(fcd, 1, f2c, 1); + connect(f2c, 0, self(), 0); + } + + source_c_impl::~source_c_impl() + { + } + + // Set frequency with Hz resolution + void source_c_impl::set_freq(int freq) + { + FCD_MODE_ENUM __GR_ATTR_UNUSED fme; + double f = (double)freq; + + /* valid range 50 MHz - 2.0 GHz */ + if((freq < 50000000) || (freq > 2000000000)) { + return; + } + + d_freq_req = freq; + f *= 1.0 + d_freq_corr/1000000.0; + + fme = fcdAppSetFreq((int)f); + /* TODO: check fme */ + } + + // Set frequency with Hz resolution (type float) + void source_c_impl::set_freq(float freq) + { + FCD_MODE_ENUM __GR_ATTR_UNUSED fme; + double f = (double)freq; + + /* valid range 50 MHz - 2.0 GHz */ + if((freq < 50.0e6) || (freq > 2.0e9)) { + return; + } + + d_freq_req = (int)freq; + f *= 1.0 + d_freq_corr/1000000.0; + + fme = fcdAppSetFreq((int)f); + /* TODO: check fme */ + } + + + // Set frequency with kHz resolution. + void source_c_impl::set_freq_khz(int freq) + { + FCD_MODE_ENUM __GR_ATTR_UNUSED fme; + double f = freq*1000.0; + + /* valid range 50 MHz - 2.0 GHz */ + if((freq < 50000) || (freq > 2000000)) { + return; + } + + d_freq_req = freq*1000; + f *= 1.0 + d_freq_corr/1000000.0; + + fme = fcdAppSetFreqkHz((int)(f/1000.0)); + /* TODO: check fme */ + } + + + // Set LNA gain + void source_c_impl::set_lna_gain(float gain) + { + FCD_MODE_ENUM __GR_ATTR_UNUSED fme; + unsigned char g; + + /* convert to nearest discrete value */ + if(gain > 27.5) { + g = 14; // 30.0 dB + } + else if(gain > 22.5) { + g = 13; // 25.0 dB + } + else if(gain > 18.75) { + g = 12; // 20.0 dB + } + else if(gain > 16.25) { + g = 11; // 17.5 dB + } + else if(gain > 13.75) { + g = 10; // 15.0 dB + } + else if(gain > 11.25) { + g = 9; // 12.5 dB + } + else if(gain > 8.75) { + g = 8; // 10.0 dB + } + else if(gain > 6.25) { + g = 7; // 7.5 dB + } + else if(gain > 3.75) { + g = 6; // 5.0 dB + } + else if(gain > 1.25) { + g = 5; // 2.5 dB + } + else if(gain > -1.25) { + g = 4; // 0.0 dB + } + else if(gain > -3.75) { + g = 1; // -2.5 dB + } + else { + g = 0; // -5.0 dB + } + + fme = fcdAppSetParam(FCD_CMD_APP_SET_LNA_GAIN, &g, 1); + /* TODO: check fme */ + } + + // Set mixer gain + void source_c_impl::set_mixer_gain(float gain) + { + __GR_ATTR_UNUSED FCD_MODE_ENUM fme; + unsigned char g; + + if( gain > 4.0 ) { + g = TMGE_P12_0DB; + } + else { + g = TMGE_P4_0DB; + } + + fme = fcdAppSetParam(FCD_CMD_APP_SET_MIXER_GAIN, &g, 1); + /* TODO: check fme */ + } + + // Set new frequency correction + void source_c_impl::set_freq_corr(int ppm) + { + d_freq_corr = ppm; + // re-tune with new correction value + set_freq(d_freq_req); + } + + // Set DC offset correction. + void source_c_impl::set_dc_corr(double _dci, double _dcq) + { + union { + unsigned char auc[4]; + struct { + signed short dci; // equivalent of qint16 which should be 16 bit everywhere + signed short dcq; + }; + } dcinfo; + + if((_dci < -1.0) || (_dci > 1.0) || (_dcq < -1.0) || (_dcq > 1.0)) + return; + + dcinfo.dci = static_cast<signed short>(_dci*32768.0); + dcinfo.dcq = static_cast<signed short>(_dcq*32768.0); + + fcdAppSetParam(FCD_CMD_APP_SET_DC_CORR, dcinfo.auc, 4); + } + + // Set IQ phase and gain balance. + void source_c_impl::set_iq_corr(double _gain, double _phase) + { + union { + unsigned char auc[4]; + struct { + signed short phase; + signed short gain; + }; + } iqinfo; + + if ((_gain < -1.0) || (_gain > 1.0) || (_phase < -1.0) || (_phase > 1.0)) + return; + + iqinfo.phase = static_cast<signed short>(_phase*32768.0); + iqinfo.gain = static_cast<signed short>(_gain*32768.0); + + fcdAppSetParam(FCD_CMD_APP_SET_IQ_CORR, iqinfo.auc, 4); + } + + } /* namespace fcd */ +} /* namespace gr */ diff --git a/gr-fcd/lib/source_c_impl.h b/gr-fcd/lib/source_c_impl.h new file mode 100644 index 0000000000..d8a33e82d9 --- /dev/null +++ b/gr-fcd/lib/source_c_impl.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011-2013 Free Software Foundation, Inc. + * + * 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. + */ + +#ifndef INCLUDED_FCD_SOURCE_C_IMPL_H +#define INCLUDED_FCD_SOURCE_C_IMPL_H + +#include <gnuradio/fcd/source_c.h> +#include <gnuradio/audio/source.h> + +namespace gr { + namespace fcd { + + class source_c_impl : public source_c + { + public: + source_c_impl(const std::string device_name = ""); + ~source_c_impl(); + + /* Public API functions documented in include/gnuradio/fcd/source_c.h */ + void set_freq(int freq); + void set_freq(float freq); + void set_freq_khz(int freq); + void set_lna_gain(float gain); + void set_mixer_gain(float gain); + void set_freq_corr(int ppm); + void set_dc_corr(double _dci, double _dcq); + void set_iq_corr(double _gain, double _phase); + + private: + gr::audio::source::sptr fcd; /*!< The audio input source */ + int d_freq_corr; /*!< The frequency correction in ppm */ + int d_freq_req; /*!< The latest requested frequency in Hz */ + }; + + } /* namespace fcd */ +} /* namespace gr */ + +#endif /* INCLUDED_FCD_SOURCE_C_IMPL_H */ diff --git a/gr-fcd/swig/CMakeLists.txt b/gr-fcd/swig/CMakeLists.txt index 043714c6b3..48fce658fd 100644 --- a/gr-fcd/swig/CMakeLists.txt +++ b/gr-fcd/swig/CMakeLists.txt @@ -28,6 +28,7 @@ include(GrSwig) set(GR_SWIG_INCLUDE_DIRS ${GR_FCD_INCLUDE_DIRS} ${GR_AUDIO_INCLUDE_DIRS} + ${GR_BLOCKS_INCLUDE_DIRS} ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ) @@ -38,10 +39,11 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/fcd_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/fcd) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/fcd) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) -set(GR_SWIG_LIBRARIES gnuradio-fcd) +set(GR_SWIG_LIBRARIES gnuradio-fcd + gnuradio-runtime gnuradio-audio gnuradio-blocks) GR_SWIG_MAKE(fcd_swig fcd_swig.i) diff --git a/gr-fcd/swig/fcd_swig.i b/gr-fcd/swig/fcd_swig.i index d1dcca83ba..f689ab1b8e 100644 --- a/gr-fcd/swig/fcd_swig.i +++ b/gr-fcd/swig/fcd_swig.i @@ -31,10 +31,10 @@ %include "fcd_swig_doc.i" %{ -#include "fcd_source_c.h" +#include "gnuradio/fcd/source_c.h" %} -%include "fcd_source_c.h" +%include "gnuradio/fcd/source_c.h" -GR_SWIG_BLOCK_MAGIC(fcd,source_c); -fcd_source_c_sptr fcd_make_source_c (const std::string device_name = ""); +GR_SWIG_BLOCK_MAGIC2(fcd, source_c); +//source_c_sptr gr::fcd::source_c::make(const std::string device_name = ""); diff --git a/gr-fec/CMakeLists.txt b/gr-fec/CMakeLists.txt index 01806565a4..05e63cf510 100644 --- a/gr-fec/CMakeLists.txt +++ b/gr-fec/CMakeLists.txt @@ -87,7 +87,7 @@ CPACK_COMPONENT("fec_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/fec) +add_subdirectory(include/gnuradio/fec) add_subdirectory(lib) if(ENABLE_PYTHON) add_subdirectory(swig) diff --git a/gr-fec/include/fec/CMakeLists.txt b/gr-fec/include/gnuradio/fec/CMakeLists.txt index 7ab0498000..7ab0498000 100644 --- a/gr-fec/include/fec/CMakeLists.txt +++ b/gr-fec/include/gnuradio/fec/CMakeLists.txt diff --git a/gr-fec/include/fec/api.h b/gr-fec/include/gnuradio/fec/api.h index 62c0fd98de..51315f6c03 100644 --- a/gr-fec/include/fec/api.h +++ b/gr-fec/include/gnuradio/fec/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_FEC_API_H #define INCLUDED_FEC_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_fec_EXPORTS # define FEC_API __GR_ATTR_EXPORT diff --git a/gr-fec/include/fec/decode_ccsds_27_fb.h b/gr-fec/include/gnuradio/fec/decode_ccsds_27_fb.h index f55f8d5c08..c0c4efa2d0 100644 --- a/gr-fec/include/fec/decode_ccsds_27_fb.h +++ b/gr-fec/include/gnuradio/fec/decode_ccsds_27_fb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FEC_DECODE_CCSDS_27_FB_H #define INCLUDED_FEC_DECODE_CCSDS_27_FB_H -#include <fec/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/fec/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace fec { @@ -49,7 +49,7 @@ namespace gr { * from the corresponding inputs. */ - class FEC_API decode_ccsds_27_fb : virtual public gr_sync_decimator + class FEC_API decode_ccsds_27_fb : virtual public sync_decimator { public: diff --git a/gr-fec/include/fec/encode_ccsds_27_bb.h b/gr-fec/include/gnuradio/fec/encode_ccsds_27_bb.h index 9f89982288..d920b60983 100644 --- a/gr-fec/include/fec/encode_ccsds_27_bb.h +++ b/gr-fec/include/gnuradio/fec/encode_ccsds_27_bb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FEC_ENCODE_CCSDS_27_BB_H #define INCLUDED_FEC_ENCODE_CCSDS_27_BB_H -#include <fec/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/fec/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace fec { @@ -46,7 +46,7 @@ namespace gr { * There is no provision to "flush" the encoder. */ - class FEC_API encode_ccsds_27_bb : virtual public gr_sync_interpolator + class FEC_API encode_ccsds_27_bb : virtual public sync_interpolator { public: diff --git a/gr-fec/include/fec/rs.h b/gr-fec/include/gnuradio/fec/rs.h index 27551f5407..8a28cd31ac 100644 --- a/gr-fec/include/fec/rs.h +++ b/gr-fec/include/gnuradio/fec/rs.h @@ -1,4 +1,4 @@ -#include <fec/api.h> +#include <gnuradio/fec/api.h> /* User include file for the Reed-Solomon codec * Copyright 2002, Phil Karn KA9Q * May be used under the terms of the GNU General Public License (GPL) diff --git a/gr-fec/include/fec/viterbi.h b/gr-fec/include/gnuradio/fec/viterbi.h index 97e09d4a8d..5827f1e9b6 100644 --- a/gr-fec/include/fec/viterbi.h +++ b/gr-fec/include/gnuradio/fec/viterbi.h @@ -24,7 +24,7 @@ * But it fits so nicely into a 32-bit machine word... */ -#include <fec/api.h> +#include <gnuradio/fec/api.h> struct viterbi_state { unsigned long path; /* Decoded path to this state */ diff --git a/gr-fec/lib/decode_ccsds_27_fb_impl.cc b/gr-fec/lib/decode_ccsds_27_fb_impl.cc index 87bdc46402..51033a86c0 100644 --- a/gr-fec/lib/decode_ccsds_27_fb_impl.cc +++ b/gr-fec/lib/decode_ccsds_27_fb_impl.cc @@ -25,7 +25,7 @@ #endif #include "decode_ccsds_27_fb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace fec { @@ -36,9 +36,9 @@ namespace gr { } decode_ccsds_27_fb_impl::decode_ccsds_27_fb_impl() - : gr_sync_decimator("decode_ccsds_27_fb", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature (1, 1, sizeof(char)), + : sync_decimator("decode_ccsds_27_fb", + io_signature::make (1, 1, sizeof(float)), + io_signature::make (1, 1, sizeof(char)), 2*8) // Rate 1/2 code, unpacked to packed conversion { float RATE = 0.5; diff --git a/gr-fec/lib/decode_ccsds_27_fb_impl.h b/gr-fec/lib/decode_ccsds_27_fb_impl.h index c28ee77b1a..cd16c6ab1c 100644 --- a/gr-fec/lib/decode_ccsds_27_fb_impl.h +++ b/gr-fec/lib/decode_ccsds_27_fb_impl.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_FEC_DECODE_CCSDS_27_FB_IMPL_H #define INCLUDED_FEC_DECODE_CCSDS_27_FB_IMPL_H -#include <fec/decode_ccsds_27_fb.h> +#include <gnuradio/fec/decode_ccsds_27_fb.h> extern "C" { -#include <fec/viterbi.h> +#include <gnuradio/fec/viterbi.h> } namespace gr { diff --git a/gr-fec/lib/encode_ccsds_27_bb_impl.cc b/gr-fec/lib/encode_ccsds_27_bb_impl.cc index 0a348f372f..56518777c7 100644 --- a/gr-fec/lib/encode_ccsds_27_bb_impl.cc +++ b/gr-fec/lib/encode_ccsds_27_bb_impl.cc @@ -25,10 +25,10 @@ #endif #include "encode_ccsds_27_bb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> extern "C" { -#include <fec/viterbi.h> +#include <gnuradio/fec/viterbi.h> } namespace gr { @@ -40,9 +40,9 @@ namespace gr { } encode_ccsds_27_bb_impl::encode_ccsds_27_bb_impl() - : gr_sync_interpolator("encode_ccsds_27_bb", - gr_make_io_signature (1, 1, sizeof(char)), - gr_make_io_signature (1, 1, sizeof(char)), + : sync_interpolator("encode_ccsds_27_bb", + io_signature::make (1, 1, sizeof(char)), + io_signature::make (1, 1, sizeof(char)), 16) // Rate 1/2 code, packed to unpacked conversion { d_encstate = 0; diff --git a/gr-fec/lib/encode_ccsds_27_bb_impl.h b/gr-fec/lib/encode_ccsds_27_bb_impl.h index 140f8c2ae4..b48c1a47f1 100644 --- a/gr-fec/lib/encode_ccsds_27_bb_impl.h +++ b/gr-fec/lib/encode_ccsds_27_bb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_FEC_ENCODE_CCSDS_27_BB_IMPL_H #define INCLUDED_FEC_ENCODE_CCSDS_27_BB_IMPL_H -#include <fec/encode_ccsds_27_bb.h> +#include <gnuradio/fec/encode_ccsds_27_bb.h> namespace gr { namespace fec { diff --git a/gr-fec/lib/reed-solomon/char.h b/gr-fec/lib/reed-solomon/char.h index bc4fd8a1ba..f76ad95cd4 100644 --- a/gr-fec/lib/reed-solomon/char.h +++ b/gr-fec/lib/reed-solomon/char.h @@ -6,7 +6,7 @@ #define DTYPE unsigned char -#include <fec/api.h> +#include <gnuradio/fec/api.h> /* Reed-Solomon codec control block */ struct rs { diff --git a/gr-fec/lib/reed-solomon/fixed.h b/gr-fec/lib/reed-solomon/fixed.h index ee4ae2e714..d45f4d47b5 100644 --- a/gr-fec/lib/reed-solomon/fixed.h +++ b/gr-fec/lib/reed-solomon/fixed.h @@ -7,7 +7,7 @@ */ #define DTYPE unsigned char -#include <fec/api.h> +#include <gnuradio/fec/api.h> static inline int mod255(int x){ while (x >= 255) { diff --git a/gr-fec/lib/reed-solomon/int.h b/gr-fec/lib/reed-solomon/int.h index 6bb00fd102..818629abb4 100644 --- a/gr-fec/lib/reed-solomon/int.h +++ b/gr-fec/lib/reed-solomon/int.h @@ -5,7 +5,7 @@ */ #define DTYPE int -#include <fec/api.h> +#include <gnuradio/fec/api.h> /* Reed-Solomon codec control block */ struct FEC_API rs { diff --git a/gr-fec/lib/reed-solomon/rstest.c b/gr-fec/lib/reed-solomon/rstest.c index 5e3f55bcea..767c01d848 100644 --- a/gr-fec/lib/reed-solomon/rstest.c +++ b/gr-fec/lib/reed-solomon/rstest.c @@ -12,7 +12,7 @@ #include <stdio.h> #include <stdlib.h> #include <time.h> -#include <fec/rs.h> +#include <gnuradio/fec/rs.h> int exercise_char(void *,int); diff --git a/gr-fec/lib/viterbi/decode.cc b/gr-fec/lib/viterbi/decode.cc index f4ea829d55..0af0b34483 100644 --- a/gr-fec/lib/viterbi/decode.cc +++ b/gr-fec/lib/viterbi/decode.cc @@ -28,7 +28,7 @@ */ extern "C" { -#include <fec/viterbi.h> +#include <gnuradio/fec/viterbi.h> } #include <cstdio> diff --git a/gr-fec/lib/viterbi/encode.cc b/gr-fec/lib/viterbi/encode.cc index 101678718c..4e152781f0 100644 --- a/gr-fec/lib/viterbi/encode.cc +++ b/gr-fec/lib/viterbi/encode.cc @@ -30,7 +30,7 @@ */ extern "C" { -#include <fec/viterbi.h> +#include <gnuradio/fec/viterbi.h> } #include <cstdio> diff --git a/gr-fec/lib/viterbi/viterbi.c b/gr-fec/lib/viterbi/viterbi.c index 526c9504a2..3c247a3868 100644 --- a/gr-fec/lib/viterbi/viterbi.c +++ b/gr-fec/lib/viterbi/viterbi.c @@ -25,7 +25,7 @@ * Some modifications from original Karn code by Matt Ettus */ -#include <fec/viterbi.h> +#include <gnuradio/fec/viterbi.h> /* The two generator polynomials for the NASA Standard K=7 code. * Since these polynomials are known to be optimal for this constraint diff --git a/gr-fec/swig/CMakeLists.txt b/gr-fec/swig/CMakeLists.txt index 587e9ff97c..d1dc556c8a 100644 --- a/gr-fec/swig/CMakeLists.txt +++ b/gr-fec/swig/CMakeLists.txt @@ -36,7 +36,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/fec_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/fec) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/fec) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_LIBRARIES gnuradio-fec) diff --git a/gr-fec/swig/fec_swig.i b/gr-fec/swig/fec_swig.i index 5a50b63777..ad0d213500 100644 --- a/gr-fec/swig/fec_swig.i +++ b/gr-fec/swig/fec_swig.i @@ -28,12 +28,12 @@ %include "fec_swig_doc.i" %{ -#include "fec/decode_ccsds_27_fb.h" -#include "fec/encode_ccsds_27_bb.h" +#include "gnuradio/fec/decode_ccsds_27_fb.h" +#include "gnuradio/fec/encode_ccsds_27_bb.h" %} -%include "fec/decode_ccsds_27_fb.h" -%include "fec/encode_ccsds_27_bb.h" +%include "gnuradio/fec/decode_ccsds_27_fb.h" +%include "gnuradio/fec/encode_ccsds_27_bb.h" GR_SWIG_BLOCK_MAGIC2(fec, decode_ccsds_27_fb); GR_SWIG_BLOCK_MAGIC2(fec, encode_ccsds_27_bb); diff --git a/gr-fft/CMakeLists.txt b/gr-fft/CMakeLists.txt index e9732eb30b..6bd08b257a 100644 --- a/gr-fft/CMakeLists.txt +++ b/gr-fft/CMakeLists.txt @@ -84,7 +84,7 @@ CPACK_COMPONENT("fft_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/fft) +add_subdirectory(include/gnuradio/fft) add_subdirectory(lib) if(ENABLE_PYTHON) add_subdirectory(swig) diff --git a/gr-fft/include/fft/CMakeLists.txt b/gr-fft/include/gnuradio/fft/CMakeLists.txt index bce3da674d..bce3da674d 100644 --- a/gr-fft/include/fft/CMakeLists.txt +++ b/gr-fft/include/gnuradio/fft/CMakeLists.txt diff --git a/gr-fft/include/fft/api.h b/gr-fft/include/gnuradio/fft/api.h index a569ceb265..ce2a49f4be 100644 --- a/gr-fft/include/fft/api.h +++ b/gr-fft/include/gnuradio/fft/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_FFT_API_H #define INCLUDED_FFT_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_fft_EXPORTS # define FFT_API __GR_ATTR_EXPORT diff --git a/gr-fft/include/fft/fft.h b/gr-fft/include/gnuradio/fft/fft.h index 305b1cb711..04673c16e1 100644 --- a/gr-fft/include/fft/fft.h +++ b/gr-fft/include/gnuradio/fft/fft.h @@ -27,8 +27,8 @@ * Wrappers for FFTW single precision 1d dft */ -#include <fft/api.h> -#include <gr_complex.h> +#include <gnuradio/fft/api.h> +#include <gnuradio/gr_complex.h> #include <boost/thread.hpp> namespace gr { diff --git a/gr-fft/include/fft/fft_vcc.h b/gr-fft/include/gnuradio/fft/fft_vcc.h index 2f5b5a23f0..a2682de196 100644 --- a/gr-fft/include/fft/fft_vcc.h +++ b/gr-fft/include/gnuradio/fft/fft_vcc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FFT_FFT_VCC_H #define INCLUDED_FFT_FFT_VCC_H -#include <fft/api.h> -#include <gr_sync_block.h> +#include <gnuradio/fft/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace fft { @@ -33,7 +33,7 @@ namespace gr { * \brief Compute forward or reverse FFT. complex vector in / complex vector out. * \ingroup fourier_analysis_blk */ - class FFT_API fft_vcc : virtual public gr_sync_block + class FFT_API fft_vcc : virtual public sync_block { public: diff --git a/gr-fft/include/fft/fft_vfc.h b/gr-fft/include/gnuradio/fft/fft_vfc.h index 89491113b6..9937d92a34 100644 --- a/gr-fft/include/fft/fft_vfc.h +++ b/gr-fft/include/gnuradio/fft/fft_vfc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FFT_FFT_VFC_H #define INCLUDED_FFT_FFT_VFC_H -#include <fft/api.h> -#include <gr_sync_block.h> +#include <gnuradio/fft/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace fft { @@ -33,7 +33,7 @@ namespace gr { * \brief Compute forward or reverse FFT. float vector in / complex vector out. * \ingroup fourier_analysis_blk */ - class FFT_API fft_vfc : virtual public gr_sync_block + class FFT_API fft_vfc : virtual public sync_block { public: diff --git a/gr-fft/include/fft/goertzel.h b/gr-fft/include/gnuradio/fft/goertzel.h index ff37355e64..47ff1dd18c 100644 --- a/gr-fft/include/fft/goertzel.h +++ b/gr-fft/include/gnuradio/fft/goertzel.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FFT_IMPL_GOERTZEL_H #define INCLUDED_FFT_IMPL_GOERTZEL_H -#include <fft/api.h> -#include <gr_types.h> +#include <gnuradio/fft/api.h> +#include <gnuradio/types.h> namespace gr { namespace fft { diff --git a/gr-fft/include/fft/goertzel_fc.h b/gr-fft/include/gnuradio/fft/goertzel_fc.h index 26b0d0d11c..3815ac0fd4 100644 --- a/gr-fft/include/fft/goertzel_fc.h +++ b/gr-fft/include/gnuradio/fft/goertzel_fc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FFT_GOERTZEL_FC_H #define INCLUDED_FFT_GOERTZEL_FC_H -#include <fft/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/fft/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace fft { @@ -33,7 +33,7 @@ namespace gr { * \brief Goertzel single-bin DFT calculation. * \ingroup fourier_analysis_blk */ - class FFT_API goertzel_fc : virtual public gr_sync_decimator + class FFT_API goertzel_fc : virtual public sync_decimator { public: diff --git a/gr-fft/lib/fft.cc b/gr-fft/lib/fft.cc index 60838ee302..abcda7d30e 100644 --- a/gr-fft/lib/fft.cc +++ b/gr-fft/lib/fft.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <fft/fft.h> -#include <gr_sys_paths.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/sys_paths.h> #include <fftw3.h> #ifdef _MSC_VER //http://www.fftw.org/install/windows.html#DLLwisdom @@ -36,7 +36,7 @@ static int my_fftw_read_char(void *f) { return fgetc((FILE *) f); } #define fftwl_import_wisdom_from_file(f) fftwl_import_wisdom(my_fftw_read_char, (void*) (f)) #endif //_MSC_VER -#include <gr_complex.h> +#include <gnuradio/gr_complex.h> #include <stdlib.h> #include <string.h> #include <stdio.h> @@ -86,7 +86,7 @@ namespace gr { wisdom_filename() { static fs::path path; - path = fs::path(gr_appdata_path()) / ".gr_fftw_wisdom"; + path = fs::path(gr::appdata_path()) / ".gr_fftw_wisdom"; return path.string().c_str(); } diff --git a/gr-fft/lib/fft_vcc_fftw.cc b/gr-fft/lib/fft_vcc_fftw.cc index ebcd5ec53f..96f3e5b51c 100644 --- a/gr-fft/lib/fft_vcc_fftw.cc +++ b/gr-fft/lib/fft_vcc_fftw.cc @@ -25,7 +25,7 @@ #endif #include "fft_vcc_fftw.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <math.h> #include <string.h> @@ -44,9 +44,9 @@ namespace gr { fft_vcc_fftw::fft_vcc_fftw(int fft_size, bool forward, const std::vector<float> &window, bool shift, int nthreads) - : gr_sync_block("fft_vcc_fftw", - gr_make_io_signature(1, 1, fft_size * sizeof(gr_complex)), - gr_make_io_signature(1, 1, fft_size * sizeof(gr_complex))), + : sync_block("fft_vcc_fftw", + io_signature::make(1, 1, fft_size * sizeof(gr_complex)), + io_signature::make(1, 1, fft_size * sizeof(gr_complex))), d_fft_size(fft_size), d_forward(forward), d_shift(shift) { d_fft = new fft_complex(d_fft_size, forward, nthreads); diff --git a/gr-fft/lib/fft_vcc_fftw.h b/gr-fft/lib/fft_vcc_fftw.h index ea15dd07bb..2aa2056f5b 100644 --- a/gr-fft/lib/fft_vcc_fftw.h +++ b/gr-fft/lib/fft_vcc_fftw.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FFT_FFT_VCC_FFTW_IMPL_H #define INCLUDED_FFT_FFT_VCC_FFTW_IMPL_H -#include <fft/fft_vcc.h> -#include <fft/fft.h> +#include <gnuradio/fft/fft_vcc.h> +#include <gnuradio/fft/fft.h> namespace gr { namespace fft { diff --git a/gr-fft/lib/fft_vfc_fftw.cc b/gr-fft/lib/fft_vfc_fftw.cc index 890dac7be7..dec2157b06 100644 --- a/gr-fft/lib/fft_vfc_fftw.cc +++ b/gr-fft/lib/fft_vfc_fftw.cc @@ -25,7 +25,7 @@ #endif #include "fft_vfc_fftw.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <math.h> #include <string.h> @@ -44,9 +44,9 @@ namespace gr { fft_vfc_fftw::fft_vfc_fftw(int fft_size, bool forward, const std::vector<float> &window, int nthreads) - : gr_sync_block("fft_vfc_fftw", - gr_make_io_signature(1, 1, fft_size * sizeof(float)), - gr_make_io_signature(1, 1, fft_size * sizeof(gr_complex))), + : sync_block("fft_vfc_fftw", + io_signature::make(1, 1, fft_size * sizeof(float)), + io_signature::make(1, 1, fft_size * sizeof(gr_complex))), d_fft_size(fft_size), d_forward(forward) { d_fft = new fft_complex(d_fft_size, forward, nthreads); diff --git a/gr-fft/lib/fft_vfc_fftw.h b/gr-fft/lib/fft_vfc_fftw.h index 1b6f78ba63..2fe292f8ca 100644 --- a/gr-fft/lib/fft_vfc_fftw.h +++ b/gr-fft/lib/fft_vfc_fftw.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FFT_FFT_VFC_FFTW_IMPL_H #define INCLUDED_FFT_FFT_VFC_FFTW_IMPL_H -#include <fft/fft_vfc.h> -#include <fft/fft.h> +#include <gnuradio/fft/fft_vfc.h> +#include <gnuradio/fft/fft.h> namespace gr { namespace fft { diff --git a/gr-fft/lib/goertzel.cc b/gr-fft/lib/goertzel.cc index 4bcd5ee190..ddb086c531 100644 --- a/gr-fft/lib/goertzel.cc +++ b/gr-fft/lib/goertzel.cc @@ -25,7 +25,7 @@ #endif #include <cmath> -#include <fft/goertzel.h> +#include <gnuradio/fft/goertzel.h> namespace gr { namespace fft { diff --git a/gr-fft/lib/goertzel_fc_impl.cc b/gr-fft/lib/goertzel_fc_impl.cc index ee214f24da..fd3755eeaa 100644 --- a/gr-fft/lib/goertzel_fc_impl.cc +++ b/gr-fft/lib/goertzel_fc_impl.cc @@ -25,7 +25,7 @@ #endif #include "goertzel_fc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace fft { @@ -36,9 +36,9 @@ namespace gr { } goertzel_fc_impl::goertzel_fc_impl(int rate, int len, float freq) - : gr_sync_decimator("goertzel_fc", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), + : sync_decimator("goertzel_fc", + io_signature::make (1, 1, sizeof(float)), + io_signature::make (1, 1, sizeof(gr_complex)), len), d_goertzel(rate, len, freq) { diff --git a/gr-fft/lib/goertzel_fc_impl.h b/gr-fft/lib/goertzel_fc_impl.h index 426bc71f6b..79b24f15c4 100644 --- a/gr-fft/lib/goertzel_fc_impl.h +++ b/gr-fft/lib/goertzel_fc_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FFT_GOERTZEL_FC_IMPL_H #define INCLUDED_FFT_GOERTZEL_FC_IMPL_H -#include <fft/goertzel_fc.h> -#include <fft/goertzel.h> +#include <gnuradio/fft/goertzel_fc.h> +#include <gnuradio/fft/goertzel.h> namespace gr { namespace fft { diff --git a/gr-fft/swig/CMakeLists.txt b/gr-fft/swig/CMakeLists.txt index 7c11b85bb4..476e343da7 100644 --- a/gr-fft/swig/CMakeLists.txt +++ b/gr-fft/swig/CMakeLists.txt @@ -36,7 +36,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/fft_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/fft) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/fft) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_LIBRARIES gnuradio-fft) diff --git a/gr-fft/swig/fft_swig.i b/gr-fft/swig/fft_swig.i index 51e44cfe49..005f5ed23a 100644 --- a/gr-fft/swig/fft_swig.i +++ b/gr-fft/swig/fft_swig.i @@ -28,14 +28,14 @@ %include "fft_swig_doc.i" %{ -#include "fft/fft_vcc.h" -#include "fft/fft_vfc.h" -#include "fft/goertzel_fc.h" +#include "gnuradio/fft/fft_vcc.h" +#include "gnuradio/fft/fft_vfc.h" +#include "gnuradio/fft/goertzel_fc.h" %} -%include "fft/fft_vcc.h" -%include "fft/fft_vfc.h" -%include "fft/goertzel_fc.h" +%include "gnuradio/fft/fft_vcc.h" +%include "gnuradio/fft/fft_vfc.h" +%include "gnuradio/fft/goertzel_fc.h" GR_SWIG_BLOCK_MAGIC2(fft, fft_vcc); GR_SWIG_BLOCK_MAGIC2(fft, fft_vfc); diff --git a/gr-filter/CMakeLists.txt b/gr-filter/CMakeLists.txt index 05414f4967..f9f1f39461 100644 --- a/gr-filter/CMakeLists.txt +++ b/gr-filter/CMakeLists.txt @@ -91,7 +91,7 @@ CPACK_COMPONENT("filter_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/filter) +add_subdirectory(include/gnuradio/filter) add_subdirectory(lib) if(ENABLE_PYTHON) add_subdirectory(swig) diff --git a/gr-filter/include/filter/CMakeLists.txt b/gr-filter/include/gnuradio/filter/CMakeLists.txt index a1595f1e9a..a1595f1e9a 100644 --- a/gr-filter/include/filter/CMakeLists.txt +++ b/gr-filter/include/gnuradio/filter/CMakeLists.txt diff --git a/gr-filter/include/filter/adaptive_fir.h b/gr-filter/include/gnuradio/filter/adaptive_fir.h index 28db1c3c08..be2060537f 100644 --- a/gr-filter/include/filter/adaptive_fir.h +++ b/gr-filter/include/gnuradio/filter/adaptive_fir.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FILTER_ADAPTIVE_FIR_H #define INCLUDED_FILTER_ADAPTIVE_FIR_H -#include <filter/api.h> -#include <filter/fir_filter.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/filter/fir_filter.h> namespace gr { namespace filter { diff --git a/gr-filter/include/filter/adaptive_fir_ccc.h b/gr-filter/include/gnuradio/filter/adaptive_fir_ccc.h index 2e674fad77..13e05a477b 100644 --- a/gr-filter/include/filter/adaptive_fir_ccc.h +++ b/gr-filter/include/gnuradio/filter/adaptive_fir_ccc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FILTER_ADAPTIVE_FIR_CCC_H #define INCLUDED_FILTER_ADAPTIVE_FIR_CCC_H -#include <filter/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace filter { @@ -59,7 +59,7 @@ namespace gr { * See digital::cma_equalizer_cc and digital::lms_dd_equalizer_cc * for example usage. */ - class FILTER_API adaptive_fir_ccc : virtual public gr_sync_decimator + class FILTER_API adaptive_fir_ccc : virtual public sync_decimator { protected: diff --git a/gr-filter/include/filter/adaptive_fir_ccf.h b/gr-filter/include/gnuradio/filter/adaptive_fir_ccf.h index e296e42df1..81d11d6fd6 100644 --- a/gr-filter/include/filter/adaptive_fir_ccf.h +++ b/gr-filter/include/gnuradio/filter/adaptive_fir_ccf.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FILTER_ADAPTIVE_FIR_CCF_H #define INCLUDED_FILTER_ADAPTIVE_FIR_CCF_H -#include <filter/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace filter { @@ -56,7 +56,7 @@ namespace gr { * } * \endcode */ - class FILTER_API adaptive_fir_ccf : virtual public gr_sync_decimator + class FILTER_API adaptive_fir_ccf : virtual public sync_decimator { public: // gr::filter::adaptive_fir_ccf::sptr diff --git a/gr-filter/include/filter/api.h b/gr-filter/include/gnuradio/filter/api.h index 97f2d537a0..f54bb2a5e3 100644 --- a/gr-filter/include/filter/api.h +++ b/gr-filter/include/gnuradio/filter/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_FILTER_API_H #define INCLUDED_FILTER_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_filter_EXPORTS # define FILTER_API __GR_ATTR_EXPORT diff --git a/gr-filter/include/filter/dc_blocker_cc.h b/gr-filter/include/gnuradio/filter/dc_blocker_cc.h index 5ef75b48e4..f3ae32d23c 100644 --- a/gr-filter/include/filter/dc_blocker_cc.h +++ b/gr-filter/include/gnuradio/filter/dc_blocker_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FILTER_DC_BLOCKER_CC_H #define INCLUDED_FILTER_DC_BLOCKER_CC_H -#include <filter/api.h> -#include <gr_sync_block.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace filter { @@ -54,7 +54,7 @@ namespace gr { * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine, * Mar. 2008, pp 132-134.</EM></B> */ - class FILTER_API dc_blocker_cc : virtual public gr_sync_block + class FILTER_API dc_blocker_cc : virtual public sync_block { public: diff --git a/gr-filter/include/filter/dc_blocker_ff.h b/gr-filter/include/gnuradio/filter/dc_blocker_ff.h index 64f134e1ab..3363e95bc3 100644 --- a/gr-filter/include/filter/dc_blocker_ff.h +++ b/gr-filter/include/gnuradio/filter/dc_blocker_ff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FILTER_DC_BLOCKER_FF_H #define INCLUDED_FILTER_DC_BLOCKER_FF_H -#include <filter/api.h> -#include <gr_sync_block.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace filter { @@ -57,7 +57,7 @@ namespace gr { * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine, * Mar. 2008, pp 132-134.</EM></B> */ - class FILTER_API dc_blocker_ff : virtual public gr_sync_block + class FILTER_API dc_blocker_ff : virtual public sync_block { public: diff --git a/gr-filter/include/filter/fft_filter.h b/gr-filter/include/gnuradio/filter/fft_filter.h index 8bab289dac..1f6c8ca8ee 100644 --- a/gr-filter/include/filter/fft_filter.h +++ b/gr-filter/include/gnuradio/filter/fft_filter.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_FILTER_FFT_FILTER_H #define INCLUDED_FILTER_FFT_FILTER_H -#include <filter/api.h> +#include <gnuradio/filter/api.h> #include <vector> -#include <gr_complex.h> -#include <fft/fft.h> +#include <gnuradio/gr_complex.h> +#include <gnuradio/fft/fft.h> namespace gr { namespace filter { diff --git a/gr-filter/include/filter/fft_filter_ccc.h b/gr-filter/include/gnuradio/filter/fft_filter_ccc.h index 38fef07f94..a9ca7ef6d4 100644 --- a/gr-filter/include/filter/fft_filter_ccc.h +++ b/gr-filter/include/gnuradio/filter/fft_filter_ccc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FILTER_FFT_FILTER_CCC_H #define INCLUDED_FILTER_FFT_FILTER_CCC_H -#include <filter/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace filter { @@ -52,7 +52,7 @@ namespace gr { * of taps used is very large) if you have enough threads/cores to * support it. */ - class FILTER_API fft_filter_ccc : virtual public gr_sync_decimator + class FILTER_API fft_filter_ccc : virtual public sync_decimator { public: // gr::filter::fft_filter_ccc::sptr diff --git a/gr-filter/include/filter/fft_filter_fff.h b/gr-filter/include/gnuradio/filter/fft_filter_fff.h index 0183234380..10c63dd9ed 100644 --- a/gr-filter/include/filter/fft_filter_fff.h +++ b/gr-filter/include/gnuradio/filter/fft_filter_fff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FILTER_FFT_FILTER_FFF_H #define INCLUDED_FILTER_FFT_FILTER_FFF_H -#include <filter/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace filter { @@ -52,7 +52,7 @@ namespace gr { * of taps used is very large) if you have enough threads/cores to * support it. */ - class FILTER_API fft_filter_fff : virtual public gr_sync_decimator + class FILTER_API fft_filter_fff : virtual public sync_decimator { public: // gr::filter::fft_filter_fff::sptr diff --git a/gr-filter/include/filter/filter_delay_fc.h b/gr-filter/include/gnuradio/filter/filter_delay_fc.h index 1d2222a830..5b87d4b12d 100644 --- a/gr-filter/include/filter/filter_delay_fc.h +++ b/gr-filter/include/gnuradio/filter/filter_delay_fc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FILTER_FILTER_DELAY_FC_H #define INCLUDED_FILTER_FILTER_DELAY_FC_H -#include <filter/api.h> -#include <gr_sync_block.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace filter { @@ -49,7 +49,7 @@ namespace gr { * introduced by the filter in the imaginary path. The filter taps * needs to be calculated before initializing this block. */ - class FILTER_API filter_delay_fc : virtual public gr_sync_block + class FILTER_API filter_delay_fc : virtual public sync_block { public: diff --git a/gr-filter/include/filter/fir_filter.h b/gr-filter/include/gnuradio/filter/fir_filter.h index a54059463f..973b55d322 100644 --- a/gr-filter/include/filter/fir_filter.h +++ b/gr-filter/include/gnuradio/filter/fir_filter.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_FILTER_FIR_FILTER_H #define INCLUDED_FILTER_FIR_FILTER_H -#include <filter/api.h> +#include <gnuradio/filter/api.h> #include <vector> -#include <gr_complex.h> +#include <gnuradio/gr_complex.h> namespace gr { namespace filter { diff --git a/gr-filter/include/filter/fir_filter_XXX.h.t b/gr-filter/include/gnuradio/filter/fir_filter_XXX.h.t index 0621bd978c..5e38653c63 100644 --- a/gr-filter/include/filter/fir_filter_XXX.h.t +++ b/gr-filter/include/gnuradio/filter/fir_filter_XXX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <filter/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace filter { @@ -55,7 +55,7 @@ namespace gr { * (or decimators) by specifying an integer value for \p * decimation. */ - class FILTER_API @BASE_NAME@ : virtual public gr_sync_decimator + class FILTER_API @BASE_NAME@ : virtual public sync_decimator { public: diff --git a/gr-filter/include/filter/fir_filter_with_buffer.h b/gr-filter/include/gnuradio/filter/fir_filter_with_buffer.h index 007eae3fa6..8520b692c4 100644 --- a/gr-filter/include/filter/fir_filter_with_buffer.h +++ b/gr-filter/include/gnuradio/filter/fir_filter_with_buffer.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_FILTER_FIR_FILTER_WITH_BUFFER_H #define INCLUDED_FILTER_FIR_FILTER_WITH_BUFFER_H -#include <filter/api.h> +#include <gnuradio/filter/api.h> #include <vector> -#include <gr_complex.h> +#include <gnuradio/gr_complex.h> namespace gr { namespace filter { diff --git a/gr-filter/include/filter/firdes.h b/gr-filter/include/gnuradio/filter/firdes.h index 0ae5894b38..7f8b944002 100644 --- a/gr-filter/include/filter/firdes.h +++ b/gr-filter/include/gnuradio/filter/firdes.h @@ -23,10 +23,10 @@ #ifndef _FILTER_FIRDES_H_ #define _FILTER_FIRDES_H_ -#include <filter/api.h> +#include <gnuradio/filter/api.h> #include <vector> #include <cmath> -#include <gr_complex.h> +#include <gnuradio/gr_complex.h> namespace gr { namespace filter { diff --git a/gr-filter/include/filter/fractional_interpolator_cc.h b/gr-filter/include/gnuradio/filter/fractional_interpolator_cc.h index 90060817fc..ed84d956ef 100644 --- a/gr-filter/include/filter/fractional_interpolator_cc.h +++ b/gr-filter/include/gnuradio/filter/fractional_interpolator_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FRACTIONAL_INTERPOLATOR_CC_H #define INCLUDED_FRACTIONAL_INTERPOLATOR_CC_H -#include <filter/api.h> -#include <gr_block.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/block.h> namespace gr { namespace filter { @@ -33,7 +33,7 @@ namespace gr { * \brief Interpolating MMSE filter with complex input, complex output * \ingroup resamplers_blk */ - class FILTER_API fractional_interpolator_cc : virtual public gr_block + class FILTER_API fractional_interpolator_cc : virtual public block { public: // gr::filter::fractional_interpolator_cc::sptr diff --git a/gr-filter/include/filter/fractional_interpolator_ff.h b/gr-filter/include/gnuradio/filter/fractional_interpolator_ff.h index 131e9e541d..04ee235688 100644 --- a/gr-filter/include/filter/fractional_interpolator_ff.h +++ b/gr-filter/include/gnuradio/filter/fractional_interpolator_ff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FRACTIONAL_INTERPOLATOR_FF_H #define INCLUDED_FRACTIONAL_INTERPOLATOR_FF_H -#include <filter/api.h> -#include <gr_block.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/block.h> namespace gr { namespace filter { @@ -33,7 +33,7 @@ namespace gr { * \brief Interpolating MMSE filter with float input, float output * \ingroup resamplers_blk */ - class FILTER_API fractional_interpolator_ff : virtual public gr_block + class FILTER_API fractional_interpolator_ff : virtual public block { public: // gr::filter::fractional_interpolator_ff::sptr diff --git a/gr-filter/include/filter/fractional_resampler_cc.h b/gr-filter/include/gnuradio/filter/fractional_resampler_cc.h index ad4eee9494..d46a462d35 100644 --- a/gr-filter/include/filter/fractional_resampler_cc.h +++ b/gr-filter/include/gnuradio/filter/fractional_resampler_cc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FRACTIONAL_RESAMPLER_CC_H #define INCLUDED_FRACTIONAL_RESAMPLER_CC_H -#include <filter/api.h> -#include <gr_block.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/block.h> namespace gr { namespace filter { @@ -33,7 +33,7 @@ namespace gr { * \brief resampling MMSE filter with complex input, complex output * \ingroup resamplers_blk */ - class FILTER_API fractional_resampler_cc : virtual public gr_block + class FILTER_API fractional_resampler_cc : virtual public block { public: // gr::filter::fractional_resampler_cc::sptr diff --git a/gr-filter/include/filter/fractional_resampler_ff.h b/gr-filter/include/gnuradio/filter/fractional_resampler_ff.h index 53fba9f029..e505920f8b 100644 --- a/gr-filter/include/filter/fractional_resampler_ff.h +++ b/gr-filter/include/gnuradio/filter/fractional_resampler_ff.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FRACTIONAL_RESAMPLER_FF_H #define INCLUDED_FRACTIONAL_RESAMPLER_FF_H -#include <filter/api.h> -#include <gr_block.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/block.h> namespace gr { namespace filter { @@ -33,7 +33,7 @@ namespace gr { * \brief Resampling MMSE filter with float input, float output * \ingroup resamplers_blk */ - class FILTER_API fractional_resampler_ff : virtual public gr_block + class FILTER_API fractional_resampler_ff : virtual public block { public: // gr::filter::fractional_resampler_ff::sptr diff --git a/gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t b/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter_XXX.h.t index 2a62bdc3ba..0174774bbf 100644 --- a/gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t +++ b/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter_XXX.h.t @@ -28,8 +28,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <filter/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace filter { @@ -50,7 +50,7 @@ namespace gr { * Uses a single input array to produce a single output array. * Additional inputs and/or outputs are ignored. */ - class FILTER_API @BASE_NAME@ : virtual public gr_sync_decimator + class FILTER_API @BASE_NAME@ : virtual public sync_decimator { public: // gr::filter::@BASE_NAME@::sptr diff --git a/gr-filter/include/filter/hilbert_fc.h b/gr-filter/include/gnuradio/filter/hilbert_fc.h index c0973415f3..006dd6067f 100644 --- a/gr-filter/include/filter/hilbert_fc.h +++ b/gr-filter/include/gnuradio/filter/hilbert_fc.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_FILTER_HILBERT_FC_H #define INCLUDED_FILTER_HILBERT_FC_H -#include <filter/api.h> -#include <gr_sync_block.h> -#include <gr_types.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/types.h> namespace gr { namespace filter { @@ -39,7 +39,7 @@ namespace gr { * imaginary output is hilbert filtered (90 degree phase shift) * version of input. */ - class FILTER_API hilbert_fc : virtual public gr_sync_block + class FILTER_API hilbert_fc : virtual public sync_block { public: // gr::filter::hilbert_fc::sptr diff --git a/gr-filter/include/filter/iir_filter.h b/gr-filter/include/gnuradio/filter/iir_filter.h index e7ea52f670..71ff73a03d 100644 --- a/gr-filter/include/filter/iir_filter.h +++ b/gr-filter/include/gnuradio/filter/iir_filter.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_IIR_FILTER_H #define INCLUDED_IIR_FILTER_H -#include <filter/api.h> +#include <gnuradio/filter/api.h> #include <vector> #include <stdexcept> diff --git a/gr-filter/include/filter/iir_filter_ffd.h b/gr-filter/include/gnuradio/filter/iir_filter_ffd.h index 17bba0edca..f0e0fcaae6 100644 --- a/gr-filter/include/filter/iir_filter_ffd.h +++ b/gr-filter/include/gnuradio/filter/iir_filter_ffd.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_IIR_FILTER_FFD_H #define INCLUDED_IIR_FILTER_FFD_H -#include <filter/api.h> -#include <gr_sync_block.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace filter { @@ -67,7 +67,7 @@ namespace gr { \endxmlonly */ - class FILTER_API iir_filter_ffd : virtual public gr_sync_block + class FILTER_API iir_filter_ffd : virtual public sync_block { public: // gr::filter::iir_filter_ffd::sptr diff --git a/gr-filter/include/filter/interp_fir_filter_XXX.h.t b/gr-filter/include/gnuradio/filter/interp_fir_filter_XXX.h.t index 7deb269e3a..5b0f3511b4 100644 --- a/gr-filter/include/filter/interp_fir_filter_XXX.h.t +++ b/gr-filter/include/gnuradio/filter/interp_fir_filter_XXX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <filter/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace filter { @@ -56,7 +56,7 @@ namespace gr { * interpolation. * */ - class FILTER_API @BASE_NAME@ : virtual public gr_sync_interpolator + class FILTER_API @BASE_NAME@ : virtual public sync_interpolator { public: // gr::filter::@BASE_NAME@::sptr diff --git a/gr-filter/include/filter/interpolator_taps.h b/gr-filter/include/gnuradio/filter/interpolator_taps.h index a232edd384..a232edd384 100644 --- a/gr-filter/include/filter/interpolator_taps.h +++ b/gr-filter/include/gnuradio/filter/interpolator_taps.h diff --git a/gr-filter/include/filter/mmse_fir_interpolator_cc.h b/gr-filter/include/gnuradio/filter/mmse_fir_interpolator_cc.h index 0af52be552..7710ca7fa2 100644 --- a/gr-filter/include/filter/mmse_fir_interpolator_cc.h +++ b/gr-filter/include/gnuradio/filter/mmse_fir_interpolator_cc.h @@ -22,9 +22,9 @@ #ifndef _GRI_MMSE_FIR_INTERPOLATOR_CC_H_ #define _GRI_MMSE_FIR_INTERPOLATOR_CC_H_ -#include <filter/api.h> -#include <filter/fir_filter.h> -#include <gr_complex.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/gr_complex.h> #include <vector> namespace gr { diff --git a/gr-filter/include/filter/mmse_fir_interpolator_ff.h b/gr-filter/include/gnuradio/filter/mmse_fir_interpolator_ff.h index c10fad3be1..a7c6d7d973 100644 --- a/gr-filter/include/filter/mmse_fir_interpolator_ff.h +++ b/gr-filter/include/gnuradio/filter/mmse_fir_interpolator_ff.h @@ -23,8 +23,8 @@ #ifndef _MMSE_FIR_INTERPOLATOR_FF_H_ #define _MMSE_FIR_INTERPOLATOR_FF_H_ -#include <filter/api.h> -#include <filter/fir_filter.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/filter/fir_filter.h> #include <vector> namespace gr { diff --git a/gr-filter/include/filter/pfb_arb_resampler_ccf.h b/gr-filter/include/gnuradio/filter/pfb_arb_resampler_ccf.h index 1adf511a14..b0641d41ee 100644 --- a/gr-filter/include/filter/pfb_arb_resampler_ccf.h +++ b/gr-filter/include/gnuradio/filter/pfb_arb_resampler_ccf.h @@ -24,8 +24,8 @@ #ifndef INCLUDED_PFB_ARB_RESAMPLER_CCF_H #define INCLUDED_PFB_ARB_RESAMPLER_CCF_H -#include <filter/api.h> -#include <gr_block.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/block.h> namespace gr { namespace filter { @@ -92,7 +92,7 @@ namespace gr { * Systems", Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B> */ - class FILTER_API pfb_arb_resampler_ccf : virtual public gr_block + class FILTER_API pfb_arb_resampler_ccf : virtual public block { public: // gr::filter::pfb_arb_resampler_ccf::sptr diff --git a/gr-filter/include/filter/pfb_arb_resampler_fff.h b/gr-filter/include/gnuradio/filter/pfb_arb_resampler_fff.h index 5e1be5c026..c28e1dc2a6 100644 --- a/gr-filter/include/filter/pfb_arb_resampler_fff.h +++ b/gr-filter/include/gnuradio/filter/pfb_arb_resampler_fff.h @@ -24,8 +24,8 @@ #ifndef INCLUDED_PFB_ARB_RESAMPLER_FFF_H #define INCLUDED_PFB_ARB_RESAMPLER_FFF_H -#include <filter/api.h> -#include <gr_block.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/block.h> namespace gr { namespace filter { @@ -92,7 +92,7 @@ namespace gr { * Systems", Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B> */ - class FILTER_API pfb_arb_resampler_fff : virtual public gr_block + class FILTER_API pfb_arb_resampler_fff : virtual public block { public: // gr::filter::pfb_arb_resampler_fff::sptr diff --git a/gr-filter/include/filter/pfb_channelizer_ccf.h b/gr-filter/include/gnuradio/filter/pfb_channelizer_ccf.h index b1fb11372b..f199f85b83 100644 --- a/gr-filter/include/filter/pfb_channelizer_ccf.h +++ b/gr-filter/include/gnuradio/filter/pfb_channelizer_ccf.h @@ -24,8 +24,8 @@ #ifndef INCLUDED_FILTER_PFB_CHANNELIZER_CCF_H #define INCLUDED_FILTER_PFB_CHANNELIZER_CCF_H -#include <filter/api.h> -#include <gr_block.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/block.h> namespace gr { namespace filter { @@ -103,7 +103,7 @@ namespace gr { * */ - class FILTER_API pfb_channelizer_ccf : virtual public gr_block + class FILTER_API pfb_channelizer_ccf : virtual public block { public: // gr::filter::pfb_channelizer_ccf::sptr diff --git a/gr-filter/include/filter/pfb_decimator_ccf.h b/gr-filter/include/gnuradio/filter/pfb_decimator_ccf.h index 56d383dae7..822206889f 100644 --- a/gr-filter/include/filter/pfb_decimator_ccf.h +++ b/gr-filter/include/gnuradio/filter/pfb_decimator_ccf.h @@ -24,8 +24,8 @@ #ifndef INCLUDED_PFB_DECIMATOR_CCF_H #define INCLUDED_PFB_DECIMATOR_CCF_H -#include <filter/api.h> -#include <gr_sync_block.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace filter { @@ -88,7 +88,7 @@ namespace gr { * Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B> */ - class FILTER_API pfb_decimator_ccf : virtual public gr_sync_block + class FILTER_API pfb_decimator_ccf : virtual public sync_block { public: // gr::filter::pfb_decimator_ccf::sptr diff --git a/gr-filter/include/filter/pfb_interpolator_ccf.h b/gr-filter/include/gnuradio/filter/pfb_interpolator_ccf.h index de1b2b85f4..096c8fd1db 100644 --- a/gr-filter/include/filter/pfb_interpolator_ccf.h +++ b/gr-filter/include/gnuradio/filter/pfb_interpolator_ccf.h @@ -24,8 +24,8 @@ #ifndef INCLUDED_PFB_INTERPOLATOR_CCF_H #define INCLUDED_PFB_INTERPOLATOR_CCF_H -#include <filter/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace filter { @@ -76,7 +76,7 @@ namespace gr { * Inc. 2004.</EM></B> */ - class FILTER_API pfb_interpolator_ccf : virtual public gr_sync_interpolator + class FILTER_API pfb_interpolator_ccf : virtual public sync_interpolator { public: // gr::filter::pfb_interpolator_ccf::sptr diff --git a/gr-filter/include/filter/pfb_synthesizer_ccf.h b/gr-filter/include/gnuradio/filter/pfb_synthesizer_ccf.h index d434776229..f1fbad7272 100644 --- a/gr-filter/include/filter/pfb_synthesizer_ccf.h +++ b/gr-filter/include/gnuradio/filter/pfb_synthesizer_ccf.h @@ -24,8 +24,8 @@ #ifndef INCLUDED_PFB_SYNTHESIZER_CCF_H #define INCLUDED_PFB_SYNTHESIZER_CCF_H -#include <filter/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace filter { @@ -35,7 +35,7 @@ namespace gr { * gr_complex input, gr_complex output and float taps * \ingroup channelizers_blk */ - class FILTER_API pfb_synthesizer_ccf : virtual public gr_sync_interpolator + class FILTER_API pfb_synthesizer_ccf : virtual public sync_interpolator { public: // gr::filter::pfb_synthesizer_ccf::sptr diff --git a/gr-filter/include/filter/pm_remez.h b/gr-filter/include/gnuradio/filter/pm_remez.h index 71283eec1c..00899eaf45 100644 --- a/gr-filter/include/filter/pm_remez.h +++ b/gr-filter/include/gnuradio/filter/pm_remez.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FILTER_PM_REMEZ_H #define INCLUDED_FILTER_PM_REMEZ_H -#include <filter/api.h> -#include <gr_types.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/types.h> #include <string> #include <stdexcept> diff --git a/gr-filter/include/filter/polyphase_filterbank.h b/gr-filter/include/gnuradio/filter/polyphase_filterbank.h index 7ce891b6c8..fad04e3294 100644 --- a/gr-filter/include/filter/polyphase_filterbank.h +++ b/gr-filter/include/gnuradio/filter/polyphase_filterbank.h @@ -24,9 +24,9 @@ #ifndef INCLUDED_FILTER_POLYPHASE_FILTERBANK_H #define INCLUDED_FILTER_POLYPHASE_FILTERBANK_H -#include <filter/api.h> -#include <filter/fir_filter.h> -#include <fft/fft.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/fft/fft.h> namespace gr { namespace filter { diff --git a/gr-filter/include/filter/rational_resampler_base_XXX.h.t b/gr-filter/include/gnuradio/filter/rational_resampler_base_XXX.h.t index 18398bbfe7..d4ea2043f6 100644 --- a/gr-filter/include/filter/rational_resampler_base_XXX.h.t +++ b/gr-filter/include/gnuradio/filter/rational_resampler_base_XXX.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <filter/api.h> -#include <gr_block.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/block.h> namespace gr { @@ -37,7 +37,7 @@ namespace gr { * input, @O_TYPE@ output and @TAP_TYPE@ taps. * \ingroup resamplers_blk */ - class FILTER_API @NAME@ : virtual public gr_block + class FILTER_API @NAME@ : virtual public block { public: // gr::filter::@BASE_NAME@::sptr diff --git a/gr-filter/include/filter/single_pole_iir.h b/gr-filter/include/gnuradio/filter/single_pole_iir.h index 10d1b4791b..0ded3a4ede 100644 --- a/gr-filter/include/filter/single_pole_iir.h +++ b/gr-filter/include/gnuradio/filter/single_pole_iir.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_SINGLE_POLE_IIR_H #define INCLUDED_SINGLE_POLE_IIR_H -#include <filter/api.h> +#include <gnuradio/filter/api.h> #include <stdexcept> -#include <gr_complex.h> +#include <gnuradio/gr_complex.h> namespace gr { namespace filter { diff --git a/gr-filter/include/filter/single_pole_iir_filter_cc.h b/gr-filter/include/gnuradio/filter/single_pole_iir_filter_cc.h index fd6f107b65..e84270aa63 100644 --- a/gr-filter/include/filter/single_pole_iir_filter_cc.h +++ b/gr-filter/include/gnuradio/filter/single_pole_iir_filter_cc.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_SINGLE_POLE_IIR_FILTER_CC_H #define INCLUDED_SINGLE_POLE_IIR_FILTER_CC_H -#include <filter/api.h> -#include <filter/single_pole_iir.h> -#include <gr_sync_block.h> -#include <gr_complex.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/filter/single_pole_iir.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/gr_complex.h> namespace gr { namespace filter { @@ -62,7 +62,7 @@ namespace gr { * denominator. If you're using that convention, you'll need to * negate the feedback tap. */ - class FILTER_API single_pole_iir_filter_cc : virtual public gr_sync_block + class FILTER_API single_pole_iir_filter_cc : virtual public sync_block { public: // gr::filter::single_pole_iir_filter_cc::sptr diff --git a/gr-filter/include/filter/single_pole_iir_filter_ff.h b/gr-filter/include/gnuradio/filter/single_pole_iir_filter_ff.h index ae4792f3d6..ae9e1821cb 100644 --- a/gr-filter/include/filter/single_pole_iir_filter_ff.h +++ b/gr-filter/include/gnuradio/filter/single_pole_iir_filter_ff.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_SINGLE_POLE_IIR_FILTER_FF_H #define INCLUDED_SINGLE_POLE_IIR_FILTER_FF_H -#include <filter/api.h> -#include <filter/single_pole_iir.h> -#include <gr_sync_block.h> -#include <gr_complex.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/filter/single_pole_iir.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/gr_complex.h> namespace gr { namespace filter { @@ -62,7 +62,7 @@ namespace gr { * denominator. If you're using that convention, you'll need to * negate the feedback tap. */ - class FILTER_API single_pole_iir_filter_ff : virtual public gr_sync_block + class FILTER_API single_pole_iir_filter_ff : virtual public sync_block { public: // gr::filter::single_pole_iir_filter_ff::sptr diff --git a/gr-filter/lib/adaptive_fir.cc b/gr-filter/lib/adaptive_fir.cc index b7d2262bb5..a7ee8228a0 100644 --- a/gr-filter/lib/adaptive_fir.cc +++ b/gr-filter/lib/adaptive_fir.cc @@ -24,8 +24,8 @@ #include "config.h" #endif -#include <filter/adaptive_fir.h> -#include <gr_io_signature.h> +#include <gnuradio/filter/adaptive_fir.h> +#include <gnuradio/io_signature.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/adaptive_fir_ccc_impl.cc b/gr-filter/lib/adaptive_fir_ccc_impl.cc index a4304bcedb..93c7dea443 100644 --- a/gr-filter/lib/adaptive_fir_ccc_impl.cc +++ b/gr-filter/lib/adaptive_fir_ccc_impl.cc @@ -25,7 +25,7 @@ #endif #include "adaptive_fir_ccc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace filter { @@ -39,9 +39,9 @@ namespace gr { adaptive_fir_ccc_impl::adaptive_fir_ccc_impl(const char *name, int decimation, const std::vector<gr_complex> &taps) - : gr_sync_decimator(name, - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex)), + : sync_decimator(name, + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex)), decimation), kernel::adaptive_fir_ccc(decimation, taps), d_updated(false) diff --git a/gr-filter/lib/adaptive_fir_ccc_impl.h b/gr-filter/lib/adaptive_fir_ccc_impl.h index 054cb4b53e..66b8fe5a49 100644 --- a/gr-filter/lib/adaptive_fir_ccc_impl.h +++ b/gr-filter/lib/adaptive_fir_ccc_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_FILTER_ADAPTIVE_FIR_CCC_IMPL_H #define INCLUDED_FILTER_ADAPTIVE_FIR_CCC_IMPL_H -#include <filter/adaptive_fir_ccc.h> -#include <filter/adaptive_fir.h> -#include <gr_types.h> +#include <gnuradio/filter/adaptive_fir_ccc.h> +#include <gnuradio/filter/adaptive_fir.h> +#include <gnuradio/types.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/adaptive_fir_ccf_impl.cc b/gr-filter/lib/adaptive_fir_ccf_impl.cc index f07b697106..16d59f36f3 100644 --- a/gr-filter/lib/adaptive_fir_ccf_impl.cc +++ b/gr-filter/lib/adaptive_fir_ccf_impl.cc @@ -25,7 +25,7 @@ #endif #include "adaptive_fir_ccf_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace filter { @@ -39,9 +39,9 @@ namespace gr { adaptive_fir_ccf_impl::adaptive_fir_ccf_impl(const char *name, int decimation, const std::vector<float> &taps) - : gr_sync_decimator(name, - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex)), + : sync_decimator(name, + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex)), decimation), kernel::adaptive_fir_ccf(decimation, taps), d_updated(false) diff --git a/gr-filter/lib/adaptive_fir_ccf_impl.h b/gr-filter/lib/adaptive_fir_ccf_impl.h index dc34185d68..188587ee56 100644 --- a/gr-filter/lib/adaptive_fir_ccf_impl.h +++ b/gr-filter/lib/adaptive_fir_ccf_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_FILTER_ADAPTIVE_FIR_CCF_IMPL_H #define INCLUDED_FILTER_ADAPTIVE_FIR_CCF_IMPL_H -#include <filter/adaptive_fir_ccf.h> -#include <filter/adaptive_fir.h> -#include <gr_types.h> +#include <gnuradio/filter/adaptive_fir_ccf.h> +#include <gnuradio/filter/adaptive_fir.h> +#include <gnuradio/types.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/dc_blocker_cc_impl.cc b/gr-filter/lib/dc_blocker_cc_impl.cc index 663ba94f1e..c5cf189cba 100644 --- a/gr-filter/lib/dc_blocker_cc_impl.cc +++ b/gr-filter/lib/dc_blocker_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include "dc_blocker_cc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> namespace gr { @@ -64,9 +64,9 @@ namespace gr { dc_blocker_cc_impl::dc_blocker_cc_impl(int D, bool long_form) - : gr_sync_block("dc_blocker_cc", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex))), + : sync_block("dc_blocker_cc", + io_signature::make (1, 1, sizeof(gr_complex)), + io_signature::make (1, 1, sizeof(gr_complex))), d_length(D), d_long_form(long_form) { if(d_long_form) { diff --git a/gr-filter/lib/dc_blocker_cc_impl.h b/gr-filter/lib/dc_blocker_cc_impl.h index 6f8bc16c76..a5093cb505 100644 --- a/gr-filter/lib/dc_blocker_cc_impl.h +++ b/gr-filter/lib/dc_blocker_cc_impl.h @@ -24,7 +24,7 @@ #ifndef INCLUDED_FILTER_DC_BLOCKER_CC_IMPL_H #define INCLUDED_FILTER_DC_BLOCKER_CC_IMPL_H -#include <filter/dc_blocker_cc.h> +#include <gnuradio/filter/dc_blocker_cc.h> #include <deque> namespace gr { diff --git a/gr-filter/lib/dc_blocker_ff_impl.cc b/gr-filter/lib/dc_blocker_ff_impl.cc index 22822d1476..1e5b238a50 100644 --- a/gr-filter/lib/dc_blocker_ff_impl.cc +++ b/gr-filter/lib/dc_blocker_ff_impl.cc @@ -25,7 +25,7 @@ #endif #include "dc_blocker_ff_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> namespace gr { @@ -62,9 +62,9 @@ namespace gr { } dc_blocker_ff_impl::dc_blocker_ff_impl(int D, bool long_form) - : gr_sync_block("dc_blocker_ff", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature (1, 1, sizeof(float))), + : sync_block("dc_blocker_ff", + io_signature::make (1, 1, sizeof(float)), + io_signature::make (1, 1, sizeof(float))), d_length(D), d_long_form(long_form) { if(d_long_form) { diff --git a/gr-filter/lib/dc_blocker_ff_impl.h b/gr-filter/lib/dc_blocker_ff_impl.h index 5ae60e2e42..c00b750a5d 100644 --- a/gr-filter/lib/dc_blocker_ff_impl.h +++ b/gr-filter/lib/dc_blocker_ff_impl.h @@ -24,7 +24,7 @@ #ifndef INCLUDED_FILTER_DC_BLOCKER_FF_IMPL_H #define INCLUDED_FILTER_DC_BLOCKER_FF_IMPL_H -#include <filter/dc_blocker_ff.h> +#include <gnuradio/filter/dc_blocker_ff.h> #include <deque> namespace gr { diff --git a/gr-filter/lib/fft_filter.cc b/gr-filter/lib/fft_filter.cc index 1b256a3dad..70ee4c67eb 100644 --- a/gr-filter/lib/fft_filter.cc +++ b/gr-filter/lib/fft_filter.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <filter/fft_filter.h> +#include <gnuradio/filter/fft_filter.h> #include <volk/volk.h> #include <iostream> #include <cstring> diff --git a/gr-filter/lib/fft_filter_ccc_impl.cc b/gr-filter/lib/fft_filter_ccc_impl.cc index 0a20029917..09077d2116 100644 --- a/gr-filter/lib/fft_filter_ccc_impl.cc +++ b/gr-filter/lib/fft_filter_ccc_impl.cc @@ -25,7 +25,7 @@ #endif #include "fft_filter_ccc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <math.h> #include <assert.h> @@ -45,9 +45,9 @@ namespace gr { fft_filter_ccc_impl::fft_filter_ccc_impl(int decimation, const std::vector<gr_complex> &taps, int nthreads) - : gr_sync_decimator("fft_filter_ccc", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), + : sync_decimator("fft_filter_ccc", + io_signature::make (1, 1, sizeof(gr_complex)), + io_signature::make (1, 1, sizeof(gr_complex)), decimation), d_updated(false) { diff --git a/gr-filter/lib/fft_filter_ccc_impl.h b/gr-filter/lib/fft_filter_ccc_impl.h index 82be009153..2f804f7bb3 100644 --- a/gr-filter/lib/fft_filter_ccc_impl.h +++ b/gr-filter/lib/fft_filter_ccc_impl.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_FILTER_FFT_FILTER_CCC_IMPL_H #define INCLUDED_FILTER_FFT_FILTER_CCC_IMPL_H -#include <filter/api.h> -#include <filter/fft_filter.h> -#include <filter/fft_filter_ccc.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/filter/fft_filter.h> +#include <gnuradio/filter/fft_filter_ccc.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/fft_filter_fff_impl.cc b/gr-filter/lib/fft_filter_fff_impl.cc index 1d6eb02db1..9d6fa4a59a 100644 --- a/gr-filter/lib/fft_filter_fff_impl.cc +++ b/gr-filter/lib/fft_filter_fff_impl.cc @@ -25,7 +25,7 @@ #endif #include "fft_filter_fff_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <math.h> #include <assert.h> @@ -46,9 +46,9 @@ namespace gr { fft_filter_fff_impl::fft_filter_fff_impl(int decimation, const std::vector<float> &taps, int nthreads) - : gr_sync_decimator("fft_filter_fff", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature (1, 1, sizeof(float)), + : sync_decimator("fft_filter_fff", + io_signature::make (1, 1, sizeof(float)), + io_signature::make (1, 1, sizeof(float)), decimation), d_updated(false) { diff --git a/gr-filter/lib/fft_filter_fff_impl.h b/gr-filter/lib/fft_filter_fff_impl.h index df35d3df7b..85b75ef625 100644 --- a/gr-filter/lib/fft_filter_fff_impl.h +++ b/gr-filter/lib/fft_filter_fff_impl.h @@ -22,9 +22,9 @@ #ifndef INCLUDED_FILTER_FFT_FILTER_FFF_IMPL_H #define INCLUDED_FILTER_FFT_FILTER_FFF_IMPL_H -#include <filter/api.h> -#include <filter/fft_filter.h> -#include <filter/fft_filter_fff.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/filter/fft_filter.h> +#include <gnuradio/filter/fft_filter_fff.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/filter_delay_fc_impl.cc b/gr-filter/lib/filter_delay_fc_impl.cc index 3bb5508642..645cfdc67e 100644 --- a/gr-filter/lib/filter_delay_fc_impl.cc +++ b/gr-filter/lib/filter_delay_fc_impl.cc @@ -36,9 +36,9 @@ namespace gr { } filter_delay_fc_impl::filter_delay_fc_impl(const std::vector<float> &taps) - : gr_sync_block("filter_delay_fc", - gr_make_io_signature(1, 2, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : sync_block("filter_delay_fc", + io_signature::make(1, 2, sizeof(float)), + io_signature::make(1, 1, sizeof(gr_complex))), d_update(false) { d_taps = taps; diff --git a/gr-filter/lib/filter_delay_fc_impl.h b/gr-filter/lib/filter_delay_fc_impl.h index 5157d6e022..5f39de223a 100644 --- a/gr-filter/lib/filter_delay_fc_impl.h +++ b/gr-filter/lib/filter_delay_fc_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_FILTER_FILTER_DELAY_FC_IMPL_H #define INCLUDED_FILTER_FILTER_DELAY_FC_IMPL_H -#include <filter/filter_delay_fc.h> -#include <filter/fir_filter.h> -#include <gr_io_signature.h> +#include <gnuradio/filter/filter_delay_fc.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/io_signature.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/fir_filter.cc b/gr-filter/lib/fir_filter.cc index 58a500e2e6..38df5fdc3e 100644 --- a/gr-filter/lib/fir_filter.cc +++ b/gr-filter/lib/fir_filter.cc @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <filter/fir_filter.h> -#include <fft/fft.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/fft/fft.h> #include <volk/volk.h> #include <cstdio> #include <cstring> diff --git a/gr-filter/lib/fir_filter_XXX_impl.cc.t b/gr-filter/lib/fir_filter_XXX_impl.cc.t index e48afe95f2..8b8938095f 100644 --- a/gr-filter/lib/fir_filter_XXX_impl.cc.t +++ b/gr-filter/lib/fir_filter_XXX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@IMPL_NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -42,9 +42,9 @@ namespace gr { @IMPL_NAME@::@IMPL_NAME@(int decimation, const std::vector<@TAP_TYPE@> &taps) - : gr_sync_decimator("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@)), + : sync_decimator("@BASE_NAME@", + io_signature::make(1, 1, sizeof(@I_TYPE@)), + io_signature::make(1, 1, sizeof(@O_TYPE@)), decimation) { d_fir = new kernel::@BASE_NAME@(decimation, taps); diff --git a/gr-filter/lib/fir_filter_XXX_impl.h.t b/gr-filter/lib/fir_filter_XXX_impl.h.t index ef0a7adfee..d00e73dc33 100644 --- a/gr-filter/lib/fir_filter_XXX_impl.h.t +++ b/gr-filter/lib/fir_filter_XXX_impl.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <filter/fir_filter.h> -#include <filter/@BASE_NAME@.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/filter/@BASE_NAME@.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/fir_filter_with_buffer.cc b/gr-filter/lib/fir_filter_with_buffer.cc index 7c37361c11..b6984e4f1f 100644 --- a/gr-filter/lib/fir_filter_with_buffer.cc +++ b/gr-filter/lib/fir_filter_with_buffer.cc @@ -24,8 +24,8 @@ #include <config.h> #endif -#include <filter/fir_filter_with_buffer.h> -#include <fft/fft.h> +#include <gnuradio/filter/fir_filter_with_buffer.h> +#include <gnuradio/fft/fft.h> #include <volk/volk.h> #include <algorithm> #include <cstdio> diff --git a/gr-filter/lib/firdes.cc b/gr-filter/lib/firdes.cc index 5c3320d71a..f6e75814cb 100644 --- a/gr-filter/lib/firdes.cc +++ b/gr-filter/lib/firdes.cc @@ -24,7 +24,7 @@ #include <config.h> #endif -#include <filter/firdes.h> +#include <gnuradio/filter/firdes.h> #include <stdexcept> using std::vector; diff --git a/gr-filter/lib/fractional_interpolator_cc_impl.cc b/gr-filter/lib/fractional_interpolator_cc_impl.cc index 137f6ee9c4..06e823f75a 100644 --- a/gr-filter/lib/fractional_interpolator_cc_impl.cc +++ b/gr-filter/lib/fractional_interpolator_cc_impl.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "fractional_interpolator_cc_impl.h" #include <stdexcept> @@ -40,9 +40,9 @@ namespace gr { fractional_interpolator_cc_impl::fractional_interpolator_cc_impl (float phase_shift, float interp_ratio) - : gr_block("fractional_interpolator_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : block("fractional_interpolator_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), d_mu (phase_shift), d_mu_inc (interp_ratio), d_interp(new mmse_fir_interpolator_cc()) { diff --git a/gr-filter/lib/fractional_interpolator_cc_impl.h b/gr-filter/lib/fractional_interpolator_cc_impl.h index cb42186038..6297313b97 100644 --- a/gr-filter/lib/fractional_interpolator_cc_impl.h +++ b/gr-filter/lib/fractional_interpolator_cc_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FRACTIONAL_INTERPOLATOR_CC_IMPL_H #define INCLUDED_FRACTIONAL_INTERPOLATOR_CC_IMPL_H -#include <filter/fractional_interpolator_cc.h> -#include <filter/mmse_fir_interpolator_cc.h> +#include <gnuradio/filter/fractional_interpolator_cc.h> +#include <gnuradio/filter/mmse_fir_interpolator_cc.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/fractional_interpolator_ff_impl.cc b/gr-filter/lib/fractional_interpolator_ff_impl.cc index f9202166b0..8728a05241 100644 --- a/gr-filter/lib/fractional_interpolator_ff_impl.cc +++ b/gr-filter/lib/fractional_interpolator_ff_impl.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "fractional_interpolator_ff_impl.h" #include <stdexcept> @@ -40,9 +40,9 @@ namespace gr { fractional_interpolator_ff_impl::fractional_interpolator_ff_impl (float phase_shift, float interp_ratio) - : gr_block("fractional_interpolator_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), + : block("fractional_interpolator_ff", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))), d_mu (phase_shift), d_mu_inc (interp_ratio), d_interp(new mmse_fir_interpolator_ff()) { diff --git a/gr-filter/lib/fractional_interpolator_ff_impl.h b/gr-filter/lib/fractional_interpolator_ff_impl.h index d31385cc49..41c5db7e77 100644 --- a/gr-filter/lib/fractional_interpolator_ff_impl.h +++ b/gr-filter/lib/fractional_interpolator_ff_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FRACTIONAL_INTERPOLATOR_FF_IMPL_H #define INCLUDED_FRACTIONAL_INTERPOLATOR_FF_IMPL_H -#include <filter/fractional_interpolator_ff.h> -#include <filter/mmse_fir_interpolator_ff.h> +#include <gnuradio/filter/fractional_interpolator_ff.h> +#include <gnuradio/filter/mmse_fir_interpolator_ff.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/fractional_resampler_cc_impl.cc b/gr-filter/lib/fractional_resampler_cc_impl.cc index 965241fdb3..27f139d813 100644 --- a/gr-filter/lib/fractional_resampler_cc_impl.cc +++ b/gr-filter/lib/fractional_resampler_cc_impl.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "fractional_resampler_cc_impl.h" #include <stdexcept> @@ -40,9 +40,9 @@ namespace gr { fractional_resampler_cc_impl::fractional_resampler_cc_impl (float phase_shift, float resamp_ratio) - : gr_block("fractional_resampler_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : block("fractional_resampler_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), d_mu(phase_shift), d_mu_inc(resamp_ratio), d_resamp(new mmse_fir_interpolator_cc()) { diff --git a/gr-filter/lib/fractional_resampler_cc_impl.h b/gr-filter/lib/fractional_resampler_cc_impl.h index 15f36f9bb9..f4a5ead56e 100644 --- a/gr-filter/lib/fractional_resampler_cc_impl.h +++ b/gr-filter/lib/fractional_resampler_cc_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FRACTIONAL_RESAMPLER_CC_IMPL_H #define INCLUDED_FRACTIONAL_RESAMPLER_CC_IMPL_H -#include <filter/fractional_resampler_cc.h> -#include <filter/mmse_fir_interpolator_cc.h> +#include <gnuradio/filter/fractional_resampler_cc.h> +#include <gnuradio/filter/mmse_fir_interpolator_cc.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/fractional_resampler_ff_impl.cc b/gr-filter/lib/fractional_resampler_ff_impl.cc index cf7a9f462f..61950d92c0 100644 --- a/gr-filter/lib/fractional_resampler_ff_impl.cc +++ b/gr-filter/lib/fractional_resampler_ff_impl.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include "fractional_resampler_ff_impl.h" #include <stdexcept> @@ -40,9 +40,9 @@ namespace gr { fractional_resampler_ff_impl::fractional_resampler_ff_impl (float phase_shift, float resamp_ratio) - : gr_block("fractional_resampler_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), + : block("fractional_resampler_ff", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))), d_mu (phase_shift), d_mu_inc (resamp_ratio), d_resamp(new mmse_fir_interpolator_ff()) { diff --git a/gr-filter/lib/fractional_resampler_ff_impl.h b/gr-filter/lib/fractional_resampler_ff_impl.h index 053a3ca040..7e7fcc0ad4 100644 --- a/gr-filter/lib/fractional_resampler_ff_impl.h +++ b/gr-filter/lib/fractional_resampler_ff_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_FRACTIONAL_RESAMPLER_FF_IMPL_H #define INCLUDED_FRACTIONAL_RESAMPLER_FF_IMPL_H -#include <filter/fractional_resampler_ff.h> -#include <filter/mmse_fir_interpolator_ff.h> +#include <gnuradio/filter/fractional_resampler_ff.h> +#include <gnuradio/filter/mmse_fir_interpolator_ff.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t index a59fa12b36..72a2c0514e 100644 --- a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t +++ b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t @@ -30,7 +30,7 @@ #endif #include "@IMPL_NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -52,9 +52,9 @@ namespace gr { const std::vector<@TAP_TYPE@> &taps, double center_freq, double sampling_freq) - : gr_sync_decimator("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@)), + : sync_decimator("@BASE_NAME@", + io_signature::make(1, 1, sizeof(@I_TYPE@)), + io_signature::make(1, 1, sizeof(@O_TYPE@)), decimation), d_proto_taps(taps), d_center_freq(center_freq), d_sampling_freq(sampling_freq), diff --git a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t index 00222cac00..352593b6c9 100644 --- a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t +++ b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t @@ -28,10 +28,10 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <filter/api.h> -#include <filter/fir_filter.h> -#include <filter/@BASE_NAME@.h> -#include <blocks/rotator.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/filter/@BASE_NAME@.h> +#include <gnuradio/blocks/rotator.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/hilbert_fc_impl.cc b/gr-filter/lib/hilbert_fc_impl.cc index 52b2dabae9..29778a9417 100644 --- a/gr-filter/lib/hilbert_fc_impl.cc +++ b/gr-filter/lib/hilbert_fc_impl.cc @@ -25,8 +25,8 @@ #endif #include "hilbert_fc_impl.h" -#include <filter/firdes.h> -#include <gr_io_signature.h> +#include <gnuradio/filter/firdes.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> namespace gr { @@ -38,9 +38,9 @@ namespace gr { } hilbert_fc_impl::hilbert_fc_impl(unsigned int ntaps) - : gr_sync_block ("hilbert_fc", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature (1, 1, sizeof(gr_complex))), + : sync_block ("hilbert_fc", + io_signature::make (1, 1, sizeof(float)), + io_signature::make (1, 1, sizeof(gr_complex))), d_ntaps(ntaps | 0x1) // ensure ntaps is odd { d_hilb = new kernel::fir_filter_fff(1, firdes::hilbert(d_ntaps)); diff --git a/gr-filter/lib/hilbert_fc_impl.h b/gr-filter/lib/hilbert_fc_impl.h index d2b41b5732..c36d519e7a 100644 --- a/gr-filter/lib/hilbert_fc_impl.h +++ b/gr-filter/lib/hilbert_fc_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_FILTER_HILBERT_FC_IMPL_H #define INCLUDED_FILTER_HILBERT_FC_IMPL_H -#include <filter/hilbert_fc.h> -#include <filter/fir_filter.h> -#include <gr_types.h> +#include <gnuradio/filter/hilbert_fc.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/types.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/iir_filter_ffd_impl.cc b/gr-filter/lib/iir_filter_ffd_impl.cc index 9a5d78b5c9..b61c80aabf 100644 --- a/gr-filter/lib/iir_filter_ffd_impl.cc +++ b/gr-filter/lib/iir_filter_ffd_impl.cc @@ -25,7 +25,7 @@ #endif #include "iir_filter_ffd_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace filter { @@ -43,9 +43,9 @@ namespace gr { const std::vector<double> &fbtaps, bool oldstyle) - : gr_sync_block("iir_filter_ffd", - gr_make_io_signature(1, 1, sizeof (float)), - gr_make_io_signature(1, 1, sizeof (float))), + : sync_block("iir_filter_ffd", + io_signature::make(1, 1, sizeof (float)), + io_signature::make(1, 1, sizeof (float))), d_updated(false) { d_iir = new kernel::iir_filter<float,float,double>(fftaps, fbtaps, oldstyle); diff --git a/gr-filter/lib/iir_filter_ffd_impl.h b/gr-filter/lib/iir_filter_ffd_impl.h index 3d3aec3762..5cad8eccdc 100644 --- a/gr-filter/lib/iir_filter_ffd_impl.h +++ b/gr-filter/lib/iir_filter_ffd_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_IIR_FILTER_FFD_IMPL_H #define INCLUDED_IIR_FILTER_FFD_IMPL_H -#include <filter/iir_filter.h> -#include <filter/iir_filter_ffd.h> +#include <gnuradio/filter/iir_filter.h> +#include <gnuradio/filter/iir_filter_ffd.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/interp_fir_filter_XXX_impl.cc.t b/gr-filter/lib/interp_fir_filter_XXX_impl.cc.t index fea3b1c8e9..d9ba509dc3 100644 --- a/gr-filter/lib/interp_fir_filter_XXX_impl.cc.t +++ b/gr-filter/lib/interp_fir_filter_XXX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@IMPL_NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> #include <stdexcept> @@ -44,9 +44,9 @@ namespace gr { @IMPL_NAME@::@IMPL_NAME@(unsigned interpolation, const std::vector<@TAP_TYPE@> &taps) - : gr_sync_interpolator("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@)), + : sync_interpolator("@BASE_NAME@", + io_signature::make(1, 1, sizeof(@I_TYPE@)), + io_signature::make(1, 1, sizeof(@O_TYPE@)), interpolation), d_updated(false), d_firs(interpolation) { diff --git a/gr-filter/lib/interp_fir_filter_XXX_impl.h.t b/gr-filter/lib/interp_fir_filter_XXX_impl.h.t index e505fca698..0e39de613c 100644 --- a/gr-filter/lib/interp_fir_filter_XXX_impl.h.t +++ b/gr-filter/lib/interp_fir_filter_XXX_impl.h.t @@ -25,9 +25,9 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <filter/api.h> -#include <filter/fir_filter.h> -#include <filter/@BASE_NAME@.h> +#include <gnuradio/filter/api.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/filter/@BASE_NAME@.h> #include <vector> namespace gr { diff --git a/gr-filter/lib/mmse_fir_interpolator_cc.cc b/gr-filter/lib/mmse_fir_interpolator_cc.cc index 8af1fb39a6..5d711ecc81 100644 --- a/gr-filter/lib/mmse_fir_interpolator_cc.cc +++ b/gr-filter/lib/mmse_fir_interpolator_cc.cc @@ -24,8 +24,8 @@ #include <config.h> #endif -#include <filter/mmse_fir_interpolator_cc.h> -#include <filter/interpolator_taps.h> +#include <gnuradio/filter/mmse_fir_interpolator_cc.h> +#include <gnuradio/filter/interpolator_taps.h> #include <stdexcept> namespace gr { diff --git a/gr-filter/lib/mmse_fir_interpolator_ff.cc b/gr-filter/lib/mmse_fir_interpolator_ff.cc index ff2c4dd873..f4cf6c3862 100644 --- a/gr-filter/lib/mmse_fir_interpolator_ff.cc +++ b/gr-filter/lib/mmse_fir_interpolator_ff.cc @@ -24,8 +24,8 @@ #include <config.h> #endif -#include <filter/mmse_fir_interpolator_ff.h> -#include <filter/interpolator_taps.h> +#include <gnuradio/filter/mmse_fir_interpolator_ff.h> +#include <gnuradio/filter/interpolator_taps.h> #include <stdexcept> namespace gr { diff --git a/gr-filter/lib/pfb_arb_resampler_ccf_impl.cc b/gr-filter/lib/pfb_arb_resampler_ccf_impl.cc index 71507a5aa5..135f6e4f05 100644 --- a/gr-filter/lib/pfb_arb_resampler_ccf_impl.cc +++ b/gr-filter/lib/pfb_arb_resampler_ccf_impl.cc @@ -25,7 +25,7 @@ #endif #include "pfb_arb_resampler_ccf_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> namespace gr { @@ -44,9 +44,9 @@ namespace gr { pfb_arb_resampler_ccf_impl::pfb_arb_resampler_ccf_impl(float rate, const std::vector<float> &taps, unsigned int filter_size) - : gr_block("pfb_arb_resampler_ccf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : block("pfb_arb_resampler_ccf", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), d_updated (false) { d_acc = 0; // start accumulator at 0 diff --git a/gr-filter/lib/pfb_arb_resampler_ccf_impl.h b/gr-filter/lib/pfb_arb_resampler_ccf_impl.h index 71f8957421..d0c53dc821 100644 --- a/gr-filter/lib/pfb_arb_resampler_ccf_impl.h +++ b/gr-filter/lib/pfb_arb_resampler_ccf_impl.h @@ -24,9 +24,9 @@ #ifndef INCLUDED_PFB_ARB_RESAMPLER_CCF_IMPL_H #define INCLUDED_PFB_ARB_RESAMPLER_CCF_IMPL_H -#include <filter/pfb_arb_resampler_ccf.h> -#include <filter/fir_filter.h> -#include <thread/thread.h> +#include <gnuradio/filter/pfb_arb_resampler_ccf.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/thread/thread.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/pfb_arb_resampler_fff_impl.cc b/gr-filter/lib/pfb_arb_resampler_fff_impl.cc index 2a60c1e2e2..c17f637776 100644 --- a/gr-filter/lib/pfb_arb_resampler_fff_impl.cc +++ b/gr-filter/lib/pfb_arb_resampler_fff_impl.cc @@ -25,7 +25,7 @@ #endif #include "pfb_arb_resampler_fff_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> namespace gr { @@ -44,9 +44,9 @@ namespace gr { pfb_arb_resampler_fff_impl::pfb_arb_resampler_fff_impl(float rate, const std::vector<float> &taps, unsigned int filter_size) - : gr_block("pfb_arb_resampler_fff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), + : block("pfb_arb_resampler_fff", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(float))), d_updated(false) { d_acc = 0; // start accumulator at 0 diff --git a/gr-filter/lib/pfb_arb_resampler_fff_impl.h b/gr-filter/lib/pfb_arb_resampler_fff_impl.h index fb871d4d44..e6022f1c18 100644 --- a/gr-filter/lib/pfb_arb_resampler_fff_impl.h +++ b/gr-filter/lib/pfb_arb_resampler_fff_impl.h @@ -24,9 +24,9 @@ #ifndef INCLUDED_PFB_ARB_RESAMPLER_FFF_IMPL_H #define INCLUDED_PFB_ARB_RESAMPLER_FFF_IMPL_H -#include <filter/pfb_arb_resampler_fff.h> -#include <filter/fir_filter.h> -#include <thread/thread.h> +#include <gnuradio/filter/pfb_arb_resampler_fff.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/thread/thread.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/pfb_channelizer_ccf_impl.cc b/gr-filter/lib/pfb_channelizer_ccf_impl.cc index 53d5375bec..bb2aa07a54 100644 --- a/gr-filter/lib/pfb_channelizer_ccf_impl.cc +++ b/gr-filter/lib/pfb_channelizer_ccf_impl.cc @@ -25,7 +25,7 @@ #endif #include "pfb_channelizer_ccf_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace filter { @@ -41,9 +41,9 @@ namespace gr { pfb_channelizer_ccf_impl::pfb_channelizer_ccf_impl(unsigned int nfilts, const std::vector<float> &taps, float oversample_rate) - : gr_block("pfb_channelizer_ccf", - gr_make_io_signature(nfilts, nfilts, sizeof(gr_complex)), - gr_make_io_signature(1, nfilts, sizeof(gr_complex))), + : block("pfb_channelizer_ccf", + io_signature::make(nfilts, nfilts, sizeof(gr_complex)), + io_signature::make(1, nfilts, sizeof(gr_complex))), polyphase_filterbank(nfilts, taps), d_updated(false), d_oversample_rate(oversample_rate) { diff --git a/gr-filter/lib/pfb_channelizer_ccf_impl.h b/gr-filter/lib/pfb_channelizer_ccf_impl.h index 56f1103ca5..6d727676b2 100644 --- a/gr-filter/lib/pfb_channelizer_ccf_impl.h +++ b/gr-filter/lib/pfb_channelizer_ccf_impl.h @@ -23,11 +23,11 @@ #ifndef INCLUDED_FILTER_PFB_CHANNELIZER_CCF_IMPL_H #define INCLUDED_FILTER_PFB_CHANNELIZER_CCF_IMPL_H -#include <filter/pfb_channelizer_ccf.h> -#include <filter/polyphase_filterbank.h> -#include <filter/fir_filter.h> -#include <fft/fft.h> -#include <thread/thread.h> +#include <gnuradio/filter/pfb_channelizer_ccf.h> +#include <gnuradio/filter/polyphase_filterbank.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/thread/thread.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/pfb_decimator_ccf_impl.cc b/gr-filter/lib/pfb_decimator_ccf_impl.cc index 52c459f784..0010d6366c 100644 --- a/gr-filter/lib/pfb_decimator_ccf_impl.cc +++ b/gr-filter/lib/pfb_decimator_ccf_impl.cc @@ -25,7 +25,7 @@ #endif #include "pfb_decimator_ccf_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace filter { @@ -43,9 +43,9 @@ namespace gr { pfb_decimator_ccf_impl::pfb_decimator_ccf_impl(unsigned int decim, const std::vector<float> &taps, unsigned int channel) - : gr_sync_block("pfb_decimator_ccf", - gr_make_io_signature(decim, decim, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), + : sync_block("pfb_decimator_ccf", + io_signature::make(decim, decim, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), polyphase_filterbank(decim, taps), d_updated(false), d_chan(channel) { diff --git a/gr-filter/lib/pfb_decimator_ccf_impl.h b/gr-filter/lib/pfb_decimator_ccf_impl.h index 31b9910418..eeebc2c3a7 100644 --- a/gr-filter/lib/pfb_decimator_ccf_impl.h +++ b/gr-filter/lib/pfb_decimator_ccf_impl.h @@ -24,11 +24,11 @@ #ifndef INCLUDED_PFB_DECIMATOR_CCF_IMPL_H #define INCLUDED_PFB_DECIMATOR_CCF_IMPL_H -#include <filter/pfb_decimator_ccf.h> -#include <filter/polyphase_filterbank.h> -#include <filter/fir_filter.h> -#include <fft/fft.h> -#include <thread/thread.h> +#include <gnuradio/filter/pfb_decimator_ccf.h> +#include <gnuradio/filter/polyphase_filterbank.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/thread/thread.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/pfb_interpolator_ccf_impl.cc b/gr-filter/lib/pfb_interpolator_ccf_impl.cc index 042238ff48..fce5fb2e68 100644 --- a/gr-filter/lib/pfb_interpolator_ccf_impl.cc +++ b/gr-filter/lib/pfb_interpolator_ccf_impl.cc @@ -25,7 +25,7 @@ #endif #include "pfb_interpolator_ccf_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace filter { @@ -41,9 +41,9 @@ namespace gr { pfb_interpolator_ccf_impl::pfb_interpolator_ccf_impl(unsigned int interp, const std::vector<float> &taps) - : gr_sync_interpolator("pfb_interpolator_ccf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex)), + : sync_interpolator("pfb_interpolator_ccf", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex)), interp), polyphase_filterbank(interp, taps), d_updated (false), d_rate(interp) diff --git a/gr-filter/lib/pfb_interpolator_ccf_impl.h b/gr-filter/lib/pfb_interpolator_ccf_impl.h index fb54501b1a..6bc1d4b789 100644 --- a/gr-filter/lib/pfb_interpolator_ccf_impl.h +++ b/gr-filter/lib/pfb_interpolator_ccf_impl.h @@ -24,11 +24,11 @@ #ifndef INCLUDED_PFB_INTERPOLATOR_CCF_IMPL_H #define INCLUDED_PFB_INTERPOLATOR_CCF_IMPL_H -#include <filter/pfb_interpolator_ccf.h> -#include <filter/polyphase_filterbank.h> -#include <filter/fir_filter.h> -#include <fft/fft.h> -#include <thread/thread.h> +#include <gnuradio/filter/pfb_interpolator_ccf.h> +#include <gnuradio/filter/polyphase_filterbank.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/thread/thread.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/pfb_synthesizer_ccf_impl.cc b/gr-filter/lib/pfb_synthesizer_ccf_impl.cc index 0968bbc6c3..49f45ab8cd 100644 --- a/gr-filter/lib/pfb_synthesizer_ccf_impl.cc +++ b/gr-filter/lib/pfb_synthesizer_ccf_impl.cc @@ -25,7 +25,7 @@ #endif #include "pfb_synthesizer_ccf_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <cstdio> namespace gr { @@ -44,9 +44,9 @@ namespace gr { pfb_synthesizer_ccf_impl::pfb_synthesizer_ccf_impl(unsigned int numchans, const std::vector<float> &taps, bool twox) - : gr_sync_interpolator("pfb_synthesizer_ccf", - gr_make_io_signature(1, numchans, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex)), + : sync_interpolator("pfb_synthesizer_ccf", + io_signature::make(1, numchans, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex)), (twox ? numchans/2 : numchans)), d_updated(false), d_numchans(numchans), d_state(0) { diff --git a/gr-filter/lib/pfb_synthesizer_ccf_impl.h b/gr-filter/lib/pfb_synthesizer_ccf_impl.h index b443773de3..e83865a7ff 100644 --- a/gr-filter/lib/pfb_synthesizer_ccf_impl.h +++ b/gr-filter/lib/pfb_synthesizer_ccf_impl.h @@ -24,10 +24,10 @@ #ifndef INCLUDED_PFB_SYNTHESIZER_CCF_IMPL_H #define INCLUDED_PFB_SYNTHESIZER_CCF_IMPL_H -#include <filter/pfb_synthesizer_ccf.h> -#include <filter/fir_filter_with_buffer.h> -#include <fft/fft.h> -#include <thread/thread.h> +#include <gnuradio/filter/pfb_synthesizer_ccf.h> +#include <gnuradio/filter/fir_filter_with_buffer.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/thread/thread.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/pm_remez.cc b/gr-filter/lib/pm_remez.cc index e7136bd83a..24891f1795 100644 --- a/gr-filter/lib/pm_remez.cc +++ b/gr-filter/lib/pm_remez.cc @@ -41,7 +41,7 @@ #include "config.h" #endif -#include <filter/pm_remez.h> +#include <gnuradio/filter/pm_remez.h> #include <cmath> #include <assert.h> #include <iostream> diff --git a/gr-filter/lib/polyphase_filterbank.cc b/gr-filter/lib/polyphase_filterbank.cc index 046c23fc07..8731241941 100644 --- a/gr-filter/lib/polyphase_filterbank.cc +++ b/gr-filter/lib/polyphase_filterbank.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <filter/polyphase_filterbank.h> +#include <gnuradio/filter/polyphase_filterbank.h> #include <cstdio> namespace gr { diff --git a/gr-filter/lib/qa_filter.h b/gr-filter/lib/qa_filter.h index d3bc0adecb..6ed698d738 100644 --- a/gr-filter/lib/qa_filter.h +++ b/gr-filter/lib/qa_filter.h @@ -23,7 +23,7 @@ #ifndef _QA_GR_FILTER_H_ #define _QA_GR_FILTER_H_ -#include <attributes.h> +#include <gnuradio/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for the gr-filter directory diff --git a/gr-filter/lib/qa_fir_filter_with_buffer.cc b/gr-filter/lib/qa_fir_filter_with_buffer.cc index ab2958ed15..ffc9120115 100644 --- a/gr-filter/lib/qa_fir_filter_with_buffer.cc +++ b/gr-filter/lib/qa_fir_filter_with_buffer.cc @@ -24,13 +24,13 @@ #include <config.h> #endif -#include <gr_types.h> +#include <gnuradio/types.h> #include <qa_fir_filter_with_buffer.h> -#include <filter/fir_filter_with_buffer.h> -#include <fft/fft.h> +#include <gnuradio/filter/fir_filter_with_buffer.h> +#include <gnuradio/fft/fft.h> #include <cppunit/TestAssert.h> #include <cmath> -#include <random.h> +#include <gnuradio/random.h> #include <cstring> namespace gr { @@ -42,7 +42,7 @@ namespace gr { static float uniform() { - return 2.0 * ((float) random() / RANDOM_MAX - 0.5); // uniformly (-1, 1) + return 2.0 * ((float)(::random()) / RANDOM_MAX - 0.5); // uniformly (-1, 1) } static void diff --git a/gr-filter/lib/qa_firdes.cc b/gr-filter/lib/qa_firdes.cc index c2fe399d5a..dfc5e00f35 100644 --- a/gr-filter/lib/qa_firdes.cc +++ b/gr-filter/lib/qa_firdes.cc @@ -21,9 +21,9 @@ */ #include <qa_firdes.h> -#include <filter/firdes.h> +#include <gnuradio/filter/firdes.h> #include <cppunit/TestAssert.h> -#include <gr_complex.h> +#include <gnuradio/gr_complex.h> #include <string.h> #include <iostream> #include <iomanip> diff --git a/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc b/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc index 268b8801cc..8d1ec533f7 100644 --- a/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc +++ b/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc @@ -26,8 +26,8 @@ #include <cppunit/TestAssert.h> #include <qa_mmse_fir_interpolator_cc.h> -#include <filter/mmse_fir_interpolator_cc.h> -#include <fft/fft.h> +#include <gnuradio/filter/mmse_fir_interpolator_cc.h> +#include <gnuradio/fft/fft.h> #include <cstdio> #include <cmath> #include <stdexcept> diff --git a/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc b/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc index 54387fd9bd..9e9c6cfdd8 100644 --- a/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc +++ b/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc @@ -26,8 +26,8 @@ #include <cppunit/TestAssert.h> #include <qa_mmse_fir_interpolator_ff.h> -#include <filter/mmse_fir_interpolator_ff.h> -#include <fft/fft.h> +#include <gnuradio/filter/mmse_fir_interpolator_ff.h> +#include <gnuradio/fft/fft.h> #include <cstdio> #include <cmath> diff --git a/gr-filter/lib/rational_resampler_base_XXX_impl.cc.t b/gr-filter/lib/rational_resampler_base_XXX_impl.cc.t index 2e9161eeb8..29f4e11c38 100644 --- a/gr-filter/lib/rational_resampler_base_XXX_impl.cc.t +++ b/gr-filter/lib/rational_resampler_base_XXX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@IMPL_NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <volk/volk.h> #include <stdexcept> @@ -46,9 +46,9 @@ namespace gr { @IMPL_NAME@::@IMPL_NAME@(unsigned interpolation, unsigned decimation, const std::vector<@TAP_TYPE@> &taps) - : gr_block("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@))), + : block("@BASE_NAME@", + io_signature::make(1, 1, sizeof(@I_TYPE@)), + io_signature::make(1, 1, sizeof(@O_TYPE@))), d_history(1), d_interpolation(interpolation), d_decimation(decimation), diff --git a/gr-filter/lib/rational_resampler_base_XXX_impl.h.t b/gr-filter/lib/rational_resampler_base_XXX_impl.h.t index 4396656da2..debd059092 100644 --- a/gr-filter/lib/rational_resampler_base_XXX_impl.h.t +++ b/gr-filter/lib/rational_resampler_base_XXX_impl.h.t @@ -25,8 +25,8 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <filter/fir_filter.h> -#include <filter/@BASE_NAME@.h> +#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/filter/@BASE_NAME@.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/single_pole_iir_filter_cc_impl.cc b/gr-filter/lib/single_pole_iir_filter_cc_impl.cc index 9406f2c98a..ecfe8f05ee 100644 --- a/gr-filter/lib/single_pole_iir_filter_cc_impl.cc +++ b/gr-filter/lib/single_pole_iir_filter_cc_impl.cc @@ -25,7 +25,7 @@ #endif #include "single_pole_iir_filter_cc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { @@ -40,9 +40,9 @@ namespace gr { single_pole_iir_filter_cc_impl::single_pole_iir_filter_cc_impl (double alpha, unsigned int vlen) - : gr_sync_block("single_pole_iir_filter_cc", - gr_make_io_signature(1, 1, sizeof (gr_complex) * vlen), - gr_make_io_signature(1, 1, sizeof (gr_complex) * vlen)), + : sync_block("single_pole_iir_filter_cc", + io_signature::make(1, 1, sizeof (gr_complex) * vlen), + io_signature::make(1, 1, sizeof (gr_complex) * vlen)), d_vlen(vlen), d_iir(vlen) { set_taps(alpha); diff --git a/gr-filter/lib/single_pole_iir_filter_cc_impl.h b/gr-filter/lib/single_pole_iir_filter_cc_impl.h index fa627881e5..689546a16a 100644 --- a/gr-filter/lib/single_pole_iir_filter_cc_impl.h +++ b/gr-filter/lib/single_pole_iir_filter_cc_impl.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_SINGLE_POLE_IIR_FILTER_CC_IMPL_H #define INCLUDED_SINGLE_POLE_IIR_FILTER_CC_IMPL_H -#include <filter/single_pole_iir.h> -#include <filter/single_pole_iir_filter_cc.h> -#include <gr_sync_block.h> -#include <gr_complex.h> +#include <gnuradio/filter/single_pole_iir.h> +#include <gnuradio/filter/single_pole_iir_filter_cc.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/gr_complex.h> #include <stdexcept> namespace gr { diff --git a/gr-filter/lib/single_pole_iir_filter_ff_impl.cc b/gr-filter/lib/single_pole_iir_filter_ff_impl.cc index 7e2bae5db7..23d9814eb4 100644 --- a/gr-filter/lib/single_pole_iir_filter_ff_impl.cc +++ b/gr-filter/lib/single_pole_iir_filter_ff_impl.cc @@ -25,7 +25,7 @@ #endif #include "single_pole_iir_filter_ff_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace filter { @@ -39,9 +39,9 @@ namespace gr { single_pole_iir_filter_ff_impl::single_pole_iir_filter_ff_impl (double alpha, unsigned int vlen) - : gr_sync_block("single_pole_iir_filter_ff", - gr_make_io_signature(1, 1, sizeof(float)*vlen), - gr_make_io_signature(1, 1, sizeof(float)*vlen)), + : sync_block("single_pole_iir_filter_ff", + io_signature::make(1, 1, sizeof(float)*vlen), + io_signature::make(1, 1, sizeof(float)*vlen)), d_vlen(vlen), d_iir(vlen) { set_taps(alpha); diff --git a/gr-filter/lib/single_pole_iir_filter_ff_impl.h b/gr-filter/lib/single_pole_iir_filter_ff_impl.h index cba9c188c2..88eac450be 100644 --- a/gr-filter/lib/single_pole_iir_filter_ff_impl.h +++ b/gr-filter/lib/single_pole_iir_filter_ff_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_SINGLE_POLE_IIR_FILTER_FF_IMPL_H #define INCLUDED_SINGLE_POLE_IIR_FILTER_FF_IMPL_H -#include <filter/single_pole_iir.h> -#include <filter/single_pole_iir_filter_ff.h> -#include <gr_sync_block.h> +#include <gnuradio/filter/single_pole_iir.h> +#include <gnuradio/filter/single_pole_iir_filter_ff.h> +#include <gnuradio/sync_block.h> #include <stdexcept> namespace gr { diff --git a/gr-filter/lib/test_gr_filter.cc b/gr-filter/lib/test_gr_filter.cc index 32978bd317..b713aafaf7 100644 --- a/gr-filter/lib/test_gr_filter.cc +++ b/gr-filter/lib/test_gr_filter.cc @@ -27,7 +27,7 @@ #include <cppunit/TextTestRunner.h> #include <cppunit/XmlOutputter.h> -#include <gr_unittests.h> +#include <gnuradio/unittests.h> #include <qa_filter.h> #include <iostream> diff --git a/gr-filter/swig/CMakeLists.txt b/gr-filter/swig/CMakeLists.txt index 7c380eb259..dab4dd813f 100644 --- a/gr-filter/swig/CMakeLists.txt +++ b/gr-filter/swig/CMakeLists.txt @@ -38,7 +38,7 @@ endif(ENABLE_GR_CTRLPORT) # FIXME: rename to filter_swig_doc.i when gnuradio-runtime is updated set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/gr_filter_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/filter) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/filter) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_TARGET_DEPS filter_generated_includes) set(GR_SWIG_LIBRARIES gnuradio-filter gnuradio-fft) diff --git a/gr-filter/swig/filter_swig.i b/gr-filter/swig/filter_swig.i index 10d0d7d823..2af86029ac 100644 --- a/gr-filter/swig/filter_swig.i +++ b/gr-filter/swig/filter_swig.i @@ -28,102 +28,102 @@ %include "gr_filter_swig_doc.i" %{ -#include "filter/firdes.h" -#include "filter/pm_remez.h" -#include "filter/adaptive_fir_ccc.h" -#include "filter/adaptive_fir_ccf.h" -#include "filter/dc_blocker_cc.h" -#include "filter/dc_blocker_ff.h" -#include "filter/filter_delay_fc.h" -#include "filter/fir_filter_ccc.h" -#include "filter/fir_filter_ccf.h" -#include "filter/fir_filter_fcc.h" -#include "filter/fir_filter_fff.h" -#include "filter/fir_filter_fsf.h" -#include "filter/fir_filter_scc.h" -#include "filter/fft_filter_ccc.h" -#include "filter/fft_filter_fff.h" -#include "filter/fractional_interpolator_cc.h" -#include "filter/fractional_interpolator_ff.h" -#include "filter/fractional_resampler_cc.h" -#include "filter/fractional_resampler_ff.h" -#include "filter/freq_xlating_fir_filter_ccc.h" -#include "filter/freq_xlating_fir_filter_ccf.h" -#include "filter/freq_xlating_fir_filter_fcc.h" -#include "filter/freq_xlating_fir_filter_fcf.h" -#include "filter/freq_xlating_fir_filter_scf.h" -#include "filter/freq_xlating_fir_filter_scc.h" -#include "filter/hilbert_fc.h" -#include "filter/iir_filter_ffd.h" -#include "filter/interp_fir_filter_ccc.h" -#include "filter/interp_fir_filter_ccf.h" -#include "filter/interp_fir_filter_fcc.h" -#include "filter/interp_fir_filter_fff.h" -#include "filter/interp_fir_filter_fsf.h" -#include "filter/interp_fir_filter_scc.h" -#include "filter/pfb_arb_resampler_ccf.h" -#include "filter/pfb_arb_resampler_fff.h" -#include "filter/pfb_channelizer_ccf.h" -#include "filter/pfb_decimator_ccf.h" -#include "filter/pfb_interpolator_ccf.h" -#include "filter/pfb_synthesizer_ccf.h" -#include "filter/rational_resampler_base_ccc.h" -#include "filter/rational_resampler_base_ccf.h" -#include "filter/rational_resampler_base_fcc.h" -#include "filter/rational_resampler_base_fff.h" -#include "filter/rational_resampler_base_fsf.h" -#include "filter/rational_resampler_base_scc.h" -#include "filter/single_pole_iir_filter_cc.h" -#include "filter/single_pole_iir_filter_ff.h" +#include "gnuradio/filter/firdes.h" +#include "gnuradio/filter/pm_remez.h" +#include "gnuradio/filter/adaptive_fir_ccc.h" +#include "gnuradio/filter/adaptive_fir_ccf.h" +#include "gnuradio/filter/dc_blocker_cc.h" +#include "gnuradio/filter/dc_blocker_ff.h" +#include "gnuradio/filter/filter_delay_fc.h" +#include "gnuradio/filter/fir_filter_ccc.h" +#include "gnuradio/filter/fir_filter_ccf.h" +#include "gnuradio/filter/fir_filter_fcc.h" +#include "gnuradio/filter/fir_filter_fff.h" +#include "gnuradio/filter/fir_filter_fsf.h" +#include "gnuradio/filter/fir_filter_scc.h" +#include "gnuradio/filter/fft_filter_ccc.h" +#include "gnuradio/filter/fft_filter_fff.h" +#include "gnuradio/filter/fractional_interpolator_cc.h" +#include "gnuradio/filter/fractional_interpolator_ff.h" +#include "gnuradio/filter/fractional_resampler_cc.h" +#include "gnuradio/filter/fractional_resampler_ff.h" +#include "gnuradio/filter/freq_xlating_fir_filter_ccc.h" +#include "gnuradio/filter/freq_xlating_fir_filter_ccf.h" +#include "gnuradio/filter/freq_xlating_fir_filter_fcc.h" +#include "gnuradio/filter/freq_xlating_fir_filter_fcf.h" +#include "gnuradio/filter/freq_xlating_fir_filter_scf.h" +#include "gnuradio/filter/freq_xlating_fir_filter_scc.h" +#include "gnuradio/filter/hilbert_fc.h" +#include "gnuradio/filter/iir_filter_ffd.h" +#include "gnuradio/filter/interp_fir_filter_ccc.h" +#include "gnuradio/filter/interp_fir_filter_ccf.h" +#include "gnuradio/filter/interp_fir_filter_fcc.h" +#include "gnuradio/filter/interp_fir_filter_fff.h" +#include "gnuradio/filter/interp_fir_filter_fsf.h" +#include "gnuradio/filter/interp_fir_filter_scc.h" +#include "gnuradio/filter/pfb_arb_resampler_ccf.h" +#include "gnuradio/filter/pfb_arb_resampler_fff.h" +#include "gnuradio/filter/pfb_channelizer_ccf.h" +#include "gnuradio/filter/pfb_decimator_ccf.h" +#include "gnuradio/filter/pfb_interpolator_ccf.h" +#include "gnuradio/filter/pfb_synthesizer_ccf.h" +#include "gnuradio/filter/rational_resampler_base_ccc.h" +#include "gnuradio/filter/rational_resampler_base_ccf.h" +#include "gnuradio/filter/rational_resampler_base_fcc.h" +#include "gnuradio/filter/rational_resampler_base_fff.h" +#include "gnuradio/filter/rational_resampler_base_fsf.h" +#include "gnuradio/filter/rational_resampler_base_scc.h" +#include "gnuradio/filter/single_pole_iir_filter_cc.h" +#include "gnuradio/filter/single_pole_iir_filter_ff.h" %} -%include "filter/firdes.h" -%include "filter/pm_remez.h" -%include "filter/adaptive_fir_ccc.h" -%include "filter/adaptive_fir_ccf.h" -%include "filter/dc_blocker_cc.h" -%include "filter/dc_blocker_ff.h" -%include "filter/filter_delay_fc.h" -%include "filter/fir_filter_ccc.h" -%include "filter/fir_filter_ccf.h" -%include "filter/fir_filter_fcc.h" -%include "filter/fir_filter_fff.h" -%include "filter/fir_filter_fsf.h" -%include "filter/fir_filter_scc.h" -%include "filter/fft_filter_ccc.h" -%include "filter/fft_filter_fff.h" -%include "filter/fractional_interpolator_cc.h" -%include "filter/fractional_interpolator_ff.h" -%include "filter/fractional_resampler_cc.h" -%include "filter/fractional_resampler_ff.h" -%include "filter/freq_xlating_fir_filter_ccc.h" -%include "filter/freq_xlating_fir_filter_ccf.h" -%include "filter/freq_xlating_fir_filter_fcc.h" -%include "filter/freq_xlating_fir_filter_fcf.h" -%include "filter/freq_xlating_fir_filter_scf.h" -%include "filter/freq_xlating_fir_filter_scc.h" -%include "filter/hilbert_fc.h" -%include "filter/iir_filter_ffd.h" -%include "filter/interp_fir_filter_ccc.h" -%include "filter/interp_fir_filter_ccf.h" -%include "filter/interp_fir_filter_fcc.h" -%include "filter/interp_fir_filter_fff.h" -%include "filter/interp_fir_filter_fsf.h" -%include "filter/interp_fir_filter_scc.h" -%include "filter/pfb_arb_resampler_ccf.h" -%include "filter/pfb_arb_resampler_fff.h" -%include "filter/pfb_channelizer_ccf.h" -%include "filter/pfb_decimator_ccf.h" -%include "filter/pfb_interpolator_ccf.h" -%include "filter/pfb_synthesizer_ccf.h" -%include "filter/rational_resampler_base_ccc.h" -%include "filter/rational_resampler_base_ccf.h" -%include "filter/rational_resampler_base_fcc.h" -%include "filter/rational_resampler_base_fff.h" -%include "filter/rational_resampler_base_fsf.h" -%include "filter/rational_resampler_base_scc.h" -%include "filter/single_pole_iir_filter_cc.h" -%include "filter/single_pole_iir_filter_ff.h" +%include "gnuradio/filter/firdes.h" +%include "gnuradio/filter/pm_remez.h" +%include "gnuradio/filter/adaptive_fir_ccc.h" +%include "gnuradio/filter/adaptive_fir_ccf.h" +%include "gnuradio/filter/dc_blocker_cc.h" +%include "gnuradio/filter/dc_blocker_ff.h" +%include "gnuradio/filter/filter_delay_fc.h" +%include "gnuradio/filter/fir_filter_ccc.h" +%include "gnuradio/filter/fir_filter_ccf.h" +%include "gnuradio/filter/fir_filter_fcc.h" +%include "gnuradio/filter/fir_filter_fff.h" +%include "gnuradio/filter/fir_filter_fsf.h" +%include "gnuradio/filter/fir_filter_scc.h" +%include "gnuradio/filter/fft_filter_ccc.h" +%include "gnuradio/filter/fft_filter_fff.h" +%include "gnuradio/filter/fractional_interpolator_cc.h" +%include "gnuradio/filter/fractional_interpolator_ff.h" +%include "gnuradio/filter/fractional_resampler_cc.h" +%include "gnuradio/filter/fractional_resampler_ff.h" +%include "gnuradio/filter/freq_xlating_fir_filter_ccc.h" +%include "gnuradio/filter/freq_xlating_fir_filter_ccf.h" +%include "gnuradio/filter/freq_xlating_fir_filter_fcc.h" +%include "gnuradio/filter/freq_xlating_fir_filter_fcf.h" +%include "gnuradio/filter/freq_xlating_fir_filter_scf.h" +%include "gnuradio/filter/freq_xlating_fir_filter_scc.h" +%include "gnuradio/filter/hilbert_fc.h" +%include "gnuradio/filter/iir_filter_ffd.h" +%include "gnuradio/filter/interp_fir_filter_ccc.h" +%include "gnuradio/filter/interp_fir_filter_ccf.h" +%include "gnuradio/filter/interp_fir_filter_fcc.h" +%include "gnuradio/filter/interp_fir_filter_fff.h" +%include "gnuradio/filter/interp_fir_filter_fsf.h" +%include "gnuradio/filter/interp_fir_filter_scc.h" +%include "gnuradio/filter/pfb_arb_resampler_ccf.h" +%include "gnuradio/filter/pfb_arb_resampler_fff.h" +%include "gnuradio/filter/pfb_channelizer_ccf.h" +%include "gnuradio/filter/pfb_decimator_ccf.h" +%include "gnuradio/filter/pfb_interpolator_ccf.h" +%include "gnuradio/filter/pfb_synthesizer_ccf.h" +%include "gnuradio/filter/rational_resampler_base_ccc.h" +%include "gnuradio/filter/rational_resampler_base_ccf.h" +%include "gnuradio/filter/rational_resampler_base_fcc.h" +%include "gnuradio/filter/rational_resampler_base_fff.h" +%include "gnuradio/filter/rational_resampler_base_fsf.h" +%include "gnuradio/filter/rational_resampler_base_scc.h" +%include "gnuradio/filter/single_pole_iir_filter_cc.h" +%include "gnuradio/filter/single_pole_iir_filter_ff.h" GR_SWIG_BLOCK_MAGIC2(filter, adaptive_fir_ccc); GR_SWIG_BLOCK_MAGIC2(filter, adaptive_fir_ccf); diff --git a/gr-noaa/CMakeLists.txt b/gr-noaa/CMakeLists.txt index f13769f95c..966d32c8db 100644 --- a/gr-noaa/CMakeLists.txt +++ b/gr-noaa/CMakeLists.txt @@ -85,7 +85,7 @@ CPACK_COMPONENT("noaa_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/noaa) +add_subdirectory(include/gnuradio/noaa) add_subdirectory(lib) if(ENABLE_PYTHON) add_subdirectory(swig) diff --git a/gr-noaa/include/noaa/CMakeLists.txt b/gr-noaa/include/gnuradio/noaa/CMakeLists.txt index a3a18d2c26..a3a18d2c26 100644 --- a/gr-noaa/include/noaa/CMakeLists.txt +++ b/gr-noaa/include/gnuradio/noaa/CMakeLists.txt diff --git a/gr-noaa/include/noaa/api.h b/gr-noaa/include/gnuradio/noaa/api.h index 86bc8eb077..d30cbf4746 100644 --- a/gr-noaa/include/noaa/api.h +++ b/gr-noaa/include/gnuradio/noaa/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_NOAA_API_H #define INCLUDED_NOAA_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_noaa_EXPORTS # define NOAA_API __GR_ATTR_EXPORT diff --git a/gr-noaa/include/noaa/hrpt.h b/gr-noaa/include/gnuradio/noaa/hrpt.h index f0f0e53f4d..f0f0e53f4d 100644 --- a/gr-noaa/include/noaa/hrpt.h +++ b/gr-noaa/include/gnuradio/noaa/hrpt.h diff --git a/gr-noaa/include/noaa/hrpt_decoder.h b/gr-noaa/include/gnuradio/noaa/hrpt_decoder.h index 0eab88375a..1a8882633e 100644 --- a/gr-noaa/include/noaa/hrpt_decoder.h +++ b/gr-noaa/include/gnuradio/noaa/hrpt_decoder.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_NOAA_HRPT_DECODER_H #define INCLUDED_NOAA_HRPT_DECODER_H -#include <noaa/api.h> -#include <gr_sync_block.h> +#include <gnuradio/noaa/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace noaa { @@ -33,7 +33,7 @@ namespace gr { * \brief NOAA HRPT Decoder * \ingroup noaa_blk */ - class NOAA_API hrpt_decoder : virtual public gr_sync_block + class NOAA_API hrpt_decoder : virtual public sync_block { public: // gr::noaa::hrpt_decoder::sptr diff --git a/gr-noaa/include/noaa/hrpt_deframer.h b/gr-noaa/include/gnuradio/noaa/hrpt_deframer.h index 4e319b9054..cafb2334e8 100644 --- a/gr-noaa/include/noaa/hrpt_deframer.h +++ b/gr-noaa/include/gnuradio/noaa/hrpt_deframer.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_NOAA_HRPT_DEFRAMER_H #define INCLUDED_NOAA_HRPT_DEFRAMER_H -#include <noaa/api.h> -#include <gr_block.h> +#include <gnuradio/noaa/api.h> +#include <gnuradio/block.h> namespace gr { namespace noaa { @@ -33,7 +33,7 @@ namespace gr { * \brief NOAA HRPT Deframer * \ingroup noaa_blk */ - class NOAA_API hrpt_deframer : virtual public gr_block + class NOAA_API hrpt_deframer : virtual public block { public: // gr::noaa::hrpt_deframer::sptr diff --git a/gr-noaa/include/noaa/hrpt_pll_cf.h b/gr-noaa/include/gnuradio/noaa/hrpt_pll_cf.h index b9d746b90c..d66663da01 100644 --- a/gr-noaa/include/noaa/hrpt_pll_cf.h +++ b/gr-noaa/include/gnuradio/noaa/hrpt_pll_cf.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_NOAA_HRPT_PLL_CF_H #define INCLUDED_NOAA_HRPT_PLL_CF_H -#include <noaa/api.h> -#include <gr_sync_block.h> +#include <gnuradio/noaa/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace noaa { @@ -33,7 +33,7 @@ namespace gr { * \brief NOAA HRPT PLL * \ingroup noaa_blk */ - class NOAA_API hrpt_pll_cf : virtual public gr_sync_block + class NOAA_API hrpt_pll_cf : virtual public sync_block { public: // gr::noaa::hrpt_pll_cf::sptr diff --git a/gr-noaa/lib/hrpt_decoder_impl.cc b/gr-noaa/lib/hrpt_decoder_impl.cc index 76155ac547..dc7b8f0ec2 100644 --- a/gr-noaa/lib/hrpt_decoder_impl.cc +++ b/gr-noaa/lib/hrpt_decoder_impl.cc @@ -25,8 +25,8 @@ #endif #include "hrpt_decoder_impl.h" -#include <noaa/hrpt.h> -#include <gr_io_signature.h> +#include <gnuradio/noaa/hrpt.h> +#include <gnuradio/io_signature.h> #include <cstdio> namespace gr { @@ -59,9 +59,9 @@ namespace gr { } hrpt_decoder_impl::hrpt_decoder_impl(bool verbose, bool output_files) - : gr_sync_block("noaa_hrpt_decoder", - gr_make_io_signature(1, 1, sizeof(short)), - gr_make_io_signature(0, 0, 0)), + : sync_block("noaa_hrpt_decoder", + io_signature::make(1, 1, sizeof(short)), + io_signature::make(0, 0, 0)), d_verbose(verbose), d_output_files(output_files), d_word_num(0), diff --git a/gr-noaa/lib/hrpt_decoder_impl.h b/gr-noaa/lib/hrpt_decoder_impl.h index e242c48e0c..9a43c98acd 100644 --- a/gr-noaa/lib/hrpt_decoder_impl.h +++ b/gr-noaa/lib/hrpt_decoder_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_NOAA_HRPT_DECODER_IMPL_H #define INCLUDED_NOAA_HRPT_DECODER_IMPL_H -#include <noaa/hrpt_decoder.h> +#include <gnuradio/noaa/hrpt_decoder.h> namespace gr { namespace noaa { diff --git a/gr-noaa/lib/hrpt_deframer_impl.cc b/gr-noaa/lib/hrpt_deframer_impl.cc index cd6d0800db..65bff09adb 100644 --- a/gr-noaa/lib/hrpt_deframer_impl.cc +++ b/gr-noaa/lib/hrpt_deframer_impl.cc @@ -25,8 +25,8 @@ #endif #include "hrpt_deframer_impl.h" -#include <gr_io_signature.h> -#include <noaa/hrpt.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/noaa/hrpt.h> #include <cstring> #include <cstdio> @@ -44,9 +44,9 @@ namespace gr { } hrpt_deframer_impl::hrpt_deframer_impl() - : gr_block("noaa_hrpt_deframer", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(1, 1, sizeof(short))) + : block("noaa_hrpt_deframer", + io_signature::make(1, 1, sizeof(char)), + io_signature::make(1, 1, sizeof(short))) { set_output_multiple(6); // room for writing full sync when received d_mid_bit = true; diff --git a/gr-noaa/lib/hrpt_deframer_impl.h b/gr-noaa/lib/hrpt_deframer_impl.h index 9bad0b87bf..d654f9f606 100644 --- a/gr-noaa/lib/hrpt_deframer_impl.h +++ b/gr-noaa/lib/hrpt_deframer_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_NOAA_HRPT_DEFRAMER_IMPL_H #define INCLUDED_NOAA_HRPT_DEFRAMER_IMPL_H -#include <noaa/hrpt_deframer.h> +#include <gnuradio/noaa/hrpt_deframer.h> namespace gr { namespace noaa { diff --git a/gr-noaa/lib/hrpt_pll_cf_impl.cc b/gr-noaa/lib/hrpt_pll_cf_impl.cc index 17114ef302..fc0d32408d 100644 --- a/gr-noaa/lib/hrpt_pll_cf_impl.cc +++ b/gr-noaa/lib/hrpt_pll_cf_impl.cc @@ -25,9 +25,9 @@ #endif #include "hrpt_pll_cf_impl.h" -#include <gr_io_signature.h> -#include <gr_math.h> -#include <gr_sincos.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/math.h> +#include <gnuradio/sincos.h> namespace gr { namespace noaa { @@ -53,9 +53,9 @@ namespace gr { } hrpt_pll_cf_impl::hrpt_pll_cf_impl(float alpha, float beta, float max_offset) - : gr_sync_block("noaa_hrpt_pll_cf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(float))), + : sync_block("noaa_hrpt_pll_cf", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(float))), d_alpha(alpha), d_beta(beta), d_max_offset(max_offset), d_phase(0.0), d_freq(0.0) { @@ -77,12 +77,12 @@ namespace gr { // Generate and mix out carrier float re, im; - gr_sincosf(d_phase, &im, &re); + gr::sincosf(d_phase, &im, &re); out[i] = (in[i]*gr_complex(re, -im)).imag(); // Adjust PLL phase/frequency - float error = phase_wrap(gr_fast_atan2f(in[i].imag(), in[i].real()) - d_phase); - d_freq = gr_branchless_clip(d_freq + error*d_beta, d_max_offset); + float error = phase_wrap(gr::fast_atan2f(in[i].imag(), in[i].real()) - d_phase); + d_freq = gr::branchless_clip(d_freq + error*d_beta, d_max_offset); d_phase = phase_wrap(d_phase + error*d_alpha + d_freq); } diff --git a/gr-noaa/lib/hrpt_pll_cf_impl.h b/gr-noaa/lib/hrpt_pll_cf_impl.h index cc0c36137e..40b0a21459 100644 --- a/gr-noaa/lib/hrpt_pll_cf_impl.h +++ b/gr-noaa/lib/hrpt_pll_cf_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_NOAA_HRPT_PLL_CF_IMPL_H #define INCLUDED_NOAA_HRPT_PLL_CF_IMPL_H -#include <noaa/hrpt_pll_cf.h> +#include <gnuradio/noaa/hrpt_pll_cf.h> namespace gr { namespace noaa { diff --git a/gr-noaa/swig/CMakeLists.txt b/gr-noaa/swig/CMakeLists.txt index 2bc7c3eb2e..3a6db36103 100644 --- a/gr-noaa/swig/CMakeLists.txt +++ b/gr-noaa/swig/CMakeLists.txt @@ -35,7 +35,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/noaa_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/noaa) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/noaa) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_LIBRARIES gnuradio-noaa) diff --git a/gr-noaa/swig/noaa_swig.i b/gr-noaa/swig/noaa_swig.i index a7d3879369..9fcb83b963 100644 --- a/gr-noaa/swig/noaa_swig.i +++ b/gr-noaa/swig/noaa_swig.i @@ -28,14 +28,14 @@ %include "noaa_swig_doc.i" %{ -#include "noaa/hrpt_decoder.h" -#include "noaa/hrpt_deframer.h" -#include "noaa/hrpt_pll_cf.h" +#include "gnuradio/noaa/hrpt_decoder.h" +#include "gnuradio/noaa/hrpt_deframer.h" +#include "gnuradio/noaa/hrpt_pll_cf.h" %} -%include "noaa/hrpt_decoder.h" -%include "noaa/hrpt_deframer.h" -%include "noaa/hrpt_pll_cf.h" +%include "gnuradio/noaa/hrpt_decoder.h" +%include "gnuradio/noaa/hrpt_deframer.h" +%include "gnuradio/noaa/hrpt_pll_cf.h" GR_SWIG_BLOCK_MAGIC2(noaa, hrpt_decoder); GR_SWIG_BLOCK_MAGIC2(noaa, hrpt_deframer); diff --git a/gr-pager/CMakeLists.txt b/gr-pager/CMakeLists.txt index 48c11d6840..04c7e2c504 100644 --- a/gr-pager/CMakeLists.txt +++ b/gr-pager/CMakeLists.txt @@ -91,7 +91,7 @@ CPACK_COMPONENT("pager_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/pager) +add_subdirectory(include/gnuradio/pager) add_subdirectory(lib) if(ENABLE_PYTHON) add_subdirectory(python) diff --git a/gr-pager/include/pager/CMakeLists.txt b/gr-pager/include/gnuradio/pager/CMakeLists.txt index 6577e7f4e6..6577e7f4e6 100644 --- a/gr-pager/include/pager/CMakeLists.txt +++ b/gr-pager/include/gnuradio/pager/CMakeLists.txt diff --git a/gr-pager/include/pager/api.h b/gr-pager/include/gnuradio/pager/api.h index d14756277f..3d76e6761a 100644 --- a/gr-pager/include/pager/api.h +++ b/gr-pager/include/gnuradio/pager/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_PAGER_API_H #define INCLUDED_PAGER_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_pager_EXPORTS # define PAGER_API __GR_ATTR_EXPORT diff --git a/gr-pager/include/pager/flex_deinterleave.h b/gr-pager/include/gnuradio/pager/flex_deinterleave.h index 75e1ec5f99..2b0c4353d6 100644 --- a/gr-pager/include/pager/flex_deinterleave.h +++ b/gr-pager/include/gnuradio/pager/flex_deinterleave.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_PAGER_FLEX_DEINTERLEAVE_H #define INCLUDED_PAGER_FLEX_DEINTERLEAVE_H -#include <pager/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/pager/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace pager { @@ -33,7 +33,7 @@ namespace gr { * \brief flex deinterleave description * \ingroup pager_blk */ - class PAGER_API flex_deinterleave : virtual public gr_sync_decimator + class PAGER_API flex_deinterleave : virtual public sync_decimator { public: // gr::pager::flex_deinterleave::sptr diff --git a/gr-pager/include/pager/flex_frame.h b/gr-pager/include/gnuradio/pager/flex_frame.h index 7e2dd3e0a6..7245c9a00c 100644 --- a/gr-pager/include/pager/flex_frame.h +++ b/gr-pager/include/gnuradio/pager/flex_frame.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_PAGER_FLEX_FRAME_H #define INCLUDED_PAGER_FLEX_FRAME_H -#include <pager/api.h> +#include <gnuradio/pager/api.h> #include <boost/shared_ptr.hpp> namespace gr { diff --git a/gr-pager/include/pager/flex_parse.h b/gr-pager/include/gnuradio/pager/flex_parse.h index a8cd4c0f5c..42adaff6e0 100644 --- a/gr-pager/include/pager/flex_parse.h +++ b/gr-pager/include/gnuradio/pager/flex_parse.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_PAGER_FLEX_PARSE_H #define INCLUDED_PAGER_FLEX_PARSE_H -#include <pager/api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> +#include <gnuradio/pager/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> #include <sstream> namespace gr { @@ -37,13 +37,13 @@ namespace gr { * \brief flex parse description * \ingroup pager_blk */ - class PAGER_API flex_parse : virtual public gr_sync_block + class PAGER_API flex_parse : virtual public sync_block { public: // gr::pager::flex_parse::sptr typedef boost::shared_ptr<flex_parse> sptr; - static sptr make(gr_msg_queue_sptr queue, float freq); + static sptr make(msg_queue::sptr queue, float freq); }; } /* namespace pager */ diff --git a/gr-pager/include/pager/flex_sync.h b/gr-pager/include/gnuradio/pager/flex_sync.h index fb1c7ca8b2..54c3d827a2 100644 --- a/gr-pager/include/pager/flex_sync.h +++ b/gr-pager/include/gnuradio/pager/flex_sync.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_PAGER_FLEX_SYNC_H #define INCLUDED_PAGER_FLEX_SYNC_H -#include <pager/api.h> -#include <gr_block.h> +#include <gnuradio/pager/api.h> +#include <gnuradio/block.h> namespace gr { namespace pager { @@ -33,7 +33,7 @@ namespace gr { * \brief flex sync description * \ingroup pager_blk */ - class PAGER_API flex_sync : virtual public gr_block + class PAGER_API flex_sync : virtual public block { public: // gr::pager::flex_sync::sptr diff --git a/gr-pager/include/pager/slicer_fb.h b/gr-pager/include/gnuradio/pager/slicer_fb.h index 452c0cbb92..6f01a254c3 100644 --- a/gr-pager/include/pager/slicer_fb.h +++ b/gr-pager/include/gnuradio/pager/slicer_fb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_PAGER_SLICER_FB_H #define INCLUDED_PAGER_SLICER_FB_H -#include <pager/api.h> -#include <gr_sync_block.h> +#include <gnuradio/pager/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace pager { @@ -33,7 +33,7 @@ namespace gr { * \brief slicer description * \ingroup pager_blk */ - class PAGER_API slicer_fb : virtual public gr_sync_block + class PAGER_API slicer_fb : virtual public sync_block { public: // gr::pager::slicer_fb::sptr diff --git a/gr-pager/lib/flex_deinterleave_impl.cc b/gr-pager/lib/flex_deinterleave_impl.cc index 01557c49ed..08ced37119 100644 --- a/gr-pager/lib/flex_deinterleave_impl.cc +++ b/gr-pager/lib/flex_deinterleave_impl.cc @@ -27,7 +27,7 @@ #include "flex_deinterleave_impl.h" #include "bch3221.h" #include "util.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace pager { @@ -40,9 +40,9 @@ namespace gr { } flex_deinterleave_impl::flex_deinterleave_impl() : - gr_sync_decimator("flex_deinterleave", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(int)), 32) + sync_decimator("flex_deinterleave", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(int)), 32) { set_output_multiple(8); // One FLEX block at a time } diff --git a/gr-pager/lib/flex_deinterleave_impl.h b/gr-pager/lib/flex_deinterleave_impl.h index 7cce86b6e9..79aabf4320 100644 --- a/gr-pager/lib/flex_deinterleave_impl.h +++ b/gr-pager/lib/flex_deinterleave_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_PAGER_FLEX_DEINTERLEAVE_IMPL_H #define INCLUDED_PAGER_FLEX_DEINTERLEAVE_IMPL_H -#include <pager/flex_deinterleave.h> -#include <gr_sync_decimator.h> +#include <gnuradio/pager/flex_deinterleave.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace pager { diff --git a/gr-pager/lib/flex_frame_impl.h b/gr-pager/lib/flex_frame_impl.h index 0a6ec80293..e7d1139041 100644 --- a/gr-pager/lib/flex_frame_impl.h +++ b/gr-pager/lib/flex_frame_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_PAGER_FLEX_FRAME_IMPL_H #define INCLUDED_PAGER_FLEX_FRAME_IMPL_H -#include <pager/flex_frame.h> +#include <gnuradio/pager/flex_frame.h> namespace gr { namespace pager { diff --git a/gr-pager/lib/flex_parse_impl.cc b/gr-pager/lib/flex_parse_impl.cc index 8cf0503de7..425b51f026 100644 --- a/gr-pager/lib/flex_parse_impl.cc +++ b/gr-pager/lib/flex_parse_impl.cc @@ -26,7 +26,7 @@ #include "flex_parse_impl.h" #include "bch3221.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <ctype.h> #include <iostream> #include <iomanip> @@ -35,16 +35,16 @@ namespace gr { namespace pager { flex_parse::sptr - flex_parse::make(gr_msg_queue_sptr queue, float freq) + flex_parse::make(msg_queue::sptr queue, float freq) { return gnuradio::get_initial_sptr (new flex_parse_impl(queue, freq)); } - flex_parse_impl::flex_parse_impl(gr_msg_queue_sptr queue, float freq) : - gr_sync_block("flex_parse", - gr_make_io_signature(1, 1, sizeof(gr_int32)), - gr_make_io_signature(0, 0, 0)), + flex_parse_impl::flex_parse_impl(msg_queue::sptr queue, float freq) : + sync_block("flex_parse", + io_signature::make(1, 1, sizeof(gr_int32)), + io_signature::make(0, 0, 0)), d_queue(queue), d_freq(freq) { @@ -159,7 +159,7 @@ namespace gr { else parse_unknown(mw1, mw2); - gr_message_sptr msg = gr_make_message_from_string(std::string(d_payload.str())); + message::sptr msg = message::make_from_string(std::string(d_payload.str())); d_queue->handle(msg); } } diff --git a/gr-pager/lib/flex_parse_impl.h b/gr-pager/lib/flex_parse_impl.h index a4fcf03d42..f2e4236c56 100644 --- a/gr-pager/lib/flex_parse_impl.h +++ b/gr-pager/lib/flex_parse_impl.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_PAGER_FLEX_PARSE_IMPL_H #define INCLUDED_PAGER_FLEX_PARSE_IMPL_H -#include <pager/flex_parse.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> +#include <gnuradio/pager/flex_parse.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> #include "flex_modes.h" #include <sstream> @@ -38,7 +38,7 @@ namespace gr { { private: std::ostringstream d_payload; - gr_msg_queue_sptr d_queue; // Destination for decoded pages + msg_queue::sptr d_queue; // Destination for decoded pages int d_count; // Count of received codewords int d_datawords[88]; // 11 blocks of 8 32-bit words @@ -56,7 +56,7 @@ namespace gr { void parse_unknown(int mw1, int mw2); public: - flex_parse_impl(gr_msg_queue_sptr queue, float freq); + flex_parse_impl(msg_queue::sptr queue, float freq); ~flex_parse_impl(); int work(int noutput_items, diff --git a/gr-pager/lib/flex_sync_impl.cc b/gr-pager/lib/flex_sync_impl.cc index 7701f56f7a..5124155d47 100644 --- a/gr-pager/lib/flex_sync_impl.cc +++ b/gr-pager/lib/flex_sync_impl.cc @@ -28,8 +28,8 @@ #include "flex_modes.h" #include "bch3221.h" #include "util.h" -#include <gr_io_signature.h> -#include <blocks/count_bits.h> +#include <gnuradio/io_signature.h> +#include <gnuradio/blocks/count_bits.h> #include <cstdio> namespace gr { @@ -50,9 +50,9 @@ namespace gr { // get all zeros, which are considered idle code words. flex_sync_impl::flex_sync_impl() : - gr_block("flex_sync", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(4, 4, sizeof(unsigned char))), + block("flex_sync", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(4, 4, sizeof(unsigned char))), d_sync(10) // Fixed at 10 samples per baud (@ 1600 baud) { enter_idle(); diff --git a/gr-pager/lib/flex_sync_impl.h b/gr-pager/lib/flex_sync_impl.h index ba18c147dc..9bc5111e7f 100644 --- a/gr-pager/lib/flex_sync_impl.h +++ b/gr-pager/lib/flex_sync_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_PAGER_FLEX_SYNC_IMPL_H #define INCLUDED_PAGER_FLEX_SYNC_IMPL_H -#include <pager/flex_sync.h> +#include <gnuradio/pager/flex_sync.h> namespace gr { namespace pager { diff --git a/gr-pager/lib/slicer_fb_impl.cc b/gr-pager/lib/slicer_fb_impl.cc index e6c5fcc1d5..7d570ebc70 100644 --- a/gr-pager/lib/slicer_fb_impl.cc +++ b/gr-pager/lib/slicer_fb_impl.cc @@ -25,7 +25,7 @@ #endif #include "slicer_fb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> namespace gr { namespace pager { @@ -38,9 +38,9 @@ namespace gr { } slicer_fb_impl::slicer_fb_impl(float alpha) : - gr_sync_block("slicer_fb", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(unsigned char))) + sync_block("slicer_fb", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(unsigned char))) { d_alpha = alpha; d_beta = 1.0-alpha; diff --git a/gr-pager/lib/slicer_fb_impl.h b/gr-pager/lib/slicer_fb_impl.h index c758a4b160..d2d6ba7d89 100644 --- a/gr-pager/lib/slicer_fb_impl.h +++ b/gr-pager/lib/slicer_fb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_PAGER_SLICER_FB_IMPL_H #define INCLUDED_PAGER_SLICER_FB_IMPL_H -#include <pager/slicer_fb.h> +#include <gnuradio/pager/slicer_fb.h> namespace gr { namespace pager { diff --git a/gr-pager/swig/CMakeLists.txt b/gr-pager/swig/CMakeLists.txt index 076b5387fb..b63c45c15d 100644 --- a/gr-pager/swig/CMakeLists.txt +++ b/gr-pager/swig/CMakeLists.txt @@ -35,7 +35,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/pager_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/pager) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/pager) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_LIBRARIES gnuradio-pager) diff --git a/gr-pager/swig/pager_swig.i b/gr-pager/swig/pager_swig.i index b558d5a6cd..cacd993e9a 100644 --- a/gr-pager/swig/pager_swig.i +++ b/gr-pager/swig/pager_swig.i @@ -27,18 +27,18 @@ %include "pager_swig_doc.i" %{ -#include "pager/flex_frame.h" -#include "pager/slicer_fb.h" -#include "pager/flex_sync.h" -#include "pager/flex_deinterleave.h" -#include "pager/flex_parse.h" +#include "gnuradio/pager/flex_frame.h" +#include "gnuradio/pager/slicer_fb.h" +#include "gnuradio/pager/flex_sync.h" +#include "gnuradio/pager/flex_deinterleave.h" +#include "gnuradio/pager/flex_parse.h" %} -%include "pager/flex_frame.h" -%include "pager/slicer_fb.h" -%include "pager/flex_sync.h" -%include "pager/flex_deinterleave.h" -%include "pager/flex_parse.h" +%include "gnuradio/pager/flex_frame.h" +%include "gnuradio/pager/slicer_fb.h" +%include "gnuradio/pager/flex_sync.h" +%include "gnuradio/pager/flex_deinterleave.h" +%include "gnuradio/pager/flex_parse.h" GR_SWIG_BLOCK_MAGIC2(pager, flex_frame); GR_SWIG_BLOCK_MAGIC2(pager, slicer_fb); diff --git a/gr-qtgui/CMakeLists.txt b/gr-qtgui/CMakeLists.txt index ca3a809b5b..19a31c5f02 100644 --- a/gr-qtgui/CMakeLists.txt +++ b/gr-qtgui/CMakeLists.txt @@ -107,7 +107,7 @@ CPACK_COMPONENT("qtgui_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/qtgui) +add_subdirectory(include/gnuradio/qtgui) add_subdirectory(lib) add_subdirectory(doc) if(ENABLE_PYTHON) diff --git a/gr-qtgui/include/qtgui/CMakeLists.txt b/gr-qtgui/include/gnuradio/qtgui/CMakeLists.txt index 8f95837fec..8f95837fec 100644 --- a/gr-qtgui/include/qtgui/CMakeLists.txt +++ b/gr-qtgui/include/gnuradio/qtgui/CMakeLists.txt diff --git a/gr-qtgui/include/qtgui/ConstellationDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/ConstellationDisplayPlot.h index 041e72d45f..52a74b6d40 100644 --- a/gr-qtgui/include/qtgui/ConstellationDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/ConstellationDisplayPlot.h @@ -26,7 +26,7 @@ #include <stdint.h> #include <cstdio> #include <vector> -#include <qtgui/DisplayPlot.h> +#include <gnuradio/qtgui/DisplayPlot.h> /*! * \brief QWidget for displaying constellaton (I&Q) plots. diff --git a/gr-qtgui/include/qtgui/DisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h index aee9ce5880..bafc712aac 100644 --- a/gr-qtgui/include/qtgui/DisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h @@ -37,7 +37,7 @@ #include <qwt_plot_magnifier.h> #include <qwt_plot_marker.h> #include <qwt_symbol.h> -#include <qtgui/utils.h> +#include <gnuradio/qtgui/utils.h> #if QWT_VERSION >= 0x060000 #include <qwt_compat.h> diff --git a/gr-qtgui/include/qtgui/FrequencyDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h index a835e7de08..220dcd7546 100644 --- a/gr-qtgui/include/qtgui/FrequencyDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h @@ -26,7 +26,7 @@ #include <stdint.h> #include <cstdio> #include <vector> -#include <qtgui/DisplayPlot.h> +#include <gnuradio/qtgui/DisplayPlot.h> /*! * \brief QWidget for displaying frequency domain (PSD) plots. diff --git a/gr-qtgui/include/qtgui/SpectrumGUIClass.h b/gr-qtgui/include/gnuradio/qtgui/SpectrumGUIClass.h index ebe08bdb85..f95ab6477a 100644 --- a/gr-qtgui/include/qtgui/SpectrumGUIClass.h +++ b/gr-qtgui/include/gnuradio/qtgui/SpectrumGUIClass.h @@ -23,15 +23,15 @@ #ifndef SPECTRUM_GUI_CLASS_HPP #define SPECTRUM_GUI_CLASS_HPP -#include <thread/thread.h> +#include <gnuradio/thread/thread.h> #include <qwidget.h> #include <qapplication.h> #include <qlabel.h> #include <qslider.h> -#include <qtgui/spectrumUpdateEvents.h> +#include <gnuradio/qtgui/spectrumUpdateEvents.h> class SpectrumDisplayForm; -#include <qtgui/spectrumdisplayform.h> +#include <gnuradio/qtgui/spectrumdisplayform.h> #include <cmath> diff --git a/gr-qtgui/include/qtgui/TimeDomainDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h index 4f1883a1cf..1ef5ddd85c 100644 --- a/gr-qtgui/include/qtgui/TimeDomainDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h @@ -26,7 +26,7 @@ #include <stdint.h> #include <cstdio> #include <vector> -#include <qtgui/DisplayPlot.h> +#include <gnuradio/qtgui/DisplayPlot.h> /*! * \brief QWidget for displaying time domain plots. diff --git a/gr-qtgui/include/qtgui/TimeRasterDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/TimeRasterDisplayPlot.h index 9d89e0ffa4..f22028c3c9 100644 --- a/gr-qtgui/include/qtgui/TimeRasterDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/TimeRasterDisplayPlot.h @@ -27,13 +27,13 @@ #include <cstdio> #include <vector> #include <qwt_plot_rasteritem.h> -#include <qtgui/DisplayPlot.h> -#include <qtgui/timeRasterGlobalData.h> -#include <qtgui/plot_raster.h> -#include <high_res_timer.h> +#include <gnuradio/qtgui/DisplayPlot.h> +#include <gnuradio/qtgui/timeRasterGlobalData.h> +#include <gnuradio/qtgui/plot_raster.h> +#include <gnuradio/high_res_timer.h> #if QWT_VERSION < 0x060000 -#include <qtgui/plot_waterfall.h> +#include <gnuradio/qtgui/plot_waterfall.h> #else #include <qwt_compat.h> #endif diff --git a/gr-qtgui/include/qtgui/WaterfallDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h index a31c5b9b21..62ea41a87c 100644 --- a/gr-qtgui/include/qtgui/WaterfallDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h @@ -27,12 +27,12 @@ #include <cstdio> #include <vector> #include <qwt_plot_spectrogram.h> -#include <qtgui/DisplayPlot.h> -#include <qtgui/waterfallGlobalData.h> -#include <high_res_timer.h> +#include <gnuradio/qtgui/DisplayPlot.h> +#include <gnuradio/qtgui/waterfallGlobalData.h> +#include <gnuradio/high_res_timer.h> #if QWT_VERSION < 0x060000 -#include <qtgui/plot_waterfall.h> +#include <gnuradio/qtgui/plot_waterfall.h> #else #include <qwt_compat.h> #endif diff --git a/gr-qtgui/include/qtgui/api.h b/gr-qtgui/include/gnuradio/qtgui/api.h index 888dd656c8..0a05544842 100644 --- a/gr-qtgui/include/qtgui/api.h +++ b/gr-qtgui/include/gnuradio/qtgui/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_QTGUI_API_H #define INCLUDED_QTGUI_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_qtgui_EXPORTS # define QTGUI_API __GR_ATTR_EXPORT diff --git a/gr-qtgui/include/qtgui/const_sink_c.h b/gr-qtgui/include/gnuradio/qtgui/const_sink_c.h index ee92d6fe22..d430b6ffdd 100644 --- a/gr-qtgui/include/qtgui/const_sink_c.h +++ b/gr-qtgui/include/gnuradio/qtgui/const_sink_c.h @@ -24,10 +24,10 @@ #define INCLUDED_QTGUI_CONST_SINK_C_H #include <Python.h> -#include <qtgui/api.h> -#include <gr_sync_block.h> +#include <gnuradio/qtgui/api.h> +#include <gnuradio/sync_block.h> #include <qapplication.h> -#include <filter/firdes.h> +#include <gnuradio/filter/firdes.h> namespace gr { namespace qtgui { @@ -41,7 +41,7 @@ namespace gr { * This is a QT-based graphical sink the takes set of a complex * streams and plots them on an IQ constellation plot. */ - class QTGUI_API const_sink_c : virtual public gr_sync_block + class QTGUI_API const_sink_c : virtual public sync_block { public: // gr::qtgui::const_sink_c::sptr diff --git a/gr-qtgui/include/qtgui/constellationdisplayform.h b/gr-qtgui/include/gnuradio/qtgui/constellationdisplayform.h index 48c70beaed..8e04218ed0 100644 --- a/gr-qtgui/include/qtgui/constellationdisplayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/constellationdisplayform.h @@ -23,12 +23,12 @@ #ifndef CONSTELLATION_DISPLAY_FORM_H #define CONSTELLATION_DISPLAY_FORM_H -#include <qtgui/spectrumUpdateEvents.h> -#include <qtgui/ConstellationDisplayPlot.h> +#include <gnuradio/qtgui/spectrumUpdateEvents.h> +#include <gnuradio/qtgui/ConstellationDisplayPlot.h> #include <QtGui/QtGui> #include <vector> -#include <qtgui/displayform.h> +#include <gnuradio/qtgui/displayform.h> /*! * \brief DisplayForm child for managing constellaton (I&Q) plots. diff --git a/gr-qtgui/include/qtgui/displayform.h b/gr-qtgui/include/gnuradio/qtgui/displayform.h index ac7ee9bf8d..df0d5a94d6 100644 --- a/gr-qtgui/include/qtgui/displayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/displayform.h @@ -23,15 +23,15 @@ #ifndef DISPLAY_FORM_H #define DISPLAY_FORM_H -#include <qtgui/spectrumUpdateEvents.h> +#include <gnuradio/qtgui/spectrumUpdateEvents.h> #include <QtGui/QtGui> #include <vector> #include <qwt_plot_grid.h> #include <qwt_plot_layout.h> -#include <qtgui/DisplayPlot.h> -#include <qtgui/form_menus.h> +#include <gnuradio/qtgui/DisplayPlot.h> +#include <gnuradio/qtgui/form_menus.h> /*! * \brief Base class for setting up and managing QTGUI plot forms. diff --git a/gr-qtgui/include/qtgui/form_menus.h b/gr-qtgui/include/gnuradio/qtgui/form_menus.h index 7f5b8ae6e7..1158f337a2 100644 --- a/gr-qtgui/include/qtgui/form_menus.h +++ b/gr-qtgui/include/gnuradio/qtgui/form_menus.h @@ -27,8 +27,8 @@ #include <vector> #include <QtGui/QtGui> #include <qwt_symbol.h> -#include <filter/firdes.h> -#include <qtgui/qtgui_types.h> +#include <gnuradio/filter/firdes.h> +#include <gnuradio/qtgui/qtgui_types.h> class LineColorMenu: public QMenu { diff --git a/gr-qtgui/include/qtgui/freq_sink_c.h b/gr-qtgui/include/gnuradio/qtgui/freq_sink_c.h index c0b053060c..667ee95e18 100644 --- a/gr-qtgui/include/qtgui/freq_sink_c.h +++ b/gr-qtgui/include/gnuradio/qtgui/freq_sink_c.h @@ -24,10 +24,10 @@ #define INCLUDED_QTGUI_FREQ_SINK_C_H #include <Python.h> -#include <qtgui/api.h> -#include <gr_sync_block.h> +#include <gnuradio/qtgui/api.h> +#include <gnuradio/sync_block.h> #include <qapplication.h> -#include <filter/firdes.h> +#include <gnuradio/filter/firdes.h> namespace gr { namespace qtgui { @@ -44,7 +44,7 @@ namespace gr { * functions can be used to change the lable and color for a given * input number. */ - class QTGUI_API freq_sink_c : virtual public gr_sync_block + class QTGUI_API freq_sink_c : virtual public sync_block { public: // gr::qtgui::freq_sink_c::sptr @@ -54,7 +54,7 @@ namespace gr { * \brief Build a complex PSD sink. * * \param fftsize size of the FFT to compute and display - * \param wintype type of window to apply (see filter/firdes.h) + * \param wintype type of window to apply (see gnuradio/filter/firdes.h) * \param fc center frequency of signal (use for x-axis labels) * \param bw bandwidth of signal (used to set x-axis labels) * \param name title for the plot diff --git a/gr-qtgui/include/qtgui/freq_sink_f.h b/gr-qtgui/include/gnuradio/qtgui/freq_sink_f.h index 501c377483..77e9159fe3 100644 --- a/gr-qtgui/include/qtgui/freq_sink_f.h +++ b/gr-qtgui/include/gnuradio/qtgui/freq_sink_f.h @@ -24,10 +24,10 @@ #define INCLUDED_QTGUI_FREQ_SINK_F_H #include <Python.h> -#include <qtgui/api.h> -#include <gr_sync_block.h> +#include <gnuradio/qtgui/api.h> +#include <gnuradio/sync_block.h> #include <qapplication.h> -#include <filter/firdes.h> +#include <gnuradio/filter/firdes.h> namespace gr { namespace qtgui { @@ -44,7 +44,7 @@ namespace gr { * functions can be used to change the lable and color for a given * input number. */ - class QTGUI_API freq_sink_f : virtual public gr_sync_block + class QTGUI_API freq_sink_f : virtual public sync_block { public: // gr::qtgui::freq_sink_f::sptr @@ -54,7 +54,7 @@ namespace gr { * \brief Build a floating point PSD sink. * * \param fftsize size of the FFT to compute and display - * \param wintype type of window to apply (see filter/firdes.h) + * \param wintype type of window to apply (see gnuradio/filter/firdes.h) * \param fc center frequency of signal (use for x-axis labels) * \param bw bandwidth of signal (used to set x-axis labels) * \param name title for the plot diff --git a/gr-qtgui/include/qtgui/freqdisplayform.h b/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h index e54b507993..48dd1a6377 100644 --- a/gr-qtgui/include/qtgui/freqdisplayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h @@ -23,13 +23,13 @@ #ifndef FREQ_DISPLAY_FORM_H #define FREQ_DISPLAY_FORM_H -#include <qtgui/spectrumUpdateEvents.h> -#include <qtgui/FrequencyDisplayPlot.h> +#include <gnuradio/qtgui/spectrumUpdateEvents.h> +#include <gnuradio/qtgui/FrequencyDisplayPlot.h> #include <QtGui/QtGui> #include <vector> -#include <filter/firdes.h> +#include <gnuradio/filter/firdes.h> -#include <qtgui/displayform.h> +#include <gnuradio/qtgui/displayform.h> /*! * \brief DisplayForm child for managing frequency (PSD) plots. diff --git a/gr-qtgui/include/qtgui/plot_raster.h b/gr-qtgui/include/gnuradio/qtgui/plot_raster.h index 2a5159e00e..6352e9f0db 100644 --- a/gr-qtgui/include/qtgui/plot_raster.h +++ b/gr-qtgui/include/gnuradio/qtgui/plot_raster.h @@ -24,7 +24,7 @@ #define PLOT_TIMERASTER_H #include <qglobal.h> -#include <qtgui/timeRasterGlobalData.h> +#include <gnuradio/qtgui/timeRasterGlobalData.h> #include <qwt_plot_rasteritem.h> #if QWT_VERSION >= 0x060000 diff --git a/gr-qtgui/include/qtgui/plot_waterfall.h b/gr-qtgui/include/gnuradio/qtgui/plot_waterfall.h index ed8edbbd0c..bd550ec676 100644 --- a/gr-qtgui/include/qtgui/plot_waterfall.h +++ b/gr-qtgui/include/gnuradio/qtgui/plot_waterfall.h @@ -24,7 +24,7 @@ #define PLOT_WATERFALL_H #include <qglobal.h> -#include <qtgui/waterfallGlobalData.h> +#include <gnuradio/qtgui/waterfallGlobalData.h> #include <qwt_plot_rasteritem.h> #if QWT_VERSION >= 0x060000 diff --git a/gr-qtgui/include/qtgui/qtgui_types.h b/gr-qtgui/include/gnuradio/qtgui/qtgui_types.h index 135350dbb8..f71ab9eda3 100644 --- a/gr-qtgui/include/qtgui/qtgui_types.h +++ b/gr-qtgui/include/gnuradio/qtgui/qtgui_types.h @@ -25,7 +25,7 @@ #include <qwt_color_map.h> #include <qwt_scale_draw.h> -#include <high_res_timer.h> +#include <gnuradio/high_res_timer.h> class FreqOffsetAndPrecisionClass { diff --git a/gr-qtgui/include/qtgui/sink_c.h b/gr-qtgui/include/gnuradio/qtgui/sink_c.h index 8d8a1e97ab..9b30e74c95 100644 --- a/gr-qtgui/include/qtgui/sink_c.h +++ b/gr-qtgui/include/gnuradio/qtgui/sink_c.h @@ -24,8 +24,8 @@ #define INCLUDED_QTGUI_SINK_C_H #include <Python.h> -#include <qtgui/api.h> -#include <gr_block.h> +#include <gnuradio/qtgui/api.h> +#include <gnuradio/block.h> #include <qapplication.h> #include <qwt_symbol.h> @@ -46,7 +46,7 @@ namespace gr { * appropriate boolean value in the constructor to False. */ - class QTGUI_API sink_c : virtual public gr_block + class QTGUI_API sink_c : virtual public block { public: // gr::qtgui::sink_c::sptr @@ -56,7 +56,7 @@ namespace gr { * \brief Build a complex qtgui sink. * * \param fftsize size of the FFT to compute and display - * \param wintype type of window to apply (see filter/firdes.h) + * \param wintype type of window to apply (see gnuradio/filter/firdes.h) * \param fc center frequency of signal (use for x-axis labels) * \param bw bandwidth of signal (used to set x-axis labels) * \param name title for the plot diff --git a/gr-qtgui/include/qtgui/sink_f.h b/gr-qtgui/include/gnuradio/qtgui/sink_f.h index 6a7783db50..99e499421b 100644 --- a/gr-qtgui/include/qtgui/sink_f.h +++ b/gr-qtgui/include/gnuradio/qtgui/sink_f.h @@ -24,8 +24,8 @@ #define INCLUDED_QTGUI_SINK_F_H #include <Python.h> -#include <qtgui/api.h> -#include <gr_block.h> +#include <gnuradio/qtgui/api.h> +#include <gnuradio/block.h> #include <qapplication.h> #include <qwt_symbol.h> @@ -46,7 +46,7 @@ namespace gr { * constructor to False. */ - class QTGUI_API sink_f : virtual public gr_block + class QTGUI_API sink_f : virtual public block { public: // gr::qtgui::sink_f::sptr @@ -56,7 +56,7 @@ namespace gr { * \brief Build a floating point qtgui sink. * * \param fftsize size of the FFT to compute and display - * \param wintype type of window to apply (see filter/firdes.h) + * \param wintype type of window to apply (see gnuradio/filter/firdes.h) * \param fc center frequency of signal (use for x-axis labels) * \param bw bandwidth of signal (used to set x-axis labels) * \param name title for the plot diff --git a/gr-qtgui/include/qtgui/spectrumUpdateEvents.h b/gr-qtgui/include/gnuradio/qtgui/spectrumUpdateEvents.h index df61f7fdb2..361610d095 100644 --- a/gr-qtgui/include/qtgui/spectrumUpdateEvents.h +++ b/gr-qtgui/include/gnuradio/qtgui/spectrumUpdateEvents.h @@ -28,7 +28,7 @@ #include <QString> #include <complex> #include <vector> -#include <high_res_timer.h> +#include <gnuradio/high_res_timer.h> static const int SpectrumUpdateEventType = 10005; static const int SpectrumWindowCaptionEventType = 10008; diff --git a/gr-qtgui/include/qtgui/spectrumdisplayform.h b/gr-qtgui/include/gnuradio/qtgui/spectrumdisplayform.h index 37a481245c..6b43661cb4 100644 --- a/gr-qtgui/include/qtgui/spectrumdisplayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/spectrumdisplayform.h @@ -26,13 +26,13 @@ #include <spectrumdisplayform.ui.h> class SpectrumGUIClass; -#include <qtgui/SpectrumGUIClass.h> +#include <gnuradio/qtgui/SpectrumGUIClass.h> -#include <qtgui/SpectrumGUIClass.h> -#include <qtgui/FrequencyDisplayPlot.h> -#include <qtgui/WaterfallDisplayPlot.h> -#include <qtgui/TimeDomainDisplayPlot.h> -#include <qtgui/ConstellationDisplayPlot.h> +#include <gnuradio/qtgui/SpectrumGUIClass.h> +#include <gnuradio/qtgui/FrequencyDisplayPlot.h> +#include <gnuradio/qtgui/WaterfallDisplayPlot.h> +#include <gnuradio/qtgui/TimeDomainDisplayPlot.h> +#include <gnuradio/qtgui/ConstellationDisplayPlot.h> #include <QValidator> #include <QTimer> #include <vector> diff --git a/gr-qtgui/include/qtgui/timeRasterGlobalData.h b/gr-qtgui/include/gnuradio/qtgui/timeRasterGlobalData.h index 0a414432d1..0a414432d1 100644 --- a/gr-qtgui/include/qtgui/timeRasterGlobalData.h +++ b/gr-qtgui/include/gnuradio/qtgui/timeRasterGlobalData.h diff --git a/gr-qtgui/include/qtgui/time_raster_sink_b.h b/gr-qtgui/include/gnuradio/qtgui/time_raster_sink_b.h index 083a6a2d24..22130e56aa 100644 --- a/gr-qtgui/include/qtgui/time_raster_sink_b.h +++ b/gr-qtgui/include/gnuradio/qtgui/time_raster_sink_b.h @@ -24,8 +24,8 @@ #define INCLUDED_QTGUI_TIME_RASTER_SINK_B_H #include <Python.h> -#include <qtgui/api.h> -#include <gr_sync_block.h> +#include <gnuradio/qtgui/api.h> +#include <gnuradio/sync_block.h> #include <qapplication.h> #include <qwt_symbol.h> @@ -46,7 +46,7 @@ namespace gr { * byte). It will display packed bytes but the display will have * to be autoscaled. */ - class QTGUI_API time_raster_sink_b : virtual public gr_sync_block + class QTGUI_API time_raster_sink_b : virtual public sync_block { public: // gr::qtgui::time_raster_sink_b::sptr diff --git a/gr-qtgui/include/qtgui/time_raster_sink_f.h b/gr-qtgui/include/gnuradio/qtgui/time_raster_sink_f.h index 07deb25fc0..5a82587074 100644 --- a/gr-qtgui/include/qtgui/time_raster_sink_f.h +++ b/gr-qtgui/include/gnuradio/qtgui/time_raster_sink_f.h @@ -24,8 +24,8 @@ #define INCLUDED_QTGUI_TIME_RASTER_SINK_F_H #include <Python.h> -#include <qtgui/api.h> -#include <gr_sync_block.h> +#include <gnuradio/qtgui/api.h> +#include <gnuradio/sync_block.h> #include <qapplication.h> #include <qwt_symbol.h> @@ -43,7 +43,7 @@ namespace gr { * point streams and plots a time_raster (spectrogram) plot. * */ - class QTGUI_API time_raster_sink_f : virtual public gr_sync_block + class QTGUI_API time_raster_sink_f : virtual public sync_block { public: // gr::qtgui::time_raster_sink_f::sptr diff --git a/gr-qtgui/include/qtgui/time_sink_c.h b/gr-qtgui/include/gnuradio/qtgui/time_sink_c.h index d3234b94bb..8563cf5cd1 100644 --- a/gr-qtgui/include/qtgui/time_sink_c.h +++ b/gr-qtgui/include/gnuradio/qtgui/time_sink_c.h @@ -24,8 +24,8 @@ #define INCLUDED_QTGUI_TIME_SINK_C_H #include <Python.h> -#include <qtgui/api.h> -#include <gr_sync_block.h> +#include <gnuradio/qtgui/api.h> +#include <gnuradio/sync_block.h> #include <qapplication.h> namespace gr { @@ -44,7 +44,7 @@ namespace gr { * functions can be used to change the lable and color for a given * input number. */ - class QTGUI_API time_sink_c : virtual public gr_sync_block + class QTGUI_API time_sink_c : virtual public sync_block { public: // gr::qtgui::time_sink_c::sptr diff --git a/gr-qtgui/include/qtgui/time_sink_f.h b/gr-qtgui/include/gnuradio/qtgui/time_sink_f.h index cf0df05337..f9457f7a72 100644 --- a/gr-qtgui/include/qtgui/time_sink_f.h +++ b/gr-qtgui/include/gnuradio/qtgui/time_sink_f.h @@ -24,8 +24,8 @@ #define INCLUDED_QTGUI_TIME_SINK_F_H #include <Python.h> -#include <qtgui/api.h> -#include <gr_sync_block.h> +#include <gnuradio/qtgui/api.h> +#include <gnuradio/sync_block.h> #include <qapplication.h> namespace gr { @@ -42,7 +42,7 @@ namespace gr { * different color, and the \a set_title and \a set_color functions * can be used to change the lable and color for a given input number. */ - class QTGUI_API time_sink_f : virtual public gr_sync_block + class QTGUI_API time_sink_f : virtual public sync_block { public: // gr::qtgui::time_sink_f::sptr diff --git a/gr-qtgui/include/qtgui/timedisplayform.h b/gr-qtgui/include/gnuradio/qtgui/timedisplayform.h index 4e216abb0c..07118a4baa 100644 --- a/gr-qtgui/include/qtgui/timedisplayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/timedisplayform.h @@ -23,12 +23,12 @@ #ifndef TIME_DISPLAY_FORM_H #define TIME_DISPLAY_FORM_H -#include <qtgui/spectrumUpdateEvents.h> -#include <qtgui/TimeDomainDisplayPlot.h> +#include <gnuradio/qtgui/spectrumUpdateEvents.h> +#include <gnuradio/qtgui/TimeDomainDisplayPlot.h> #include <QtGui/QtGui> #include <vector> -#include <qtgui/displayform.h> +#include <gnuradio/qtgui/displayform.h> /*! * \brief DisplayForm child for managing time domain plots. diff --git a/gr-qtgui/include/qtgui/timerasterdisplayform.h b/gr-qtgui/include/gnuradio/qtgui/timerasterdisplayform.h index 7d6af9f5dd..24933c3c05 100644 --- a/gr-qtgui/include/qtgui/timerasterdisplayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/timerasterdisplayform.h @@ -23,13 +23,13 @@ #ifndef TIMERASTER_DISPLAY_FORM_H #define TIMERASTER_DISPLAY_FORM_H -#include <qtgui/spectrumUpdateEvents.h> -#include <qtgui/TimeRasterDisplayPlot.h> +#include <gnuradio/qtgui/spectrumUpdateEvents.h> +#include <gnuradio/qtgui/TimeRasterDisplayPlot.h> #include <QtGui/QtGui> #include <vector> -#include <filter/firdes.h> +#include <gnuradio/filter/firdes.h> -#include <qtgui/displayform.h> +#include <gnuradio/qtgui/displayform.h> /*! * \brief DisplayForm child for managing time raster plots. diff --git a/gr-qtgui/include/qtgui/utils.h b/gr-qtgui/include/gnuradio/qtgui/utils.h index f490c48567..c4271288fa 100644 --- a/gr-qtgui/include/qtgui/utils.h +++ b/gr-qtgui/include/gnuradio/qtgui/utils.h @@ -24,7 +24,7 @@ #define INCLUDED_QTGUI_UTILS_H #include <qevent.h> -#include <qtgui/api.h> +#include <gnuradio/qtgui/api.h> #include <qwt_plot_picker.h> #include <qwt_picker_machine.h> diff --git a/gr-qtgui/include/qtgui/waterfallGlobalData.h b/gr-qtgui/include/gnuradio/qtgui/waterfallGlobalData.h index 8ab9590d0b..8ab9590d0b 100644 --- a/gr-qtgui/include/qtgui/waterfallGlobalData.h +++ b/gr-qtgui/include/gnuradio/qtgui/waterfallGlobalData.h diff --git a/gr-qtgui/include/qtgui/waterfall_sink_c.h b/gr-qtgui/include/gnuradio/qtgui/waterfall_sink_c.h index 060c0f14b6..74b94bb4b4 100644 --- a/gr-qtgui/include/qtgui/waterfall_sink_c.h +++ b/gr-qtgui/include/gnuradio/qtgui/waterfall_sink_c.h @@ -24,10 +24,10 @@ #define INCLUDED_QTGUI_WATERFALL_SINK_C_H #include <Python.h> -#include <qtgui/api.h> -#include <gr_sync_block.h> +#include <gnuradio/qtgui/api.h> +#include <gnuradio/sync_block.h> #include <qapplication.h> -#include <filter/firdes.h> +#include <gnuradio/filter/firdes.h> namespace gr { namespace qtgui { @@ -50,7 +50,7 @@ namespace gr { * here, it's probably best to sum the signals together and * connect that here. */ - class QTGUI_API waterfall_sink_c : virtual public gr_sync_block + class QTGUI_API waterfall_sink_c : virtual public sync_block { public: // gr::qtgui::waterfall_sink_c::sptr @@ -61,7 +61,7 @@ namespace gr { * \brief Build a complex waterfall sink. * * \param size size of the FFT to compute and display - * \param wintype type of window to apply (see filter/firdes.h) + * \param wintype type of window to apply (see gnuradio/filter/firdes.h) * \param fc center frequency of signal (use for x-axis labels) * \param bw bandwidth of signal (used to set x-axis labels) * \param name title for the plot diff --git a/gr-qtgui/include/qtgui/waterfall_sink_f.h b/gr-qtgui/include/gnuradio/qtgui/waterfall_sink_f.h index a550d3d2d2..8b6fce2651 100644 --- a/gr-qtgui/include/qtgui/waterfall_sink_f.h +++ b/gr-qtgui/include/gnuradio/qtgui/waterfall_sink_f.h @@ -24,10 +24,10 @@ #define INCLUDED_QTGUI_WATERFALL_SINK_F_H #include <Python.h> -#include <qtgui/api.h> -#include <gr_sync_block.h> +#include <gnuradio/qtgui/api.h> +#include <gnuradio/sync_block.h> #include <qapplication.h> -#include <filter/firdes.h> +#include <gnuradio/filter/firdes.h> namespace gr { namespace qtgui { @@ -50,7 +50,7 @@ namespace gr { * here, it's probably best to sum the signals together and * connect that here. */ - class QTGUI_API waterfall_sink_f : virtual public gr_sync_block + class QTGUI_API waterfall_sink_f : virtual public sync_block { public: // gr::qtgui::waterfall_sink_f::sptr @@ -60,7 +60,7 @@ namespace gr { * \brief Build a floating point waterfall sink. * * \param size size of the FFT to compute and display - * \param wintype type of window to apply (see filter/firdes.h) + * \param wintype type of window to apply (see gnuradio/filter/firdes.h) * \param fc center frequency of signal (use for x-axis labels) * \param bw bandwidth of signal (used to set x-axis labels) * \param name title for the plot diff --git a/gr-qtgui/include/qtgui/waterfalldisplayform.h b/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h index 00e678bd0c..8d78bb015a 100644 --- a/gr-qtgui/include/qtgui/waterfalldisplayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h @@ -23,13 +23,13 @@ #ifndef WATERFALL_DISPLAY_FORM_H #define WATERFALL_DISPLAY_FORM_H -#include <qtgui/spectrumUpdateEvents.h> -#include <qtgui/WaterfallDisplayPlot.h> +#include <gnuradio/qtgui/spectrumUpdateEvents.h> +#include <gnuradio/qtgui/WaterfallDisplayPlot.h> #include <QtGui/QtGui> #include <vector> -#include <filter/firdes.h> +#include <gnuradio/filter/firdes.h> -#include <qtgui/displayform.h> +#include <gnuradio/qtgui/displayform.h> /*! * \brief DisplayForm child for managing waterfall (spectrogram) plots. diff --git a/gr-qtgui/lib/CMakeLists.txt b/gr-qtgui/lib/CMakeLists.txt index 7114c6c390..2df8b31555 100644 --- a/gr-qtgui/lib/CMakeLists.txt +++ b/gr-qtgui/lib/CMakeLists.txt @@ -20,7 +20,7 @@ ######################################################################## # Setup the QT file generations stuff ######################################################################## -set(qtgui_mod_includedir ${CMAKE_CURRENT_SOURCE_DIR}/../include/qtgui) +set(qtgui_mod_includedir ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/qtgui) set(qtgui_moc_hdrs ${qtgui_mod_includedir}/spectrumdisplayform.h ${qtgui_mod_includedir}/displayform.h diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc index 7e2f11e6d6..f483867776 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc @@ -23,7 +23,7 @@ #ifndef CONSTELLATION_DISPLAY_PLOT_C #define CONSTELLATION_DISPLAY_PLOT_C -#include <qtgui/ConstellationDisplayPlot.h> +#include <gnuradio/qtgui/ConstellationDisplayPlot.h> #include <qwt_scale_draw.h> #include <qwt_legend.h> diff --git a/gr-qtgui/lib/DisplayPlot.cc b/gr-qtgui/lib/DisplayPlot.cc index 227cf9cc9e..3fe16f68bd 100644 --- a/gr-qtgui/lib/DisplayPlot.cc +++ b/gr-qtgui/lib/DisplayPlot.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <qtgui/DisplayPlot.h> +#include <gnuradio/qtgui/DisplayPlot.h> #include <qwt_scale_draw.h> #include <qwt_legend.h> diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc index 56e63100c7..087a176d5e 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc @@ -23,9 +23,9 @@ #ifndef FREQUENCY_DISPLAY_PLOT_C #define FREQUENCY_DISPLAY_PLOT_C -#include <qtgui/FrequencyDisplayPlot.h> +#include <gnuradio/qtgui/FrequencyDisplayPlot.h> -#include <qtgui/qtgui_types.h> +#include <gnuradio/qtgui/qtgui_types.h> #include <qwt_scale_draw.h> #include <qwt_legend.h> #include <qwt_legend_item.h> diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc index 020cd8218a..c0c78dad14 100644 --- a/gr-qtgui/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/lib/SpectrumGUIClass.cc @@ -23,7 +23,7 @@ #ifndef SPECTRUM_GUI_CLASS_CPP #define SPECTRUM_GUI_CLASS_CPP -#include <qtgui/SpectrumGUIClass.h> +#include <gnuradio/qtgui/SpectrumGUIClass.h> //Added by qt3to4: #include <QEvent> #include <QCustomEvent> diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc index 13e24c2a97..a7e6a821bc 100644 --- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc @@ -23,7 +23,7 @@ #ifndef TIME_DOMAIN_DISPLAY_PLOT_C #define TIME_DOMAIN_DISPLAY_PLOT_C -#include <qtgui/TimeDomainDisplayPlot.h> +#include <gnuradio/qtgui/TimeDomainDisplayPlot.h> #include <qwt_scale_draw.h> #include <qwt_legend.h> diff --git a/gr-qtgui/lib/TimeRasterDisplayPlot.cc b/gr-qtgui/lib/TimeRasterDisplayPlot.cc index 66b38c52f2..89e32cab9c 100644 --- a/gr-qtgui/lib/TimeRasterDisplayPlot.cc +++ b/gr-qtgui/lib/TimeRasterDisplayPlot.cc @@ -23,9 +23,9 @@ #ifndef TIMERASTER_DISPLAY_PLOT_C #define TIMERASTER_DISPLAY_PLOT_C -#include <qtgui/TimeRasterDisplayPlot.h> +#include <gnuradio/qtgui/TimeRasterDisplayPlot.h> -#include <qtgui/qtgui_types.h> +#include <gnuradio/qtgui/qtgui_types.h> #include <qwt_color_map.h> #include <qwt_scale_draw.h> #include <qwt_legend.h> diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc index aa78000741..0e38808b94 100644 --- a/gr-qtgui/lib/WaterfallDisplayPlot.cc +++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc @@ -23,9 +23,9 @@ #ifndef WATERFALL_DISPLAY_PLOT_C #define WATERFALL_DISPLAY_PLOT_C -#include <qtgui/WaterfallDisplayPlot.h> +#include <gnuradio/qtgui/WaterfallDisplayPlot.h> -#include <qtgui/qtgui_types.h> +#include <gnuradio/qtgui/qtgui_types.h> #include <qwt_color_map.h> #include <qwt_scale_draw.h> #include <qwt_legend.h> diff --git a/gr-qtgui/lib/const_sink_c_impl.cc b/gr-qtgui/lib/const_sink_c_impl.cc index 9064be4ebe..33e0cc5a22 100644 --- a/gr-qtgui/lib/const_sink_c_impl.cc +++ b/gr-qtgui/lib/const_sink_c_impl.cc @@ -25,10 +25,10 @@ #endif #include "const_sink_c_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <volk/volk.h> -#include <fft/fft.h> +#include <gnuradio/fft/fft.h> #include <qwt_symbol.h> namespace gr { @@ -48,9 +48,9 @@ namespace gr { const std::string &name, int nconnections, QWidget *parent) - : gr_sync_block("const_sink_c", - gr_make_io_signature(nconnections, nconnections, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), + : sync_block("const_sink_c", + io_signature::make(nconnections, nconnections, sizeof(gr_complex)), + io_signature::make(0, 0, 0)), d_size(size), d_name(name), d_nconnections(nconnections), d_parent(parent) { diff --git a/gr-qtgui/lib/const_sink_c_impl.h b/gr-qtgui/lib/const_sink_c_impl.h index 02b25409e6..fb9481fb15 100644 --- a/gr-qtgui/lib/const_sink_c_impl.h +++ b/gr-qtgui/lib/const_sink_c_impl.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_QTGUI_CONST_SINK_C_IMPL_H #define INCLUDED_QTGUI_CONST_SINK_C_IMPL_H -#include <qtgui/const_sink_c.h> -#include <high_res_timer.h> -#include <thread/thread.h> -#include <qtgui/constellationdisplayform.h> +#include <gnuradio/qtgui/const_sink_c.h> +#include <gnuradio/high_res_timer.h> +#include <gnuradio/thread/thread.h> +#include <gnuradio/qtgui/constellationdisplayform.h> namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/constellationdisplayform.cc b/gr-qtgui/lib/constellationdisplayform.cc index bfd17b9c11..52691ee67a 100644 --- a/gr-qtgui/lib/constellationdisplayform.cc +++ b/gr-qtgui/lib/constellationdisplayform.cc @@ -22,7 +22,7 @@ #include <cmath> #include <QMessageBox> -#include <qtgui/constellationdisplayform.h> +#include <gnuradio/qtgui/constellationdisplayform.h> #include <iostream> ConstellationDisplayForm::ConstellationDisplayForm(int nplots, QWidget* parent) diff --git a/gr-qtgui/lib/displayform.cc b/gr-qtgui/lib/displayform.cc index 3439db31ee..ecc878b0a8 100644 --- a/gr-qtgui/lib/displayform.cc +++ b/gr-qtgui/lib/displayform.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <qtgui/displayform.h> +#include <gnuradio/qtgui/displayform.h> #include <iostream> #include <QPixmap> #include <QFileDialog> diff --git a/gr-qtgui/lib/freq_sink_c_impl.cc b/gr-qtgui/lib/freq_sink_c_impl.cc index 4508750457..b0646904cf 100644 --- a/gr-qtgui/lib/freq_sink_c_impl.cc +++ b/gr-qtgui/lib/freq_sink_c_impl.cc @@ -25,7 +25,7 @@ #endif #include "freq_sink_c_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <volk/volk.h> #include <qwt_symbol.h> @@ -52,9 +52,9 @@ namespace gr { const std::string &name, int nconnections, QWidget *parent) - : gr_sync_block("freq_sink_c", - gr_make_io_signature(1, -1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), + : sync_block("freq_sink_c", + io_signature::make(1, -1, sizeof(gr_complex)), + io_signature::make(0, 0, 0)), d_fftsize(fftsize), d_fftavg(1.0), d_wintype((filter::firdes::win_type)(wintype)), d_center_freq(fc), d_bandwidth(bw), d_name(name), diff --git a/gr-qtgui/lib/freq_sink_c_impl.h b/gr-qtgui/lib/freq_sink_c_impl.h index ef17079567..06ae4f80f3 100644 --- a/gr-qtgui/lib/freq_sink_c_impl.h +++ b/gr-qtgui/lib/freq_sink_c_impl.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_QTGUI_FREQ_SINK_C_IMPL_H #define INCLUDED_QTGUI_FREQ_SINK_C_IMPL_H -#include <qtgui/freq_sink_c.h> -#include <filter/firdes.h> -#include <fft/fft.h> -#include <high_res_timer.h> -#include <thread/thread.h> -#include <qtgui/freqdisplayform.h> +#include <gnuradio/qtgui/freq_sink_c.h> +#include <gnuradio/filter/firdes.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/high_res_timer.h> +#include <gnuradio/thread/thread.h> +#include <gnuradio/qtgui/freqdisplayform.h> namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/freq_sink_f_impl.cc b/gr-qtgui/lib/freq_sink_f_impl.cc index 6028c8ec4e..2f9f1956f3 100644 --- a/gr-qtgui/lib/freq_sink_f_impl.cc +++ b/gr-qtgui/lib/freq_sink_f_impl.cc @@ -25,7 +25,7 @@ #endif #include "freq_sink_f_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <volk/volk.h> #include <qwt_symbol.h> @@ -52,9 +52,9 @@ namespace gr { const std::string &name, int nconnections, QWidget *parent) - : gr_sync_block("freq_sink_f", - gr_make_io_signature(1, -1, sizeof(float)), - gr_make_io_signature(0, 0, 0)), + : sync_block("freq_sink_f", + io_signature::make(1, -1, sizeof(float)), + io_signature::make(0, 0, 0)), d_fftsize(fftsize), d_fftavg(1.0), d_wintype((filter::firdes::win_type)(wintype)), d_center_freq(fc), d_bandwidth(bw), d_name(name), diff --git a/gr-qtgui/lib/freq_sink_f_impl.h b/gr-qtgui/lib/freq_sink_f_impl.h index 6f4d9d2062..a5bdc3c076 100644 --- a/gr-qtgui/lib/freq_sink_f_impl.h +++ b/gr-qtgui/lib/freq_sink_f_impl.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_QTGUI_FREQ_SINK_F_IMPL_H #define INCLUDED_QTGUI_FREQ_SINK_F_IMPL_H -#include <qtgui/freq_sink_f.h> -#include <filter/firdes.h> -#include <fft/fft.h> -#include <high_res_timer.h> -#include <thread/thread.h> -#include <qtgui/freqdisplayform.h> +#include <gnuradio/qtgui/freq_sink_f.h> +#include <gnuradio/filter/firdes.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/high_res_timer.h> +#include <gnuradio/thread/thread.h> +#include <gnuradio/qtgui/freqdisplayform.h> namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/freqdisplayform.cc b/gr-qtgui/lib/freqdisplayform.cc index adcc09dc4b..948d845895 100644 --- a/gr-qtgui/lib/freqdisplayform.cc +++ b/gr-qtgui/lib/freqdisplayform.cc @@ -22,7 +22,7 @@ #include <cmath> #include <QMessageBox> -#include <qtgui/freqdisplayform.h> +#include <gnuradio/qtgui/freqdisplayform.h> #include <iostream> FreqDisplayForm::FreqDisplayForm(int nplots, QWidget* parent) diff --git a/gr-qtgui/lib/plot_raster.cc b/gr-qtgui/lib/plot_raster.cc index 6d31a2596c..62eac5e13f 100644 --- a/gr-qtgui/lib/plot_raster.cc +++ b/gr-qtgui/lib/plot_raster.cc @@ -27,7 +27,7 @@ #include "qwt_painter.h" #include "qwt_scale_map.h" #include "qwt_color_map.h" -#include <qtgui/plot_raster.h> +#include <gnuradio/qtgui/plot_raster.h> #if QWT_VERSION < 0x060000 #include "qwt_double_interval.h" diff --git a/gr-qtgui/lib/plot_waterfall.cc b/gr-qtgui/lib/plot_waterfall.cc index 5a378767be..b96d573e3d 100644 --- a/gr-qtgui/lib/plot_waterfall.cc +++ b/gr-qtgui/lib/plot_waterfall.cc @@ -26,7 +26,7 @@ #include "qwt_painter.h" #include "qwt_scale_map.h" #include "qwt_color_map.h" -#include <qtgui/plot_waterfall.h> +#include <gnuradio/qtgui/plot_waterfall.h> #if QWT_VERSION < 0x060000 #include "qwt_double_interval.h" diff --git a/gr-qtgui/lib/qtgui_util.cc b/gr-qtgui/lib/qtgui_util.cc index 70dcb483fb..539f7bac8f 100644 --- a/gr-qtgui/lib/qtgui_util.cc +++ b/gr-qtgui/lib/qtgui_util.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <qtgui/utils.h> +#include <gnuradio/qtgui/utils.h> #include <QDebug> QwtPickerDblClickPointMachine::QwtPickerDblClickPointMachine() diff --git a/gr-qtgui/lib/sink_c_impl.cc b/gr-qtgui/lib/sink_c_impl.cc index aab5be54bf..b33853482d 100644 --- a/gr-qtgui/lib/sink_c_impl.cc +++ b/gr-qtgui/lib/sink_c_impl.cc @@ -25,7 +25,7 @@ #endif #include "sink_c_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <volk/volk.h> @@ -54,9 +54,9 @@ namespace gr { bool plotfreq, bool plotwaterfall, bool plottime, bool plotconst, QWidget *parent) - : gr_block("sink_c", - gr_make_io_signature(1, -1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), + : block("sink_c", + io_signature::make(1, -1, sizeof(gr_complex)), + io_signature::make(0, 0, 0)), d_fftsize(fftsize), d_wintype((filter::firdes::win_type)(wintype)), d_center_freq(fc), d_bandwidth(bw), d_name(name), diff --git a/gr-qtgui/lib/sink_c_impl.h b/gr-qtgui/lib/sink_c_impl.h index 77ddf79a0e..ce4bbac11b 100644 --- a/gr-qtgui/lib/sink_c_impl.h +++ b/gr-qtgui/lib/sink_c_impl.h @@ -23,11 +23,11 @@ #ifndef INCLUDED_QTGUI_SINK_C_IMPL_H #define INCLUDED_QTGUI_SINK_C_IMPL_H -#include <qtgui/sink_c.h> -#include <filter/firdes.h> -#include <fft/fft.h> -#include <high_res_timer.h> -#include <qtgui/SpectrumGUIClass.h> +#include <gnuradio/qtgui/sink_c.h> +#include <gnuradio/filter/firdes.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/high_res_timer.h> +#include <gnuradio/qtgui/SpectrumGUIClass.h> namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/sink_f_impl.cc b/gr-qtgui/lib/sink_f_impl.cc index 1fb2bbdbb7..679593b1ad 100644 --- a/gr-qtgui/lib/sink_f_impl.cc +++ b/gr-qtgui/lib/sink_f_impl.cc @@ -25,7 +25,7 @@ #endif #include "sink_f_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <volk/volk.h> @@ -54,9 +54,9 @@ namespace gr { bool plotfreq, bool plotwaterfall, bool plottime, bool plotconst, QWidget *parent) - : gr_block("sink_f", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature (0, 0, 0)), + : block("sink_f", + io_signature::make(1, 1, sizeof(float)), + io_signature::make (0, 0, 0)), d_fftsize(fftsize), d_wintype((filter::firdes::win_type)(wintype)), d_center_freq(fc), d_bandwidth(bw), d_name(name), diff --git a/gr-qtgui/lib/sink_f_impl.h b/gr-qtgui/lib/sink_f_impl.h index 24dff8d6b3..c6b4ec3cb5 100644 --- a/gr-qtgui/lib/sink_f_impl.h +++ b/gr-qtgui/lib/sink_f_impl.h @@ -23,11 +23,11 @@ #ifndef INCLUDED_QTGUI_SINK_F_IMPL_H #define INCLUDED_QTGUI_SINK_F_IMPL_H -#include <qtgui/sink_f.h> -#include <filter/firdes.h> -#include <fft/fft.h> -#include <high_res_timer.h> -#include <qtgui/SpectrumGUIClass.h> +#include <gnuradio/qtgui/sink_f.h> +#include <gnuradio/filter/firdes.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/high_res_timer.h> +#include <gnuradio/qtgui/SpectrumGUIClass.h> namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc index 21b1f4d6d9..7d7f689f25 100644 --- a/gr-qtgui/lib/spectrumUpdateEvents.cc +++ b/gr-qtgui/lib/spectrumUpdateEvents.cc @@ -23,7 +23,7 @@ #ifndef SPECTRUM_UPDATE_EVENTS_C #define SPECTRUM_UPDATE_EVENTS_C -#include <qtgui/spectrumUpdateEvents.h> +#include <gnuradio/qtgui/spectrumUpdateEvents.h> SpectrumUpdateEvent::SpectrumUpdateEvent(const float* fftPoints, const uint64_t numFFTDataPoints, diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 24f15886ba..7731e41454 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -23,8 +23,8 @@ #include <cmath> #include <QColorDialog> #include <QMessageBox> -#include <qtgui/spectrumdisplayform.h> -#include <qtgui/qtgui_types.h> +#include <gnuradio/qtgui/spectrumdisplayform.h> +#include <gnuradio/qtgui/qtgui_types.h> SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) : QWidget(parent) diff --git a/gr-qtgui/lib/spectrumdisplayform.ui b/gr-qtgui/lib/spectrumdisplayform.ui index e1ebfa8197..f6f21c6472 100644 --- a/gr-qtgui/lib/spectrumdisplayform.ui +++ b/gr-qtgui/lib/spectrumdisplayform.ui @@ -522,10 +522,10 @@ <tabstop>WaterfallMinimumIntensitySlider</tabstop> </tabstops> <includes> - <include location="global">qtgui/SpectrumGUIClass.h</include> - <include location="global">qtgui/FrequencyDisplayPlot.h</include> - <include location="global">qtgui/WaterfallDisplayPlot.h</include> - <include location="global">qtgui/TimeDomainDisplayPlot.h</include> + <include location="global">gnuradio/qtgui/SpectrumGUIClass.h</include> + <include location="global">gnuradio/qtgui/FrequencyDisplayPlot.h</include> + <include location="global">gnuradio/qtgui/WaterfallDisplayPlot.h</include> + <include location="global">gnuradio/qtgui/TimeDomainDisplayPlot.h</include> <include location="global">qvalidator.h</include> <include location="global">vector</include> <include location="local">qwt_slider.h</include> diff --git a/gr-qtgui/lib/timeRasterGlobalData.cc b/gr-qtgui/lib/timeRasterGlobalData.cc index 6ebef5f47e..bd88ead8d3 100644 --- a/gr-qtgui/lib/timeRasterGlobalData.cc +++ b/gr-qtgui/lib/timeRasterGlobalData.cc @@ -23,7 +23,7 @@ #ifndef TIMERASTER_GLOBAL_DATA_CPP #define TIMERASTER_GLOBAL_DATA_CPP -#include <qtgui/timeRasterGlobalData.h> +#include <gnuradio/qtgui/timeRasterGlobalData.h> #include <cstdio> #include <cmath> #include <iostream> diff --git a/gr-qtgui/lib/time_raster_sink_b_impl.cc b/gr-qtgui/lib/time_raster_sink_b_impl.cc index 6ec6c6075b..4b3d1594cd 100644 --- a/gr-qtgui/lib/time_raster_sink_b_impl.cc +++ b/gr-qtgui/lib/time_raster_sink_b_impl.cc @@ -25,7 +25,7 @@ #endif #include "time_raster_sink_b_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <volk/volk.h> @@ -57,9 +57,9 @@ namespace gr { const std::string &name, int nconnections, QWidget *parent) - : gr_sync_block("time_raster_sink_b", - gr_make_io_signature(1, -1, sizeof(char)), - gr_make_io_signature(0, 0, 0)), + : sync_block("time_raster_sink_b", + io_signature::make(1, -1, sizeof(char)), + io_signature::make(0, 0, 0)), d_name(name), d_nconnections(nconnections), d_parent(parent), d_rows(rows), d_cols(cols), d_mult(std::vector<float>(nconnections,1)), diff --git a/gr-qtgui/lib/time_raster_sink_b_impl.h b/gr-qtgui/lib/time_raster_sink_b_impl.h index 09c471fcfc..17a492b799 100644 --- a/gr-qtgui/lib/time_raster_sink_b_impl.h +++ b/gr-qtgui/lib/time_raster_sink_b_impl.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_QTGUI_TIME_RASTER_SINK_B_IMPL_H #define INCLUDED_QTGUI_TIME_RASTER_SINK_B_IMPL_H -#include <qtgui/time_raster_sink_b.h> -#include <filter/firdes.h> -#include <fft/fft.h> -#include <high_res_timer.h> -#include <thread/thread.h> -#include <qtgui/timerasterdisplayform.h> +#include <gnuradio/qtgui/time_raster_sink_b.h> +#include <gnuradio/filter/firdes.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/high_res_timer.h> +#include <gnuradio/thread/thread.h> +#include <gnuradio/qtgui/timerasterdisplayform.h> namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/time_raster_sink_c_impl.cc b/gr-qtgui/lib/time_raster_sink_c_impl.cc index 1c71258030..93eba63a3f 100644 --- a/gr-qtgui/lib/time_raster_sink_c_impl.cc +++ b/gr-qtgui/lib/time_raster_sink_c_impl.cc @@ -25,7 +25,7 @@ #endif #include "time_raster_sink_c_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <volk/volk.h> @@ -47,9 +47,9 @@ namespace gr { unsigned int cols, const std::string &name, QWidget *parent) - : gr_sync_block("time_raster_sink_c", - gr_make_io_signature(1, -1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), + : sync_block("time_raster_sink_c", + io_signature::make(1, -1, sizeof(gr_complex)), + io_signature::make(0, 0, 0)), d_name(name), d_nconnections(1), d_parent(parent), d_rows(rows), d_cols(cols) { diff --git a/gr-qtgui/lib/time_raster_sink_c_impl.h b/gr-qtgui/lib/time_raster_sink_c_impl.h index 9f8a463bf8..8263046702 100644 --- a/gr-qtgui/lib/time_raster_sink_c_impl.h +++ b/gr-qtgui/lib/time_raster_sink_c_impl.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_QTGUI_TIME_RASTER_SINK_C_IMPL_H #define INCLUDED_QTGUI_TIME_RASTER_SINK_C_IMPL_H -#include <qtgui/time_raster_sink_c.h> -#include <filter/firdes.h> -#include <fft/fft.h> -#include <high_res_timer.h> -#include <thread/thread.h> -#include <qtgui/time_rasterdisplayform.h> +#include <gnuradio/qtgui/time_raster_sink_c.h> +#include <gnuradio/filter/firdes.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/high_res_timer.h> +#include <gnuradio/thread/thread.h> +#include <gnuradio/qtgui/time_rasterdisplayform.h> namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/time_raster_sink_f_impl.cc b/gr-qtgui/lib/time_raster_sink_f_impl.cc index b6b0a1fc7d..0f60e45463 100644 --- a/gr-qtgui/lib/time_raster_sink_f_impl.cc +++ b/gr-qtgui/lib/time_raster_sink_f_impl.cc @@ -25,7 +25,7 @@ #endif #include "time_raster_sink_f_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <volk/volk.h> @@ -57,9 +57,9 @@ namespace gr { const std::string &name, int nconnections, QWidget *parent) - : gr_sync_block("time_raster_sink_f", - gr_make_io_signature(1, -1, sizeof(float)), - gr_make_io_signature(0, 0, 0)), + : sync_block("time_raster_sink_f", + io_signature::make(1, -1, sizeof(float)), + io_signature::make(0, 0, 0)), d_name(name), d_nconnections(nconnections), d_parent(parent), d_rows(rows), d_cols(cols), d_mult(std::vector<float>(nconnections,1)), diff --git a/gr-qtgui/lib/time_raster_sink_f_impl.h b/gr-qtgui/lib/time_raster_sink_f_impl.h index fad731570c..42e0c787e2 100644 --- a/gr-qtgui/lib/time_raster_sink_f_impl.h +++ b/gr-qtgui/lib/time_raster_sink_f_impl.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_QTGUI_TIME_RASTER_SINK_F_IMPL_H #define INCLUDED_QTGUI_TIME_RASTER_SINK_F_IMPL_H -#include <qtgui/time_raster_sink_f.h> -#include <filter/firdes.h> -#include <fft/fft.h> -#include <high_res_timer.h> -#include <thread/thread.h> -#include <qtgui/timerasterdisplayform.h> +#include <gnuradio/qtgui/time_raster_sink_f.h> +#include <gnuradio/filter/firdes.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/high_res_timer.h> +#include <gnuradio/thread/thread.h> +#include <gnuradio/qtgui/timerasterdisplayform.h> namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/time_sink_c_impl.cc b/gr-qtgui/lib/time_sink_c_impl.cc index f8ff758218..c9f3e963c7 100644 --- a/gr-qtgui/lib/time_sink_c_impl.cc +++ b/gr-qtgui/lib/time_sink_c_impl.cc @@ -25,10 +25,10 @@ #endif #include "time_sink_c_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <volk/volk.h> -#include <fft/fft.h> +#include <gnuradio/fft/fft.h> #include <qwt_symbol.h> namespace gr { @@ -48,9 +48,9 @@ namespace gr { const std::string &name, int nconnections, QWidget *parent) - : gr_sync_block("time_sink_c", - gr_make_io_signature(nconnections, nconnections, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), + : sync_block("time_sink_c", + io_signature::make(nconnections, nconnections, sizeof(gr_complex)), + io_signature::make(0, 0, 0)), d_size(size), d_samp_rate(samp_rate), d_name(name), d_nconnections(2*nconnections), d_parent(parent) { diff --git a/gr-qtgui/lib/time_sink_c_impl.h b/gr-qtgui/lib/time_sink_c_impl.h index 2f9765c2c5..724d38e2ae 100644 --- a/gr-qtgui/lib/time_sink_c_impl.h +++ b/gr-qtgui/lib/time_sink_c_impl.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_QTGUI_TIME_SINK_C_IMPL_H #define INCLUDED_QTGUI_TIME_SINK_C_IMPL_H -#include <qtgui/time_sink_c.h> -#include <qtgui/timedisplayform.h> -#include <thread/thread.h> -#include <high_res_timer.h> +#include <gnuradio/qtgui/time_sink_c.h> +#include <gnuradio/qtgui/timedisplayform.h> +#include <gnuradio/thread/thread.h> +#include <gnuradio/high_res_timer.h> namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/time_sink_f_impl.cc b/gr-qtgui/lib/time_sink_f_impl.cc index 6011751b2b..081da98134 100644 --- a/gr-qtgui/lib/time_sink_f_impl.cc +++ b/gr-qtgui/lib/time_sink_f_impl.cc @@ -25,10 +25,10 @@ #endif #include "time_sink_f_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <volk/volk.h> -#include <fft/fft.h> +#include <gnuradio/fft/fft.h> #include <qwt_symbol.h> namespace gr { @@ -48,9 +48,9 @@ namespace gr { const std::string &name, int nconnections, QWidget *parent) - : gr_sync_block("time_sink_f", - gr_make_io_signature(nconnections, nconnections, sizeof(float)), - gr_make_io_signature(0, 0, 0)), + : sync_block("time_sink_f", + io_signature::make(nconnections, nconnections, sizeof(float)), + io_signature::make(0, 0, 0)), d_size(size), d_samp_rate(samp_rate), d_name(name), d_nconnections(nconnections), d_parent(parent) { diff --git a/gr-qtgui/lib/time_sink_f_impl.h b/gr-qtgui/lib/time_sink_f_impl.h index 1012ffbd77..c3bd7cd838 100644 --- a/gr-qtgui/lib/time_sink_f_impl.h +++ b/gr-qtgui/lib/time_sink_f_impl.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_QTGUI_TIME_SINK_F_IMPL_H #define INCLUDED_QTGUI_TIME_SINK_F_IMPL_H -#include <qtgui/time_sink_f.h> -#include <qtgui/timedisplayform.h> -#include <thread/thread.h> -#include <high_res_timer.h> +#include <gnuradio/qtgui/time_sink_f.h> +#include <gnuradio/qtgui/timedisplayform.h> +#include <gnuradio/thread/thread.h> +#include <gnuradio/high_res_timer.h> namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/timedisplayform.cc b/gr-qtgui/lib/timedisplayform.cc index 3ae6f93d0c..4b26808cf6 100644 --- a/gr-qtgui/lib/timedisplayform.cc +++ b/gr-qtgui/lib/timedisplayform.cc @@ -22,7 +22,7 @@ #include <cmath> #include <QMessageBox> -#include <qtgui/timedisplayform.h> +#include <gnuradio/qtgui/timedisplayform.h> #include <iostream> TimeDisplayForm::TimeDisplayForm(int nplots, QWidget* parent) diff --git a/gr-qtgui/lib/timerasterdisplayform.cc b/gr-qtgui/lib/timerasterdisplayform.cc index 50c63ad545..e6f341875d 100644 --- a/gr-qtgui/lib/timerasterdisplayform.cc +++ b/gr-qtgui/lib/timerasterdisplayform.cc @@ -23,7 +23,7 @@ #include <cmath> #include <QColorDialog> #include <QMessageBox> -#include <qtgui/timerasterdisplayform.h> +#include <gnuradio/qtgui/timerasterdisplayform.h> #include <iostream> TimeRasterDisplayForm::TimeRasterDisplayForm(int nplots, diff --git a/gr-qtgui/lib/waterfallGlobalData.cc b/gr-qtgui/lib/waterfallGlobalData.cc index 2085acf8fc..a7e8db0928 100644 --- a/gr-qtgui/lib/waterfallGlobalData.cc +++ b/gr-qtgui/lib/waterfallGlobalData.cc @@ -23,7 +23,7 @@ #ifndef WATERFALL_GLOBAL_DATA_CPP #define WATERFALL_GLOBAL_DATA_CPP -#include <qtgui/waterfallGlobalData.h> +#include <gnuradio/qtgui/waterfallGlobalData.h> #include <cstdio> WaterfallData::WaterfallData(const double minimumFrequency, diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.cc b/gr-qtgui/lib/waterfall_sink_c_impl.cc index 817a5a126e..34ad0de38d 100644 --- a/gr-qtgui/lib/waterfall_sink_c_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc @@ -25,7 +25,7 @@ #endif #include "waterfall_sink_c_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <volk/volk.h> #include <qwt_symbol.h> @@ -52,9 +52,9 @@ namespace gr { const std::string &name, int nconnections, QWidget *parent) - : gr_sync_block("waterfall_sink_c", - gr_make_io_signature(1, nconnections, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), + : sync_block("waterfall_sink_c", + io_signature::make(1, nconnections, sizeof(gr_complex)), + io_signature::make(0, 0, 0)), d_fftsize(fftsize), d_fftavg(1.0), d_wintype((filter::firdes::win_type)(wintype)), d_center_freq(fc), d_bandwidth(bw), d_name(name), diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.h b/gr-qtgui/lib/waterfall_sink_c_impl.h index 7483989c00..bd548bc944 100644 --- a/gr-qtgui/lib/waterfall_sink_c_impl.h +++ b/gr-qtgui/lib/waterfall_sink_c_impl.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_QTGUI_WATERFALL_SINK_C_IMPL_H #define INCLUDED_QTGUI_WATERFALL_SINK_C_IMPL_H -#include <qtgui/waterfall_sink_c.h> -#include <filter/firdes.h> -#include <fft/fft.h> -#include <high_res_timer.h> -#include <thread/thread.h> -#include <qtgui/waterfalldisplayform.h> +#include <gnuradio/qtgui/waterfall_sink_c.h> +#include <gnuradio/filter/firdes.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/high_res_timer.h> +#include <gnuradio/thread/thread.h> +#include <gnuradio/qtgui/waterfalldisplayform.h> namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.cc b/gr-qtgui/lib/waterfall_sink_f_impl.cc index aad2ffe5c7..d226ca6a96 100644 --- a/gr-qtgui/lib/waterfall_sink_f_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc @@ -25,7 +25,7 @@ #endif #include "waterfall_sink_f_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> #include <volk/volk.h> @@ -51,9 +51,9 @@ namespace gr { const std::string &name, int nconnections, QWidget *parent) - : gr_sync_block("waterfall_sink_f", - gr_make_io_signature(1, -1, sizeof(float)), - gr_make_io_signature(0, 0, 0)), + : sync_block("waterfall_sink_f", + io_signature::make(1, -1, sizeof(float)), + io_signature::make(0, 0, 0)), d_fftsize(fftsize), d_fftavg(1.0), d_wintype((filter::firdes::win_type)(wintype)), d_center_freq(fc), d_bandwidth(bw), d_name(name), diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.h b/gr-qtgui/lib/waterfall_sink_f_impl.h index 02556fd9d6..16a54e0f36 100644 --- a/gr-qtgui/lib/waterfall_sink_f_impl.h +++ b/gr-qtgui/lib/waterfall_sink_f_impl.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_QTGUI_WATERFALL_SINK_F_IMPL_H #define INCLUDED_QTGUI_WATERFALL_SINK_F_IMPL_H -#include <qtgui/waterfall_sink_f.h> -#include <filter/firdes.h> -#include <fft/fft.h> -#include <high_res_timer.h> -#include <thread/thread.h> -#include <qtgui/waterfalldisplayform.h> +#include <gnuradio/qtgui/waterfall_sink_f.h> +#include <gnuradio/filter/firdes.h> +#include <gnuradio/fft/fft.h> +#include <gnuradio/high_res_timer.h> +#include <gnuradio/thread/thread.h> +#include <gnuradio/qtgui/waterfalldisplayform.h> namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/waterfalldisplayform.cc b/gr-qtgui/lib/waterfalldisplayform.cc index fb5df230c2..1021a4f8d3 100644 --- a/gr-qtgui/lib/waterfalldisplayform.cc +++ b/gr-qtgui/lib/waterfalldisplayform.cc @@ -23,7 +23,7 @@ #include <cmath> #include <QColorDialog> #include <QMessageBox> -#include <qtgui/waterfalldisplayform.h> +#include <gnuradio/qtgui/waterfalldisplayform.h> #include <iostream> WaterfallDisplayForm::WaterfallDisplayForm(int nplots, QWidget* parent) diff --git a/gr-qtgui/swig/CMakeLists.txt b/gr-qtgui/swig/CMakeLists.txt index 15b2147d6f..1c9a182625 100644 --- a/gr-qtgui/swig/CMakeLists.txt +++ b/gr-qtgui/swig/CMakeLists.txt @@ -39,7 +39,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/qtgui_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/qtgui) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/qtgui) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_LIBRARIES gnuradio-qtgui) diff --git a/gr-qtgui/swig/qtgui_swig.i b/gr-qtgui/swig/qtgui_swig.i index 27f34fc3cd..a04267dffc 100644 --- a/gr-qtgui/swig/qtgui_swig.i +++ b/gr-qtgui/swig/qtgui_swig.i @@ -29,36 +29,36 @@ %include "qtgui_swig_doc.i" // So we understand the firdes window types -%import "filter/firdes.h" +%import "gnuradio/filter/firdes.h" %{ -#include "qtgui/form_menus.h" -#include "qtgui/DisplayPlot.h" -#include "qtgui/displayform.h" -#include "qtgui/sink_c.h" -#include "qtgui/sink_f.h" -#include "qtgui/time_sink_c.h" -#include "qtgui/time_sink_f.h" -#include "qtgui/time_raster_sink_b.h" -#include "qtgui/time_raster_sink_f.h" -#include "qtgui/freq_sink_c.h" -#include "qtgui/freq_sink_f.h" -#include "qtgui/const_sink_c.h" -#include "qtgui/waterfall_sink_c.h" -#include "qtgui/waterfall_sink_f.h" +#include "gnuradio/qtgui/form_menus.h" +#include "gnuradio/qtgui/DisplayPlot.h" +#include "gnuradio/qtgui/displayform.h" +#include "gnuradio/qtgui/sink_c.h" +#include "gnuradio/qtgui/sink_f.h" +#include "gnuradio/qtgui/time_sink_c.h" +#include "gnuradio/qtgui/time_sink_f.h" +#include "gnuradio/qtgui/time_raster_sink_b.h" +#include "gnuradio/qtgui/time_raster_sink_f.h" +#include "gnuradio/qtgui/freq_sink_c.h" +#include "gnuradio/qtgui/freq_sink_f.h" +#include "gnuradio/qtgui/const_sink_c.h" +#include "gnuradio/qtgui/waterfall_sink_c.h" +#include "gnuradio/qtgui/waterfall_sink_f.h" %} -%include "qtgui/sink_c.h" -%include "qtgui/sink_f.h" -%include "qtgui/time_sink_c.h" -%include "qtgui/time_sink_f.h" -%include "qtgui/time_raster_sink_b.h" -%include "qtgui/time_raster_sink_f.h" -%include "qtgui/freq_sink_c.h" -%include "qtgui/freq_sink_f.h" -%include "qtgui/const_sink_c.h" -%include "qtgui/waterfall_sink_c.h" -%include "qtgui/waterfall_sink_f.h" +%include "gnuradio/qtgui/sink_c.h" +%include "gnuradio/qtgui/sink_f.h" +%include "gnuradio/qtgui/time_sink_c.h" +%include "gnuradio/qtgui/time_sink_f.h" +%include "gnuradio/qtgui/time_raster_sink_b.h" +%include "gnuradio/qtgui/time_raster_sink_f.h" +%include "gnuradio/qtgui/freq_sink_c.h" +%include "gnuradio/qtgui/freq_sink_f.h" +%include "gnuradio/qtgui/const_sink_c.h" +%include "gnuradio/qtgui/waterfall_sink_c.h" +%include "gnuradio/qtgui/waterfall_sink_f.h" GR_SWIG_BLOCK_MAGIC2(qtgui, sink_c); GR_SWIG_BLOCK_MAGIC2(qtgui, sink_f); diff --git a/gr-shd/include/gr_shd_smini_sink.h b/gr-shd/include/gr_shd_smini_sink.h index b807e5c878..48389a8c7b 100644 --- a/gr-shd/include/gr_shd_smini_sink.h +++ b/gr-shd/include/gr_shd_smini_sink.h @@ -23,7 +23,7 @@ #define INCLUDED_GR_SHD_SMINI_SINK_H #include <gr_shd_api.h> -#include <gr_sync_block.h> +#include <gnuradio/sync_block.h> #include <shd/xmini/multi_xmini.hpp> class shd_smini_sink; @@ -34,7 +34,7 @@ GR_SHD_API boost::shared_ptr<shd_smini_sink> shd_make_smini_sink( size_t num_channels ); -class GR_SHD_API shd_smini_sink : virtual public gr_sync_block +class GR_SHD_API shd_smini_sink : virtual public sync_block { public: diff --git a/gr-shd/include/gr_shd_smini_source.h b/gr-shd/include/gr_shd_smini_source.h index 11c8563fe2..a397a3b302 100644 --- a/gr-shd/include/gr_shd_smini_source.h +++ b/gr-shd/include/gr_shd_smini_source.h @@ -23,7 +23,7 @@ #define INCLUDED_GR_SHD_SMINI_SOURCE_H #include <gr_shd_api.h> -#include <gr_sync_block.h> +#include <gnuradio/sync_block.h> #include <shd/xmini/multi_xmini.hpp> class shd_smini_source; @@ -34,7 +34,7 @@ GR_SHD_API boost::shared_ptr<shd_smini_source> shd_make_smini_source( size_t num_channels ); -class GR_SHD_API shd_smini_source : virtual public gr_sync_block +class GR_SHD_API shd_smini_source : virtual public sync_block { public: diff --git a/gr-shd/lib/gr_shd_smini_sink.cc b/gr-shd/lib/gr_shd_smini_sink.cc index 658f5719ef..c471873d73 100644 --- a/gr-shd/lib/gr_shd_smini_sink.cc +++ b/gr-shd/lib/gr_shd_smini_sink.cc @@ -20,7 +20,7 @@ */ #include <gr_shd_smini_sink.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> /********************************************************************* @@ -32,9 +32,9 @@ public: shd_smini_sink_impl(const shd::device_addr_t &device_addr, const shd::io_type_t &io_type, size_t num_channels): - gr_sync_block("gr shd smini sink", - gr_make_io_signature(num_channels, num_channels, io_type.size), - gr_make_io_signature(0, 0, 0)), + sync_block("gr shd smini sink", + io_signature::make(num_channels, num_channels, io_type.size), + io_signature::make(0, 0, 0)), _type(io_type), _nchan(num_channels), _has_time_spec(_nchan > 1) diff --git a/gr-shd/lib/gr_shd_smini_source.cc b/gr-shd/lib/gr_shd_smini_source.cc index 58559a6239..684eb343b6 100644 --- a/gr-shd/lib/gr_shd_smini_source.cc +++ b/gr-shd/lib/gr_shd_smini_source.cc @@ -20,7 +20,7 @@ */ #include <gr_shd_smini_source.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> #include <iostream> #include <boost/format.hpp> @@ -36,10 +36,10 @@ public: const shd::io_type_t &io_type, size_t num_channels ): - gr_sync_block( + sync_block( "gr shd smini source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(num_channels, num_channels, io_type.size) + io_signature::make(0, 0, 0), + io_signature::make(num_channels, num_channels, io_type.size) ), _type(io_type), _nchan(num_channels), diff --git a/gr-trellis/CMakeLists.txt b/gr-trellis/CMakeLists.txt index 5646a6b579..d7c317b755 100644 --- a/gr-trellis/CMakeLists.txt +++ b/gr-trellis/CMakeLists.txt @@ -100,7 +100,7 @@ CPACK_COMPONENT("trellis_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/trellis) +add_subdirectory(include/gnuradio/trellis) add_subdirectory(lib) add_subdirectory(doc) if(ENABLE_PYTHON) diff --git a/gr-trellis/include/trellis/CMakeLists.txt b/gr-trellis/include/gnuradio/trellis/CMakeLists.txt index b7ceea179e..b7ceea179e 100644 --- a/gr-trellis/include/trellis/CMakeLists.txt +++ b/gr-trellis/include/gnuradio/trellis/CMakeLists.txt diff --git a/gr-trellis/include/trellis/api.h b/gr-trellis/include/gnuradio/trellis/api.h index 8b85addd96..bdf5842864 100644 --- a/gr-trellis/include/trellis/api.h +++ b/gr-trellis/include/gnuradio/trellis/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_TRELLIS_API_H #define INCLUDED_TRELLIS_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_trellis_EXPORTS # define TRELLIS_API __GR_ATTR_EXPORT diff --git a/gr-trellis/include/trellis/base.h b/gr-trellis/include/gnuradio/trellis/base.h index c69500d0df..c69500d0df 100644 --- a/gr-trellis/include/trellis/base.h +++ b/gr-trellis/include/gnuradio/trellis/base.h diff --git a/gr-trellis/include/trellis/calc_metric.h b/gr-trellis/include/gnuradio/trellis/calc_metric.h index b39267dc84..c85fcbff69 100644 --- a/gr-trellis/include/trellis/calc_metric.h +++ b/gr-trellis/include/gnuradio/trellis/calc_metric.h @@ -24,8 +24,8 @@ #define INCLUDED_CALC_METRIC_H #include <vector> -#include <gr_complex.h> -#include <digital/metric_type.h> +#include <gnuradio/gr_complex.h> +#include <gnuradio/digital/metric_type.h> namespace gr { namespace trellis { diff --git a/gr-trellis/include/trellis/constellation_metrics_cf.h b/gr-trellis/include/gnuradio/trellis/constellation_metrics_cf.h index f4b94223c7..01bfab0140 100644 --- a/gr-trellis/include/trellis/constellation_metrics_cf.h +++ b/gr-trellis/include/gnuradio/trellis/constellation_metrics_cf.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H #define INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H -#include <trellis/api.h> -#include <gr_block.h> -#include <digital/constellation.h> -#include <digital/metric_type.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/block.h> +#include <gnuradio/digital/constellation.h> +#include <gnuradio/digital/metric_type.h> namespace gr { namespace trellis { @@ -35,7 +35,7 @@ namespace gr { * \brief Evaluate metrics for use by the Viterbi algorithm. * \ingroup trellis_coding_blk */ - class TRELLIS_API constellation_metrics_cf : virtual public gr_block + class TRELLIS_API constellation_metrics_cf : virtual public block { public: // gr::trellis::constellation_metrics_cf::sptr diff --git a/gr-trellis/include/trellis/core_algorithms.h b/gr-trellis/include/gnuradio/trellis/core_algorithms.h index 2292845629..aedff120d8 100644 --- a/gr-trellis/include/trellis/core_algorithms.h +++ b/gr-trellis/include/gnuradio/trellis/core_algorithms.h @@ -25,9 +25,9 @@ #include <cmath> #include <vector> -#include <digital/metric_type.h> -#include <trellis/fsm.h> -#include <trellis/interleaver.h> +#include <gnuradio/digital/metric_type.h> +#include <gnuradio/trellis/fsm.h> +#include <gnuradio/trellis/interleaver.h> namespace gr { namespace trellis { diff --git a/gr-trellis/include/trellis/encoder_XX.h.t b/gr-trellis/include/gnuradio/trellis/encoder_XX.h.t index 9ca7cb30ce..7ece5d3f21 100644 --- a/gr-trellis/include/trellis/encoder_XX.h.t +++ b/gr-trellis/include/gnuradio/trellis/encoder_XX.h.t @@ -25,9 +25,9 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/api.h> -#include <trellis/fsm.h> -#include <gr_sync_block.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/fsm.h> +#include <gnuradio/sync_block.h> namespace gr { namespace trellis { @@ -36,7 +36,7 @@ namespace gr { * \brief Convolutional encoder. * \ingroup trellis_coding_blk */ - class TRELLIS_API @NAME@ : virtual public gr_sync_block + class TRELLIS_API @NAME@ : virtual public sync_block { public: // gr::trellis::@BASE_NAME@::sptr diff --git a/gr-trellis/include/trellis/fsm.h b/gr-trellis/include/gnuradio/trellis/fsm.h index d88732b29b..cc8893f1e3 100644 --- a/gr-trellis/include/trellis/fsm.h +++ b/gr-trellis/include/gnuradio/trellis/fsm.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_TRELLIS_FSM_H #define INCLUDED_TRELLIS_FSM_H -#include <trellis/api.h> +#include <gnuradio/trellis/api.h> #include <vector> #include <iosfwd> diff --git a/gr-trellis/include/trellis/interleaver.h b/gr-trellis/include/gnuradio/trellis/interleaver.h index 35fff0ac88..2147db6600 100644 --- a/gr-trellis/include/trellis/interleaver.h +++ b/gr-trellis/include/gnuradio/trellis/interleaver.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_TRELLIS_INTERLEAVER_H #define INCLUDED_TRELLIS_INTERLEAVER_H -#include <trellis/api.h> +#include <gnuradio/trellis/api.h> #include <vector> namespace gr { diff --git a/gr-trellis/include/trellis/metrics_X.h.t b/gr-trellis/include/gnuradio/trellis/metrics_X.h.t index dab7924a8b..3f650faf0e 100644 --- a/gr-trellis/include/trellis/metrics_X.h.t +++ b/gr-trellis/include/gnuradio/trellis/metrics_X.h.t @@ -25,9 +25,9 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/api.h> -#include <trellis/calc_metric.h> -#include <gr_block.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/calc_metric.h> +#include <gnuradio/block.h> namespace gr { namespace trellis { @@ -36,7 +36,7 @@ namespace gr { * \brief Evaluate metrics for use by the Viterbi algorithm. * \ingroup trellis_coding_blk */ - class TRELLIS_API @NAME@ : virtual public gr_block + class TRELLIS_API @NAME@ : virtual public block { public: // gr::trellis::@BASE_NAME@::sptr diff --git a/gr-trellis/include/trellis/pccc_decoder_X.h.t b/gr-trellis/include/gnuradio/trellis/pccc_decoder_X.h.t index d5b6af7b87..affce07042 100644 --- a/gr-trellis/include/trellis/pccc_decoder_X.h.t +++ b/gr-trellis/include/gnuradio/trellis/pccc_decoder_X.h.t @@ -25,11 +25,11 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/api.h> -#include <trellis/fsm.h> -#include <trellis/interleaver.h> -#include <trellis/siso_type.h> -#include <gr_block.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/fsm.h> +#include <gnuradio/trellis/interleaver.h> +#include <gnuradio/trellis/siso_type.h> +#include <gnuradio/block.h> #include <vector> namespace gr { @@ -38,7 +38,7 @@ namespace gr { /*! * \ingroup trellis_coding_blk */ - class TRELLIS_API @NAME@ : virtual public gr_block + class TRELLIS_API @NAME@ : virtual public block { public: // gr::trellis::@BASE_NAME@::sptr diff --git a/gr-trellis/include/trellis/pccc_decoder_combined_XX.h.t b/gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_XX.h.t index 87b110a945..719b0aa1e5 100644 --- a/gr-trellis/include/trellis/pccc_decoder_combined_XX.h.t +++ b/gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_XX.h.t @@ -25,12 +25,12 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/api.h> -#include <trellis/fsm.h> -#include <trellis/interleaver.h> -#include <trellis/calc_metric.h> -#include <trellis/siso_type.h> -#include <gr_block.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/fsm.h> +#include <gnuradio/trellis/interleaver.h> +#include <gnuradio/trellis/calc_metric.h> +#include <gnuradio/trellis/siso_type.h> +#include <gnuradio/block.h> #include <vector> namespace gr { @@ -39,7 +39,7 @@ namespace gr { /*! * \ingroup trellis_coding_blk */ - class TRELLIS_API @NAME@ : virtual public gr_block + class TRELLIS_API @NAME@ : virtual public block { public: // gr::trellis::@BASE_NAME@::sptr diff --git a/gr-trellis/include/trellis/pccc_encoder_XX.h.t b/gr-trellis/include/gnuradio/trellis/pccc_encoder_XX.h.t index 2a62b7520f..5308fe275d 100644 --- a/gr-trellis/include/trellis/pccc_encoder_XX.h.t +++ b/gr-trellis/include/gnuradio/trellis/pccc_encoder_XX.h.t @@ -25,10 +25,10 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/api.h> -#include <trellis/fsm.h> -#include <trellis/interleaver.h> -#include <gr_sync_block.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/fsm.h> +#include <gnuradio/trellis/interleaver.h> +#include <gnuradio/sync_block.h> #include <vector> namespace gr { @@ -38,7 +38,7 @@ namespace gr { * \brief PCCC encoder. * \ingroup trellis_coding_blk */ - class TRELLIS_API @NAME@ : virtual public gr_sync_block + class TRELLIS_API @NAME@ : virtual public sync_block { public: // gr::trellis::@BASE_NAME@::sptr diff --git a/gr-trellis/include/trellis/permutation.h b/gr-trellis/include/gnuradio/trellis/permutation.h index 0f974abb97..80b9fef641 100644 --- a/gr-trellis/include/trellis/permutation.h +++ b/gr-trellis/include/gnuradio/trellis/permutation.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_TRELLIS_PERMUTATION_H #define INCLUDED_TRELLIS_PERMUTATION_H -#include <trellis/api.h> +#include <gnuradio/trellis/api.h> #include <vector> -#include <gr_sync_block.h> +#include <gnuradio/sync_block.h> namespace gr { namespace trellis { @@ -34,7 +34,7 @@ namespace gr { * \brief Permutation. * \ingroup trellis_coding_blk */ - class TRELLIS_API permutation : virtual public gr_sync_block + class TRELLIS_API permutation : virtual public sync_block { public: // gr::trellis::permutation::sptr diff --git a/gr-trellis/include/trellis/quicksort_index.h b/gr-trellis/include/gnuradio/trellis/quicksort_index.h index 402962172a..402962172a 100644 --- a/gr-trellis/include/trellis/quicksort_index.h +++ b/gr-trellis/include/gnuradio/trellis/quicksort_index.h diff --git a/gr-trellis/include/trellis/sccc_decoder_X.h.t b/gr-trellis/include/gnuradio/trellis/sccc_decoder_X.h.t index 1a63facad9..cc1d86b709 100644 --- a/gr-trellis/include/trellis/sccc_decoder_X.h.t +++ b/gr-trellis/include/gnuradio/trellis/sccc_decoder_X.h.t @@ -25,11 +25,11 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/api.h> -#include <trellis/fsm.h> -#include <trellis/interleaver.h> -#include <trellis/siso_type.h> -#include <gr_block.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/fsm.h> +#include <gnuradio/trellis/interleaver.h> +#include <gnuradio/trellis/siso_type.h> +#include <gnuradio/block.h> #include <vector> namespace gr { @@ -38,7 +38,7 @@ namespace gr { /*! * \ingroup trellis_coding_blk */ - class TRELLIS_API @NAME@ : virtual public gr_block + class TRELLIS_API @NAME@ : virtual public block { public: // gr::trellis::@BASE_NAME@::sptr diff --git a/gr-trellis/include/trellis/sccc_decoder_combined_XX.h.t b/gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_XX.h.t index f5f9bef464..699de12fd8 100644 --- a/gr-trellis/include/trellis/sccc_decoder_combined_XX.h.t +++ b/gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_XX.h.t @@ -25,12 +25,12 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/api.h> -#include <trellis/fsm.h> -#include <trellis/interleaver.h> -#include <trellis/calc_metric.h> -#include <trellis/siso_type.h> -#include <gr_block.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/fsm.h> +#include <gnuradio/trellis/interleaver.h> +#include <gnuradio/trellis/calc_metric.h> +#include <gnuradio/trellis/siso_type.h> +#include <gnuradio/block.h> #include <vector> namespace gr { @@ -39,7 +39,7 @@ namespace gr { /*! * \ingroup trellis_coding_blk */ - class TRELLIS_API @NAME@ : virtual public gr_block + class TRELLIS_API @NAME@ : virtual public block { public: // gr::trellis::@BASE_NAME@::sptr diff --git a/gr-trellis/include/trellis/sccc_encoder_XX.h.t b/gr-trellis/include/gnuradio/trellis/sccc_encoder_XX.h.t index f62a1e7cfb..85fad02eeb 100644 --- a/gr-trellis/include/trellis/sccc_encoder_XX.h.t +++ b/gr-trellis/include/gnuradio/trellis/sccc_encoder_XX.h.t @@ -25,10 +25,10 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/api.h> -#include <trellis/fsm.h> -#include <trellis/interleaver.h> -#include <gr_sync_block.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/fsm.h> +#include <gnuradio/trellis/interleaver.h> +#include <gnuradio/sync_block.h> #include <vector> namespace gr { @@ -38,7 +38,7 @@ namespace gr { * \brief SCCC encoder. * \ingroup trellis_coding_blk */ - class TRELLIS_API @NAME@ : virtual public gr_sync_block + class TRELLIS_API @NAME@ : virtual public sync_block { public: // gr::trellis::@BASE_NAME@::sptr diff --git a/gr-trellis/include/trellis/siso_combined_f.h b/gr-trellis/include/gnuradio/trellis/siso_combined_f.h index 48089f86e4..47c34ea81e 100644 --- a/gr-trellis/include/trellis/siso_combined_f.h +++ b/gr-trellis/include/gnuradio/trellis/siso_combined_f.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_TRELLIS_SISO_COMBINED_F_H #define INCLUDED_TRELLIS_SISO_COMBINED_F_H -#include <trellis/api.h> -#include <trellis/fsm.h> -#include <trellis/siso_type.h> -#include <trellis/calc_metric.h> -#include <trellis/core_algorithms.h> -#include <gr_block.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/fsm.h> +#include <gnuradio/trellis/siso_type.h> +#include <gnuradio/trellis/calc_metric.h> +#include <gnuradio/trellis/core_algorithms.h> +#include <gnuradio/block.h> namespace gr { namespace trellis { @@ -36,7 +36,7 @@ namespace gr { /*! * \ingroup trellis_coding_blk */ - class TRELLIS_API siso_combined_f : virtual public gr_block + class TRELLIS_API siso_combined_f : virtual public block { public: // gr::trellis::siso_combined_f::sptr diff --git a/gr-trellis/include/trellis/siso_f.h b/gr-trellis/include/gnuradio/trellis/siso_f.h index 6d4d414f38..60c3349e11 100644 --- a/gr-trellis/include/trellis/siso_f.h +++ b/gr-trellis/include/gnuradio/trellis/siso_f.h @@ -23,11 +23,11 @@ #ifndef INCLUDED_TRELLIS_SISO_F_H #define INCLUDED_TRELLIS_SISO_F_H -#include <trellis/api.h> -#include <trellis/fsm.h> -#include <trellis/siso_type.h> -#include <trellis/core_algorithms.h> -#include <gr_block.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/fsm.h> +#include <gnuradio/trellis/siso_type.h> +#include <gnuradio/trellis/core_algorithms.h> +#include <gnuradio/block.h> namespace gr { namespace trellis { @@ -35,7 +35,7 @@ namespace gr { /*! * \ingroup trellis_coding_blk */ - class TRELLIS_API siso_f : virtual public gr_block + class TRELLIS_API siso_f : virtual public block { public: // gr::trellis::siso_f::sptr diff --git a/gr-trellis/include/trellis/siso_type.h b/gr-trellis/include/gnuradio/trellis/siso_type.h index 9167381164..9167381164 100644 --- a/gr-trellis/include/trellis/siso_type.h +++ b/gr-trellis/include/gnuradio/trellis/siso_type.h diff --git a/gr-trellis/include/trellis/viterbi_X.h.t b/gr-trellis/include/gnuradio/trellis/viterbi_X.h.t index 817c98508a..2d72cb5e09 100644 --- a/gr-trellis/include/trellis/viterbi_X.h.t +++ b/gr-trellis/include/gnuradio/trellis/viterbi_X.h.t @@ -25,10 +25,10 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/api.h> -#include <trellis/fsm.h> -#include <trellis/core_algorithms.h> -#include <gr_block.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/fsm.h> +#include <gnuradio/trellis/core_algorithms.h> +#include <gnuradio/block.h> namespace gr { namespace trellis { @@ -36,7 +36,7 @@ namespace gr { /*! * \ingroup trellis_coding_blk */ - class TRELLIS_API @NAME@ : virtual public gr_block + class TRELLIS_API @NAME@ : virtual public block { public: // gr::trellis::@BASE_NAME@::sptr diff --git a/gr-trellis/include/trellis/viterbi_combined_XX.h.t b/gr-trellis/include/gnuradio/trellis/viterbi_combined_XX.h.t index a2cc4b946c..2becf8bf18 100644 --- a/gr-trellis/include/trellis/viterbi_combined_XX.h.t +++ b/gr-trellis/include/gnuradio/trellis/viterbi_combined_XX.h.t @@ -25,11 +25,11 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/api.h> -#include <trellis/fsm.h> -#include <trellis/calc_metric.h> -#include <trellis/core_algorithms.h> -#include <gr_block.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/fsm.h> +#include <gnuradio/trellis/calc_metric.h> +#include <gnuradio/trellis/core_algorithms.h> +#include <gnuradio/block.h> namespace gr { namespace trellis { @@ -37,7 +37,7 @@ namespace gr { /*! * \ingroup trellis_coding_blk */ - class TRELLIS_API @NAME@ : virtual public gr_block + class TRELLIS_API @NAME@ : virtual public block { public: // gr::trellis::@BASE_NAME@::sptr diff --git a/gr-trellis/lib/base.cc b/gr-trellis/lib/base.cc index e9d0141e70..c5022dac83 100644 --- a/gr-trellis/lib/base.cc +++ b/gr-trellis/lib/base.cc @@ -23,7 +23,7 @@ #include <cstdio> #include <stdexcept> #include <cmath> -#include <trellis/base.h> +#include <gnuradio/trellis/base.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/calc_metric.cc b/gr-trellis/lib/calc_metric.cc index 3c474e30fe..b95899940a 100644 --- a/gr-trellis/lib/calc_metric.cc +++ b/gr-trellis/lib/calc_metric.cc @@ -22,7 +22,7 @@ #include <float.h> #include <stdexcept> -#include <trellis/calc_metric.h> +#include <gnuradio/trellis/calc_metric.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/constellation_metrics_cf_impl.cc b/gr-trellis/lib/constellation_metrics_cf_impl.cc index 18d3095802..6aa7dce6c8 100644 --- a/gr-trellis/lib/constellation_metrics_cf_impl.cc +++ b/gr-trellis/lib/constellation_metrics_cf_impl.cc @@ -25,7 +25,7 @@ #endif #include "constellation_metrics_cf_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <assert.h> #include <stdexcept> #include <iostream> @@ -43,9 +43,9 @@ namespace gr { constellation_metrics_cf_impl::constellation_metrics_cf_impl(digital::constellation_sptr constellation, digital::trellis_metric_type_t TYPE) - : gr_block("constellation_metrics_cf", - gr_make_io_signature(1, -1, sizeof(gr_complex)), - gr_make_io_signature(1, -1, sizeof(float))), + : block("constellation_metrics_cf", + io_signature::make(1, -1, sizeof(gr_complex)), + io_signature::make(1, -1, sizeof(float))), d_constellation(constellation), d_TYPE(TYPE), d_O(constellation->arity()), diff --git a/gr-trellis/lib/constellation_metrics_cf_impl.h b/gr-trellis/lib/constellation_metrics_cf_impl.h index 52018c4baa..a2f165857b 100644 --- a/gr-trellis/lib/constellation_metrics_cf_impl.h +++ b/gr-trellis/lib/constellation_metrics_cf_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_IMPL_H #define INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_IMPL_H -#include <trellis/api.h> -#include <trellis/constellation_metrics_cf.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/constellation_metrics_cf.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/core_algorithms.cc b/gr-trellis/lib/core_algorithms.cc index a704e5f9a6..a8a0174551 100644 --- a/gr-trellis/lib/core_algorithms.cc +++ b/gr-trellis/lib/core_algorithms.cc @@ -23,8 +23,8 @@ #include <cstring> #include <stdexcept> #include <iostream> -#include <trellis/core_algorithms.h> -#include <trellis/calc_metric.h> +#include <gnuradio/trellis/core_algorithms.h> +#include <gnuradio/trellis/calc_metric.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/encoder_XX_impl.cc.t b/gr-trellis/lib/encoder_XX_impl.cc.t index fdda593d45..4b11e3c06d 100644 --- a/gr-trellis/lib/encoder_XX_impl.cc.t +++ b/gr-trellis/lib/encoder_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> namespace gr { @@ -41,9 +41,9 @@ namespace gr { } @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM, int ST) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(1, -1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, -1, sizeof(@O_TYPE@))), + : sync_block("@BASE_NAME@", + io_signature::make(1, -1, sizeof(@I_TYPE@)), + io_signature::make(1, -1, sizeof(@O_TYPE@))), d_FSM(FSM), d_ST(ST) { diff --git a/gr-trellis/lib/encoder_XX_impl.h.t b/gr-trellis/lib/encoder_XX_impl.h.t index 949f1182de..ec2f82611e 100644 --- a/gr-trellis/lib/encoder_XX_impl.h.t +++ b/gr-trellis/lib/encoder_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/@BASE_NAME@.h> +#include <gnuradio/trellis/@BASE_NAME@.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/fsm.cc b/gr-trellis/lib/fsm.cc index 16efcd10f2..20eeed5c25 100644 --- a/gr-trellis/lib/fsm.cc +++ b/gr-trellis/lib/fsm.cc @@ -27,8 +27,8 @@ #include <stdexcept> #include <cmath> #include <stdlib.h> -#include <trellis/base.h> -#include <trellis/fsm.h> +#include <gnuradio/trellis/base.h> +#include <gnuradio/trellis/fsm.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/interleaver.cc b/gr-trellis/lib/interleaver.cc index 27248a6d43..f24d625582 100644 --- a/gr-trellis/lib/interleaver.cc +++ b/gr-trellis/lib/interleaver.cc @@ -27,8 +27,8 @@ #include <fstream> #include <stdexcept> #include <cmath> -#include <trellis/quicksort_index.h> -#include <trellis/interleaver.h> +#include <gnuradio/trellis/quicksort_index.h> +#include <gnuradio/trellis/interleaver.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/metrics_X_impl.cc.t b/gr-trellis/lib/metrics_X_impl.cc.t index c74051c53e..499bd8b9cd 100644 --- a/gr-trellis/lib/metrics_X_impl.cc.t +++ b/gr-trellis/lib/metrics_X_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <assert.h> #include <stdexcept> #include <iostream> @@ -45,9 +45,9 @@ namespace gr { @IMPL_NAME@::@IMPL_NAME@(int O, int D, const std::vector<@I_TYPE@> &TABLE, digital::trellis_metric_type_t TYPE) - : gr_block("@BASE_NAME@", - gr_make_io_signature(1, -1, sizeof (@I_TYPE@)), - gr_make_io_signature(1, -1, sizeof (float))), + : block("@BASE_NAME@", + io_signature::make(1, -1, sizeof (@I_TYPE@)), + io_signature::make(1, -1, sizeof (float))), d_O(O), d_D(D), d_TYPE(TYPE), d_TABLE(TABLE) { set_relative_rate (1.0 * d_O / ((double) d_D)); diff --git a/gr-trellis/lib/metrics_X_impl.h.t b/gr-trellis/lib/metrics_X_impl.h.t index 0f52a8bc40..0cd7f0ba5b 100644 --- a/gr-trellis/lib/metrics_X_impl.h.t +++ b/gr-trellis/lib/metrics_X_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/@BASE_NAME@.h> +#include <gnuradio/trellis/@BASE_NAME@.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/pccc_decoder_X_impl.cc.t b/gr-trellis/lib/pccc_decoder_X_impl.cc.t index 9bf85bc614..aa19884712 100644 --- a/gr-trellis/lib/pccc_decoder_X_impl.cc.t +++ b/gr-trellis/lib/pccc_decoder_X_impl.cc.t @@ -27,9 +27,9 @@ #endif #include "@NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> -#include <trellis/core_algorithms.h> +#include <gnuradio/trellis/core_algorithms.h> namespace gr { namespace trellis { @@ -59,9 +59,9 @@ namespace gr { int blocklength, int repetitions, siso_type_t SISO_TYPE) - : gr_block("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@))), + : block("@BASE_NAME@", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(@O_TYPE@))), d_FSM1(FSM1), d_ST10(ST10), d_ST1K(ST1K), d_FSM2(FSM2), d_ST20(ST20), d_ST2K(ST2K), d_INTERLEAVER(INTERLEAVER), diff --git a/gr-trellis/lib/pccc_decoder_X_impl.h.t b/gr-trellis/lib/pccc_decoder_X_impl.h.t index 9b61e34fde..43a7257fc5 100644 --- a/gr-trellis/lib/pccc_decoder_X_impl.h.t +++ b/gr-trellis/lib/pccc_decoder_X_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/@BASE_NAME@.h> +#include <gnuradio/trellis/@BASE_NAME@.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t b/gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t index 21a5c0b3ae..15ea3ceecb 100644 --- a/gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t +++ b/gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t @@ -27,9 +27,9 @@ #endif #include "@NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> -#include <trellis/core_algorithms.h> +#include <gnuradio/trellis/core_algorithms.h> namespace gr { namespace trellis { @@ -64,9 +64,9 @@ namespace gr { const std::vector<@I_TYPE@> &TABLE, digital::trellis_metric_type_t METRIC_TYPE, float scaling) - : gr_block("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@))), + : block("@BASE_NAME@", + io_signature::make(1, 1, sizeof(@I_TYPE@)), + io_signature::make(1, 1, sizeof(@O_TYPE@))), d_FSMo(FSMo), d_STo0(STo0), d_SToK(SToK), d_FSMi(FSMi), d_STi0(STi0), d_STiK(STiK), d_INTERLEAVER(INTERLEAVER), diff --git a/gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t b/gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t index 4c3655f40d..7606017547 100644 --- a/gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t +++ b/gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/@BASE_NAME@.h> +#include <gnuradio/trellis/@BASE_NAME@.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/pccc_encoder_XX_impl.cc.t b/gr-trellis/lib/pccc_encoder_XX_impl.cc.t index 4e804729a2..119bff6ddb 100644 --- a/gr-trellis/lib/pccc_encoder_XX_impl.cc.t +++ b/gr-trellis/lib/pccc_encoder_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> namespace gr { @@ -47,9 +47,9 @@ namespace gr { const fsm &FSM2, int ST2, const interleaver &INTERLEAVER, int blocklength) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@))), + : sync_block("@BASE_NAME@", + io_signature::make(1, 1, sizeof(@I_TYPE@)), + io_signature::make(1, 1, sizeof(@O_TYPE@))), d_FSM1(FSM1), d_ST1(ST1), d_FSM2(FSM2), d_ST2(ST2), d_INTERLEAVER(INTERLEAVER), diff --git a/gr-trellis/lib/pccc_encoder_XX_impl.h.t b/gr-trellis/lib/pccc_encoder_XX_impl.h.t index 1eed3702be..f7d6967584 100644 --- a/gr-trellis/lib/pccc_encoder_XX_impl.h.t +++ b/gr-trellis/lib/pccc_encoder_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/@BASE_NAME@.h> +#include <gnuradio/trellis/@BASE_NAME@.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/permutation_impl.cc b/gr-trellis/lib/permutation_impl.cc index da82e46832..06bba1e11f 100644 --- a/gr-trellis/lib/permutation_impl.cc +++ b/gr-trellis/lib/permutation_impl.cc @@ -25,7 +25,7 @@ #endif #include "permutation_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> #include <string.h> @@ -42,9 +42,9 @@ namespace gr { permutation_impl::permutation_impl(int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL) - : gr_sync_block("permutation", - gr_make_io_signature(1, -1, BYTES_PER_SYMBOL), - gr_make_io_signature(1, -1, BYTES_PER_SYMBOL)), + : sync_block("permutation", + io_signature::make(1, -1, BYTES_PER_SYMBOL), + io_signature::make(1, -1, BYTES_PER_SYMBOL)), d_K(K), d_TABLE(TABLE), d_SYMS_PER_BLOCK(SYMS_PER_BLOCK), d_BYTES_PER_SYMBOL(BYTES_PER_SYMBOL) diff --git a/gr-trellis/lib/permutation_impl.h b/gr-trellis/lib/permutation_impl.h index 6e3ca2b2d7..2c7b28d62f 100644 --- a/gr-trellis/lib/permutation_impl.h +++ b/gr-trellis/lib/permutation_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_TRELLIS_PERMUTATION_IMPL_H #define INCLUDED_TRELLIS_PERMUTATION_IMPL_H -#include <trellis/api.h> -#include <trellis/permutation.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/permutation.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/quicksort_index.cc b/gr-trellis/lib/quicksort_index.cc index 02cd8a9134..2e7c21907a 100644 --- a/gr-trellis/lib/quicksort_index.cc +++ b/gr-trellis/lib/quicksort_index.cc @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <trellis/quicksort_index.h> +#include <gnuradio/trellis/quicksort_index.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/sccc_decoder_X_impl.cc.t b/gr-trellis/lib/sccc_decoder_X_impl.cc.t index 6eef46518d..d217bbccfb 100644 --- a/gr-trellis/lib/sccc_decoder_X_impl.cc.t +++ b/gr-trellis/lib/sccc_decoder_X_impl.cc.t @@ -27,9 +27,9 @@ #endif #include "@NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> -#include <trellis/core_algorithms.h> +#include <gnuradio/trellis/core_algorithms.h> namespace gr { namespace trellis { @@ -56,9 +56,9 @@ namespace gr { int blocklength, int repetitions, siso_type_t SISO_TYPE) - : gr_block("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@))), + : block("@BASE_NAME@", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(1, 1, sizeof(@O_TYPE@))), d_FSMo(FSMo), d_STo0(STo0), d_SToK(SToK), d_FSMi(FSMi), d_STi0(STi0), d_STiK(STiK), d_INTERLEAVER(INTERLEAVER), diff --git a/gr-trellis/lib/sccc_decoder_X_impl.h.t b/gr-trellis/lib/sccc_decoder_X_impl.h.t index 31f4edc4b8..c79e6ebbab 100644 --- a/gr-trellis/lib/sccc_decoder_X_impl.h.t +++ b/gr-trellis/lib/sccc_decoder_X_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/@BASE_NAME@.h> +#include <gnuradio/trellis/@BASE_NAME@.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t b/gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t index 717f2c8e49..4acc560175 100644 --- a/gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t +++ b/gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t @@ -27,9 +27,9 @@ #endif #include "@NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> -#include <trellis/core_algorithms.h> +#include <gnuradio/trellis/core_algorithms.h> namespace gr { namespace trellis { @@ -64,9 +64,9 @@ namespace gr { const std::vector<@I_TYPE@> &TABLE, digital::trellis_metric_type_t METRIC_TYPE, float scaling) - : gr_block("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@))), + : block("@BASE_NAME@", + io_signature::make(1, 1, sizeof(@I_TYPE@)), + io_signature::make(1, 1, sizeof(@O_TYPE@))), d_FSMo(FSMo), d_STo0(STo0), d_SToK(SToK), d_FSMi(FSMi), d_STi0(STi0), d_STiK(STiK), d_INTERLEAVER(INTERLEAVER), diff --git a/gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t b/gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t index f3dbd1b4bb..6a38f0114f 100644 --- a/gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t +++ b/gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/@BASE_NAME@.h> +#include <gnuradio/trellis/@BASE_NAME@.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/sccc_encoder_XX_impl.cc.t b/gr-trellis/lib/sccc_encoder_XX_impl.cc.t index 390e65c4f3..9924b3c7d2 100644 --- a/gr-trellis/lib/sccc_encoder_XX_impl.cc.t +++ b/gr-trellis/lib/sccc_encoder_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> namespace gr { @@ -47,9 +47,9 @@ namespace gr { const fsm &FSMi, int STi, const interleaver &INTERLEAVER, int blocklength) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(1, 1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, 1, sizeof(@O_TYPE@))), + : sync_block("@BASE_NAME@", + io_signature::make(1, 1, sizeof(@I_TYPE@)), + io_signature::make(1, 1, sizeof(@O_TYPE@))), d_FSMo(FSMo), d_STo(STo), d_FSMi(FSMi), d_STi(STi), d_INTERLEAVER(INTERLEAVER), diff --git a/gr-trellis/lib/sccc_encoder_XX_impl.h.t b/gr-trellis/lib/sccc_encoder_XX_impl.h.t index a3e582b5a0..fc64f2ade8 100644 --- a/gr-trellis/lib/sccc_encoder_XX_impl.h.t +++ b/gr-trellis/lib/sccc_encoder_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/@BASE_NAME@.h> +#include <gnuradio/trellis/@BASE_NAME@.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/siso_combined_f_impl.cc b/gr-trellis/lib/siso_combined_f_impl.cc index 7514d46747..d30f5cc4bb 100644 --- a/gr-trellis/lib/siso_combined_f_impl.cc +++ b/gr-trellis/lib/siso_combined_f_impl.cc @@ -25,7 +25,7 @@ #endif #include "siso_combined_f_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> #include <assert.h> #include <iostream> @@ -54,9 +54,9 @@ namespace gr { siso_type_t SISO_TYPE, int D, const std::vector<float> &TABLE, digital::trellis_metric_type_t TYPE) - : gr_block("siso_combined_f", - gr_make_io_signature(1, -1, sizeof(float)), - gr_make_io_signature(1, -1, sizeof(float))), + : block("siso_combined_f", + io_signature::make(1, -1, sizeof(float)), + io_signature::make(1, -1, sizeof(float))), d_FSM(FSM), d_K(K), d_S0(S0), d_SK(SK), d_POSTI(POSTI), d_POSTO(POSTO), d_SISO_TYPE(SISO_TYPE), diff --git a/gr-trellis/lib/siso_combined_f_impl.h b/gr-trellis/lib/siso_combined_f_impl.h index 27cef5e334..5035a0a83d 100644 --- a/gr-trellis/lib/siso_combined_f_impl.h +++ b/gr-trellis/lib/siso_combined_f_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_TRELLIS_SISO_COMBINED_F_IMPL_H #define INCLUDED_TRELLIS_SISO_COMBINED_F_IMPL_H -#include <trellis/siso_combined_f.h> +#include <gnuradio/trellis/siso_combined_f.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/siso_f_impl.cc b/gr-trellis/lib/siso_f_impl.cc index b0484f6f37..d699cecaec 100644 --- a/gr-trellis/lib/siso_f_impl.cc +++ b/gr-trellis/lib/siso_f_impl.cc @@ -25,7 +25,7 @@ #endif #include "siso_f_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> #include <assert.h> #include <iostream> @@ -49,9 +49,9 @@ namespace gr { int S0, int SK, bool POSTI, bool POSTO, siso_type_t SISO_TYPE) - : gr_block("siso_f", - gr_make_io_signature(1, -1, sizeof(float)), - gr_make_io_signature(1, -1, sizeof(float))), + : block("siso_f", + io_signature::make(1, -1, sizeof(float)), + io_signature::make(1, -1, sizeof(float))), d_FSM(FSM), d_K(K), d_S0(S0),d_SK(SK), d_POSTI(POSTI), d_POSTO(POSTO), diff --git a/gr-trellis/lib/siso_f_impl.h b/gr-trellis/lib/siso_f_impl.h index 40766b97fa..ca8f623aaf 100644 --- a/gr-trellis/lib/siso_f_impl.h +++ b/gr-trellis/lib/siso_f_impl.h @@ -23,11 +23,11 @@ #ifndef INCLUDED_TRELLIS_SISO_F_IMPL_H #define INCLUDED_TRELLIS_SISO_F_IMPL_H -#include <trellis/api.h> -#include <trellis/fsm.h> -#include <trellis/siso_type.h> -#include <trellis/core_algorithms.h> -#include <trellis/siso_f.h> +#include <gnuradio/trellis/api.h> +#include <gnuradio/trellis/fsm.h> +#include <gnuradio/trellis/siso_type.h> +#include <gnuradio/trellis/core_algorithms.h> +#include <gnuradio/trellis/siso_f.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/viterbi_X_impl.cc.t b/gr-trellis/lib/viterbi_X_impl.cc.t index 5097cc2053..247424b3f3 100644 --- a/gr-trellis/lib/viterbi_X_impl.cc.t +++ b/gr-trellis/lib/viterbi_X_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> namespace gr { @@ -45,9 +45,9 @@ namespace gr { @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM, int K, int S0, int SK) - : gr_block("@BASE_NAME@", - gr_make_io_signature(1, -1, sizeof(float)), - gr_make_io_signature(1, -1, sizeof(@TYPE@))), + : block("@BASE_NAME@", + io_signature::make(1, -1, sizeof(float)), + io_signature::make(1, -1, sizeof(@TYPE@))), d_FSM(FSM), d_K(K), d_S0(S0), d_SK(SK)//, //d_trace(FSM.S()*K) { diff --git a/gr-trellis/lib/viterbi_X_impl.h.t b/gr-trellis/lib/viterbi_X_impl.h.t index accaacc158..b9554e8c39 100644 --- a/gr-trellis/lib/viterbi_X_impl.h.t +++ b/gr-trellis/lib/viterbi_X_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/@BASE_NAME@.h> +#include <gnuradio/trellis/@BASE_NAME@.h> namespace gr { namespace trellis { diff --git a/gr-trellis/lib/viterbi_combined_XX_impl.cc.t b/gr-trellis/lib/viterbi_combined_XX_impl.cc.t index 95175bef95..c7cf10e567 100644 --- a/gr-trellis/lib/viterbi_combined_XX_impl.cc.t +++ b/gr-trellis/lib/viterbi_combined_XX_impl.cc.t @@ -27,7 +27,7 @@ #endif #include "@NAME@.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <iostream> namespace gr { @@ -49,9 +49,9 @@ namespace gr { int S0, int SK, int D, const std::vector<@I_TYPE@> &TABLE, digital::trellis_metric_type_t TYPE) - : gr_block("@BASE_NAME@", - gr_make_io_signature(1, -1, sizeof(@I_TYPE@)), - gr_make_io_signature(1, -1, sizeof(@O_TYPE@))), + : block("@BASE_NAME@", + io_signature::make(1, -1, sizeof(@I_TYPE@)), + io_signature::make(1, -1, sizeof(@O_TYPE@))), d_FSM(FSM), d_K(K), d_S0(S0), d_SK(SK), d_D(D), d_TABLE(TABLE), d_TYPE(TYPE)//, //d_trace(FSM.S()*K) diff --git a/gr-trellis/lib/viterbi_combined_XX_impl.h.t b/gr-trellis/lib/viterbi_combined_XX_impl.h.t index df62001110..199e8c8e88 100644 --- a/gr-trellis/lib/viterbi_combined_XX_impl.h.t +++ b/gr-trellis/lib/viterbi_combined_XX_impl.h.t @@ -25,7 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <trellis/@BASE_NAME@.h> +#include <gnuradio/trellis/@BASE_NAME@.h> namespace gr { namespace trellis { diff --git a/gr-trellis/swig/CMakeLists.txt b/gr-trellis/swig/CMakeLists.txt index c11bf02e84..d021445fb8 100644 --- a/gr-trellis/swig/CMakeLists.txt +++ b/gr-trellis/swig/CMakeLists.txt @@ -40,7 +40,7 @@ endif(ENABLE_GR_CTRLPORT) # Setup swig docs to depend on includes and pull in from build directory set(GR_SWIG_TARGET_DEPS trellis_generated_includes) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/trellis_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/trellis) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/trellis) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) GR_SWIG_MAKE(trellis_swig trellis_swig.i) diff --git a/gr-trellis/swig/trellis_swig.i b/gr-trellis/swig/trellis_swig.i index d593926b0d..2848b31d62 100644 --- a/gr-trellis/swig/trellis_swig.i +++ b/gr-trellis/swig/trellis_swig.i @@ -27,133 +27,133 @@ //load generated python docstrings %include "trellis_swig_doc.i" -%include "digital/metric_type.h" -%include "digital/constellation.h" -%include "trellis/siso_type.h" -%include "trellis/fsm.h" -%include "trellis/interleaver.h" +%include "gnuradio/digital/metric_type.h" +%include "gnuradio/digital/constellation.h" +%include "gnuradio/trellis/siso_type.h" +%include "gnuradio/trellis/fsm.h" +%include "gnuradio/trellis/interleaver.h" %{ -#include "trellis/constellation_metrics_cf.h" -#include "trellis/permutation.h" -#include "trellis/siso_combined_f.h" -#include "trellis/siso_f.h" -#include "trellis/encoder_bb.h" -#include "trellis/encoder_bs.h" -#include "trellis/encoder_bi.h" -#include "trellis/encoder_ss.h" -#include "trellis/encoder_si.h" -#include "trellis/encoder_ii.h" -#include "trellis/sccc_encoder_bb.h" -#include "trellis/sccc_encoder_bs.h" -#include "trellis/sccc_encoder_bi.h" -#include "trellis/sccc_encoder_ss.h" -#include "trellis/sccc_encoder_si.h" -#include "trellis/sccc_encoder_ii.h" -#include "trellis/pccc_encoder_bb.h" -#include "trellis/pccc_encoder_bs.h" -#include "trellis/pccc_encoder_bi.h" -#include "trellis/pccc_encoder_ss.h" -#include "trellis/pccc_encoder_si.h" -#include "trellis/pccc_encoder_ii.h" -#include "trellis/metrics_s.h" -#include "trellis/metrics_i.h" -#include "trellis/metrics_f.h" -#include "trellis/metrics_c.h" -#include "trellis/pccc_decoder_b.h" -#include "trellis/pccc_decoder_s.h" -#include "trellis/pccc_decoder_i.h" -#include "trellis/pccc_decoder_combined_fb.h" -#include "trellis/pccc_decoder_combined_fs.h" -#include "trellis/pccc_decoder_combined_fi.h" -#include "trellis/pccc_decoder_combined_cb.h" -#include "trellis/pccc_decoder_combined_cs.h" -#include "trellis/pccc_decoder_combined_ci.h" -#include "trellis/viterbi_b.h" -#include "trellis/viterbi_s.h" -#include "trellis/viterbi_i.h" -#include "trellis/viterbi_combined_sb.h" -#include "trellis/viterbi_combined_ss.h" -#include "trellis/viterbi_combined_si.h" -#include "trellis/viterbi_combined_ib.h" -#include "trellis/viterbi_combined_is.h" -#include "trellis/viterbi_combined_ii.h" -#include "trellis/viterbi_combined_fb.h" -#include "trellis/viterbi_combined_fs.h" -#include "trellis/viterbi_combined_fi.h" -#include "trellis/viterbi_combined_cb.h" -#include "trellis/viterbi_combined_cs.h" -#include "trellis/viterbi_combined_ci.h" -#include "trellis/sccc_decoder_b.h" -#include "trellis/sccc_decoder_s.h" -#include "trellis/sccc_decoder_i.h" -#include "trellis/sccc_decoder_combined_fb.h" -#include "trellis/sccc_decoder_combined_fs.h" -#include "trellis/sccc_decoder_combined_fi.h" -#include "trellis/sccc_decoder_combined_cb.h" -#include "trellis/sccc_decoder_combined_cs.h" -#include "trellis/sccc_decoder_combined_ci.h" +#include "gnuradio/trellis/constellation_metrics_cf.h" +#include "gnuradio/trellis/permutation.h" +#include "gnuradio/trellis/siso_combined_f.h" +#include "gnuradio/trellis/siso_f.h" +#include "gnuradio/trellis/encoder_bb.h" +#include "gnuradio/trellis/encoder_bs.h" +#include "gnuradio/trellis/encoder_bi.h" +#include "gnuradio/trellis/encoder_ss.h" +#include "gnuradio/trellis/encoder_si.h" +#include "gnuradio/trellis/encoder_ii.h" +#include "gnuradio/trellis/sccc_encoder_bb.h" +#include "gnuradio/trellis/sccc_encoder_bs.h" +#include "gnuradio/trellis/sccc_encoder_bi.h" +#include "gnuradio/trellis/sccc_encoder_ss.h" +#include "gnuradio/trellis/sccc_encoder_si.h" +#include "gnuradio/trellis/sccc_encoder_ii.h" +#include "gnuradio/trellis/pccc_encoder_bb.h" +#include "gnuradio/trellis/pccc_encoder_bs.h" +#include "gnuradio/trellis/pccc_encoder_bi.h" +#include "gnuradio/trellis/pccc_encoder_ss.h" +#include "gnuradio/trellis/pccc_encoder_si.h" +#include "gnuradio/trellis/pccc_encoder_ii.h" +#include "gnuradio/trellis/metrics_s.h" +#include "gnuradio/trellis/metrics_i.h" +#include "gnuradio/trellis/metrics_f.h" +#include "gnuradio/trellis/metrics_c.h" +#include "gnuradio/trellis/pccc_decoder_b.h" +#include "gnuradio/trellis/pccc_decoder_s.h" +#include "gnuradio/trellis/pccc_decoder_i.h" +#include "gnuradio/trellis/pccc_decoder_combined_fb.h" +#include "gnuradio/trellis/pccc_decoder_combined_fs.h" +#include "gnuradio/trellis/pccc_decoder_combined_fi.h" +#include "gnuradio/trellis/pccc_decoder_combined_cb.h" +#include "gnuradio/trellis/pccc_decoder_combined_cs.h" +#include "gnuradio/trellis/pccc_decoder_combined_ci.h" +#include "gnuradio/trellis/viterbi_b.h" +#include "gnuradio/trellis/viterbi_s.h" +#include "gnuradio/trellis/viterbi_i.h" +#include "gnuradio/trellis/viterbi_combined_sb.h" +#include "gnuradio/trellis/viterbi_combined_ss.h" +#include "gnuradio/trellis/viterbi_combined_si.h" +#include "gnuradio/trellis/viterbi_combined_ib.h" +#include "gnuradio/trellis/viterbi_combined_is.h" +#include "gnuradio/trellis/viterbi_combined_ii.h" +#include "gnuradio/trellis/viterbi_combined_fb.h" +#include "gnuradio/trellis/viterbi_combined_fs.h" +#include "gnuradio/trellis/viterbi_combined_fi.h" +#include "gnuradio/trellis/viterbi_combined_cb.h" +#include "gnuradio/trellis/viterbi_combined_cs.h" +#include "gnuradio/trellis/viterbi_combined_ci.h" +#include "gnuradio/trellis/sccc_decoder_b.h" +#include "gnuradio/trellis/sccc_decoder_s.h" +#include "gnuradio/trellis/sccc_decoder_i.h" +#include "gnuradio/trellis/sccc_decoder_combined_fb.h" +#include "gnuradio/trellis/sccc_decoder_combined_fs.h" +#include "gnuradio/trellis/sccc_decoder_combined_fi.h" +#include "gnuradio/trellis/sccc_decoder_combined_cb.h" +#include "gnuradio/trellis/sccc_decoder_combined_cs.h" +#include "gnuradio/trellis/sccc_decoder_combined_ci.h" %} -%include "trellis/constellation_metrics_cf.h" -%include "trellis/permutation.h" -%include "trellis/siso_combined_f.h" -%include "trellis/siso_f.h" -%include "trellis/encoder_bb.h" -%include "trellis/encoder_bs.h" -%include "trellis/encoder_bi.h" -%include "trellis/encoder_ss.h" -%include "trellis/encoder_si.h" -%include "trellis/encoder_ii.h" -%include "trellis/sccc_encoder_bb.h" -%include "trellis/sccc_encoder_bs.h" -%include "trellis/sccc_encoder_bi.h" -%include "trellis/sccc_encoder_ss.h" -%include "trellis/sccc_encoder_si.h" -%include "trellis/sccc_encoder_ii.h" -%include "trellis/pccc_encoder_bb.h" -%include "trellis/pccc_encoder_bs.h" -%include "trellis/pccc_encoder_bi.h" -%include "trellis/pccc_encoder_ss.h" -%include "trellis/pccc_encoder_si.h" -%include "trellis/pccc_encoder_ii.h" -%include "trellis/metrics_s.h" -%include "trellis/metrics_i.h" -%include "trellis/metrics_f.h" -%include "trellis/metrics_c.h" -%include "trellis/pccc_decoder_b.h" -%include "trellis/pccc_decoder_s.h" -%include "trellis/pccc_decoder_i.h" -%include "trellis/pccc_decoder_combined_fb.h" -%include "trellis/pccc_decoder_combined_fs.h" -%include "trellis/pccc_decoder_combined_fi.h" -%include "trellis/pccc_decoder_combined_cb.h" -%include "trellis/pccc_decoder_combined_cs.h" -%include "trellis/pccc_decoder_combined_ci.h" -%include "trellis/viterbi_b.h" -%include "trellis/viterbi_s.h" -%include "trellis/viterbi_i.h" -%include "trellis/viterbi_combined_sb.h" -%include "trellis/viterbi_combined_ss.h" -%include "trellis/viterbi_combined_si.h" -%include "trellis/viterbi_combined_ib.h" -%include "trellis/viterbi_combined_is.h" -%include "trellis/viterbi_combined_ii.h" -%include "trellis/viterbi_combined_fb.h" -%include "trellis/viterbi_combined_fs.h" -%include "trellis/viterbi_combined_fi.h" -%include "trellis/viterbi_combined_cb.h" -%include "trellis/viterbi_combined_cs.h" -%include "trellis/viterbi_combined_ci.h" -%include "trellis/sccc_decoder_b.h" -%include "trellis/sccc_decoder_s.h" -%include "trellis/sccc_decoder_i.h" -%include "trellis/sccc_decoder_combined_fb.h" -%include "trellis/sccc_decoder_combined_fs.h" -%include "trellis/sccc_decoder_combined_fi.h" -%include "trellis/sccc_decoder_combined_cb.h" -%include "trellis/sccc_decoder_combined_cs.h" -%include "trellis/sccc_decoder_combined_ci.h" +%include "gnuradio/trellis/constellation_metrics_cf.h" +%include "gnuradio/trellis/permutation.h" +%include "gnuradio/trellis/siso_combined_f.h" +%include "gnuradio/trellis/siso_f.h" +%include "gnuradio/trellis/encoder_bb.h" +%include "gnuradio/trellis/encoder_bs.h" +%include "gnuradio/trellis/encoder_bi.h" +%include "gnuradio/trellis/encoder_ss.h" +%include "gnuradio/trellis/encoder_si.h" +%include "gnuradio/trellis/encoder_ii.h" +%include "gnuradio/trellis/sccc_encoder_bb.h" +%include "gnuradio/trellis/sccc_encoder_bs.h" +%include "gnuradio/trellis/sccc_encoder_bi.h" +%include "gnuradio/trellis/sccc_encoder_ss.h" +%include "gnuradio/trellis/sccc_encoder_si.h" +%include "gnuradio/trellis/sccc_encoder_ii.h" +%include "gnuradio/trellis/pccc_encoder_bb.h" +%include "gnuradio/trellis/pccc_encoder_bs.h" +%include "gnuradio/trellis/pccc_encoder_bi.h" +%include "gnuradio/trellis/pccc_encoder_ss.h" +%include "gnuradio/trellis/pccc_encoder_si.h" +%include "gnuradio/trellis/pccc_encoder_ii.h" +%include "gnuradio/trellis/metrics_s.h" +%include "gnuradio/trellis/metrics_i.h" +%include "gnuradio/trellis/metrics_f.h" +%include "gnuradio/trellis/metrics_c.h" +%include "gnuradio/trellis/pccc_decoder_b.h" +%include "gnuradio/trellis/pccc_decoder_s.h" +%include "gnuradio/trellis/pccc_decoder_i.h" +%include "gnuradio/trellis/pccc_decoder_combined_fb.h" +%include "gnuradio/trellis/pccc_decoder_combined_fs.h" +%include "gnuradio/trellis/pccc_decoder_combined_fi.h" +%include "gnuradio/trellis/pccc_decoder_combined_cb.h" +%include "gnuradio/trellis/pccc_decoder_combined_cs.h" +%include "gnuradio/trellis/pccc_decoder_combined_ci.h" +%include "gnuradio/trellis/viterbi_b.h" +%include "gnuradio/trellis/viterbi_s.h" +%include "gnuradio/trellis/viterbi_i.h" +%include "gnuradio/trellis/viterbi_combined_sb.h" +%include "gnuradio/trellis/viterbi_combined_ss.h" +%include "gnuradio/trellis/viterbi_combined_si.h" +%include "gnuradio/trellis/viterbi_combined_ib.h" +%include "gnuradio/trellis/viterbi_combined_is.h" +%include "gnuradio/trellis/viterbi_combined_ii.h" +%include "gnuradio/trellis/viterbi_combined_fb.h" +%include "gnuradio/trellis/viterbi_combined_fs.h" +%include "gnuradio/trellis/viterbi_combined_fi.h" +%include "gnuradio/trellis/viterbi_combined_cb.h" +%include "gnuradio/trellis/viterbi_combined_cs.h" +%include "gnuradio/trellis/viterbi_combined_ci.h" +%include "gnuradio/trellis/sccc_decoder_b.h" +%include "gnuradio/trellis/sccc_decoder_s.h" +%include "gnuradio/trellis/sccc_decoder_i.h" +%include "gnuradio/trellis/sccc_decoder_combined_fb.h" +%include "gnuradio/trellis/sccc_decoder_combined_fs.h" +%include "gnuradio/trellis/sccc_decoder_combined_fi.h" +%include "gnuradio/trellis/sccc_decoder_combined_cb.h" +%include "gnuradio/trellis/sccc_decoder_combined_cs.h" +%include "gnuradio/trellis/sccc_decoder_combined_ci.h" GR_SWIG_BLOCK_MAGIC2(trellis, constellation_metrics_cf); GR_SWIG_BLOCK_MAGIC2(trellis, permutation); diff --git a/gr-uhd/CMakeLists.txt b/gr-uhd/CMakeLists.txt index 41926a446c..a83bcce600 100644 --- a/gr-uhd/CMakeLists.txt +++ b/gr-uhd/CMakeLists.txt @@ -92,7 +92,7 @@ CPACK_COMPONENT("uhd_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/uhd) +add_subdirectory(include/gnuradio/uhd) add_subdirectory(lib) add_subdirectory(doc) add_subdirectory(examples/c++) diff --git a/gr-uhd/examples/c++/tag_sink_demo.h b/gr-uhd/examples/c++/tag_sink_demo.h index 676005e06c..e96cd9ec3c 100644 --- a/gr-uhd/examples/c++/tag_sink_demo.h +++ b/gr-uhd/examples/c++/tag_sink_demo.h @@ -19,21 +19,22 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_sync_block.h> -#include <gr_io_signature.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/io_signature.h> #include <boost/foreach.hpp> #include <boost/format.hpp> #include <iostream> #include <complex> -class tag_sink_demo : public gr_sync_block{ +class tag_sink_demo : public gr::sync_block +{ public: tag_sink_demo(void): - gr_sync_block( + sync_block( "uhd tag sink demo", - gr_make_io_signature(1, 1, sizeof(std::complex<float>)), - gr_make_io_signature(0, 0, 0) + gr::io_signature::make(1, 1, sizeof(std::complex<float>)), + gr::io_signature::make(0, 0, 0) ) { //NOP @@ -46,11 +47,11 @@ public: ){ //grab all "rx time" tags in this work call const uint64_t samp0_count = this->nitems_read(0); - std::vector<gr_tag_t> rx_time_tags; + std::vector<gr::tag_t> rx_time_tags; get_tags_in_range(rx_time_tags, 0, samp0_count, samp0_count + ninput_items, pmt::string_to_symbol("rx_time")); //print all tags - BOOST_FOREACH(const gr_tag_t &rx_time_tag, rx_time_tags){ + BOOST_FOREACH(const gr::tag_t &rx_time_tag, rx_time_tags){ const uint64_t offset = rx_time_tag.offset; const pmt::pmt_t &value = rx_time_tag.value; diff --git a/gr-uhd/examples/c++/tag_source_demo.h b/gr-uhd/examples/c++/tag_source_demo.h index 6efe4667e5..71fb94482a 100644 --- a/gr-uhd/examples/c++/tag_source_demo.h +++ b/gr-uhd/examples/c++/tag_source_demo.h @@ -19,14 +19,15 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_sync_block.h> -#include <gr_io_signature.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/io_signature.h> #include <boost/foreach.hpp> #include <boost/format.hpp> #include <iostream> #include <complex> -class tag_source_demo : public gr_sync_block{ +class tag_source_demo : public gr::sync_block +{ public: tag_source_demo( @@ -36,10 +37,10 @@ public: const double idle_duration, const double burst_duration ): - gr_sync_block( + sync_block( "uhd tag source demo", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, sizeof(std::complex<float>)) + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(1, 1, sizeof(std::complex<float>)) ), _time_secs(start_secs), _time_fracs(start_fracs), @@ -52,7 +53,8 @@ public: //NOP } - void make_time_tag(const uint64_t tag_count){; + void make_time_tag(const uint64_t tag_count) + { const pmt::pmt_t key = pmt::string_to_symbol("tx_time"); const pmt::pmt_t value = pmt::make_tuple( pmt::from_uint64(_time_secs), @@ -62,14 +64,16 @@ public: this->add_item_tag(0/*chan0*/, tag_count, key, value, srcid); } - void make_sob_tag(const uint64_t tag_count){ + void make_sob_tag(const uint64_t tag_count) + { const pmt::pmt_t key = pmt::string_to_symbol("tx_sob"); const pmt::pmt_t value = pmt::PMT_T; const pmt::pmt_t srcid = pmt::string_to_symbol(this->name()); this->add_item_tag(0/*chan0*/, tag_count, key, value, srcid); } - void make_eob_tag(const uint64_t tag_count){; + void make_eob_tag(const uint64_t tag_count) + { const pmt::pmt_t key = pmt::string_to_symbol("tx_eob"); const pmt::pmt_t value = pmt::PMT_T; const pmt::pmt_t srcid = pmt::string_to_symbol(this->name()); @@ -79,8 +83,8 @@ public: int work( int noutput_items, gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ){ + gr_vector_void_star &output_items) + { //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++){ diff --git a/gr-uhd/examples/c++/tags_demo.cc b/gr-uhd/examples/c++/tags_demo.cc index 890cc12dea..0f87109109 100644 --- a/gr-uhd/examples/c++/tags_demo.cc +++ b/gr-uhd/examples/c++/tags_demo.cc @@ -19,9 +19,9 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_top_block.h> -#include <uhd/usrp_source.h> -#include <uhd/usrp_sink.h> +#include <gnuradio/top_block.h> +#include <gnuradio/uhd/usrp_source.h> +#include <gnuradio/uhd/usrp_sink.h> #include <tag_source_demo.h> #include <tag_sink_demo.h> #include <boost/make_shared.hpp> @@ -74,7 +74,7 @@ int main(int argc, char *argv[]){ //------------------------------------------------------------------ //-- make a top block //------------------------------------------------------------------ - gr_top_block_sptr tb = gr_make_top_block("tags_demo"); + gr::top_block_sptr tb = gr::make_top_block("tags_demo"); //------------------------------------------------------------------ //-- make the usrp source test blocks diff --git a/gr-uhd/include/uhd/CMakeLists.txt b/gr-uhd/include/gnuradio/uhd/CMakeLists.txt index 71c17b89cd..71c17b89cd 100644 --- a/gr-uhd/include/uhd/CMakeLists.txt +++ b/gr-uhd/include/gnuradio/uhd/CMakeLists.txt diff --git a/gr-uhd/include/uhd/amsg_source.h b/gr-uhd/include/gnuradio/uhd/amsg_source.h index 819f6edad2..4ef7027f13 100644 --- a/gr-uhd/include/uhd/amsg_source.h +++ b/gr-uhd/include/gnuradio/uhd/amsg_source.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_UHD_AMSG_SOURCE_H #define INCLUDED_GR_UHD_AMSG_SOURCE_H -#include <uhd/api.h> #include <uhd/usrp/multi_usrp.hpp> -#include <gr_msg_queue.h> +#include <gnuradio/uhd/api.h> +#include <gnuradio/msg_queue.h> namespace gr { namespace uhd { @@ -43,14 +43,14 @@ namespace gr { * \ingroup uhd_blk */ static sptr make(const ::uhd::device_addr_t &device_addr, - gr_msg_queue_sptr msgq); + msg_queue::sptr msgq); /*! * Convert a raw asynchronous message to an asynchronous metatdata object. * \return The asynchronous metadata object. */ static ::uhd::async_metadata_t - msg_to_async_metadata_t(const gr_message_sptr msg); + msg_to_async_metadata_t(const message::sptr msg); }; } /* namespace uhd */ diff --git a/gr-uhd/include/uhd/api.h b/gr-uhd/include/gnuradio/uhd/api.h index 106acd8c76..106acd8c76 100644 --- a/gr-uhd/include/uhd/api.h +++ b/gr-uhd/include/gnuradio/uhd/api.h diff --git a/gr-uhd/include/uhd/usrp_sink.h b/gr-uhd/include/gnuradio/uhd/usrp_sink.h index 242bc0bde6..6d21bbccdd 100644 --- a/gr-uhd/include/uhd/usrp_sink.h +++ b/gr-uhd/include/gnuradio/uhd/usrp_sink.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_UHD_USRP_SINK_H #define INCLUDED_GR_UHD_USRP_SINK_H -#include <uhd/api.h> -#include <gr_sync_block.h> +#include <gnuradio/uhd/api.h> +#include <gnuradio/sync_block.h> #include <uhd/usrp/multi_usrp.hpp> #ifndef INCLUDED_UHD_STREAM_HPP @@ -53,7 +53,7 @@ namespace gr { class uhd_usrp_sink; - class GR_UHD_API usrp_sink : virtual public gr_sync_block + class GR_UHD_API usrp_sink : virtual public sync_block { public: // gr::uhd::usrp_sink::sptr diff --git a/gr-uhd/include/uhd/usrp_source.h b/gr-uhd/include/gnuradio/uhd/usrp_source.h index 7eb0b3111d..f330ee0901 100644 --- a/gr-uhd/include/uhd/usrp_source.h +++ b/gr-uhd/include/gnuradio/uhd/usrp_source.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_UHD_USRP_SOURCE_H #define INCLUDED_GR_UHD_USRP_SOURCE_H -#include <uhd/api.h> -#include <gr_sync_block.h> +#include <gnuradio/uhd/api.h> +#include <gnuradio/sync_block.h> #include <uhd/usrp/multi_usrp.hpp> #ifndef INCLUDED_UHD_STREAM_HPP @@ -53,7 +53,7 @@ namespace gr { class uhd_usrp_source; - class GR_UHD_API usrp_source : virtual public gr_sync_block + class GR_UHD_API usrp_source : virtual public sync_block { public: // gr::uhd::usrp_source::sptr diff --git a/gr-uhd/lib/amsg_source_impl.cc b/gr-uhd/lib/amsg_source_impl.cc index cf344db202..deaff232d1 100644 --- a/gr-uhd/lib/amsg_source_impl.cc +++ b/gr-uhd/lib/amsg_source_impl.cc @@ -29,7 +29,7 @@ namespace gr { amsg_source::sptr amsg_source::make(const ::uhd::device_addr_t &device_addr, - gr_msg_queue_sptr msgq) + msg_queue::sptr msgq) { check_abi(); return amsg_source::sptr @@ -37,13 +37,13 @@ namespace gr { } ::uhd::async_metadata_t - amsg_source::msg_to_async_metadata_t(const gr_message_sptr msg) + amsg_source::msg_to_async_metadata_t(const message::sptr msg) { return *(::uhd::async_metadata_t *)msg->msg(); } amsg_source_impl::amsg_source_impl(const ::uhd::device_addr_t &device_addr, - gr_msg_queue_sptr msgq) + msg_queue::sptr msgq) : _msgq(msgq), _running(true) { _dev = ::uhd::usrp::multi_usrp::make(device_addr); @@ -60,11 +60,11 @@ namespace gr { void amsg_source_impl::recv_loop() { - gr_message_sptr msg; + message::sptr msg; ::uhd::async_metadata_t *md; while(_running) { - msg = gr_make_message(0, 0.0, 0.0, sizeof(::uhd::async_metadata_t)); + msg = message::make(0, 0.0, 0.0, sizeof(::uhd::async_metadata_t)); md = (::uhd::async_metadata_t*) msg->msg(); while(!_dev->get_device()->recv_async_msg(*md, 0.1)) { @@ -77,7 +77,7 @@ namespace gr { } void - amsg_source_impl::post(gr_message_sptr msg) + amsg_source_impl::post(message::sptr msg) { _msgq->insert_tail(msg); } diff --git a/gr-uhd/lib/amsg_source_impl.h b/gr-uhd/lib/amsg_source_impl.h index f0f3d4bfb1..5bba3627f7 100644 --- a/gr-uhd/lib/amsg_source_impl.h +++ b/gr-uhd/lib/amsg_source_impl.h @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <uhd/amsg_source.h> -#include <thread/thread.h> +#include <gnuradio/uhd/amsg_source.h> +#include <gnuradio/thread/thread.h> namespace gr { namespace uhd { @@ -30,16 +30,16 @@ namespace gr { { public: amsg_source_impl(const ::uhd::device_addr_t &device_addr, - gr_msg_queue_sptr msgq); + msg_queue::sptr msgq); ~amsg_source_impl(); void recv_loop(); - void post(gr_message_sptr msg); + void post(message::sptr msg); protected: ::uhd::usrp::multi_usrp::sptr _dev; gr::thread::thread _amsg_thread; - gr_msg_queue_sptr _msgq; + msg_queue::sptr _msgq; bool _running; }; diff --git a/gr-uhd/lib/usrp_sink_impl.cc b/gr-uhd/lib/usrp_sink_impl.cc index 8a315a2e40..d38ffc344d 100644 --- a/gr-uhd/lib/usrp_sink_impl.cc +++ b/gr-uhd/lib/usrp_sink_impl.cc @@ -22,7 +22,7 @@ #include "usrp_sink_impl.h" #include "gr_uhd_common.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <boost/make_shared.hpp> #include <stdexcept> @@ -60,9 +60,9 @@ namespace gr { usrp_sink_impl::usrp_sink_impl(const ::uhd::device_addr_t &device_addr, const ::uhd::stream_args_t &stream_args) - : gr_sync_block("gr uhd usrp sink", + : sync_block("gr uhd usrp sink", args_to_io_sig(stream_args), - gr_make_io_signature(0, 0, 0)), + io_signature::make(0, 0, 0)), _stream_args(stream_args), _nchan(std::max<size_t>(1, stream_args.channels.size())), _stream_now(_nchan == 1), @@ -473,10 +473,10 @@ namespace gr { usrp_sink_impl::tag_work(int &ninput_items) { //the for loop below assumes tags sorted by count low -> high - std::sort(_tags.begin(), _tags.end(), gr_tag_t::offset_compare); + std::sort(_tags.begin(), _tags.end(), tag_t::offset_compare); //extract absolute sample counts - const gr_tag_t &tag0 = _tags.front(); + const tag_t &tag0 = _tags.front(); const uint64_t tag0_count = tag0.offset; const uint64_t samp0_count = this->nitems_read(0); @@ -491,7 +491,7 @@ namespace gr { _metadata.has_time_spec = false; //process all of the tags found with the same count as tag0 - BOOST_FOREACH(const gr_tag_t &my_tag, _tags) { + BOOST_FOREACH(const tag_t &my_tag, _tags) { const uint64_t my_tag_count = my_tag.offset; const pmt::pmt_t &key = my_tag.key; const pmt::pmt_t &value = my_tag.value; diff --git a/gr-uhd/lib/usrp_sink_impl.h b/gr-uhd/lib/usrp_sink_impl.h index b75dc1dc6d..c714eb53eb 100644 --- a/gr-uhd/lib/usrp_sink_impl.h +++ b/gr-uhd/lib/usrp_sink_impl.h @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <uhd/usrp_sink.h> +#include <gnuradio/uhd/usrp_sink.h> #include <uhd/convert.hpp> static const pmt::pmt_t SOB_KEY = pmt::string_to_symbol("tx_sob"); @@ -30,7 +30,7 @@ static const pmt::pmt_t TIME_KEY = pmt::string_to_symbol("tx_time"); namespace gr { namespace uhd { - inline gr_io_signature_sptr + inline io_signature::sptr args_to_io_sig(const ::uhd::stream_args_t &args) { const size_t nchan = std::max<size_t>(args.channels.size(), 1); @@ -43,7 +43,7 @@ namespace gr { if(args.cpu_format == "sc16") size = 4; #endif - return gr_make_io_signature(nchan, nchan, size); + return io_signature::make(nchan, nchan, size); } /*********************************************************************** @@ -134,7 +134,7 @@ namespace gr { bool _start_time_set; //stream tags related stuff - std::vector<gr_tag_t> _tags; + std::vector<tag_t> _tags; }; } /* namespace uhd */ diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc index 50c144fb86..c5df60222a 100644 --- a/gr-uhd/lib/usrp_source_impl.cc +++ b/gr-uhd/lib/usrp_source_impl.cc @@ -22,7 +22,7 @@ #include "usrp_source_impl.h" #include "gr_uhd_common.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <boost/format.hpp> #include <boost/thread/thread.hpp> #include <boost/make_shared.hpp> @@ -63,8 +63,8 @@ namespace gr { usrp_source_impl::usrp_source_impl(const ::uhd::device_addr_t &device_addr, const ::uhd::stream_args_t &stream_args): - gr_sync_block("gr uhd usrp source", - gr_make_io_signature(0, 0, 0), + sync_block("gr uhd usrp source", + io_signature::make(0, 0, 0), args_to_io_sig(stream_args)), _stream_args(stream_args), _nchan(std::max<size_t>(1, stream_args.channels.size())), diff --git a/gr-uhd/lib/usrp_source_impl.h b/gr-uhd/lib/usrp_source_impl.h index 218cc9b6e3..58bb21551c 100644 --- a/gr-uhd/lib/usrp_source_impl.h +++ b/gr-uhd/lib/usrp_source_impl.h @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <uhd/usrp_source.h> +#include <gnuradio/uhd/usrp_source.h> #include <uhd/convert.hpp> static const pmt::pmt_t TIME_KEY = pmt::string_to_symbol("rx_time"); @@ -30,7 +30,7 @@ static const pmt::pmt_t FREQ_KEY = pmt::string_to_symbol("rx_freq"); namespace gr { namespace uhd { - inline gr_io_signature_sptr + inline io_signature::sptr args_to_io_sig(const ::uhd::stream_args_t &args) { const size_t nchan = std::max<size_t>(args.channels.size(), 1); @@ -43,7 +43,7 @@ namespace gr { if(args.cpu_format == "sc16") size = 4; #endif - return gr_make_io_signature(nchan, nchan, size); + return io_signature::make(nchan, nchan, size); } /*********************************************************************** diff --git a/gr-uhd/swig/CMakeLists.txt b/gr-uhd/swig/CMakeLists.txt index 94d84a64bc..4084bc07e9 100644 --- a/gr-uhd/swig/CMakeLists.txt +++ b/gr-uhd/swig/CMakeLists.txt @@ -38,7 +38,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/uhd_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/uhd) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/uhd) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) link_directories(${UHD_LIBRARY_DIRS}) diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 3df3c885b6..56f7b5eadd 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -41,9 +41,9 @@ // block headers //////////////////////////////////////////////////////////////////////// %{ -#include <uhd/usrp_source.h> -#include <uhd/usrp_sink.h> -#include <uhd/amsg_source.h> +#include <gnuradio/uhd/usrp_source.h> +#include <gnuradio/uhd/usrp_sink.h> +#include <gnuradio/uhd/amsg_source.h> %} //////////////////////////////////////////////////////////////////////// @@ -83,6 +83,9 @@ %include <uhd/types/sensors.hpp> +// Prevents issue with vector<size_t> redef on 32-bit systems +%import <uhd/stream.hpp> + //////////////////////////////////////////////////////////////////////// // swig dboard_iface for python access //////////////////////////////////////////////////////////////////////// @@ -95,9 +98,9 @@ //////////////////////////////////////////////////////////////////////// // block magic //////////////////////////////////////////////////////////////////////// -%include <uhd/usrp_source.h> -%include <uhd/usrp_sink.h> -%include <uhd/amsg_source.h> +%include <gnuradio/uhd/usrp_source.h> +%include <gnuradio/uhd/usrp_sink.h> +%include <gnuradio/uhd/amsg_source.h> GR_SWIG_BLOCK_MAGIC2(uhd, usrp_source) GR_SWIG_BLOCK_MAGIC2(uhd, usrp_sink) diff --git a/gr-utils/python/modtool/code_generator.py b/gr-utils/python/modtool/code_generator.py index fbe9aa92c2..33cebc68c4 100644 --- a/gr-utils/python/modtool/code_generator.py +++ b/gr-utils/python/modtool/code_generator.py @@ -31,14 +31,14 @@ class GRMTemplate(Cheetah.Template.Template): """ An extended template class """ def __init__(self, src, searchList): self.grtypelist = { - 'sync': 'gr_sync_block', - 'sink': 'gr_sync_block', - 'source': 'gr_sync_block', - 'decimator': 'gr_sync_decimator', - 'interpolator': 'gr_sync_interpolator', - 'general': 'gr_block', - 'tagged_stream': 'gr_tagged_stream_block', - 'hier': 'gr_hier_block2', + 'sync': 'sync_block', + 'sink': 'sync_block', + 'source': 'sync_block', + 'decimator': 'sync_decimator', + 'interpolator': 'sync_interpolator', + 'general': 'block', + 'tagged_stream': 'tagged_stream_block', + 'hier': 'hier_block2', 'noblock': ''} searchList['str_to_fancyc_comment'] = str_to_fancyc_comment searchList['str_to_python_comment'] = str_to_python_comment diff --git a/gr-utils/python/modtool/gr-newmod/include/howto/api.h b/gr-utils/python/modtool/gr-newmod/include/howto/api.h index 0c20712786..db5f81f394 100644 --- a/gr-utils/python/modtool/gr-newmod/include/howto/api.h +++ b/gr-utils/python/modtool/gr-newmod/include/howto/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_HOWTO_API_H #define INCLUDED_HOWTO_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_howto_EXPORTS # define HOWTO_API __GR_ATTR_EXPORT diff --git a/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h b/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h index 069afd38ae..23f0f7f33e 100644 --- a/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h +++ b/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h @@ -23,7 +23,7 @@ #ifndef _QA_HOWTO_H_ #define _QA_HOWTO_H_ -#include <attributes.h> +#include <gnuradio/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for the gr-filter directory diff --git a/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc b/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc index 9c5faa0eba..f01bd5a064 100644 --- a/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc +++ b/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc @@ -27,7 +27,7 @@ #include <cppunit/TextTestRunner.h> #include <cppunit/XmlOutputter.h> -#include <gr_unittests.h> +#include <gnuradio/unittests.h> #include "qa_howto.h" #include <iostream> diff --git a/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt index bfcf3d521f..b9925ea06f 100644 --- a/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt @@ -32,7 +32,7 @@ include(GrPython) # Setup swig generation ######################################################################## foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS}) - list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/swig) + list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig) endforeach(incdir) set(GR_SWIG_LIBRARIES gnuradio-howto) diff --git a/gr-utils/python/modtool/parser_cc_block.py b/gr-utils/python/modtool/parser_cc_block.py index 0d1d75f29a..703522c8fb 100644 --- a/gr-utils/python/modtool/parser_cc_block.py +++ b/gr-utils/python/modtool/parser_cc_block.py @@ -41,7 +41,7 @@ class ParserCCBlock(object): """ From a type identifier, returns the data type. E.g., for sizeof(int), it will return 'int'. Returns a list! """ - if 'gr_make_iosignaturev' in iosigcall: + if 'gr::io_signature::makev' in iosigcall: print 'tbi' raise ValueError return {'type': [_typestr_to_iotype(x) for x in typestr.split(',')], @@ -72,9 +72,9 @@ class ParserCCBlock(object): elif len(vlen_parts) > 1: return '*'.join(vlen_parts).strip() iosig = {} - iosig_regex = '(?P<incall>gr_make_io_signature[23v]?)\s*\(\s*(?P<inmin>[^,]+),\s*(?P<inmax>[^,]+),' + \ + iosig_regex = '(?P<incall>gr::io_signature::make[23v]?)\s*\(\s*(?P<inmin>[^,]+),\s*(?P<inmax>[^,]+),' + \ '\s*(?P<intype>(\([^\)]*\)|[^)])+)\),\s*' + \ - '(?P<outcall>gr_make_io_signature[23v]?)\s*\(\s*(?P<outmin>[^,]+),\s*(?P<outmax>[^,]+),' + \ + '(?P<outcall>gr::io_signature::make[23v]?)\s*\(\s*(?P<outmin>[^,]+),\s*(?P<outmax>[^,]+),' + \ '\s*(?P<outtype>(\([^\)]*\)|[^)])+)\)' iosig_match = re.compile(iosig_regex, re.MULTILINE).search(self.code_cc) try: diff --git a/gr-utils/python/modtool/templates.py b/gr-utils/python/modtool/templates.py index 4f4469951c..0b6176a513 100644 --- a/gr-utils/python/modtool/templates.py +++ b/gr-utils/python/modtool/templates.py @@ -105,7 +105,7 @@ ${str_to_fancyc_comment($license)} \#include "config.h" \#endif -\#include <gr_io_signature.h> +\#include <gnuradio/io_signature.h> #if $blocktype == 'noblock' \#include <${modname}/${blockname}.h> #else @@ -153,9 +153,9 @@ namespace gr { * The private constructor */ ${blockname}_impl::${blockname}_impl(${strip_default_values($arglist)}) - : ${grblocktype}("${blockname}", - gr_make_io_signature($inputsig), - gr_make_io_signature($outputsig)$decimation) + : gr::${grblocktype}("${blockname}", + gr::io_signature::make($inputsig), + gr::io_signature::make($outputsig)$decimation) #if $blocktype == 'hier' { connect(self(), 0, d_firstblock, 0); @@ -251,7 +251,7 @@ ${str_to_fancyc_comment($license)} \#define INCLUDED_${modname.upper()}_${blockname.upper()}_H \#include <${modname}/api.h> -\#include <${grblocktype}.h> +\#include <gnuradio/${grblocktype}.h> namespace gr { namespace ${modname} { @@ -273,7 +273,7 @@ namespace gr { * \ingroup ${modname} * */ - class ${modname.upper()}_API ${blockname} : virtual public $grblocktype + class ${modname.upper()}_API ${blockname} : virtual public gr::$grblocktype { public: typedef boost::shared_ptr<${blockname}> sptr; @@ -297,7 +297,7 @@ namespace gr { ''' -# Python block (from grextras!) +# Python block Templates['block_python'] = '''\#!/usr/bin/env python ${str_to_python_comment($license)} # @@ -587,7 +587,7 @@ ${modname}_make_${blockname} (${strip_default_values($arglist)}) * The private constructor */ ${modname}_${blockname}::${modname}_${blockname} (${strip_default_values($arglist)}) - : ${grblocktype} ("${blockname}", + : gr_${grblocktype} ("${blockname}", gr_make_io_signature($inputsig), gr_make_io_signature($outputsig)$decimation) { @@ -672,7 +672,7 @@ class ${modname.upper()}_API $blockname }; #else -\#include <${grblocktype}.h> +\#include <gr_${grblocktype}.h> class ${modname}_${blockname}; @@ -685,7 +685,7 @@ ${modname.upper()}_API ${modname}_${blockname}_sptr ${modname}_make_${blockname} * \ingroup ${modname} * */ -class ${modname.upper()}_API ${modname}_${blockname} : public $grblocktype +class ${modname.upper()}_API ${modname}_${blockname} : public gr_$grblocktype { private: friend ${modname.upper()}_API ${modname}_${blockname}_sptr ${modname}_make_${blockname} (${strip_default_values($arglist)}); diff --git a/gr-video-sdl/CMakeLists.txt b/gr-video-sdl/CMakeLists.txt index d0f230892c..82fab5c41e 100644 --- a/gr-video-sdl/CMakeLists.txt +++ b/gr-video-sdl/CMakeLists.txt @@ -81,7 +81,7 @@ CPACK_COMPONENT("video_sdl_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/video_sdl) +add_subdirectory(include/gnuradio/video_sdl) add_subdirectory(lib) if(ENABLE_PYTHON) add_subdirectory(swig) diff --git a/gr-video-sdl/include/video_sdl/CMakeLists.txt b/gr-video-sdl/include/gnuradio/video_sdl/CMakeLists.txt index 8831fd8172..8831fd8172 100644 --- a/gr-video-sdl/include/video_sdl/CMakeLists.txt +++ b/gr-video-sdl/include/gnuradio/video_sdl/CMakeLists.txt diff --git a/gr-video-sdl/include/video_sdl/api.h b/gr-video-sdl/include/gnuradio/video_sdl/api.h index 981292658c..b9df5fd060 100644 --- a/gr-video-sdl/include/video_sdl/api.h +++ b/gr-video-sdl/include/gnuradio/video_sdl/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_VIDEO_SDL_API_H #define INCLUDED_VIDEO_SDL_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_video_sdl_EXPORTS # define VIDEO_SDL_API __GR_ATTR_EXPORT diff --git a/gr-video-sdl/include/video_sdl/sink_s.h b/gr-video-sdl/include/gnuradio/video_sdl/sink_s.h index 2e2a9085e4..bc5b6eea13 100644 --- a/gr-video-sdl/include/video_sdl/sink_s.h +++ b/gr-video-sdl/include/gnuradio/video_sdl/sink_s.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VIDEO_SDL_SINK_S_H #define INCLUDED_VIDEO_SDL_SINK_S_H -#include <video_sdl/api.h> -#include <gr_sync_block.h> +#include <gnuradio/video_sdl/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace video_sdl { @@ -38,7 +38,7 @@ namespace gr { * Three streams: first is grey (Y), second is U, third is V * Input samples must be in the range [0,255]. */ - class VIDEO_SDL_API sink_s : virtual public gr_sync_block + class VIDEO_SDL_API sink_s : virtual public sync_block { public: // gr::video_sdl::sink_s::sptr diff --git a/gr-video-sdl/include/video_sdl/sink_uc.h b/gr-video-sdl/include/gnuradio/video_sdl/sink_uc.h index 215847fc0b..222eb117e0 100644 --- a/gr-video-sdl/include/video_sdl/sink_uc.h +++ b/gr-video-sdl/include/gnuradio/video_sdl/sink_uc.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VIDEO_SDL_SINK_UC_H #define INCLUDED_VIDEO_SDL_SINK_UC_H -#include <video_sdl/api.h> -#include <gr_sync_block.h> +#include <gnuradio/video_sdl/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace video_sdl { @@ -38,7 +38,7 @@ namespace gr { * Three streams: first is grey (Y), second is U, third is V * Input samples must be in the range [0,255]. */ - class VIDEO_SDL_API sink_uc : virtual public gr_sync_block + class VIDEO_SDL_API sink_uc : virtual public sync_block { public: // gr::video_sdl::sink_uc::sptr diff --git a/gr-video-sdl/lib/sink_s_impl.cc b/gr-video-sdl/lib/sink_s_impl.cc index 2da9442d63..3ca19840ba 100644 --- a/gr-video-sdl/lib/sink_s_impl.cc +++ b/gr-video-sdl/lib/sink_s_impl.cc @@ -25,7 +25,7 @@ #endif #include "sink_s_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -50,9 +50,9 @@ namespace gr { sink_s_impl::sink_s_impl(double framerate, int width, int height, unsigned int format, int dst_width, int dst_height) - : gr_sync_block("video_sdl_sink_s", - gr_make_io_signature(1, 3, sizeof(short)), - gr_make_io_signature(0, 0, 0)), + : sync_block("video_sdl_sink_s", + io_signature::make(1, 3, sizeof(short)), + io_signature::make(0, 0, 0)), d_chunk_size(width*height), d_framerate(framerate), d_wanted_frametime_ms(0), d_width(width), d_height(height), d_dst_width(dst_width), d_dst_height(dst_height), diff --git a/gr-video-sdl/lib/sink_s_impl.h b/gr-video-sdl/lib/sink_s_impl.h index 8d20cb6596..3160d9e218 100644 --- a/gr-video-sdl/lib/sink_s_impl.h +++ b/gr-video-sdl/lib/sink_s_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VIDEO_SDL_SINK_S_IMPL_H #define INCLUDED_VIDEO_SDL_SINK_S_IMPL_H -#include <video_sdl/sink_s.h> +#include <gnuradio/video_sdl/sink_s.h> #include <SDL.h> namespace gr { diff --git a/gr-video-sdl/lib/sink_uc_impl.cc b/gr-video-sdl/lib/sink_uc_impl.cc index 28333e2413..85176704f9 100644 --- a/gr-video-sdl/lib/sink_uc_impl.cc +++ b/gr-video-sdl/lib/sink_uc_impl.cc @@ -25,7 +25,7 @@ #endif #include "sink_uc_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -49,9 +49,9 @@ namespace gr { sink_uc_impl::sink_uc_impl(double framerate, int width, int height, unsigned int format, int dst_width, int dst_height) - : gr_sync_block("video_sdl_sink_uc", - gr_make_io_signature(1, 3, sizeof(unsigned char)), - gr_make_io_signature(0, 0, 0)), + : sync_block("video_sdl_sink_uc", + io_signature::make(1, 3, sizeof(unsigned char)), + io_signature::make(0, 0, 0)), d_chunk_size(width*height), d_framerate(framerate), d_wanted_frametime_ms(0), d_width(width), d_height(height), d_dst_width(dst_width), d_dst_height(dst_height), diff --git a/gr-video-sdl/lib/sink_uc_impl.h b/gr-video-sdl/lib/sink_uc_impl.h index 927510745f..c1a79b0d25 100644 --- a/gr-video-sdl/lib/sink_uc_impl.h +++ b/gr-video-sdl/lib/sink_uc_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VIDEO_SDL_SINK_UC_IMPL_H #define INCLUDED_VIDEO_SDL_SINK_UC_IMPL_H -#include <video_sdl/sink_uc.h> +#include <gnuradio/video_sdl/sink_uc.h> #include <SDL.h> namespace gr { diff --git a/gr-video-sdl/swig/CMakeLists.txt b/gr-video-sdl/swig/CMakeLists.txt index 26169bf0b9..df64cb38d3 100644 --- a/gr-video-sdl/swig/CMakeLists.txt +++ b/gr-video-sdl/swig/CMakeLists.txt @@ -39,7 +39,7 @@ endif(ENABLE_GR_CTRLPORT) # Setup swig docs to depend on includes and pull in from build directory set(GR_SWIG_TARGET_DEPS video_sdl_generated_includes) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/video_sdl_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/video_sdl) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/video_sdl) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_LIBRARIES gnuradio-video-sdl) diff --git a/gr-video-sdl/swig/video_sdl_swig.i b/gr-video-sdl/swig/video_sdl_swig.i index d66201d670..f5db34151a 100644 --- a/gr-video-sdl/swig/video_sdl_swig.i +++ b/gr-video-sdl/swig/video_sdl_swig.i @@ -28,12 +28,12 @@ %include "video_sdl_swig_doc.i" %{ -#include "video_sdl/sink_uc.h" -#include "video_sdl/sink_s.h" +#include "gnuradio/video_sdl/sink_uc.h" +#include "gnuradio/video_sdl/sink_s.h" %} -%include "video_sdl/sink_uc.h" -%include "video_sdl/sink_s.h" +%include "gnuradio/video_sdl/sink_uc.h" +%include "gnuradio/video_sdl/sink_s.h" GR_SWIG_BLOCK_MAGIC2(video_sdl, sink_uc); GR_SWIG_BLOCK_MAGIC2(video_sdl, sink_s); diff --git a/gr-vocoder/CMakeLists.txt b/gr-vocoder/CMakeLists.txt index 47c64369a2..bfaea7f12f 100644 --- a/gr-vocoder/CMakeLists.txt +++ b/gr-vocoder/CMakeLists.txt @@ -91,7 +91,7 @@ CPACK_COMPONENT("vocoder_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/vocoder) +add_subdirectory(include/gnuradio/vocoder) add_subdirectory(lib) add_subdirectory(doc) if(ENABLE_PYTHON) diff --git a/gr-vocoder/include/vocoder/CMakeLists.txt b/gr-vocoder/include/gnuradio/vocoder/CMakeLists.txt index ea0562f36f..ea0562f36f 100644 --- a/gr-vocoder/include/vocoder/CMakeLists.txt +++ b/gr-vocoder/include/gnuradio/vocoder/CMakeLists.txt diff --git a/gr-vocoder/include/vocoder/alaw_decode_bs.h b/gr-vocoder/include/gnuradio/vocoder/alaw_decode_bs.h index 9966512c2a..431859762c 100644 --- a/gr-vocoder/include/vocoder/alaw_decode_bs.h +++ b/gr-vocoder/include/gnuradio/vocoder/alaw_decode_bs.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_ALAW_DECODE_BS_H #define INCLUDED_VOCODER_ALAW_DECODE_BS_H -#include <vocoder/api.h> -#include <gr_sync_block.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace vocoder { @@ -33,7 +33,7 @@ namespace gr { * \brief This block performs alaw audio decoding. * \ingroup audio_blk */ - class VOCODER_API alaw_decode_bs : virtual public gr_sync_block + class VOCODER_API alaw_decode_bs : virtual public sync_block { public: // gr::vocoder::alaw_decode_bs::sptr diff --git a/gr-vocoder/include/vocoder/alaw_encode_sb.h b/gr-vocoder/include/gnuradio/vocoder/alaw_encode_sb.h index e944a93455..c81018ee5f 100644 --- a/gr-vocoder/include/vocoder/alaw_encode_sb.h +++ b/gr-vocoder/include/gnuradio/vocoder/alaw_encode_sb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_ALAW_ENCODER_SB_H #define INCLUDED_VOCODER_ALAW_ENCODER_SB_H -#include <vocoder/api.h> -#include <gr_sync_block.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace vocoder { @@ -33,7 +33,7 @@ namespace gr { * \brief This block performs g.711 alaw audio encoding. * \ingroup audio_blk */ - class VOCODER_API alaw_encode_sb : virtual public gr_sync_block + class VOCODER_API alaw_encode_sb : virtual public sync_block { public: // gr::vocoder::alaw_encode_sb::sptr diff --git a/gr-vocoder/include/vocoder/api.h b/gr-vocoder/include/gnuradio/vocoder/api.h index 613a19f4bc..425e397b9d 100644 --- a/gr-vocoder/include/vocoder/api.h +++ b/gr-vocoder/include/gnuradio/vocoder/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_VOCODER_API_H #define INCLUDED_VOCODER_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_vocoder_EXPORTS # define VOCODER_API __GR_ATTR_EXPORT diff --git a/gr-vocoder/include/vocoder/codec2_decode_ps.h b/gr-vocoder/include/gnuradio/vocoder/codec2_decode_ps.h index 9c0d1526b8..e90e7b9560 100644 --- a/gr-vocoder/include/vocoder/codec2_decode_ps.h +++ b/gr-vocoder/include/gnuradio/vocoder/codec2_decode_ps.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_CODEC2_DECODE_PS_H #define INCLUDED_VOCODER_CODEC2_DECODE_PS_H -#include <vocoder/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace vocoder { @@ -33,7 +33,7 @@ namespace gr { * \brief CODEC2 Vocoder Decoder * \ingroup audio_blk */ - class VOCODER_API codec2_decode_ps : virtual public gr_sync_interpolator + class VOCODER_API codec2_decode_ps : virtual public sync_interpolator { public: // gr::vocoder::codec2_decode_ps::sptr diff --git a/gr-vocoder/include/vocoder/codec2_encode_sp.h b/gr-vocoder/include/gnuradio/vocoder/codec2_encode_sp.h index 2960bee04b..9fe1c2dd43 100644 --- a/gr-vocoder/include/vocoder/codec2_encode_sp.h +++ b/gr-vocoder/include/gnuradio/vocoder/codec2_encode_sp.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_CODEC2_ENCODE_SP_H #define INCLUDED_VOCODER_CODEC2_ENCODE_SP_H -#include <vocoder/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace vocoder { @@ -33,7 +33,7 @@ namespace gr { * \brief CODEC2 Vocoder Encoder * \ingroup audio_blk */ - class VOCODER_API codec2_encode_sp : virtual public gr_sync_decimator + class VOCODER_API codec2_encode_sp : virtual public sync_decimator { public: // gr::vocoder::codec2_encode_sp::sptr diff --git a/gr-vocoder/include/vocoder/cvsd_decode_bs.h b/gr-vocoder/include/gnuradio/vocoder/cvsd_decode_bs.h index 03dedffbbd..324dcea1a1 100644 --- a/gr-vocoder/include/vocoder/cvsd_decode_bs.h +++ b/gr-vocoder/include/gnuradio/vocoder/cvsd_decode_bs.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_CVSD_DECODE_BS_H #define INCLUDED_VOCODER_CVSD_DECODE_BS_H -#include <vocoder/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace vocoder { @@ -83,7 +83,7 @@ namespace gr { * Bluetooth Voice Simulink� Model, Available: * http://www.mathworks.com/company/newsletters/digest/nov01/bluetooth.html */ - class VOCODER_API cvsd_decode_bs : virtual public gr_sync_interpolator + class VOCODER_API cvsd_decode_bs : virtual public sync_interpolator { public: // gr::vocoder::cvsd_decode_bs::sptr diff --git a/gr-vocoder/include/vocoder/cvsd_encode_sb.h b/gr-vocoder/include/gnuradio/vocoder/cvsd_encode_sb.h index c12269562e..7b7cea712e 100644 --- a/gr-vocoder/include/vocoder/cvsd_encode_sb.h +++ b/gr-vocoder/include/gnuradio/vocoder/cvsd_encode_sb.h @@ -22,8 +22,8 @@ #ifndef INCLUDED_VOCODER_CVSD_ENCODER_SB_H #define INCLUDED_VOCODER_CVSD_ENCODER_SB_H -#include <vocoder/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace vocoder { @@ -84,7 +84,7 @@ namespace gr { * Bluetooth Voice Simulink� Model, Available: * http://www.mathworks.com/company/newsletters/digest/nov01/bluetooth.html */ - class VOCODER_API cvsd_encode_sb : virtual public gr_sync_decimator + class VOCODER_API cvsd_encode_sb : virtual public sync_decimator { public: // gr::vocoder::cvsd_encode_sb::sptr diff --git a/gr-vocoder/include/vocoder/g721_decode_bs.h b/gr-vocoder/include/gnuradio/vocoder/g721_decode_bs.h index 05459ccb3d..46444d569a 100644 --- a/gr-vocoder/include/vocoder/g721_decode_bs.h +++ b/gr-vocoder/include/gnuradio/vocoder/g721_decode_bs.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_G721_DECODE_BS_H #define INCLUDED_VOCODER_G721_DECODE_BS_H -#include <vocoder/api.h> -#include <gr_sync_block.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace vocoder { @@ -33,7 +33,7 @@ namespace gr { * \brief This block performs g721 audio decoding. * \ingroup audio_blk */ - class VOCODER_API g721_decode_bs : virtual public gr_sync_block + class VOCODER_API g721_decode_bs : virtual public sync_block { public: // gr::vocoder::g721_decode_bs::sptr diff --git a/gr-vocoder/include/vocoder/g721_encode_sb.h b/gr-vocoder/include/gnuradio/vocoder/g721_encode_sb.h index af03b855c3..2ae717d4b7 100644 --- a/gr-vocoder/include/vocoder/g721_encode_sb.h +++ b/gr-vocoder/include/gnuradio/vocoder/g721_encode_sb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_G721_ENCODE_SB_H #define INCLUDED_VOCODER_G721_ENCODE_SB_H -#include <vocoder/api.h> -#include <gr_sync_block.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace vocoder { @@ -33,7 +33,7 @@ namespace gr { * \brief This block performs g721 audio encoding. * \ingroup audio_blk */ - class VOCODER_API g721_encode_sb : virtual public gr_sync_block + class VOCODER_API g721_encode_sb : virtual public sync_block { public: // gr::vocoder::g721_encode_sb::sptr diff --git a/gr-vocoder/include/vocoder/g723_24_decode_bs.h b/gr-vocoder/include/gnuradio/vocoder/g723_24_decode_bs.h index e91354071d..74acd57a40 100644 --- a/gr-vocoder/include/vocoder/g723_24_decode_bs.h +++ b/gr-vocoder/include/gnuradio/vocoder/g723_24_decode_bs.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_G723_24_DECODE_BS_H #define INCLUDED_VOCODER_G723_24_DECODE_BS_H -#include <vocoder/api.h> -#include <gr_sync_block.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace vocoder { @@ -33,7 +33,7 @@ namespace gr { * \brief This block performs g723_24 audio decoding. * \ingroup audio_blk */ - class VOCODER_API g723_24_decode_bs : virtual public gr_sync_block + class VOCODER_API g723_24_decode_bs : virtual public sync_block { public: // gr::vocoder::g723_24_decode_bs::sptr diff --git a/gr-vocoder/include/vocoder/g723_24_encode_sb.h b/gr-vocoder/include/gnuradio/vocoder/g723_24_encode_sb.h index c63a9ec84b..9a08eafed3 100644 --- a/gr-vocoder/include/vocoder/g723_24_encode_sb.h +++ b/gr-vocoder/include/gnuradio/vocoder/g723_24_encode_sb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_G723_24_ENCODE_SB_H #define INCLUDED_VOCODER_G723_24_ENCODE_SB_H -#include <vocoder/api.h> -#include <gr_sync_block.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace vocoder { @@ -33,7 +33,7 @@ namespace gr { * \brief This block performs g723_24 audio encoding. * \ingroup audio_blk */ - class VOCODER_API g723_24_encode_sb : virtual public gr_sync_block + class VOCODER_API g723_24_encode_sb : virtual public sync_block { public: // gr::vocoder::g723_24_encode_sb::sptr diff --git a/gr-vocoder/include/vocoder/g723_40_decode_bs.h b/gr-vocoder/include/gnuradio/vocoder/g723_40_decode_bs.h index 433e74149c..b1d9f6fe3c 100644 --- a/gr-vocoder/include/vocoder/g723_40_decode_bs.h +++ b/gr-vocoder/include/gnuradio/vocoder/g723_40_decode_bs.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_G723_40_DECODE_BS_H #define INCLUDED_VOCODER_G723_40_DECODE_BS_H -#include <vocoder/api.h> -#include <gr_sync_block.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace vocoder { @@ -33,7 +33,7 @@ namespace gr { * \brief This block performs g723_40 audio decoding. * \ingroup audio_blk */ - class VOCODER_API g723_40_decode_bs : virtual public gr_sync_block + class VOCODER_API g723_40_decode_bs : virtual public sync_block { public: // gr::vocoder::g723_40_decode_bs::sptr diff --git a/gr-vocoder/include/vocoder/g723_40_encode_sb.h b/gr-vocoder/include/gnuradio/vocoder/g723_40_encode_sb.h index af28996412..05ddfed552 100644 --- a/gr-vocoder/include/vocoder/g723_40_encode_sb.h +++ b/gr-vocoder/include/gnuradio/vocoder/g723_40_encode_sb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_G723_40_ENCODE_SB_H #define INCLUDED_VOCODER_G723_40_ENCODE_SB_H -#include <vocoder/api.h> -#include <gr_sync_block.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace vocoder { @@ -33,7 +33,7 @@ namespace gr { * \brief This block performs g723_40 audio encoding. * \ingroup audio_blk */ - class VOCODER_API g723_40_encode_sb : virtual public gr_sync_block + class VOCODER_API g723_40_encode_sb : virtual public sync_block { public: // gr::vocoder::g723_40_encode_sb::sptr diff --git a/gr-vocoder/include/vocoder/gsm_fr_decode_ps.h b/gr-vocoder/include/gnuradio/vocoder/gsm_fr_decode_ps.h index cda62f19db..9979763e60 100644 --- a/gr-vocoder/include/vocoder/gsm_fr_decode_ps.h +++ b/gr-vocoder/include/gnuradio/vocoder/gsm_fr_decode_ps.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_GSM_FR_DECODE_PS_H #define INCLUDED_VOCODER_GSM_FR_DECODE_PS_H -#include <vocoder/api.h> -#include <gr_sync_interpolator.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_interpolator.h> namespace gr { namespace vocoder { @@ -33,7 +33,7 @@ namespace gr { * \brief GSM 06.10 Full Rate Vocoder Decoder * \ingroup audio_blk */ - class VOCODER_API gsm_fr_decode_ps : virtual public gr_sync_interpolator + class VOCODER_API gsm_fr_decode_ps : virtual public sync_interpolator { public: // gr::vocoder::gsm_fr_decode_ps::sptr diff --git a/gr-vocoder/include/vocoder/gsm_fr_encode_sp.h b/gr-vocoder/include/gnuradio/vocoder/gsm_fr_encode_sp.h index 798e99a3b1..98d88bba1f 100644 --- a/gr-vocoder/include/vocoder/gsm_fr_encode_sp.h +++ b/gr-vocoder/include/gnuradio/vocoder/gsm_fr_encode_sp.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_GSM_FR_ENCODE_SP_H #define INCLUDED_VOCODER_GSM_FR_ENCODE_SP_H -#include <vocoder/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_decimator.h> namespace gr { namespace vocoder { @@ -35,7 +35,7 @@ namespace gr { * * shorts in; 33 byte packets out */ - class VOCODER_API gsm_fr_encode_sp : virtual public gr_sync_decimator + class VOCODER_API gsm_fr_encode_sp : virtual public sync_decimator { public: // gr::vocoder::gsm_fr_encode_sp::sptr diff --git a/gr-vocoder/include/vocoder/ulaw_decode_bs.h b/gr-vocoder/include/gnuradio/vocoder/ulaw_decode_bs.h index 74c15531c0..83c328c326 100644 --- a/gr-vocoder/include/vocoder/ulaw_decode_bs.h +++ b/gr-vocoder/include/gnuradio/vocoder/ulaw_decode_bs.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_ULAW_DECODE_BS_H #define INCLUDED_VOCODER_ULAW_DECODE_BS_H -#include <vocoder/api.h> -#include <gr_sync_block.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace vocoder { @@ -33,7 +33,7 @@ namespace gr { * \brief This block performs ulaw audio decoding. * \ingroup audio_blk */ - class VOCODER_API ulaw_decode_bs : virtual public gr_sync_block + class VOCODER_API ulaw_decode_bs : virtual public sync_block { public: // gr::vocoder::ulaw_decode_bs::sptr diff --git a/gr-vocoder/include/vocoder/ulaw_encode_sb.h b/gr-vocoder/include/gnuradio/vocoder/ulaw_encode_sb.h index 8d18d00138..fe1dba79b3 100644 --- a/gr-vocoder/include/vocoder/ulaw_encode_sb.h +++ b/gr-vocoder/include/gnuradio/vocoder/ulaw_encode_sb.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_VOCODER_ULAW_ENCODER_SB_H #define INCLUDED_VOCODER_ULAW_ENCODER_SB_H -#include <vocoder/api.h> -#include <gr_sync_block.h> +#include <gnuradio/vocoder/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace vocoder { @@ -33,7 +33,7 @@ namespace gr { * \brief This block performs g.711 ulaw audio encoding. * \ingroup audio_blk */ - class VOCODER_API ulaw_encode_sb : virtual public gr_sync_block + class VOCODER_API ulaw_encode_sb : virtual public sync_block { public: // gr::vocoder::ulaw_encode_sb::sptr diff --git a/gr-vocoder/lib/alaw_decode_bs_impl.cc b/gr-vocoder/lib/alaw_decode_bs_impl.cc index abea694da9..2f43304578 100644 --- a/gr-vocoder/lib/alaw_decode_bs_impl.cc +++ b/gr-vocoder/lib/alaw_decode_bs_impl.cc @@ -25,7 +25,7 @@ #endif #include "alaw_decode_bs_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <limits.h> namespace gr { @@ -43,9 +43,9 @@ extern "C" { } alaw_decode_bs_impl::alaw_decode_bs_impl() - : gr_sync_block("vocoder_alaw_decode_bs", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(short))) + : sync_block("vocoder_alaw_decode_bs", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(short))) { } diff --git a/gr-vocoder/lib/alaw_decode_bs_impl.h b/gr-vocoder/lib/alaw_decode_bs_impl.h index 06b23f3cfa..37fb6b28c3 100644 --- a/gr-vocoder/lib/alaw_decode_bs_impl.h +++ b/gr-vocoder/lib/alaw_decode_bs_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_ALAW_DECODE_BS_IMPL_H #define INCLUDED_VOCODER_ALAW_DECODE_BS_IMPL_H -#include <vocoder/alaw_decode_bs.h> +#include <gnuradio/vocoder/alaw_decode_bs.h> namespace gr { namespace vocoder { diff --git a/gr-vocoder/lib/alaw_encode_sb_impl.cc b/gr-vocoder/lib/alaw_encode_sb_impl.cc index 4b316f2e14..9c941e790d 100644 --- a/gr-vocoder/lib/alaw_encode_sb_impl.cc +++ b/gr-vocoder/lib/alaw_encode_sb_impl.cc @@ -25,7 +25,7 @@ #endif #include "alaw_encode_sb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <limits.h> namespace gr { @@ -43,9 +43,9 @@ extern "C" { } alaw_encode_sb_impl::alaw_encode_sb_impl() - : gr_sync_block("avocoder_law_encode_sb", - gr_make_io_signature(1, 1, sizeof(short)), - gr_make_io_signature(1, 1, sizeof(unsigned char))) + : sync_block("avocoder_law_encode_sb", + io_signature::make(1, 1, sizeof(short)), + io_signature::make(1, 1, sizeof(unsigned char))) { } diff --git a/gr-vocoder/lib/alaw_encode_sb_impl.h b/gr-vocoder/lib/alaw_encode_sb_impl.h index 72112e35a9..0de1e2e6fd 100644 --- a/gr-vocoder/lib/alaw_encode_sb_impl.h +++ b/gr-vocoder/lib/alaw_encode_sb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_ALAW_ENCODER_SB_IMPL_H #define INCLUDED_VOCODER_ALAW_ENCODER_SB_IMPL_H -#include <vocoder/alaw_encode_sb.h> +#include <gnuradio/vocoder/alaw_encode_sb.h> namespace gr { namespace vocoder { diff --git a/gr-vocoder/lib/codec2_decode_ps_impl.cc b/gr-vocoder/lib/codec2_decode_ps_impl.cc index cd47c9e702..57ab62422e 100644 --- a/gr-vocoder/lib/codec2_decode_ps_impl.cc +++ b/gr-vocoder/lib/codec2_decode_ps_impl.cc @@ -30,7 +30,7 @@ extern "C" { #include "codec2/codec2.h" } -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> #include <assert.h> @@ -46,9 +46,9 @@ namespace gr { codec2_decode_ps_impl::codec2_decode_ps_impl () - : gr_sync_interpolator("vocoder_codec2_decode_ps", - gr_make_io_signature(1, 1, CODEC2_BITS_PER_FRAME * sizeof(char)), - gr_make_io_signature (1, 1, sizeof(short)), + : sync_interpolator("vocoder_codec2_decode_ps", + io_signature::make(1, 1, CODEC2_BITS_PER_FRAME * sizeof(char)), + io_signature::make (1, 1, sizeof(short)), CODEC2_SAMPLES_PER_FRAME) { if((d_codec2 = codec2_create()) == 0) diff --git a/gr-vocoder/lib/codec2_decode_ps_impl.h b/gr-vocoder/lib/codec2_decode_ps_impl.h index 26e39da1de..54b3744adf 100644 --- a/gr-vocoder/lib/codec2_decode_ps_impl.h +++ b/gr-vocoder/lib/codec2_decode_ps_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_CODEC2_DECODE_PS_IMPL_H #define INCLUDED_VOCODER_CODEC2_DECODE_PS_IMPL_H -#include <vocoder/codec2_decode_ps.h> +#include <gnuradio/vocoder/codec2_decode_ps.h> namespace gr { namespace vocoder { diff --git a/gr-vocoder/lib/codec2_encode_sp_impl.cc b/gr-vocoder/lib/codec2_encode_sp_impl.cc index 0217fbd424..3f79e06409 100644 --- a/gr-vocoder/lib/codec2_encode_sp_impl.cc +++ b/gr-vocoder/lib/codec2_encode_sp_impl.cc @@ -30,7 +30,7 @@ extern "C" { #include "codec2/codec2.h" } -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> namespace gr { @@ -44,9 +44,9 @@ namespace gr { } codec2_encode_sp_impl::codec2_encode_sp_impl() - : gr_sync_decimator("vocoder_codec2_encode_sp", - gr_make_io_signature(1, 1, sizeof(short)), - gr_make_io_signature(1, 1, CODEC2_BITS_PER_FRAME * sizeof(char)), + : sync_decimator("vocoder_codec2_encode_sp", + io_signature::make(1, 1, sizeof(short)), + io_signature::make(1, 1, CODEC2_BITS_PER_FRAME * sizeof(char)), CODEC2_SAMPLES_PER_FRAME) { if((d_codec2 = codec2_create()) == 0) diff --git a/gr-vocoder/lib/codec2_encode_sp_impl.h b/gr-vocoder/lib/codec2_encode_sp_impl.h index 1a5c34c9d8..354bcc4718 100644 --- a/gr-vocoder/lib/codec2_encode_sp_impl.h +++ b/gr-vocoder/lib/codec2_encode_sp_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_CODEC2_ENCODE_SP_IMPL_H #define INCLUDED_VOCODER_CODEC2_ENCODE_SP_IMPL_H -#include <vocoder/codec2_encode_sp.h> +#include <gnuradio/vocoder/codec2_encode_sp.h> namespace gr { namespace vocoder { diff --git a/gr-vocoder/lib/cvsd_decode_bs_impl.cc b/gr-vocoder/lib/cvsd_decode_bs_impl.cc index e7f284adda..57379b2162 100644 --- a/gr-vocoder/lib/cvsd_decode_bs_impl.cc +++ b/gr-vocoder/lib/cvsd_decode_bs_impl.cc @@ -25,7 +25,7 @@ #endif #include "cvsd_decode_bs_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <limits.h> namespace gr { @@ -45,9 +45,9 @@ namespace gr { cvsd_decode_bs_impl::cvsd_decode_bs_impl(short min_step, short max_step, double step_decay, double accum_decay, int K, int J, short pos_accum_max, short neg_accum_max) - : gr_sync_interpolator("vocoder_cvsd_decode_bs", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(short)), + : sync_interpolator("vocoder_cvsd_decode_bs", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(short)), 8), d_min_step(min_step), d_max_step(max_step), d_step_decay(step_decay), d_accum_decay(accum_decay), d_K(K), d_J(J), diff --git a/gr-vocoder/lib/cvsd_decode_bs_impl.h b/gr-vocoder/lib/cvsd_decode_bs_impl.h index 007c00c2bd..a9a7cede44 100644 --- a/gr-vocoder/lib/cvsd_decode_bs_impl.h +++ b/gr-vocoder/lib/cvsd_decode_bs_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_CVSD_DECODE_BS_IMPL_H #define INCLUDED_VOCODER_CVSD_DECODE_BS_IMPL_H -#include <vocoder/cvsd_decode_bs.h> +#include <gnuradio/vocoder/cvsd_decode_bs.h> namespace gr { namespace vocoder { diff --git a/gr-vocoder/lib/cvsd_encode_sb_impl.cc b/gr-vocoder/lib/cvsd_encode_sb_impl.cc index 74ecdb25e1..b567f7868c 100644 --- a/gr-vocoder/lib/cvsd_encode_sb_impl.cc +++ b/gr-vocoder/lib/cvsd_encode_sb_impl.cc @@ -25,7 +25,7 @@ #endif #include "cvsd_encode_sb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <limits.h> namespace gr { @@ -45,9 +45,9 @@ namespace gr { cvsd_encode_sb_impl::cvsd_encode_sb_impl(short min_step, short max_step, double step_decay, double accum_decay, int K, int J, short pos_accum_max, short neg_accum_max) - : gr_sync_decimator("vocoder_cvsd_encode_sb", - gr_make_io_signature(1, 1, sizeof(short)), - gr_make_io_signature(1, 1, sizeof(unsigned char)), + : sync_decimator("vocoder_cvsd_encode_sb", + io_signature::make(1, 1, sizeof(short)), + io_signature::make(1, 1, sizeof(unsigned char)), 8), d_min_step (min_step), d_max_step(max_step), d_step_decay(step_decay), d_accum_decay(accum_decay), d_K(K), d_J(J), diff --git a/gr-vocoder/lib/cvsd_encode_sb_impl.h b/gr-vocoder/lib/cvsd_encode_sb_impl.h index 1189920fa0..78bbd3eeb3 100644 --- a/gr-vocoder/lib/cvsd_encode_sb_impl.h +++ b/gr-vocoder/lib/cvsd_encode_sb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_CVSD_ENCODER_SB_IMPL_H #define INCLUDED_VOCODER_CVSD_ENCODER_SB_IMPL_H -#include <vocoder/cvsd_encode_sb.h> +#include <gnuradio/vocoder/cvsd_encode_sb.h> namespace gr { namespace vocoder { diff --git a/gr-vocoder/lib/g721_decode_bs_impl.cc b/gr-vocoder/lib/g721_decode_bs_impl.cc index 143bbc514d..db23ffa677 100644 --- a/gr-vocoder/lib/g721_decode_bs_impl.cc +++ b/gr-vocoder/lib/g721_decode_bs_impl.cc @@ -25,7 +25,7 @@ #endif #include "g721_decode_bs_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <limits.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } g721_decode_bs_impl::g721_decode_bs_impl() - : gr_sync_block("vocoder_g721_decode_bs", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(short))) + : sync_block("vocoder_g721_decode_bs", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(short))) { g72x_init_state(&d_state); } diff --git a/gr-vocoder/lib/g721_decode_bs_impl.h b/gr-vocoder/lib/g721_decode_bs_impl.h index b861591e49..f5354e1364 100644 --- a/gr-vocoder/lib/g721_decode_bs_impl.h +++ b/gr-vocoder/lib/g721_decode_bs_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_G721_DECODE_BS_IMPL_H #define INCLUDED_VOCODER_G721_DECODE_BS_IMPL_H -#include <vocoder/g721_decode_bs.h> +#include <gnuradio/vocoder/g721_decode_bs.h> extern "C" { #include "g7xx/g72x.h" diff --git a/gr-vocoder/lib/g721_encode_sb_impl.cc b/gr-vocoder/lib/g721_encode_sb_impl.cc index a961b0efeb..9293c46a83 100644 --- a/gr-vocoder/lib/g721_encode_sb_impl.cc +++ b/gr-vocoder/lib/g721_encode_sb_impl.cc @@ -25,7 +25,7 @@ #endif #include "g721_encode_sb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <limits.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } g721_encode_sb_impl::g721_encode_sb_impl() - : gr_sync_block("vocoder_g721_encode_sb", - gr_make_io_signature(1, 1, sizeof(short)), - gr_make_io_signature(1, 1, sizeof(unsigned char))) + : sync_block("vocoder_g721_encode_sb", + io_signature::make(1, 1, sizeof(short)), + io_signature::make(1, 1, sizeof(unsigned char))) { g72x_init_state(&d_state); } diff --git a/gr-vocoder/lib/g721_encode_sb_impl.h b/gr-vocoder/lib/g721_encode_sb_impl.h index f22949aa45..5fc3388ef9 100644 --- a/gr-vocoder/lib/g721_encode_sb_impl.h +++ b/gr-vocoder/lib/g721_encode_sb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_G721_ENCODE_SB_IMPL_H #define INCLUDED_VOCODER_G721_ENCODE_SB_IMPL_H -#include <vocoder/g721_encode_sb.h> +#include <gnuradio/vocoder/g721_encode_sb.h> extern "C" { #include "g7xx/g72x.h" diff --git a/gr-vocoder/lib/g723_24_decode_bs_impl.cc b/gr-vocoder/lib/g723_24_decode_bs_impl.cc index f7a8b59a08..c78229c4f3 100644 --- a/gr-vocoder/lib/g723_24_decode_bs_impl.cc +++ b/gr-vocoder/lib/g723_24_decode_bs_impl.cc @@ -25,7 +25,7 @@ #endif #include "g723_24_decode_bs_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <limits.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } g723_24_decode_bs_impl::g723_24_decode_bs_impl() - : gr_sync_block("vocoder_g723_24_decode_bs", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(short))) + : sync_block("vocoder_g723_24_decode_bs", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(short))) { g72x_init_state(&d_state); } diff --git a/gr-vocoder/lib/g723_24_decode_bs_impl.h b/gr-vocoder/lib/g723_24_decode_bs_impl.h index 3ecea1b1ef..454bed76c6 100644 --- a/gr-vocoder/lib/g723_24_decode_bs_impl.h +++ b/gr-vocoder/lib/g723_24_decode_bs_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_G723_24_DECODE_BS_IMPL_H #define INCLUDED_VOCODER_G723_24_DECODE_BS_IMPL_H -#include <vocoder/g723_24_decode_bs.h> +#include <gnuradio/vocoder/g723_24_decode_bs.h> extern "C" { #include "g7xx/g72x.h" diff --git a/gr-vocoder/lib/g723_24_encode_sb_impl.cc b/gr-vocoder/lib/g723_24_encode_sb_impl.cc index 8b168197b5..cf721e3580 100644 --- a/gr-vocoder/lib/g723_24_encode_sb_impl.cc +++ b/gr-vocoder/lib/g723_24_encode_sb_impl.cc @@ -25,7 +25,7 @@ #endif #include "g723_24_encode_sb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <limits.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } g723_24_encode_sb_impl::g723_24_encode_sb_impl() - : gr_sync_block("vocoder_g723_24_encode_sb", - gr_make_io_signature(1, 1, sizeof(short)), - gr_make_io_signature(1, 1, sizeof(unsigned char))) + : sync_block("vocoder_g723_24_encode_sb", + io_signature::make(1, 1, sizeof(short)), + io_signature::make(1, 1, sizeof(unsigned char))) { g72x_init_state(&d_state); } diff --git a/gr-vocoder/lib/g723_24_encode_sb_impl.h b/gr-vocoder/lib/g723_24_encode_sb_impl.h index d7a44bc57b..9bad56009e 100644 --- a/gr-vocoder/lib/g723_24_encode_sb_impl.h +++ b/gr-vocoder/lib/g723_24_encode_sb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_G723_24_ENCODE_SB_IMPL_H #define INCLUDED_VOCODER_G723_24_ENCODE_SB_IMPL_H -#include <vocoder/g723_24_encode_sb.h> +#include <gnuradio/vocoder/g723_24_encode_sb.h> extern "C" { #include "g7xx/g72x.h" diff --git a/gr-vocoder/lib/g723_40_decode_bs_impl.cc b/gr-vocoder/lib/g723_40_decode_bs_impl.cc index 0790c9481c..4302583200 100644 --- a/gr-vocoder/lib/g723_40_decode_bs_impl.cc +++ b/gr-vocoder/lib/g723_40_decode_bs_impl.cc @@ -25,7 +25,7 @@ #endif #include "g723_40_decode_bs_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <limits.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } g723_40_decode_bs_impl::g723_40_decode_bs_impl() - : gr_sync_block("vocoder_g723_40_decode_bs", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(short))) + : sync_block("vocoder_g723_40_decode_bs", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(short))) { g72x_init_state(&d_state); } diff --git a/gr-vocoder/lib/g723_40_decode_bs_impl.h b/gr-vocoder/lib/g723_40_decode_bs_impl.h index 3d5b4d6b7f..4efd8c5905 100644 --- a/gr-vocoder/lib/g723_40_decode_bs_impl.h +++ b/gr-vocoder/lib/g723_40_decode_bs_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_G723_40_DECODE_BS_IMPL_H #define INCLUDED_VOCODER_G723_40_DECODE_BS_IMPL_H -#include <vocoder/g723_40_decode_bs.h> +#include <gnuradio/vocoder/g723_40_decode_bs.h> extern "C" { #include "g7xx/g72x.h" diff --git a/gr-vocoder/lib/g723_40_encode_sb_impl.cc b/gr-vocoder/lib/g723_40_encode_sb_impl.cc index 54dd052637..ff1910c55f 100644 --- a/gr-vocoder/lib/g723_40_encode_sb_impl.cc +++ b/gr-vocoder/lib/g723_40_encode_sb_impl.cc @@ -25,7 +25,7 @@ #endif #include "g723_40_encode_sb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <limits.h> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } g723_40_encode_sb_impl::g723_40_encode_sb_impl() - : gr_sync_block("vocoder_g723_40_encode_sb", - gr_make_io_signature(1, 1, sizeof(short)), - gr_make_io_signature(1, 1, sizeof(unsigned char))) + : sync_block("vocoder_g723_40_encode_sb", + io_signature::make(1, 1, sizeof(short)), + io_signature::make(1, 1, sizeof(unsigned char))) { g72x_init_state(&d_state); } diff --git a/gr-vocoder/lib/g723_40_encode_sb_impl.h b/gr-vocoder/lib/g723_40_encode_sb_impl.h index a4093e1fc7..f2160b7097 100644 --- a/gr-vocoder/lib/g723_40_encode_sb_impl.h +++ b/gr-vocoder/lib/g723_40_encode_sb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_G723_40_ENCODE_SB_IMPL_H #define INCLUDED_VOCODER_G723_40_ENCODE_SB_IMPL_H -#include <vocoder/g723_40_encode_sb.h> +#include <gnuradio/vocoder/g723_40_encode_sb.h> extern "C" { #include "g7xx/g72x.h" diff --git a/gr-vocoder/lib/gsm_fr_decode_ps_impl.cc b/gr-vocoder/lib/gsm_fr_decode_ps_impl.cc index 2b3d11135c..e318a60668 100644 --- a/gr-vocoder/lib/gsm_fr_decode_ps_impl.cc +++ b/gr-vocoder/lib/gsm_fr_decode_ps_impl.cc @@ -25,7 +25,7 @@ #endif #include "gsm_fr_decode_ps_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> #include <assert.h> @@ -40,9 +40,9 @@ namespace gr { } gsm_fr_decode_ps_impl::gsm_fr_decode_ps_impl() - : gr_sync_interpolator("vocoder_gsm_fr_decode_ps", - gr_make_io_signature(1, 1, sizeof(gsm_frame)), - gr_make_io_signature(1, 1, sizeof(short)), + : sync_interpolator("vocoder_gsm_fr_decode_ps", + io_signature::make(1, 1, sizeof(gsm_frame)), + io_signature::make(1, 1, sizeof(short)), GSM_SAMPLES_PER_FRAME) { if((d_gsm = gsm_create()) == 0) diff --git a/gr-vocoder/lib/gsm_fr_decode_ps_impl.h b/gr-vocoder/lib/gsm_fr_decode_ps_impl.h index 3c1bb351d6..878d40c92a 100644 --- a/gr-vocoder/lib/gsm_fr_decode_ps_impl.h +++ b/gr-vocoder/lib/gsm_fr_decode_ps_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_GSM_FR_DECODE_PS_IMPL_H #define INCLUDED_VOCODER_GSM_FR_DECODE_PS_IMPL_H -#include <vocoder/gsm_fr_decode_ps.h> +#include <gnuradio/vocoder/gsm_fr_decode_ps.h> extern "C"{ #include "gsm/gsm.h" diff --git a/gr-vocoder/lib/gsm_fr_encode_sp_impl.cc b/gr-vocoder/lib/gsm_fr_encode_sp_impl.cc index c7b10089fb..143a73bce7 100644 --- a/gr-vocoder/lib/gsm_fr_encode_sp_impl.cc +++ b/gr-vocoder/lib/gsm_fr_encode_sp_impl.cc @@ -25,7 +25,7 @@ #endif #include "gsm_fr_encode_sp_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdexcept> namespace gr { @@ -39,9 +39,9 @@ namespace gr { } gsm_fr_encode_sp_impl::gsm_fr_encode_sp_impl() - : gr_sync_decimator("vocoder_gsm_fr_encode_sp", - gr_make_io_signature(1, 1, sizeof(short)), - gr_make_io_signature(1, 1, sizeof(gsm_frame)), + : sync_decimator("vocoder_gsm_fr_encode_sp", + io_signature::make(1, 1, sizeof(short)), + io_signature::make(1, 1, sizeof(gsm_frame)), GSM_SAMPLES_PER_FRAME) { if((d_gsm = gsm_create ()) == 0) diff --git a/gr-vocoder/lib/gsm_fr_encode_sp_impl.h b/gr-vocoder/lib/gsm_fr_encode_sp_impl.h index a5501deaae..c4629dd984 100644 --- a/gr-vocoder/lib/gsm_fr_encode_sp_impl.h +++ b/gr-vocoder/lib/gsm_fr_encode_sp_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_GSM_FR_ENCODE_SP_IMPL_H #define INCLUDED_VOCODER_GSM_FR_ENCODE_SP_IMPL_H -#include <vocoder/gsm_fr_encode_sp.h> +#include <gnuradio/vocoder/gsm_fr_encode_sp.h> extern "C"{ #include "gsm/gsm.h" diff --git a/gr-vocoder/lib/ulaw_decode_bs_impl.cc b/gr-vocoder/lib/ulaw_decode_bs_impl.cc index d0c99b70a0..bbf58a54da 100644 --- a/gr-vocoder/lib/ulaw_decode_bs_impl.cc +++ b/gr-vocoder/lib/ulaw_decode_bs_impl.cc @@ -25,7 +25,7 @@ #endif #include "ulaw_decode_bs_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <limits.h> namespace gr { @@ -43,9 +43,9 @@ extern "C" { } ulaw_decode_bs_impl::ulaw_decode_bs_impl() - : gr_sync_block("vocoder_ulaw_decode_bs", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(short))) + : sync_block("vocoder_ulaw_decode_bs", + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(short))) { } diff --git a/gr-vocoder/lib/ulaw_decode_bs_impl.h b/gr-vocoder/lib/ulaw_decode_bs_impl.h index db7a0dcab9..9e5d238b49 100644 --- a/gr-vocoder/lib/ulaw_decode_bs_impl.h +++ b/gr-vocoder/lib/ulaw_decode_bs_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_ULAW_DECODE_BS_IMPL_H #define INCLUDED_VOCODER_ULAW_DECODE_BS_IMPL_H -#include <vocoder/ulaw_decode_bs.h> +#include <gnuradio/vocoder/ulaw_decode_bs.h> namespace gr { namespace vocoder { diff --git a/gr-vocoder/lib/ulaw_encode_sb_impl.cc b/gr-vocoder/lib/ulaw_encode_sb_impl.cc index a49df12b59..83d3864965 100644 --- a/gr-vocoder/lib/ulaw_encode_sb_impl.cc +++ b/gr-vocoder/lib/ulaw_encode_sb_impl.cc @@ -25,7 +25,7 @@ #endif #include "ulaw_encode_sb_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <limits.h> namespace gr { @@ -43,9 +43,9 @@ extern "C" { } ulaw_encode_sb_impl::ulaw_encode_sb_impl() - : gr_sync_block("vocoder_ulaw_encode_sb", - gr_make_io_signature(1, 1, sizeof(short)), - gr_make_io_signature(1, 1, sizeof(unsigned char))) + : sync_block("vocoder_ulaw_encode_sb", + io_signature::make(1, 1, sizeof(short)), + io_signature::make(1, 1, sizeof(unsigned char))) { } diff --git a/gr-vocoder/lib/ulaw_encode_sb_impl.h b/gr-vocoder/lib/ulaw_encode_sb_impl.h index 2ce207fbf8..48227a86da 100644 --- a/gr-vocoder/lib/ulaw_encode_sb_impl.h +++ b/gr-vocoder/lib/ulaw_encode_sb_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_VOCODER_ULAW_ENCODER_SB_IMPL_H #define INCLUDED_VOCODER_ULAW_ENCODER_SB_IMPL_H -#include <vocoder/ulaw_encode_sb.h> +#include <gnuradio/vocoder/ulaw_encode_sb.h> namespace gr { namespace vocoder { diff --git a/gr-vocoder/swig/CMakeLists.txt b/gr-vocoder/swig/CMakeLists.txt index 14d894ced9..2c2a7a6791 100644 --- a/gr-vocoder/swig/CMakeLists.txt +++ b/gr-vocoder/swig/CMakeLists.txt @@ -35,7 +35,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/vocoder_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/vocoder) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/vocoder) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_LIBRARIES gnuradio-vocoder) diff --git a/gr-vocoder/swig/vocoder_swig.i b/gr-vocoder/swig/vocoder_swig.i index b3dd436868..d7cb99c239 100644 --- a/gr-vocoder/swig/vocoder_swig.i +++ b/gr-vocoder/swig/vocoder_swig.i @@ -28,40 +28,40 @@ %include "vocoder_swig_doc.i" %{ -#include "vocoder/alaw_decode_bs.h" -#include "vocoder/alaw_encode_sb.h" -#include "vocoder/codec2_decode_ps.h" -#include "vocoder/codec2_encode_sp.h" -#include "vocoder/cvsd_decode_bs.h" -#include "vocoder/cvsd_encode_sb.h" -#include "vocoder/g721_decode_bs.h" -#include "vocoder/g721_encode_sb.h" -#include "vocoder/g723_24_decode_bs.h" -#include "vocoder/g723_24_encode_sb.h" -#include "vocoder/g723_40_decode_bs.h" -#include "vocoder/g723_40_encode_sb.h" -#include "vocoder/gsm_fr_decode_ps.h" -#include "vocoder/gsm_fr_encode_sp.h" -#include "vocoder/ulaw_decode_bs.h" -#include "vocoder/ulaw_encode_sb.h" +#include "gnuradio/vocoder/alaw_decode_bs.h" +#include "gnuradio/vocoder/alaw_encode_sb.h" +#include "gnuradio/vocoder/codec2_decode_ps.h" +#include "gnuradio/vocoder/codec2_encode_sp.h" +#include "gnuradio/vocoder/cvsd_decode_bs.h" +#include "gnuradio/vocoder/cvsd_encode_sb.h" +#include "gnuradio/vocoder/g721_decode_bs.h" +#include "gnuradio/vocoder/g721_encode_sb.h" +#include "gnuradio/vocoder/g723_24_decode_bs.h" +#include "gnuradio/vocoder/g723_24_encode_sb.h" +#include "gnuradio/vocoder/g723_40_decode_bs.h" +#include "gnuradio/vocoder/g723_40_encode_sb.h" +#include "gnuradio/vocoder/gsm_fr_decode_ps.h" +#include "gnuradio/vocoder/gsm_fr_encode_sp.h" +#include "gnuradio/vocoder/ulaw_decode_bs.h" +#include "gnuradio/vocoder/ulaw_encode_sb.h" %} -%include "vocoder/alaw_decode_bs.h" -%include "vocoder/alaw_encode_sb.h" -%include "vocoder/codec2_decode_ps.h" -%include "vocoder/codec2_encode_sp.h" -%include "vocoder/cvsd_decode_bs.h" -%include "vocoder/cvsd_encode_sb.h" -%include "vocoder/g721_decode_bs.h" -%include "vocoder/g721_encode_sb.h" -%include "vocoder/g723_24_decode_bs.h" -%include "vocoder/g723_24_encode_sb.h" -%include "vocoder/g723_40_decode_bs.h" -%include "vocoder/g723_40_encode_sb.h" -%include "vocoder/gsm_fr_decode_ps.h" -%include "vocoder/gsm_fr_encode_sp.h" -%include "vocoder/ulaw_decode_bs.h" -%include "vocoder/ulaw_encode_sb.h" +%include "gnuradio/vocoder/alaw_decode_bs.h" +%include "gnuradio/vocoder/alaw_encode_sb.h" +%include "gnuradio/vocoder/codec2_decode_ps.h" +%include "gnuradio/vocoder/codec2_encode_sp.h" +%include "gnuradio/vocoder/cvsd_decode_bs.h" +%include "gnuradio/vocoder/cvsd_encode_sb.h" +%include "gnuradio/vocoder/g721_decode_bs.h" +%include "gnuradio/vocoder/g721_encode_sb.h" +%include "gnuradio/vocoder/g723_24_decode_bs.h" +%include "gnuradio/vocoder/g723_24_encode_sb.h" +%include "gnuradio/vocoder/g723_40_decode_bs.h" +%include "gnuradio/vocoder/g723_40_encode_sb.h" +%include "gnuradio/vocoder/gsm_fr_decode_ps.h" +%include "gnuradio/vocoder/gsm_fr_encode_sp.h" +%include "gnuradio/vocoder/ulaw_decode_bs.h" +%include "gnuradio/vocoder/ulaw_encode_sb.h" GR_SWIG_BLOCK_MAGIC2(vocoder, alaw_decode_bs); GR_SWIG_BLOCK_MAGIC2(vocoder, alaw_encode_sb); diff --git a/gr-wavelet/CMakeLists.txt b/gr-wavelet/CMakeLists.txt index 4c1e3afb38..df0dbb9709 100644 --- a/gr-wavelet/CMakeLists.txt +++ b/gr-wavelet/CMakeLists.txt @@ -84,7 +84,7 @@ CPACK_COMPONENT("wavelet_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/wavelet) +add_subdirectory(include/gnuradio/wavelet) add_subdirectory(lib) if(ENABLE_PYTHON) add_subdirectory(swig) diff --git a/gr-wavelet/include/wavelet/CMakeLists.txt b/gr-wavelet/include/gnuradio/wavelet/CMakeLists.txt index 43c1603d15..43c1603d15 100644 --- a/gr-wavelet/include/wavelet/CMakeLists.txt +++ b/gr-wavelet/include/gnuradio/wavelet/CMakeLists.txt diff --git a/gr-wavelet/include/wavelet/api.h b/gr-wavelet/include/gnuradio/wavelet/api.h index f1b281440d..371ac24d54 100644 --- a/gr-wavelet/include/wavelet/api.h +++ b/gr-wavelet/include/gnuradio/wavelet/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_WAVELET_API_H #define INCLUDED_WAVELET_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_wavelet_EXPORTS # define WAVELET_API __GR_ATTR_EXPORT diff --git a/gr-wavelet/include/wavelet/squash_ff.h b/gr-wavelet/include/gnuradio/wavelet/squash_ff.h index f546148581..bf05fe9b5e 100644 --- a/gr-wavelet/include/wavelet/squash_ff.h +++ b/gr-wavelet/include/gnuradio/wavelet/squash_ff.h @@ -23,13 +23,13 @@ #ifndef INCLUDED_WAVELET_SQUASH_FF_H #define INCLUDED_WAVELET_SQUASH_FF_H -#include <wavelet/api.h> -#include <gr_sync_block.h> +#include <gnuradio/wavelet/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace wavelet { - class WAVELET_API squash_ff : virtual public gr_sync_block + class WAVELET_API squash_ff : virtual public sync_block { public: diff --git a/gr-wavelet/include/wavelet/wavelet_ff.h b/gr-wavelet/include/gnuradio/wavelet/wavelet_ff.h index 67bb6b19f8..ffc73dee93 100644 --- a/gr-wavelet/include/wavelet/wavelet_ff.h +++ b/gr-wavelet/include/gnuradio/wavelet/wavelet_ff.h @@ -23,13 +23,13 @@ #ifndef INCLUDED_WAVELET_WAVELET_FF_H #define INCLUDED_WAVELET_WAVELET_FF_H -#include <wavelet/api.h> -#include <gr_sync_block.h> +#include <gnuradio/wavelet/api.h> +#include <gnuradio/sync_block.h> namespace gr { namespace wavelet { - class WAVELET_API wavelet_ff : virtual public gr_sync_block + class WAVELET_API wavelet_ff : virtual public sync_block { public: diff --git a/gr-wavelet/include/wavelet/wvps_ff.h b/gr-wavelet/include/gnuradio/wavelet/wvps_ff.h index 7f1965a6e7..563ffb7db3 100644 --- a/gr-wavelet/include/wavelet/wvps_ff.h +++ b/gr-wavelet/include/gnuradio/wavelet/wvps_ff.h @@ -23,15 +23,15 @@ #ifndef INCLUDED_WAVELET_WVPS_FF_H #define INCLUDED_WAVELET_WVPS_FF_H -#include <wavelet/api.h> -#include <gr_sync_decimator.h> +#include <gnuradio/wavelet/api.h> +#include <gnuradio/sync_decimator.h> class wavelet_wvps_ff; namespace gr { namespace wavelet { - class WAVELET_API wvps_ff : virtual public gr_sync_block + class WAVELET_API wvps_ff : virtual public sync_block { public: diff --git a/gr-wavelet/lib/squash_ff_impl.cc b/gr-wavelet/lib/squash_ff_impl.cc index 081ac900f5..47f8c616d5 100644 --- a/gr-wavelet/lib/squash_ff_impl.cc +++ b/gr-wavelet/lib/squash_ff_impl.cc @@ -26,7 +26,7 @@ #include <stdexcept> #include <squash_ff_impl.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> // expect input vector of igrid.size y-values, // produce output vector of ogrid.size y-values @@ -42,9 +42,9 @@ namespace gr { squash_ff_impl::squash_ff_impl(const std::vector<float> &igrid, const std::vector<float> &ogrid) - : gr_sync_block("squash_ff", - gr_make_io_signature(1, 1, sizeof(float) * igrid.size()), - gr_make_io_signature(1, 1, sizeof(float) * ogrid.size())) + : sync_block("squash_ff", + io_signature::make(1, 1, sizeof(float) * igrid.size()), + io_signature::make(1, 1, sizeof(float) * ogrid.size())) { d_inum = igrid.size(); d_onum = ogrid.size(); diff --git a/gr-wavelet/lib/squash_ff_impl.h b/gr-wavelet/lib/squash_ff_impl.h index b6ddb45363..b9ab994558 100644 --- a/gr-wavelet/lib/squash_ff_impl.h +++ b/gr-wavelet/lib/squash_ff_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_WAVELET_SQUASH_FF_IMPL_H #define INCLUDED_WAVELET_SQUASH_FF_IMPL_H -#include <wavelet/api.h> -#include <wavelet/squash_ff.h> +#include <gnuradio/wavelet/api.h> +#include <gnuradio/wavelet/squash_ff.h> #include <gsl/gsl_errno.h> #include <gsl/gsl_interp.h> #include <gsl/gsl_spline.h> diff --git a/gr-wavelet/lib/wavelet_ff_impl.cc b/gr-wavelet/lib/wavelet_ff_impl.cc index 73fc8c5440..6b313574b3 100644 --- a/gr-wavelet/lib/wavelet_ff_impl.cc +++ b/gr-wavelet/lib/wavelet_ff_impl.cc @@ -26,7 +26,7 @@ #include <stdexcept> #include <wavelet_ff_impl.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <stdio.h> @@ -46,9 +46,9 @@ namespace gr { wavelet_ff_impl::wavelet_ff_impl(int size, int order, bool forward) - : gr_sync_block("wavelet_ff", - gr_make_io_signature(1, 1, size * sizeof(float)), - gr_make_io_signature(1, 1, size * sizeof(float))), + : sync_block("wavelet_ff", + io_signature::make(1, 1, size * sizeof(float)), + io_signature::make(1, 1, size * sizeof(float))), d_size(size), d_order(order), d_forward(forward) diff --git a/gr-wavelet/lib/wavelet_ff_impl.h b/gr-wavelet/lib/wavelet_ff_impl.h index bec3935f33..b8d6500487 100644 --- a/gr-wavelet/lib/wavelet_ff_impl.h +++ b/gr-wavelet/lib/wavelet_ff_impl.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_WAVELET_WAVELET_FF_IMPL_H #define INCLUDED_WAVELET_WAVELET_FF_IMPL_H -#include <wavelet/wavelet_ff.h> +#include <gnuradio/wavelet/wavelet_ff.h> #include <gsl/gsl_errno.h> #include <gsl/gsl_wavelet.h> diff --git a/gr-wavelet/lib/wvps_ff_impl.cc b/gr-wavelet/lib/wvps_ff_impl.cc index 6e886bff4e..3dd6bf4ba9 100644 --- a/gr-wavelet/lib/wvps_ff_impl.cc +++ b/gr-wavelet/lib/wvps_ff_impl.cc @@ -25,7 +25,7 @@ #endif #include <wvps_ff_impl.h> -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <string.h> namespace gr { @@ -45,9 +45,9 @@ namespace gr { } wvps_ff_impl::wvps_ff_impl(int ilen) - : gr_sync_block("wvps_ff", - gr_make_io_signature(1, 1, sizeof(float) * ilen), - gr_make_io_signature(1, 1, sizeof(float) * ceil_log2(ilen))), + : sync_block("wvps_ff", + io_signature::make(1, 1, sizeof(float) * ilen), + io_signature::make(1, 1, sizeof(float) * ceil_log2(ilen))), d_ilen(ilen), d_olen(ceil_log2(ilen)) { } diff --git a/gr-wavelet/lib/wvps_ff_impl.h b/gr-wavelet/lib/wvps_ff_impl.h index ab64395d24..b9951f40a7 100644 --- a/gr-wavelet/lib/wvps_ff_impl.h +++ b/gr-wavelet/lib/wvps_ff_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_WAVELET_WVPS_FF_IMPL_H #define INCLUDED_WAVELET_WVPS_FF_IMPL_H -#include <wavelet/wvps_ff.h> +#include <gnuradio/wavelet/wvps_ff.h> namespace gr { namespace wavelet { diff --git a/gr-wavelet/swig/CMakeLists.txt b/gr-wavelet/swig/CMakeLists.txt index aa0d800af8..c539898575 100644 --- a/gr-wavelet/swig/CMakeLists.txt +++ b/gr-wavelet/swig/CMakeLists.txt @@ -37,7 +37,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/wavelet_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/wavelet) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/wavelet) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_LIBRARIES gnuradio-wavelet ${GSL_LDFLAGS}) diff --git a/gr-wavelet/swig/wavelet_swig.i b/gr-wavelet/swig/wavelet_swig.i index d9b8e3144b..5aa2973647 100644 --- a/gr-wavelet/swig/wavelet_swig.i +++ b/gr-wavelet/swig/wavelet_swig.i @@ -28,14 +28,14 @@ %include "wavelet_swig_doc.i" %{ -#include "wavelet/squash_ff.h" -#include "wavelet/wavelet_ff.h" -#include "wavelet/wvps_ff.h" +#include "gnuradio/wavelet/squash_ff.h" +#include "gnuradio/wavelet/wavelet_ff.h" +#include "gnuradio/wavelet/wvps_ff.h" %} -%include "wavelet/squash_ff.h" -%include "wavelet/wavelet_ff.h" -%include "wavelet/wvps_ff.h" +%include "gnuradio/wavelet/squash_ff.h" +%include "gnuradio/wavelet/wavelet_ff.h" +%include "gnuradio/wavelet/wvps_ff.h" GR_SWIG_BLOCK_MAGIC2(wavelet, squash_ff); GR_SWIG_BLOCK_MAGIC2(wavelet, wavelet_ff); diff --git a/gr-wxgui/CMakeLists.txt b/gr-wxgui/CMakeLists.txt index 5140db5658..25382638c5 100644 --- a/gr-wxgui/CMakeLists.txt +++ b/gr-wxgui/CMakeLists.txt @@ -94,7 +94,7 @@ install( ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/wxgui) +add_subdirectory(include/gnuradio/wxgui) add_subdirectory(lib) add_subdirectory(grc) add_subdirectory(swig) diff --git a/gr-wxgui/include/wxgui/CMakeLists.txt b/gr-wxgui/include/gnuradio/wxgui/CMakeLists.txt index fad84792e1..fad84792e1 100644 --- a/gr-wxgui/include/wxgui/CMakeLists.txt +++ b/gr-wxgui/include/gnuradio/wxgui/CMakeLists.txt diff --git a/gr-wxgui/include/wxgui/api.h b/gr-wxgui/include/gnuradio/wxgui/api.h index cf9e980a9c..6439c8e591 100644 --- a/gr-wxgui/include/wxgui/api.h +++ b/gr-wxgui/include/gnuradio/wxgui/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_WXGUI_API_H #define INCLUDED_WXGUI_API_H -#include <attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_wxgui_EXPORTS # define WXGUI_API __GR_ATTR_EXPORT diff --git a/gr-wxgui/include/wxgui/histo_sink_f.h b/gr-wxgui/include/gnuradio/wxgui/histo_sink_f.h index f65517ca35..30f0bc7c0d 100644 --- a/gr-wxgui/include/wxgui/histo_sink_f.h +++ b/gr-wxgui/include/gnuradio/wxgui/histo_sink_f.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_HISTO_SINK_F_H #define INCLUDED_GR_HISTO_SINK_F_H -#include <wxgui/api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> +#include <gnuradio/wxgui/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> namespace gr { namespace wxgui { @@ -34,13 +34,13 @@ namespace gr { * \brief Histogram module. * \ingroup sink_blk */ - class WXGUI_API histo_sink_f : virtual public gr_sync_block + class WXGUI_API histo_sink_f : virtual public sync_block { public: // gr::blocks::histo_sink_f::sptr typedef boost::shared_ptr<histo_sink_f> sptr; - static sptr make(gr_msg_queue_sptr msgq); + static sptr make(msg_queue::sptr msgq); virtual unsigned int get_frame_size(void) = 0; virtual unsigned int get_num_bins(void) = 0; diff --git a/gr-wxgui/include/wxgui/oscope_guts.h b/gr-wxgui/include/gnuradio/wxgui/oscope_guts.h index a6abd81539..c1a521acf2 100644 --- a/gr-wxgui/include/wxgui/oscope_guts.h +++ b/gr-wxgui/include/gnuradio/wxgui/oscope_guts.h @@ -24,9 +24,9 @@ #ifndef INCLUDED_GR_OSCOPE_GUTS_H #define INCLUDED_GR_OSCOPE_GUTS_H -#include <wxgui/api.h> -#include <wxgui/trigger_mode.h> -#include <gr_msg_queue.h> +#include <gnuradio/wxgui/api.h> +#include <gnuradio/wxgui/trigger_mode.h> +#include <gnuradio/msg_queue.h> namespace gr { namespace wxgui { @@ -54,7 +54,7 @@ namespace gr { enum scope_state { HOLD_OFF, LOOK_FOR_TRIGGER, POST_TRIGGER }; int d_nchannels; // how many channels - gr_msg_queue_sptr d_msgq; // message queue we stuff output records into + msg_queue::sptr d_msgq; // message queue we stuff output records into trigger_mode d_trigger_mode; trigger_slope d_trigger_slope; int d_trigger_channel; // which channel to watch for trigger condition @@ -90,7 +90,7 @@ namespace gr { public: // CREATORS - oscope_guts(double sample_rate, gr_msg_queue_sptr msgq); + oscope_guts(double sample_rate, msg_queue::sptr msgq); ~oscope_guts(); // MANIPULATORS diff --git a/gr-wxgui/include/wxgui/oscope_sink_f.h b/gr-wxgui/include/gnuradio/wxgui/oscope_sink_f.h index a7c7657d40..9e86442055 100644 --- a/gr-wxgui/include/wxgui/oscope_sink_f.h +++ b/gr-wxgui/include/gnuradio/wxgui/oscope_sink_f.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_OSCOPE_SINK_F_H #define INCLUDED_GR_OSCOPE_SINK_F_H -#include <wxgui/api.h> -#include <wxgui/oscope_sink_x.h> -#include <gr_msg_queue.h> +#include <gnuradio/wxgui/api.h> +#include <gnuradio/wxgui/oscope_sink_x.h> +#include <gnuradio/msg_queue.h> namespace gr { namespace wxgui { @@ -43,7 +43,7 @@ namespace gr { // gr::blocks::oscope_sink_f::sptr typedef boost::shared_ptr<oscope_sink_f> sptr; - static sptr make(double sampling_rate, gr_msg_queue_sptr msgq); + static sptr make(double sampling_rate, msg_queue::sptr msgq); }; } /* namespace wxgui */ diff --git a/gr-wxgui/include/wxgui/oscope_sink_x.h b/gr-wxgui/include/gnuradio/wxgui/oscope_sink_x.h index 17fa9a0f5a..b72c1dd370 100644 --- a/gr-wxgui/include/wxgui/oscope_sink_x.h +++ b/gr-wxgui/include/gnuradio/wxgui/oscope_sink_x.h @@ -23,10 +23,10 @@ #ifndef INCLUDED_GR_OSCOPE_SINK_X_H #define INCLUDED_GR_OSCOPE_SINK_X_H -#include <wxgui/api.h> -#include <wxgui/trigger_mode.h> -#include <wxgui/oscope_guts.h> -#include <gr_sync_block.h> +#include <gnuradio/wxgui/api.h> +#include <gnuradio/wxgui/trigger_mode.h> +#include <gnuradio/wxgui/oscope_guts.h> +#include <gnuradio/sync_block.h> namespace gr { namespace wxgui { @@ -37,7 +37,7 @@ namespace gr { * * Don't instantiate this. Use gr::blocks::oscope_sink_f instead. */ - class WXGUI_API oscope_sink_x : public gr_sync_block + class WXGUI_API oscope_sink_x : public sync_block { protected: double d_sampling_rate; @@ -45,7 +45,7 @@ namespace gr { oscope_sink_x() {}; oscope_sink_x(const std::string name, - gr_io_signature_sptr input_sig, + gr::io_signature::sptr input_sig, double sampling_rate); public: virtual ~oscope_sink_x(); @@ -54,7 +54,7 @@ namespace gr { //typedef boost::shared_ptr<oscope_sink_x> sptr; // //static sptr make(const std::string name, - // gr_io_signature_sptr input_sig, + // gnuradio/io_signature.h_sptr input_sig, // double sampling_rate); bool set_update_rate(double update_rate); diff --git a/gr-wxgui/include/wxgui/trigger_mode.h b/gr-wxgui/include/gnuradio/wxgui/trigger_mode.h index 11654ef6c5..11654ef6c5 100644 --- a/gr-wxgui/include/wxgui/trigger_mode.h +++ b/gr-wxgui/include/gnuradio/wxgui/trigger_mode.h diff --git a/gr-wxgui/lib/histo_sink_f_impl.cc b/gr-wxgui/lib/histo_sink_f_impl.cc index 9b168de547..f10540fa36 100644 --- a/gr-wxgui/lib/histo_sink_f_impl.cc +++ b/gr-wxgui/lib/histo_sink_f_impl.cc @@ -25,7 +25,7 @@ #endif #include "histo_sink_f_impl.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <boost/math/special_functions/round.hpp> namespace gr { @@ -50,16 +50,16 @@ namespace gr { } histo_sink_f::sptr - histo_sink_f::make(gr_msg_queue_sptr msgq) + histo_sink_f::make(msg_queue::sptr msgq) { return gnuradio::get_initial_sptr (new histo_sink_f_impl(msgq)); } - histo_sink_f_impl::histo_sink_f_impl(gr_msg_queue_sptr msgq) - : gr_sync_block("histo_sink_f", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(0, 0, 0)), + histo_sink_f_impl::histo_sink_f_impl(msg_queue::sptr msgq) + : sync_block("histo_sink_f", + io_signature::make(1, 1, sizeof(float)), + io_signature::make(0, 0, 0)), d_msgq(msgq), d_num_bins(11), d_frame_size(1000), d_sample_count(0), d_bins(NULL), d_samps(NULL) { @@ -123,7 +123,7 @@ namespace gr { d_bins[index]++; } /* Build a message to hold the output records */ - gr_message_sptr msg = gr_make_message(0, minimum, maximum, d_num_bins*sizeof(float)); + message::sptr msg = message::make(0, minimum, maximum, d_num_bins*sizeof(float)); float *out = (float *)msg->msg(); // get pointer to raw message buffer /* normalize the bins and put into message */ for(unsigned int i = 0; i < d_num_bins; i++) { diff --git a/gr-wxgui/lib/histo_sink_f_impl.h b/gr-wxgui/lib/histo_sink_f_impl.h index 98b0fe6706..6c16a8a465 100644 --- a/gr-wxgui/lib/histo_sink_f_impl.h +++ b/gr-wxgui/lib/histo_sink_f_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_HISTO_SINK_F_IMPL_H #define INCLUDED_GR_HISTO_SINK_F_IMPL_H -#include <wxgui/histo_sink_f.h> +#include <gnuradio/wxgui/histo_sink_f.h> namespace gr { namespace wxgui { @@ -31,7 +31,7 @@ namespace gr { class histo_sink_f_impl : public histo_sink_f { private: - gr_msg_queue_sptr d_msgq; + msg_queue::sptr d_msgq; unsigned int d_num_bins; unsigned int d_frame_size; unsigned int d_sample_count; @@ -43,7 +43,7 @@ namespace gr { void clear(void); public: - histo_sink_f_impl(gr_msg_queue_sptr msgq); + histo_sink_f_impl(msg_queue::sptr msgq); ~histo_sink_f_impl(void); int work(int noutput_items, diff --git a/gr-wxgui/lib/oscope_guts.cc b/gr-wxgui/lib/oscope_guts.cc index 3d1f085a6f..d406932dae 100644 --- a/gr-wxgui/lib/oscope_guts.cc +++ b/gr-wxgui/lib/oscope_guts.cc @@ -24,7 +24,7 @@ #include <config.h> #endif -#include <wxgui/oscope_guts.h> +#include <gnuradio/wxgui/oscope_guts.h> #include <stdexcept> #include <stdio.h> #include <algorithm> @@ -68,7 +68,7 @@ namespace gr { return wrap_bi(buffer_index - 1, mx); } - oscope_guts::oscope_guts(double sample_rate, gr_msg_queue_sptr msgq) + oscope_guts::oscope_guts(double sample_rate, msg_queue::sptr msgq) : d_nchannels(1), d_msgq(msgq), d_trigger_mode(TRIG_MODE_AUTO), @@ -251,8 +251,8 @@ namespace gr { if(d_msgq->full_p()) return; // Build a message to hold the output records - gr_message_sptr msg = - gr_make_message(0, // msg type + message::sptr msg = + message::make(0, // msg type d_nchannels, // arg1 for other side mx, // arg2 for other side ((d_nchannels * mx) + 1) * sizeof(float)); // sizeof payload diff --git a/gr-wxgui/lib/oscope_sink_f_impl.cc b/gr-wxgui/lib/oscope_sink_f_impl.cc index 5e578cb8e3..9993040ffd 100644 --- a/gr-wxgui/lib/oscope_sink_f_impl.cc +++ b/gr-wxgui/lib/oscope_sink_f_impl.cc @@ -25,23 +25,23 @@ #endif #include "oscope_sink_f_impl.h" -#include <wxgui/oscope_sink_x.h> -#include <wxgui/oscope_guts.h> -#include <gr_io_signature.h> +#include <gnuradio/wxgui/oscope_sink_x.h> +#include <gnuradio/wxgui/oscope_guts.h> +#include <gnuradio/io_signature.h> namespace gr { namespace wxgui { oscope_sink_f::sptr - oscope_sink_f::make(double sampling_rate, gr_msg_queue_sptr msgq) + oscope_sink_f::make(double sampling_rate, msg_queue::sptr msgq) { return gnuradio::get_initial_sptr (new oscope_sink_f_impl(sampling_rate, msgq)); } - oscope_sink_f_impl::oscope_sink_f_impl(double sampling_rate, gr_msg_queue_sptr msgq) + oscope_sink_f_impl::oscope_sink_f_impl(double sampling_rate, msg_queue::sptr msgq) : oscope_sink_x("oscope_sink_f", - gr_make_io_signature(1, oscope_guts::MAX_CHANNELS, + io_signature::make(1, oscope_guts::MAX_CHANNELS, sizeof(float)), sampling_rate), d_msgq(msgq) diff --git a/gr-wxgui/lib/oscope_sink_f_impl.h b/gr-wxgui/lib/oscope_sink_f_impl.h index 6ad28a885f..81688f53a5 100644 --- a/gr-wxgui/lib/oscope_sink_f_impl.h +++ b/gr-wxgui/lib/oscope_sink_f_impl.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_GR_OSCOPE_SINK_F_IMPL_H #define INCLUDED_GR_OSCOPE_SINK_F_IMPL_H -#include <wxgui/oscope_sink_f.h> +#include <gnuradio/wxgui/oscope_sink_f.h> namespace gr { namespace wxgui { @@ -31,10 +31,10 @@ namespace gr { class oscope_sink_f_impl : public oscope_sink_f { private: - gr_msg_queue_sptr d_msgq; + msg_queue::sptr d_msgq; public: - oscope_sink_f_impl(double sampling_rate, gr_msg_queue_sptr msgq); + oscope_sink_f_impl(double sampling_rate, msg_queue::sptr msgq); ~oscope_sink_f_impl(); bool check_topology(int ninputs, int noutputs); diff --git a/gr-wxgui/lib/oscope_sink_x.cc b/gr-wxgui/lib/oscope_sink_x.cc index 417442979c..c97495fe53 100644 --- a/gr-wxgui/lib/oscope_sink_x.cc +++ b/gr-wxgui/lib/oscope_sink_x.cc @@ -24,18 +24,18 @@ #include "config.h" #endif -#include <wxgui/oscope_sink_x.h> -#include <wxgui/oscope_guts.h> -#include <gr_io_signature.h> +#include <gnuradio/wxgui/oscope_sink_x.h> +#include <gnuradio/wxgui/oscope_guts.h> +#include <gnuradio/io_signature.h> namespace gr { namespace wxgui { oscope_sink_x::oscope_sink_x(const std::string name, - gr_io_signature_sptr input_sig, + gr::io_signature::sptr input_sig, double sampling_rate) - : gr_sync_block(name, input_sig, - gr_make_io_signature(0, 0, 0)), + : sync_block(name, input_sig, + io_signature::make(0, 0, 0)), d_sampling_rate(sampling_rate), d_guts(0) { } diff --git a/gr-wxgui/swig/CMakeLists.txt b/gr-wxgui/swig/CMakeLists.txt index c7f5bcd96c..f02f1f1455 100644 --- a/gr-wxgui/swig/CMakeLists.txt +++ b/gr-wxgui/swig/CMakeLists.txt @@ -36,7 +36,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/wxgui_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/wxgui) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/wxgui) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) set(GR_SWIG_TARGET_DEPS wxgui_generated_includes) set(GR_SWIG_LIBRARIES gnuradio-wxgui) diff --git a/gr-wxgui/swig/wxgui_swig.i b/gr-wxgui/swig/wxgui_swig.i index 69c1887a46..2051dd45eb 100644 --- a/gr-wxgui/swig/wxgui_swig.i +++ b/gr-wxgui/swig/wxgui_swig.i @@ -27,17 +27,17 @@ //load generated python docstrings %include "wxgui_swig_doc.i" -%include "wxgui/trigger_mode.h" +%include "gnuradio/wxgui/trigger_mode.h" %{ -#include "wxgui/oscope_sink_x.h" -#include "wxgui/histo_sink_f.h" -#include "wxgui/oscope_sink_f.h" +#include "gnuradio/wxgui/oscope_sink_x.h" +#include "gnuradio/wxgui/histo_sink_f.h" +#include "gnuradio/wxgui/oscope_sink_f.h" %} -%include "wxgui/oscope_sink_x.h" -%include "wxgui/histo_sink_f.h" -%include "wxgui/oscope_sink_f.h" +%include "gnuradio/wxgui/oscope_sink_x.h" +%include "gnuradio/wxgui/histo_sink_f.h" +%include "gnuradio/wxgui/oscope_sink_f.h" GR_SWIG_BLOCK_MAGIC2(wxgui, histo_sink_f); GR_SWIG_BLOCK_MAGIC2(wxgui, oscope_sink_f); |