radio.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #ifndef __ZMQ_RADIO_HPP_INCLUDED__
4 #define __ZMQ_RADIO_HPP_INCLUDED__
5 
6 #include <map>
7 #include <string>
8 #include <vector>
9 
10 #include "socket_base.hpp"
11 #include "session_base.hpp"
12 #include "dist.hpp"
13 #include "msg.hpp"
14 
15 namespace zmq
16 {
17 class ctx_t;
18 class pipe_t;
19 class io_thread_t;
20 
21 class radio_t ZMQ_FINAL : public socket_base_t
22 {
23  public:
24  radio_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
25  ~radio_t ();
26 
27  // Implementations of virtual functions from socket_base_t.
28  void xattach_pipe (zmq::pipe_t *pipe_,
29  bool subscribe_to_all_ = false,
30  bool locally_initiated_ = false);
31  int xsend (zmq::msg_t *msg_);
32  bool xhas_out ();
33  int xrecv (zmq::msg_t *msg_);
34  bool xhas_in ();
35  void xread_activated (zmq::pipe_t *pipe_);
36  void xwrite_activated (zmq::pipe_t *pipe_);
37  int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
38  void xpipe_terminated (zmq::pipe_t *pipe_);
39 
40  private:
41  // List of all subscriptions mapped to corresponding pipes.
42  typedef std::multimap<std::string, pipe_t *> subscriptions_t;
43  subscriptions_t _subscriptions;
44 
45  // List of udp pipes
46  typedef std::vector<pipe_t *> udp_pipes_t;
48 
49  // Distributor of messages holding the list of outbound pipes.
50  dist_t _dist;
51 
52  // Drop messages if HWM reached, otherwise return with EAGAIN
53  bool _lossy;
54 
56 };
57 
58 class radio_session_t ZMQ_FINAL : public session_base_t
59 {
60  public:
61  radio_session_t (zmq::io_thread_t *io_thread_,
62  bool connect_,
63  zmq::socket_base_t *socket_,
64  const options_t &options_,
65  address_t *addr_);
66  ~radio_session_t ();
67 
68  // Overrides of the functions from session_base_t.
69  int push_msg (msg_t *msg_);
70  int pull_msg (msg_t *msg_);
71  void reset ();
72 
73  private:
74  enum
75  {
76  group,
77  body
78  } _state;
79 
81 
82  ZMQ_NON_COPYABLE_NOR_MOVABLE (radio_session_t)
83 };
84 }
85 
86 #endif
zmq::ZMQ_FINAL
Definition: channel.hpp:17
zmq::session_base_t
Definition: session_base.hpp:21
zmq::ZMQ_FINAL::subscriptions_t
std::multimap< std::string, pipe_t * > subscriptions_t
Definition: radio.hpp:42
zmq::ZMQ_FINAL::_lossy
bool _lossy
Definition: radio.hpp:53
zmq::options_t
Definition: options.hpp:34
dist.hpp
zmq::socket_base_t
Definition: socket_base.hpp:31
zmq::ZMQ_FINAL::_pending_msg
msg_t _pending_msg
Definition: radio.hpp:80
zmq::ZMQ_FINAL::subscriptions_t
std::set< std::string > subscriptions_t
Definition: dish.hpp:55
zmq
Definition: zmq.hpp:229
ZMQ_NON_COPYABLE_NOR_MOVABLE
#define ZMQ_NON_COPYABLE_NOR_MOVABLE(classname)
Definition: macros.hpp:58
zmq::ZMQ_FINAL::udp_pipes_t
std::vector< pipe_t * > udp_pipes_t
Definition: radio.hpp:46
msg.hpp
zmq::ZMQ_FINAL::_udp_pipes
udp_pipes_t _udp_pipes
Definition: radio.hpp:47
zmq::address_t
Definition: address.hpp:64
zmq::dist_t
Definition: dist.hpp:18
socket_base.hpp
session_base.hpp
ZMQ_FINAL
Definition: unittest_ip_resolver.cpp:26
group
static uint32_t * group(tarjan *t, upb_refcounted *r)
Definition: ruby/ext/google/protobuf_c/upb.c:5943
zmq::msg_t
Definition: msg.hpp:33
options_
DebugStringOptions options_
Definition: src/google/protobuf/descriptor.cc:2410


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:58