AsyncBerkeley
Asynchronous Berkeley sockets. Simple.
Loading...
Searching...
No Matches
socket_dialog.hpp
Go to the documentation of this file.
1/* Copyright 2025 Kevin Exton
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
20#pragma once
21#ifndef IO_SOCKET_DIALOG_HPP
22#define IO_SOCKET_DIALOG_HPP
25
26#include <memory>
27// Forward declarations
28namespace io::execution {
29template <Multiplexer Mux> class executor;
30} // namespace io::execution
31
37namespace io::socket {
43template <Multiplexer Mux> struct socket_dialog {
47 std::weak_ptr<executor_type> executor;
49 std::shared_ptr<socket_handle> socket;
54 [[nodiscard]] explicit operator bool() const noexcept;
60 [[nodiscard]] explicit operator native_socket_type() const;
61};
62
71template <Multiplexer Mux>
72auto operator<=>(const socket_dialog<Mux> &lhs,
73 const socket_dialog<Mux> &rhs) -> std::strong_ordering;
74
83template <Multiplexer Mux>
84auto operator==(const socket_dialog<Mux> &lhs,
85 const socket_dialog<Mux> &rhs) -> bool;
86
94template <Multiplexer Mux>
95auto operator<=>(const socket_dialog<Mux> &lhs,
96 const socket_handle &rhs) -> std::strong_ordering;
97
105template <Multiplexer Mux>
106auto operator==(const socket_dialog<Mux> &lhs,
107 const socket_handle &rhs) -> bool;
108
116template <Multiplexer Mux>
117auto operator<=>(const socket_dialog<Mux> &lhs,
118 native_socket_type rhs) -> std::strong_ordering;
119
127template <Multiplexer Mux>
128auto operator==(const socket_dialog<Mux> &lhs, native_socket_type rhs) -> bool;
129
130} // namespace io::socket
131
132#include "detail/async_operations.hpp" // IWYU pragma: export
133#include "impl/socket_dialog_impl.hpp" // IWYU pragma: export
134
135#endif // IO_SOCKET_DIALOG_HPP
An executor that uses a multiplexer to wait for events.
Definition executor.hpp:46
A thread-safe, move-only RAII wrapper for a native socket handle.
Definition socket_handle.hpp:38
Concept for a multiplexer.
Definition concepts.hpp:110
This file defines concepts for the execution components.
Provides high-level interfaces for executors and completion triggers.
Definition executor.hpp:33
The io::socket namespace provides a cross-platform abstraction for socket-level I/O operations.
Definition poll_multiplexer.hpp:36
Cross-platform, thread-safe RAII socket wrapper.
A dialog that facilitates asynchronous operations on the socket by the executor.
Definition socket_dialog.hpp:43
std::weak_ptr< executor_type > executor
A weak pointer to the executor that owns the socket.
Definition socket_dialog.hpp:47
std::shared_ptr< socket_handle > socket
A shared pointer to the socket handle.
Definition socket_dialog.hpp:49