Zivid C++ API 2.11.1+de9b5dae-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 <set>
53#include <sstream>
54#include <string>
55#include <tuple>
56#include <utility>
57#include <vector>
58
64#include "Zivid/Range.h"
65
66#ifdef _MSC_VER
67# pragma warning(push)
68# pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
69#endif
70
71namespace Zivid
72{
73
75
76 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
78 {
79 public:
81 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
82
84 static constexpr const char *path{ "" };
85
87 static constexpr const char *name{ "CameraState" };
88
90 static constexpr const char *description{
91 R"description(Information about camera connection state, temperatures, etc.)description"
92 };
93
94 static constexpr size_t version{ 5 };
95
96#ifndef NO_DOC
97 template<size_t>
98 struct Version;
99
100 using LatestVersion = Zivid::CameraState;
101
102 // Short identifier. This value is not guaranteed to be universally unique
103 // Todo(ZIVID-2808): Move this to internal DataModelExt header
104 static constexpr std::array<uint8_t, 3> binaryId{ 'c', 's', 't' };
105
106#endif
107
112
113 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
115 {
116 public:
118 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
119
121 static constexpr const char *path{ "Available" };
122
124 static constexpr const char *name{ "Available" };
125
127 static constexpr const char *description{
128 R"description(Flag if camera is physically connected to the computer and is available for use, but not connected in
129software. This corresponds to the Status enums `available` or `firmwareUpdateRequired`. Zivid
130recommends to use the Status enum instead of this bool.
131)description"
132 };
133
135 using ValueType = bool;
136 static const Available yes;
137 static const Available no;
138
140 static std::set<bool> validValues()
141 {
142 return { false, true };
143 }
144
146 Available() = default;
147
149 explicit constexpr Available(bool value)
150 : m_value{ value }
151 {}
152
154 bool value() const;
155
157 std::string toString() const;
158
160 explicit operator bool() const
161 {
162 return m_value;
163 }
164
166 bool operator==(const Available &other) const
167 {
168 return m_value == other.m_value;
169 }
170
172 bool operator!=(const Available &other) const
173 {
174 return m_value != other.m_value;
175 }
176
178 friend std::ostream &operator<<(std::ostream &stream, const Available &value)
179 {
180 return stream << value.toString();
181 }
182
183 private:
184 void setFromString(const std::string &value);
185
186 bool m_value{ false };
187
188 friend struct DataModel::Detail::Befriend<Available>;
189 };
190
194
195 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
197 {
198 public:
200 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
201
203 static constexpr const char *path{ "Connected" };
204
206 static constexpr const char *name{ "Connected" };
207
209 static constexpr const char *description{
210 R"description(Flag if camera is connected in software. This bool is true when the Status value is `connected`. Zivid
211recommends to use the Status enum instead of this bool.
212)description"
213 };
214
216 using ValueType = bool;
217 static const Connected yes;
218 static const Connected no;
219
221 static std::set<bool> validValues()
222 {
223 return { false, true };
224 }
225
227 Connected() = default;
228
230 explicit constexpr Connected(bool value)
231 : m_value{ value }
232 {}
233
235 bool value() const;
236
238 std::string toString() const;
239
241 explicit operator bool() const
242 {
243 return m_value;
244 }
245
247 bool operator==(const Connected &other) const
248 {
249 return m_value == other.m_value;
250 }
251
253 bool operator!=(const Connected &other) const
254 {
255 return m_value != other.m_value;
256 }
257
259 friend std::ostream &operator<<(std::ostream &stream, const Connected &value)
260 {
261 return stream << value.toString();
262 }
263
264 private:
265 void setFromString(const std::string &value);
266
267 bool m_value{ false };
268
269 friend struct DataModel::Detail::Befriend<Connected>;
270 };
271
273
274 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
276 {
277 public:
279 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
280
282 static constexpr const char *path{ "InaccessibleReason" };
283
285 static constexpr const char *name{ "InaccessibleReason" };
286
288 static constexpr const char *description{
289 R"description(If the camera status is `inaccessible`, then this enum value will give you the reason.)description"
290 };
291
293 enum class ValueType
294 {
295 ipConflictWithAnotherCamera,
296 ipConflictWithLocalNetworkAdapter,
297 ipNotInLocalSubnet,
298 ipInMultipleLocalSubnets
299 };
304
306 static std::set<ValueType> validValues()
307 {
308 return { ValueType::ipConflictWithAnotherCamera,
309 ValueType::ipConflictWithLocalNetworkAdapter,
310 ValueType::ipNotInLocalSubnet,
311 ValueType::ipInMultipleLocalSubnets };
312 }
313
316
318 explicit constexpr InaccessibleReason(ValueType value)
319 : m_opt{ verifyValue(value) }
320 {}
321
327
329 bool hasValue() const;
330
332 void reset();
333
335 std::string toString() const;
336
338 friend std::ostream &operator<<(std::ostream &stream, const InaccessibleReason::ValueType &value)
339 {
340 return stream << InaccessibleReason{ value }.toString();
341 }
342
344 bool operator==(const InaccessibleReason &other) const
345 {
346 return m_opt == other.m_opt;
347 }
348
350 bool operator!=(const InaccessibleReason &other) const
351 {
352 return m_opt != other.m_opt;
353 }
354
356 friend std::ostream &operator<<(std::ostream &stream, const InaccessibleReason &value)
357 {
358 return stream << value.toString();
359 }
360
361 private:
362 void setFromString(const std::string &value);
363
364 constexpr ValueType static verifyValue(const ValueType &value)
365 {
366 return value == ValueType::ipConflictWithAnotherCamera
367 || value == ValueType::ipConflictWithLocalNetworkAdapter
368 || value == ValueType::ipNotInLocalSubnet || value == ValueType::ipInMultipleLocalSubnets
369 ? value
370 : throw std::invalid_argument{
371 "Invalid value: InaccessibleReason{ "
372 + std::to_string(static_cast<std::underlying_type<ValueType>::type>(value)) + " }"
373 };
374 }
375
376 Zivid::DataModel::Detail::Optional<ValueType> m_opt;
377
378 friend struct DataModel::Detail::Befriend<InaccessibleReason>;
379 };
380
382
383 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
385 {
386 public:
388 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
389
391 static constexpr const char *path{ "Network" };
392
394 static constexpr const char *name{ "Network" };
395
397 static constexpr const char *description{ R"description(Current network state)description" };
398
400
401 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
403 {
404 public:
406 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
407
409 static constexpr const char *path{ "Network/IPV4" };
410
412 static constexpr const char *name{ "IPV4" };
413
415 static constexpr const char *description{ R"description(Current IPv4 protocol state)description" };
416
418
419 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
421 {
422 public:
424 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
425
427 static constexpr const char *path{ "Network/IPV4/Address" };
428
430 static constexpr const char *name{ "Address" };
431
433 static constexpr const char *description{ R"description(Current IPv4 address)description" };
434
436 using ValueType = std::string;
437
440 {
441 return { 0, std::numeric_limits<ValueType::size_type>::max() };
442 }
443
445 Address() = default;
446
448 explicit Address(std::string value)
449 : m_value{ std::move(value) }
450 {}
451
453 const std::string &value() const;
454
456 std::string toString() const;
457
459 bool operator==(const Address &other) const
460 {
461 return m_value == other.m_value;
462 }
463
465 bool operator!=(const Address &other) const
466 {
467 return m_value != other.m_value;
468 }
469
471 bool operator<(const Address &other) const
472 {
473 return m_value < other.m_value;
474 }
475
477 bool operator>(const Address &other) const
478 {
479 return m_value > other.m_value;
480 }
481
483 bool operator<=(const Address &other) const
484 {
485 return m_value <= other.m_value;
486 }
487
489 bool operator>=(const Address &other) const
490 {
491 return m_value >= other.m_value;
492 }
493
495 friend std::ostream &operator<<(std::ostream &stream, const Address &value)
496 {
497 return stream << value.toString();
498 }
499
500 private:
501 void setFromString(const std::string &value);
502
503 std::string m_value{};
504
505 friend struct DataModel::Detail::Befriend<Address>;
506 };
507
508 using Descendants = std::tuple<CameraState::Network::IPV4::Address>;
509
512
524#ifndef NO_DOC
525 template<
526 typename... Args,
527 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
528 typename std::enable_if<
529 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
530 value,
531 int>::type = 0>
532#else
533 template<typename... Args>
534#endif
535 explicit IPV4(Args &&...args)
536 {
537 using namespace Zivid::Detail::TypeTraits;
538
539 static_assert(
540 AllArgsDecayedAreUnique<Args...>::value,
541 "Found duplicate types among the arguments passed to IPV4(...). "
542 "Types should be listed at most once.");
543
544 set(std::forward<Args>(args)...);
545 }
546
557#ifndef NO_DOC
558 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
559#else
560 template<typename... Args>
561#endif
562 void set(Args &&...args)
563 {
564 using namespace Zivid::Detail::TypeTraits;
565
566 using AllArgsAreDescendantNodes =
567 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
568 static_assert(
569 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
570
571 static_assert(
572 AllArgsDecayedAreUnique<Args...>::value,
573 "Found duplicate types among the arguments passed to set(...). "
574 "Types should be listed at most once.");
575
576 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
577 }
578
590#ifndef NO_DOC
591 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
592#else
593 template<typename... Args>
594#endif
595 IPV4 copyWith(Args &&...args) const
596 {
597 using namespace Zivid::Detail::TypeTraits;
598
599 using AllArgsAreDescendantNodes =
600 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
601 static_assert(
602 AllArgsAreDescendantNodes::value,
603 "All arguments passed to copyWith(...) must be descendant nodes.");
604
605 static_assert(
606 AllArgsDecayedAreUnique<Args...>::value,
607 "Found duplicate types among the arguments passed to copyWith(...). "
608 "Types should be listed at most once.");
609
610 auto copy{ *this };
611 copy.set(std::forward<Args>(args)...);
612 return copy;
613 }
614
616 const Address &address() const
617 {
618 return m_address;
619 }
620
623 {
624 return m_address;
625 }
626
628 IPV4 &set(const Address &value)
629 {
630 m_address = value;
631 return *this;
632 }
633
634 template<
635 typename T,
636 typename std::enable_if<std::is_same<T, CameraState::Network::IPV4::Address>::value, int>::type = 0>
638 {
639 return m_address;
640 }
641
642 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
644 {
645 return m_address;
646 }
647
649 template<typename F>
650 void forEach(const F &f) const
651 {
652 f(m_address);
653 }
654
656 template<typename F>
657 void forEach(const F &f)
658 {
659 f(m_address);
660 }
661
663 bool operator==(const IPV4 &other) const;
664
666 bool operator!=(const IPV4 &other) const;
667
669 std::string toString() const;
670
672 friend std::ostream &operator<<(std::ostream &stream, const IPV4 &value)
673 {
674 return stream << value.toString();
675 }
676
677 private:
678 void setFromString(const std::string &value);
679
680 void setFromString(const std::string &fullPath, const std::string &value);
681
682 std::string getString(const std::string &fullPath) const;
683
684 Address m_address;
685
686 friend struct DataModel::Detail::Befriend<IPV4>;
687 };
688
689 using Descendants = std::tuple<CameraState::Network::IPV4, CameraState::Network::IPV4::Address>;
690
693
706#ifndef NO_DOC
707 template<
708 typename... Args,
709 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
710 typename std::enable_if<
711 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
712 value,
713 int>::type = 0>
714#else
715 template<typename... Args>
716#endif
717 explicit Network(Args &&...args)
718 {
719 using namespace Zivid::Detail::TypeTraits;
720
721 static_assert(
722 AllArgsDecayedAreUnique<Args...>::value,
723 "Found duplicate types among the arguments passed to Network(...). "
724 "Types should be listed at most once.");
725
726 set(std::forward<Args>(args)...);
727 }
728
740#ifndef NO_DOC
741 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
742#else
743 template<typename... Args>
744#endif
745 void set(Args &&...args)
746 {
747 using namespace Zivid::Detail::TypeTraits;
748
749 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
750 static_assert(
751 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
752
753 static_assert(
754 AllArgsDecayedAreUnique<Args...>::value,
755 "Found duplicate types among the arguments passed to set(...). "
756 "Types should be listed at most once.");
757
758 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
759 }
760
773#ifndef NO_DOC
774 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
775#else
776 template<typename... Args>
777#endif
778 Network copyWith(Args &&...args) const
779 {
780 using namespace Zivid::Detail::TypeTraits;
781
782 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
783 static_assert(
784 AllArgsAreDescendantNodes::value,
785 "All arguments passed to copyWith(...) must be descendant nodes.");
786
787 static_assert(
788 AllArgsDecayedAreUnique<Args...>::value,
789 "Found duplicate types among the arguments passed to copyWith(...). "
790 "Types should be listed at most once.");
791
792 auto copy{ *this };
793 copy.set(std::forward<Args>(args)...);
794 return copy;
795 }
796
798 const IPV4 &ipv4() const
799 {
800 return m_ipv4;
801 }
802
805 {
806 return m_ipv4;
807 }
808
810 Network &set(const IPV4 &value)
811 {
812 m_ipv4 = value;
813 return *this;
814 }
815
817 Network &set(const IPV4::Address &value)
818 {
819 m_ipv4.set(value);
820 return *this;
821 }
822
823 template<
824 typename T,
825 typename std::enable_if<std::is_same<T, CameraState::Network::IPV4>::value, int>::type = 0>
827 {
828 return m_ipv4;
829 }
830
831 template<
832 typename T,
833 typename std::enable_if<std::is_same<T, CameraState::Network::IPV4::Address>::value, int>::type = 0>
835 {
836 return m_ipv4.get<CameraState::Network::IPV4::Address>();
837 }
838
839 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
841 {
842 return m_ipv4;
843 }
844
846 template<typename F>
847 void forEach(const F &f) const
848 {
849 f(m_ipv4);
850 }
851
853 template<typename F>
854 void forEach(const F &f)
855 {
856 f(m_ipv4);
857 }
858
860 bool operator==(const Network &other) const;
861
863 bool operator!=(const Network &other) const;
864
866 std::string toString() const;
867
869 friend std::ostream &operator<<(std::ostream &stream, const Network &value)
870 {
871 return stream << value.toString();
872 }
873
874 private:
875 void setFromString(const std::string &value);
876
877 void setFromString(const std::string &fullPath, const std::string &value);
878
879 std::string getString(const std::string &fullPath) const;
880
881 IPV4 m_ipv4;
882
883 friend struct DataModel::Detail::Befriend<Network>;
884 };
885
918
919 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
921 {
922 public:
924 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
925
927 static constexpr const char *path{ "Status" };
928
930 static constexpr const char *name{ "Status" };
931
933 static constexpr const char *description{
934 R"description(This enum describes the current status of this camera. The enum can have the following values:
935
936* `inaccessible`: The camera was discovered, but the SDK is not able to connect to this camera. This can
937 be because the IP settings of the camera and the PC are not compatible, or because there are several
938 cameras with the same IP connected to your PC. The `InaccessibleReason` enum will give you more
939 details about why this camera is not accessible. The network configuration of the camera can be changed
940 using the ZividNetworkCameraConfigurator CLI tool. See the knowledge base for more information.
941
942* `busy`: The camera is currently in use by another process. This can be a different process on the same
943 PC, or on a different PC if the camera is shared on a network.
944
945* `firmwareUpdateRequired`: The camera is accessible, but requires a firmware update before you can connect
946 to it.
947
948* `updatingFirmware`: The camera firmware is currently being updated in the current process.
949
950* `available`: The camera is available for use by the current process. This means that you can invoke
951 camera.connect() on this camera.
952
953* `connecting`: The camera is currently connecting in the current process.
954
955* `connected`: The camera is connected in the current process. This means camera.connect() has successfully
956 completed and you can capture using this camera.
957
958* `disconnecting`: The camera is currently disconnecting in the current process. When disconnection has
959 completed, the camera will normally go back to the `available` state.
960
961* `disappeared`: The camera was found earlier, but it can no longer be found. The connection between the
962 PC and the camera may be disrupted, or the camera may have lost power. When in `disappeared` state, the
963 camera will not be returned from `Application::cameras()`. The camera will go back to one of the other
964 states if the camera is later found again.
965)description"
966 };
967
969 enum class ValueType
970 {
971 inaccessible,
972 busy,
973 firmwareUpdateRequired,
974 updatingFirmware,
975 available,
976 connecting,
977 connected,
978 disconnecting,
979 disappeared
980 };
981 static const Status inaccessible;
982 static const Status busy;
985 static const Status available;
986 static const Status connecting;
987 static const Status connected;
988 static const Status disconnecting;
989 static const Status disappeared;
990
992 static std::set<ValueType> validValues()
993 {
994 return { ValueType::inaccessible, ValueType::busy, ValueType::firmwareUpdateRequired,
995 ValueType::updatingFirmware, ValueType::available, ValueType::connecting,
996 ValueType::connected, ValueType::disconnecting, ValueType::disappeared };
997 }
998
1000 Status() = default;
1001
1003 explicit constexpr Status(ValueType value)
1004 : m_value{ verifyValue(value) }
1005 {}
1006
1009
1011 std::string toString() const;
1012
1014 friend std::ostream &operator<<(std::ostream &stream, const Status::ValueType &value)
1015 {
1016 return stream << Status{ value }.toString();
1017 }
1018
1020 bool operator==(const Status &other) const
1021 {
1022 return m_value == other.m_value;
1023 }
1024
1026 bool operator!=(const Status &other) const
1027 {
1028 return m_value != other.m_value;
1029 }
1030
1032 friend std::ostream &operator<<(std::ostream &stream, const Status &value)
1033 {
1034 return stream << value.toString();
1035 }
1036
1037 private:
1038 void setFromString(const std::string &value);
1039
1040 constexpr ValueType static verifyValue(const ValueType &value)
1041 {
1042 return value == ValueType::inaccessible || value == ValueType::busy
1043 || value == ValueType::firmwareUpdateRequired || value == ValueType::updatingFirmware
1044 || value == ValueType::available || value == ValueType::connecting
1045 || value == ValueType::connected || value == ValueType::disconnecting
1046 || value == ValueType::disappeared
1047 ? value
1048 : throw std::invalid_argument{
1049 "Invalid value: Status{ "
1050 + std::to_string(static_cast<std::underlying_type<ValueType>::type>(value)) + " }"
1051 };
1052 }
1053
1054 ValueType m_value{ ValueType::inaccessible };
1055
1056 friend struct DataModel::Detail::Befriend<Status>;
1057 };
1058
1060
1061 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1063 {
1064 public:
1066 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
1067
1069 static constexpr const char *path{ "Temperature" };
1070
1072 static constexpr const char *name{ "Temperature" };
1073
1075 static constexpr const char *description{ R"description(Current temperature(s))description" };
1076
1078
1079 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1081 {
1082 public:
1084 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1085
1087 static constexpr const char *path{ "Temperature/DMD" };
1088
1090 static constexpr const char *name{ "DMD" };
1091
1093 static constexpr const char *description{ R"description(DMD temperature)description" };
1094
1096 using ValueType = double;
1097
1099 static constexpr Range<double> validRange()
1100 {
1101 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1102 }
1103
1105 DMD() = default;
1106
1108 explicit constexpr DMD(double value)
1109 : m_value{ value }
1110 {}
1111
1113 double value() const;
1114
1116 std::string toString() const;
1117
1119 bool operator==(const DMD &other) const
1120 {
1121 return m_value == other.m_value;
1122 }
1123
1125 bool operator!=(const DMD &other) const
1126 {
1127 return m_value != other.m_value;
1128 }
1129
1131 bool operator<(const DMD &other) const
1132 {
1133 return m_value < other.m_value;
1134 }
1135
1137 bool operator>(const DMD &other) const
1138 {
1139 return m_value > other.m_value;
1140 }
1141
1143 bool operator<=(const DMD &other) const
1144 {
1145 return m_value <= other.m_value;
1146 }
1147
1149 bool operator>=(const DMD &other) const
1150 {
1151 return m_value >= other.m_value;
1152 }
1153
1155 friend std::ostream &operator<<(std::ostream &stream, const DMD &value)
1156 {
1157 return stream << value.toString();
1158 }
1159
1160 private:
1161 void setFromString(const std::string &value);
1162
1163 double m_value{ 0.0 };
1164
1165 friend struct DataModel::Detail::Befriend<DMD>;
1166 };
1167
1169
1170 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1172 {
1173 public:
1175 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1176
1178 static constexpr const char *path{ "Temperature/General" };
1179
1181 static constexpr const char *name{ "General" };
1182
1184 static constexpr const char *description{ R"description(General temperature)description" };
1185
1187 using ValueType = double;
1188
1190 static constexpr Range<double> validRange()
1191 {
1192 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1193 }
1194
1196 General() = default;
1197
1199 explicit constexpr General(double value)
1200 : m_value{ value }
1201 {}
1202
1204 double value() const;
1205
1207 std::string toString() const;
1208
1210 bool operator==(const General &other) const
1211 {
1212 return m_value == other.m_value;
1213 }
1214
1216 bool operator!=(const General &other) const
1217 {
1218 return m_value != other.m_value;
1219 }
1220
1222 bool operator<(const General &other) const
1223 {
1224 return m_value < other.m_value;
1225 }
1226
1228 bool operator>(const General &other) const
1229 {
1230 return m_value > other.m_value;
1231 }
1232
1234 bool operator<=(const General &other) const
1235 {
1236 return m_value <= other.m_value;
1237 }
1238
1240 bool operator>=(const General &other) const
1241 {
1242 return m_value >= other.m_value;
1243 }
1244
1246 friend std::ostream &operator<<(std::ostream &stream, const General &value)
1247 {
1248 return stream << value.toString();
1249 }
1250
1251 private:
1252 void setFromString(const std::string &value);
1253
1254 double m_value{ 0.0 };
1255
1256 friend struct DataModel::Detail::Befriend<General>;
1257 };
1258
1260
1261 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1263 {
1264 public:
1266 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1267
1269 static constexpr const char *path{ "Temperature/LED" };
1270
1272 static constexpr const char *name{ "LED" };
1273
1275 static constexpr const char *description{ R"description(LED temperature)description" };
1276
1278 using ValueType = double;
1279
1281 static constexpr Range<double> validRange()
1282 {
1283 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1284 }
1285
1287 LED() = default;
1288
1290 explicit constexpr LED(double value)
1291 : m_value{ value }
1292 {}
1293
1295 double value() const;
1296
1298 std::string toString() const;
1299
1301 bool operator==(const LED &other) const
1302 {
1303 return m_value == other.m_value;
1304 }
1305
1307 bool operator!=(const LED &other) const
1308 {
1309 return m_value != other.m_value;
1310 }
1311
1313 bool operator<(const LED &other) const
1314 {
1315 return m_value < other.m_value;
1316 }
1317
1319 bool operator>(const LED &other) const
1320 {
1321 return m_value > other.m_value;
1322 }
1323
1325 bool operator<=(const LED &other) const
1326 {
1327 return m_value <= other.m_value;
1328 }
1329
1331 bool operator>=(const LED &other) const
1332 {
1333 return m_value >= other.m_value;
1334 }
1335
1337 friend std::ostream &operator<<(std::ostream &stream, const LED &value)
1338 {
1339 return stream << value.toString();
1340 }
1341
1342 private:
1343 void setFromString(const std::string &value);
1344
1345 double m_value{ 0.0 };
1346
1347 friend struct DataModel::Detail::Befriend<LED>;
1348 };
1349
1351
1352 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1354 {
1355 public:
1357 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1358
1360 static constexpr const char *path{ "Temperature/Lens" };
1361
1363 static constexpr const char *name{ "Lens" };
1364
1366 static constexpr const char *description{ R"description(Lens temperature)description" };
1367
1369 using ValueType = double;
1370
1372 static constexpr Range<double> validRange()
1373 {
1374 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1375 }
1376
1378 Lens() = default;
1379
1381 explicit constexpr Lens(double value)
1382 : m_value{ value }
1383 {}
1384
1386 double value() const;
1387
1389 std::string toString() const;
1390
1392 bool operator==(const Lens &other) const
1393 {
1394 return m_value == other.m_value;
1395 }
1396
1398 bool operator!=(const Lens &other) const
1399 {
1400 return m_value != other.m_value;
1401 }
1402
1404 bool operator<(const Lens &other) const
1405 {
1406 return m_value < other.m_value;
1407 }
1408
1410 bool operator>(const Lens &other) const
1411 {
1412 return m_value > other.m_value;
1413 }
1414
1416 bool operator<=(const Lens &other) const
1417 {
1418 return m_value <= other.m_value;
1419 }
1420
1422 bool operator>=(const Lens &other) const
1423 {
1424 return m_value >= other.m_value;
1425 }
1426
1428 friend std::ostream &operator<<(std::ostream &stream, const Lens &value)
1429 {
1430 return stream << value.toString();
1431 }
1432
1433 private:
1434 void setFromString(const std::string &value);
1435
1436 double m_value{ 0.0 };
1437
1438 friend struct DataModel::Detail::Befriend<Lens>;
1439 };
1440
1442
1443 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1445 {
1446 public:
1448 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1449
1451 static constexpr const char *path{ "Temperature/PCB" };
1452
1454 static constexpr const char *name{ "PCB" };
1455
1457 static constexpr const char *description{ R"description(PCB temperature)description" };
1458
1460 using ValueType = double;
1461
1463 static constexpr Range<double> validRange()
1464 {
1465 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
1466 }
1467
1469 PCB() = default;
1470
1472 explicit constexpr PCB(double value)
1473 : m_value{ value }
1474 {}
1475
1477 double value() const;
1478
1480 std::string toString() const;
1481
1483 bool operator==(const PCB &other) const
1484 {
1485 return m_value == other.m_value;
1486 }
1487
1489 bool operator!=(const PCB &other) const
1490 {
1491 return m_value != other.m_value;
1492 }
1493
1495 bool operator<(const PCB &other) const
1496 {
1497 return m_value < other.m_value;
1498 }
1499
1501 bool operator>(const PCB &other) const
1502 {
1503 return m_value > other.m_value;
1504 }
1505
1507 bool operator<=(const PCB &other) const
1508 {
1509 return m_value <= other.m_value;
1510 }
1511
1513 bool operator>=(const PCB &other) const
1514 {
1515 return m_value >= other.m_value;
1516 }
1517
1519 friend std::ostream &operator<<(std::ostream &stream, const PCB &value)
1520 {
1521 return stream << value.toString();
1522 }
1523
1524 private:
1525 void setFromString(const std::string &value);
1526
1527 double m_value{ 0.0 };
1528
1529 friend struct DataModel::Detail::Befriend<PCB>;
1530 };
1531
1532 using Descendants = std::tuple<
1538
1541
1557#ifndef NO_DOC
1558 template<
1559 typename... Args,
1560 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1561 typename std::enable_if<
1562 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
1563 value,
1564 int>::type = 0>
1565#else
1566 template<typename... Args>
1567#endif
1568 explicit Temperature(Args &&...args)
1569 {
1570 using namespace Zivid::Detail::TypeTraits;
1571
1572 static_assert(
1573 AllArgsDecayedAreUnique<Args...>::value,
1574 "Found duplicate types among the arguments passed to Temperature(...). "
1575 "Types should be listed at most once.");
1576
1577 set(std::forward<Args>(args)...);
1578 }
1579
1594#ifndef NO_DOC
1595 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1596#else
1597 template<typename... Args>
1598#endif
1599 void set(Args &&...args)
1600 {
1601 using namespace Zivid::Detail::TypeTraits;
1602
1603 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1604 static_assert(
1605 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1606
1607 static_assert(
1608 AllArgsDecayedAreUnique<Args...>::value,
1609 "Found duplicate types among the arguments passed to set(...). "
1610 "Types should be listed at most once.");
1611
1612 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1613 }
1614
1630#ifndef NO_DOC
1631 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1632#else
1633 template<typename... Args>
1634#endif
1635 Temperature copyWith(Args &&...args) const
1636 {
1637 using namespace Zivid::Detail::TypeTraits;
1638
1639 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1640 static_assert(
1641 AllArgsAreDescendantNodes::value,
1642 "All arguments passed to copyWith(...) must be descendant nodes.");
1643
1644 static_assert(
1645 AllArgsDecayedAreUnique<Args...>::value,
1646 "Found duplicate types among the arguments passed to copyWith(...). "
1647 "Types should be listed at most once.");
1648
1649 auto copy{ *this };
1650 copy.set(std::forward<Args>(args)...);
1651 return copy;
1652 }
1653
1655 const DMD &dmd() const
1656 {
1657 return m_dmd;
1658 }
1659
1662 {
1663 return m_dmd;
1664 }
1665
1667 Temperature &set(const DMD &value)
1668 {
1669 m_dmd = value;
1670 return *this;
1671 }
1672
1674 const General &general() const
1675 {
1676 return m_general;
1677 }
1678
1681 {
1682 return m_general;
1683 }
1684
1686 Temperature &set(const General &value)
1687 {
1688 m_general = value;
1689 return *this;
1690 }
1691
1693 const LED &led() const
1694 {
1695 return m_led;
1696 }
1697
1700 {
1701 return m_led;
1702 }
1703
1705 Temperature &set(const LED &value)
1706 {
1707 m_led = value;
1708 return *this;
1709 }
1710
1712 const Lens &lens() const
1713 {
1714 return m_lens;
1715 }
1716
1719 {
1720 return m_lens;
1721 }
1722
1724 Temperature &set(const Lens &value)
1725 {
1726 m_lens = value;
1727 return *this;
1728 }
1729
1731 const PCB &pcb() const
1732 {
1733 return m_pcb;
1734 }
1735
1738 {
1739 return m_pcb;
1740 }
1741
1743 Temperature &set(const PCB &value)
1744 {
1745 m_pcb = value;
1746 return *this;
1747 }
1748
1749 template<
1750 typename T,
1751 typename std::enable_if<std::is_same<T, CameraState::Temperature::DMD>::value, int>::type = 0>
1753 {
1754 return m_dmd;
1755 }
1756
1757 template<
1758 typename T,
1759 typename std::enable_if<std::is_same<T, CameraState::Temperature::General>::value, int>::type = 0>
1761 {
1762 return m_general;
1763 }
1764
1765 template<
1766 typename T,
1767 typename std::enable_if<std::is_same<T, CameraState::Temperature::LED>::value, int>::type = 0>
1769 {
1770 return m_led;
1771 }
1772
1773 template<
1774 typename T,
1775 typename std::enable_if<std::is_same<T, CameraState::Temperature::Lens>::value, int>::type = 0>
1777 {
1778 return m_lens;
1779 }
1780
1781 template<
1782 typename T,
1783 typename std::enable_if<std::is_same<T, CameraState::Temperature::PCB>::value, int>::type = 0>
1785 {
1786 return m_pcb;
1787 }
1788
1789 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1791 {
1792 return m_dmd;
1793 }
1794
1795 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1797 {
1798 return m_general;
1799 }
1800
1801 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
1803 {
1804 return m_led;
1805 }
1806
1807 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
1809 {
1810 return m_lens;
1811 }
1812
1813 template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
1815 {
1816 return m_pcb;
1817 }
1818
1820 template<typename F>
1821 void forEach(const F &f) const
1822 {
1823 f(m_dmd);
1824 f(m_general);
1825 f(m_led);
1826 f(m_lens);
1827 f(m_pcb);
1828 }
1829
1831 template<typename F>
1832 void forEach(const F &f)
1833 {
1834 f(m_dmd);
1835 f(m_general);
1836 f(m_led);
1837 f(m_lens);
1838 f(m_pcb);
1839 }
1840
1842 bool operator==(const Temperature &other) const;
1843
1845 bool operator!=(const Temperature &other) const;
1846
1848 std::string toString() const;
1849
1851 friend std::ostream &operator<<(std::ostream &stream, const Temperature &value)
1852 {
1853 return stream << value.toString();
1854 }
1855
1856 private:
1857 void setFromString(const std::string &value);
1858
1859 void setFromString(const std::string &fullPath, const std::string &value);
1860
1861 std::string getString(const std::string &fullPath) const;
1862
1863 DMD m_dmd;
1864 General m_general;
1865 LED m_led;
1866 Lens m_lens;
1867 PCB m_pcb;
1868
1869 friend struct DataModel::Detail::Befriend<Temperature>;
1870 };
1871
1872 using Descendants = std::tuple<
1886
1889
1891 explicit CameraState(const std::string &fileName);
1892
1916#ifndef NO_DOC
1917 template<
1918 typename... Args,
1919 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1920 typename std::enable_if<
1921 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
1922 int>::type = 0>
1923#else
1924 template<typename... Args>
1925#endif
1926 explicit CameraState(Args &&...args)
1927 {
1928 using namespace Zivid::Detail::TypeTraits;
1929
1930 static_assert(
1931 AllArgsDecayedAreUnique<Args...>::value,
1932 "Found duplicate types among the arguments passed to CameraState(...). "
1933 "Types should be listed at most once.");
1934
1935 set(std::forward<Args>(args)...);
1936 }
1937
1960#ifndef NO_DOC
1961 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1962#else
1963 template<typename... Args>
1964#endif
1965 void set(Args &&...args)
1966 {
1967 using namespace Zivid::Detail::TypeTraits;
1968
1969 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1970 static_assert(
1971 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1972
1973 static_assert(
1974 AllArgsDecayedAreUnique<Args...>::value,
1975 "Found duplicate types among the arguments passed to set(...). "
1976 "Types should be listed at most once.");
1977
1978 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1979 }
1980
2004#ifndef NO_DOC
2005 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
2006#else
2007 template<typename... Args>
2008#endif
2009 CameraState copyWith(Args &&...args) const
2010 {
2011 using namespace Zivid::Detail::TypeTraits;
2012
2013 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2014 static_assert(
2015 AllArgsAreDescendantNodes::value, "All arguments passed to copyWith(...) must be descendant nodes.");
2016
2017 static_assert(
2018 AllArgsDecayedAreUnique<Args...>::value,
2019 "Found duplicate types among the arguments passed to copyWith(...). "
2020 "Types should be listed at most once.");
2021
2022 auto copy{ *this };
2023 copy.set(std::forward<Args>(args)...);
2024 return copy;
2025 }
2026
2028 const Available &isAvailable() const
2029 {
2030 return m_available;
2031 }
2032
2035 {
2036 return m_available;
2037 }
2038
2041 {
2042 m_available = value;
2043 return *this;
2044 }
2045
2047 const Connected &isConnected() const
2048 {
2049 return m_connected;
2050 }
2051
2054 {
2055 return m_connected;
2056 }
2057
2060 {
2061 m_connected = value;
2062 return *this;
2063 }
2064
2067 {
2068 return m_inaccessibleReason;
2069 }
2070
2073 {
2074 return m_inaccessibleReason;
2075 }
2076
2079 {
2080 m_inaccessibleReason = value;
2081 return *this;
2082 }
2083
2085 const Network &network() const
2086 {
2087 return m_network;
2088 }
2089
2092 {
2093 return m_network;
2094 }
2095
2097 CameraState &set(const Network &value)
2098 {
2099 m_network = value;
2100 return *this;
2101 }
2102
2105 {
2106 m_network.set(value);
2107 return *this;
2108 }
2109
2112 {
2113 m_network.set(value);
2114 return *this;
2115 }
2116
2118 const Status &status() const
2119 {
2120 return m_status;
2121 }
2122
2125 {
2126 return m_status;
2127 }
2128
2130 CameraState &set(const Status &value)
2131 {
2132 m_status = value;
2133 return *this;
2134 }
2135
2138 {
2139 return m_temperature;
2140 }
2141
2144 {
2145 return m_temperature;
2146 }
2147
2150 {
2151 m_temperature = value;
2152 return *this;
2153 }
2154
2157 {
2158 m_temperature.set(value);
2159 return *this;
2160 }
2161
2164 {
2165 m_temperature.set(value);
2166 return *this;
2167 }
2168
2171 {
2172 m_temperature.set(value);
2173 return *this;
2174 }
2175
2178 {
2179 m_temperature.set(value);
2180 return *this;
2181 }
2182
2185 {
2186 m_temperature.set(value);
2187 return *this;
2188 }
2189
2190 template<typename T, typename std::enable_if<std::is_same<T, CameraState::Available>::value, int>::type = 0>
2192 {
2193 return m_available;
2194 }
2195
2196 template<typename T, typename std::enable_if<std::is_same<T, CameraState::Connected>::value, int>::type = 0>
2198 {
2199 return m_connected;
2200 }
2201
2202 template<
2203 typename T,
2204 typename std::enable_if<std::is_same<T, CameraState::InaccessibleReason>::value, int>::type = 0>
2206 {
2207 return m_inaccessibleReason;
2208 }
2209
2210 template<typename T, typename std::enable_if<std::is_same<T, CameraState::Network>::value, int>::type = 0>
2212 {
2213 return m_network;
2214 }
2215
2216 template<typename T, typename std::enable_if<std::is_same<T, CameraState::Network::IPV4>::value, int>::type = 0>
2218 {
2219 return m_network.get<CameraState::Network::IPV4>();
2220 }
2221
2222 template<
2223 typename T,
2224 typename std::enable_if<std::is_same<T, CameraState::Network::IPV4::Address>::value, int>::type = 0>
2226 {
2227 return m_network.get<CameraState::Network::IPV4::Address>();
2228 }
2229
2230 template<typename T, typename std::enable_if<std::is_same<T, CameraState::Status>::value, int>::type = 0>
2232 {
2233 return m_status;
2234 }
2235
2236 template<typename T, typename std::enable_if<std::is_same<T, CameraState::Temperature>::value, int>::type = 0>
2238 {
2239 return m_temperature;
2240 }
2241
2242 template<
2243 typename T,
2244 typename std::enable_if<std::is_same<T, CameraState::Temperature::DMD>::value, int>::type = 0>
2246 {
2247 return m_temperature.get<CameraState::Temperature::DMD>();
2248 }
2249
2250 template<
2251 typename T,
2252 typename std::enable_if<std::is_same<T, CameraState::Temperature::General>::value, int>::type = 0>
2254 {
2255 return m_temperature.get<CameraState::Temperature::General>();
2256 }
2257
2258 template<
2259 typename T,
2260 typename std::enable_if<std::is_same<T, CameraState::Temperature::LED>::value, int>::type = 0>
2262 {
2263 return m_temperature.get<CameraState::Temperature::LED>();
2264 }
2265
2266 template<
2267 typename T,
2268 typename std::enable_if<std::is_same<T, CameraState::Temperature::Lens>::value, int>::type = 0>
2270 {
2271 return m_temperature.get<CameraState::Temperature::Lens>();
2272 }
2273
2274 template<
2275 typename T,
2276 typename std::enable_if<std::is_same<T, CameraState::Temperature::PCB>::value, int>::type = 0>
2278 {
2279 return m_temperature.get<CameraState::Temperature::PCB>();
2280 }
2281
2282 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2284 {
2285 return m_available;
2286 }
2287
2288 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
2290 {
2291 return m_connected;
2292 }
2293
2294 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
2296 {
2297 return m_inaccessibleReason;
2298 }
2299
2300 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
2302 {
2303 return m_network;
2304 }
2305
2306 template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
2308 {
2309 return m_status;
2310 }
2311
2312 template<size_t i, typename std::enable_if<i == 5, int>::type = 0>
2314 {
2315 return m_temperature;
2316 }
2317
2319 template<typename F>
2320 void forEach(const F &f) const
2321 {
2322 f(m_available);
2323 f(m_connected);
2324 f(m_inaccessibleReason);
2325 f(m_network);
2326 f(m_status);
2327 f(m_temperature);
2328 }
2329
2331 template<typename F>
2332 void forEach(const F &f)
2333 {
2334 f(m_available);
2335 f(m_connected);
2336 f(m_inaccessibleReason);
2337 f(m_network);
2338 f(m_status);
2339 f(m_temperature);
2340 }
2341
2343 bool operator==(const CameraState &other) const;
2344
2346 bool operator!=(const CameraState &other) const;
2347
2349 std::string toString() const;
2350
2352 friend std::ostream &operator<<(std::ostream &stream, const CameraState &value)
2353 {
2354 return stream << value.toString();
2355 }
2356
2358 void save(const std::string &fileName) const;
2359
2361 void load(const std::string &fileName);
2362
2363 private:
2364 void setFromString(const std::string &value);
2365
2366 void setFromString(const std::string &fullPath, const std::string &value);
2367
2368 std::string getString(const std::string &fullPath) const;
2369
2370 Available m_available;
2371 Connected m_connected;
2372 InaccessibleReason m_inaccessibleReason;
2373 Network m_network;
2374 Status m_status;
2375 Temperature m_temperature;
2376
2377 friend struct DataModel::Detail::Befriend<CameraState>;
2378 };
2379
2380#ifndef NO_DOC
2382 namespace Detail
2383 {
2384 ZIVID_CORE_EXPORT void save(const CameraState &dataModel, std::ostream &ostream);
2385 ZIVID_CORE_EXPORT void load(CameraState &dataModel, std::istream &istream);
2386 } // namespace Detail
2387#endif
2388
2389#ifndef NO_DOC
2390 template<>
2391 struct CameraState::Version<5>
2392 {
2393 using Type = CameraState;
2394 };
2395#endif
2396
2397} // namespace Zivid
2398
2399#ifdef _MSC_VER
2400# pragma warning(pop)
2401#endif
2402
2403#ifndef NO_DOC
2404# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
2405namespace std // NOLINT
2406{
2407
2408 template<>
2409 struct tuple_size<Zivid::CameraState::Network> : integral_constant<size_t, 1>
2410 {};
2411
2412 template<size_t i>
2413 struct tuple_element<i, Zivid::CameraState::Network>
2414 {
2415 static_assert(i < tuple_size<Zivid::CameraState::Network>::value, "Index must be less than 1");
2416
2417 using type // NOLINT
2418 = decltype(declval<Zivid::CameraState::Network>().get<i>());
2419 };
2420
2421 template<>
2422 struct tuple_size<Zivid::CameraState::Network::IPV4> : integral_constant<size_t, 1>
2423 {};
2424
2425 template<size_t i>
2426 struct tuple_element<i, Zivid::CameraState::Network::IPV4>
2427 {
2428 static_assert(i < tuple_size<Zivid::CameraState::Network::IPV4>::value, "Index must be less than 1");
2429
2430 using type // NOLINT
2431 = decltype(declval<Zivid::CameraState::Network::IPV4>().get<i>());
2432 };
2433
2434 template<>
2435 struct tuple_size<Zivid::CameraState::Temperature> : integral_constant<size_t, 5>
2436 {};
2437
2438 template<size_t i>
2439 struct tuple_element<i, Zivid::CameraState::Temperature>
2440 {
2441 static_assert(i < tuple_size<Zivid::CameraState::Temperature>::value, "Index must be less than 5");
2442
2443 using type // NOLINT
2444 = decltype(declval<Zivid::CameraState::Temperature>().get<i>());
2445 };
2446
2447 template<>
2448 struct tuple_size<Zivid::CameraState> : integral_constant<size_t, 6>
2449 {};
2450
2451 template<size_t i>
2452 struct tuple_element<i, Zivid::CameraState>
2453 {
2454 static_assert(i < tuple_size<Zivid::CameraState>::value, "Index must be less than 6");
2455
2456 using type // NOLINT
2457 = decltype(declval<Zivid::CameraState>().get<i>());
2458 };
2459
2460} // namespace std
2461# endif
2462#endif
2463
2464// If we have access to the DataModel library, automatically include internal DataModel
2465// header. This header is necessary for serialization and deserialization.
2466#if defined(__has_include) && !defined(NO_DOC)
2467# if __has_include("Zivid/CameraStateInternal.h") && __has_include("Zivid/DataModelNodeMetaData.h")
2468# include "Zivid/CameraStateInternal.h"
2469# endif
2470#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:115
static std::set< bool > validValues()
All valid values of Available.
Definition CameraState.h:140
static const Available no
Off/disabled.
Definition CameraState.h:137
bool operator==(const Available &other) const
Comparison operator.
Definition CameraState.h:166
std::string toString() const
Get the value as string.
bool ValueType
The type of the underlying value.
Definition CameraState.h:135
static const Available yes
On/enabled.
Definition CameraState.h:136
friend std::ostream & operator<<(std::ostream &stream, const Available &value)
Operator to serialize the value to a stream.
Definition CameraState.h:178
bool operator!=(const Available &other) const
Comparison operator.
Definition CameraState.h:172
constexpr Available(bool value)
Constructor.
Definition CameraState.h:149
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:197
Connected()=default
Default constructor.
static const Connected yes
On/enabled.
Definition CameraState.h:217
static const Connected no
Off/disabled.
Definition CameraState.h:218
bool operator!=(const Connected &other) const
Comparison operator.
Definition CameraState.h:253
constexpr Connected(bool value)
Constructor.
Definition CameraState.h:230
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:259
static std::set< bool > validValues()
All valid values of Connected.
Definition CameraState.h:221
bool operator==(const Connected &other) const
Comparison operator.
Definition CameraState.h:247
bool ValueType
The type of the underlying value.
Definition CameraState.h:216
If the camera status is inaccessible, then this enum value will give you the reason.
Definition CameraState.h:276
static const InaccessibleReason ipNotInLocalSubnet
ipNotInLocalSubnet
Definition CameraState.h:302
constexpr InaccessibleReason(ValueType value)
Constructor.
Definition CameraState.h:318
bool hasValue() const
Check if the value is set.
static const InaccessibleReason ipConflictWithAnotherCamera
ipConflictWithAnotherCamera
Definition CameraState.h:300
friend std::ostream & operator<<(std::ostream &stream, const InaccessibleReason::ValueType &value)
Operator to serialize ValueType to a stream.
Definition CameraState.h:338
bool operator==(const InaccessibleReason &other) const
Comparison operator.
Definition CameraState.h:344
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:356
static const InaccessibleReason ipConflictWithLocalNetworkAdapter
ipConflictWithLocalNetworkAdapter
Definition CameraState.h:301
InaccessibleReason()=default
Default constructor.
static const InaccessibleReason ipInMultipleLocalSubnets
ipInMultipleLocalSubnets
Definition CameraState.h:303
ValueType
The type of the underlying value.
Definition CameraState.h:294
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:350
static std::set< ValueType > validValues()
All valid values of InaccessibleReason.
Definition CameraState.h:306
Current IPv4 address.
Definition CameraState.h:421
Address()=default
Default constructor.
bool operator<(const Address &other) const
Comparison operator.
Definition CameraState.h:471
bool operator==(const Address &other) const
Comparison operator.
Definition CameraState.h:459
bool operator<=(const Address &other) const
Comparison operator.
Definition CameraState.h:483
static constexpr Range< ValueType::size_type > validSize()
The valid sizes for Address.
Definition CameraState.h:439
bool operator>(const Address &other) const
Comparison operator.
Definition CameraState.h:477
bool operator!=(const Address &other) const
Comparison operator.
Definition CameraState.h:465
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:495
bool operator>=(const Address &other) const
Comparison operator.
Definition CameraState.h:489
Address(std::string value)
Constructor.
Definition CameraState.h:448
std::string toString() const
Get the value as string.
std::string ValueType
The type of the underlying value.
Definition CameraState.h:436
Current IPv4 protocol state.
Definition CameraState.h:403
IPV4()
Default constructor.
void set(Args &&...args)
Set multiple arguments.
Definition CameraState.h:562
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:650
const Address & address() const
Get Address.
Definition CameraState.h:616
friend std::ostream & operator<<(std::ostream &stream, const IPV4 &value)
Operator to send the value as string to a stream.
Definition CameraState.h:672
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:595
const CameraState::Network::IPV4::Address & get() const
Definition CameraState.h:637
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:657
IPV4 & set(const Address &value)
Set Address.
Definition CameraState.h:628
std::string toString() const
Get the value as string.
std::tuple< CameraState::Network::IPV4::Address > Descendants
Definition CameraState.h:508
Address & address()
Get Address.
Definition CameraState.h:622
bool operator!=(const IPV4 &other) const
Inequality operator.
Current network state.
Definition CameraState.h:385
void set(Args &&...args)
Set multiple arguments.
Definition CameraState.h:745
std::tuple< CameraState::Network::IPV4, CameraState::Network::IPV4::Address > Descendants
Definition CameraState.h:689
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:869
bool operator==(const Network &other) const
Equality operator.
Network()
Default constructor.
Network & set(const IPV4 &value)
Set IPV4.
Definition CameraState.h:810
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:778
const CameraState::Network::IPV4::Address & get() const
Definition CameraState.h:834
const CameraState::Network::IPV4 & get() const
Definition CameraState.h:826
Network & set(const IPV4::Address &value)
Set IPV4::Address.
Definition CameraState.h:817
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:854
IPV4 & ipv4()
Get IPV4.
Definition CameraState.h:804
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:847
const IPV4 & ipv4() const
Get IPV4.
Definition CameraState.h:798
This enum describes the current status of this camera. The enum can have the following values:
Definition CameraState.h:921
constexpr Status(ValueType value)
Constructor.
Definition CameraState.h:1003
static std::set< ValueType > validValues()
All valid values of Status.
Definition CameraState.h:992
static const Status connected
connected
Definition CameraState.h:987
static const Status disconnecting
disconnecting
Definition CameraState.h:988
static const Status inaccessible
inaccessible
Definition CameraState.h:981
std::string toString() const
Get the value as string.
ValueType
The type of the underlying value.
Definition CameraState.h:970
friend std::ostream & operator<<(std::ostream &stream, const Status &value)
Operator to serialize the value to a stream.
Definition CameraState.h:1032
static const Status firmwareUpdateRequired
firmwareUpdateRequired
Definition CameraState.h:983
ValueType value() const
Get the value.
bool operator!=(const Status &other) const
Comparison operator.
Definition CameraState.h:1026
static const Status connecting
connecting
Definition CameraState.h:986
bool operator==(const Status &other) const
Comparison operator.
Definition CameraState.h:1020
static const Status busy
busy
Definition CameraState.h:982
Status()=default
Default constructor.
static const Status available
available
Definition CameraState.h:985
static const Status updatingFirmware
updatingFirmware
Definition CameraState.h:984
static const Status disappeared
disappeared
Definition CameraState.h:989
friend std::ostream & operator<<(std::ostream &stream, const Status::ValueType &value)
Operator to serialize ValueType to a stream.
Definition CameraState.h:1014
DMD temperature.
Definition CameraState.h:1081
bool operator>(const DMD &other) const
Comparison operator.
Definition CameraState.h:1137
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:1125
bool operator<(const DMD &other) const
Comparison operator.
Definition CameraState.h:1131
bool operator>=(const DMD &other) const
Comparison operator.
Definition CameraState.h:1149
double ValueType
The type of the underlying value.
Definition CameraState.h:1096
bool operator<=(const DMD &other) const
Comparison operator.
Definition CameraState.h:1143
friend std::ostream & operator<<(std::ostream &stream, const DMD &value)
Operator to serialize the value to a stream.
Definition CameraState.h:1155
constexpr DMD(double value)
Constructor.
Definition CameraState.h:1108
bool operator==(const DMD &other) const
Comparison operator.
Definition CameraState.h:1119
static constexpr Range< double > validRange()
The range of valid values for DMD.
Definition CameraState.h:1099
DMD()=default
Default constructor.
General temperature.
Definition CameraState.h:1172
double ValueType
The type of the underlying value.
Definition CameraState.h:1187
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:1222
constexpr General(double value)
Constructor.
Definition CameraState.h:1199
static constexpr Range< double > validRange()
The range of valid values for General.
Definition CameraState.h:1190
bool operator==(const General &other) const
Comparison operator.
Definition CameraState.h:1210
General()=default
Default constructor.
bool operator<=(const General &other) const
Comparison operator.
Definition CameraState.h:1234
bool operator!=(const General &other) const
Comparison operator.
Definition CameraState.h:1216
bool operator>(const General &other) const
Comparison operator.
Definition CameraState.h:1228
friend std::ostream & operator<<(std::ostream &stream, const General &value)
Operator to serialize the value to a stream.
Definition CameraState.h:1246
bool operator>=(const General &other) const
Comparison operator.
Definition CameraState.h:1240
LED temperature.
Definition CameraState.h:1263
bool operator<=(const LED &other) const
Comparison operator.
Definition CameraState.h:1325
std::string toString() const
Get the value as string.
bool operator<(const LED &other) const
Comparison operator.
Definition CameraState.h:1313
double value() const
Get the value.
LED()=default
Default constructor.
constexpr LED(double value)
Constructor.
Definition CameraState.h:1290
friend std::ostream & operator<<(std::ostream &stream, const LED &value)
Operator to serialize the value to a stream.
Definition CameraState.h:1337
bool operator!=(const LED &other) const
Comparison operator.
Definition CameraState.h:1307
bool operator==(const LED &other) const
Comparison operator.
Definition CameraState.h:1301
bool operator>=(const LED &other) const
Comparison operator.
Definition CameraState.h:1331
bool operator>(const LED &other) const
Comparison operator.
Definition CameraState.h:1319
static constexpr Range< double > validRange()
The range of valid values for LED.
Definition CameraState.h:1281
double ValueType
The type of the underlying value.
Definition CameraState.h:1278
Lens temperature.
Definition CameraState.h:1354
double ValueType
The type of the underlying value.
Definition CameraState.h:1369
bool operator==(const Lens &other) const
Comparison operator.
Definition CameraState.h:1392
Lens()=default
Default constructor.
bool operator<=(const Lens &other) const
Comparison operator.
Definition CameraState.h:1416
double value() const
Get the value.
bool operator>(const Lens &other) const
Comparison operator.
Definition CameraState.h:1410
bool operator!=(const Lens &other) const
Comparison operator.
Definition CameraState.h:1398
bool operator>=(const Lens &other) const
Comparison operator.
Definition CameraState.h:1422
std::string toString() const
Get the value as string.
constexpr Lens(double value)
Constructor.
Definition CameraState.h:1381
static constexpr Range< double > validRange()
The range of valid values for Lens.
Definition CameraState.h:1372
bool operator<(const Lens &other) const
Comparison operator.
Definition CameraState.h:1404
friend std::ostream & operator<<(std::ostream &stream, const Lens &value)
Operator to serialize the value to a stream.
Definition CameraState.h:1428
PCB temperature.
Definition CameraState.h:1445
bool operator!=(const PCB &other) const
Comparison operator.
Definition CameraState.h:1489
constexpr PCB(double value)
Constructor.
Definition CameraState.h:1472
static constexpr Range< double > validRange()
The range of valid values for PCB.
Definition CameraState.h:1463
bool operator>=(const PCB &other) const
Comparison operator.
Definition CameraState.h:1513
PCB()=default
Default constructor.
bool operator<=(const PCB &other) const
Comparison operator.
Definition CameraState.h:1507
friend std::ostream & operator<<(std::ostream &stream, const PCB &value)
Operator to serialize the value to a stream.
Definition CameraState.h:1519
bool operator==(const PCB &other) const
Comparison operator.
Definition CameraState.h:1483
double value() const
Get the value.
bool operator>(const PCB &other) const
Comparison operator.
Definition CameraState.h:1501
double ValueType
The type of the underlying value.
Definition CameraState.h:1460
std::string toString() const
Get the value as string.
bool operator<(const PCB &other) const
Comparison operator.
Definition CameraState.h:1495
Current temperature(s)
Definition CameraState.h:1063
DMD & dmd()
Get DMD.
Definition CameraState.h:1661
Temperature & set(const General &value)
Set General.
Definition CameraState.h:1686
const PCB & pcb() const
Get PCB.
Definition CameraState.h:1731
const CameraState::Temperature::Lens & get() const
Definition CameraState.h:1776
Temperature & set(const Lens &value)
Set Lens.
Definition CameraState.h:1724
const CameraState::Temperature::DMD & get() const
Definition CameraState.h:1752
const CameraState::Temperature::PCB & get() const
Definition CameraState.h:1784
const CameraState::Temperature::General & get() const
Definition CameraState.h:1760
Temperature & set(const PCB &value)
Set PCB.
Definition CameraState.h:1743
const General & general() const
Get General.
Definition CameraState.h:1674
bool operator!=(const Temperature &other) const
Inequality operator.
const LED & led() const
Get LED.
Definition CameraState.h:1693
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:1821
friend std::ostream & operator<<(std::ostream &stream, const Temperature &value)
Operator to send the value as string to a stream.
Definition CameraState.h:1851
std::tuple< CameraState::Temperature::DMD, CameraState::Temperature::General, CameraState::Temperature::LED, CameraState::Temperature::Lens, CameraState::Temperature::PCB > Descendants
Definition CameraState.h:1537
Temperature & set(const LED &value)
Set LED.
Definition CameraState.h:1705
std::string toString() const
Get the value as string.
LED & led()
Get LED.
Definition CameraState.h:1699
bool operator==(const Temperature &other) const
Equality operator.
const Lens & lens() const
Get Lens.
Definition CameraState.h:1712
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:1635
General & general()
Get General.
Definition CameraState.h:1680
void set(Args &&...args)
Set multiple arguments.
Definition CameraState.h:1599
const DMD & dmd() const
Get DMD.
Definition CameraState.h:1655
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:1832
const CameraState::Temperature::LED & get() const
Definition CameraState.h:1768
Lens & lens()
Get Lens.
Definition CameraState.h:1718
Temperature()
Default constructor.
Temperature & set(const DMD &value)
Set DMD.
Definition CameraState.h:1667
PCB & pcb()
Get PCB.
Definition CameraState.h:1737
Information about camera connection state, temperatures, etc.
Definition CameraState.h:78
const Temperature & temperature() const
Get Temperature.
Definition CameraState.h:2137
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:2009
const CameraState::Network::IPV4 & get() const
Definition CameraState.h:2217
const CameraState::Temperature::Lens & get() const
Definition CameraState.h:2269
void load(const std::string &fileName)
Load from the given file.
CameraState(const std::string &fileName)
Construct CameraState by loading from file.
CameraState & set(const Temperature &value)
Set Temperature.
Definition CameraState.h:2149
const CameraState::Connected & get() const
Definition CameraState.h:2197
Temperature & temperature()
Get Temperature.
Definition CameraState.h:2143
const CameraState::Temperature::General & get() const
Definition CameraState.h:2253
std::string toString() const
Get the value as string.
CameraState & set(const Network &value)
Set Network.
Definition CameraState.h:2097
const CameraState::Status & get() const
Definition CameraState.h:2231
const CameraState::InaccessibleReason & get() const
Definition CameraState.h:2205
const CameraState::Available & get() const
Definition CameraState.h:2191
const CameraState::Network::IPV4::Address & get() const
Definition CameraState.h:2225
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition CameraState.h:2332
void save(const std::string &fileName) const
Save to the given file.
const CameraState::Network & get() const
Definition CameraState.h:2211
const CameraState::Temperature::PCB & get() const
Definition CameraState.h:2277
CameraState & set(const Temperature::PCB &value)
Set Temperature::PCB.
Definition CameraState.h:2184
const InaccessibleReason & inaccessibleReason() const
Get InaccessibleReason.
Definition CameraState.h:2066
const CameraState::Temperature::LED & get() const
Definition CameraState.h:2261
CameraState & set(const Temperature::General &value)
Set Temperature::General.
Definition CameraState.h:2163
friend std::ostream & operator<<(std::ostream &stream, const CameraState &value)
Operator to send the value as string to a stream.
Definition CameraState.h:2352
bool operator!=(const CameraState &other) const
Inequality operator.
CameraState & set(const Network::IPV4 &value)
Set Network::IPV4.
Definition CameraState.h:2104
CameraState & set(const Network::IPV4::Address &value)
Set Network::IPV4::Address.
Definition CameraState.h:2111
Status & status()
Get Status.
Definition CameraState.h:2124
const Available & isAvailable() const
Get Available.
Definition CameraState.h:2028
const Status & status() const
Get Status.
Definition CameraState.h:2118
Connected & isConnected()
Get Connected.
Definition CameraState.h:2053
CameraState & set(const Temperature::Lens &value)
Set Temperature::Lens.
Definition CameraState.h:2177
CameraState & set(const Available &value)
Set Available.
Definition CameraState.h:2040
CameraState & set(const Temperature::DMD &value)
Set Temperature::DMD.
Definition CameraState.h:2156
bool operator==(const CameraState &other) const
Equality operator.
CameraState()
Default constructor.
CameraState & set(const Status &value)
Set Status.
Definition CameraState.h:2130
CameraState & set(const InaccessibleReason &value)
Set InaccessibleReason.
Definition CameraState.h:2078
CameraState & set(const Connected &value)
Set Connected.
Definition CameraState.h:2059
Network & network()
Get Network.
Definition CameraState.h:2091
CameraState(Args &&...args)
Constructor taking variadic number of arguments.
Definition CameraState.h:1926
const CameraState::Temperature & get() const
Definition CameraState.h:2237
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:2320
std::tuple< CameraState::Available, CameraState::Connected, CameraState::InaccessibleReason, CameraState::Network, CameraState::Network::IPV4, CameraState::Network::IPV4::Address, CameraState::Status, CameraState::Temperature, CameraState::Temperature::DMD, CameraState::Temperature::General, CameraState::Temperature::LED, CameraState::Temperature::Lens, CameraState::Temperature::PCB > Descendants
Definition CameraState.h:1885
void set(Args &&...args)
Set multiple arguments.
Definition CameraState.h:1965
InaccessibleReason & inaccessibleReason()
Get InaccessibleReason.
Definition CameraState.h:2072
CameraState & set(const Temperature::LED &value)
Set Temperature::LED.
Definition CameraState.h:2170
const CameraState::Temperature::DMD & get() const
Definition CameraState.h:2245
const Network & network() const
Get Network.
Definition CameraState.h:2085
const Connected & isConnected() const
Get Connected.
Definition CameraState.h:2047
Available & isAvailable()
Get Available.
Definition CameraState.h:2034
Class describing a range of values for a given type T.
Definition Range.h:73
NodeType
Definition NodeType.h:55
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:54