43#include <spdlog/spdlog.h>
62 explicit operator bool() {
return static_cast<bool>(aio_m); }
64 template<ev::event_c event_t, tool_c tool_t>
88 auto pv = m.get_pipe();
99 aio_m = nngxx::make_aio(op::send_cb,
this).value_or_abort();
102 aio_m.set_msg(std::move(m));
106 template<tool_c tool_t>
117 auto pv = m.get_pipe();
139 aio_m = nngxx::make_aio(op::recv_cb,
this).value_or_abort();
145 void sleep(nng_duration ms, std::function<
void()>
f)
156 aio_m = nngxx::make_aio(op::sleep_cb,
this).value_or_abort();
158 nngxx::sleep(ms, aio_m);
166 aio_m = nngxx::make_aio(op::sleep_cb,
this).value_or_abort();
168 nngxx::sleep(ms, aio_m);
222 void wait()
const { aio_m.wait(); }
237 static void send_cb(
void* arg)
239 auto self =
static_cast<op*
>(arg);
242 auto res = self->aio_m.result();
249 msg = self->aio_m.release_msg();
253 self->cb_m(res, std::move(msg));
256 static void recv_cb(
void* arg)
258 auto self =
static_cast<op*
>(arg);
261 auto res = self->aio_m.result();
268 msg = self->aio_m.release_msg();
272 self->cb_m(res, std::move(msg));
275 static void sleep_cb(
void* arg)
277 auto self =
static_cast<op*
>(arg);
279 auto res = self->aio_m.result();
void queue_fire(event_t ev)
void queue_sent(event_t ev, int s_id, tool_t &t, net::pipe p)
void queue_received(nngxx::msg m, int s_id, tool_t &t, net::pipe p)
void stop()
stop asynchronous I/O operation
void send(ev::enqueuer &r, tool_t &t, pipe p, event_t ev)
void recv(ev::enqueuer &r, tool_t &t)
void reset_sleep(nng_duration ms)
std::error_code result() const
return result of asynchronous operation
void wait() const
wait for asynchronous I/O operation
void sleep(nng_duration ms, std::function< void()> f)
void abort(nngxx::err err)
abort asynchronous I/O operation
void cancel()
cancel asynchronous I/O operation
clev::own< nng_msg * > msg
clev::iface< nng_pipe > pipe_view
clev::own< nng_aio * > aio
std::function< void(clev::expected< void >, nngxx::msg)> cb_f
void err(spdlog::source_loc loc, pars::lf lf, spdlog::format_string_t< args_t... > fmt, args_t &&... args)
void debug(spdlog::source_loc loc, pars::lf lf, spdlog::format_string_t< args_t... > fmt, args_t &&... args)
static nngxx::msg to_network(event_t &ev)