[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 20/29: zeromq: cleanup and convert pub_msg_
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 20/29: zeromq: cleanup and convert pub_msg_sink to derive from gr::block |
Date: |
Tue, 13 Jan 2015 01:04:28 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 3827ff325ef1bcdbeedb46b7b4efff4f897da0ae
Author: Johnathan Corgan <address@hidden>
Date: Mon Jan 12 13:19:48 2015 -0800
zeromq: cleanup and convert pub_msg_sink to derive from gr::block
---
gr-zeromq/include/gnuradio/zeromq/pub_msg_sink.h | 10 +++++-----
gr-zeromq/lib/pub_msg_sink_impl.cc | 25 ++++++++++--------------
gr-zeromq/lib/pub_msg_sink_impl.h | 3 ---
3 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/gr-zeromq/include/gnuradio/zeromq/pub_msg_sink.h
b/gr-zeromq/include/gnuradio/zeromq/pub_msg_sink.h
index d626ddd..ffcb475 100644
--- a/gr-zeromq/include/gnuradio/zeromq/pub_msg_sink.h
+++ b/gr-zeromq/include/gnuradio/zeromq/pub_msg_sink.h
@@ -30,17 +30,17 @@ namespace gr {
namespace zeromq {
/*!
- * \brief Sink the contents of a stream to a ZMQ PUB socket
+ * \brief Sink the contents of a msg port to a ZMQ PUB socket
* \ingroup zeromq
*
* \details
- * This block acts a a streaming sink for a GNU Radio flowgraph
- * and writes its contents to a ZMQ PUB socket. A PUB socket may
- * have subscribers and will pass all incoming stream data to each
+ * This block acts a message port receiver and writes individual
+ * messages to a ZMQ PUB socket. A PUB socket may have
+ * subscribers and will pass all incoming messages to each
* subscriber. Subscribers can be either another gr-zeromq source
* block or a non-GNU Radio ZMQ socket.
*/
- class ZEROMQ_API pub_msg_sink : virtual public gr::sync_block
+ class ZEROMQ_API pub_msg_sink : virtual public gr::block
{
public:
typedef boost::shared_ptr<pub_msg_sink> sptr;
diff --git a/gr-zeromq/lib/pub_msg_sink_impl.cc
b/gr-zeromq/lib/pub_msg_sink_impl.cc
index 0264aef..5fc7164 100644
--- a/gr-zeromq/lib/pub_msg_sink_impl.cc
+++ b/gr-zeromq/lib/pub_msg_sink_impl.cc
@@ -39,9 +39,9 @@ namespace gr {
}
pub_msg_sink_impl::pub_msg_sink_impl(char *address, int timeout)
- : gr::sync_block("pub_msg_sink",
- gr::io_signature::make(0, 0, 0),
- gr::io_signature::make(0, 0, 0)),
+ : gr::block("pub_msg_sink",
+ gr::io_signature::make(0, 0, 0),
+ gr::io_signature::make(0, 0, 0)),
d_timeout(timeout)
{
int major, minor, patch;
@@ -49,6 +49,7 @@ namespace gr {
if (major < 3) {
d_timeout = timeout*1000;
}
+
d_context = new zmq::context_t(1);
d_socket = new zmq::socket_t(*d_context, ZMQ_PUB);
int time = 0;
@@ -56,7 +57,7 @@ namespace gr {
d_socket->bind(address);
message_port_register_in(pmt::mp("in"));
- set_msg_handler( pmt::mp("in"),
+ set_msg_handler( pmt::mp("in"),
boost::bind(&pub_msg_sink_impl::handler, this, _1));
}
@@ -67,21 +68,15 @@ namespace gr {
delete d_context;
}
- void pub_msg_sink_impl::handler(pmt::pmt_t msg){
+ void pub_msg_sink_impl::handler(pmt::pmt_t msg)
+ {
std::stringbuf sb("");
- pmt::serialize( msg, sb );
+ pmt::serialize(msg, sb);
std::string s = sb.str();
zmq::message_t zmsg(s.size());
- memcpy( zmsg.data(), s.c_str(), s.size() );
- d_socket->send(zmsg);
- }
- int
- pub_msg_sink_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- return noutput_items;
+ memcpy(zmsg.data(), s.c_str(), s.size());
+ d_socket->send(zmsg);
}
} /* namespace zeromq */
diff --git a/gr-zeromq/lib/pub_msg_sink_impl.h
b/gr-zeromq/lib/pub_msg_sink_impl.h
index 4bbf7ee..747ac7e 100644
--- a/gr-zeromq/lib/pub_msg_sink_impl.h
+++ b/gr-zeromq/lib/pub_msg_sink_impl.h
@@ -40,9 +40,6 @@ namespace gr {
pub_msg_sink_impl(char *address, int timeout);
~pub_msg_sink_impl();
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
void handler(pmt::pmt_t msg);
};
- [Commit-gnuradio] [gnuradio] branch master updated (5cb307e -> 1581681), git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 13/29: zmq: adding header information, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 11/29: zeromq: fix segfault in tag_headers, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 16/29: zmq: naming cleanup, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 17/29: zmq: pull_msg_source should be working, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 20/29: zeromq: cleanup and convert pub_msg_sink to derive from gr::block,
git <=
- [Commit-gnuradio] [gnuradio] 23/29: zeromq: cleanup and made pull_msg_source derive from gr::block, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 07/29: zmq: all source blocks should now support tag headers, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 06/29: zmq: hoisting tag parsing into helper function, should now be easy to use in other zmq blocks, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 14/29: zmq: Adding zmq pub/sub blocks for message passing, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 21/29: zeromq: cleanup and convert sub_msg_source to derive from gr::block, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 22/29: zeromq: cleanup and converted push_msg_sink to derive from gr::block, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 01/29: zmq: encoding tags into zmq stream, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 10/29: zeromq: fixups and stylistic changes before merge, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 24/29: zeromq: cleanup and converted rep_msg_sink to derive from gr::block, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 08/29: zmq: sync blocks now all support tag headers, git, 2015/01/12