OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — legacy C++ API referencev12.0

These are the pre-v12 classes, kept so existing code keeps building. New code should use the modern API — see Migration Guide: v11 to v12.

optris::Port

Port number a usually separated by a : from an IP address like 192.168.0.2:50101 Here the port number is 50101.

Public types

Number

std::uint16_t Number

Type used to store the port number.

Public functions

Port

Port() noexcept

Constructor. The port number is set to 0.

Port

Port(Number number) noexcept

Constructor. Native byte order is expected.

Parameters

Name Description
number of the port in [0, 65535].

Port

Port(const std::string &port)

Sets the port number from the given string.

Parameters

Name Description
port string.

Exceptions

Name Description
SDKException if the given string does not contain a valid port number.

reset

void reset() noexcept

Resets the port number to 0.

setNumber

void setNumber(Number number) noexcept

Sets the port number to the given value. Native byte order is expected.

Parameters

Name Description
number port number to set.

getNumber

Number getNumber() const noexcept

Returns the port number. Native byte order is used.

Returns: port number.

setFromString

OTC_SDK_API void setFromString(const std::string &port) noexcept(false)

Sets the port number from the given string.

Parameters

Name Description
port number string.

Exceptions

Name Description
SDKException if the given string does not contain a valid port number.

toString

OTC_SDK_API std::string toString() const noexcept

Returns the port number as a string.

Returns: port number as a string.

operator==

bool operator==(const Port &rhs) const noexcept

Returns whether this port equals the provided one.

Parameters

Name Description
rhs port to compare this one to.

Returns: true, if this port equals the provided one. False otherwise.

operator!=

bool operator!=(const Port &rhs) const noexcept

Returns whether this port is different from the provided one.

Parameters

Name Description
rhs port to compare this one to.

Returns: true, if this port is different from the provided one.

operator<

bool operator<(const Port &rhs) const noexcept

Returns whether this port number is smaller than the provided one.

Parameters

Name Description
rhs port to compare this one to.

Returns: true, if this port is smaller than the provided one.