Zivid C++ API 2.14.0+e4a0c4a9-1
CameraState.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 <optional>
53#include <set>
54#include <sstream>
55#include <string>
56#include <tuple>
57#include <utility>
58#include <vector>
59
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
76
77 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
79 {
80 public:
82 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
83
85 static constexpr const char *path{ "" };
86
88 static constexpr const char *name{ "CameraState" };
89
91 static constexpr const char *description{
92 R"description(Information about camera connection state, temperatures, etc.)description"
93 };
94
95 static constexpr size_t version{ 7 };
96
97#ifndef NO_DOC
98 template<size_t>
99 struct Version;
100
101 using LatestVersion = Zivid::CameraState;
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', 's', 't' };
106
107#endif
108
113
114 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
116 {
117 public:
119 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
120
122 static constexpr const char *path{ "Available" };
123
125 static constexpr const char *name{ "Available" };
126
128 static constexpr const char *description{
129 R"description(Flag if camera is physically connected to the computer and is available for use, but not connected in
130software. This corresponds to the Status enums `available` or `firmwareUpdateRequired`. Zivid
131recommends to use the Status enum instead of this bool.
132)description"
133 };
134
136 using ValueType = bool;
137 static const Available yes;
138 static const Available no;
139
141 static std::set<bool> validValues()
142 {
143 return { false, true };
144 }
145
147 Available() = default;
148
150 explicit constexpr Available(bool value)
151 : m_value{ value }
152 {}
153
155 bool value() const;
156
158 std::string toString() const;
159
161 explicit operator bool() const
162 {
163 return m_value;
164 }
165
167 bool operator==(const Available &other) const
168 {
169 return m_value == other.m_value;
170 }
171
173 bool operator!=(const Available &other) const
174 {
175 return m_value != other.m_value;
176 }
177
179 friend std::ostream &operator<<(std::ostream &stream, const Available &value)
180 {
181 return stream << value.toString();
182 }
183
184 private:
185 void setFromString(const std::string &value);
186
187 bool m_value{ false };
188
189 friend struct DataModel::Detail::Befriend<Available>;
190 };
191
195
196 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
198 {
199 public:
201 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
202
204 static constexpr const char *path{ "Connected" };
205
207 static constexpr const char *name{ "Connected" };
208
210 static constexpr const char *description{
211 R"description(Flag if camera is connected in software. This bool is true when the Status value is `connected`. Zivid
212recommends to use the Status enum instead of this bool.
213)description"
214 };
215
217 using ValueType = bool;
218 static const Connected yes;
219 static const Connected no;
220
222 static std::set<bool> validValues()
223 {
224 return { false, true };
225 }
226
228 Connected() = default;
229
231 explicit constexpr Connected(bool value)
232 : m_value{ value }
233 {}
234
236 bool value() const;
237
239 std::string toString() const;
240
242 explicit operator bool() const
243 {
244 return m_value;
245 }
246
248 bool operator==(const Connected &other) const
249 {
250 return m_value == other.m_value;
251 }
252
254 bool operator!=(const Connected &other) const
255 {
256 return m_value != other.m_value;
257 }
258
260 friend std::ostream &operator<<(std::ostream &stream, const Connected &value)
261 {
262 return stream << value.toString();
263 }
264
265 private:
266 void setFromString(const std::string &value);
267
268 bool m_value{ false };
269
270 friend struct DataModel::Detail::Befriend<Connected>;
271 };
272
274
275 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
277 {
278 public:
280 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
281
283 static constexpr const char *path{ "InaccessibleReason" };
284
286 static constexpr const char *name{ "InaccessibleReason" };
287
289 static constexpr const char *description{
290 R"description(If the camera status is `inaccessible`, then this enum value will give you the reason.)description"
291 };
292
294 enum class ValueType
295 {
296 ipConflictWithAnotherCamera,
297 ipConflictWithLocalNetworkAdapter,
298 ipNotInLocalSubnet,
299 ipInMultipleLocalSubnets
300 };
305
307 static std::set<ValueType> validValues()
308 {
309 return { ValueType::ipConflictWithAnotherCamera,
310 ValueType::ipConflictWithLocalNetworkAdapter,
311 ValueType::ipNotInLocalSubnet,
312 ValueType::ipInMultipleLocalSubnets };
313 }
314
317
319 explicit constexpr InaccessibleReason(ValueType value)
320 : m_opt{ verifyValue(value) }
321 {}
322
328
330 bool hasValue() const;
331
333 void reset();
334
336 std::string toString() const;
337
339 friend std::ostream &operator<<(std::ostream &stream, const InaccessibleReason::ValueType &value)
340 {
341 return stream << InaccessibleReason{ value }.toString();
342 }
343
345 bool operator==(const InaccessibleReason &other) const
346 {
347 return m_opt == other.m_opt;
348 }
349
351 bool operator!=(const InaccessibleReason &other) const
352 {
353 return m_opt != other.m_opt;
354 }
355
357 friend std::ostream &operator<<(std::ostream &stream, const InaccessibleReason &value)
358 {
359 return stream << value.toString();
360 }
361
362 private:
363 void setFromString(const std::string &value);
364
365 constexpr ValueType static verifyValue(const ValueType &value)
366 {
367 return value == ValueType::ipConflictWithAnotherCamera
368 || value == ValueType::ipConflictWithLocalNetworkAdapter
369 || value == ValueType::ipNotInLocalSubnet || value == ValueType::ipInMultipleLocalSubnets
370 ? value
371 : throw std::invalid_argument{
372 "Invalid value: InaccessibleReason{ "
373 + std::to_string(static_cast<std::underlying_type<ValueType>::type>(value)) + " }"
374 };
375 }
376
377 std::optional<ValueType> m_opt;
378
379 friend struct DataModel::Detail::Befriend<InaccessibleReason>;
380 };
381
383
384 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
386 {
387 public:
389 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
390
392 static constexpr const char *path{ "Network" };
393
395 static constexpr const char *name{ "Network" };
396
398 static constexpr const char *description{ R"description(Current network state)description" };
399
402
403 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
405 {
406 public:
408 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
409
411 static constexpr const char *path{ "Network/LocalInterface" };
412
414 static constexpr const char *name{ "LocalInterface" };
415
417 static constexpr const char *description{
418 R"description(Current state of the computer's local network interface.
419)description"
420 };
421
423
424 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
426 {
427 public:
429 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
430
432 static constexpr const char *path{ "Network/LocalInterface/IPV4" };
433
435 static constexpr const char *name{ "IPV4" };
436
438 static constexpr const char *description{
439 R"description(Current IPv4 protocol state of the computer's local network interface.)description"
440 };
441
444
445 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
447 {
448 public:
450 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
451
453 static constexpr const char *path{ "Network/LocalInterface/IPV4/Subnet" };
454
456 static constexpr const char *name{ "Subnet" };
457
459 static constexpr const char *description{
460 R"description(An IPv4 subnet that the local network interface is connected to.
461)description"
462 };
463
465
466 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
468 {
469 public:
471 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
472
474 static constexpr const char *path{ "Network/LocalInterface/IPV4/Subnet/Address" };
475
477 static constexpr const char *name{ "Address" };
478
480 static constexpr const char *description{
481 R"description(IP address of the computer's local network interface.)description"
482 };
483
485 using ValueType = std::string;
486
489 {
490 return { 0, std::numeric_limits<ValueType::size_type>::max() };
491 }
492
494 Address() = default;
495
497 explicit Address(std::string value)
498 : m_value{ std::move(value) }
499 {}
500
502 const std::string &value() const;
503
505 std::string toString() const;
506
508 bool operator==(const Address &other) const
509 {
510 return m_value == other.m_value;
511 }
512
514 bool operator!=(const Address &other) const
515 {
516 return m_value != other.m_value;
517 }
518
520 bool operator<(const Address &other) const
521 {
522 return m_value < other.m_value;
523 }
524
526 bool operator>(const Address &other) const
527 {
528 return m_value > other.m_value;
529 }
530
532 bool operator<=(const Address &other) const
533 {
534 return m_value <= other.m_value;
535 }
536
538 bool operator>=(const Address &other) const
539 {
540 return m_value >= other.m_value;
541 }
542
544 friend std::ostream &operator<<(std::ostream &stream, const Address &value)
545 {
546 return stream << value.toString();
547 }
548
549 private:
550 void setFromString(const std::string &value);
551
552 std::string m_value{};
553
554 friend struct DataModel::Detail::Befriend<Address>;
555 };
556
558
559 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
561 {
562 public:
564 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
565
567 static constexpr const char *path{ "Network/LocalInterface/IPV4/Subnet/Mask" };
568
570 static constexpr const char *name{ "Mask" };
571
573 static constexpr const char *description{
574 R"description(Subnet mask of the computer's local network interface.)description"
575 };
576
578 using ValueType = std::string;
579
582 {
583 return { 0, std::numeric_limits<ValueType::size_type>::max() };
584 }
585
587 Mask() = default;
588
590 explicit Mask(std::string value)
591 : m_value{ std::move(value) }
592 {}
593
595 const std::string &value() const;
596
598 std::string toString() const;
599
601 bool operator==(const Mask &other) const
602 {
603 return m_value == other.m_value;
604 }
605
607 bool operator!=(const Mask &other) const
608 {
609 return m_value != other.m_value;
610 }
611
613 bool operator<(const Mask &other) const
614 {
615 return m_value < other.m_value;
616 }
617
619 bool operator>(const Mask &other) const
620 {
621 return m_value > other.m_value;
622 }
623
625 bool operator<=(const Mask &other) const
626 {
627 return m_value <= other.m_value;
628 }
629
631 bool operator>=(const Mask &other) const
632 {
633 return m_value >= other.m_value;
634 }
635
637 friend std::ostream &operator<<(std::ostream &stream, const Mask &value)
638 {
639 return stream << value.toString();
640 }
641
642 private:
643 void setFromString(const std::string &value);
644
645 std::string m_value{};
646
647 friend struct DataModel::Detail::Befriend<Mask>;
648 };
649
650 using Descendants = std::tuple<
653
656
669#ifndef NO_DOC
670 template<
671 typename... Args,
672 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
673 typename std::enable_if<
674 Zivid::Detail::TypeTraits::
675 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
676 int>::type = 0>
677#else
678 template<typename... Args>
679#endif
680 explicit Subnet(Args &&...args)
681 {
682 using namespace Zivid::Detail::TypeTraits;
683
684 static_assert(
685 AllArgsDecayedAreUnique<Args...>::value,
686 "Found duplicate types among the arguments passed to Subnet(...). "
687 "Types should be listed at most once.");
688
689 set(std::forward<Args>(args)...);
690 }
691
703#ifndef NO_DOC
704 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
705#else
706 template<typename... Args>
707#endif
708 void set(Args &&...args)
709 {
710 using namespace Zivid::Detail::TypeTraits;
711
712 using AllArgsAreDescendantNodes =
713 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
714 static_assert(
715 AllArgsAreDescendantNodes::value,
716 "All arguments passed to set(...) must be descendant nodes.");
717
718 static_assert(
719 AllArgsDecayedAreUnique<Args...>::value,
720 "Found duplicate types among the arguments passed to set(...). "
721 "Types should be listed at most once.");
722
723 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
724 }
725
738#ifndef NO_DOC
739 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
740#else
741 template<typename... Args>
742#endif
743 Subnet copyWith(Args &&...args) const
744 {
745 using namespace Zivid::Detail::TypeTraits;
746
747 using AllArgsAreDescendantNodes =
748 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
749 static_assert(
750 AllArgsAreDescendantNodes::value,
751 "All arguments passed to copyWith(...) must be descendant nodes.");
752
753 static_assert(
754 AllArgsDecayedAreUnique<Args...>::value,
755 "Found duplicate types among the arguments passed to copyWith(...). "
756 "Types should be listed at most once.");
757
758 auto copy{ *this };
759 copy.set(std::forward<Args>(args)...);
760 return copy;
761 }
762
764 const Address &address() const
765 {
766 return m_address;
767 }
768
771 {
772 return m_address;
773 }
774
776 Subnet &set(const Address &value)
777 {
778 m_address = value;
779 return *this;
780 }
781
783 const Mask &mask() const
784 {
785 return m_mask;
786 }
787
790 {
791 return m_mask;
792 }
793
795 Subnet &set(const Mask &value)
796 {
797 m_mask = value;
798 return *this;
799 }
800
801 template<
802 typename T,
803 typename std::enable_if<
804 std::is_same<T, CameraState::Network::LocalInterface::IPV4::Subnet::Address>::value,
805 int>::type = 0>
807 {
808 return m_address;
809 }
810
811 template<
812 typename T,
813 typename std::enable_if<
814 std::is_same<T, CameraState::Network::LocalInterface::IPV4::Subnet::Mask>::value,
815 int>::type = 0>
817 {
818 return m_mask;
819 }
820
821 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
823 {
824 return m_address;
825 }
826
827 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
829 {
830 return m_mask;
831 }
832
834 template<typename F>
835 void forEach(const F &f) const
836 {
837 f(m_address);
838 f(m_mask);
839 }
840
842 template<typename F>
843 void forEach(const F &f)
844 {
845 f(m_address);
846 f(m_mask);
847 }
848
850 bool operator==(const Subnet &other) const;
851
853 bool operator!=(const Subnet &other) const;
854
856 std::string toString() const;
857
859 friend std::ostream &operator<<(std::ostream &stream, const Subnet &value)
860 {
861 return stream << value.toString();
862 }
863
864 private:
865 void setFromString(const std::string &value);
866
867 void setFromString(const std::string &fullPath, const std::string &value);
868
869 std::string getString(const std::string &fullPath) const;
870
871 Address m_address;
872 Mask m_mask;
873
874 friend struct DataModel::Detail::Befriend<Subnet>;
875 };
876
881
882 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
884 {
885 public:
887 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafDataModelList;
888
890 static constexpr const char *path{ "Network/LocalInterface/IPV4/Subnets" };
891
893 static constexpr const char *name{ "Subnets" };
894
896 static constexpr const char *description{
897 R"description(List of IPv4 addresses and subnet masks that the interface is configured with. This list can
898contain multiple entries if the local network interface is configured with multiple IPv4
899addresses.
900)description"
901 };
902
904 using ValueType = std::vector<CameraState::Network::LocalInterface::IPV4::Subnet>;
905
908 {
909 return { 0, std::numeric_limits<ValueType::size_type>::max() };
910 }
911
913 Subnets() = default;
914
916 explicit Subnets(std::vector<CameraState::Network::LocalInterface::IPV4::Subnet> value)
917 : m_value{ std::move(value) }
918 {}
919
921 explicit Subnets(
922 std::initializer_list<CameraState::Network::LocalInterface::IPV4::Subnet> value)
923 : Subnets{ ValueType{ value } }
924 {}
925
927 const std::vector<CameraState::Network::LocalInterface::IPV4::Subnet> &value() const;
928
930 std::string toString() const;
931
933 std::size_t size() const noexcept;
934
936 bool isEmpty() const noexcept;
937
943 template<typename... Args>
944 void emplaceBack(Args &&...args)
945 {
946 m_value.emplace_back(std::forward<Args>(args)...);
947 }
948
955
962
969
976
978 template<typename F>
979 void forEach(const F &f)
980 {
981 for(auto &child : m_value)
982 {
983 f(child);
984 }
985 }
986
988 template<typename F>
989 void forEach(const F &f) const
990 {
991 for(const auto &child : m_value)
992 {
993 f(child);
994 }
995 }
996
998 using Iterator = std::vector<CameraState::Network::LocalInterface::IPV4::Subnet>::iterator;
999
1001 Iterator begin() noexcept;
1002
1004 Iterator end() noexcept;
1005
1008 std::vector<CameraState::Network::LocalInterface::IPV4::Subnet>::const_iterator;
1009
1011 ConstIterator begin() const noexcept;
1012
1014 ConstIterator end() const noexcept;
1015
1017 ConstIterator cbegin() const noexcept;
1018
1020 ConstIterator cend() const noexcept;
1021
1023 bool operator==(const Subnets &other) const
1024 {
1025 return m_value == other.m_value;
1026 }
1027
1029 bool operator!=(const Subnets &other) const
1030 {
1031 return m_value != other.m_value;
1032 }
1033
1035 friend std::ostream &operator<<(std::ostream &stream, const Subnets &value)
1036 {
1037 return stream << value.toString();
1038 }
1039
1040 private:
1041 void setFromString(const std::string &value);
1042
1043 std::vector<CameraState::Network::LocalInterface::IPV4::Subnet> m_value{};
1044
1045 friend struct DataModel::Detail::Befriend<Subnets>;
1046 };
1047
1048 using Descendants = std::tuple<CameraState::Network::LocalInterface::IPV4::Subnets>;
1049
1052
1064#ifndef NO_DOC
1065 template<
1066 typename... Args,
1067 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1068 typename std::enable_if<
1069 Zivid::Detail::TypeTraits::
1070 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
1071 int>::type = 0>
1072#else
1073 template<typename... Args>
1074#endif
1075 explicit IPV4(Args &&...args)
1076 {
1077 using namespace Zivid::Detail::TypeTraits;
1078
1079 static_assert(
1080 AllArgsDecayedAreUnique<Args...>::value,
1081 "Found duplicate types among the arguments passed to IPV4(...). "
1082 "Types should be listed at most once.");
1083
1084 set(std::forward<Args>(args)...);
1085 }
1086
1097#ifndef NO_DOC
1098 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1099#else
1100 template<typename... Args>
1101#endif
1102 void set(Args &&...args)
1103 {
1104 using namespace Zivid::Detail::TypeTraits;
1105
1106 using AllArgsAreDescendantNodes =
1107 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1108 static_assert(
1109 AllArgsAreDescendantNodes::value,
1110 "All arguments passed to set(...) must be descendant nodes.");
1111
1112 static_assert(
1113 AllArgsDecayedAreUnique<Args...>::value,
1114 "Found duplicate types among the arguments passed to set(...). "
1115 "Types should be listed at most once.");
1116
1117 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1118 }
1119
1131#ifndef NO_DOC
1132 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1133#else
1134 template<typename... Args>
1135#endif
1136 IPV4 copyWith(Args &&...args) const
1137 {
1138 using namespace Zivid::Detail::TypeTraits;
1139
1140 using AllArgsAreDescendantNodes =
1141 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1142 static_assert(
1143 AllArgsAreDescendantNodes::value,
1144 "All arguments passed to copyWith(...) must be descendant nodes.");
1145
1146 static_assert(
1147 AllArgsDecayedAreUnique<Args...>::value,
1148 "Found duplicate types among the arguments passed to copyWith(...). "
1149 "Types should be listed at most once.");
1150
1151 auto copy{ *this };
1152 copy.set(std::forward<Args>(args)...);
1153 return copy;
1154 }
1155
1157 const Subnets &subnets() const
1158 {
1159 return m_subnets;
1160 }
1161
1164 {
1165 return m_subnets;
1166 }
1167
1169 IPV4 &set(const Subnets &value)
1170 {
1171 m_subnets = value;
1172 return *this;
1173 }
1174
1175 template<
1176 typename T,
1177 typename std::enable_if<
1178 std::is_same<T, CameraState::Network::LocalInterface::IPV4::Subnets>::value,
1179 int>::type = 0>
1181 {
1182 return m_subnets;
1183 }
1184
1185 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1187 {
1188 return m_subnets;
1189 }
1190
1192 template<typename F>
1193 void forEach(const F &f) const
1194 {
1195 f(m_subnets);
1196 }
1197
1199 template<typename F>
1200 void forEach(const F &f)
1201 {
1202 f(m_subnets);
1203 }
1204
1206 bool operator==(const IPV4 &other) const;
1207
1209 bool operator!=(const IPV4 &other) const;
1210
1212 std::string toString() const;
1213
1215 friend std::ostream &operator<<(std::ostream &stream, const IPV4 &value)
1216 {
1217 return stream << value.toString();
1218 }
1219
1220 private:
1221 void setFromString(const std::string &value);
1222
1223 void setFromString(const std::string &fullPath, const std::string &value);
1224
1225 std::string getString(const std::string &fullPath) const;
1226
1227 Subnets m_subnets;
1228
1229 friend struct DataModel::Detail::Befriend<IPV4>;
1230 };
1231
1233
1234 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1236 {
1237 public:
1239 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1240
1242 static constexpr const char *path{ "Network/LocalInterface/InterfaceName" };
1243
1245 static constexpr const char *name{ "InterfaceName" };
1246
1248 static constexpr const char *description{
1249 R"description(Name of the computer's local network interface.)description"
1250 };
1251
1253 using ValueType = std::string;
1254
1257 {
1258 return { 0, std::numeric_limits<ValueType::size_type>::max() };
1259 }
1260
1262 InterfaceName() = default;
1263
1265 explicit InterfaceName(std::string value)
1266 : m_value{ std::move(value) }
1267 {}
1268
1270 const std::string &value() const;
1271
1273 std::string toString() const;
1274
1276 bool operator==(const InterfaceName &other) const
1277 {
1278 return m_value == other.m_value;
1279 }
1280
1282 bool operator!=(const InterfaceName &other) const
1283 {
1284 return m_value != other.m_value;
1285 }
1286
1288 bool operator<(const InterfaceName &other) const
1289 {
1290 return m_value < other.m_value;
1291 }
1292
1294 bool operator>(const InterfaceName &other) const
1295 {
1296 return m_value > other.m_value;
1297 }
1298
1300 bool operator<=(const InterfaceName &other) const
1301 {
1302 return m_value <= other.m_value;
1303 }
1304
1306 bool operator>=(const InterfaceName &other) const
1307 {
1308 return m_value >= other.m_value;
1309 }
1310
1312 friend std::ostream &operator<<(std::ostream &stream, const InterfaceName &value)
1313 {
1314 return stream << value.toString();
1315 }
1316
1317 private:
1318 void setFromString(const std::string &value);
1319
1320 std::string m_value{};
1321
1322 friend struct DataModel::Detail::Befriend<InterfaceName>;
1323 };
1324
1325 using Descendants = std::tuple<
1329
1332
1346#ifndef NO_DOC
1347 template<
1348 typename... Args,
1349 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1350 typename std::enable_if<
1351 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
1352 value,
1353 int>::type = 0>
1354#else
1355 template<typename... Args>
1356#endif
1357 explicit LocalInterface(Args &&...args)
1358 {
1359 using namespace Zivid::Detail::TypeTraits;
1360
1361 static_assert(
1362 AllArgsDecayedAreUnique<Args...>::value,
1363 "Found duplicate types among the arguments passed to LocalInterface(...). "
1364 "Types should be listed at most once.");
1365
1366 set(std::forward<Args>(args)...);
1367 }
1368
1381#ifndef NO_DOC
1382 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1383#else
1384 template<typename... Args>
1385#endif
1386 void set(Args &&...args)
1387 {
1388 using namespace Zivid::Detail::TypeTraits;
1389
1390 using AllArgsAreDescendantNodes =
1391 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1392 static_assert(
1393 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1394
1395 static_assert(
1396 AllArgsDecayedAreUnique<Args...>::value,
1397 "Found duplicate types among the arguments passed to set(...). "
1398 "Types should be listed at most once.");
1399
1400 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1401 }
1402
1416#ifndef NO_DOC
1417 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1418#else
1419 template<typename... Args>
1420#endif
1421 LocalInterface copyWith(Args &&...args) const
1422 {
1423 using namespace Zivid::Detail::TypeTraits;
1424
1425 using AllArgsAreDescendantNodes =
1426 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1427 static_assert(
1428 AllArgsAreDescendantNodes::value,
1429 "All arguments passed to copyWith(...) must be descendant nodes.");
1430
1431 static_assert(
1432 AllArgsDecayedAreUnique<Args...>::value,
1433 "Found duplicate types among the arguments passed to copyWith(...). "
1434 "Types should be listed at most once.");
1435
1436 auto copy{ *this };
1437 copy.set(std::forward<Args>(args)...);
1438 return copy;
1439 }
1440
1442 const IPV4 &ipv4() const
1443 {
1444 return m_ipv4;
1445 }
1446
1449 {
1450 return m_ipv4;
1451 }
1452
1454 LocalInterface &set(const IPV4 &value)
1455 {
1456 m_ipv4 = value;
1457 return *this;
1458 }
1459
1462 {
1463 m_ipv4.set(value);
1464 return *this;
1465 }
1466
1469 {
1470 return m_interfaceName;
1471 }
1472
1475 {
1476 return m_interfaceName;
1477 }
1478
1481 {
1482 m_interfaceName = value;
1483 return *this;
1484 }
1485
1486 template<
1487 typename T,
1488 typename std::enable_if<std::is_same<T, CameraState::Network::LocalInterface::IPV4>::value, int>::
1489 type = 0>
1491 {
1492 return m_ipv4;
1493 }
1494
1495 template<
1496 typename T,
1497 typename std::enable_if<
1498 std::is_same<T, CameraState::Network::LocalInterface::IPV4::Subnets>::value,
1499 int>::type = 0>
1501 {
1503 }
1504
1505 template<
1506 typename T,
1507 typename std::enable_if<
1508 std::is_same<T, CameraState::Network::LocalInterface::InterfaceName>::value,
1509 int>::type = 0>
1511 {
1512 return m_interfaceName;
1513 }
1514
1515 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1517 {
1518 return m_ipv4;
1519 }
1520
1521 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1523 {
1524 return m_interfaceName;
1525 }
1526
1528 template<typename F>
1529 void forEach(const F &f) const
1530 {
1531 f(m_ipv4);
1532 f(m_interfaceName);
1533 }
1534
1536 template<typename F>
1537 void forEach(const F &f)
1538 {
1539 f(m_ipv4);
1540 f(m_interfaceName);
1541 }
1542
1544 bool operator==(const LocalInterface &other) const;
1545
1547 bool operator!=(const LocalInterface &other) const;
1548
1550 std::string toString() const;
1551
1553 friend std::ostream &operator<<(std::ostream &stream, const LocalInterface &value)
1554 {
1555 return stream << value.toString();
1556 }
1557
1558 private:
1559 void setFromString(const std::string &value);
1560
1561 void setFromString(const std::string &fullPath, const std::string &value);
1562
1563 std::string getString(const std::string &fullPath) const;
1564
1565 IPV4 m_ipv4;
1566 InterfaceName m_interfaceName;
1567
1568 friend struct DataModel::Detail::Befriend<LocalInterface>;
1569 };
1570
1572
1573 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1575 {
1576 public:
1578 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
1579
1581 static constexpr const char *path{ "Network/IPV4" };
1582
1584 static constexpr const char *name{ "IPV4" };
1585
1587 static constexpr const char *description{ R"description(Current IPv4 protocol state)description" };
1588
1590
1591 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1593 {
1594 public:
1596 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1597
1599 static constexpr const char *path{ "Network/IPV4/Address" };
1600
1602 static constexpr const char *name{ "Address" };
1603
1605 static constexpr const char *description{ R"description(Current IPv4 address)description" };
1606
1608 using ValueType = std::string;
1609
1612 {
1613 return { 0, std::numeric_limits<ValueType::size_type>::max() };
1614 }
1615
1617 Address() = default;
1618
1620 explicit Address(std::string value)
1621 : m_value{ std::move(value) }
1622 {}
1623
1625 const std::string &value() const;
1626
1628 std::string toString() const;
1629
1631 bool operator==(const Address &other) const
1632 {
1633 return m_value == other.m_value;
1634 }
1635
1637 bool operator!=(const Address &other) const
1638 {
1639 return m_value != other.m_value;
1640 }
1641
1643 bool operator<(const Address &other) const
1644 {
1645 return m_value < other.m_value;
1646 }
1647
1649 bool operator>(const Address &other) const
1650 {
1651 return m_value > other.m_value;
1652 }
1653
1655 bool operator<=(const Address &other) const
1656 {
1657 return m_value <= other.m_value;
1658 }
1659
1661 bool operator>=(const Address &other) const
1662 {
1663 return m_value >= other.m_value;
1664 }
1665
1667 friend std::ostream &operator<<(std::ostream &stream, const Address &value)
1668 {
1669 return stream << value.toString();
1670 }
1671
1672 private:
1673 void setFromString(const std::string &value);
1674
1675 std::string m_value{};
1676
1677 friend struct DataModel::Detail::Befriend<Address>;
1678 };
1679
1680 using Descendants = std::tuple<CameraState::Network::IPV4::Address>;
1681
1684
1696#ifndef NO_DOC
1697 template<
1698 typename... Args,
1699 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1700 typename std::enable_if<
1701 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
1702 value,
1703 int>::type = 0>
1704#else
1705 template<typename... Args>
1706#endif
1707 explicit IPV4(Args &&...args)
1708 {
1709 using namespace Zivid::Detail::TypeTraits;
1710
1711 static_assert(
1712 AllArgsDecayedAreUnique<Args...>::value,
1713 "Found duplicate types among the arguments passed to IPV4(...). "
1714 "Types should be listed at most once.");
1715
1716 set(std::forward<Args>(args)...);
1717 }
1718
1729#ifndef NO_DOC
1730 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1731#else
1732 template<typename... Args>
1733#endif
1734 void set(Args &&...args)
1735 {
1736 using namespace Zivid::Detail::TypeTraits;
1737
1738 using AllArgsAreDescendantNodes =
1739 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1740 static_assert(
1741 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1742
1743 static_assert(
1744 AllArgsDecayedAreUnique<Args...>::value,
1745 "Found duplicate types among the arguments passed to set(...). "
1746 "Types should be listed at most once.");
1747
1748 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1749 }
1750
1762#ifndef NO_DOC
1763 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1764#else
1765 template<typename... Args>
1766#endif
1767 IPV4 copyWith(Args &&...args) const
1768 {
1769 using namespace Zivid::Detail::TypeTraits;
1770
1771 using AllArgsAreDescendantNodes =
1772 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1773 static_assert(
1774 AllArgsAreDescendantNodes::value,
1775 "All arguments passed to copyWith(...) must be descendant nodes.");
1776
1777 static_assert(
1778 AllArgsDecayedAreUnique<Args...>::value,
1779 "Found duplicate types among the arguments passed to copyWith(...). "
1780 "Types should be listed at most once.");
1781
1782 auto copy{ *this };
1783 copy.set(std::forward<Args>(args)...);
1784 return copy;
1785 }
1786
1788 const Address &address() const
1789 {
1790 return m_address;
1791 }
1792
1795 {
1796 return m_address;
1797 }
1798
1800 IPV4 &set(const Address &value)
1801 {
1802 m_address = value;
1803 return *this;
1804 }
1805
1806 template<
1807 typename T,
1808 typename std::enable_if<std::is_same<T, CameraState::Network::IPV4::Address>::value, int>::type = 0>
1810 {
1811 return m_address;
1812 }
1813
1814 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1816 {
1817 return m_address;
1818 }
1819
1821 template<typename F>
1822 void forEach(const F &f) const
1823 {
1824 f(m_address);
1825 }
1826
1828 template<typename F>
1829 void forEach(const F &f)
1830 {
1831 f(m_address);
1832 }
1833
1835 bool operator==(const IPV4 &other) const;
1836
1838 bool operator!=(const IPV4 &other) const;
1839
1841 std::string toString() const;
1842
1844 friend std::ostream &operator<<(std::ostream &stream, const IPV4 &value)
1845 {
1846 return stream << value.toString();
1847 }
1848
1849 private:
1850 void setFromString(const std::string &value);
1851
1852 void setFromString(const std::string &fullPath, const std::string &value);
1853
1854 std::string getString(const std::string &fullPath) const;
1855
1856 Address m_address;
1857
1858 friend struct DataModel::Detail::Befriend<IPV4>;
1859 };
1860
1868
1869 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1871 {
1872 public:
1874 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafDataModelList;
1875
1877 static constexpr const char *path{ "Network/LocalInterfaces" };
1878
1880 static constexpr const char *name{ "LocalInterfaces" };
1881
1883 static constexpr const char *description{
1884 R"description(List of the computer's local network interfaces that discovered the camera. In the most common scenario
1885with the camera connected to the computer with an Ethernet cable, this list will contain only the
1886network interface for that Ethernet port. In more complex network scenarios it can be the case that the
1887camera is discovered by multiple interfaces, and in that case this list will contain multiple network
1888interfaces. However, when `CameraState::Status` is `connected`, only the one network interface that has
1889the active TCP/IP connection to the camera will be listed.
1890)description"
1891 };
1892
1894 using ValueType = std::vector<CameraState::Network::LocalInterface>;
1895
1898 {
1899 return { 0, std::numeric_limits<ValueType::size_type>::max() };
1900 }
1901
1903 LocalInterfaces() = default;
1904
1906 explicit LocalInterfaces(std::vector<CameraState::Network::LocalInterface> value)
1907 : m_value{ std::move(value) }
1908 {}
1909
1911 explicit LocalInterfaces(std::initializer_list<CameraState::Network::LocalInterface> value)
1912 : LocalInterfaces{ ValueType{ value } }
1913 {}
1914
1916 const std::vector<CameraState::Network::LocalInterface> &value() const;
1917
1919 std::string toString() const;
1920
1922 std::size_t size() const noexcept;
1923
1925 bool isEmpty() const noexcept;
1926
1932 template<typename... Args>
1933 void emplaceBack(Args &&...args)
1934 {
1935 m_value.emplace_back(std::forward<Args>(args)...);
1936 }
1937
1944
1950 const CameraState::Network::LocalInterface &at(std::size_t pos) const;
1951
1958
1965
1967 template<typename F>
1968 void forEach(const F &f)
1969 {
1970 for(auto &child : m_value)
1971 {
1972 f(child);
1973 }
1974 }
1975
1977 template<typename F>
1978 void forEach(const F &f) const
1979 {
1980 for(const auto &child : m_value)
1981 {
1982 f(child);
1983 }
1984 }
1985
1987 using Iterator = std::vector<CameraState::Network::LocalInterface>::iterator;
1988
1990 Iterator begin() noexcept;
1991
1993 Iterator end() noexcept;
1994
1996 using ConstIterator = std::vector<CameraState::Network::LocalInterface>::const_iterator;
1997
1999 ConstIterator begin() const noexcept;
2000
2002 ConstIterator end() const noexcept;
2003
2005 ConstIterator cbegin() const noexcept;
2006
2008 ConstIterator cend() const noexcept;
2009
2011 bool operator==(const LocalInterfaces &other) const
2012 {
2013 return m_value == other.m_value;
2014 }
2015
2017 bool operator!=(const LocalInterfaces &other) const
2018 {
2019 return m_value != other.m_value;
2020 }
2021
2023 friend std::ostream &operator<<(std::ostream &stream, const LocalInterfaces &value)
2024 {
2025 return stream << value.toString();
2026 }
2027
2028 private:
2029 void setFromString(const std::string &value);
2030
2031 std::vector<CameraState::Network::LocalInterface> m_value{};
2032
2033 friend struct DataModel::Detail::Befriend<LocalInterfaces>;
2034 };
2035
2036 using Descendants = std::tuple<
2040
2043
2057#ifndef NO_DOC
2058 template<
2059 typename... Args,
2060 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
2061 typename std::enable_if<
2062 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
2063 value,
2064 int>::type = 0>
2065#else
2066 template<typename... Args>
2067#endif
2068 explicit Network(Args &&...args)
2069 {
2070 using namespace Zivid::Detail::TypeTraits;
2071
2072 static_assert(
2073 AllArgsDecayedAreUnique<Args...>::value,
2074 "Found duplicate types among the arguments passed to Network(...). "
2075 "Types should be listed at most once.");
2076
2077 set(std::forward<Args>(args)...);
2078 }
2079
2092#ifndef NO_DOC
2093 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
2094#else
2095 template<typename... Args>
2096#endif
2097 void set(Args &&...args)
2098 {
2099 using namespace Zivid::Detail::TypeTraits;
2100
2101 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2102 static_assert(
2103 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
2104
2105 static_assert(
2106 AllArgsDecayedAreUnique<Args...>::value,
2107 "Found duplicate types among the arguments passed to set(...). "
2108 "Types should be listed at most once.");
2109
2110 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
2111 }
2112
2126#ifndef NO_DOC
2127 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
2128#else
2129 template<typename... Args>
2130#endif
2131 Network copyWith(Args &&...args) const
2132 {
2133 using namespace Zivid::Detail::TypeTraits;
2134
2135 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2136 static_assert(
2137 AllArgsAreDescendantNodes::value,
2138 "All arguments passed to copyWith(...) must be descendant nodes.");
2139
2140 static_assert(
2141 AllArgsDecayedAreUnique<Args...>::value,
2142 "Found duplicate types among the arguments passed to copyWith(...). "
2143 "Types should be listed at most once.");
2144
2145 auto copy{ *this };
2146 copy.set(std::forward<Args>(args)...);
2147 return copy;
2148 }
2149
2151 const IPV4 &ipv4() const
2152 {
2153 return m_ipv4;
2154 }
2155
2158 {
2159 return m_ipv4;
2160 }
2161
2163 Network &set(const IPV4 &value)
2164 {
2165 m_ipv4 = value;
2166 return *this;
2167 }
2168
2171 {
2172 m_ipv4.set(value);
2173 return *this;
2174 }
2175
2178 {
2179 return m_localInterfaces;
2180 }
2181
2184 {
2185 return m_localInterfaces;
2186 }
2187
2190 {
2191 m_localInterfaces = value;
2192 return *this;
2193 }
2194
2195 template<
2196 typename T,
2197 typename std::enable_if<std::is_same<T, CameraState::Network::IPV4>::value, int>::type = 0>
2199 {
2200 return m_ipv4;
2201 }
2202
2203 template<
2204 typename T,
2205 typename std::enable_if<std::is_same<T, CameraState::Network::IPV4::Address>::value, int>::type = 0>
2207 {
2208 return m_ipv4.get<CameraState::Network::IPV4::Address>();
2209 }
2210
2211 template<
2212 typename T,
2213 typename std::enable_if<std::is_same<T, CameraState::Network::LocalInterfaces>::value, int>::type = 0>
2215 {
2216 return m_localInterfaces;
2217 }
2218
2219 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2221 {
2222 return m_ipv4;
2223 }
2224
2225 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
2227 {
2228 return m_localInterfaces;
2229 }
2230
2232 template<typename F>
2233 void forEach(const F &f) const
2234 {
2235 f(m_ipv4);
2236 f(m_localInterfaces);
2237 }
2238
2240 template<typename F>
2241 void forEach(const F &f)
2242 {
2243 f(m_ipv4);
2244 f(m_localInterfaces);
2245 }
2246
2248 bool operator==(const Network &other) const;
2249
2251 bool operator!=(const Network &other) const;
2252
2254 std::string toString() const;
2255
2257 friend std::ostream &operator<<(std::ostream &stream, const Network &value)
2258 {
2259 return stream << value.toString();
2260 }
2261
2262 private:
2263 void setFromString(const std::string &value);
2264
2265 void setFromString(const std::string &fullPath, const std::string &value);
2266
2267 std::string getString(const std::string &fullPath) const;
2268
2269 IPV4 m_ipv4;
2270 LocalInterfaces m_localInterfaces;
2271
2272 friend struct DataModel::Detail::Befriend<Network>;
2273 };
2274
2309
2310 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
2312 {
2313 public:
2315 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
2316
2318 static constexpr const char *path{ "Status" };
2319
2321 static constexpr const char *name{ "Status" };
2322
2324 static constexpr const char *description{
2325 R"description(This enum describes the current status of this camera. The enum can have the following values:
2326
2327* `inaccessible`: The camera was discovered, but the SDK is not able to connect to this camera. This can
2328 be because the IP settings of the camera and the PC are not compatible, or because there are several
2329 cameras with the same IP connected to your PC. The `InaccessibleReason` enum will give you more
2330 details about why this camera is not accessible. The network configuration of the camera can be changed
2331 using the ZividNetworkCameraConfigurator CLI tool. See the knowledge base for more information.
2332
2333* `busy`: The camera is currently in use by another process. This can be a different process on the same
2334 PC, or on a different PC if the camera is shared on a network.
2335
2336* `applyingNetworkConfiguration`: The camera network configuration is being changed by the current process.
2337
2338* `firmwareUpdateRequired`: The camera is accessible, but requires a firmware update before you can connect
2339 to it.
2340
2341* `updatingFirmware`: The camera firmware is currently being updated in the current process.
2342
2343* `available`: The camera is available for use by the current process. This means that you can invoke
2344 camera.connect() on this camera.
2345
2346* `connecting`: The camera is currently connecting in the current process.
2347
2348* `connected`: The camera is connected in the current process. This means camera.connect() has successfully
2349 completed and you can capture using this camera.
2350
2351* `disconnecting`: The camera is currently disconnecting in the current process. When disconnection has
2352 completed, the camera will normally go back to the `available` state.
2353
2354* `disappeared`: The camera was found earlier, but it can no longer be found. The connection between the
2355 PC and the camera may be disrupted, or the camera may have lost power. When in `disappeared` state, the
2356 camera will not be returned from `Application::cameras()`. The camera will go back to one of the other
2357 states if the camera is later found again.
2358)description"
2359 };
2360
2362 enum class ValueType
2363 {
2364 inaccessible,
2365 busy,
2366 applyingNetworkConfiguration,
2367 firmwareUpdateRequired,
2368 updatingFirmware,
2369 available,
2370 connecting,
2371 connected,
2372 disconnecting,
2373 disappeared
2374 };
2375 static const Status inaccessible;
2376 static const Status busy;
2380 static const Status available;
2381 static const Status connecting;
2382 static const Status connected;
2383 static const Status disconnecting;
2384 static const Status disappeared;
2385
2387 static std::set<ValueType> validValues()
2388 {
2389 return { ValueType::inaccessible,
2390 ValueType::busy,
2391 ValueType::applyingNetworkConfiguration,
2392 ValueType::firmwareUpdateRequired,
2393 ValueType::updatingFirmware,
2394 ValueType::available,
2395 ValueType::connecting,
2396 ValueType::connected,
2397 ValueType::disconnecting,
2398 ValueType::disappeared };
2399 }
2400
2402 Status() = default;
2403
2405 explicit constexpr Status(ValueType value)
2406 : m_value{ verifyValue(value) }
2407 {}
2408
2411
2413 std::string toString() const;
2414
2416 friend std::ostream &operator<<(std::ostream &stream, const Status::ValueType &value)
2417 {
2418 return stream << Status{ value }.toString();
2419 }
2420
2422 bool operator==(const Status &other) const
2423 {
2424 return m_value == other.m_value;
2425 }
2426
2428 bool operator!=(const Status &other) const
2429 {
2430 return m_value != other.m_value;
2431 }
2432
2434 friend std::ostream &operator<<(std::ostream &stream, const Status &value)
2435 {
2436 return stream << value.toString();
2437 }
2438
2439 private:
2440 void setFromString(const std::string &value);
2441
2442 constexpr ValueType static verifyValue(const ValueType &value)
2443 {
2444 return value == ValueType::inaccessible || value == ValueType::busy
2445 || value == ValueType::applyingNetworkConfiguration
2446 || value == ValueType::firmwareUpdateRequired || value == ValueType::updatingFirmware
2447 || value == ValueType::available || value == ValueType::connecting
2448 || value == ValueType::connected || value == ValueType::disconnecting
2449 || value == ValueType::disappeared
2450 ? value
2451 : throw std::invalid_argument{
2452 "Invalid value: Status{ "
2453 + std::to_string(static_cast<std::underlying_type<ValueType>::type>(value)) + " }"
2454 };
2455 }
2456
2457 ValueType m_value{ ValueType::inaccessible };
2458
2459 friend struct DataModel::Detail::Befriend<Status>;
2460 };
2461
2463
2464 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
2466 {
2467 public:
2469 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
2470
2472 static constexpr const char *path{ "Temperature" };
2473
2475 static constexpr const char *name{ "Temperature" };
2476
2478 static constexpr const char *description{ R"description(Current temperature(s))description" };
2479
2481
2482 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
2484 {
2485 public:
2487 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
2488
2490 static constexpr const char *path{ "Temperature/DMD" };
2491
2493 static constexpr const char *name{ "DMD" };
2494
2496 static constexpr const char *description{ R"description(DMD temperature)description" };
2497
2499 using ValueType = double;
2500
2502 static constexpr Range<double> validRange()
2503 {
2504 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
2505 }
2506
2508 DMD() = default;
2509
2511 explicit constexpr DMD(double value)
2512 : m_value{ value }
2513 {}
2514
2516 double value() const;
2517
2519 std::string toString() const;
2520
2522 bool operator==(const DMD &other) const
2523 {
2524 return m_value == other.m_value;
2525 }
2526
2528 bool operator!=(const DMD &other) const
2529 {
2530 return m_value != other.m_value;
2531 }
2532
2534 bool operator<(const DMD &other) const
2535 {
2536 return m_value < other.m_value;
2537 }
2538
2540 bool operator>(const DMD &other) const
2541 {
2542 return m_value > other.m_value;
2543 }
2544
2546 bool operator<=(const DMD &other) const
2547 {
2548 return m_value <= other.m_value;
2549 }
2550
2552 bool operator>=(const DMD &other) const
2553 {
2554 return m_value >= other.m_value;
2555 }
2556
2558 friend std::ostream &operator<<(std::ostream &stream, const DMD &value)
2559 {
2560 return stream << value.toString();
2561 }
2562
2563 private:
2564 void setFromString(const std::string &value);
2565
2566 double m_value{ 0.0 };
2567
2568 friend struct DataModel::Detail::Befriend<DMD>;
2569 };
2570
2572
2573 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
2575 {
2576 public:
2578 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
2579
2581 static constexpr const char *path{ "Temperature/General" };
2582
2584 static constexpr const char *name{ "General" };
2585
2587 static constexpr const char *description{ R"description(General temperature)description" };
2588
2590 using ValueType = double;
2591
2593 static constexpr Range<double> validRange()
2594 {
2595 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
2596 }
2597
2599 General() = default;
2600
2602 explicit constexpr General(double value)
2603 : m_value{ value }
2604 {}
2605
2607 double value() const;
2608
2610 std::string toString() const;
2611
2613 bool operator==(const General &other) const
2614 {
2615 return m_value == other.m_value;
2616 }
2617
2619 bool operator!=(const General &other) const
2620 {
2621 return m_value != other.m_value;
2622 }
2623
2625 bool operator<(const General &other) const
2626 {
2627 return m_value < other.m_value;
2628 }
2629
2631 bool operator>(const General &other) const
2632 {
2633 return m_value > other.m_value;
2634 }
2635
2637 bool operator<=(const General &other) const
2638 {
2639 return m_value <= other.m_value;
2640 }
2641
2643 bool operator>=(const General &other) const
2644 {
2645 return m_value >= other.m_value;
2646 }
2647
2649 friend std::ostream &operator<<(std::ostream &stream, const General &value)
2650 {
2651 return stream << value.toString();
2652 }
2653
2654 private:
2655 void setFromString(const std::string &value);
2656
2657 double m_value{ 0.0 };
2658
2659 friend struct DataModel::Detail::Befriend<General>;
2660 };
2661
2663
2664 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
2666 {
2667 public:
2669 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
2670
2672 static constexpr const char *path{ "Temperature/LED" };
2673
2675 static constexpr const char *name{ "LED" };
2676
2678 static constexpr const char *description{ R"description(LED temperature)description" };
2679
2681 using ValueType = double;
2682
2684 static constexpr Range<double> validRange()
2685 {
2686 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
2687 }
2688
2690 LED() = default;
2691
2693 explicit constexpr LED(double value)
2694 : m_value{ value }
2695 {}
2696
2698 double value() const;
2699
2701 std::string toString() const;
2702
2704 bool operator==(const LED &other) const
2705 {
2706 return m_value == other.m_value;
2707 }
2708
2710 bool operator!=(const LED &other) const
2711 {
2712 return m_value != other.m_value;
2713 }
2714
2716 bool operator<(const LED &other) const
2717 {
2718 return m_value < other.m_value;
2719 }
2720
2722 bool operator>(const LED &other) const
2723 {
2724 return m_value > other.m_value;
2725 }
2726
2728 bool operator<=(const LED &other) const
2729 {
2730 return m_value <= other.m_value;
2731 }
2732
2734 bool operator>=(const LED &other) const
2735 {
2736 return m_value >= other.m_value;
2737 }
2738
2740 friend std::ostream &operator<<(std::ostream &stream, const LED &value)
2741 {
2742 return stream << value.toString();
2743 }
2744
2745 private:
2746 void setFromString(const std::string &value);
2747
2748 double m_value{ 0.0 };
2749
2750 friend struct DataModel::Detail::Befriend<LED>;
2751 };
2752
2754
2755 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
2757 {
2758 public:
2760 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
2761
2763 static constexpr const char *path{ "Temperature/Lens" };
2764
2766 static constexpr const char *name{ "Lens" };
2767
2769 static constexpr const char *description{ R"description(Lens temperature)description" };
2770
2772 using ValueType = double;
2773
2775 static constexpr Range<double> validRange()
2776 {
2777 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
2778 }
2779
2781 Lens() = default;
2782
2784 explicit constexpr Lens(double value)
2785 : m_value{ value }
2786 {}
2787
2789 double value() const;
2790
2792 std::string toString() const;
2793
2795 bool operator==(const Lens &other) const
2796 {
2797 return m_value == other.m_value;
2798 }
2799
2801 bool operator!=(const Lens &other) const
2802 {
2803 return m_value != other.m_value;
2804 }
2805
2807 bool operator<(const Lens &other) const
2808 {
2809 return m_value < other.m_value;
2810 }
2811
2813 bool operator>(const Lens &other) const
2814 {
2815 return m_value > other.m_value;
2816 }
2817
2819 bool operator<=(const Lens &other) const
2820 {
2821 return m_value <= other.m_value;
2822 }
2823
2825 bool operator>=(const Lens &other) const
2826 {
2827 return m_value >= other.m_value;
2828 }
2829
2831 friend std::ostream &operator<<(std::ostream &stream, const Lens &value)
2832 {
2833 return stream << value.toString();
2834 }
2835
2836 private:
2837 void setFromString(const std::string &value);
2838
2839 double m_value{ 0.0 };
2840
2841 friend struct DataModel::Detail::Befriend<Lens>;
2842 };
2843
2845
2846 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
2848 {
2849 public:
2851 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
2852
2854 static constexpr const char *path{ "Temperature/PCB" };
2855
2857 static constexpr const char *name{ "PCB" };
2858
2860 static constexpr const char *description{ R"description(PCB temperature)description" };
2861
2863 using ValueType = double;
2864
2866 static constexpr Range<double> validRange()
2867 {
2868 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
2869 }
2870
2872 PCB() = default;
2873
2875 explicit constexpr PCB(double value)
2876 : m_value{ value }
2877 {}
2878
2880 double value() const;
2881
2883 std::string toString() const;
2884
2886 bool operator==(const PCB &other) const
2887 {
2888 return m_value == other.m_value;
2889 }
2890
2892 bool operator!=(const PCB &other) const
2893 {
2894 return m_value != other.m_value;
2895 }
2896
2898 bool operator<(const PCB &other) const
2899 {
2900 return m_value < other.m_value;
2901 }
2902
2904 bool operator>(const PCB &other) const
2905 {
2906 return m_value > other.m_value;
2907 }
2908
2910 bool operator<=(const PCB &other) const
2911 {
2912 return m_value <= other.m_value;
2913 }
2914
2916 bool operator>=(const PCB &other) const
2917 {
2918 return m_value >= other.m_value;
2919 }
2920
2922 friend std::ostream &operator<<(std::ostream &stream, const PCB &value)
2923 {
2924 return stream << value.toString();
2925 }
2926
2927 private:
2928 void setFromString(const std::string &value);
2929
2930 double m_value{ 0.0 };
2931
2932 friend struct DataModel::Detail::Befriend<PCB>;
2933 };
2934
2935 using Descendants = std::tuple<
2941
2944
2960#ifndef NO_DOC
2961 template<
2962 typename... Args,
2963 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
2964 typename std::enable_if<
2965 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
2966 value,
2967 int>::type = 0>
2968#else
2969 template<typename... Args>
2970#endif
2971 explicit Temperature(Args &&...args)
2972 {
2973 using namespace Zivid::Detail::TypeTraits;
2974
2975 static_assert(
2976 AllArgsDecayedAreUnique<Args...>::value,
2977 "Found duplicate types among the arguments passed to Temperature(...). "
2978 "Types should be listed at most once.");
2979
2980 set(std::forward<Args>(args)...);
2981 }
2982
2997#ifndef NO_DOC
2998 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
2999#else
3000 template<typename... Args>
3001#endif
3002 void set(Args &&...args)
3003 {
3004 using namespace Zivid::Detail::TypeTraits;
3005
3006 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
3007 static_assert(
3008 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
3009
3010 static_assert(
3011 AllArgsDecayedAreUnique<Args...>::value,
3012 "Found duplicate types among the arguments passed to set(...). "
3013 "Types should be listed at most once.");
3014
3015 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
3016 }
3017
3033#ifndef NO_DOC
3034 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
3035#else
3036 template<typename... Args>
3037#endif
3038 Temperature copyWith(Args &&...args) const
3039 {
3040 using namespace Zivid::Detail::TypeTraits;
3041
3042 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
3043 static_assert(
3044 AllArgsAreDescendantNodes::value,
3045 "All arguments passed to copyWith(...) must be descendant nodes.");
3046
3047 static_assert(
3048 AllArgsDecayedAreUnique<Args...>::value,
3049 "Found duplicate types among the arguments passed to copyWith(...). "
3050 "Types should be listed at most once.");
3051
3052 auto copy{ *this };
3053 copy.set(std::forward<Args>(args)...);
3054 return copy;
3055 }
3056
3058 const DMD &dmd() const
3059 {
3060 return m_dmd;
3061 }
3062
3065 {
3066 return m_dmd;
3067 }
3068
3070 Temperature &set(const DMD &value)
3071 {
3072 m_dmd = value;
3073 return *this;
3074 }
3075
3077 const General &general() const
3078 {
3079 return m_general;
3080 }
3081
3084 {
3085 return m_general;
3086 }
3087
3089 Temperature &set(const General &value)
3090 {
3091 m_general = value;
3092 return *this;
3093 }
3094
3096 const LED &led() const
3097 {
3098 return m_led;
3099 }
3100
3103 {
3104 return m_led;
3105 }
3106
3108 Temperature &set(const LED &value)
3109 {
3110 m_led = value;
3111 return *this;
3112 }
3113
3115 const Lens &lens() const
3116 {
3117 return m_lens;
3118 }
3119
3122 {
3123 return m_lens;
3124 }
3125
3127 Temperature &set(const Lens &value)
3128 {
3129 m_lens = value;
3130 return *this;
3131 }
3132
3134 const PCB &pcb() const
3135 {
3136 return m_pcb;
3137 }
3138
3141 {
3142 return m_pcb;
3143 }
3144
3146 Temperature &set(const PCB &value)
3147 {
3148 m_pcb = value;
3149 return *this;
3150 }
3151
3152 template<
3153 typename T,
3154 typename std::enable_if<std::is_same<T, CameraState::Temperature::DMD>::value, int>::type = 0>
3156 {
3157 return m_dmd;
3158 }
3159
3160 template<
3161 typename T,
3162 typename std::enable_if<std::is_same<T, CameraState::Temperature::General>::value, int>::type = 0>
3164 {
3165 return m_general;
3166 }
3167
3168 template<
3169 typename T,
3170 typename std::enable_if<std::is_same<T, CameraState::Temperature::LED>::value, int>::type = 0>
3172 {
3173 return m_led;
3174 }
3175
3176 template<
3177 typename T,
3178 typename std::enable_if<std::is_same<T, CameraState::Temperature::Lens>::value, int>::type = 0>
3180 {
3181 return m_lens;
3182 }
3183
3184 template<
3185 typename T,
3186 typename std::enable_if<std::is_same<T, CameraState::Temperature::PCB>::value, int>::type = 0>
3188 {
3189 return m_pcb;
3190 }
3191
3192 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
3194 {
3195 return m_dmd;
3196 }
3197
3198 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
3200 {
3201 return m_general;
3202 }
3203
3204 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
3206 {
3207 return m_led;
3208 }
3209
3210 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
3212 {
3213 return m_lens;
3214 }
3215
3216 template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
3218 {
3219 return m_pcb;
3220 }
3221
3223 template<typename F>
3224 void forEach(const F &f) const
3225 {
3226 f(m_dmd);
3227 f(m_general);
3228 f(m_led);
3229 f(m_lens);
3230 f(m_pcb);
3231 }
3232
3234 template<typename F>
3235 void forEach(const F &f)
3236 {
3237 f(m_dmd);
3238 f(m_general);
3239 f(m_led);
3240 f(m_lens);
3241 f(m_pcb);
3242 }
3243
3245 bool operator==(const Temperature &other) const;
3246
3248 bool operator!=(const Temperature &other) const;
3249
3251 std::string toString() const;
3252
3254 friend std::ostream &operator<<(std::ostream &stream, const Temperature &value)
3255 {
3256 return stream << value.toString();
3257 }
3258
3259 private:
3260 void setFromString(const std::string &value);
3261
3262 void setFromString(const std::string &fullPath, const std::string &value);
3263
3264 std::string getString(const std::string &fullPath) const;
3265
3266 DMD m_dmd;
3267 General m_general;
3268 LED m_led;
3269 Lens m_lens;
3270 PCB m_pcb;
3271
3272 friend struct DataModel::Detail::Befriend<Temperature>;
3273 };
3274
3275 using Descendants = std::tuple<
3290
3293
3295 explicit CameraState(const std::string &fileName);
3296
3302 [[nodiscard]] static CameraState fromSerialized(const std::string &value);
3303
3309 std::string serialize() const;
3310
3335#ifndef NO_DOC
3336 template<
3337 typename... Args,
3338 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
3339 typename std::enable_if<
3340 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
3341 int>::type = 0>
3342#else
3343 template<typename... Args>
3344#endif
3345 explicit CameraState(Args &&...args)
3346 {
3347 using namespace Zivid::Detail::TypeTraits;
3348
3349 static_assert(
3350 AllArgsDecayedAreUnique<Args...>::value,
3351 "Found duplicate types among the arguments passed to CameraState(...). "
3352 "Types should be listed at most once.");
3353
3354 set(std::forward<Args>(args)...);
3355 }
3356
3380#ifndef NO_DOC
3381 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
3382#else
3383 template<typename... Args>
3384#endif
3385 void set(Args &&...args)
3386 {
3387 using namespace Zivid::Detail::TypeTraits;
3388
3389 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
3390 static_assert(
3391 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
3392
3393 static_assert(
3394 AllArgsDecayedAreUnique<Args...>::value,
3395 "Found duplicate types among the arguments passed to set(...). "
3396 "Types should be listed at most once.");
3397
3398 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
3399 }
3400
3425#ifndef NO_DOC
3426 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
3427#else
3428 template<typename... Args>
3429#endif
3430 CameraState copyWith(Args &&...args) const
3431 {
3432 using namespace Zivid::Detail::TypeTraits;
3433
3434 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
3435 static_assert(
3436 AllArgsAreDescendantNodes::value, "All arguments passed to copyWith(...) must be descendant nodes.");
3437
3438 static_assert(
3439 AllArgsDecayedAreUnique<Args...>::value,
3440 "Found duplicate types among the arguments passed to copyWith(...). "
3441 "Types should be listed at most once.");
3442
3443 auto copy{ *this };
3444 copy.set(std::forward<Args>(args)...);
3445 return copy;
3446 }
3447
3449 const Available &isAvailable() const
3450 {
3451 return m_available;
3452 }
3453
3456 {
3457 return m_available;
3458 }
3459
3462 {
3463 m_available = value;
3464 return *this;
3465 }
3466
3468 const Connected &isConnected() const
3469 {
3470 return m_connected;
3471 }
3472
3475 {
3476 return m_connected;
3477 }
3478
3481 {
3482 m_connected = value;
3483 return *this;
3484 }
3485
3488 {
3489 return m_inaccessibleReason;
3490 }
3491
3494 {
3495 return m_inaccessibleReason;
3496 }
3497
3500 {
3501 m_inaccessibleReason = value;
3502 return *this;
3503 }
3504
3506 const Network &network() const
3507 {
3508 return m_network;
3509 }
3510
3513 {
3514 return m_network;
3515 }
3516
3518 CameraState &set(const Network &value)
3519 {
3520 m_network = value;
3521 return *this;
3522 }
3523
3526 {
3527 m_network.set(value);
3528 return *this;
3529 }
3530
3533 {
3534 m_network.set(value);
3535 return *this;
3536 }
3537
3540 {
3541 m_network.set(value);
3542 return *this;
3543 }
3544
3546 const Status &status() const
3547 {
3548 return m_status;
3549 }
3550
3553 {
3554 return m_status;
3555 }
3556
3558 CameraState &set(const Status &value)
3559 {
3560 m_status = value;
3561 return *this;
3562 }
3563
3566 {
3567 return m_temperature;
3568 }
3569
3572 {
3573 return m_temperature;
3574 }
3575
3578 {
3579 m_temperature = value;
3580 return *this;
3581 }
3582
3585 {
3586 m_temperature.set(value);
3587 return *this;
3588 }
3589
3592 {
3593 m_temperature.set(value);
3594 return *this;
3595 }
3596
3599 {
3600 m_temperature.set(value);
3601 return *this;
3602 }
3603
3606 {
3607 m_temperature.set(value);
3608 return *this;
3609 }
3610
3613 {
3614 m_temperature.set(value);
3615 return *this;
3616 }
3617
3618 template<typename T, typename std::enable_if<std::is_same<T, CameraState::Available>::value, int>::type = 0>
3620 {
3621 return m_available;
3622 }
3623
3624 template<typename T, typename std::enable_if<std::is_same<T, CameraState::Connected>::value, int>::type = 0>
3626 {
3627 return m_connected;
3628 }
3629
3630 template<
3631 typename T,
3632 typename std::enable_if<std::is_same<T, CameraState::InaccessibleReason>::value, int>::type = 0>
3634 {
3635 return m_inaccessibleReason;
3636 }
3637
3638 template<typename T, typename std::enable_if<std::is_same<T, CameraState::Network>::value, int>::type = 0>
3640 {
3641 return m_network;
3642 }
3643
3644 template<typename T, typename std::enable_if<std::is_same<T, CameraState::Network::IPV4>::value, int>::type = 0>
3646 {
3647 return m_network.get<CameraState::Network::IPV4>();
3648 }
3649
3650 template<
3651 typename T,
3652 typename std::enable_if<std::is_same<T, CameraState::Network::IPV4::Address>::value, int>::type = 0>
3654 {
3655 return m_network.get<CameraState::Network::IPV4::Address>();
3656 }
3657
3658 template<
3659 typename T,
3660 typename std::enable_if<std::is_same<T, CameraState::Network::LocalInterfaces>::value, int>::type = 0>
3662 {
3663 return m_network.get<CameraState::Network::LocalInterfaces>();
3664 }
3665
3666 template<typename T, typename std::enable_if<std::is_same<T, CameraState::Status>::value, int>::type = 0>
3668 {
3669 return m_status;
3670 }
3671
3672 template<typename T, typename std::enable_if<std::is_same<T, CameraState::Temperature>::value, int>::type = 0>
3674 {
3675 return m_temperature;
3676 }
3677
3678 template<
3679 typename T,
3680 typename std::enable_if<std::is_same<T, CameraState::Temperature::DMD>::value, int>::type = 0>
3682 {
3683 return m_temperature.get<CameraState::Temperature::DMD>();
3684 }
3685
3686 template<
3687 typename T,
3688 typename std::enable_if<std::is_same<T, CameraState::Temperature::General>::value, int>::type = 0>
3690 {
3691 return m_temperature.get<CameraState::Temperature::General>();
3692 }
3693
3694 template<
3695 typename T,
3696 typename std::enable_if<std::is_same<T, CameraState::Temperature::LED>::value, int>::type = 0>
3698 {
3699 return m_temperature.get<CameraState::Temperature::LED>();
3700 }
3701
3702 template<
3703 typename T,
3704 typename std::enable_if<std::is_same<T, CameraState::Temperature::Lens>::value, int>::type = 0>
3706 {
3707 return m_temperature.get<CameraState::Temperature::Lens>();
3708 }
3709
3710 template<
3711 typename T,
3712 typename std::enable_if<std::is_same<T, CameraState::Temperature::PCB>::value, int>::type = 0>
3714 {
3715 return m_temperature.get<CameraState::Temperature::PCB>();
3716 }
3717
3718 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
3720 {
3721 return m_available;
3722 }
3723
3724 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
3726 {
3727 return m_connected;
3728 }
3729
3730 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
3732 {
3733 return m_inaccessibleReason;
3734 }
3735
3736 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
3738 {
3739 return m_network;
3740 }
3741
3742 template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
3744 {
3745 return m_status;
3746 }
3747
3748 template<size_t i, typename std::enable_if<i == 5, int>::type = 0>
3750 {
3751 return m_temperature;
3752 }
3753
3755 template<typename F>
3756 void forEach(const F &f) const
3757 {
3758 f(m_available);
3759 f(m_connected);
3760 f(m_inaccessibleReason);
3761 f(m_network);
3762 f(m_status);
3763 f(m_temperature);
3764 }
3765
3767 template<typename F>
3768 void forEach(const F &f)
3769 {
3770 f(m_available);
3771 f(m_connected);
3772 f(m_inaccessibleReason);
3773 f(m_network);
3774 f(m_status);
3775 f(m_temperature);
3776 }
3777
3779 bool operator==(const CameraState &other) const;
3780
3782 bool operator!=(const CameraState &other) const;
3783
3785 std::string toString() const;
3786
3788 friend std::ostream &operator<<(std::ostream &stream, const CameraState &value)
3789 {
3790 return stream << value.toString();
3791 }
3792
3794 void save(const std::string &fileName) const;
3795
3797 void load(const std::string &fileName);
3798
3799 private:
3800 void setFromString(const std::string &value);
3801
3802 void setFromString(const std::string &fullPath, const std::string &value);
3803
3804 std::string getString(const std::string &fullPath) const;
3805
3806 Available m_available;
3807 Connected m_connected;
3808 InaccessibleReason m_inaccessibleReason;
3809 Network m_network;
3810 Status m_status;
3811 Temperature m_temperature;
3812
3813 friend struct DataModel::Detail::Befriend<CameraState>;
3814 };
3815
3816#ifndef NO_DOC
3817 template<>
3818 struct CameraState::Version<7>
3819 {
3820 using Type = CameraState;
3821 };
3822#endif
3823
3824} // namespace Zivid
3825
3826#ifndef NO_DOC
3828namespace Zivid::Detail
3829{
3830
3831 ZIVID_CORE_EXPORT void save(const Zivid::CameraState &dataModel, std::ostream &ostream);
3832 ZIVID_CORE_EXPORT void load(Zivid::CameraState &dataModel, std::istream &istream);
3833
3834 ZIVID_CORE_EXPORT std::vector<uint8_t> serializeToBinaryVector(const Zivid::CameraState &source);
3835 ZIVID_CORE_EXPORT void deserializeFromBinaryVector(Zivid::CameraState &dest, const std::vector<uint8_t> &data);
3836
3837} // namespace Zivid::Detail
3838#endif
3839
3840#ifdef _MSC_VER
3841# pragma warning(pop)
3842#endif
3843
3844#ifndef NO_DOC
3845# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
3846namespace std // NOLINT
3847{
3848
3849 template<>
3850 struct tuple_size<Zivid::CameraState::Network> : integral_constant<size_t, 2>
3851 {};
3852
3853 template<size_t i>
3854 struct tuple_element<i, Zivid::CameraState::Network>
3855 {
3856 static_assert(i < tuple_size<Zivid::CameraState::Network>::value, "Index must be less than 2");
3857
3858 using type // NOLINT
3859 = decltype(declval<Zivid::CameraState::Network>().get<i>());
3860 };
3861
3862 template<>
3863 struct tuple_size<Zivid::CameraState::Network::IPV4> : integral_constant<size_t, 1>
3864 {};
3865
3866 template<size_t i>
3867 struct tuple_element<i, Zivid::CameraState::Network::IPV4>
3868 {
3869 static_assert(i < tuple_size<Zivid::CameraState::Network::IPV4>::value, "Index must be less than 1");
3870
3871 using type // NOLINT
3872 = decltype(declval<Zivid::CameraState::Network::IPV4>().get<i>());
3873 };
3874
3875 template<>
3876 struct tuple_size<Zivid::CameraState::Temperature> : integral_constant<size_t, 5>
3877 {};
3878
3879 template<size_t i>
3880 struct tuple_element<i, Zivid::CameraState::Temperature>
3881 {
3882 static_assert(i < tuple_size<Zivid::CameraState::Temperature>::value, "Index must be less than 5");
3883
3884 using type // NOLINT
3885 = decltype(declval<Zivid::CameraState::Temperature>().get<i>());
3886 };
3887
3888 template<>
3889 struct tuple_size<Zivid::CameraState> : integral_constant<size_t, 6>
3890 {};
3891
3892 template<size_t i>
3893 struct tuple_element<i, Zivid::CameraState>
3894 {
3895 static_assert(i < tuple_size<Zivid::CameraState>::value, "Index must be less than 6");
3896
3897 using type // NOLINT
3898 = decltype(declval<Zivid::CameraState>().get<i>());
3899 };
3900
3901} // namespace std
3902# endif
3903#endif
3904
3905// If we have access to the DataModel library, automatically include internal DataModel
3906// header. This header is necessary for serialization and deserialization.
3907#if defined(__has_include) && !defined(NO_DOC)
3908# if __has_include("Zivid/CameraStateInternal.h") && __has_include("Zivid/DataModelNodeMetaData.h")
3909# include "Zivid/CameraStateInternal.h"
3910# endif
3911#endif
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
Flag if camera is physically connected to the computer and is available for use, but not connected in...
Definition CameraState.h:116
static std::set< bool > validValues()
All valid values of Available.
Definition CameraState.h:141
static const Available no
Off/disabled.
Definition CameraState.h:138
bool operator==(const Available &other) const
Comparison operator.
Definition CameraState.h:167
std::string toString() const
Get the value as string.
bool ValueType
The type of the underlying value.
Definition CameraState.h:136
static const Available yes
On/enabled.
Definition CameraState.h:137
friend std::ostream & operator<<(std::ostream &stream, const Available &value)
Operator to serialize the value to a stream.
Definition CameraState.h:179
bool operator!=(const Available &other) const
Comparison operator.
Definition CameraState.h:173
constexpr Available(bool value)
Constructor.
Definition CameraState.h:150
bool value() const
Get the value.
Available()=default
Default constructor.
Flag if camera is connected in software. This bool is true when the Status value is connected....
Definition CameraState.h:198
Connected()=default
Default constructor.
static const Connected yes
On/enabled.
Definition CameraState.h:218
static const Connected no
Off/disabled.
Definition CameraState.h:219
bool operator!=(const Connected &other) const
Comparison operator.
Definition CameraState.h:254
constexpr Connected(bool value)
Constructor.
Definition CameraState.h:231
bool value() const
Get the value.
std::string toString() const
Get the value as string.
friend std::ostream & operator<<(std::ostream &stream, const Connected &value)
Operator to serialize the value to a stream.
Definition CameraState.h:260
static std::set< bool > validValues()
All valid values of Connected.
Definition CameraState.h:222
bool operator==(const Connected &other) const
Comparison operator.
Definition CameraState.h:248
bool ValueType
The type of the underlying value.
Definition CameraState.h:217
If the camera status is inaccessible, then this enum value will give you the reason.
Definition CameraState.h:277
static const InaccessibleReason ipNotInLocalSubnet
ipNotInLocalSubnet
Definition CameraState.h:303
constexpr InaccessibleReason(ValueType value)
Constructor.
Definition CameraState.h:319
bool hasValue() const
Check if the value is set.
static const InaccessibleReason ipConflictWithAnotherCamera
ipConflictWithAnotherCamera
Definition CameraState.h:301
friend std::ostream & operator<<(std::ostream &stream, const InaccessibleReason::ValueType &value)
Operator to serialize ValueType to a stream.
Definition CameraState.h:339
bool operator==(const InaccessibleReason &other) const
Comparison operator.
Definition CameraState.h:345
std::string toString() const
Get the value as string.
friend std::ostream & operator<<(std::ostream &stream, const InaccessibleReason &value)
Operator to serialize the value to a stream.
Definition CameraState.h:357
static const InaccessibleReason ipConflictWithLocalNetworkAdapter
ipConflictWithLocalNetworkAdapter
Definition CameraState.h:302
InaccessibleReason()=default
Default constructor.
static const InaccessibleReason ipInMultipleLocalSubnets
ipInMultipleLocalSubnets
Definition CameraState.h:304
ValueType
The type of the underlying value.
Definition CameraState.h:295
ValueType value() const
Get the value.
void reset()
Reset the node to unset state.
bool operator!=(const InaccessibleReason &other) const
Comparison operator.
Definition CameraState.h:351
static std::set< ValueType > validValues()
All valid values of InaccessibleReason.
Definition CameraState.h:307
Current IPv4 address.
Definition CameraState.h:1593
Address()=default
Default constructor.
bool operator<(const Address &other) const
Comparison operator.
Definition CameraState.h:1643
bool operator==(const Address &other) const
Comparison operator.
Definition CameraState.h:1631
bool operator<=(const Address &other) const
Comparison operator.
Definition CameraState.h:1655
static constexpr Range< ValueType::size_type > validSize()
The valid sizes for Address.
Definition CameraState.h:1611
bool operator>(const Address &other) const
Comparison operator.
Definition CameraState.h:1649
bool operator!=(const Address &other) const
Comparison operator.
Definition CameraState.h:1637
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 CameraState.h:1667
bool operator>=(const Address &other) const
Comparison operator.
Definition CameraState.h:1661
Address(std::string value)
Constructor.
Definition CameraState.h:1620
std::string toString() const
Get the value as string.
std::string ValueType
The type of the underlying value.
Definition CameraState.h:1608
Current IPv4 protocol state.
Definition CameraState.h:1575
IPV4()
Default constructor.
void set(Args &&...args)
Set multiple arguments.
Definition CameraState.h:1734
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:1822
const Address & address() const
Get Address.
Definition CameraState.h:1788
friend std::ostream & operator<<(std::ostream &stream, const IPV4 &value)
Operator to send the value as string to a stream.
Definition CameraState.h:1844
IPV4 copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition CameraState.h:1767
const CameraState::Network::IPV4::Address & get() const
Definition CameraState.h:1809
bool operator==(const IPV4 &other) const
Equality operator.
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:1829
IPV4 & set(const Address &value)
Set Address.
Definition CameraState.h:1800
std::string toString() const
Get the value as string.
std::tuple< CameraState::Network::IPV4::Address > Descendants
Definition CameraState.h:1680
Address & address()
Get Address.
Definition CameraState.h:1794
bool operator!=(const IPV4 &other) const
Inequality operator.
IP address of the computer's local network interface.
Definition CameraState.h:468
bool operator>=(const Address &other) const
Comparison operator.
Definition CameraState.h:538
bool operator<(const Address &other) const
Comparison operator.
Definition CameraState.h:520
bool operator<=(const Address &other) const
Comparison operator.
Definition CameraState.h:532
std::string ValueType
The type of the underlying value.
Definition CameraState.h:485
static constexpr Range< ValueType::size_type > validSize()
The valid sizes for Address.
Definition CameraState.h:488
std::string toString() const
Get the value as string.
friend std::ostream & operator<<(std::ostream &stream, const Address &value)
Operator to serialize the value to a stream.
Definition CameraState.h:544
Address(std::string value)
Constructor.
Definition CameraState.h:497
bool operator!=(const Address &other) const
Comparison operator.
Definition CameraState.h:514
bool operator>(const Address &other) const
Comparison operator.
Definition CameraState.h:526
bool operator==(const Address &other) const
Comparison operator.
Definition CameraState.h:508
Subnet mask of the computer's local network interface.
Definition CameraState.h:561
bool operator!=(const Mask &other) const
Comparison operator.
Definition CameraState.h:607
bool operator>=(const Mask &other) const
Comparison operator.
Definition CameraState.h:631
Mask(std::string value)
Constructor.
Definition CameraState.h:590
friend std::ostream & operator<<(std::ostream &stream, const Mask &value)
Operator to serialize the value to a stream.
Definition CameraState.h:637
bool operator==(const Mask &other) const
Comparison operator.
Definition CameraState.h:601
bool operator>(const Mask &other) const
Comparison operator.
Definition CameraState.h:619
bool operator<(const Mask &other) const
Comparison operator.
Definition CameraState.h:613
bool operator<=(const Mask &other) const
Comparison operator.
Definition CameraState.h:625
std::string toString() const
Get the value as string.
static constexpr Range< ValueType::size_type > validSize()
The valid sizes for Mask.
Definition CameraState.h:581
std::string ValueType
The type of the underlying value.
Definition CameraState.h:578
const std::string & value() const
Get the value.
An IPv4 subnet that the local network interface is connected to.
Definition CameraState.h:447
std::string toString() const
Get the value as string.
Subnet copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition CameraState.h:743
const Mask & mask() const
Get Mask.
Definition CameraState.h:783
void set(Args &&...args)
Set multiple arguments.
Definition CameraState.h:708
const CameraState::Network::LocalInterface::IPV4::Subnet::Address & get() const
Definition CameraState.h:806
bool operator!=(const Subnet &other) const
Inequality operator.
Mask & mask()
Get Mask.
Definition CameraState.h:789
std::tuple< CameraState::Network::LocalInterface::IPV4::Subnet::Address, CameraState::Network::LocalInterface::IPV4::Subnet::Mask > Descendants
Definition CameraState.h:650
bool operator==(const Subnet &other) const
Equality operator.
friend std::ostream & operator<<(std::ostream &stream, const Subnet &value)
Operator to send the value as string to a stream.
Definition CameraState.h:859
const CameraState::Network::LocalInterface::IPV4::Subnet::Mask & get() const
Definition CameraState.h:816
const Address & address() const
Get Address.
Definition CameraState.h:764
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:843
Subnet & set(const Address &value)
Set Address.
Definition CameraState.h:776
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:835
Subnet & set(const Mask &value)
Set Mask.
Definition CameraState.h:795
Address & address()
Get Address.
Definition CameraState.h:770
List of IPv4 addresses and subnet masks that the interface is configured with. This list can contain ...
Definition CameraState.h:884
CameraState::Network::LocalInterface::IPV4::Subnet & operator[](std::size_t pos)
Returns a reference to the element at position pos in the list.
bool operator!=(const Subnets &other) const
Comparison operator.
Definition CameraState.h:1029
std::vector< CameraState::Network::LocalInterface::IPV4::Subnet > ValueType
The type of the underlying value.
Definition CameraState.h:904
Subnets(std::vector< CameraState::Network::LocalInterface::IPV4::Subnet > value)
Constructor.
Definition CameraState.h:916
std::string toString() const
Get the value as string.
const CameraState::Network::LocalInterface::IPV4::Subnet & at(std::size_t pos) const
Returns a const reference to the element at position pos in the list.
Subnets(std::initializer_list< CameraState::Network::LocalInterface::IPV4::Subnet > value)
Constructor.
Definition CameraState.h:921
void forEach(const F &f)
Run the given function on each element in the list.
Definition CameraState.h:979
friend std::ostream & operator<<(std::ostream &stream, const Subnets &value)
Operator to serialize the value to a stream.
Definition CameraState.h:1035
std::vector< CameraState::Network::LocalInterface::IPV4::Subnet >::const_iterator ConstIterator
Constant iterator type for Subnets.
Definition CameraState.h:1007
std::size_t size() const noexcept
Get the size of the list.
CameraState::Network::LocalInterface::IPV4::Subnet & at(std::size_t pos)
Returns a reference to the element at position pos in the list.
const CameraState::Network::LocalInterface::IPV4::Subnet & operator[](std::size_t pos) const
Returns a const reference to the element at position pos in the list.
std::vector< CameraState::Network::LocalInterface::IPV4::Subnet >::iterator Iterator
Iterator type for Subnets.
Definition CameraState.h:998
static constexpr Range< ValueType::size_type > validSize()
The valid sizes for Subnets.
Definition CameraState.h:907
void forEach(const F &f) const
Run the given function on each element in the list.
Definition CameraState.h:989
const std::vector< CameraState::Network::LocalInterface::IPV4::Subnet > & value() const
Get the value.
Iterator begin() noexcept
Returns an iterator to the first element of the list.
Current IPv4 protocol state of the computer's local network interface.
Definition CameraState.h:426
const Subnets & subnets() const
Get Subnets.
Definition CameraState.h:1157
IPV4 copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition CameraState.h:1136
const CameraState::Network::LocalInterface::IPV4::Subnets & get() const
Definition CameraState.h:1180
std::tuple< CameraState::Network::LocalInterface::IPV4::Subnets > Descendants
Definition CameraState.h:1048
friend std::ostream & operator<<(std::ostream &stream, const IPV4 &value)
Operator to send the value as string to a stream.
Definition CameraState.h:1215
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:1193
bool operator!=(const IPV4 &other) const
Inequality operator.
void set(Args &&...args)
Set multiple arguments.
Definition CameraState.h:1102
bool operator==(const IPV4 &other) const
Equality operator.
std::string toString() const
Get the value as string.
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:1200
IPV4 & set(const Subnets &value)
Set Subnets.
Definition CameraState.h:1169
Subnets & subnets()
Get Subnets.
Definition CameraState.h:1163
Name of the computer's local network interface.
Definition CameraState.h:1236
bool operator==(const InterfaceName &other) const
Comparison operator.
Definition CameraState.h:1276
std::string ValueType
The type of the underlying value.
Definition CameraState.h:1253
const std::string & value() const
Get the value.
static constexpr Range< ValueType::size_type > validSize()
The valid sizes for InterfaceName.
Definition CameraState.h:1256
InterfaceName(std::string value)
Constructor.
Definition CameraState.h:1265
bool operator<=(const InterfaceName &other) const
Comparison operator.
Definition CameraState.h:1300
friend std::ostream & operator<<(std::ostream &stream, const InterfaceName &value)
Operator to serialize the value to a stream.
Definition CameraState.h:1312
bool operator>(const InterfaceName &other) const
Comparison operator.
Definition CameraState.h:1294
bool operator<(const InterfaceName &other) const
Comparison operator.
Definition CameraState.h:1288
std::string toString() const
Get the value as string.
bool operator!=(const InterfaceName &other) const
Comparison operator.
Definition CameraState.h:1282
bool operator>=(const InterfaceName &other) const
Comparison operator.
Definition CameraState.h:1306
Current state of the computer's local network interface.
Definition CameraState.h:405
const CameraState::Network::LocalInterface::IPV4::Subnets & get() const
Definition CameraState.h:1500
bool operator!=(const LocalInterface &other) const
Inequality operator.
std::tuple< CameraState::Network::LocalInterface::IPV4, CameraState::Network::LocalInterface::IPV4::Subnets, CameraState::Network::LocalInterface::InterfaceName > Descendants
Definition CameraState.h:1325
InterfaceName & interfaceName()
Get InterfaceName.
Definition CameraState.h:1474
bool operator==(const LocalInterface &other) const
Equality operator.
LocalInterface & set(const IPV4::Subnets &value)
Set IPV4::Subnets.
Definition CameraState.h:1461
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:1537
LocalInterface copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition CameraState.h:1421
std::string toString() const
Get the value as string.
const InterfaceName & interfaceName() const
Get InterfaceName.
Definition CameraState.h:1468
const IPV4 & ipv4() const
Get IPV4.
Definition CameraState.h:1442
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:1529
void set(Args &&...args)
Set multiple arguments.
Definition CameraState.h:1386
friend std::ostream & operator<<(std::ostream &stream, const LocalInterface &value)
Operator to send the value as string to a stream.
Definition CameraState.h:1553
const CameraState::Network::LocalInterface::IPV4 & get() const
Definition CameraState.h:1490
LocalInterface & set(const InterfaceName &value)
Set InterfaceName.
Definition CameraState.h:1480
IPV4 & ipv4()
Get IPV4.
Definition CameraState.h:1448
const CameraState::Network::LocalInterface::InterfaceName & get() const
Definition CameraState.h:1510
LocalInterface & set(const IPV4 &value)
Set IPV4.
Definition CameraState.h:1454
List of the computer's local network interfaces that discovered the camera. In the most common scenar...
Definition CameraState.h:1871
std::vector< CameraState::Network::LocalInterface >::iterator Iterator
Iterator type for LocalInterfaces.
Definition CameraState.h:1987
bool operator!=(const LocalInterfaces &other) const
Comparison operator.
Definition CameraState.h:2017
const std::vector< CameraState::Network::LocalInterface > & value() const
Get the value.
CameraState::Network::LocalInterface & operator[](std::size_t pos)
Returns a reference to the element at position pos in the list.
std::string toString() const
Get the value as string.
LocalInterfaces()=default
Default constructor.
std::vector< CameraState::Network::LocalInterface > ValueType
The type of the underlying value.
Definition CameraState.h:1894
LocalInterfaces(std::initializer_list< CameraState::Network::LocalInterface > value)
Constructor.
Definition CameraState.h:1911
const CameraState::Network::LocalInterface & operator[](std::size_t pos) const
Returns a const reference to the element at position pos in the list.
static constexpr Range< ValueType::size_type > validSize()
The valid sizes for LocalInterfaces.
Definition CameraState.h:1897
Iterator begin() noexcept
Returns an iterator to the first element of the list.
const CameraState::Network::LocalInterface & at(std::size_t pos) const
Returns a const reference to the element at position pos in the list.
LocalInterfaces(std::vector< CameraState::Network::LocalInterface > value)
Constructor.
Definition CameraState.h:1906
void forEach(const F &f) const
Run the given function on each element in the list.
Definition CameraState.h:1978
std::vector< CameraState::Network::LocalInterface >::const_iterator ConstIterator
Constant iterator type for LocalInterfaces.
Definition CameraState.h:1996
void forEach(const F &f)
Run the given function on each element in the list.
Definition CameraState.h:1968
CameraState::Network::LocalInterface & at(std::size_t pos)
Returns a reference to the element at position pos in the list.
std::size_t size() const noexcept
Get the size of the list.
friend std::ostream & operator<<(std::ostream &stream, const LocalInterfaces &value)
Operator to serialize the value to a stream.
Definition CameraState.h:2023
Current network state.
Definition CameraState.h:386
void set(Args &&...args)
Set multiple arguments.
Definition CameraState.h:2097
const LocalInterfaces & localInterfaces() const
Get LocalInterfaces.
Definition CameraState.h:2177
std::string toString() const
Get the value as string.
friend std::ostream & operator<<(std::ostream &stream, const Network &value)
Operator to send the value as string to a stream.
Definition CameraState.h:2257
const CameraState::Network::LocalInterfaces & get() const
Definition CameraState.h:2214
std::tuple< CameraState::Network::IPV4, CameraState::Network::IPV4::Address, CameraState::Network::LocalInterfaces > Descendants
Definition CameraState.h:2036
bool operator==(const Network &other) const
Equality operator.
LocalInterfaces & localInterfaces()
Get LocalInterfaces.
Definition CameraState.h:2183
Network()
Default constructor.
Network & set(const IPV4 &value)
Set IPV4.
Definition CameraState.h:2163
Network copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition CameraState.h:2131
const CameraState::Network::IPV4::Address & get() const
Definition CameraState.h:2206
Network & set(const LocalInterfaces &value)
Set LocalInterfaces.
Definition CameraState.h:2189
const CameraState::Network::IPV4 & get() const
Definition CameraState.h:2198
Network & set(const IPV4::Address &value)
Set IPV4::Address.
Definition CameraState.h:2170
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:2241
IPV4 & ipv4()
Get IPV4.
Definition CameraState.h:2157
bool operator!=(const Network &other) const
Inequality operator.
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:2233
const IPV4 & ipv4() const
Get IPV4.
Definition CameraState.h:2151
This enum describes the current status of this camera. The enum can have the following values:
Definition CameraState.h:2312
constexpr Status(ValueType value)
Constructor.
Definition CameraState.h:2405
static std::set< ValueType > validValues()
All valid values of Status.
Definition CameraState.h:2387
static const Status connected
connected
Definition CameraState.h:2382
static const Status disconnecting
disconnecting
Definition CameraState.h:2383
static const Status inaccessible
inaccessible
Definition CameraState.h:2375
std::string toString() const
Get the value as string.
ValueType
The type of the underlying value.
Definition CameraState.h:2363
static const Status applyingNetworkConfiguration
applyingNetworkConfiguration
Definition CameraState.h:2377
friend std::ostream & operator<<(std::ostream &stream, const Status &value)
Operator to serialize the value to a stream.
Definition CameraState.h:2434
static const Status firmwareUpdateRequired
firmwareUpdateRequired
Definition CameraState.h:2378
ValueType value() const
Get the value.
bool operator!=(const Status &other) const
Comparison operator.
Definition CameraState.h:2428
static const Status connecting
connecting
Definition CameraState.h:2381
bool operator==(const Status &other) const
Comparison operator.
Definition CameraState.h:2422
static const Status busy
busy
Definition CameraState.h:2376
Status()=default
Default constructor.
static const Status available
available
Definition CameraState.h:2380
static const Status updatingFirmware
updatingFirmware
Definition CameraState.h:2379
static const Status disappeared
disappeared
Definition CameraState.h:2384
friend std::ostream & operator<<(std::ostream &stream, const Status::ValueType &value)
Operator to serialize ValueType to a stream.
Definition CameraState.h:2416
DMD temperature.
Definition CameraState.h:2484
bool operator>(const DMD &other) const
Comparison operator.
Definition CameraState.h:2540
std::string toString() const
Get the value as string.
double value() const
Get the value.
bool operator!=(const DMD &other) const
Comparison operator.
Definition CameraState.h:2528
bool operator<(const DMD &other) const
Comparison operator.
Definition CameraState.h:2534
bool operator>=(const DMD &other) const
Comparison operator.
Definition CameraState.h:2552
double ValueType
The type of the underlying value.
Definition CameraState.h:2499
bool operator<=(const DMD &other) const
Comparison operator.
Definition CameraState.h:2546
friend std::ostream & operator<<(std::ostream &stream, const DMD &value)
Operator to serialize the value to a stream.
Definition CameraState.h:2558
constexpr DMD(double value)
Constructor.
Definition CameraState.h:2511
bool operator==(const DMD &other) const
Comparison operator.
Definition CameraState.h:2522
static constexpr Range< double > validRange()
The range of valid values for DMD.
Definition CameraState.h:2502
DMD()=default
Default constructor.
General temperature.
Definition CameraState.h:2575
double ValueType
The type of the underlying value.
Definition CameraState.h:2590
std::string toString() const
Get the value as string.
double value() const
Get the value.
bool operator<(const General &other) const
Comparison operator.
Definition CameraState.h:2625
constexpr General(double value)
Constructor.
Definition CameraState.h:2602
static constexpr Range< double > validRange()
The range of valid values for General.
Definition CameraState.h:2593
bool operator==(const General &other) const
Comparison operator.
Definition CameraState.h:2613
General()=default
Default constructor.
bool operator<=(const General &other) const
Comparison operator.
Definition CameraState.h:2637
bool operator!=(const General &other) const
Comparison operator.
Definition CameraState.h:2619
bool operator>(const General &other) const
Comparison operator.
Definition CameraState.h:2631
friend std::ostream & operator<<(std::ostream &stream, const General &value)
Operator to serialize the value to a stream.
Definition CameraState.h:2649
bool operator>=(const General &other) const
Comparison operator.
Definition CameraState.h:2643
LED temperature.
Definition CameraState.h:2666
bool operator<=(const LED &other) const
Comparison operator.
Definition CameraState.h:2728
std::string toString() const
Get the value as string.
bool operator<(const LED &other) const
Comparison operator.
Definition CameraState.h:2716
double value() const
Get the value.
LED()=default
Default constructor.
constexpr LED(double value)
Constructor.
Definition CameraState.h:2693
friend std::ostream & operator<<(std::ostream &stream, const LED &value)
Operator to serialize the value to a stream.
Definition CameraState.h:2740
bool operator!=(const LED &other) const
Comparison operator.
Definition CameraState.h:2710
bool operator==(const LED &other) const
Comparison operator.
Definition CameraState.h:2704
bool operator>=(const LED &other) const
Comparison operator.
Definition CameraState.h:2734
bool operator>(const LED &other) const
Comparison operator.
Definition CameraState.h:2722
static constexpr Range< double > validRange()
The range of valid values for LED.
Definition CameraState.h:2684
double ValueType
The type of the underlying value.
Definition CameraState.h:2681
Lens temperature.
Definition CameraState.h:2757
double ValueType
The type of the underlying value.
Definition CameraState.h:2772
bool operator==(const Lens &other) const
Comparison operator.
Definition CameraState.h:2795
Lens()=default
Default constructor.
bool operator<=(const Lens &other) const
Comparison operator.
Definition CameraState.h:2819
double value() const
Get the value.
bool operator>(const Lens &other) const
Comparison operator.
Definition CameraState.h:2813
bool operator!=(const Lens &other) const
Comparison operator.
Definition CameraState.h:2801
bool operator>=(const Lens &other) const
Comparison operator.
Definition CameraState.h:2825
std::string toString() const
Get the value as string.
constexpr Lens(double value)
Constructor.
Definition CameraState.h:2784
static constexpr Range< double > validRange()
The range of valid values for Lens.
Definition CameraState.h:2775
bool operator<(const Lens &other) const
Comparison operator.
Definition CameraState.h:2807
friend std::ostream & operator<<(std::ostream &stream, const Lens &value)
Operator to serialize the value to a stream.
Definition CameraState.h:2831
PCB temperature.
Definition CameraState.h:2848
bool operator!=(const PCB &other) const
Comparison operator.
Definition CameraState.h:2892
constexpr PCB(double value)
Constructor.
Definition CameraState.h:2875
static constexpr Range< double > validRange()
The range of valid values for PCB.
Definition CameraState.h:2866
bool operator>=(const PCB &other) const
Comparison operator.
Definition CameraState.h:2916
PCB()=default
Default constructor.
bool operator<=(const PCB &other) const
Comparison operator.
Definition CameraState.h:2910
friend std::ostream & operator<<(std::ostream &stream, const PCB &value)
Operator to serialize the value to a stream.
Definition CameraState.h:2922
bool operator==(const PCB &other) const
Comparison operator.
Definition CameraState.h:2886
double value() const
Get the value.
bool operator>(const PCB &other) const
Comparison operator.
Definition CameraState.h:2904
double ValueType
The type of the underlying value.
Definition CameraState.h:2863
std::string toString() const
Get the value as string.
bool operator<(const PCB &other) const
Comparison operator.
Definition CameraState.h:2898
Current temperature(s)
Definition CameraState.h:2466
DMD & dmd()
Get DMD.
Definition CameraState.h:3064
Temperature & set(const General &value)
Set General.
Definition CameraState.h:3089
const PCB & pcb() const
Get PCB.
Definition CameraState.h:3134
const CameraState::Temperature::Lens & get() const
Definition CameraState.h:3179
Temperature & set(const Lens &value)
Set Lens.
Definition CameraState.h:3127
const CameraState::Temperature::DMD & get() const
Definition CameraState.h:3155
const CameraState::Temperature::PCB & get() const
Definition CameraState.h:3187
const CameraState::Temperature::General & get() const
Definition CameraState.h:3163
Temperature & set(const PCB &value)
Set PCB.
Definition CameraState.h:3146
const General & general() const
Get General.
Definition CameraState.h:3077
bool operator!=(const Temperature &other) const
Inequality operator.
const LED & led() const
Get LED.
Definition CameraState.h:3096
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:3224
friend std::ostream & operator<<(std::ostream &stream, const Temperature &value)
Operator to send the value as string to a stream.
Definition CameraState.h:3254
Temperature & set(const LED &value)
Set LED.
Definition CameraState.h:3108
std::string toString() const
Get the value as string.
LED & led()
Get LED.
Definition CameraState.h:3102
bool operator==(const Temperature &other) const
Equality operator.
const Lens & lens() const
Get Lens.
Definition CameraState.h:3115
Temperature copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition CameraState.h:3038
General & general()
Get General.
Definition CameraState.h:3083
std::tuple< CameraState::Temperature::DMD, CameraState::Temperature::General, CameraState::Temperature::LED, CameraState::Temperature::Lens, CameraState::Temperature::PCB > Descendants
Definition CameraState.h:2935
void set(Args &&...args)
Set multiple arguments.
Definition CameraState.h:3002
const DMD & dmd() const
Get DMD.
Definition CameraState.h:3058
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:3235
const CameraState::Temperature::LED & get() const
Definition CameraState.h:3171
Lens & lens()
Get Lens.
Definition CameraState.h:3121
Temperature()
Default constructor.
Temperature & set(const DMD &value)
Set DMD.
Definition CameraState.h:3070
PCB & pcb()
Get PCB.
Definition CameraState.h:3140
Information about camera connection state, temperatures, etc.
Definition CameraState.h:79
const Temperature & temperature() const
Get Temperature.
Definition CameraState.h:3565
CameraState copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition CameraState.h:3430
const CameraState::Network::IPV4 & get() const
Definition CameraState.h:3645
const CameraState::Temperature::Lens & get() const
Definition CameraState.h:3705
void load(const std::string &fileName)
Load from the given file.
CameraState(const std::string &fileName)
Construct CameraState by loading from file.
std::string serialize() const
Serialize to a string.
CameraState & set(const Temperature &value)
Set Temperature.
Definition CameraState.h:3577
const CameraState::Connected & get() const
Definition CameraState.h:3625
Temperature & temperature()
Get Temperature.
Definition CameraState.h:3571
const CameraState::Temperature::General & get() const
Definition CameraState.h:3689
std::string toString() const
Get the value as string.
CameraState & set(const Network &value)
Set Network.
Definition CameraState.h:3518
const CameraState::Status & get() const
Definition CameraState.h:3667
const CameraState::InaccessibleReason & get() const
Definition CameraState.h:3633
const CameraState::Available & get() const
Definition CameraState.h:3619
const CameraState::Network::IPV4::Address & get() const
Definition CameraState.h:3653
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:3768
void save(const std::string &fileName) const
Save to the given file.
std::tuple< CameraState::Available, CameraState::Connected, CameraState::InaccessibleReason, CameraState::Network, CameraState::Network::IPV4, CameraState::Network::IPV4::Address, CameraState::Network::LocalInterfaces, CameraState::Status, CameraState::Temperature, CameraState::Temperature::DMD, CameraState::Temperature::General, CameraState::Temperature::LED, CameraState::Temperature::Lens, CameraState::Temperature::PCB > Descendants
Definition CameraState.h:3275
const CameraState::Network & get() const
Definition CameraState.h:3639
const CameraState::Temperature::PCB & get() const
Definition CameraState.h:3713
CameraState & set(const Temperature::PCB &value)
Set Temperature::PCB.
Definition CameraState.h:3612
const InaccessibleReason & inaccessibleReason() const
Get InaccessibleReason.
Definition CameraState.h:3487
const CameraState::Temperature::LED & get() const
Definition CameraState.h:3697
CameraState & set(const Temperature::General &value)
Set Temperature::General.
Definition CameraState.h:3591
friend std::ostream & operator<<(std::ostream &stream, const CameraState &value)
Operator to send the value as string to a stream.
Definition CameraState.h:3788
bool operator!=(const CameraState &other) const
Inequality operator.
CameraState & set(const Network::IPV4 &value)
Set Network::IPV4.
Definition CameraState.h:3525
CameraState & set(const Network::IPV4::Address &value)
Set Network::IPV4::Address.
Definition CameraState.h:3532
Status & status()
Get Status.
Definition CameraState.h:3552
const Available & isAvailable() const
Get Available.
Definition CameraState.h:3449
const Status & status() const
Get Status.
Definition CameraState.h:3546
const CameraState::Network::LocalInterfaces & get() const
Definition CameraState.h:3661
Connected & isConnected()
Get Connected.
Definition CameraState.h:3474
CameraState & set(const Temperature::Lens &value)
Set Temperature::Lens.
Definition CameraState.h:3605
CameraState & set(const Available &value)
Set Available.
Definition CameraState.h:3461
CameraState & set(const Temperature::DMD &value)
Set Temperature::DMD.
Definition CameraState.h:3584
bool operator==(const CameraState &other) const
Equality operator.
CameraState()
Default constructor.
CameraState & set(const Status &value)
Set Status.
Definition CameraState.h:3558
CameraState & set(const InaccessibleReason &value)
Set InaccessibleReason.
Definition CameraState.h:3499
CameraState & set(const Connected &value)
Set Connected.
Definition CameraState.h:3480
Network & network()
Get Network.
Definition CameraState.h:3512
CameraState(Args &&...args)
Constructor taking variadic number of arguments.
Definition CameraState.h:3345
const CameraState::Temperature & get() const
Definition CameraState.h:3673
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:3756
static CameraState fromSerialized(const std::string &value)
Construct a new CameraState instance from a previously serialized string.
void set(Args &&...args)
Set multiple arguments.
Definition CameraState.h:3385
InaccessibleReason & inaccessibleReason()
Get InaccessibleReason.
Definition CameraState.h:3493
CameraState & set(const Temperature::LED &value)
Set Temperature::LED.
Definition CameraState.h:3598
const CameraState::Temperature::DMD & get() const
Definition CameraState.h:3681
const Network & network() const
Get Network.
Definition CameraState.h:3506
const Connected & isConnected() const
Get Connected.
Definition CameraState.h:3468
Available & isAvailable()
Get Available.
Definition CameraState.h:3455
CameraState & set(const Network::LocalInterfaces &value)
Set Network::LocalInterfaces.
Definition CameraState.h:3539
Class describing a range of values for a given type T.
Definition Range.h:75
NodeType
Definition NodeType.h:49
Definition EnvironmentInfo.h:74
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:84