lb.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #ifndef __ZMQ_LB_HPP_INCLUDED__
4 #define __ZMQ_LB_HPP_INCLUDED__
5 
6 #include "array.hpp"
7 
8 namespace zmq
9 {
10 class msg_t;
11 class pipe_t;
12 
13 // This class manages a set of outbound pipes. On send it load balances
14 // messages fairly among the pipes.
15 
16 class lb_t
17 {
18  public:
19  lb_t ();
20  ~lb_t ();
21 
22  void attach (pipe_t *pipe_);
23  void activated (pipe_t *pipe_);
24  void pipe_terminated (pipe_t *pipe_);
25 
26  int send (msg_t *msg_);
27 
28  // Sends a message and stores the pipe that was used in pipe_.
29  // It is possible for this function to return success but keep pipe_
30  // unset if the rest of a multipart message to a terminated pipe is
31  // being dropped. For the first frame, this will never happen.
32  int sendpipe (msg_t *msg_, pipe_t **pipe_);
33 
34  bool has_out ();
35 
36  private:
37  // List of outbound pipes.
40 
41  // Number of active pipes. All the active pipes are located at the
42  // beginning of the pipes array.
44 
45  // Points to the last pipe that the most recent message was sent to.
47 
48  // True if last we are in the middle of a multipart message.
49  bool _more;
50 
51  // True if we are dropping current message.
52  bool _dropping;
53 
55 };
56 }
57 
58 #endif
zmq::lb_t::has_out
bool has_out()
Definition: lb.cpp:133
zmq::lb_t::attach
void attach(pipe_t *pipe_)
Definition: lb.cpp:18
zmq::lb_t::sendpipe
int sendpipe(msg_t *msg_, pipe_t **pipe_)
Definition: lb.cpp:56
zmq::lb_t::_pipes
pipes_t _pipes
Definition: lb.hpp:39
zmq::lb_t::pipes_t
array_t< pipe_t, 2 > pipes_t
Definition: lb.hpp:38
array.hpp
zmq::lb_t::send
int send(msg_t *msg_)
Definition: lb.cpp:51
zmq::lb_t::_current
pipes_t::size_type _current
Definition: lb.hpp:46
zmq
Definition: zmq.hpp:229
zmq::lb_t::lb_t
lb_t()
Definition: lb.cpp:9
ZMQ_NON_COPYABLE_NOR_MOVABLE
#define ZMQ_NON_COPYABLE_NOR_MOVABLE(classname)
Definition: macros.hpp:58
zmq::lb_t
Definition: lb.hpp:16
zmq::lb_t::_dropping
bool _dropping
Definition: lb.hpp:52
zmq::array_t< pipe_t, 2 >::size_type
std::vector< pipe_t * >::size_type size_type
Definition: array.hpp:52
zmq::lb_t::~lb_t
~lb_t()
Definition: lb.cpp:13
zmq::lb_t::pipe_terminated
void pipe_terminated(pipe_t *pipe_)
Definition: lb.cpp:24
zmq::lb_t::_more
bool _more
Definition: lb.hpp:49
zmq::array_t< pipe_t, 2 >
zmq::lb_t::_active
pipes_t::size_type _active
Definition: lb.hpp:43
zmq::msg_t
Definition: msg.hpp:33
zmq::lb_t::activated
void activated(pipe_t *pipe_)
Definition: lb.cpp:44


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