41#ifndef IO_OUTPUT_DELIVERY_HPP_INCLUDED
42#define IO_OUTPUT_DELIVERY_HPP_INCLUDED
46#include <system_error>
56#include "queue/wait_queue.hpp"
64template <
typename IOT>
67 std::size_t num_handlers;
71 io_out(std::move(io)), num_handlers(num), starting(s) { }
77template <
typename IOT>
78using io_wait_q = chops::wait_queue<io_state_chg_data<IOT> >;
105template <
typename IOT,
typename IOS,
typename EF>
110 return ne.
start( [io_start = std::move(io_start), &wq]
113 io_start(io, num, starting);
117 std::forward<EF>(err_func)
124template <
typename IOT>
144template <
typename IOT>
182template <
typename IOT,
typename IOS,
typename EF>
188 auto start_prom_ptr = std::make_shared<std::promise<basic_io_output<IOT> > >();
189 auto start_fut = start_prom_ptr->get_future();
191 auto lam = [io_start = std::move(io_start), start_prom_ptr]
194 io_start(io, num, starting);
198 auto e = ent.
start(lam, std::forward<EF>(err_func));
200 start_prom_ptr->set_exception(std::make_exception_ptr(std::system_error(e.error())));
232template <
typename IOT,
typename IOS,
typename EF>
237 auto start_prom_ptr = std::make_shared<std::promise<basic_io_output<IOT> > >();
238 auto start_fut = start_prom_ptr->get_future();
239 auto stop_prom_ptr = std::make_shared<std::promise<basic_io_output<IOT> > >();
240 auto stop_fut = stop_prom_ptr->get_future();
242 auto lam = [io_start = std::move(io_start), start_prom_ptr, stop_prom_ptr]
245 io_start(io, num, starting);
246 start_prom_ptr->set_value(*(io.make_io_output()));
249 stop_prom_ptr->set_value(*(io.make_io_output()));
253 auto e = ent.
start(lam, std::forward<EF>(err_func));
255 auto ep = std::make_exception_ptr(std::system_error(e.error()));
256 start_prom_ptr->set_exception(ep);
257 stop_prom_ptr->set_exception(ep);
basic_io_interface class template, providing start_io, stop_io, visit_socket, make_io_output and rela...
basic_io_output class template, providing send and get_output_queue_stats methods.
The basic_io_interface class template provides access to an underlying network IO handler (TCP or UDP...
Definition basic_io_interface.hpp:100
auto make_io_output() const -> nonstd::expected< basic_io_output< IOT >, std::error_code >
Make a basic_io_output object from the associated IO handler.
Definition basic_io_interface.hpp:153
The basic_io_output class template provides methods for sending data to an associated network IO hand...
Definition basic_io_output.hpp:57
The net_entity class provides the primary application interface into the TCP acceptor,...
Definition net_entity.hpp:82
auto start(F1 &&io_state_chg_func, F2 &&err_func) -> nonstd::expected< void, std::error_code >
Start network processing on the associated net entity with the application providing IO state change ...
Definition net_entity.hpp:344
io_output_future< tcp_io > tcp_io_output_future
io_output_future for TCP IO handlers.
Definition io_output_delivery.hpp:130
io_output_future< IOT > make_io_output_future(net_entity &ent, IOS &&io_start, EF &&err_func)
Return a std::future object containing a basic_io_output, which will become available after start is ...
Definition io_output_delivery.hpp:183
io_output_future< udp_io > udp_io_output_future
io_output_future for UDP IO handlers.
Definition io_output_delivery.hpp:134
std::future< basic_io_output< IOT > > io_output_future
An alias for a std::future containing a basic_io_output.
Definition io_output_delivery.hpp:125
io_wait_q< chops::net::tcp_io > tcp_io_wait_q
io_wait_q for tcp_io_interface objects.
Definition io_output_delivery.hpp:83
io_wait_q< chops::net::udp_io > udp_io_wait_q
io_wait_q for udp_io_interface objects.
Definition io_output_delivery.hpp:87
chops::wait_queue< io_state_chg_data< IOT > > io_wait_q
wait_queue declaration that provides IO state change data.
Definition io_output_delivery.hpp:78
io_output_future_pair< IOT > make_io_output_future_pair(net_entity &ent, IOS &&io_start, EF &&err_func)
Return a pair of std::future objects each containing a basic_io_output, which will become available a...
Definition io_output_delivery.hpp:233
auto start_with_io_wait_queue(net_entity ne, IOS &&io_start, io_wait_q< IOT > &wq, EF &&err_func)
Start the entity with an IO state change function object that calls start_io and also passes basic_io...
Definition io_output_delivery.hpp:106
IO type declarations, relating to the basic_io_interface and basic_io_output class templates.
net_entity class and related functionality.
A struct containing two std::future objects that deliver basic_io_output objects corresponding to the...
Definition io_output_delivery.hpp:145
Data provided through an IO state change.
Definition io_output_delivery.hpp:65