GNU Radio Manual and C++ API Reference  v3.9.2.0-89-gb7c7001e
The Free & Open Software Radio Ecosystem
sub_source.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2013,2014 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio.
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_ZEROMQ_SUB_SOURCE_H
12 #define INCLUDED_ZEROMQ_SUB_SOURCE_H
13 
14 #include <gnuradio/sync_block.h>
15 #include <gnuradio/zeromq/api.h>
16 
17 namespace gr {
18 namespace zeromq {
19 
20 /*!
21  * \brief Receive messages on ZMQ SUB socket and source stream
22  * \ingroup zeromq
23  *
24  * \details
25  * This block will connect to a ZMQ PUB socket, then produce all
26  * incoming messages as streaming output.
27  */
28 class ZEROMQ_API sub_source : virtual public gr::sync_block
29 {
30 public:
31  typedef std::shared_ptr<sub_source> sptr;
32 
33  /*!
34  * \brief Return a shared_ptr to a new instance of gr::zeromq::sub_source.
35  *
36  * \param itemsize Size of a stream item in bytes.
37  * \param vlen Vector length of the input items. Note that one vector is one item.
38  * \param address ZMQ socket address specifier.
39  * \param timeout Receive timeout in milliseconds, default is 100ms, 1us increments.
40  * \param pass_tags Whether source will look for and deserialize tags.
41  * \param hwm High Watermark to configure the socket to (-1 => zmq's default)
42  * \param key Subscriber filter key. Leave empty to pass all messages.
43  */
44  static sptr make(size_t itemsize,
45  size_t vlen,
46  char* address,
47  int timeout = 100,
48  bool pass_tags = false,
49  int hwm = -1,
50  const std::string& key = "");
51 
52  /*!
53  * \brief Return a std::string of ZMQ_LAST_ENDPOINT from the underlying ZMQ socket.
54  */
55  virtual std::string last_endpoint() = 0;
56 };
57 
58 } // namespace zeromq
59 } // namespace gr
60 
61 #endif /* INCLUDED_ZEROMQ_SUB_SOURCE_H */
synchronous 1:1 input to output with history
Definition: sync_block.h:26
Receive messages on ZMQ SUB socket and source stream.
Definition: sub_source.h:29
virtual std::string last_endpoint()=0
Return a std::string of ZMQ_LAST_ENDPOINT from the underlying ZMQ socket.
std::shared_ptr< sub_source > sptr
Definition: sub_source.h:31
static sptr make(size_t itemsize, size_t vlen, char *address, int timeout=100, bool pass_tags=false, int hwm=-1, const std::string &key="")
Return a shared_ptr to a new instance of gr::zeromq::sub_source.
#define ZEROMQ_API
Definition: gr-zeromq/include/gnuradio/zeromq/api.h:18
BLOCKS_API size_t itemsize(vector_type type)
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:29