diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2014-04-21 11:51:39 -0700 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2014-04-22 15:07:42 -0700 |
commit | 6850d68a14d96fd160892567f793605ab427817b (patch) | |
tree | c70940f852a29dd291ff86bf42447334bca04eb5 /gr-zeromq/lib | |
parent | 9833f3fb80c788d740dc1328899d50165cfdfa90 (diff) |
zeromq: renamed sink_pubsub to pub_sink
Diffstat (limited to 'gr-zeromq/lib')
-rw-r--r-- | gr-zeromq/lib/CMakeLists.txt | 4 | ||||
-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.cc | 2 |
6 files changed, 43 insertions, 42 deletions
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); |