SOLA
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
minhton::PhysicalNodeInfo Class Reference

#include <physical_node_info.h>

Public Member Functions

 PhysicalNodeInfo ()=default
 
 PhysicalNodeInfo (const std::string &address, uint16_t port)
 
uint16_t getPort () const
 
void setPort (uint16_t port)
 
std::string getAddress () const
 
void setAddress (std::string address)
 
uint32_t getAddressValue () const
 
std::string getString () const
 
bool isInitialized () const
 
 SERIALIZE (address_, port_)
 

Friends

bool operator== (const minhton::PhysicalNodeInfo &n1, const minhton::PhysicalNodeInfo &n2)
 
bool operator!= (const minhton::PhysicalNodeInfo &n1, const minhton::PhysicalNodeInfo &n2)
 
bool operator< (const minhton::PhysicalNodeInfo &n1, const minhton::PhysicalNodeInfo &n2)
 
bool operator<= (const minhton::PhysicalNodeInfo &n1, const minhton::PhysicalNodeInfo &n2)
 
bool operator> (const minhton::PhysicalNodeInfo &n1, const minhton::PhysicalNodeInfo &n2)
 
bool operator>= (const minhton::PhysicalNodeInfo &n1, const minhton::PhysicalNodeInfo &n2)
 

Detailed Description

A PhysicalNodeInfo represents the remote host, by having a IPv4/IPv6 IP address and a port

Constructor & Destructor Documentation

◆ PhysicalNodeInfo() [1/2]

minhton::PhysicalNodeInfo::PhysicalNodeInfo ( )
default

Constructing an empty uninitialized PhysicalNodeInfo object.

◆ PhysicalNodeInfo() [2/2]

minhton::PhysicalNodeInfo::PhysicalNodeInfo ( const std::string &  address,
uint16_t  port 
)

Constructing an initialized PhysicalNodeInfo object with the given information.

Parameters
addressvalid IPv4address string
portvalid port number

Member Function Documentation

◆ getAddress()

std::string minhton::PhysicalNodeInfo::getAddress ( ) const
Returns
the address of the object as a string

◆ getAddressValue()

uint32_t minhton::PhysicalNodeInfo::getAddressValue ( ) const
Returns
a calculated unique value of the ip address as an uint32_t

◆ getPort()

uint16_t minhton::PhysicalNodeInfo::getPort ( ) const
Returns
the port of the object

◆ getString()

std::string minhton::PhysicalNodeInfo::getString ( ) const
Returns
a simple string representation of the object

◆ isInitialized()

bool minhton::PhysicalNodeInfo::isInitialized ( ) const

Returns the current state of the PhysicalNodeInfo if the node is properly initialized.

Typical usage:

bool isInitialized() const
Definition physical_node_info.cpp:73
Returns
true if the node has a proper PhysicalNodeInfo, otherwise false

We are initialized, if our address and port are valid.

◆ setAddress()

void minhton::PhysicalNodeInfo::setAddress ( std::string  address)

Sets the address of the object

Parameters
addressvalid IPv4address string

◆ setPort()

void minhton::PhysicalNodeInfo::setPort ( uint16_t  port)

Sets the port of the object, which needs to be in range of k_RANDOM_PORT_MINIMUM..k_RANDOM_PORT_MAXIMUM

Parameters
portvalid port number

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const minhton::PhysicalNodeInfo n1,
const minhton::PhysicalNodeInfo n2 
)
friend
Returns
true if n1 and n2 are not equal

◆ operator<

bool operator< ( const minhton::PhysicalNodeInfo n1,
const minhton::PhysicalNodeInfo n2 
)
friend
Returns
true if the calculated unique value of n1 is smaller than that of n2

◆ operator<=

bool operator<= ( const minhton::PhysicalNodeInfo n1,
const minhton::PhysicalNodeInfo n2 
)
friend
Returns
true if the calculated unique value of n1 is smaller or equal than that of n2

◆ operator==

bool operator== ( const minhton::PhysicalNodeInfo n1,
const minhton::PhysicalNodeInfo n2 
)
friend
Returns
true if the address and port are the same

◆ operator>

bool operator> ( const minhton::PhysicalNodeInfo n1,
const minhton::PhysicalNodeInfo n2 
)
friend
Returns
true if the calculated unique value of n1 is larger than that of n2

◆ operator>=

bool operator>= ( const minhton::PhysicalNodeInfo n1,
const minhton::PhysicalNodeInfo n2 
)
friend
Returns
true if the calculated unique value of n1 is larger or equal than that of n2

The documentation for this class was generated from the following files: