12 #include <unordered_map>
88 void remove(socket_t
const&
socket);
156 void add(
const zmq_pollitem_t &item, Callable callable);
159 std::vector<PollItemCallablePair>
items_;
static const short poll_error
Definition: poller.hpp:44
bool has(socket_t const &socket)
Check if we are monitoring a given socket with this reactor.
Definition: reactor.cpp:53
std::vector< const socket_t * > sockRemoveLater_
Definition: reactor.hpp:160
bool poll(long timeout=poller::wait_forever)
Poll for monitored events and call associated handler when needed.
Definition: reactor.cpp:111
C++ wrapper around zmq.
Definition: actor.cpp:29
poller poller_
Definition: reactor.hpp:169
The socket class represents the zmq sockets.
Definition: socket.hpp:75
socket socket_t
socket type
Definition: poller.hpp:28
void add(socket_t &socket, Callable callable, short const event=poller::poll_in)
Add a socket to the reactor, providing a handler that will be called when the monitored events occur...
Definition: reactor.cpp:34
std::pair< zmq_pollitem_t, Callable > PollItemCallablePair
Definition: reactor.hpp:36
int raw_socket_t
Definition: compatibility.hpp:116
poller & get_poller()
Get a reference to the underlying poller object used by the reactor.
Definition: reactor.cpp:140
std::vector< raw_socket_t > fdRemoveLater_
Definition: reactor.hpp:161
std::function< void(void) > Callable
Definition: reactor.hpp:35
short events(socket_t const &socket) const
Get the event flags triggered for a socket.
Definition: reactor.cpp:130
Reactor object that helps to manage multiple socket by calling a user-defined handler for each socket...
Definition: reactor.hpp:32
~reactor()
Cleanup reactor.
Definition: reactor.cpp:30
reactor()
Construct an empty polling model.
Definition: reactor.cpp:24
std::vector< PollItemCallablePair > items_
Definition: reactor.hpp:159
void flush_remove_later()
Flush the fdRemoveLater_ and sockRemoveLater_ vector, effectively removing the item for the reactor a...
Definition: reactor.cpp:150
void check_for(socket_t const &socket, short const event)
Update the monitored event flags for a given socket.
Definition: reactor.cpp:101
static const long wait_forever
Definition: poller.hpp:39
bool dispatching_
Definition: reactor.hpp:170
static const short poll_in
Definition: poller.hpp:42
Polling wrapper.
Definition: poller.hpp:36