randolf.ca  1.00
Randolf Richardson's C++ classes
Loading...
Searching...
No Matches
rsocket_mux_fds
1#pragma once
2
3#include <randolf/rsocket>
4
5namespace randolf {
6
7 /*======================================================================*//**
8 @brief
9 Internal structure that @ref rsocket_mux uses to store @ref rsocket objects
10 with their intended fds/fd_set relations. The vector that this structure is
11 used to generate fds tables.
12 @see rsocket_mux
13 @author Randolf Richardson
14 @version 1.00
15 @par History
16 - 2022-Dec-24 v1.00 Initial version
17 - 2025-Feb-03 v1.00 Increased use of references and pointers
18 *///=========================================================================
19 struct rsocket_mux_fds {
20 /// Pointer to instantiated rsocket object
21 rsocket* r;
22 /// Flags for intended fd_set array relations (e.g., @c POLLIN, @c POLLOUT, @c POLLERR, etc.)
23 int fd_sets;
24
25 /*======================================================================*//**
26 @brief
27 Built-in comparison operator used by @c std::set for ordering rsocket objects
28 by their underlying socket descriptors because this is what is needed for
29 internal muxing by POSIX's @c select(), @c poll(), etc. functions.
30 @returns Underlying socket handle
31 *///=========================================================================
32 bool operator<(
33 /// This rsocket_mux_fds structure
34 const rsocket_mux_fds& rmf) const {
35 return r->get_socket_fd() < rmf.r->get_socket_fd();
36 } // -x- bool < -x-
37
38 }; // -x- struct rsocket_mux_fds -x-
39
40}; // -x- namespace randolf -x-