Chops Net IP
Loading...
Searching...
No Matches

net_entity class and related functionality. More...

#include <memory>
#include <cstddef>
#include <utility>
#include <variant>
#include <type_traits>
#include <system_error>
#include <string_view>
#include "nonstd/expected.hpp"
#include "net_ip/net_ip_error.hpp"
#include "net_ip/detail/tcp_acceptor.hpp"
#include "net_ip/detail/tcp_connector.hpp"
#include "net_ip/detail/udp_entity_io.hpp"
#include "net_ip/detail/wp_access.hpp"
#include "net_ip/io_type_decls.hpp"
Include dependency graph for net_entity.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  chops::net::detail::overloaded< Ts >
 
class  chops::net::net_entity
 The net_entity class provides the primary application interface into the TCP acceptor, TCP connector, and UDP entity functionality. More...
 

Functions

bool chops::net::operator== (const net_entity &lhs, const net_entity &rhs)
 Compare two net_entity objects for equality.
 
bool chops::net::operator< (const net_entity &lhs, const net_entity &rhs)
 Compare two net_entity objects for ordering purposes.
 

Detailed Description

net_entity class and related functionality.

Author
Cliff Green

Copyright (c) 2017-2025 by Cliff Green

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Function Documentation

◆ operator<()

bool chops::net::operator< ( const net_entity & lhs,
const net_entity & rhs )
inlinenoexcept

Compare two net_entity objects for ordering purposes.

Arbitrarily, a UDP network entity compares less than a TCP acceptor which compares less than a TCP connector. If both network entities are the same then the std::shared_ptr ordering is returned.

All invalid net_entity objects (of the same network entity type) are less than valid ones. If both net_entity objects are invalid and the same network entity type, they are considered equal, so operator< returns false.

Returns
As described in the comments.

◆ operator==()

bool chops::net::operator== ( const net_entity & lhs,
const net_entity & rhs )
inlinenoexcept

Compare two net_entity objects for equality.

If the @ net_entity objects are not both pointing to the same type of network entity (TCP connector, TCP acceptor, etc), then they are not equal. If both are the same type of network entity, then both are checked to be valid (i.e. the internal weak_ptr is valid). If both are valid, then a std::shared_ptr comparison is made.

If both net_entity objects are invalid (and both same type of network entity), true is returned (this implies that all invalid net_entity objects are equivalent). If one is valid and the other invalid, false is returned.

Returns
As described in the comments.