Zivid C++ API 2.14.0+e4a0c4a9-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
65#include "Zivid/Range.h"
66
67#ifdef _MSC_VER
68# pragma warning(push)
69# pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
70#endif
71
72namespace Zivid
73{
74
77
78 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
80 {
81 public:
83 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
84
86 static constexpr const char *path{ "" };
87
89 static constexpr const char *name{ "NetworkConfiguration" };
90
92 static constexpr const char *description{ R"description(Network configuration of a camera
93)description" };
94
95 static constexpr size_t version{ 1 };
96
97#ifndef NO_DOC
98 template<size_t>
99 struct Version;
100
101 using LatestVersion = Zivid::NetworkConfiguration;
102
103 // Short identifier. This value is not guaranteed to be universally unique
104 // Todo(ZIVID-2808): Move this to internal DataModelExt header
105 static constexpr std::array<uint8_t, 3> binaryId{ 'c', 'n', 'c' };
106
107#endif
108
110
111 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
113 {
114 public:
116 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
117
119 static constexpr const char *path{ "IPV4" };
120
122 static constexpr const char *name{ "IPV4" };
123
125 static constexpr const char *description{ R"description(IPv4 network configuration)description" };
126
132
133 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
135 {
136 public:
138 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
139
141 static constexpr const char *path{ "IPV4/Address" };
142
144 static constexpr const char *name{ "Address" };
145
147 static constexpr const char *description{
148 R"description(The camera's IPv4 address. Only used in manual mode.
149
150To be able to connect to the camera, the camera's IP address must be in the same subnet as the IP
151address of the computer's local network interface.
152)description"
153 };
154
156 using ValueType = std::string;
157
159 Address() = default;
160
162 explicit Address(std::string value)
163 : m_value{ verifyValue(std::move(value)) }
164 {}
165
167 const std::string &value() const;
168
170 std::string toString() const;
171
173 bool operator==(const Address &other) const
174 {
175 return m_value == other.m_value;
176 }
177
179 bool operator!=(const Address &other) const
180 {
181 return m_value != other.m_value;
182 }
183
185 bool operator<(const Address &other) const
186 {
187 return m_value < other.m_value;
188 }
189
191 bool operator>(const Address &other) const
192 {
193 return m_value > other.m_value;
194 }
195
197 bool operator<=(const Address &other) const
198 {
199 return m_value <= other.m_value;
200 }
201
203 bool operator>=(const Address &other) const
204 {
205 return m_value >= other.m_value;
206 }
207
209 friend std::ostream &operator<<(std::ostream &stream, const Address &value)
210 {
211 return stream << value.toString();
212 }
213
214 private:
215 void setFromString(const std::string &value);
216
217 ValueType static verifyValue(ValueType &&value)
218 {
219 return DataModel::Detail::isValidIPv4Address(value)
220 ? std::move(value)
221 : throw std::invalid_argument{ "The value '" + value
222 + "' is not a valid IPv4 address." };
223 }
224
225 std::string m_value{ "172.28.60.5" };
226
227 friend struct DataModel::Detail::Befriend<Address>;
228 };
229
231
232 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
234 {
235 public:
237 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
238
240 static constexpr const char *path{ "IPV4/Mode" };
241
243 static constexpr const char *name{ "Mode" };
244
246 static constexpr const char *description{ R"description(DHCP or manual configuration)description" };
247
249 enum class ValueType
250 {
251 dhcp,
252 manual
253 };
254 static const Mode dhcp;
255 static const Mode manual;
256
258 static std::set<ValueType> validValues()
259 {
260 return { ValueType::dhcp, ValueType::manual };
261 }
262
264 Mode() = default;
265
267 explicit constexpr Mode(ValueType value)
268 : m_value{ verifyValue(value) }
269 {}
270
273
275 std::string toString() const;
276
278 friend std::ostream &operator<<(std::ostream &stream, const Mode::ValueType &value)
279 {
280 return stream << Mode{ value }.toString();
281 }
282
284 bool operator==(const Mode &other) const
285 {
286 return m_value == other.m_value;
287 }
288
290 bool operator!=(const Mode &other) const
291 {
292 return m_value != other.m_value;
293 }
294
296 friend std::ostream &operator<<(std::ostream &stream, const Mode &value)
297 {
298 return stream << value.toString();
299 }
300
301 private:
302 void setFromString(const std::string &value);
303
304 constexpr ValueType static verifyValue(const ValueType &value)
305 {
306 return value == ValueType::dhcp || value == ValueType::manual
307 ? value
308 : throw std::invalid_argument{
309 "Invalid value: Mode{ "
310 + std::to_string(static_cast<std::underlying_type<ValueType>::type>(value)) + " }"
311 };
312 }
313
314 ValueType m_value{ ValueType::manual };
315
316 friend struct DataModel::Detail::Befriend<Mode>;
317 };
318
324
325 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
327 {
328 public:
330 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
331
333 static constexpr const char *path{ "IPV4/SubnetMask" };
334
336 static constexpr const char *name{ "SubnetMask" };
337
339 static constexpr const char *description{
340 R"description(The camera's subnet mask (for example 255.255.255.0). Only used in manual mode.
341
342To be able to connect to the camera, the camera's subnet mask must be the same as the subnet mask of the
343computer's local network interface.
344)description"
345 };
346
348 using ValueType = std::string;
349
351 SubnetMask() = default;
352
354 explicit SubnetMask(std::string value)
355 : m_value{ verifyValue(std::move(value)) }
356 {}
357
359 const std::string &value() const;
360
362 std::string toString() const;
363
365 bool operator==(const SubnetMask &other) const
366 {
367 return m_value == other.m_value;
368 }
369
371 bool operator!=(const SubnetMask &other) const
372 {
373 return m_value != other.m_value;
374 }
375
377 bool operator<(const SubnetMask &other) const
378 {
379 return m_value < other.m_value;
380 }
381
383 bool operator>(const SubnetMask &other) const
384 {
385 return m_value > other.m_value;
386 }
387
389 bool operator<=(const SubnetMask &other) const
390 {
391 return m_value <= other.m_value;
392 }
393
395 bool operator>=(const SubnetMask &other) const
396 {
397 return m_value >= other.m_value;
398 }
399
401 friend std::ostream &operator<<(std::ostream &stream, const SubnetMask &value)
402 {
403 return stream << value.toString();
404 }
405
406 private:
407 void setFromString(const std::string &value);
408
409 ValueType static verifyValue(ValueType &&value)
410 {
411 return DataModel::Detail::isValidIPv4SubnetMask(value)
412 ? std::move(value)
413 : throw std::invalid_argument{ "The value '" + value
414 + "' is not a valid IPv4 subnet mask." };
415 }
416
417 std::string m_value{ "255.255.255.0" };
418
419 friend struct DataModel::Detail::Befriend<SubnetMask>;
420 };
421
422 using Descendants = std::tuple<
426
429
443#ifndef NO_DOC
444 template<
445 typename... Args,
446 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
447 typename std::enable_if<
448 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
449 value,
450 int>::type = 0>
451#else
452 template<typename... Args>
453#endif
454 explicit IPV4(Args &&...args)
455 {
456 using namespace Zivid::Detail::TypeTraits;
457
458 static_assert(
459 AllArgsDecayedAreUnique<Args...>::value,
460 "Found duplicate types among the arguments passed to IPV4(...). "
461 "Types should be listed at most once.");
462
463 set(std::forward<Args>(args)...);
464 }
465
478#ifndef NO_DOC
479 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
480#else
481 template<typename... Args>
482#endif
483 void set(Args &&...args)
484 {
485 using namespace Zivid::Detail::TypeTraits;
486
487 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
488 static_assert(
489 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
490
491 static_assert(
492 AllArgsDecayedAreUnique<Args...>::value,
493 "Found duplicate types among the arguments passed to set(...). "
494 "Types should be listed at most once.");
495
496 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
497 }
498
512#ifndef NO_DOC
513 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
514#else
515 template<typename... Args>
516#endif
517 IPV4 copyWith(Args &&...args) const
518 {
519 using namespace Zivid::Detail::TypeTraits;
520
521 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
522 static_assert(
523 AllArgsAreDescendantNodes::value,
524 "All arguments passed to copyWith(...) must be descendant nodes.");
525
526 static_assert(
527 AllArgsDecayedAreUnique<Args...>::value,
528 "Found duplicate types among the arguments passed to copyWith(...). "
529 "Types should be listed at most once.");
530
531 auto copy{ *this };
532 copy.set(std::forward<Args>(args)...);
533 return copy;
534 }
535
537 const Address &address() const
538 {
539 return m_address;
540 }
541
544 {
545 return m_address;
546 }
547
549 IPV4 &set(const Address &value)
550 {
551 m_address = value;
552 return *this;
553 }
554
556 const Mode &mode() const
557 {
558 return m_mode;
559 }
560
563 {
564 return m_mode;
565 }
566
568 IPV4 &set(const Mode &value)
569 {
570 m_mode = value;
571 return *this;
572 }
573
575 const SubnetMask &subnetMask() const
576 {
577 return m_subnetMask;
578 }
579
582 {
583 return m_subnetMask;
584 }
585
587 IPV4 &set(const SubnetMask &value)
588 {
589 m_subnetMask = value;
590 return *this;
591 }
592
593 template<
594 typename T,
595 typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4::Address>::value, int>::type = 0>
597 {
598 return m_address;
599 }
600
601 template<
602 typename T,
603 typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4::Mode>::value, int>::type = 0>
605 {
606 return m_mode;
607 }
608
609 template<
610 typename T,
611 typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4::SubnetMask>::value, int>::type = 0>
613 {
614 return m_subnetMask;
615 }
616
617 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
619 {
620 return m_address;
621 }
622
623 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
625 {
626 return m_mode;
627 }
628
629 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
631 {
632 return m_subnetMask;
633 }
634
636 template<typename F>
637 void forEach(const F &f) const
638 {
639 f(m_address);
640 f(m_mode);
641 f(m_subnetMask);
642 }
643
645 template<typename F>
646 void forEach(const F &f)
647 {
648 f(m_address);
649 f(m_mode);
650 f(m_subnetMask);
651 }
652
654 bool operator==(const IPV4 &other) const;
655
657 bool operator!=(const IPV4 &other) const;
658
660 std::string toString() const;
661
663 friend std::ostream &operator<<(std::ostream &stream, const IPV4 &value)
664 {
665 return stream << value.toString();
666 }
667
668 private:
669 void setFromString(const std::string &value);
670
671 void setFromString(const std::string &fullPath, const std::string &value);
672
673 std::string getString(const std::string &fullPath) const;
674
675 Address m_address;
676 Mode m_mode;
677 SubnetMask m_subnetMask;
678
679 friend struct DataModel::Detail::Befriend<IPV4>;
680 };
681
682 using Descendants = std::tuple<
687
690
692 explicit NetworkConfiguration(const std::string &fileName);
693
699 [[nodiscard]] static NetworkConfiguration fromSerialized(const std::string &value);
700
706 std::string serialize() const;
707
722#ifndef NO_DOC
723 template<
724 typename... Args,
725 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
726 typename std::enable_if<
727 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
728 int>::type = 0>
729#else
730 template<typename... Args>
731#endif
732 explicit NetworkConfiguration(Args &&...args)
733 {
734 using namespace Zivid::Detail::TypeTraits;
735
736 static_assert(
737 AllArgsDecayedAreUnique<Args...>::value,
738 "Found duplicate types among the arguments passed to NetworkConfiguration(...). "
739 "Types should be listed at most once.");
740
741 set(std::forward<Args>(args)...);
742 }
743
757#ifndef NO_DOC
758 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
759#else
760 template<typename... Args>
761#endif
762 void set(Args &&...args)
763 {
764 using namespace Zivid::Detail::TypeTraits;
765
766 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
767 static_assert(
768 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
769
770 static_assert(
771 AllArgsDecayedAreUnique<Args...>::value,
772 "Found duplicate types among the arguments passed to set(...). "
773 "Types should be listed at most once.");
774
775 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
776 }
777
792#ifndef NO_DOC
793 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
794#else
795 template<typename... Args>
796#endif
797 NetworkConfiguration copyWith(Args &&...args) const
798 {
799 using namespace Zivid::Detail::TypeTraits;
800
801 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
802 static_assert(
803 AllArgsAreDescendantNodes::value, "All arguments passed to copyWith(...) must be descendant nodes.");
804
805 static_assert(
806 AllArgsDecayedAreUnique<Args...>::value,
807 "Found duplicate types among the arguments passed to copyWith(...). "
808 "Types should be listed at most once.");
809
810 auto copy{ *this };
811 copy.set(std::forward<Args>(args)...);
812 return copy;
813 }
814
816 const IPV4 &ipv4() const
817 {
818 return m_ipv4;
819 }
820
823 {
824 return m_ipv4;
825 }
826
829 {
830 m_ipv4 = value;
831 return *this;
832 }
833
836 {
837 m_ipv4.set(value);
838 return *this;
839 }
840
843 {
844 m_ipv4.set(value);
845 return *this;
846 }
847
850 {
851 m_ipv4.set(value);
852 return *this;
853 }
854
855 template<typename T, typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4>::value, int>::type = 0>
857 {
858 return m_ipv4;
859 }
860
861 template<
862 typename T,
863 typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4::Address>::value, int>::type = 0>
865 {
866 return m_ipv4.get<NetworkConfiguration::IPV4::Address>();
867 }
868
869 template<
870 typename T,
871 typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4::Mode>::value, int>::type = 0>
873 {
874 return m_ipv4.get<NetworkConfiguration::IPV4::Mode>();
875 }
876
877 template<
878 typename T,
879 typename std::enable_if<std::is_same<T, NetworkConfiguration::IPV4::SubnetMask>::value, int>::type = 0>
881 {
882 return m_ipv4.get<NetworkConfiguration::IPV4::SubnetMask>();
883 }
884
885 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
887 {
888 return m_ipv4;
889 }
890
892 template<typename F>
893 void forEach(const F &f) const
894 {
895 f(m_ipv4);
896 }
897
899 template<typename F>
900 void forEach(const F &f)
901 {
902 f(m_ipv4);
903 }
904
906 bool operator==(const NetworkConfiguration &other) const;
907
909 bool operator!=(const NetworkConfiguration &other) const;
910
912 std::string toString() const;
913
915 friend std::ostream &operator<<(std::ostream &stream, const NetworkConfiguration &value)
916 {
917 return stream << value.toString();
918 }
919
921 void save(const std::string &fileName) const;
922
924 void load(const std::string &fileName);
925
926 private:
927 void setFromString(const std::string &value);
928
929 void setFromString(const std::string &fullPath, const std::string &value);
930
931 std::string getString(const std::string &fullPath) const;
932
933 IPV4 m_ipv4;
934
935 friend struct DataModel::Detail::Befriend<NetworkConfiguration>;
936 };
937
938#ifndef NO_DOC
939 template<>
940 struct NetworkConfiguration::Version<1>
941 {
942 using Type = NetworkConfiguration;
943 };
944#endif
945
946} // namespace Zivid
947
948#ifndef NO_DOC
950namespace Zivid::Detail
951{
952
953 ZIVID_CORE_EXPORT void save(const Zivid::NetworkConfiguration &dataModel, std::ostream &ostream);
954 ZIVID_CORE_EXPORT void load(Zivid::NetworkConfiguration &dataModel, std::istream &istream);
955
956 ZIVID_CORE_EXPORT std::vector<uint8_t> serializeToBinaryVector(const Zivid::NetworkConfiguration &source);
957 ZIVID_CORE_EXPORT void deserializeFromBinaryVector(
959 const std::vector<uint8_t> &data);
960
961} // namespace Zivid::Detail
962#endif
963
964#ifdef _MSC_VER
965# pragma warning(pop)
966#endif
967
968#ifndef NO_DOC
969# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
970namespace std // NOLINT
971{
972
973 template<>
974 struct tuple_size<Zivid::NetworkConfiguration::IPV4> : integral_constant<size_t, 3>
975 {};
976
977 template<size_t i>
978 struct tuple_element<i, Zivid::NetworkConfiguration::IPV4>
979 {
980 static_assert(i < tuple_size<Zivid::NetworkConfiguration::IPV4>::value, "Index must be less than 3");
981
982 using type // NOLINT
983 = decltype(declval<Zivid::NetworkConfiguration::IPV4>().get<i>());
984 };
985
986 template<>
987 struct tuple_size<Zivid::NetworkConfiguration> : integral_constant<size_t, 1>
988 {};
989
990 template<size_t i>
991 struct tuple_element<i, Zivid::NetworkConfiguration>
992 {
993 static_assert(i < tuple_size<Zivid::NetworkConfiguration>::value, "Index must be less than 1");
994
995 using type // NOLINT
996 = decltype(declval<Zivid::NetworkConfiguration>().get<i>());
997 };
998
999} // namespace std
1000# endif
1001#endif
1002
1003// If we have access to the DataModel library, automatically include internal DataModel
1004// header. This header is necessary for serialization and deserialization.
1005#if defined(__has_include) && !defined(NO_DOC)
1006# if __has_include("Zivid/NetworkConfigurationInternal.h") && __has_include("Zivid/DataModelNodeMetaData.h")
1007# include "Zivid/NetworkConfigurationInternal.h"
1008# endif
1009#endif
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
The camera's IPv4 address. Only used in manual mode.
Definition NetworkConfiguration.h:135
bool operator<(const Address &other) const
Comparison operator.
Definition NetworkConfiguration.h:185
bool operator>(const Address &other) const
Comparison operator.
Definition NetworkConfiguration.h:191
bool operator>=(const Address &other) const
Comparison operator.
Definition NetworkConfiguration.h:203
std::string toString() const
Get the value as string.
std::string ValueType
The type of the underlying value.
Definition NetworkConfiguration.h:156
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:209
Address()=default
Default constructor.
bool operator!=(const Address &other) const
Comparison operator.
Definition NetworkConfiguration.h:179
bool operator<=(const Address &other) const
Comparison operator.
Definition NetworkConfiguration.h:197
bool operator==(const Address &other) const
Comparison operator.
Definition NetworkConfiguration.h:173
Address(std::string value)
Constructor.
Definition NetworkConfiguration.h:162
DHCP or manual configuration.
Definition NetworkConfiguration.h:234
ValueType
The type of the underlying value.
Definition NetworkConfiguration.h:250
static std::set< ValueType > validValues()
All valid values of Mode.
Definition NetworkConfiguration.h:258
friend std::ostream & operator<<(std::ostream &stream, const Mode &value)
Operator to serialize the value to a stream.
Definition NetworkConfiguration.h:296
static const Mode dhcp
dhcp
Definition NetworkConfiguration.h:254
bool operator!=(const Mode &other) const
Comparison operator.
Definition NetworkConfiguration.h:290
ValueType value() const
Get the value.
constexpr Mode(ValueType value)
Constructor.
Definition NetworkConfiguration.h:267
std::string toString() const
Get the value as string.
Mode()=default
Default constructor.
static const Mode manual
manual
Definition NetworkConfiguration.h:255
bool operator==(const Mode &other) const
Comparison operator.
Definition NetworkConfiguration.h:284
friend std::ostream & operator<<(std::ostream &stream, const Mode::ValueType &value)
Operator to serialize ValueType to a stream.
Definition NetworkConfiguration.h:278
The camera's subnet mask (for example 255.255.255.0). Only used in manual mode.
Definition NetworkConfiguration.h:327
std::string toString() const
Get the value as string.
SubnetMask()=default
Default constructor.
bool operator>=(const SubnetMask &other) const
Comparison operator.
Definition NetworkConfiguration.h:395
SubnetMask(std::string value)
Constructor.
Definition NetworkConfiguration.h:354
bool operator==(const SubnetMask &other) const
Comparison operator.
Definition NetworkConfiguration.h:365
friend std::ostream & operator<<(std::ostream &stream, const SubnetMask &value)
Operator to serialize the value to a stream.
Definition NetworkConfiguration.h:401
bool operator!=(const SubnetMask &other) const
Comparison operator.
Definition NetworkConfiguration.h:371
const std::string & value() const
Get the value.
std::string ValueType
The type of the underlying value.
Definition NetworkConfiguration.h:348
bool operator<(const SubnetMask &other) const
Comparison operator.
Definition NetworkConfiguration.h:377
bool operator>(const SubnetMask &other) const
Comparison operator.
Definition NetworkConfiguration.h:383
bool operator<=(const SubnetMask &other) const
Comparison operator.
Definition NetworkConfiguration.h:389
IPv4 network configuration.
Definition NetworkConfiguration.h:113
SubnetMask & subnetMask()
Get SubnetMask.
Definition NetworkConfiguration.h:581
const Mode & mode() const
Get Mode.
Definition NetworkConfiguration.h:556
std::string toString() const
Get the value as string.
Address & address()
Get Address.
Definition NetworkConfiguration.h:543
const NetworkConfiguration::IPV4::Mode & get() const
Definition NetworkConfiguration.h:604
bool operator==(const IPV4 &other) const
Equality operator.
void set(Args &&...args)
Set multiple arguments.
Definition NetworkConfiguration.h:483
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition NetworkConfiguration.h:646
const Address & address() const
Get Address.
Definition NetworkConfiguration.h:537
friend std::ostream & operator<<(std::ostream &stream, const IPV4 &value)
Operator to send the value as string to a stream.
Definition NetworkConfiguration.h:663
IPV4 & set(const SubnetMask &value)
Set SubnetMask.
Definition NetworkConfiguration.h:587
Mode & mode()
Get Mode.
Definition NetworkConfiguration.h:562
std::tuple< NetworkConfiguration::IPV4::Address, NetworkConfiguration::IPV4::Mode, NetworkConfiguration::IPV4::SubnetMask > Descendants
Definition NetworkConfiguration.h:422
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:517
const SubnetMask & subnetMask() const
Get SubnetMask.
Definition NetworkConfiguration.h:575
IPV4 & set(const Address &value)
Set Address.
Definition NetworkConfiguration.h:549
const NetworkConfiguration::IPV4::SubnetMask & get() const
Definition NetworkConfiguration.h:612
IPV4 & set(const Mode &value)
Set Mode.
Definition NetworkConfiguration.h:568
const NetworkConfiguration::IPV4::Address & get() const
Definition NetworkConfiguration.h:596
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:637
Network configuration of a camera.
Definition NetworkConfiguration.h:80
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:797
void load(const std::string &fileName)
Load from the given file.
NetworkConfiguration & set(const IPV4::Mode &value)
Set IPV4::Mode.
Definition NetworkConfiguration.h:842
NetworkConfiguration(Args &&...args)
Constructor taking variadic number of arguments.
Definition NetworkConfiguration.h:732
std::tuple< NetworkConfiguration::IPV4, NetworkConfiguration::IPV4::Address, NetworkConfiguration::IPV4::Mode, NetworkConfiguration::IPV4::SubnetMask > Descendants
Definition NetworkConfiguration.h:682
const NetworkConfiguration::IPV4::Mode & get() const
Definition NetworkConfiguration.h:872
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition NetworkConfiguration.h:900
void set(Args &&...args)
Set multiple arguments.
Definition NetworkConfiguration.h:762
static NetworkConfiguration fromSerialized(const std::string &value)
Construct a new NetworkConfiguration instance from a previously serialized string.
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:915
NetworkConfiguration(const std::string &fileName)
Construct NetworkConfiguration by loading from file.
const IPV4 & ipv4() const
Get IPV4.
Definition NetworkConfiguration.h:816
void save(const std::string &fileName) const
Save to the given file.
NetworkConfiguration & set(const IPV4::Address &value)
Set IPV4::Address.
Definition NetworkConfiguration.h:835
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:893
const NetworkConfiguration::IPV4::SubnetMask & get() const
Definition NetworkConfiguration.h:880
const NetworkConfiguration::IPV4 & get() const
Definition NetworkConfiguration.h:856
std::string toString() const
Get the value as string.
NetworkConfiguration & set(const IPV4::SubnetMask &value)
Set IPV4::SubnetMask.
Definition NetworkConfiguration.h:849
NetworkConfiguration & set(const IPV4 &value)
Set IPV4.
Definition NetworkConfiguration.h:828
IPV4 & ipv4()
Get IPV4.
Definition NetworkConfiguration.h:822
const NetworkConfiguration::IPV4::Address & get() const
Definition NetworkConfiguration.h:864
bool operator!=(const NetworkConfiguration &other) const
Inequality operator.
NodeType
Definition NodeType.h:49
Definition EnvironmentInfo.h:74
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:84