Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
kcenon::common::interfaces::udp_endpoint Struct Reference

Represents a UDP endpoint (host and port) More...

#include <udp_client_interface.h>

Collaboration diagram for kcenon::common::interfaces::udp_endpoint:
Collaboration graph

Public Member Functions

 udp_endpoint ()=default
 
 udp_endpoint (std::string host_, uint16_t port_)
 
std::string to_string () const
 Convert to string representation.
 
bool operator== (const udp_endpoint &other) const
 
bool operator!= (const udp_endpoint &other) const
 

Public Attributes

std::string host
 Hostname or IP address.
 
uint16_t port = 0
 Port number.
 

Detailed Description

Represents a UDP endpoint (host and port)

Definition at line 35 of file udp_client_interface.h.

Constructor & Destructor Documentation

◆ udp_endpoint() [1/2]

kcenon::common::interfaces::udp_endpoint::udp_endpoint ( )
default

◆ udp_endpoint() [2/2]

kcenon::common::interfaces::udp_endpoint::udp_endpoint ( std::string host_,
uint16_t port_ )
inline

Definition at line 44 of file udp_client_interface.h.

45 : host(std::move(host_)), port(port_) {}
std::string host
Hostname or IP address.

Member Function Documentation

◆ operator!=()

bool kcenon::common::interfaces::udp_endpoint::operator!= ( const udp_endpoint & other) const
inline

Definition at line 59 of file udp_client_interface.h.

59 {
60 return !(*this == other);
61 }

◆ operator==()

bool kcenon::common::interfaces::udp_endpoint::operator== ( const udp_endpoint & other) const
inline

Definition at line 55 of file udp_client_interface.h.

55 {
56 return host == other.host && port == other.port;
57 }

References host, and port.

◆ to_string()

std::string kcenon::common::interfaces::udp_endpoint::to_string ( ) const
inlinenodiscard

Convert to string representation.

Returns
String in format "host:port"

Definition at line 51 of file udp_client_interface.h.

51 {
52 return host + ":" + std::to_string(port);
53 }

References host, and port.

Member Data Documentation

◆ host

std::string kcenon::common::interfaces::udp_endpoint::host

Hostname or IP address.

Definition at line 37 of file udp_client_interface.h.

Referenced by kcenon::common::interfaces::IUdpClient::connect(), operator==(), and to_string().

◆ port

uint16_t kcenon::common::interfaces::udp_endpoint::port = 0

Port number.

Definition at line 40 of file udp_client_interface.h.

Referenced by kcenon::common::interfaces::IUdpClient::connect(), operator==(), and to_string().


The documentation for this struct was generated from the following file: