17#ifndef ZMQPP_POLLER_HPP_
18#define ZMQPP_POLLER_HPP_
20#include <unordered_map>
46 poll_out = ZMQ_POLLOUT,
47 poll_error = ZMQ_POLLERR,
48#if ((ZMQ_VERSION_MAJOR == 4 && ZMQ_VERSION_MINOR >= 2) || ZMQ_VERSION_MAJOR > 4)
49 poll_pri = ZMQ_POLLPRI
79 void add(
raw_socket_t const descriptor,
short const event = poll_in | poll_error);
88 void add(zmq_pollitem_t
const& item);
114 bool has(zmq_pollitem_t
const& item);
135 void remove(zmq_pollitem_t
const& item);
151 void check_for(
raw_socket_t const descriptor,
short const event);
159 void check_for(zmq_pollitem_t
const& item,
short const event);
172 bool poll(
long timeout = wait_forever);
196 short events(zmq_pollitem_t
const& item)
const;
206 template<
typename Watched>
207 bool has_input(Watched
const& watchable)
const {
return (events(watchable) & poll_in) != 0; }
217 template<
typename Watched>
218 bool has_output(Watched
const& watchable)
const {
return (events(watchable) & poll_out) != 0; }
231 template<
typename Watched>
232 bool has_error(Watched
const& watchable)
const {
return (events(watchable) & poll_error) != 0; }
236 std::unordered_map<void *, size_t>
_index;
239 void reindex(
size_t const index);
Polling wrapper.
Definition: poller.hpp:37
std::vector< zmq_pollitem_t > _items
Definition: poller.hpp:235
bool has_error(Watched const &watchable) const
Check a standard socket (file descriptor or SOCKET).
Definition: poller.hpp:232
bool has_input(Watched const &watchable) const
Check either a standard socket or zmq socket for input events.
Definition: poller.hpp:207
bool has_output(Watched const &watchable) const
Check either a standard socket or zmq socket for output events.
Definition: poller.hpp:218
std::unordered_map< raw_socket_t, size_t > _fdindex
Definition: poller.hpp:237
std::unordered_map< void *, size_t > _index
Definition: poller.hpp:236
The socket class represents the zmq sockets.
Definition: socket.hpp:76
#define ZMQPP_EXPORT
Definition: compatibility.hpp:39
C++ wrapper around zmq.
Definition: actor.cpp:30
socket socket_t
socket type
Definition: loop.hpp:26
int raw_socket_t
Definition: compatibility.hpp:134