diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-03-06 12:23:05 -0500 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-03-06 12:23:05 -0500 |
commit | a770feec38cd8a188a4c4c88f34d513155b4b539 (patch) | |
tree | ac5a0263daf24c8a78868a307df68a30c9890b0b /gnuradio-core/src/lib/io | |
parent | a08afb0b0166cab961982f174a5cf672393b5198 (diff) |
blocks: removing blocks moved into gr-blocks:
message_strobe, message_debug, message_source, message_sink, message_burst_source, peak_detector, moving_average.
Diffstat (limited to 'gnuradio-core/src/lib/io')
-rw-r--r-- | gnuradio-core/src/lib/io/CMakeLists.txt | 4 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_burst_source.cc | 144 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_burst_source.h | 71 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_burst_source.i | 38 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_debug.cc | 121 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_debug.h | 114 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_debug.i | 30 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_sink.cc | 79 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_sink.h | 63 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_sink.i | 36 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_source.cc | 120 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_source.h | 69 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_source.i | 38 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/io.i | 8 |
14 files changed, 0 insertions, 935 deletions
diff --git a/gnuradio-core/src/lib/io/CMakeLists.txt b/gnuradio-core/src/lib/io/CMakeLists.txt index 7368283dab..dc0ffe62b1 100644 --- a/gnuradio-core/src/lib/io/CMakeLists.txt +++ b/gnuradio-core/src/lib/io/CMakeLists.txt @@ -85,10 +85,6 @@ set(gr_core_io_triple_threats gr_file_source gr_file_descriptor_sink gr_file_descriptor_source - gr_message_debug - gr_message_sink - gr_message_source - gr_message_burst_source microtune_xxxx_eval_board microtune_4702_eval_board microtune_4937_eval_board diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.cc b/gnuradio-core/src/lib/io/gr_message_burst_source.cc deleted file mode 100644 index 968df6ec38..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_burst_source.cc +++ /dev/null @@ -1,144 +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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_message_burst_source.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> -#include <gr_tags.h> - -// public constructor that returns a shared_ptr - -gr_message_burst_source_sptr -gr_make_message_burst_source(size_t itemsize, int msgq_limit) -{ - return gnuradio::get_initial_sptr(new gr_message_burst_source(itemsize, msgq_limit)); -} - -// public constructor that takes existing message queue -gr_message_burst_source_sptr -gr_make_message_burst_source(size_t itemsize, gr_msg_queue_sptr msgq) -{ - return gnuradio::get_initial_sptr(new gr_message_burst_source(itemsize, msgq)); -} - -gr_message_burst_source::gr_message_burst_source (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)), d_msg_offset(0), d_eof(false) -{ - std::stringstream id; - id << name() << unique_id(); - d_me = pmt::string_to_symbol(id.str()); -} - -gr_message_burst_source::gr_message_burst_source (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)), - d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false) -{ - std::stringstream id; - id << name() << unique_id(); - d_me = pmt::string_to_symbol(id.str()); -} - -gr_message_burst_source::~gr_message_burst_source() -{ -} - -int -gr_message_burst_source::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - char *out = (char *) output_items[0]; - int nn = 0; - - uint64_t abs_sample_count = nitems_written(0); - - while (nn < noutput_items){ - if (d_msg){ - // - // Consume whatever we can from the current message - // - - int mm = std::min(noutput_items - nn, (int)((d_msg->length() - d_msg_offset) / d_itemsize)); - memcpy (out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize); - - nn += mm; - out += mm * d_itemsize; - d_msg_offset += mm * d_itemsize; - assert(d_msg_offset <= d_msg->length()); - - if (d_msg_offset == d_msg->length()){ - if (d_msg->type() == 1) // type == 1 sets EOF - d_eof = true; - d_msg.reset(); - //tag end of burst - add_item_tag(0, //stream ID - abs_sample_count+nn-1, //sample number - pmt::string_to_symbol("tx_eob"), - pmt::from_bool(1), - d_me //block src id - ); - } - } - else { - // - // No current message - // - if (d_msgq->empty_p() && nn > 0){ // no more messages in the queue, return what we've got - break; - } - - if (d_eof) - return -1; - - d_msg = d_msgq->delete_head(); // block, waiting for a message - d_msg_offset = 0; - //tag start of burst - add_item_tag(0, //stream ID - abs_sample_count+nn, //sample number - pmt::string_to_symbol("tx_sob"), - pmt::from_bool(1), - d_me //block src id - ); - - - if ((d_msg->length() % d_itemsize) != 0) - throw std::runtime_error("msg length is not a multiple of d_itemsize"); - } - } - - return nn; -} diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.h b/gnuradio-core/src/lib/io/gr_message_burst_source.h deleted file mode 100644 index 63e2201139..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_burst_source.h +++ /dev/null @@ -1,71 +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. - */ - -#ifndef INCLUDED_GR_MESSAGE_BURST_SOURCE_H -#define INCLUDED_GR_MESSAGE_BURST_SOURCE_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> - -class gr_message_burst_source; -typedef boost::shared_ptr<gr_message_burst_source> gr_message_burst_source_sptr; - -GR_CORE_API gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, int msgq_limit=0); -GR_CORE_API gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq); - -/*! - * \brief Turn received messages into a stream and tag them for UHD to send. - * \ingroup source_blk - */ -class GR_CORE_API gr_message_burst_source : public gr_sync_block -{ - private: - size_t d_itemsize; - gr_msg_queue_sptr d_msgq; - gr_message_sptr d_msg; - unsigned d_msg_offset; - bool d_eof; - - pmt::pmt_t d_me; - - friend GR_CORE_API gr_message_burst_source_sptr - gr_make_message_burst_source(size_t itemsize, int msgq_limit); - friend GR_CORE_API gr_message_burst_source_sptr - gr_make_message_burst_source(size_t itemsize, gr_msg_queue_sptr msgq); - - protected: - gr_message_burst_source (size_t itemsize, int msgq_limit); - gr_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq); - - public: - ~gr_message_burst_source (); - - gr_msg_queue_sptr msgq() const { return d_msgq; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_gr_message_burst_source_H */ diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.i b/gnuradio-core/src/lib/io/gr_message_burst_source.i deleted file mode 100644 index f7ad840c22..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_burst_source.i +++ /dev/null @@ -1,38 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_burst_source); - -gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, int msgq_limit=0); -gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq); - -class gr_message_burst_source : public gr_sync_block -{ - protected: - gr_message_burst_source (size_t itemsize, int msgq_limit); - gr_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq); - - public: - ~gr_message_burst_source (); - - gr_msg_queue_sptr msgq() const; -}; diff --git a/gnuradio-core/src/lib/io/gr_message_debug.cc b/gnuradio-core/src/lib/io/gr_message_debug.cc deleted file mode 100644 index 07c0af1e34..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_debug.cc +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010,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_message_debug.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> -#include <iostream> - -// public constructor that returns a shared_ptr - -gr_message_debug_sptr -gr_make_message_debug () -{ - return gnuradio::get_initial_sptr(new gr_message_debug()); -} - -void -gr_message_debug::print(pmt::pmt_t msg) -{ - std::cout << "******* MESSAGE DEBUG PRINT ********\n"; - pmt::print(msg); - std::cout << "************************************\n"; -} - -void -gr_message_debug::store(pmt::pmt_t msg) -{ - gruel::scoped_lock guard(d_mutex); - d_messages.push_back(msg); -} - -void -gr_message_debug::print_pdu(pmt::pmt_t pdu) -{ - pmt::pmt_t meta = pmt::car(pdu); - pmt::pmt_t vector = pmt::cdr(pdu); - - std::cout << "* MESSAGE DEBUG PRINT PDU VERBOSE *\n"; - pmt::print(meta); - size_t len = pmt::length(vector); - std::cout << "pdu_length = " << len << std::endl; - std::cout << "contents = " << std::endl; - size_t offset(0); - const uint8_t* d = (const uint8_t*) uniform_vector_elements(vector, offset); - for(size_t i=0; i<len; i+=16){ - printf("%04x: ", ((unsigned int)i)); - for(size_t j=i; j<std::min(i+16,len); j++){ - printf("%02x ",d[j] ); - } - - std::cout << std::endl; - } - - std::cout << "***********************************\n"; -} - -int -gr_message_debug::num_messages() -{ - return (int)d_messages.size(); -} - -pmt::pmt_t -gr_message_debug::get_message(int i) -{ - gruel::scoped_lock guard(d_mutex); - - if((size_t)i >= d_messages.size()) { - throw std::runtime_error("gr_message_debug: index for message out of bounds.\n"); - } - - return d_messages[i]; -} - -gr_message_debug::gr_message_debug() - : gr_block("message_debug", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)) -{ - message_port_register_in(pmt::mp("print")); - set_msg_handler(pmt::mp("print"), boost::bind(&gr_message_debug::print, this, _1)); - - message_port_register_in(pmt::mp("store")); - set_msg_handler(pmt::mp("store"), boost::bind(&gr_message_debug::store, this, _1)); - - message_port_register_in(pmt::mp("print_pdu")); - set_msg_handler(pmt::mp("print_pdu"), boost::bind(&gr_message_debug::print_pdu, this, _1)); -} - -gr_message_debug::~gr_message_debug() -{ -} diff --git a/gnuradio-core/src/lib/io/gr_message_debug.h b/gnuradio-core/src/lib/io/gr_message_debug.h deleted file mode 100644 index f1374e8062..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_debug.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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_GR_MESSAGE_DEBUG_H -#define INCLUDED_GR_MESSAGE_DEBUG_H - -#include <gr_core_api.h> -#include <gr_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> -#include <gruel/thread.h> - -class gr_message_debug; -typedef boost::shared_ptr<gr_message_debug> gr_message_debug_sptr; - -GR_CORE_API gr_message_debug_sptr gr_make_message_debug(); - -/*! - * \brief Print received messages to stdout - * \ingroup sink_blk - */ -class GR_CORE_API gr_message_debug : public gr_block -{ - private: - friend GR_CORE_API gr_message_debug_sptr - gr_make_message_debug(); - - /*! - * \brief Messages received in this port are printed to stdout. - * - * This port receives messages from the scheduler's message handling - * mechanism and prints it to stdout. This message handler function - * is only meant to be used by the scheduler to handle messages - * posted to port 'print'. - * - * \param msg A pmt message passed from the scheduler's message handling. - */ - void print(pmt::pmt_t msg); - - /*! - * \brief PDU formatted messages received in this port are printed to stdout. - * - * This port receives messages from the scheduler's message handling - * mechanism and prints it to stdout. This message handler function - * is only meant to be used by the scheduler to handle messages - * posted to port 'print'. - * - * \param pdu A PDU message passed from the scheduler's message handling. - */ - void print_pdu(pmt::pmt_t pdu); - - /*! - * \brief Messages received in this port are stored in a vector. - * - * This port receives messages from the scheduler's message handling - * mechanism and stores it in a vector. Messages can be retrieved - * later using the 'get_message' function. This message handler - * function is only meant to be used by the scheduler to handle - * messages posted to port 'store'. - * - * \param msg A pmt message passed from the scheduler's message handling. - */ - void store(pmt::pmt_t msg); - - gruel::mutex d_mutex; - std::vector<pmt::pmt_t> d_messages; - - protected: - gr_message_debug (); - - public: - ~gr_message_debug (); - - /*! - * \brief Reports the number of messages received by this block. - */ - int num_messages(); - - /*! - * \brief Get a message (as a PMT) from the message vector at index \p i. - * - * Messages passed to the 'store' port will be stored in a - * vector. This function retrieves those messages by index. They are - * index in order of when they were received (all messages are just - * pushed onto the back of a vector). This is mostly useful in - * debugging message passing graphs and in QA code. - * - * \param i The index in the vector for the message to retrieve. - * - * \return a message at index \p i as a pmt_t. - */ - pmt::pmt_t get_message(int i); -}; - -#endif /* INCLUDED_GR_MESSAGE_DEBUG_H */ diff --git a/gnuradio-core/src/lib/io/gr_message_debug.i b/gnuradio-core/src/lib/io/gr_message_debug.i deleted file mode 100644 index 65d3bfc4aa..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_debug.i +++ /dev/null @@ -1,30 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_debug); - -%{ -#include <gr_message_debug.h> -%} - -%include "gr_message_debug.h" - diff --git a/gnuradio-core/src/lib/io/gr_message_sink.cc b/gnuradio-core/src/lib/io/gr_message_sink.cc deleted file mode 100644 index ae0b5c7649..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_sink.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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_message_sink.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> - - -// public constructor that returns a shared_ptr - -gr_message_sink_sptr -gr_make_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block) -{ - return gnuradio::get_initial_sptr(new gr_message_sink(itemsize, msgq, dont_block)); -} - -gr_message_sink::gr_message_sink (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)), - d_itemsize(itemsize), d_msgq(msgq), d_dont_block(dont_block) -{ -} - -gr_message_sink::~gr_message_sink() -{ -} - -int -gr_message_sink::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *in = (const char *) input_items[0]; - - // if we'd block, drop the data on the floor and say everything is OK - if (d_dont_block && d_msgq->full_p()) - return noutput_items; - - // 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 - memcpy(msg->msg(), in, noutput_items * d_itemsize); - - d_msgq->handle(msg); // send it - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/io/gr_message_sink.h b/gnuradio-core/src/lib/io/gr_message_sink.h deleted file mode 100644 index 84005694a1..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_sink.h +++ /dev/null @@ -1,63 +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_SINK_H -#define INCLUDED_GR_MESSAGE_SINK_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> - -class gr_message_sink; -typedef boost::shared_ptr<gr_message_sink> gr_message_sink_sptr; - -GR_CORE_API gr_message_sink_sptr gr_make_message_sink (size_t itemsize, - gr_msg_queue_sptr msgq, - bool dont_block); - -/*! - * \brief Gather received items into messages and insert into msgq - * \ingroup sink_blk - */ -class GR_CORE_API gr_message_sink : public gr_sync_block -{ - private: - size_t d_itemsize; - gr_msg_queue_sptr d_msgq; - bool d_dont_block; - - friend GR_CORE_API gr_message_sink_sptr - gr_make_message_sink(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block); - - protected: - gr_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block); - - public: - ~gr_message_sink (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_MESSAGE_SINK_H */ diff --git a/gnuradio-core/src/lib/io/gr_message_sink.i b/gnuradio-core/src/lib/io/gr_message_sink.i deleted file mode 100644 index 8415cbd66d..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_sink.i +++ /dev/null @@ -1,36 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_sink); - -gr_message_sink_sptr gr_make_message_sink (size_t itemsize, - gr_msg_queue_sptr msgq, - bool dont_block); - -class gr_message_sink : public gr_sync_block -{ - protected: - gr_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block); - - public: - ~gr_message_sink (); -}; diff --git a/gnuradio-core/src/lib/io/gr_message_source.cc b/gnuradio-core/src/lib/io/gr_message_source.cc deleted file mode 100644 index fb3da89a8b..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_source.cc +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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_message_source.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> - - -// public constructor that returns a shared_ptr - -gr_message_source_sptr -gr_make_message_source(size_t itemsize, int msgq_limit) -{ - return gnuradio::get_initial_sptr(new gr_message_source(itemsize, msgq_limit)); -} - -// public constructor that takes existing message queue -gr_message_source_sptr -gr_make_message_source(size_t itemsize, gr_msg_queue_sptr msgq) -{ - return gnuradio::get_initial_sptr(new gr_message_source(itemsize, msgq)); -} - -gr_message_source::gr_message_source (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)), d_msg_offset(0), d_eof(false) -{ -} - -gr_message_source::gr_message_source (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)), - d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false) -{ -} - -gr_message_source::~gr_message_source() -{ -} - -int -gr_message_source::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - char *out = (char *) output_items[0]; - int nn = 0; - - while (nn < noutput_items){ - if (d_msg){ - // - // Consume whatever we can from the current message - // - int mm = std::min(noutput_items - nn, (int)((d_msg->length() - d_msg_offset) / d_itemsize)); - memcpy (out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize); - - nn += mm; - out += mm * d_itemsize; - d_msg_offset += mm * d_itemsize; - assert(d_msg_offset <= d_msg->length()); - - if (d_msg_offset == d_msg->length()){ - if (d_msg->type() == 1) // type == 1 sets EOF - d_eof = true; - d_msg.reset(); - } - } - else { - // - // No current message - // - if (d_msgq->empty_p() && nn > 0){ // no more messages in the queue, return what we've got - break; - } - - if (d_eof) - return -1; - - d_msg = d_msgq->delete_head(); // block, waiting for a message - d_msg_offset = 0; - - if ((d_msg->length() % d_itemsize) != 0) - throw std::runtime_error("msg length is not a multiple of d_itemsize"); - } - } - - return nn; -} diff --git a/gnuradio-core/src/lib/io/gr_message_source.h b/gnuradio-core/src/lib/io/gr_message_source.h deleted file mode 100644 index c510d1775f..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_source.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_MESSAGE_SOURCE_H -#define INCLUDED_GR_MESSAGE_SOURCE_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> - -class gr_message_source; -typedef boost::shared_ptr<gr_message_source> gr_message_source_sptr; - -GR_CORE_API gr_message_source_sptr gr_make_message_source (size_t itemsize, int msgq_limit=0); -GR_CORE_API gr_message_source_sptr gr_make_message_source (size_t itemsize, gr_msg_queue_sptr msgq); - -/*! - * \brief Turn received messages into a stream - * \ingroup source_blk - */ -class GR_CORE_API gr_message_source : public gr_sync_block -{ - private: - size_t d_itemsize; - gr_msg_queue_sptr d_msgq; - gr_message_sptr d_msg; - unsigned d_msg_offset; - bool d_eof; - - friend GR_CORE_API gr_message_source_sptr - gr_make_message_source(size_t itemsize, int msgq_limit); - friend GR_CORE_API gr_message_source_sptr - gr_make_message_source(size_t itemsize, gr_msg_queue_sptr msgq); - - protected: - gr_message_source (size_t itemsize, int msgq_limit); - gr_message_source (size_t itemsize, gr_msg_queue_sptr msgq); - - public: - ~gr_message_source (); - - gr_msg_queue_sptr msgq() const { return d_msgq; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_MESSAGE_SOURCE_H */ diff --git a/gnuradio-core/src/lib/io/gr_message_source.i b/gnuradio-core/src/lib/io/gr_message_source.i deleted file mode 100644 index 9ee9157e8c..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_source.i +++ /dev/null @@ -1,38 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_source); - -gr_message_source_sptr gr_make_message_source (size_t itemsize, int msgq_limit=0); -gr_message_source_sptr gr_make_message_source (size_t itemsize, gr_msg_queue_sptr msgq); - -class gr_message_source : public gr_sync_block -{ - protected: - gr_message_source (size_t itemsize, int msgq_limit); - gr_message_source (size_t itemsize, gr_msg_queue_sptr msgq); - - public: - ~gr_message_source (); - - gr_msg_queue_sptr msgq() const; -}; diff --git a/gnuradio-core/src/lib/io/io.i b/gnuradio-core/src/lib/io/io.i index 01a174903d..be2ce99374 100644 --- a/gnuradio-core/src/lib/io/io.i +++ b/gnuradio-core/src/lib/io/io.i @@ -37,15 +37,11 @@ #include <gr_oscope_sink_x.h> #include <gr_oscope_sink_f.h> #include <ppio.h> -#include <gr_message_source.h> -#include <gr_message_burst_source.h> -#include <gr_message_sink.h> #include <gr_udp_sink.h> #include <gr_udp_source.h> #include <gr_wavfile_sink.h> #include <gr_wavfile_source.h> #include <gr_tagged_file_sink.h> -#include <gr_message_debug.h> %} %include "gr_file_sink_base.i" @@ -60,14 +56,10 @@ %include "sdr_1000.i" %include "gr_oscope_sink.i" %include "ppio.i" -%include "gr_message_source.i" -%include "gr_message_burst_source.i" -%include "gr_message_sink.i" %include "gr_udp_sink.i" %include "gr_udp_source.i" %include "gr_wavfile_sink.i" %include "gr_wavfile_source.i" %include "gr_tagged_file_sink.i" -%include "gr_message_debug.i" |