Thermal Camera SDK 10.0.1
SDK for Optris Thermal Cameras
Loading...
Searching...
No Matches
IpAddress.h
Go to the documentation of this file.
1// Copyright (c) 2025 Optris GmbH Co. KG
2
10
11#pragma once
12
13#include <array>
14#include <ostream>
15#include <cstdint>
16#include <string>
17
18#include "otcsdk/Api.h"
19#include "otcsdk/Exceptions.h"
20
21
22namespace optris
23{
24
33{
34public:
37
43 OTC_SDK_API IpAddress(std::uint32_t address) noexcept;
44
52 OTC_SDK_API IpAddress(const std::string& address);
53
62 OTC_SDK_API IpAddress(std::uint8_t a, std::uint8_t b, std::uint8_t c, std::uint8_t d) noexcept;
63
64
67
75 OTC_SDK_API void setFromUInt32(std::uint32_t address) noexcept;
76
84 OTC_SDK_API std::uint32_t toUInt32() const noexcept;
85
93 OTC_SDK_API void setFromString(const std::string& address);
94
100 OTC_SDK_API std::string toString() const noexcept;
101
110 OTC_SDK_API void setByte(int index, std::uint8_t value);
111
121 OTC_SDK_API std::uint8_t getByte(int index) const;
122
124 OTC_SDK_API bool operator==(const IpAddress& rhs) const noexcept;
126 OTC_SDK_API bool operator!=(const IpAddress& rhs) const noexcept;
128 OTC_SDK_API bool operator<(const IpAddress& rhs) const noexcept;
129
130
131private:
133 std::array<std::uint8_t, 4> _bytes;
134};
135
136
145OTC_SDK_API std::ostream& operator<<(std::ostream& out, const IpAddress& address);
146
147} // namespace optris
Contains defines controlling the Windows DLL export and import of symbols.
#define OTC_SDK_API
Only needed when working with Windows DLLs.
Definition Api.h:65
Contains the exceptions raised by the SDK.
Encapsulates an IP v4 address.
Definition IpAddress.h:33
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::uint8_t getByte(int index) const
Returns the value of the byte with the given index.
OTC_SDK_API void reset()
Resets all the bytes of the address to 0.0.0.0.
OTC_SDK_API void setByte(int index, std::uint8_t value)
Sets the value of the byte with the given index.
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 IpAddress() noexcept
Constructor.
OTC_SDK_API std::string toString() const noexcept
Returns the address as a string in dot notation (a.b.c.d).
OTC_SDK_API std::uint32_t toUInt32() const noexcept
Returns the address as an unsigned 32 bit integer in network byte order.
Main SDK namespace.
Definition DeviceInfo.h:23