Thermal Camera SDK 10.1.1
SDK for Optris Thermal Cameras
Loading...
Searching...
No Matches
optris::MacAddress Class Reference

Encapsulates a media access control address (MAC address). More...

#include <MacAddress.h>

Collaboration diagram for optris::MacAddress:
Collaboration graph

Public Member Functions

OTC_SDK_API MacAddress () noexcept
 Constructor.
 
OTC_SDK_API MacAddress (std::uint64_t mac)
 Constructor.
 
OTC_SDK_API MacAddress (const std::string &mac)
 Constructor.
 
OTC_SDK_API MacAddress (std::uint8_t a, std::uint8_t b, std::uint8_t c, std::uint8_t d, std::uint8_t e, std::uint8_t f) noexcept
 Constructor.
 
OTC_SDK_API void reset () noexcept
 Resets all the bytes of the MAC address to 0 (0:0:0:0:0:0).
 
OTC_SDK_API void setFromUInt64 (std::uint64_t mac)
 Sets the MAC address from an unsigned 64 bit integer.
 
OTC_SDK_API std::uint64_t toUInt64 () const noexcept
 Returns the MAC address as an unsigned 64 bit integer.
 
OTC_SDK_API void setFromString (const std::string &mac)
 Sets the MAC address from the given string.
 
OTC_SDK_API std::string toString () const noexcept
 Returns the MAC address as a string in colon notation (a:b:c:d:e:f).
 
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.
 
bool operator== (const MacAddress &rhs) const noexcept
 Equality operator.
 
bool operator== (const std::uint64_t &rhs) const
 Equality operator.
 
bool operator!= (const MacAddress &rhs) const noexcept
 Unequality operator.
 

Detailed Description

Encapsulates a media access control address (MAC address).

A MAC address is usually specified by six bytes in hex notation separated by colons, like this:

12:34:56:78:9a:bc

Constructor & Destructor Documentation

◆ MacAddress() [1/4]

OTC_SDK_API optris::MacAddress::MacAddress ( )
noexcept

Constructor.

All MAC address bytes are set to 0.

◆ MacAddress() [2/4]

OTC_SDK_API optris::MacAddress::MacAddress ( std::uint64_t mac)

Constructor.

Parameters
[in]macaddress as an unsigned 64 bit integer.
Exceptions
SDKExceptionif the given value is outside [0x00, 0xffffffffffff].

◆ MacAddress() [3/4]

OTC_SDK_API optris::MacAddress::MacAddress ( const std::string & mac)

Constructor.

Parameters
[in]macaddress string in colon notation (a:b:c:d:e:f).
Exceptions
SDKExceptionif the given string does not contain a valid MAC address.

◆ MacAddress() [4/4]

OTC_SDK_API optris::MacAddress::MacAddress ( std::uint8_t a,
std::uint8_t b,
std::uint8_t c,
std::uint8_t d,
std::uint8_t e,
std::uint8_t f )
noexcept

Constructor.

Parameters
[in]abyte from an a:b:c:d:e:f MAC address.
[in]bbyte from an a:b:c:d:e:f MAC address.
[in]cbyte from an a:b:c:d:e:f MAC address.
[in]dbyte from an a:b:c:d:e:f MAC address.
[in]ebyte from an a:b:c:d:e:f MAC address.
[in]fbyte from an a:b:c:d:e:f MAC address.

Member Function Documentation

◆ getByte()

OTC_SDK_API std::uint8_t optris::MacAddress::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::MacAddress::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::MacAddress::setFromString ( const std::string & mac)

Sets the MAC address from the given string.

Parameters
[in]macaddress string in colon notation (a:b:c:d:e:f).
Exceptions
SDKExceptionif the given string does not contain a valid mac address.

◆ setFromUInt64()

OTC_SDK_API void optris::MacAddress::setFromUInt64 ( std::uint64_t mac)

Sets the MAC address from an unsigned 64 bit integer.

Parameters
[in]macaddress as an unsigned 64 bit integer.
Exceptions
SDKExceptionif the given value is outside [0x00, 0xffffffffffff].

◆ toString()

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

Returns the MAC address as a string in colon notation (a:b:c:d:e:f).

Returns
MAC address as a string in colon notation (a:b:c:d:e:f).

◆ toUInt64()

OTC_SDK_API std::uint64_t optris::MacAddress::toUInt64 ( ) const
noexcept

Returns the MAC address as an unsigned 64 bit integer.

Returns
MAC address as an unsigned 64 bit integer.

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