2
Copyright (c) 2011 250bpm s.r.o.
3
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
5
This file is part of 0MQ.
7
0MQ is free software; you can redistribute it and/or modify it under
8
the terms of the GNU Lesser General Public License as published by
9
the Free Software Foundation; either version 3 of the License, or
10
(at your option) any later version.
12
0MQ is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU Lesser General Public License for more details.
17
You should have received a copy of the GNU Lesser General Public License
18
along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#ifndef __ZMQ_DIST_HPP_INCLUDED__
22
#define __ZMQ_DIST_HPP_INCLUDED__
35
// Class manages a set of outbound pipes. It sends each messages to
44
// Adds the pipe to the distributor object.
45
void attach (zmq::pipe_t *pipe_);
47
// Activates pipe that have previously reached high watermark.
48
void activated (zmq::pipe_t *pipe_);
50
// Mark the pipe as matching. Subsequent call to send_to_matching
51
// will send message also to this pipe.
52
void match (zmq::pipe_t *pipe_);
54
// Mark all pipes as non-matching.
57
// Removes the pipe from the distributor object.
58
void terminated (zmq::pipe_t *pipe_);
60
// Send the message to the matching outbound pipes.
61
int send_to_matching (zmq::msg_t *msg_, int flags_);
63
// Send the message to all the outbound pipes.
64
int send_to_all (zmq::msg_t *msg_, int flags_);
70
// Write the message to the pipe. Make the pipe inactive if writing
71
// fails. In such a case false is returned.
72
bool write (zmq::pipe_t *pipe_, zmq::msg_t *msg_);
74
// Put the message to all active pipes.
75
void distribute (zmq::msg_t *msg_, int flags_);
77
// List of outbound pipes.
78
typedef array_t <zmq::pipe_t, 2> pipes_t;
81
// Number of all the pipes to send the next message to.
82
pipes_t::size_type matching;
84
// Number of active pipes. All the active pipes are located at the
85
// beginning of the pipes array. These are the pipes the messages
86
// can be sent to at the moment.
87
pipes_t::size_type active;
89
// Number of pipes eligible for sending messages to. This includes all
90
// the active pipes plus all the pipes that we can in theory send
91
// messages to (the HWM is not yet reached), but sending a message
92
// to them would result in partial message being delivered, ie. message
93
// with initial parts missing.
94
pipes_t::size_type eligible;
96
// True if last we are in the middle of a multipart message.
99
dist_t (const dist_t&);
100
const dist_t &operator = (const dist_t&);