2
Copyright (c) 2007-2011 iMatix Corporation
3
Copyright (c) 2007-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__
32
// Class manages a set of outbound pipes. It sends each messages to
34
class dist_t : public i_writer_events
38
dist_t (class own_t *sink_);
41
void attach (writer_t *pipe_);
43
int send (zmq_msg_t *msg_, int flags_);
46
// i_writer_events interface implementation.
47
void activated (writer_t *pipe_);
48
void terminated (writer_t *pipe_);
52
// Write the message to the pipe. Make the pipe inactive if writing
53
// fails. In such a case false is returned.
54
bool write (class writer_t *pipe_, zmq_msg_t *msg_);
56
// Put the message to all active pipes.
57
void distribute (zmq_msg_t *msg_, int flags_);
59
// List of outbound pipes.
60
typedef array_t <class writer_t> pipes_t;
63
// Number of active pipes. All the active pipes are located at the
64
// beginning of the pipes array. These are the pipes the messages
65
// can be sent to at the moment.
66
pipes_t::size_type active;
68
// Number of pipes eligible for sending messages to. This includes all
69
// the active pipes plus all the pipes that we can in theory send
70
// messages to (the HWM is not yet reached), but sending a message
71
// to them would result in partial message being delivered, ie. message
72
// with initial parts missing.
73
pipes_t::size_type eligible;
75
// True if last we are in the middle of a multipart message.
78
// Object to send events to.
81
// If true, termination process is already underway.
84
dist_t (const dist_t&);
85
const dist_t &operator = (const dist_t&);