21#ifndef G_NET_DESCRIPTOR_H
22#define G_NET_DESCRIPTOR_H
42 explicit Descriptor( SOCKET , HANDLE = HNULL ) noexcept ;
45 bool valid()
const noexcept ;
53 SOCKET
fd()
const noexcept ;
56 HANDLE
h()
const noexcept ;
92 return m_fd == other.m_fd && m_handle == other.m_handle ;
98 return !(*
this == other) ;
104 return m_fd == other.m_fd ? ( m_handle < other.m_handle ) : ( m_fd < other.m_fd ) ;
116 std::ostream & operator<<( std::ostream & stream ,
const Descriptor & d )
A class that encapsulates a network socket file descriptor and an associated windows event handle.
void streamOut(std::ostream &) const
Used by op<<().
bool operator<(const Descriptor &other) const noexcept
Comparison operator.
SOCKET fd() const noexcept
Returns the socket part.
Descriptor() noexcept
Default constructor.
bool operator==(const Descriptor &other) const noexcept
Comparison operator.
static Descriptor invalid() noexcept
Returns a descriptor with an invalid socket part and a zero handle.
bool valid() const noexcept
Returns true if the socket part is valid, ignoring the handle.
HANDLE h() const noexcept
Returns the handle part.
bool operator!=(const Descriptor &other) const noexcept
Comparison operator.