21#ifndef IO_TRIGGERS_HPP
22#define IO_TRIGGERS_HPP
57 template <AllocatorLike Allocator>
59 noexcept(Allocator()))
60 : executor_{std::allocate_shared<executor_type>(alloc, alloc)}
79 template <SocketLike Socket>
102 template <
typename... Args>
auto set(Args &&...args) ->
decltype(
auto)
104 return executor_->set(std::forward<Args>(args)...);
112 constexpr auto wait_for(
int interval = -1) ->
decltype(
auto)
114 return executor_->wait_for(interval);
121 constexpr auto wait() ->
decltype(
auto) {
return executor_->wait(); }
129 return executor_->on_empty();
147 std::shared_ptr<executor_type> executor_{std::make_shared<executor_type>()};
A class that provides a high-level interface for an executor.
Definition triggers.hpp:38
basic_triggers()=default
Default constructor.
auto set(Args &&...args) -> decltype(auto)
Sets a completion handler for an event.
Definition triggers.hpp:102
constexpr auto wait_for(int interval=-1) -> decltype(auto)
Waits for events to occur.
Definition triggers.hpp:112
auto push(std::shared_ptr< Socket > socket) -> socket_dialog
Constructs a socket_dialog associated to the executor.
Definition triggers.hpp:80
basic_triggers(const basic_triggers &)=delete
Deleted copy constructor.
basic_triggers(const Allocator &alloc=Allocator()) noexcept(noexcept(Allocator()))
Construct with an allocator.
Definition triggers.hpp:58
auto emplace(Args &&...args) -> socket_dialog
In-place constructs a socket_dialog associated to the executor.
Definition triggers.hpp:91
auto operator=(const basic_triggers &) -> basic_triggers &=delete
Deleted copy assignment operator.
auto operator=(basic_triggers &&) -> basic_triggers &=default
Default move assignment operator.
auto on_empty() -> decltype(auto)
Sends a notice when the triggers are empty.
Definition triggers.hpp:127
~basic_triggers()=default
Default destructor.
constexpr auto wait() -> decltype(auto)
Waits for events to occur.
Definition triggers.hpp:121
basic_triggers(basic_triggers &&)=default
Default move constructor.
auto get_executor() const noexcept -> std::weak_ptr< executor_type >
Gets the executor.
Definition triggers.hpp:137
An executor that uses a multiplexer to wait for events.
Definition executor.hpp:46
static auto emplace(Args &&...args) -> std::shared_ptr< socket_handle >
Emplaces a socket handle in the collection.
Definition executor.hpp:102
static auto push(std::shared_ptr< Socket > socket) -> decltype(auto)
Configures the socket to be non-blocking.
Definition executor.hpp:77
A thread-safe, move-only RAII wrapper for a native socket handle.
Definition socket_handle.hpp:38
This file defines concepts for the execution components.
This file defines a generic executor for the I/O library.
Provides high-level interfaces for executors and completion triggers.
Definition executor.hpp:33
Defines the socket_dialog struct.
Cross-platform, thread-safe RAII socket wrapper.
A dialog that facilitates asynchronous operations on the socket by the executor.
Definition socket_dialog.hpp:43