Zivid C++ API 2.13.1+18e79e79-1
NetworkConfiguration.h
Go to the documentation of this file.
1/*******************************************************************************
2 * This file is part of the Zivid API
3 *
4 * Copyright 2015-2024 (C) Zivid AS
5 * All rights reserved.
6 *
7 * Zivid Software License, v1.0
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * 3. Neither the name of Zivid AS nor the names of its contributors may be used
20 * to endorse or promote products derived from this software without specific
21 * prior written permission.
22 *
23 * 4. This software, with or without modification, must not be used with any
24 * other 3D camera than from Zivid AS.
25 *
26 * 5. Any software provided in binary form under this license must not be
27 * reverse engineered, decompiled, modified and/or disassembled.
28 *
29 * THIS SOFTWARE IS PROVIDED BY ZIVID AS "AS IS" AND ANY EXPRESS OR IMPLIED
30 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31 * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
32 * DISCLAIMED. IN NO EVENT SHALL ZIVID AS OR CONTRIBUTORS BE LIABLE FOR ANY
33 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
36 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 * Contact: Zivid Customer Success Team <customersuccess@zivid.com>
41 * Info: http://www.zivid.com
42 ******************************************************************************/
43
44#pragma once
45
46#include <array>
47#include <chrono>
48#include <cmath>
49#include <ctime>
50#include <iomanip>
51#include <memory>
52#include <set>
53#include <sstream>
54#include <string>
55#include <tuple>
56#include <utility>
57#include <vector>
58
66#include "Zivid/Range.h"
67
68#ifdef _MSC_VER
69# pragma warning(push)
70# pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
71#endif
72
73namespace Zivid
74{
75
78
79 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
81 {
82 public:
84 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
85
87 static constexpr const char *path{ "" };
88
90 static constexpr const char *name{ "NetworkConfiguration" };
91
93 static constexpr const char *description{ R"description(Network configuration of a camera
94)description" };
95
96 static constexpr size_t version{ 1 };
97
98#ifndef NO_DOC
99 template<size_t>
100 struct Version;
101
102 using LatestVersion = Zivid::NetworkConfiguration;
103
104 // Short identifier. This value is not guaranteed to be universally unique
105 // Todo(ZIVID-2808): Move this to internal DataModelExt header
106 static constexpr std::array<uint8_t, 3> binaryId{ 'c', 'n', 'c' };
107
108#endif
109
111
112 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
114 {
115 public:
117 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
118
120 static constexpr const char *path{ "IPV4" };
121
123 static constexpr const char *name{ "IPV4" };
124
126 static constexpr const char *description{ R"description(IPv4 network configuration)description" };
127
129
130 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
132 {
133 public:
135 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
136
138 static constexpr const char *path{ "IPV4/Address" };
139
141 static constexpr const char *name{ "Address" };
142
144 static constexpr const char *description{
145 R"description(IPv4 address. Only used in manual mode.)description"
146 };
147
149 using ValueType = std::string;
150
152 Address() = default;
153
155 explicit Address(std::string value)
156 : m_value{ verifyValue(std::move(value)) }
157 {}
158
160 const std::string &value() const;
161
163 std::string toString() const;
164
166 bool operator==(const Address &other) const
167 {
168 return m_value == other.m_value;
169 }
170
172 bool operator!=(const Address &other) const
173 {
174 return m_value != other.m_value;
175 }
176
178 bool operator<(const Address &other) const
179 {
180 return m_value < other.m_value;
181 }
182
184 bool operator>(const Address &other) const
185 {
186 return m_value > other.m_value;
187 }
188
190 bool operator<=(const Address &other) const
191 {
192 return m_value <= other.m_value;
193 }
194
196 bool operator>=(const Address &other) const
197 {
198 return m_value >= other.m_value;
199 }
200
202 friend std::ostream &operator<<(std::ostream &stream, const Address &value)
203 {
204 return stream << value.toString();
205 }
206
207 private:
208 void setFromString(const std::string &value);
209
210 ValueType static verifyValue(ValueType &&value)
211 {
212 return DataModel::Detail::isValidIPv4Address(value)
213 ? std::move(value)
214 : throw std::invalid_argument{ "The value '" + value
215 + "' is not a valid IPv4 address." };
216 }
217
218 std::string m_value{ "172.28.60.5" };
219
220 friend struct DataModel::Detail::Befriend<Address>;
221 };
222
224
225 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
227 {
228 public:
230 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
231
233 static constexpr const char *path{ "IPV4/Mode" };
234
236 static constexpr const char *name{ "Mode" };
237
239 static constexpr const char *description{ R"description(DHCP or manual configuration)description" };
240
242 enum class ValueType
243 {
244 dhcp,
245 manual
246 };
247 static const Mode dhcp;
248 static const Mode manual;
249
251 static std::set<ValueType> validValues()
252 {
253 return { ValueType::dhcp, ValueType::manual };
254 }
255
257 Mode() = default;
258
260 explicit constexpr Mode(ValueType value)
261 : m_value{ verifyValue(value) }
262 {}
263
266
268 std::string toString() const;
269
271 friend std::ostream &operator<<(std::ostream &stream, const Mode::ValueType &value)
272 {
273 return stream << Mode{ value }.toString();
274 }
275
277 bool operator==(const Mode &other) const
278 {
279 return m_value == other.m_value;
280 }
281
283 bool operator!=(const Mode &other) const
284 {
285 return m_value != other.m_value;
286 }
287
289 friend std::ostream &operator<<(std::ostream &stream, const Mode &value)
290 {
291 return stream << value.toString();
292 }
293
294 private:
295 void setFromString(const std::string &value);
296
297 constexpr ValueType static verifyValue(const ValueType &value)
298 {
299 return value == ValueType::dhcp || value == ValueType::manual
300 ? value
301 : throw std::invalid_argument{
302 "Invalid value: Mode{ "
303 + std::to_string(static_cast<std::underlying_type<ValueType>::type>(value)) + " }"
304 };
305 }
306
307 ValueType m_value{ ValueType::manual };
308
309 friend struct DataModel::Detail::Befriend<Mode>;
310 };
311
315
316 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
318 {
319 public:
321 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
322
324 static constexpr const char *path{ "IPV4/SubnetMask" };
325
327 static constexpr const char *name{ "SubnetMask" };
328
330 static constexpr const char *description{ R"description(IPv4 subnet mask (for example 255.255.255.0).
331Only used in manual mode.
332)description" };
333
335 using ValueType = std::string;
336
338 SubnetMask() = default;
339
341 explicit SubnetMask(std::string value)
342 : m_value{ verifyValue(std::move(value)) }
343 {}
344
346 const std::string &value() const;
347
349 std::string toString() const;
350
352 bool operator==(const SubnetMask &other) const
353 {
354 return m_value == other.m_value;
355 }
356
358 bool operator!=(const SubnetMask &other) const
359 {
360 return m_value != other.m_value;
361 }
362
364 bool operator<(const SubnetMask &other) const
365 {
366 return m_value < other.m_value;
367 }
368
370 bool operator>(const SubnetMask &other) const
371 {
372 return m_value > other.m_value;
373 }
374
376 bool operator<=(const SubnetMask &other) const
377 {
378 return m_value <= other.m_value;
379 }
380
382 bool operator>=(const SubnetMask &other) const
383 {
384 return m_value >= other.m_value;
385 }
386
388 friend std::ostream &operator<<(std::ostream &stream, const SubnetMask &value)
389 {
390 return stream << value.toString();
391 }
392
393 private:
394 void setFromString(const std::string &value);
395
396 ValueType static verifyValue(ValueType &&value)
397 {
398 return DataModel::Detail::isValidIPv4SubnetMask(value)
399 ? std::move(value)
400 : throw std::invalid_argument{ "The value '" + value
401 + "' is not a valid IPv4 subnet mask." };
402 }
403
404 std::string m_value{ "255.255.255.0" };
405
406 friend struct DataModel::Detail::Befriend<SubnetMask>;
407 };
408
409 using Descendants = std::tuple<
413
416
430#ifndef NO_DOC
431 template<
432 typename... Args,
433 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
434 typename std::enable_if<
435 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
436 value,
437 int>::type = 0>
438#else
439 template<typename... Args>
440#endif
441 explicit IPV4(Args &&...args)
442 {
443 using namespace Zivid::Detail::TypeTraits;
444
445 static_assert(
446 AllArgsDecayedAreUnique<Args...>::value,
447 "Found duplicate types among the arguments passed to IPV4(...). "
448 "Types should be listed at most once.");
449
450 set(std::forward<Args>(args)...);
451 }
452
465#ifndef NO_DOC
466 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
467#else
468 template<typename... Args>
469#endif
470 void set(Args &&...args)
471 {
472 using namespace Zivid::Detail::TypeTraits;
473
474 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
475 static_assert(
476 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
477
478 static_assert(
479 AllArgsDecayedAreUnique<Args...>::value,
480 "Found duplicate types among the arguments passed to set(...). "
481 "Types should be listed at most once.");
482
483 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
484 }
485
499#ifndef NO_DOC
500 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
501#else
502 template<typename... Args>
503#endif
504 IPV4 copyWith(Args &&...args) const
505 {
506 using namespace Zivid::Detail::TypeTraits;
507
508 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
509 static_assert(
510 AllArgsAreDescendantNodes::value,
511 "All arguments passed to copyWith(...) must be descendant nodes.");
512
513 static_assert(
514 AllArgsDecayedAreUnique<Args...>::value,
515 "Found duplicate types among the arguments passed to copyWith(...). "
516 "Types should be listed at most once.");
517
518 auto copy{ *this };
519 copy.set(std::forward<Args>(args)...);
520 return copy;
521 }
522
524 const Address &address() const
525 {
526 return m_address;
527 }
528
531 {
532 return m_address;
533 }
534
536 IPV4 &set(const Address &value)
537 {
538 m_address = value;
539 return *this;
540 }
541
543 const Mode &mode() const
544 {
545 return m_mode;
546 }
547
550 {
551 return m_mode;
552 }
553
555 IPV4 &set(const Mode &value)
556 {
557 m_mode = value;
558 return *this;
559 }
560
562 const SubnetMask &subnetMask() const
563 {
564 return m_subnetMask;
565 }
566
569 {
570 return m_subnetMask;
571 }
572
574 IPV4 &set(const SubnetMask &value)
575 {
576 m_subnetMask = value;
577 return *this;
578 }
579
580 template<
581 typename T,
582 typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4::Address>::value, int>::type = 0>
584 {
585 return m_address;
586 }
587
588 template<
589 typename T,
590 typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4::Mode>::value, int>::type = 0>
592 {
593 return m_mode;
594 }
595
596 template<
597 typename T,
598 typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4::SubnetMask>::value, int>::type = 0>
600 {
601 return m_subnetMask;
602 }
603
604 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
606 {
607 return m_address;
608 }
609
610 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
612 {
613 return m_mode;
614 }
615
616 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
618 {
619 return m_subnetMask;
620 }
621
623 template<typename F>
624 void forEach(const F &f) const
625 {
626 f(m_address);
627 f(m_mode);
628 f(m_subnetMask);
629 }
630
632 template<typename F>
633 void forEach(const F &f)
634 {
635 f(m_address);
636 f(m_mode);
637 f(m_subnetMask);
638 }
639
641 bool operator==(const IPV4 &other) const;
642
644 bool operator!=(const IPV4 &other) const;
645
647 std::string toString() const;
648
650 friend std::ostream &operator<<(std::ostream &stream, const IPV4 &value)
651 {
652 return stream << value.toString();
653 }
654
655 private:
656 void setFromString(const std::string &value);
657
658 void setFromString(const std::string &fullPath, const std::string &value);
659
660 std::string getString(const std::string &fullPath) const;
661
662 Address m_address;
663 Mode m_mode;
664 SubnetMask m_subnetMask;
665
666 friend struct DataModel::Detail::Befriend<IPV4>;
667 };
668
669 using Descendants = std::tuple<
674
677
679 explicit NetworkConfiguration(const std::string &fileName);
680
686 ZIVID_NODISCARD static NetworkConfiguration fromSerialized(const std::string &value);
687
693 std::string serialize() const;
694
709#ifndef NO_DOC
710 template<
711 typename... Args,
712 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
713 typename std::enable_if<
714 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
715 int>::type = 0>
716#else
717 template<typename... Args>
718#endif
719 explicit NetworkConfiguration(Args &&...args)
720 {
721 using namespace Zivid::Detail::TypeTraits;
722
723 static_assert(
724 AllArgsDecayedAreUnique<Args...>::value,
725 "Found duplicate types among the arguments passed to NetworkConfiguration(...). "
726 "Types should be listed at most once.");
727
728 set(std::forward<Args>(args)...);
729 }
730
744#ifndef NO_DOC
745 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
746#else
747 template<typename... Args>
748#endif
749 void set(Args &&...args)
750 {
751 using namespace Zivid::Detail::TypeTraits;
752
753 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
754 static_assert(
755 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
756
757 static_assert(
758 AllArgsDecayedAreUnique<Args...>::value,
759 "Found duplicate types among the arguments passed to set(...). "
760 "Types should be listed at most once.");
761
762 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
763 }
764
779#ifndef NO_DOC
780 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
781#else
782 template<typename... Args>
783#endif
784 NetworkConfiguration copyWith(Args &&...args) const
785 {
786 using namespace Zivid::Detail::TypeTraits;
787
788 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
789 static_assert(
790 AllArgsAreDescendantNodes::value, "All arguments passed to copyWith(...) must be descendant nodes.");
791
792 static_assert(
793 AllArgsDecayedAreUnique<Args...>::value,
794 "Found duplicate types among the arguments passed to copyWith(...). "
795 "Types should be listed at most once.");
796
797 auto copy{ *this };
798 copy.set(std::forward<Args>(args)...);
799 return copy;
800 }
801
803 const IPV4 &ipv4() const
804 {
805 return m_ipv4;
806 }
807
810 {
811 return m_ipv4;
812 }
813
816 {
817 m_ipv4 = value;
818 return *this;
819 }
820
823 {
824 m_ipv4.set(value);
825 return *this;
826 }
827
830 {
831 m_ipv4.set(value);
832 return *this;
833 }
834
837 {
838 m_ipv4.set(value);
839 return *this;
840 }
841
842 template<typename T, typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4>::value, int>::type = 0>
844 {
845 return m_ipv4;
846 }
847
848 template<
849 typename T,
850 typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4::Address>::value, int>::type = 0>
852 {
853 return m_ipv4.get<NetworkConfiguration::IPV4::Address>();
854 }
855
856 template<
857 typename T,
858 typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4::Mode>::value, int>::type = 0>
860 {
861 return m_ipv4.get<NetworkConfiguration::IPV4::Mode>();
862 }
863
864 template<
865 typename T,
866 typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4::SubnetMask>::value, int>::type = 0>
868 {
869 return m_ipv4.get<NetworkConfiguration::IPV4::SubnetMask>();
870 }
871
872 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
874 {
875 return m_ipv4;
876 }
877
879 template<typename F>
880 void forEach(const F &f) const
881 {
882 f(m_ipv4);
883 }
884
886 template<typename F>
887 void forEach(const F &f)
888 {
889 f(m_ipv4);
890 }
891
893 bool operator==(const NetworkConfiguration &other) const;
894
896 bool operator!=(const NetworkConfiguration &other) const;
897
899 std::string toString() const;
900
902 friend std::ostream &operator<<(std::ostream &stream, const NetworkConfiguration &value)
903 {
904 return stream << value.toString();
905 }
906
908 void save(const std::string &fileName) const;
909
911 void load(const std::string &fileName);
912
913 private:
914 void setFromString(const std::string &value);
915
916 void setFromString(const std::string &fullPath, const std::string &value);
917
918 std::string getString(const std::string &fullPath) const;
919
920 IPV4 m_ipv4;
921
922 friend struct DataModel::Detail::Befriend<NetworkConfiguration>;
923 };
924
925#ifndef NO_DOC
927 namespace Detail
928 {
929 ZIVID_CORE_EXPORT void save(const NetworkConfiguration &dataModel, std::ostream &ostream);
930 ZIVID_CORE_EXPORT void load(NetworkConfiguration &dataModel, std::istream &istream);
931 } // namespace Detail
932#endif
933
934#ifndef NO_DOC
935 template<>
936 struct NetworkConfiguration::Version<1>
937 {
938 using Type = NetworkConfiguration;
939 };
940#endif
941
942} // namespace Zivid
943
944#ifdef _MSC_VER
945# pragma warning(pop)
946#endif
947
948#ifndef NO_DOC
949# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
950namespace std // NOLINT
951{
952
953 template<>
954 struct tuple_size<Zivid::NetworkConfiguration::IPV4> : integral_constant<size_t, 3>
955 {};
956
957 template<size_t i>
958 struct tuple_element<i, Zivid::NetworkConfiguration::IPV4>
959 {
960 static_assert(i < tuple_size<Zivid::NetworkConfiguration::IPV4>::value, "Index must be less than 3");
961
962 using type // NOLINT
963 = decltype(declval<Zivid::NetworkConfiguration::IPV4>().get<i>());
964 };
965
966 template<>
967 struct tuple_size<Zivid::NetworkConfiguration> : integral_constant<size_t, 1>
968 {};
969
970 template<size_t i>
971 struct tuple_element<i, Zivid::NetworkConfiguration>
972 {
973 static_assert(i < tuple_size<Zivid::NetworkConfiguration>::value, "Index must be less than 1");
974
975 using type // NOLINT
976 = decltype(declval<Zivid::NetworkConfiguration>().get<i>());
977 };
978
979} // namespace std
980# endif
981#endif
982
983// If we have access to the DataModel library, automatically include internal DataModel
984// header. This header is necessary for serialization and deserialization.
985#if defined(__has_include) && !defined(NO_DOC)
986# if __has_include("Zivid/NetworkConfigurationInternal.h") && __has_include("Zivid/DataModelNodeMetaData.h")
987# include "Zivid/NetworkConfigurationInternal.h"
988# endif
989#endif
#define ZIVID_NODISCARD
Definition Attributes.h:49
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
IPv4 address. Only used in manual mode.
Definition NetworkConfiguration.h:132
bool operator<(const Address &other) const
Comparison operator.
Definition NetworkConfiguration.h:178
bool operator>(const Address &other) const
Comparison operator.
Definition NetworkConfiguration.h:184
bool operator>=(const Address &other) const
Comparison operator.
Definition NetworkConfiguration.h:196
std::string toString() const
Get the value as string.
std::string ValueType
The type of the underlying value.
Definition NetworkConfiguration.h:149
const std::string & value() const
Get the value.
friend std::ostream & operator<<(std::ostream &stream, const Address &value)
Operator to serialize the value to a stream.
Definition NetworkConfiguration.h:202
Address()=default
Default constructor.
bool operator!=(const Address &other) const
Comparison operator.
Definition NetworkConfiguration.h:172
bool operator<=(const Address &other) const
Comparison operator.
Definition NetworkConfiguration.h:190
bool operator==(const Address &other) const
Comparison operator.
Definition NetworkConfiguration.h:166
Address(std::string value)
Constructor.
Definition NetworkConfiguration.h:155
DHCP or manual configuration.
Definition NetworkConfiguration.h:227
ValueType
The type of the underlying value.
Definition NetworkConfiguration.h:243
static std::set< ValueType > validValues()
All valid values of Mode.
Definition NetworkConfiguration.h:251
friend std::ostream & operator<<(std::ostream &stream, const Mode &value)
Operator to serialize the value to a stream.
Definition NetworkConfiguration.h:289
static const Mode dhcp
dhcp
Definition NetworkConfiguration.h:247
bool operator!=(const Mode &other) const
Comparison operator.
Definition NetworkConfiguration.h:283
ValueType value() const
Get the value.
constexpr Mode(ValueType value)
Constructor.
Definition NetworkConfiguration.h:260
std::string toString() const
Get the value as string.
Mode()=default
Default constructor.
static const Mode manual
manual
Definition NetworkConfiguration.h:248
bool operator==(const Mode &other) const
Comparison operator.
Definition NetworkConfiguration.h:277
friend std::ostream & operator<<(std::ostream &stream, const Mode::ValueType &value)
Operator to serialize ValueType to a stream.
Definition NetworkConfiguration.h:271
IPv4 subnet mask (for example 255.255.255.0). Only used in manual mode.
Definition NetworkConfiguration.h:318
std::string toString() const
Get the value as string.
SubnetMask()=default
Default constructor.
bool operator>=(const SubnetMask &other) const
Comparison operator.
Definition NetworkConfiguration.h:382
SubnetMask(std::string value)
Constructor.
Definition NetworkConfiguration.h:341
bool operator==(const SubnetMask &other) const
Comparison operator.
Definition NetworkConfiguration.h:352
friend std::ostream & operator<<(std::ostream &stream, const SubnetMask &value)
Operator to serialize the value to a stream.
Definition NetworkConfiguration.h:388
bool operator!=(const SubnetMask &other) const
Comparison operator.
Definition NetworkConfiguration.h:358
const std::string & value() const
Get the value.
std::string ValueType
The type of the underlying value.
Definition NetworkConfiguration.h:335
bool operator<(const SubnetMask &other) const
Comparison operator.
Definition NetworkConfiguration.h:364
bool operator>(const SubnetMask &other) const
Comparison operator.
Definition NetworkConfiguration.h:370
bool operator<=(const SubnetMask &other) const
Comparison operator.
Definition NetworkConfiguration.h:376
IPv4 network configuration.
Definition NetworkConfiguration.h:114
SubnetMask & subnetMask()
Get SubnetMask.
Definition NetworkConfiguration.h:568
const Mode & mode() const
Get Mode.
Definition NetworkConfiguration.h:543
std::string toString() const
Get the value as string.
Address & address()
Get Address.
Definition NetworkConfiguration.h:530
const NetworkConfiguration::IPV4::Mode & get() const
Definition NetworkConfiguration.h:591
bool operator==(const IPV4 &other) const
Equality operator.
void set(Args &&...args)
Set multiple arguments.
Definition NetworkConfiguration.h:470
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition NetworkConfiguration.h:633
const Address & address() const
Get Address.
Definition NetworkConfiguration.h:524
friend std::ostream & operator<<(std::ostream &stream, const IPV4 &value)
Operator to send the value as string to a stream.
Definition NetworkConfiguration.h:650
IPV4 & set(const SubnetMask &value)
Set SubnetMask.
Definition NetworkConfiguration.h:574
Mode & mode()
Get Mode.
Definition NetworkConfiguration.h:549
std::tuple< NetworkConfiguration::IPV4::Address, NetworkConfiguration::IPV4::Mode, NetworkConfiguration::IPV4::SubnetMask > Descendants
Definition NetworkConfiguration.h:409
IPV4 copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition NetworkConfiguration.h:504
const SubnetMask & subnetMask() const
Get SubnetMask.
Definition NetworkConfiguration.h:562
IPV4 & set(const Address &value)
Set Address.
Definition NetworkConfiguration.h:536
const NetworkConfiguration::IPV4::SubnetMask & get() const
Definition NetworkConfiguration.h:599
IPV4 & set(const Mode &value)
Set Mode.
Definition NetworkConfiguration.h:555
const NetworkConfiguration::IPV4::Address & get() const
Definition NetworkConfiguration.h:583
bool operator!=(const IPV4 &other) const
Inequality operator.
IPV4()
Default constructor.
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition NetworkConfiguration.h:624
Network configuration of a camera.
Definition NetworkConfiguration.h:81
NetworkConfiguration copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition NetworkConfiguration.h:784
void load(const std::string &fileName)
Load from the given file.
NetworkConfiguration & set(const IPV4::Mode &value)
Set IPV4::Mode.
Definition NetworkConfiguration.h:829
NetworkConfiguration(Args &&...args)
Constructor taking variadic number of arguments.
Definition NetworkConfiguration.h:719
std::tuple< NetworkConfiguration::IPV4, NetworkConfiguration::IPV4::Address, NetworkConfiguration::IPV4::Mode, NetworkConfiguration::IPV4::SubnetMask > Descendants
Definition NetworkConfiguration.h:669
static ZIVID_NODISCARD NetworkConfiguration fromSerialized(const std::string &value)
Construct a new NetworkConfiguration instance from a previously serialized string.
const NetworkConfiguration::IPV4::Mode & get() const
Definition NetworkConfiguration.h:859
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition NetworkConfiguration.h:887
void set(Args &&...args)
Set multiple arguments.
Definition NetworkConfiguration.h:749
NetworkConfiguration()
Default constructor.
friend std::ostream & operator<<(std::ostream &stream, const NetworkConfiguration &value)
Operator to send the value as string to a stream.
Definition NetworkConfiguration.h:902
NetworkConfiguration(const std::string &fileName)
Construct NetworkConfiguration by loading from file.
const IPV4 & ipv4() const
Get IPV4.
Definition NetworkConfiguration.h:803
void save(const std::string &fileName) const
Save to the given file.
NetworkConfiguration & set(const IPV4::Address &value)
Set IPV4::Address.
Definition NetworkConfiguration.h:822
bool operator==(const NetworkConfiguration &other) const
Equality operator.
std::string serialize() const
Serialize to a string.
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition NetworkConfiguration.h:880
const NetworkConfiguration::IPV4::SubnetMask & get() const
Definition NetworkConfiguration.h:867
const NetworkConfiguration::IPV4 & get() const
Definition NetworkConfiguration.h:843
std::string toString() const
Get the value as string.
NetworkConfiguration & set(const IPV4::SubnetMask &value)
Set IPV4::SubnetMask.
Definition NetworkConfiguration.h:836
NetworkConfiguration & set(const IPV4 &value)
Set IPV4.
Definition NetworkConfiguration.h:815
IPV4 & ipv4()
Get IPV4.
Definition NetworkConfiguration.h:809
const NetworkConfiguration::IPV4::Address & get() const
Definition NetworkConfiguration.h:851
bool operator!=(const NetworkConfiguration &other) const
Inequality operator.
NodeType
Definition NodeType.h:55
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:56