2
Copyright (c) 2009-2011 250bpm s.r.o.
3
Copyright (c) 2007-2009 iMatix Corporation
4
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
6
This file is part of 0MQ.
8
0MQ is free software; you can redistribute it and/or modify it under
9
the terms of the GNU Lesser General Public License as published by
10
the Free Software Foundation; either version 3 of the License, or
11
(at your option) any later version.
13
0MQ is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU Lesser General Public License for more details.
18
You should have received a copy of the GNU Lesser General Public License
19
along with this program. If not, see <http://www.gnu.org/licenses/>.
22
#ifndef __ZMQ_IO_OBJECT_HPP_INCLUDED__
23
#define __ZMQ_IO_OBJECT_HPP_INCLUDED__
29
#include "i_poll_events.hpp"
36
// Simple base class for objects that live in I/O threads.
37
// It makes communication with the poller object easier and
38
// makes defining unneeded event handlers unnecessary.
40
class io_object_t : public i_poll_events
44
io_object_t (zmq::io_thread_t *io_thread_ = NULL);
47
// When migrating an object from one I/O thread to another, first
48
// unplug it, then migrate it, then plug it to the new thread.
49
void plug (zmq::io_thread_t *io_thread_);
54
typedef poller_t::handle_t handle_t;
56
// Methods to access underlying poller object.
57
handle_t add_fd (fd_t fd_);
58
void rm_fd (handle_t handle_);
59
void set_pollin (handle_t handle_);
60
void reset_pollin (handle_t handle_);
61
void set_pollout (handle_t handle_);
62
void reset_pollout (handle_t handle_);
63
void add_timer (int timout_, int id_);
64
void cancel_timer (int id_);
66
// i_poll_events interface implementation.
69
void timer_event (int id_);
75
io_object_t (const io_object_t&);
76
const io_object_t &operator = (const io_object_t&);