Thermal Camera SDK 10.0.1
SDK for Optris Thermal Cameras
Loading...
Searching...
No Matches
optris::IpAddress Class Reference

Encapsulates an IP v4 address. More...

#include <IpAddress.h>

Collaboration diagram for optris::IpAddress:
Collaboration graph

Public Member Functions

OTC_SDK_API IpAddress () noexcept
 Constructor.
 
OTC_SDK_API IpAddress (std::uint32_t address) noexcept
 Constructor.
 
OTC_SDK_API IpAddress (const std::string &address)
 Constructor.
 
OTC_SDK_API IpAddress (std::uint8_t a, std::uint8_t b, std::uint8_t c, std::uint8_t d) noexcept
 Constructor.
 
OTC_SDK_API void reset ()
 Resets all the bytes of the address to 0.0.0.0.
 
OTC_SDK_API void setFromUInt32 (std::uint32_t address) noexcept
 Sets the address from an unsigned 32 bit integer in network byte order.
 
OTC_SDK_API std::uint32_t toUInt32 () const noexcept
 Returns the address as an unsigned 32 bit integer in network byte order.
 
OTC_SDK_API void setFromString (const std::string &address)
 Sets the address from a string in dot notation (a.b.c.d).
 
OTC_SDK_API std::string toString () const noexcept
 Returns the address as a string in dot notation (a.b.c.d).
 
OTC_SDK_API void setByte (int index, std::uint8_t value)
 Sets the value of the byte with the given index.
 
OTC_SDK_API std::uint8_t getByte (int index) const
 Returns the value of the byte with the given index.
 
OTC_SDK_API bool operator== (const IpAddress &rhs) const noexcept
 Equal operator.
 
OTC_SDK_API bool operator!= (const IpAddress &rhs) const noexcept
 Unequal operator.
 
OTC_SDK_API bool operator< (const IpAddress &rhs) const noexcept
 Less than operator.
 

Detailed Description

Encapsulates an IP v4 address.

IP address are stored in an array in the following oder:

a.b.c.d => [0: a, 1: b, 2: c, 3: d]

Constructor & Destructor Documentation

◆ IpAddress() [1/3]

OTC_SDK_API optris::IpAddress::IpAddress ( std::uint32_t address)
noexcept

Constructor.

Parameters
[in]addressas an unsigned 32 bit integer in network byte order.

◆ IpAddress() [2/3]

OTC_SDK_API optris::IpAddress::IpAddress ( const std::string & address)

Constructor.

Parameters
[in]addressstring in dot notation (a.b.c.d).
Exceptions
SDKExceptionif address string is invalid.

◆ IpAddress() [3/3]

OTC_SDK_API optris::IpAddress::IpAddress ( std::uint8_t a,
std::uint8_t b,
std::uint8_t c,
std::uint8_t d )
noexcept

Constructor.

Parameters
[in]abyte from an a.b.c.d IP address.
[in]bbyte from an a.b.c.d IP address.
[in]cbyte from an a.b.c.d IP address.
[in]dbyte from an a.b.c.d IP address.

Member Function Documentation

◆ getByte()

OTC_SDK_API std::uint8_t optris::IpAddress::getByte ( int index) const

Returns the value of the byte with the given index.

Parameters
[in]indexof the desired byte.
Returns
value of the byte with the given index.
Exceptions
SDKExceptionif the index is out of range.

◆ setByte()

OTC_SDK_API void optris::IpAddress::setByte ( int index,
std::uint8_t value )

Sets the value of the byte with the given index.

Parameters
[in]indexof the byte to set.
[in]valueto set.
Exceptions
SDKExceptionif index is out of range.

◆ setFromString()

OTC_SDK_API void optris::IpAddress::setFromString ( const std::string & address)

Sets the address from a string in dot notation (a.b.c.d).

Parameters
[in]addressin dot notation.
Exceptions
SDKExceptionif the address string is invalid.

◆ setFromUInt32()

OTC_SDK_API void optris::IpAddress::setFromUInt32 ( std::uint32_t address)
noexcept

Sets the address from an unsigned 32 bit integer in network byte order.

Note
The network byte order is big-endian while many architectures like x64 or arm64 are little-endian.
Parameters
[in]addressas an unsigned 32 bit integer with the bytes in network order.

◆ toString()

OTC_SDK_API std::string optris::IpAddress::toString ( ) const
noexcept

Returns the address as a string in dot notation (a.b.c.d).

Returns
the address as a string in dot notation.

◆ toUInt32()

OTC_SDK_API std::uint32_t optris::IpAddress::toUInt32 ( ) const
noexcept

Returns the address as an unsigned 32 bit integer in network byte order.

Note
The network byte order is big-endian while many architectures like x64 or arm64 are little-endian.
Returns
address as an unsigned 32 bit integer in network byte order.

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