summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2014-04-21 11:51:39 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2014-04-22 15:07:42 -0700
commit6850d68a14d96fd160892567f793605ab427817b (patch)
treec70940f852a29dd291ff86bf42447334bca04eb5
parent9833f3fb80c788d740dc1328899d50165cfdfa90 (diff)
zeromq: renamed sink_pubsub to pub_sink
-rwxr-xr-xgr-zeromq/examples/client.py2
-rwxr-xr-xgr-zeromq/examples/server.py2
-rw-r--r--gr-zeromq/grc/CMakeLists.txt2
-rw-r--r--gr-zeromq/grc/zeromq_pub_sink.xml (renamed from gr-zeromq/grc/zeromq_sink_pubsub.xml)6
-rw-r--r--gr-zeromq/grc/zeromq_pull_feedback_source.xml (renamed from gr-zeromq/grc/zeromq_soure_pushpull_feedback.xml)0
-rw-r--r--gr-zeromq/include/gnuradio/zeromq/CMakeLists.txt3
-rw-r--r--gr-zeromq/include/gnuradio/zeromq/pub_sink.h (renamed from gr-zeromq/include/gnuradio/zeromq/sink_pubsub.h)12
-rw-r--r--gr-zeromq/include/gnuradio/zeromq/pull_feedback_source.h (renamed from gr-zeromq/include/gnuradio/zeromq/source_pushpull_feedback.h)29
-rw-r--r--gr-zeromq/lib/CMakeLists.txt4
-rw-r--r--gr-zeromq/lib/pub_sink_impl.cc (renamed from gr-zeromq/lib/sink_pubsub_impl.cc)20
-rw-r--r--gr-zeromq/lib/pub_sink_impl.h (renamed from gr-zeromq/lib/sink_pubsub_impl.h)14
-rw-r--r--gr-zeromq/lib/pull_feedback_source_impl.cc (renamed from gr-zeromq/lib/source_pushpull_feedback_impl.cc)28
-rw-r--r--gr-zeromq/lib/pull_feedback_source_impl.h (renamed from gr-zeromq/lib/source_pushpull_feedback_impl.h)17
-rw-r--r--gr-zeromq/lib/pull_source_impl.cc2
-rw-r--r--gr-zeromq/swig/zeromq_swig.i12
15 files changed, 79 insertions, 74 deletions
diff --git a/gr-zeromq/examples/client.py b/gr-zeromq/examples/client.py
index ceb3959478..9ae57f7d15 100755
--- a/gr-zeromq/examples/client.py
+++ b/gr-zeromq/examples/client.py
@@ -56,7 +56,7 @@ class top_block(gr.top_block):
self.zmq_source = zeromq.source_reqrep(gr.sizeof_float,source_adr)
#self.zmq_source = zeromq.pull_source(gr.sizeof_float,source_adr)
#self.zmq_probe = zeromq.push_sink(gr.sizeof_float,probe_adr)
- self.zmq_probe = zeromq.sink_pubsub(gr.sizeof_float,probe_adr)
+ self.zmq_probe = zeromq.pub_sink(gr.sizeof_float,probe_adr)
# connects
self.connect(self.zmq_source, self.zmq_probe)
diff --git a/gr-zeromq/examples/server.py b/gr-zeromq/examples/server.py
index 70fe3a5d99..0ca1b4f99c 100755
--- a/gr-zeromq/examples/server.py
+++ b/gr-zeromq/examples/server.py
@@ -62,7 +62,7 @@ class top_block(gr.top_block):
self.zmq_sink = zeromq.sink_reqrep(gr.sizeof_float, sink_adr)
#self.zmq_sink = zeromq.push_sink(gr.sizeof_float, sink_adr)
#self.zmq_probe = zeromq.push_sink(gr.sizeof_float, probe_adr)
- self.zmq_probe = zeromq.sink_pubsub(gr.sizeof_float, probe_adr)
+ self.zmq_probe = zeromq.pub_sink(gr.sizeof_float, probe_adr)
#self.null_sink = blocks.null_sink(gr.sizeof_float)
# connects
diff --git a/gr-zeromq/grc/CMakeLists.txt b/gr-zeromq/grc/CMakeLists.txt
index ba4a93182b..0829b5436a 100644
--- a/gr-zeromq/grc/CMakeLists.txt
+++ b/gr-zeromq/grc/CMakeLists.txt
@@ -18,7 +18,7 @@
# Boston, MA 02110-1301, USA.
install(FILES
- zeromq_sink_pubsub.xml
+ zeromq_pub_sink.xml
zeromq_push_sink.xml
zeromq_pull_source.xml
diff --git a/gr-zeromq/grc/zeromq_sink_pubsub.xml b/gr-zeromq/grc/zeromq_pub_sink.xml
index 787eefb2cd..64d26e1823 100644
--- a/gr-zeromq/grc/zeromq_sink_pubsub.xml
+++ b/gr-zeromq/grc/zeromq_pub_sink.xml
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
<block>
- <name>ZMQ PUB/SUB Sink</name>
- <key>zeromq_sink_pubsub</key>
+ <name>ZMQ PUB Sink</name>
+ <key>zeromq_pub_sink</key>
<category>ZeroMQ Interfaces</category>
<import>from gnuradio import zeromq</import>
- <make>zeromq.sink_pubsub($type.itemsize, $address, $blocking)</make>
+ <make>zeromq.pub_sink($type.itemsize, $address, $blocking)</make>
<param>
<name>IO Type</name>
diff --git a/gr-zeromq/grc/zeromq_soure_pushpull_feedback.xml b/gr-zeromq/grc/zeromq_pull_feedback_source.xml
index 6c5cd5bbd3..6c5cd5bbd3 100644
--- a/gr-zeromq/grc/zeromq_soure_pushpull_feedback.xml
+++ b/gr-zeromq/grc/zeromq_pull_feedback_source.xml
diff --git a/gr-zeromq/include/gnuradio/zeromq/CMakeLists.txt b/gr-zeromq/include/gnuradio/zeromq/CMakeLists.txt
index 9cad546ca5..ea18dd6b3c 100644
--- a/gr-zeromq/include/gnuradio/zeromq/CMakeLists.txt
+++ b/gr-zeromq/include/gnuradio/zeromq/CMakeLists.txt
@@ -22,9 +22,10 @@
########################################################################
install(FILES
api.h
+ pub_sink.h
+ pull_feedback_source.h
pull_source.h
push_sink.h
- sink_pubsub.h
sink_reqrep.h
sink_reqrep_nopoll.h
source_pushpull_feedback.h
diff --git a/gr-zeromq/include/gnuradio/zeromq/sink_pubsub.h b/gr-zeromq/include/gnuradio/zeromq/pub_sink.h
index 23aaba92a8..7c5734ee12 100644
--- a/gr-zeromq/include/gnuradio/zeromq/sink_pubsub.h
+++ b/gr-zeromq/include/gnuradio/zeromq/pub_sink.h
@@ -20,8 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_ZEROMQ_SINK_PUBSUB_H
-#define INCLUDED_ZEROMQ_SINK_PUBSUB_H
+#ifndef INCLUDED_ZEROMQ_PUB_SINK_H
+#define INCLUDED_ZEROMQ_PUB_SINK_H
#include <gnuradio/zeromq/api.h>
#include <gnuradio/sync_block.h>
@@ -40,13 +40,13 @@ namespace gr {
* subscriber. Subscribers can be either another gr-zeromq source
* block or a non-GNU Radio ZMQ socket.
*/
- class ZEROMQ_API sink_pubsub : virtual public gr::sync_block
+ class ZEROMQ_API pub_sink : virtual public gr::sync_block
{
public:
- typedef boost::shared_ptr<sink_pubsub> sptr;
+ typedef boost::shared_ptr<pub_sink> sptr;
/*!
- * \brief Return a shared_ptr to a new instance of zeromq::sink_pubsub.
+ * \brief Return a shared_ptr to a new instance of zeromq::pub_sink.
*
* \param itemsize Size of a stream item in bytes
* \param address ZMQ socket address specifier
@@ -58,4 +58,4 @@ namespace gr {
} // namespace zeromq
} // namespace gr
-#endif /* INCLUDED_ZEROMQ_SINK_PUBSUB_H */
+#endif /* INCLUDED_ZEROMQ_PUB_SINK_H */
diff --git a/gr-zeromq/include/gnuradio/zeromq/source_pushpull_feedback.h b/gr-zeromq/include/gnuradio/zeromq/pull_feedback_source.h
index 765bab023a..3da27b69dd 100644
--- a/gr-zeromq/include/gnuradio/zeromq/source_pushpull_feedback.h
+++ b/gr-zeromq/include/gnuradio/zeromq/pull_feedback_source.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2013 Free Software Foundation, Inc.
+ * Copyright 2013,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio.
*
@@ -20,8 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_ZEROMQ_SOURCE_PUSHPULL_FEEDBACK_H
-#define INCLUDED_ZEROMQ_SOURCE_PUSHPULL_FEEDBACK_H
+#ifndef INCLUDED_ZEROMQ_PULL_FEEDBACK_SOURCE_H
+#define INCLUDED_ZEROMQ_PULL_FEEDBACK_SOURCE_H
#include <gnuradio/zeromq/api.h>
#include <gnuradio/sync_block.h>
@@ -30,27 +30,30 @@ namespace gr {
namespace zeromq {
/*!
- * \brief <+description of block+>
+ * \brief Receive messages on ZMQ PULL socket and source stream
* \ingroup zeromq
*
+ * \details
+ * This block will connect to a ZMQ PULL socket, then produce all
+ * incoming messages as streaming output.
*/
- class ZEROMQ_API source_pushpull_feedback : virtual public gr::sync_block
+ class ZEROMQ_API pull_feedback_source : virtual public gr::sync_block
{
public:
- typedef boost::shared_ptr<source_pushpull_feedback> sptr;
+ typedef boost::shared_ptr<pull_feedback_source> sptr;
/*!
- * \brief Return a shared_ptr to a new instance of zeromq::source_pushpull_feedback.
+ * \brief Return a shared_ptr to a new instance of gr::zeromq::pull_source.
+ *
+ * \param itemsize Size of a stream item in bytes
+ * \param address ZMQ socket address specifier
+ * \param timeout Receive timeout in seconds, default is 100ms, 1us increments
*
- * To avoid accidental use of raw pointers, zeromq::source_pushpull_feedback's
- * constructor is in a private implementation
- * class. zeromq::source_pushpull_feedback::make is the public interface for
- * creating new instances.
*/
- static sptr make(size_t itemsize, char *address);
+ static sptr make(size_t itemsize, char *address, float timeout=0.1);
};
} // namespace zeromq
} // namespace gr
-#endif /* INCLUDED_ZEROMQ_SOURCE_PUSHPULL_FEEDBACK_H */
+#endif /* INCLUDED_ZEROMQ_PULL_FEEDBACK_SOURCE_H */
diff --git a/gr-zeromq/lib/CMakeLists.txt b/gr-zeromq/lib/CMakeLists.txt
index 4142723159..e12e80d4fe 100644
--- a/gr-zeromq/lib/CMakeLists.txt
+++ b/gr-zeromq/lib/CMakeLists.txt
@@ -38,12 +38,12 @@ endif(ENABLE_GR_CTRLPORT)
# Setup library
########################################################################
list(APPEND zeromq_sources
- sink_pubsub_impl.cc
+ pub_sink_impl.cc
+ pull_feedback_source_impl.cc
pull_source_impl.cc
push_sink_impl.cc
sink_reqrep_impl.cc
sink_reqrep_nopoll_impl.cc
- source_pushpull_feedback_impl.cc
source_reqrep_impl.cc
source_reqrep_nopoll_impl.cc
)
diff --git a/gr-zeromq/lib/sink_pubsub_impl.cc b/gr-zeromq/lib/pub_sink_impl.cc
index 5388d50a5d..086e995b2e 100644
--- a/gr-zeromq/lib/sink_pubsub_impl.cc
+++ b/gr-zeromq/lib/pub_sink_impl.cc
@@ -25,20 +25,20 @@
#endif
#include <gnuradio/io_signature.h>
-#include "sink_pubsub_impl.h"
+#include "pub_sink_impl.h"
namespace gr {
namespace zeromq {
- sink_pubsub::sptr
- sink_pubsub::make(size_t itemsize, char *address, bool blocking)
+ pub_sink::sptr
+ pub_sink::make(size_t itemsize, char *address, bool blocking)
{
return gnuradio::get_initial_sptr
- (new sink_pubsub_impl(itemsize, address, blocking));
+ (new pub_sink_impl(itemsize, address, blocking));
}
- sink_pubsub_impl::sink_pubsub_impl(size_t itemsize, char *address, bool blocking)
- : gr::sync_block("sink_pubsub",
+ pub_sink_impl::pub_sink_impl(size_t itemsize, char *address, bool blocking)
+ : gr::sync_block("pub_sink",
gr::io_signature::make(1, 1, itemsize),
gr::io_signature::make(0, 0, 0)),
d_itemsize(itemsize), d_blocking(blocking)
@@ -48,16 +48,16 @@ namespace gr {
d_socket->bind(address);
}
- sink_pubsub_impl::~sink_pubsub_impl()
+ pub_sink_impl::~pub_sink_impl()
{
delete d_socket;
delete d_context;
}
int
- sink_pubsub_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
+ pub_sink_impl::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];
diff --git a/gr-zeromq/lib/sink_pubsub_impl.h b/gr-zeromq/lib/pub_sink_impl.h
index ded41c59f7..d1cb02d289 100644
--- a/gr-zeromq/lib/sink_pubsub_impl.h
+++ b/gr-zeromq/lib/pub_sink_impl.h
@@ -20,16 +20,16 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_ZMQBLOCKS_SINK_PUBSUB_IMPL_H
-#define INCLUDED_ZMQBLOCKS_SINK_PUBSUB_IMPL_H
+#ifndef INCLUDED_ZMQBLOCKS_PUB_SINK_IMPL_H
+#define INCLUDED_ZMQBLOCKS_PUB_SINK_IMPL_H
-#include <gnuradio/zeromq/sink_pubsub.h>
+#include <gnuradio/zeromq/pub_sink.h>
#include <zmq.hpp>
namespace gr {
namespace zeromq {
- class sink_pubsub_impl : public sink_pubsub
+ class pub_sink_impl : public pub_sink
{
private:
size_t d_itemsize;
@@ -38,8 +38,8 @@ namespace gr {
zmq::socket_t *d_socket;
public:
- sink_pubsub_impl(size_t itemsize, char *address, bool blocking);
- ~sink_pubsub_impl();
+ pub_sink_impl(size_t itemsize, char *address, bool blocking);
+ ~pub_sink_impl();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -49,4 +49,4 @@ namespace gr {
} // namespace zeromq
} // namespace gr
-#endif /* INCLUDED_ZMQBLOCKS_SINK_PUBSUB_IMPL_H */
+#endif /* INCLUDED_ZMQBLOCKS_PUB_SINK_IMPL_H */
diff --git a/gr-zeromq/lib/source_pushpull_feedback_impl.cc b/gr-zeromq/lib/pull_feedback_source_impl.cc
index f1f66e90b0..87ae9bfa0e 100644
--- a/gr-zeromq/lib/source_pushpull_feedback_impl.cc
+++ b/gr-zeromq/lib/pull_feedback_source_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2013 Free Software Foundation, Inc.
+ * Copyright 2013, 2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio.
*
@@ -25,45 +25,45 @@
#endif
#include <gnuradio/io_signature.h>
-#include "source_pushpull_feedback_impl.h"
+#include "pull_feedback_source_impl.h"
namespace gr {
namespace zeromq {
- source_pushpull_feedback::sptr
- source_pushpull_feedback::make(size_t itemsize, char *address)
+ pull_feedback_source::sptr
+ pull_feedback_source::make(size_t itemsize, char *address, float timeout)
{
return gnuradio::get_initial_sptr
- (new source_pushpull_feedback_impl(itemsize, address));
+ (new pull_feedback_source_impl(itemsize, address, timeout));
}
- source_pushpull_feedback_impl::source_pushpull_feedback_impl(size_t itemsize, char *address)
- : gr::sync_block("source_pushpull_feedback",
+ pull_feedback_source_impl::pull_feedback_source_impl(size_t itemsize, char *address, float timeout)
+ : gr::sync_block("pull_feedback_source",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 1, itemsize)),
d_itemsize(itemsize), d_first_work(true)
{
+ d_timeout = timeout >= 0 ? (int)(timeout*1e6) : 0;
d_context = new zmq::context_t(1);
d_socket = new zmq::socket_t(*d_context, ZMQ_PULL);
- d_socket->connect (address);
- std::cout << "source_pushpull on " << address << std::endl;
+ d_socket->connect(address);
}
- source_pushpull_feedback_impl::~source_pushpull_feedback_impl()
+ pull_feedback_source_impl::~pull_feedback_source_impl()
{
delete(d_socket);
delete(d_context);
}
int
- source_pushpull_feedback_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
+ pull_feedback_source_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
{
char *out = (char*)output_items[0];
zmq::pollitem_t items[] = { { *d_socket, 0, ZMQ_POLLIN, 0 } };
- zmq::poll (&items[0], 1, 1000);
+ zmq::poll (&items[0], 1, d_timeout);
// If we got a reply, process
if (items[0].revents & ZMQ_POLLIN) {
diff --git a/gr-zeromq/lib/source_pushpull_feedback_impl.h b/gr-zeromq/lib/pull_feedback_source_impl.h
index 3a69bee75b..38ab85e81b 100644
--- a/gr-zeromq/lib/source_pushpull_feedback_impl.h
+++ b/gr-zeromq/lib/pull_feedback_source_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2013 Free Software Foundation, Inc.
+ * Copyright 2013,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio.
*
@@ -20,26 +20,27 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_ZMQBLOCKS_SOURCE_PUSHPULL_FEEDBACK_IMPL_H
-#define INCLUDED_ZMQBLOCKS_SOURCE_PUSHPULL_FEEDBACK_IMPL_H
+#ifndef INCLUDED_ZMQBLOCKS_PULL_FEEDBACK_SOURCE_IMPL_H
+#define INCLUDED_ZMQBLOCKS_PULL_FEEDBACK_SOURCE_IMPL_H
-#include <gnuradio/zeromq/source_pushpull_feedback.h>
+#include <gnuradio/zeromq/pull_feedback_source.h>
#include <zmq.hpp>
namespace gr {
namespace zeromq {
- class source_pushpull_feedback_impl : public source_pushpull_feedback
+ class pull_feedback_source_impl : public pull_feedback_source
{
private:
size_t d_itemsize;
+ int d_timeout;
zmq::context_t *d_context;
zmq::socket_t *d_socket;
bool d_first_work;
public:
- source_pushpull_feedback_impl(size_t itemsize, char *address);
- ~source_pushpull_feedback_impl();
+ pull_feedback_source_impl(size_t itemsize, char *address);
+ ~pull_feedback_source_impl();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -48,4 +49,4 @@ namespace gr {
} // namespace zeromq
} // namespace gr
-#endif /* INCLUDED_ZMQBLOCKS_SOURCE_PUSHPULL_FEEDBACK_IMPL_H */
+#endif /* INCLUDED_ZMQBLOCKS_PULL_FEEDBACK_SOURCE_IMPL_H */
diff --git a/gr-zeromq/lib/pull_source_impl.cc b/gr-zeromq/lib/pull_source_impl.cc
index 637b529a72..d5b815ecce 100644
--- a/gr-zeromq/lib/pull_source_impl.cc
+++ b/gr-zeromq/lib/pull_source_impl.cc
@@ -43,7 +43,7 @@ namespace gr {
gr::io_signature::make(1, 1, itemsize)),
d_itemsize(itemsize)
{
- d_timeout = timeout >=0 ? (int)(timeout*1e6) : 0;
+ d_timeout = timeout >= 0 ? (int)(timeout*1e6) : 0;
d_context = new zmq::context_t(1);
d_socket = new zmq::socket_t(*d_context, ZMQ_PULL);
d_socket->connect (address);
diff --git a/gr-zeromq/swig/zeromq_swig.i b/gr-zeromq/swig/zeromq_swig.i
index 1e433995b0..45c3485f65 100644
--- a/gr-zeromq/swig/zeromq_swig.i
+++ b/gr-zeromq/swig/zeromq_swig.i
@@ -28,30 +28,30 @@
%include "zeromq_swig_doc.i"
%{
-#include "gnuradio/zeromq/sink_pubsub.h"
+#include "gnuradio/zeromq/pub_sink.h"
#include "gnuradio/zeromq/push_sink.h"
#include "gnuradio/zeromq/sink_reqrep.h"
#include "gnuradio/zeromq/sink_reqrep_nopoll.h"
-#include "gnuradio/zeromq/source_pushpull_feedback.h"
+#include "gnuradio/zeromq/pull_feedback_source.h"
#include "gnuradio/zeromq/pull_source.h"
#include "gnuradio/zeromq/source_reqrep.h"
#include "gnuradio/zeromq/source_reqrep_nopoll.h"
%}
-%include "gnuradio/zeromq/sink_pubsub.h"
+%include "gnuradio/zeromq/pub_sink.h"
%include "gnuradio/zeromq/push_sink.h"
%include "gnuradio/zeromq/sink_reqrep.h"
%include "gnuradio/zeromq/sink_reqrep_nopoll.h"
-%include "gnuradio/zeromq/source_pushpull_feedback.h"
+%include "gnuradio/zeromq/pull_feedback_source.h"
%include "gnuradio/zeromq/pull_source.h"
%include "gnuradio/zeromq/source_reqrep.h"
%include "gnuradio/zeromq/source_reqrep_nopoll.h"
-GR_SWIG_BLOCK_MAGIC2(zeromq, sink_pubsub);
+GR_SWIG_BLOCK_MAGIC2(zeromq, pub_sink);
GR_SWIG_BLOCK_MAGIC2(zeromq, push_sink);
GR_SWIG_BLOCK_MAGIC2(zeromq, sink_reqrep);
GR_SWIG_BLOCK_MAGIC2(zeromq, sink_reqrep_nopoll);
-GR_SWIG_BLOCK_MAGIC2(zeromq, source_pushpull_feedback);
+GR_SWIG_BLOCK_MAGIC2(zeromq, pull_feedback_source);
GR_SWIG_BLOCK_MAGIC2(zeromq, pull_source);
GR_SWIG_BLOCK_MAGIC2(zeromq, source_reqrep);
GR_SWIG_BLOCK_MAGIC2(zeromq, source_reqrep_nopoll);