Zivid C++ API 2.9.0+4dbba385-1
Defining the Future of 3D Machine Vision
Settings2D.h
Go to the documentation of this file.
1
2
3/*******************************************************************************
4
5 * This file is part of the Zivid 3D Camera API
6
7 *
8
9 * Copyright 2015-2023 (C) Zivid AS
10
11 * All rights reserved.
12
13 *
14
15 * Zivid Software License, v1.0
16
17 *
18
19 * Redistribution and use in source and binary forms, with or without
20
21 * modification, are permitted provided that the following conditions are met:
22
23 *
24
25 * 1. Redistributions of source code must retain the above copyright notice,
26
27 * this list of conditions and the following disclaimer.
28
29 *
30
31 * 2. Redistributions in binary form must reproduce the above copyright notice,
32
33 * this list of conditions and the following disclaimer in the documentation
34
35 * and/or other materials provided with the distribution.
36
37 *
38
39 * 3. Neither the name of Zivid AS nor the names of its contributors may be used
40
41 * to endorse or promote products derived from this software without specific
42
43 * prior written permission.
44
45 *
46
47 * 4. This software, with or without modification, must not be used with any
48
49 * other 3D camera than from Zivid AS.
50
51 *
52
53 * 5. Any software provided in binary form under this license must not be
54
55 * reverse engineered, decompiled, modified and/or disassembled.
56
57 *
58
59 * THIS SOFTWARE IS PROVIDED BY ZIVID AS "AS IS" AND ANY EXPRESS OR IMPLIED
60
61 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
62
63 * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
64
65 * DISCLAIMED. IN NO EVENT SHALL ZIVID AS OR CONTRIBUTORS BE LIABLE FOR ANY
66
67 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
68
69 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
70
71 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
72
73 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
74
75 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
76
77 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
78
79 *
80
81 * Contact: Zivid Customer Success Team <customersuccess@zivid.com>
82
83 * Info: http://www.zivid.com
84
85 ******************************************************************************/
86
87
88
89#pragma once
90
91#include <array>
92#include <chrono>
93#include <cmath>
94#include <ctime>
95#include <iomanip>
96#include <memory>
97#include <set>
98#include <sstream>
99#include <string>
100#include <tuple>
101#include <utility>
102#include <vector>
103
109#include "Zivid/Range.h"
110
111#ifdef _MSC_VER
112# pragma warning(push)
113# pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
114#endif
115
116namespace Zivid
117{
118
120
121 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
123 {
124 public:
127
129 static constexpr const char *path{ "" };
130
132 static constexpr const char *name{ "Settings2D" };
133
135 static constexpr const char *description{
136 R"description(Settings used when capturing 2D images with a Zivid camera)description"
137 };
138
139 static constexpr size_t version{ 3 };
140
141#ifndef NO_DOC
142 template<size_t>
143 struct Version;
144
145 using LatestVersion = Zivid::Settings2D;
146
147 // Short identifier. This value is not guaranteed to be universally unique
148 // Todo(ZIVID-2808): Move this to internal DataModelExt header
149 static constexpr std::array<uint8_t, 3> binaryId{ 's', 't', '2' };
150
151#endif
152
154
155 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
157 {
158 public:
161
163 static constexpr const char *path{ "Acquisition" };
164
166 static constexpr const char *name{ "Acquisition" };
167
169 static constexpr const char *description{ R"description(Settings for a single acquisition)description" };
170
174
175 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
177 {
178 public:
181
183 static constexpr const char *path{ "Acquisition/Aperture" };
184
186 static constexpr const char *name{ "Aperture" };
187
189 static constexpr const char *description{
190 R"description(Aperture setting for the camera. Specified as an f-number (the ratio of lens focal length to
191the effective aperture diameter).
192)description"
193 };
194
196 using ValueType = double;
197
199 static constexpr Range<double> validRange()
200 {
201 return { 1.4, 32.0 };
202 }
203
205 Aperture() = default;
206
208 explicit constexpr Aperture(double value)
209 : m_opt{ verifyValue(value) }
210 {}
211
216 double value() const;
217
219 bool hasValue() const;
220
222 void reset();
223
225 std::string toString() const;
226
228 bool operator==(const Aperture &other) const
229 {
230 return m_opt == other.m_opt;
231 }
232
234 bool operator!=(const Aperture &other) const
235 {
236 return m_opt != other.m_opt;
237 }
238
240 bool operator<(const Aperture &other) const
241 {
242 return m_opt < other.m_opt;
243 }
244
246 bool operator>(const Aperture &other) const
247 {
248 return m_opt > other.m_opt;
249 }
250
252 bool operator<=(const Aperture &other) const
253 {
254 return m_opt <= other.m_opt;
255 }
256
258 bool operator>=(const Aperture &other) const
259 {
260 return m_opt >= other.m_opt;
261 }
262
264 friend std::ostream &operator<<(std::ostream &stream, const Aperture &value)
265 {
266 return stream << value.toString();
267 }
268
269 private:
270 void setFromString(const std::string &value);
271
272 constexpr ValueType static verifyValue(const ValueType &value)
273 {
274 return validRange().isInRange(value)
275 ? value
276 : throw std::out_of_range{ "Aperture{ " + std::to_string(value) + " } is not in range ["
277 + std::to_string(validRange().min()) + ", "
278 + std::to_string(validRange().max()) + "]" };
279 }
280
281 Zivid::DataModel::Detail::Optional<double> m_opt;
282
283 friend struct DataModel::Detail::Befriend<Aperture>;
284 };
285
297
298 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
300 {
301 public:
304
306 static constexpr const char *path{ "Acquisition/Brightness" };
307
309 static constexpr const char *name{ "Brightness" };
310
312 static constexpr const char *description{
313 R"description(Brightness controls the light output from the projector.
314
315Brightness above 1.0 may be needed when the distance between the camera and the scene is large,
316or in case of high levels of ambient lighting.
317
318When brightness is above 1.0 the duty cycle of the camera (the percentage of time the camera
319can capture) will be reduced. The duty cycle in boost mode is 50%. The duty cycle is calculated
320over a 10 second period. This limitation is enforced automatically by the camera. Calling capture
321when the duty cycle limit has been reached will cause the camera to first wait (sleep) for a
322duration of time to cool down, before capture will start.
323)description"
324 };
325
327 using ValueType = double;
328
330 static constexpr Range<double> validRange()
331 {
332 return { 0, 2.5 };
333 }
334
336 Brightness() = default;
337
339 explicit constexpr Brightness(double value)
340 : m_opt{ verifyValue(value) }
341 {}
342
347 double value() const;
348
350 bool hasValue() const;
351
353 void reset();
354
356 std::string toString() const;
357
359 bool operator==(const Brightness &other) const
360 {
361 return m_opt == other.m_opt;
362 }
363
365 bool operator!=(const Brightness &other) const
366 {
367 return m_opt != other.m_opt;
368 }
369
371 bool operator<(const Brightness &other) const
372 {
373 return m_opt < other.m_opt;
374 }
375
377 bool operator>(const Brightness &other) const
378 {
379 return m_opt > other.m_opt;
380 }
381
383 bool operator<=(const Brightness &other) const
384 {
385 return m_opt <= other.m_opt;
386 }
387
389 bool operator>=(const Brightness &other) const
390 {
391 return m_opt >= other.m_opt;
392 }
393
395 friend std::ostream &operator<<(std::ostream &stream, const Brightness &value)
396 {
397 return stream << value.toString();
398 }
399
400 private:
401 void setFromString(const std::string &value);
402
403 constexpr ValueType static verifyValue(const ValueType &value)
404 {
405 return validRange().isInRange(value)
406 ? value
407 : throw std::out_of_range{ "Brightness{ " + std::to_string(value)
408 + " } is not in range [" + std::to_string(validRange().min())
409 + ", " + std::to_string(validRange().max()) + "]" };
410 }
411
412 Zivid::DataModel::Detail::Optional<double> m_opt;
413
414 friend struct DataModel::Detail::Befriend<Brightness>;
415 };
416
418
419 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
421 {
422 public:
425
427 static constexpr const char *path{ "Acquisition/ExposureTime" };
428
430 static constexpr const char *name{ "ExposureTime" };
431
433 static constexpr const char *description{ R"description(Exposure time for the image)description" };
434
436 using ValueType = std::chrono::microseconds;
437
440 {
441 return { std::chrono::microseconds{ 1677 }, std::chrono::microseconds{ 100000 } };
442 }
443
445 ExposureTime() = default;
446
448 explicit constexpr ExposureTime(std::chrono::microseconds value)
449 : m_opt{ verifyValue(value) }
450 {}
451
456 std::chrono::microseconds value() const;
457
459 bool hasValue() const;
460
462 void reset();
463
465 std::string toString() const;
466
468 bool operator==(const ExposureTime &other) const
469 {
470 return m_opt == other.m_opt;
471 }
472
474 bool operator!=(const ExposureTime &other) const
475 {
476 return m_opt != other.m_opt;
477 }
478
480 bool operator<(const ExposureTime &other) const
481 {
482 return m_opt < other.m_opt;
483 }
484
486 bool operator>(const ExposureTime &other) const
487 {
488 return m_opt > other.m_opt;
489 }
490
492 bool operator<=(const ExposureTime &other) const
493 {
494 return m_opt <= other.m_opt;
495 }
496
498 bool operator>=(const ExposureTime &other) const
499 {
500 return m_opt >= other.m_opt;
501 }
502
504 friend std::ostream &operator<<(std::ostream &stream, const ExposureTime &value)
505 {
506 return stream << value.toString();
507 }
508
509 private:
510 void setFromString(const std::string &value);
511
512 constexpr ValueType static verifyValue(const ValueType &value)
513 {
514 return validRange().isInRange(value)
515 ? value
516 : throw std::out_of_range{ "ExposureTime{ " + std::to_string(value.count())
517 + " } is not in range ["
518 + std::to_string(validRange().min().count()) + ", "
519 + std::to_string(validRange().max().count()) + "]" };
520 }
521
522 Zivid::DataModel::Detail::Optional<std::chrono::microseconds> m_opt;
523
524 friend struct DataModel::Detail::Befriend<ExposureTime>;
525 };
526
528
529 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
531 {
532 public:
535
537 static constexpr const char *path{ "Acquisition/Gain" };
538
540 static constexpr const char *name{ "Gain" };
541
543 static constexpr const char *description{ R"description(Analog gain in the camera)description" };
544
546 using ValueType = double;
547
549 static constexpr Range<double> validRange()
550 {
551 return { 1, 16 };
552 }
553
555 Gain() = default;
556
558 explicit constexpr Gain(double value)
559 : m_opt{ verifyValue(value) }
560 {}
561
566 double value() const;
567
569 bool hasValue() const;
570
572 void reset();
573
575 std::string toString() const;
576
578 bool operator==(const Gain &other) const
579 {
580 return m_opt == other.m_opt;
581 }
582
584 bool operator!=(const Gain &other) const
585 {
586 return m_opt != other.m_opt;
587 }
588
590 bool operator<(const Gain &other) const
591 {
592 return m_opt < other.m_opt;
593 }
594
596 bool operator>(const Gain &other) const
597 {
598 return m_opt > other.m_opt;
599 }
600
602 bool operator<=(const Gain &other) const
603 {
604 return m_opt <= other.m_opt;
605 }
606
608 bool operator>=(const Gain &other) const
609 {
610 return m_opt >= other.m_opt;
611 }
612
614 friend std::ostream &operator<<(std::ostream &stream, const Gain &value)
615 {
616 return stream << value.toString();
617 }
618
619 private:
620 void setFromString(const std::string &value);
621
622 constexpr ValueType static verifyValue(const ValueType &value)
623 {
624 return validRange().isInRange(value)
625 ? value
626 : throw std::out_of_range{ "Gain{ " + std::to_string(value) + " } is not in range ["
627 + std::to_string(validRange().min()) + ", "
628 + std::to_string(validRange().max()) + "]" };
629 }
630
631 Zivid::DataModel::Detail::Optional<double> m_opt;
632
633 friend struct DataModel::Detail::Befriend<Gain>;
634 };
635
636 using Descendants = std::tuple<
641
644
659#ifndef NO_DOC
660 template<
661 typename... Args,
662 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
663 typename std::enable_if<
664 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
665 value,
666 int>::type = 0>
667#else
668 template<typename... Args>
669#endif
670 explicit Acquisition(Args &&...args)
671 {
672 using namespace Zivid::Detail::TypeTraits;
673
674 static_assert(
675 AllArgsDecayedAreUnique<Args...>::value,
676 "Found duplicate types among the arguments passed to Acquisition(...). "
677 "Types should be listed at most once.");
678
679 set(std::forward<Args>(args)...);
680 }
681
695#ifndef NO_DOC
696 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
697#else
698 template<typename... Args>
699#endif
700 void set(Args &&...args)
701 {
702 using namespace Zivid::Detail::TypeTraits;
703
704 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
705 static_assert(
706 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
707
708 static_assert(
709 AllArgsDecayedAreUnique<Args...>::value,
710 "Found duplicate types among the arguments passed to set(...). "
711 "Types should be listed at most once.");
712
713 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
714 }
715
730#ifndef NO_DOC
731 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
732#else
733 template<typename... Args>
734#endif
735 Acquisition copyWith(Args &&...args) const
736 {
737 using namespace Zivid::Detail::TypeTraits;
738
739 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
740 static_assert(
741 AllArgsAreDescendantNodes::value,
742 "All arguments passed to copyWith(...) must be descendant nodes.");
743
744 static_assert(
745 AllArgsDecayedAreUnique<Args...>::value,
746 "Found duplicate types among the arguments passed to copyWith(...). "
747 "Types should be listed at most once.");
748
749 auto copy{ *this };
750 copy.set(std::forward<Args>(args)...);
751 return copy;
752 }
753
755 const Aperture &aperture() const
756 {
757 return m_aperture;
758 }
759
762 {
763 return m_aperture;
764 }
765
767 Acquisition &set(const Aperture &value)
768 {
769 m_aperture = value;
770 return *this;
771 }
772
774 const Brightness &brightness() const
775 {
776 return m_brightness;
777 }
778
781 {
782 return m_brightness;
783 }
784
787 {
788 m_brightness = value;
789 return *this;
790 }
791
794 {
795 return m_exposureTime;
796 }
797
800 {
801 return m_exposureTime;
802 }
803
806 {
807 m_exposureTime = value;
808 return *this;
809 }
810
812 const Gain &gain() const
813 {
814 return m_gain;
815 }
816
819 {
820 return m_gain;
821 }
822
824 Acquisition &set(const Gain &value)
825 {
826 m_gain = value;
827 return *this;
828 }
829
830 template<
831 typename T,
832 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::Aperture>::value, int>::type = 0>
834 {
835 return m_aperture;
836 }
837
838 template<
839 typename T,
840 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::Brightness>::value, int>::type = 0>
842 {
843 return m_brightness;
844 }
845
846 template<
847 typename T,
848 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::ExposureTime>::value, int>::type = 0>
850 {
851 return m_exposureTime;
852 }
853
854 template<
855 typename T,
856 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::Gain>::value, int>::type = 0>
858 {
859 return m_gain;
860 }
861
862 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
864 {
865 return m_aperture;
866 }
867
868 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
870 {
871 return m_brightness;
872 }
873
874 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
876 {
877 return m_exposureTime;
878 }
879
880 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
882 {
883 return m_gain;
884 }
885
887 template<typename F>
888 void forEach(const F &f) const
889 {
890 f(m_aperture);
891 f(m_brightness);
892 f(m_exposureTime);
893 f(m_gain);
894 }
895
897 template<typename F>
898 void forEach(const F &f)
899 {
900 f(m_aperture);
901 f(m_brightness);
902 f(m_exposureTime);
903 f(m_gain);
904 }
905
907 bool operator==(const Acquisition &other) const;
908
910 bool operator!=(const Acquisition &other) const;
911
913 std::string toString() const;
914
916 friend std::ostream &operator<<(std::ostream &stream, const Acquisition &value)
917 {
918 return stream << value.toString();
919 }
920
921 private:
922 void setFromString(const std::string &value);
923
924 void setFromString(const std::string &fullPath, const std::string &value);
925
926 std::string getString(const std::string &fullPath) const;
927
928 Aperture m_aperture;
929 Brightness m_brightness;
930 ExposureTime m_exposureTime;
931 Gain m_gain;
932
933 friend struct DataModel::Detail::Befriend<Acquisition>;
934 };
935
937
938 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
940 {
941 public:
944
946 static constexpr const char *path{ "Acquisitions" };
947
949 static constexpr const char *name{ "Acquisitions" };
950
952 static constexpr const char *description{
953 R"description(List of acquisitions. Note that the Zivid SDK only supports a single acquisition per capture in 2D mode.)description"
954 };
955
957 using ValueType = std::vector<Settings2D::Acquisition>;
958
961 {
962 return { 0, std::numeric_limits<ValueType::size_type>::max() };
963 }
964
966 Acquisitions() = default;
967
969 explicit Acquisitions(std::vector<Settings2D::Acquisition> value)
970 : m_value{ std::move(value) }
971 {}
972
974 explicit Acquisitions(std::initializer_list<Settings2D::Acquisition> value)
975 : Acquisitions{ ValueType{ value } }
976 {}
977
979 const std::vector<Settings2D::Acquisition> &value() const;
980
982 std::string toString() const;
983
985 std::size_t size() const noexcept;
986
988 bool isEmpty() const noexcept;
989
995 template<typename... Args>
996 void emplaceBack(Args &&...args)
997 {
998 m_value.emplace_back(std::forward<Args>(args)...);
999 }
1000
1006 Settings2D::Acquisition &at(std::size_t pos);
1007
1013 const Settings2D::Acquisition &at(std::size_t pos) const;
1014
1021
1027 const Settings2D::Acquisition &operator[](std::size_t pos) const;
1028
1030 template<typename F>
1031 void forEach(const F &f)
1032 {
1033 for(auto &child : m_value)
1034 {
1035 f(child);
1036 }
1037 }
1038
1040 template<typename F>
1041 void forEach(const F &f) const
1042 {
1043 for(const auto &child : m_value)
1044 {
1045 f(child);
1046 }
1047 }
1048
1050 using Iterator = std::vector<Settings2D::Acquisition>::iterator;
1051
1053 Iterator begin() noexcept;
1054
1056 Iterator end() noexcept;
1057
1059 using ConstIterator = std::vector<Settings2D::Acquisition>::const_iterator;
1060
1062 ConstIterator begin() const noexcept;
1063
1065 ConstIterator end() const noexcept;
1066
1068 ConstIterator cbegin() const noexcept;
1069
1071 ConstIterator cend() const noexcept;
1072
1074 bool operator==(const Acquisitions &other) const
1075 {
1076 return m_value == other.m_value;
1077 }
1078
1080 bool operator!=(const Acquisitions &other) const
1081 {
1082 return m_value != other.m_value;
1083 }
1084
1086 friend std::ostream &operator<<(std::ostream &stream, const Acquisitions &value)
1087 {
1088 return stream << value.toString();
1089 }
1090
1091 private:
1092 void setFromString(const std::string &value);
1093
1094 std::vector<Settings2D::Acquisition> m_value{};
1095
1096 friend struct DataModel::Detail::Befriend<Acquisitions>;
1097 };
1098
1100
1101 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1103 {
1104 public:
1107
1109 static constexpr const char *path{ "Processing" };
1110
1112 static constexpr const char *name{ "Processing" };
1113
1115 static constexpr const char *description{ R"description(Processing related settings)description" };
1116
1118
1119 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1121 {
1122 public:
1125
1127 static constexpr const char *path{ "Processing/Color" };
1128
1130 static constexpr const char *name{ "Color" };
1131
1133 static constexpr const char *description{ R"description(Color settings)description" };
1134
1136
1137 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1139 {
1140 public:
1143
1145 static constexpr const char *path{ "Processing/Color/Balance" };
1146
1148 static constexpr const char *name{ "Balance" };
1149
1151 static constexpr const char *description{ R"description(Color balance settings)description" };
1152
1154
1155 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1157 {
1158 public:
1161
1163 static constexpr const char *path{ "Processing/Color/Balance/Blue" };
1164
1166 static constexpr const char *name{ "Blue" };
1167
1169 static constexpr const char *description{
1170 R"description(Digital gain applied to blue channel)description"
1171 };
1172
1174 using ValueType = double;
1175
1177 static constexpr Range<double> validRange()
1178 {
1179 return { 1.0, 8.0 };
1180 }
1181
1183 Blue() = default;
1184
1186 explicit constexpr Blue(double value)
1187 : m_opt{ verifyValue(value) }
1188 {}
1189
1194 double value() const;
1195
1197 bool hasValue() const;
1198
1200 void reset();
1201
1203 std::string toString() const;
1204
1206 bool operator==(const Blue &other) const
1207 {
1208 return m_opt == other.m_opt;
1209 }
1210
1212 bool operator!=(const Blue &other) const
1213 {
1214 return m_opt != other.m_opt;
1215 }
1216
1218 bool operator<(const Blue &other) const
1219 {
1220 return m_opt < other.m_opt;
1221 }
1222
1224 bool operator>(const Blue &other) const
1225 {
1226 return m_opt > other.m_opt;
1227 }
1228
1230 bool operator<=(const Blue &other) const
1231 {
1232 return m_opt <= other.m_opt;
1233 }
1234
1236 bool operator>=(const Blue &other) const
1237 {
1238 return m_opt >= other.m_opt;
1239 }
1240
1242 friend std::ostream &operator<<(std::ostream &stream, const Blue &value)
1243 {
1244 return stream << value.toString();
1245 }
1246
1247 private:
1248 void setFromString(const std::string &value);
1249
1250 constexpr ValueType static verifyValue(const ValueType &value)
1251 {
1252 return validRange().isInRange(value)
1253 ? value
1254 : throw std::out_of_range{ "Blue{ " + std::to_string(value)
1255 + " } is not in range ["
1256 + std::to_string(validRange().min()) + ", "
1257 + std::to_string(validRange().max()) + "]" };
1258 }
1259
1260 Zivid::DataModel::Detail::Optional<double> m_opt;
1261
1262 friend struct DataModel::Detail::Befriend<Blue>;
1263 };
1264
1266
1267 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1269 {
1270 public:
1273
1275 static constexpr const char *path{ "Processing/Color/Balance/Green" };
1276
1278 static constexpr const char *name{ "Green" };
1279
1281 static constexpr const char *description{
1282 R"description(Digital gain applied to green channel)description"
1283 };
1284
1286 using ValueType = double;
1287
1289 static constexpr Range<double> validRange()
1290 {
1291 return { 1.0, 8.0 };
1292 }
1293
1295 Green() = default;
1296
1298 explicit constexpr Green(double value)
1299 : m_opt{ verifyValue(value) }
1300 {}
1301
1306 double value() const;
1307
1309 bool hasValue() const;
1310
1312 void reset();
1313
1315 std::string toString() const;
1316
1318 bool operator==(const Green &other) const
1319 {
1320 return m_opt == other.m_opt;
1321 }
1322
1324 bool operator!=(const Green &other) const
1325 {
1326 return m_opt != other.m_opt;
1327 }
1328
1330 bool operator<(const Green &other) const
1331 {
1332 return m_opt < other.m_opt;
1333 }
1334
1336 bool operator>(const Green &other) const
1337 {
1338 return m_opt > other.m_opt;
1339 }
1340
1342 bool operator<=(const Green &other) const
1343 {
1344 return m_opt <= other.m_opt;
1345 }
1346
1348 bool operator>=(const Green &other) const
1349 {
1350 return m_opt >= other.m_opt;
1351 }
1352
1354 friend std::ostream &operator<<(std::ostream &stream, const Green &value)
1355 {
1356 return stream << value.toString();
1357 }
1358
1359 private:
1360 void setFromString(const std::string &value);
1361
1362 constexpr ValueType static verifyValue(const ValueType &value)
1363 {
1364 return validRange().isInRange(value)
1365 ? value
1366 : throw std::out_of_range{ "Green{ " + std::to_string(value)
1367 + " } is not in range ["
1368 + std::to_string(validRange().min()) + ", "
1369 + std::to_string(validRange().max()) + "]" };
1370 }
1371
1372 Zivid::DataModel::Detail::Optional<double> m_opt;
1373
1374 friend struct DataModel::Detail::Befriend<Green>;
1375 };
1376
1378
1379 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1381 {
1382 public:
1385
1387 static constexpr const char *path{ "Processing/Color/Balance/Red" };
1388
1390 static constexpr const char *name{ "Red" };
1391
1393 static constexpr const char *description{
1394 R"description(Digital gain applied to red channel)description"
1395 };
1396
1398 using ValueType = double;
1399
1401 static constexpr Range<double> validRange()
1402 {
1403 return { 1.0, 8.0 };
1404 }
1405
1407 Red() = default;
1408
1410 explicit constexpr Red(double value)
1411 : m_opt{ verifyValue(value) }
1412 {}
1413
1418 double value() const;
1419
1421 bool hasValue() const;
1422
1424 void reset();
1425
1427 std::string toString() const;
1428
1430 bool operator==(const Red &other) const
1431 {
1432 return m_opt == other.m_opt;
1433 }
1434
1436 bool operator!=(const Red &other) const
1437 {
1438 return m_opt != other.m_opt;
1439 }
1440
1442 bool operator<(const Red &other) const
1443 {
1444 return m_opt < other.m_opt;
1445 }
1446
1448 bool operator>(const Red &other) const
1449 {
1450 return m_opt > other.m_opt;
1451 }
1452
1454 bool operator<=(const Red &other) const
1455 {
1456 return m_opt <= other.m_opt;
1457 }
1458
1460 bool operator>=(const Red &other) const
1461 {
1462 return m_opt >= other.m_opt;
1463 }
1464
1466 friend std::ostream &operator<<(std::ostream &stream, const Red &value)
1467 {
1468 return stream << value.toString();
1469 }
1470
1471 private:
1472 void setFromString(const std::string &value);
1473
1474 constexpr ValueType static verifyValue(const ValueType &value)
1475 {
1476 return validRange().isInRange(value)
1477 ? value
1478 : throw std::out_of_range{ "Red{ " + std::to_string(value)
1479 + " } is not in range ["
1480 + std::to_string(validRange().min()) + ", "
1481 + std::to_string(validRange().max()) + "]" };
1482 }
1483
1484 Zivid::DataModel::Detail::Optional<double> m_opt;
1485
1486 friend struct DataModel::Detail::Befriend<Red>;
1487 };
1488
1489 using Descendants = std::tuple<
1493
1496
1510#ifndef NO_DOC
1511 template<
1512 typename... Args,
1513 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1514 typename std::enable_if<
1515 Zivid::Detail::TypeTraits::
1516 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
1517 int>::type = 0>
1518#else
1519 template<typename... Args>
1520#endif
1521 explicit Balance(Args &&...args)
1522 {
1523 using namespace Zivid::Detail::TypeTraits;
1524
1525 static_assert(
1526 AllArgsDecayedAreUnique<Args...>::value,
1527 "Found duplicate types among the arguments passed to Balance(...). "
1528 "Types should be listed at most once.");
1529
1530 set(std::forward<Args>(args)...);
1531 }
1532
1545#ifndef NO_DOC
1546 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1547#else
1548 template<typename... Args>
1549#endif
1550 void set(Args &&...args)
1551 {
1552 using namespace Zivid::Detail::TypeTraits;
1553
1554 using AllArgsAreDescendantNodes =
1555 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1556 static_assert(
1557 AllArgsAreDescendantNodes::value,
1558 "All arguments passed to set(...) must be descendant nodes.");
1559
1560 static_assert(
1561 AllArgsDecayedAreUnique<Args...>::value,
1562 "Found duplicate types among the arguments passed to set(...). "
1563 "Types should be listed at most once.");
1564
1565 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1566 }
1567
1581#ifndef NO_DOC
1582 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1583#else
1584 template<typename... Args>
1585#endif
1586 Balance copyWith(Args &&...args) const
1587 {
1588 using namespace Zivid::Detail::TypeTraits;
1589
1590 using AllArgsAreDescendantNodes =
1591 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1592 static_assert(
1593 AllArgsAreDescendantNodes::value,
1594 "All arguments passed to copyWith(...) must be descendant nodes.");
1595
1596 static_assert(
1597 AllArgsDecayedAreUnique<Args...>::value,
1598 "Found duplicate types among the arguments passed to copyWith(...). "
1599 "Types should be listed at most once.");
1600
1601 auto copy{ *this };
1602 copy.set(std::forward<Args>(args)...);
1603 return copy;
1604 }
1605
1607 const Blue &blue() const
1608 {
1609 return m_blue;
1610 }
1611
1614 {
1615 return m_blue;
1616 }
1617
1619 Balance &set(const Blue &value)
1620 {
1621 m_blue = value;
1622 return *this;
1623 }
1624
1626 const Green &green() const
1627 {
1628 return m_green;
1629 }
1630
1633 {
1634 return m_green;
1635 }
1636
1638 Balance &set(const Green &value)
1639 {
1640 m_green = value;
1641 return *this;
1642 }
1643
1645 const Red &red() const
1646 {
1647 return m_red;
1648 }
1649
1652 {
1653 return m_red;
1654 }
1655
1657 Balance &set(const Red &value)
1658 {
1659 m_red = value;
1660 return *this;
1661 }
1662
1663 template<
1664 typename T,
1665 typename std::enable_if<
1666 std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value,
1667 int>::type = 0>
1669 {
1670 return m_blue;
1671 }
1672
1673 template<
1674 typename T,
1675 typename std::enable_if<
1676 std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value,
1677 int>::type = 0>
1679 {
1680 return m_green;
1681 }
1682
1683 template<
1684 typename T,
1685 typename std::enable_if<
1686 std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value,
1687 int>::type = 0>
1689 {
1690 return m_red;
1691 }
1692
1693 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1695 {
1696 return m_blue;
1697 }
1698
1699 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1701 {
1702 return m_green;
1703 }
1704
1705 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
1707 {
1708 return m_red;
1709 }
1710
1712 template<typename F>
1713 void forEach(const F &f) const
1714 {
1715 f(m_blue);
1716 f(m_green);
1717 f(m_red);
1718 }
1719
1721 template<typename F>
1722 void forEach(const F &f)
1723 {
1724 f(m_blue);
1725 f(m_green);
1726 f(m_red);
1727 }
1728
1730 bool operator==(const Balance &other) const;
1731
1733 bool operator!=(const Balance &other) const;
1734
1736 std::string toString() const;
1737
1739 friend std::ostream &operator<<(std::ostream &stream, const Balance &value)
1740 {
1741 return stream << value.toString();
1742 }
1743
1744 private:
1745 void setFromString(const std::string &value);
1746
1747 void setFromString(const std::string &fullPath, const std::string &value);
1748
1749 std::string getString(const std::string &fullPath) const;
1750
1751 Blue m_blue;
1752 Green m_green;
1753 Red m_red;
1754
1755 friend struct DataModel::Detail::Befriend<Balance>;
1756 };
1757
1761
1762 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1764 {
1765 public:
1768
1770 static constexpr const char *path{ "Processing/Color/Gamma" };
1771
1773 static constexpr const char *name{ "Gamma" };
1774
1776 static constexpr const char *description{
1777 R"description(Gamma applied to the color values. Gamma less than 1 makes the colors brighter, while gamma
1778greater than 1 makes the colors darker.
1779)description"
1780 };
1781
1783 using ValueType = double;
1784
1786 static constexpr Range<double> validRange()
1787 {
1788 return { 0.25, 1.5 };
1789 }
1790
1792 Gamma() = default;
1793
1795 explicit constexpr Gamma(double value)
1796 : m_opt{ verifyValue(value) }
1797 {}
1798
1803 double value() const;
1804
1806 bool hasValue() const;
1807
1809 void reset();
1810
1812 std::string toString() const;
1813
1815 bool operator==(const Gamma &other) const
1816 {
1817 return m_opt == other.m_opt;
1818 }
1819
1821 bool operator!=(const Gamma &other) const
1822 {
1823 return m_opt != other.m_opt;
1824 }
1825
1827 bool operator<(const Gamma &other) const
1828 {
1829 return m_opt < other.m_opt;
1830 }
1831
1833 bool operator>(const Gamma &other) const
1834 {
1835 return m_opt > other.m_opt;
1836 }
1837
1839 bool operator<=(const Gamma &other) const
1840 {
1841 return m_opt <= other.m_opt;
1842 }
1843
1845 bool operator>=(const Gamma &other) const
1846 {
1847 return m_opt >= other.m_opt;
1848 }
1849
1851 friend std::ostream &operator<<(std::ostream &stream, const Gamma &value)
1852 {
1853 return stream << value.toString();
1854 }
1855
1856 private:
1857 void setFromString(const std::string &value);
1858
1859 constexpr ValueType static verifyValue(const ValueType &value)
1860 {
1861 return validRange().isInRange(value)
1862 ? value
1863 : throw std::out_of_range{ "Gamma{ " + std::to_string(value) + " } is not in range ["
1864 + std::to_string(validRange().min()) + ", "
1865 + std::to_string(validRange().max()) + "]" };
1866 }
1867
1868 Zivid::DataModel::Detail::Optional<double> m_opt;
1869
1870 friend struct DataModel::Detail::Befriend<Gamma>;
1871 };
1872
1873 using Descendants = std::tuple<
1879
1882
1898#ifndef NO_DOC
1899 template<
1900 typename... Args,
1901 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1902 typename std::enable_if<
1903 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
1904 value,
1905 int>::type = 0>
1906#else
1907 template<typename... Args>
1908#endif
1909 explicit Color(Args &&...args)
1910 {
1911 using namespace Zivid::Detail::TypeTraits;
1912
1913 static_assert(
1914 AllArgsDecayedAreUnique<Args...>::value,
1915 "Found duplicate types among the arguments passed to Color(...). "
1916 "Types should be listed at most once.");
1917
1918 set(std::forward<Args>(args)...);
1919 }
1920
1935#ifndef NO_DOC
1936 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1937#else
1938 template<typename... Args>
1939#endif
1940 void set(Args &&...args)
1941 {
1942 using namespace Zivid::Detail::TypeTraits;
1943
1944 using AllArgsAreDescendantNodes =
1945 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1946 static_assert(
1947 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1948
1949 static_assert(
1950 AllArgsDecayedAreUnique<Args...>::value,
1951 "Found duplicate types among the arguments passed to set(...). "
1952 "Types should be listed at most once.");
1953
1954 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1955 }
1956
1972#ifndef NO_DOC
1973 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1974#else
1975 template<typename... Args>
1976#endif
1977 Color copyWith(Args &&...args) const
1978 {
1979 using namespace Zivid::Detail::TypeTraits;
1980
1981 using AllArgsAreDescendantNodes =
1982 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1983 static_assert(
1984 AllArgsAreDescendantNodes::value,
1985 "All arguments passed to copyWith(...) must be descendant nodes.");
1986
1987 static_assert(
1988 AllArgsDecayedAreUnique<Args...>::value,
1989 "Found duplicate types among the arguments passed to copyWith(...). "
1990 "Types should be listed at most once.");
1991
1992 auto copy{ *this };
1993 copy.set(std::forward<Args>(args)...);
1994 return copy;
1995 }
1996
1998 const Balance &balance() const
1999 {
2000 return m_balance;
2001 }
2002
2005 {
2006 return m_balance;
2007 }
2008
2010 Color &set(const Balance &value)
2011 {
2012 m_balance = value;
2013 return *this;
2014 }
2015
2017 Color &set(const Balance::Blue &value)
2018 {
2019 m_balance.set(value);
2020 return *this;
2021 }
2022
2024 Color &set(const Balance::Green &value)
2025 {
2026 m_balance.set(value);
2027 return *this;
2028 }
2029
2031 Color &set(const Balance::Red &value)
2032 {
2033 m_balance.set(value);
2034 return *this;
2035 }
2036
2038 const Gamma &gamma() const
2039 {
2040 return m_gamma;
2041 }
2042
2045 {
2046 return m_gamma;
2047 }
2048
2050 Color &set(const Gamma &value)
2051 {
2052 m_gamma = value;
2053 return *this;
2054 }
2055
2056 template<
2057 typename T,
2058 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance>::value, int>::type =
2059 0>
2061 {
2062 return m_balance;
2063 }
2064
2065 template<
2066 typename T,
2067 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value, int>::
2068 type = 0>
2070 {
2071 return m_balance.get<Settings2D::Processing::Color::Balance::Blue>();
2072 }
2073
2074 template<
2075 typename T,
2076 typename std::
2077 enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value, int>::type = 0>
2079 {
2080 return m_balance.get<Settings2D::Processing::Color::Balance::Green>();
2081 }
2082
2083 template<
2084 typename T,
2085 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value, int>::
2086 type = 0>
2088 {
2089 return m_balance.get<Settings2D::Processing::Color::Balance::Red>();
2090 }
2091
2092 template<
2093 typename T,
2094 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Gamma>::value, int>::type =
2095 0>
2097 {
2098 return m_gamma;
2099 }
2100
2101 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2103 {
2104 return m_balance;
2105 }
2106
2107 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
2109 {
2110 return m_gamma;
2111 }
2112
2114 template<typename F>
2115 void forEach(const F &f) const
2116 {
2117 f(m_balance);
2118 f(m_gamma);
2119 }
2120
2122 template<typename F>
2123 void forEach(const F &f)
2124 {
2125 f(m_balance);
2126 f(m_gamma);
2127 }
2128
2130 bool operator==(const Color &other) const;
2131
2133 bool operator!=(const Color &other) const;
2134
2136 std::string toString() const;
2137
2139 friend std::ostream &operator<<(std::ostream &stream, const Color &value)
2140 {
2141 return stream << value.toString();
2142 }
2143
2144 private:
2145 void setFromString(const std::string &value);
2146
2147 void setFromString(const std::string &fullPath, const std::string &value);
2148
2149 std::string getString(const std::string &fullPath) const;
2150
2151 Balance m_balance;
2152 Gamma m_gamma;
2153
2154 friend struct DataModel::Detail::Befriend<Color>;
2155 };
2156
2157 using Descendants = std::tuple<
2164
2167
2184#ifndef NO_DOC
2185 template<
2186 typename... Args,
2187 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
2188 typename std::enable_if<
2189 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
2190 value,
2191 int>::type = 0>
2192#else
2193 template<typename... Args>
2194#endif
2195 explicit Processing(Args &&...args)
2196 {
2197 using namespace Zivid::Detail::TypeTraits;
2198
2199 static_assert(
2200 AllArgsDecayedAreUnique<Args...>::value,
2201 "Found duplicate types among the arguments passed to Processing(...). "
2202 "Types should be listed at most once.");
2203
2204 set(std::forward<Args>(args)...);
2205 }
2206
2222#ifndef NO_DOC
2223 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
2224#else
2225 template<typename... Args>
2226#endif
2227 void set(Args &&...args)
2228 {
2229 using namespace Zivid::Detail::TypeTraits;
2230
2231 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2232 static_assert(
2233 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
2234
2235 static_assert(
2236 AllArgsDecayedAreUnique<Args...>::value,
2237 "Found duplicate types among the arguments passed to set(...). "
2238 "Types should be listed at most once.");
2239
2240 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
2241 }
2242
2259#ifndef NO_DOC
2260 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
2261#else
2262 template<typename... Args>
2263#endif
2264 Processing copyWith(Args &&...args) const
2265 {
2266 using namespace Zivid::Detail::TypeTraits;
2267
2268 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2269 static_assert(
2270 AllArgsAreDescendantNodes::value,
2271 "All arguments passed to copyWith(...) must be descendant nodes.");
2272
2273 static_assert(
2274 AllArgsDecayedAreUnique<Args...>::value,
2275 "Found duplicate types among the arguments passed to copyWith(...). "
2276 "Types should be listed at most once.");
2277
2278 auto copy{ *this };
2279 copy.set(std::forward<Args>(args)...);
2280 return copy;
2281 }
2282
2284 const Color &color() const
2285 {
2286 return m_color;
2287 }
2288
2291 {
2292 return m_color;
2293 }
2294
2296 Processing &set(const Color &value)
2297 {
2298 m_color = value;
2299 return *this;
2300 }
2301
2304 {
2305 m_color.set(value);
2306 return *this;
2307 }
2308
2311 {
2312 m_color.set(value);
2313 return *this;
2314 }
2315
2318 {
2319 m_color.set(value);
2320 return *this;
2321 }
2322
2325 {
2326 m_color.set(value);
2327 return *this;
2328 }
2329
2332 {
2333 m_color.set(value);
2334 return *this;
2335 }
2336
2337 template<
2338 typename T,
2339 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color>::value, int>::type = 0>
2341 {
2342 return m_color;
2343 }
2344
2345 template<
2346 typename T,
2347 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance>::value, int>::type = 0>
2349 {
2351 }
2352
2353 template<
2354 typename T,
2355 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value, int>::
2356 type = 0>
2358 {
2360 }
2361
2362 template<
2363 typename T,
2364 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value, int>::
2365 type = 0>
2367 {
2369 }
2370
2371 template<
2372 typename T,
2373 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value, int>::
2374 type = 0>
2376 {
2377 return m_color.get<Settings2D::Processing::Color::Balance::Red>();
2378 }
2379
2380 template<
2381 typename T,
2382 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Gamma>::value, int>::type = 0>
2384 {
2385 return m_color.get<Settings2D::Processing::Color::Gamma>();
2386 }
2387
2388 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2390 {
2391 return m_color;
2392 }
2393
2395 template<typename F>
2396 void forEach(const F &f) const
2397 {
2398 f(m_color);
2399 }
2400
2402 template<typename F>
2403 void forEach(const F &f)
2404 {
2405 f(m_color);
2406 }
2407
2409 bool operator==(const Processing &other) const;
2410
2412 bool operator!=(const Processing &other) const;
2413
2415 std::string toString() const;
2416
2418 friend std::ostream &operator<<(std::ostream &stream, const Processing &value)
2419 {
2420 return stream << value.toString();
2421 }
2422
2423 private:
2424 void setFromString(const std::string &value);
2425
2426 void setFromString(const std::string &fullPath, const std::string &value);
2427
2428 std::string getString(const std::string &fullPath) const;
2429
2430 Color m_color;
2431
2432 friend struct DataModel::Detail::Befriend<Processing>;
2433 };
2434
2435 using Descendants = std::tuple<
2444
2447
2449 explicit Settings2D(const std::string &fileName);
2450
2469#ifndef NO_DOC
2470 template<
2471 typename... Args,
2472 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
2473 typename std::enable_if<
2474 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
2475 int>::type = 0>
2476#else
2477 template<typename... Args>
2478#endif
2479 explicit Settings2D(Args &&...args)
2480 {
2481 using namespace Zivid::Detail::TypeTraits;
2482
2483 static_assert(
2484 AllArgsDecayedAreUnique<Args...>::value,
2485 "Found duplicate types among the arguments passed to Settings2D(...). "
2486 "Types should be listed at most once.");
2487
2488 set(std::forward<Args>(args)...);
2489 }
2490
2508#ifndef NO_DOC
2509 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
2510#else
2511 template<typename... Args>
2512#endif
2513 void set(Args &&...args)
2514 {
2515 using namespace Zivid::Detail::TypeTraits;
2516
2517 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2518 static_assert(
2519 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
2520
2521 static_assert(
2522 AllArgsDecayedAreUnique<Args...>::value,
2523 "Found duplicate types among the arguments passed to set(...). "
2524 "Types should be listed at most once.");
2525
2526 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
2527 }
2528
2547#ifndef NO_DOC
2548 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
2549#else
2550 template<typename... Args>
2551#endif
2552 Settings2D copyWith(Args &&...args) const
2553 {
2554 using namespace Zivid::Detail::TypeTraits;
2555
2556 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2557 static_assert(
2558 AllArgsAreDescendantNodes::value, "All arguments passed to copyWith(...) must be descendant nodes.");
2559
2560 static_assert(
2561 AllArgsDecayedAreUnique<Args...>::value,
2562 "Found duplicate types among the arguments passed to copyWith(...). "
2563 "Types should be listed at most once.");
2564
2565 auto copy{ *this };
2566 copy.set(std::forward<Args>(args)...);
2567 return copy;
2568 }
2569
2572 {
2573 return m_acquisitions;
2574 }
2575
2578 {
2579 return m_acquisitions;
2580 }
2581
2584 {
2585 m_acquisitions = value;
2586 return *this;
2587 }
2588
2590 const Processing &processing() const
2591 {
2592 return m_processing;
2593 }
2594
2597 {
2598 return m_processing;
2599 }
2600
2603 {
2604 m_processing = value;
2605 return *this;
2606 }
2607
2610 {
2611 m_processing.set(value);
2612 return *this;
2613 }
2614
2617 {
2618 m_processing.set(value);
2619 return *this;
2620 }
2621
2624 {
2625 m_processing.set(value);
2626 return *this;
2627 }
2628
2631 {
2632 m_processing.set(value);
2633 return *this;
2634 }
2635
2638 {
2639 m_processing.set(value);
2640 return *this;
2641 }
2642
2645 {
2646 m_processing.set(value);
2647 return *this;
2648 }
2649
2650 template<typename T, typename std::enable_if<std::is_same<T, Settings2D::Acquisitions>::value, int>::type = 0>
2652 {
2653 return m_acquisitions;
2654 }
2655
2656 template<typename T, typename std::enable_if<std::is_same<T, Settings2D::Processing>::value, int>::type = 0>
2658 {
2659 return m_processing;
2660 }
2661
2662 template<
2663 typename T,
2664 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color>::value, int>::type = 0>
2666 {
2667 return m_processing.get<Settings2D::Processing::Color>();
2668 }
2669
2670 template<
2671 typename T,
2672 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance>::value, int>::type = 0>
2674 {
2675 return m_processing.get<Settings2D::Processing::Color::Balance>();
2676 }
2677
2678 template<
2679 typename T,
2680 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value, int>::type =
2681 0>
2683 {
2684 return m_processing.get<Settings2D::Processing::Color::Balance::Blue>();
2685 }
2686
2687 template<
2688 typename T,
2689 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value, int>::type =
2690 0>
2692 {
2693 return m_processing.get<Settings2D::Processing::Color::Balance::Green>();
2694 }
2695
2696 template<
2697 typename T,
2698 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value, int>::type = 0>
2700 {
2701 return m_processing.get<Settings2D::Processing::Color::Balance::Red>();
2702 }
2703
2704 template<
2705 typename T,
2706 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Gamma>::value, int>::type = 0>
2708 {
2709 return m_processing.get<Settings2D::Processing::Color::Gamma>();
2710 }
2711
2712 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2714 {
2715 return m_acquisitions;
2716 }
2717
2718 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
2720 {
2721 return m_processing;
2722 }
2723
2725 template<typename F>
2726 void forEach(const F &f) const
2727 {
2728 f(m_acquisitions);
2729 f(m_processing);
2730 }
2731
2733 template<typename F>
2734 void forEach(const F &f)
2735 {
2736 f(m_acquisitions);
2737 f(m_processing);
2738 }
2739
2741 bool operator==(const Settings2D &other) const;
2742
2744 bool operator!=(const Settings2D &other) const;
2745
2747 std::string toString() const;
2748
2750 friend std::ostream &operator<<(std::ostream &stream, const Settings2D &value)
2751 {
2752 return stream << value.toString();
2753 }
2754
2756 void save(const std::string &fileName) const;
2757
2759 void load(const std::string &fileName);
2760
2761 private:
2762 void setFromString(const std::string &value);
2763
2764 void setFromString(const std::string &fullPath, const std::string &value);
2765
2766 std::string getString(const std::string &fullPath) const;
2767
2768 Acquisitions m_acquisitions;
2769 Processing m_processing;
2770
2771 friend struct DataModel::Detail::Befriend<Settings2D>;
2772 };
2773
2774#ifndef NO_DOC
2776 namespace Detail
2777 {
2778 ZIVID_CORE_EXPORT void save(const Settings2D &dataModel, std::ostream &ostream);
2779 ZIVID_CORE_EXPORT void load(Settings2D &dataModel, std::istream &istream);
2780 } // namespace Detail
2781#endif
2782
2783#ifndef NO_DOC
2784 template<>
2785 struct Settings2D::Version<3>
2786 {
2787 using Type = Settings2D;
2788 };
2789#endif
2790
2791} // namespace Zivid
2792
2793#ifdef _MSC_VER
2794# pragma warning(pop)
2795#endif
2796
2797#ifndef NO_DOC
2798# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
2799namespace std // NOLINT
2800{
2801
2802 template<>
2803 struct tuple_size<Zivid::Settings2D::Processing> : integral_constant<size_t, 1>
2804 {};
2805
2806 template<size_t i>
2807 struct tuple_element<i, Zivid::Settings2D::Processing>
2808 {
2809 static_assert(i < tuple_size<Zivid::Settings2D::Processing>::value, "Index must be less than 1");
2810
2811 using type // NOLINT
2812 = decltype(declval<Zivid::Settings2D::Processing>().get<i>());
2813 };
2814
2815 template<>
2816 struct tuple_size<Zivid::Settings2D::Processing::Color> : integral_constant<size_t, 2>
2817 {};
2818
2819 template<size_t i>
2820 struct tuple_element<i, Zivid::Settings2D::Processing::Color>
2821 {
2822 static_assert(i < tuple_size<Zivid::Settings2D::Processing::Color>::value, "Index must be less than 2");
2823
2824 using type // NOLINT
2825 = decltype(declval<Zivid::Settings2D::Processing::Color>().get<i>());
2826 };
2827
2828 template<>
2829 struct tuple_size<Zivid::Settings2D::Processing::Color::Balance> : integral_constant<size_t, 3>
2830 {};
2831
2832 template<size_t i>
2833 struct tuple_element<i, Zivid::Settings2D::Processing::Color::Balance>
2834 {
2835 static_assert(
2836 i < tuple_size<Zivid::Settings2D::Processing::Color::Balance>::value,
2837 "Index must be less than 3");
2838
2839 using type // NOLINT
2840 = decltype(declval<Zivid::Settings2D::Processing::Color::Balance>().get<i>());
2841 };
2842
2843 template<>
2844 struct tuple_size<Zivid::Settings2D> : integral_constant<size_t, 2>
2845 {};
2846
2847 template<size_t i>
2848 struct tuple_element<i, Zivid::Settings2D>
2849 {
2850 static_assert(i < tuple_size<Zivid::Settings2D>::value, "Index must be less than 2");
2851
2852 using type // NOLINT
2853 = decltype(declval<Zivid::Settings2D>().get<i>());
2854 };
2855
2856} // namespace std
2857# endif
2858#endif
2859
2860// If we have access to the DataModel library, automatically include internal DataModel
2861// header. This header is necessary for serialization and deserialization.
2862#if defined(__has_include) && !defined(NO_DOC)
2863# if __has_include("Zivid/Settings2DInternal.h") && __has_include("Zivid/DataModelNodeMetaData.h")
2864# include "Zivid/Settings2DInternal.h"
2865# endif
2866#endif
#define ZIVID_CORE_EXPORT
Definition: CoreExport.h:101
Class describing a range of values for a given type T
Definition: Range.h:118
Aperture setting for the camera. Specified as an f-number (the ratio of lens focal length to the effe...
Definition: Settings2D.h:177
void reset()
Reset the node to unset state
bool operator!=(const Aperture &other) const
Comparison operator
Definition: Settings2D.h:234
friend std::ostream & operator<<(std::ostream &stream, const Aperture &value)
Operator to serialize the value to a stream
Definition: Settings2D.h:264
bool operator<(const Aperture &other) const
Comparison operator
Definition: Settings2D.h:240
constexpr Aperture(double value)
Constructor
Definition: Settings2D.h:208
static constexpr Range< double > validRange()
The range of valid values for Aperture
Definition: Settings2D.h:199
bool operator>=(const Aperture &other) const
Comparison operator
Definition: Settings2D.h:258
bool operator<=(const Aperture &other) const
Comparison operator
Definition: Settings2D.h:252
std::string toString() const
Get the value as string
double value() const
Get the value
bool operator>(const Aperture &other) const
Comparison operator
Definition: Settings2D.h:246
Aperture()=default
Default constructor
double ValueType
The type of the underlying value
Definition: Settings2D.h:196
bool operator==(const Aperture &other) const
Comparison operator
Definition: Settings2D.h:228
bool hasValue() const
Check if the value is set
Brightness controls the light output from the projector.
Definition: Settings2D.h:300
bool operator==(const Brightness &other) const
Comparison operator
Definition: Settings2D.h:359
bool operator<=(const Brightness &other) const
Comparison operator
Definition: Settings2D.h:383
bool operator>(const Brightness &other) const
Comparison operator
Definition: Settings2D.h:377
bool operator<(const Brightness &other) const
Comparison operator
Definition: Settings2D.h:371
static constexpr Range< double > validRange()
The range of valid values for Brightness
Definition: Settings2D.h:330
constexpr Brightness(double value)
Constructor
Definition: Settings2D.h:339
std::string toString() const
Get the value as string
bool operator!=(const Brightness &other) const
Comparison operator
Definition: Settings2D.h:365
bool operator>=(const Brightness &other) const
Comparison operator
Definition: Settings2D.h:389
friend std::ostream & operator<<(std::ostream &stream, const Brightness &value)
Operator to serialize the value to a stream
Definition: Settings2D.h:395
double value() const
Get the value
Brightness()=default
Default constructor
bool hasValue() const
Check if the value is set
void reset()
Reset the node to unset state
double ValueType
The type of the underlying value
Definition: Settings2D.h:327
Exposure time for the image
Definition: Settings2D.h:421
bool operator>(const ExposureTime &other) const
Comparison operator
Definition: Settings2D.h:486
std::chrono::microseconds ValueType
The type of the underlying value
Definition: Settings2D.h:436
bool operator>=(const ExposureTime &other) const
Comparison operator
Definition: Settings2D.h:498
void reset()
Reset the node to unset state
constexpr ExposureTime(std::chrono::microseconds value)
Constructor
Definition: Settings2D.h:448
std::chrono::microseconds value() const
Get the value
bool operator<(const ExposureTime &other) const
Comparison operator
Definition: Settings2D.h:480
bool operator<=(const ExposureTime &other) const
Comparison operator
Definition: Settings2D.h:492
static constexpr Range< std::chrono::microseconds > validRange()
The range of valid values for ExposureTime
Definition: Settings2D.h:439
bool operator!=(const ExposureTime &other) const
Comparison operator
Definition: Settings2D.h:474
std::string toString() const
Get the value as string
ExposureTime()=default
Default constructor
bool operator==(const ExposureTime &other) const
Comparison operator
Definition: Settings2D.h:468
friend std::ostream & operator<<(std::ostream &stream, const ExposureTime &value)
Operator to serialize the value to a stream
Definition: Settings2D.h:504
bool hasValue() const
Check if the value is set
Analog gain in the camera
Definition: Settings2D.h:531
bool operator>(const Gain &other) const
Comparison operator
Definition: Settings2D.h:596
bool operator!=(const Gain &other) const
Comparison operator
Definition: Settings2D.h:584
bool operator==(const Gain &other) const
Comparison operator
Definition: Settings2D.h:578
friend std::ostream & operator<<(std::ostream &stream, const Gain &value)
Operator to serialize the value to a stream
Definition: Settings2D.h:614
double ValueType
The type of the underlying value
Definition: Settings2D.h:546
Gain()=default
Default constructor
std::string toString() const
Get the value as string
void reset()
Reset the node to unset state
constexpr Gain(double value)
Constructor
Definition: Settings2D.h:558
double value() const
Get the value
bool hasValue() const
Check if the value is set
bool operator>=(const Gain &other) const
Comparison operator
Definition: Settings2D.h:608
bool operator<=(const Gain &other) const
Comparison operator
Definition: Settings2D.h:602
static constexpr Range< double > validRange()
The range of valid values for Gain
Definition: Settings2D.h:549
bool operator<(const Gain &other) const
Comparison operator
Definition: Settings2D.h:590
Settings for a single acquisition
Definition: Settings2D.h:157
const Settings2D::Acquisition::Gain & get() const
Definition: Settings2D.h:857
const ExposureTime & exposureTime() const
Get ExposureTime
Definition: Settings2D.h:793
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter
Definition: Settings2D.h:888
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: Settings2D.h:898
const Settings2D::Acquisition::Aperture & get() const
Definition: Settings2D.h:833
ExposureTime & exposureTime()
Get ExposureTime
Definition: Settings2D.h:799
friend std::ostream & operator<<(std::ostream &stream, const Acquisition &value)
Operator to send the value as string to a stream
Definition: Settings2D.h:916
bool operator!=(const Acquisition &other) const
Inequality operator
Acquisition & set(const Gain &value)
Set Gain
Definition: Settings2D.h:824
std::string toString() const
Get the value as string
Acquisition & set(const Aperture &value)
Set Aperture
Definition: Settings2D.h:767
std::tuple< Settings2D::Acquisition::Aperture, Settings2D::Acquisition::Brightness, Settings2D::Acquisition::ExposureTime, Settings2D::Acquisition::Gain > Descendants
Definition: Settings2D.h:640
Gain & gain()
Get Gain
Definition: Settings2D.h:818
bool operator==(const Acquisition &other) const
Equality operator
Acquisition copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition: Settings2D.h:735
void set(Args &&...args)
Set multiple arguments
Definition: Settings2D.h:700
const Settings2D::Acquisition::ExposureTime & get() const
Definition: Settings2D.h:849
Acquisition()
Default constructor
Aperture & aperture()
Get Aperture
Definition: Settings2D.h:761
Acquisition(Args &&...args)
Constructor taking variadic number of arguments
Definition: Settings2D.h:670
const Aperture & aperture() const
Get Aperture
Definition: Settings2D.h:755
Acquisition & set(const Brightness &value)
Set Brightness
Definition: Settings2D.h:786
const Brightness & brightness() const
Get Brightness
Definition: Settings2D.h:774
Brightness & brightness()
Get Brightness
Definition: Settings2D.h:780
const Gain & gain() const
Get Gain
Definition: Settings2D.h:812
const Settings2D::Acquisition::Brightness & get() const
Definition: Settings2D.h:841
Acquisition & set(const ExposureTime &value)
Set ExposureTime
Definition: Settings2D.h:805
List of acquisitions. Note that the Zivid SDK only supports a single acquisition per capture in 2D mo...
Definition: Settings2D.h:940
const Settings2D::Acquisition & at(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 Acquisitions
Definition: Settings2D.h:960
Acquisitions(std::initializer_list< Settings2D::Acquisition > value)
Constructor
Definition: Settings2D.h:974
Settings2D::Acquisition & operator[](std::size_t pos)
Returns a reference to the element at position pos in the list
const Settings2D::Acquisition & operator[](std::size_t pos) const
Returns a const reference to the element at position pos in the list
Acquisitions(std::vector< Settings2D::Acquisition > value)
Constructor
Definition: Settings2D.h:969
void forEach(const F &f)
Run the given function on each element in the list
Definition: Settings2D.h:1031
Settings2D::Acquisition & at(std::size_t pos)
Returns a reference to the element at position pos in the list
void forEach(const F &f) const
Run the given function on each element in the list
Definition: Settings2D.h:1041
std::vector< Settings2D::Acquisition > ValueType
The type of the underlying value
Definition: Settings2D.h:957
Iterator begin() noexcept
Returns an iterator to the first element of the list
std::string toString() const
Get the value as string
friend std::ostream & operator<<(std::ostream &stream, const Acquisitions &value)
Operator to serialize the value to a stream
Definition: Settings2D.h:1086
std::vector< Settings2D::Acquisition >::iterator Iterator
Iterator type for Acquisitions
Definition: Settings2D.h:1050
std::vector< Settings2D::Acquisition >::const_iterator ConstIterator
Constant iterator type for Acquisitions
Definition: Settings2D.h:1059
std::size_t size() const noexcept
Get the size of the list
bool operator!=(const Acquisitions &other) const
Comparison operator
Definition: Settings2D.h:1080
Acquisitions()=default
Default constructor
const std::vector< Settings2D::Acquisition > & value() const
Get the value
Digital gain applied to blue channel
Definition: Settings2D.h:1157
friend std::ostream & operator<<(std::ostream &stream, const Blue &value)
Operator to serialize the value to a stream
Definition: Settings2D.h:1242
bool operator<=(const Blue &other) const
Comparison operator
Definition: Settings2D.h:1230
bool operator==(const Blue &other) const
Comparison operator
Definition: Settings2D.h:1206
void reset()
Reset the node to unset state
double ValueType
The type of the underlying value
Definition: Settings2D.h:1174
bool operator>(const Blue &other) const
Comparison operator
Definition: Settings2D.h:1224
std::string toString() const
Get the value as string
constexpr Blue(double value)
Constructor
Definition: Settings2D.h:1186
bool operator!=(const Blue &other) const
Comparison operator
Definition: Settings2D.h:1212
bool hasValue() const
Check if the value is set
static constexpr Range< double > validRange()
The range of valid values for Blue
Definition: Settings2D.h:1177
bool operator<(const Blue &other) const
Comparison operator
Definition: Settings2D.h:1218
bool operator>=(const Blue &other) const
Comparison operator
Definition: Settings2D.h:1236
Digital gain applied to green channel
Definition: Settings2D.h:1269
double ValueType
The type of the underlying value
Definition: Settings2D.h:1286
static constexpr Range< double > validRange()
The range of valid values for Green
Definition: Settings2D.h:1289
bool operator==(const Green &other) const
Comparison operator
Definition: Settings2D.h:1318
std::string toString() const
Get the value as string
constexpr Green(double value)
Constructor
Definition: Settings2D.h:1298
friend std::ostream & operator<<(std::ostream &stream, const Green &value)
Operator to serialize the value to a stream
Definition: Settings2D.h:1354
bool operator<(const Green &other) const
Comparison operator
Definition: Settings2D.h:1330
bool hasValue() const
Check if the value is set
bool operator<=(const Green &other) const
Comparison operator
Definition: Settings2D.h:1342
bool operator>=(const Green &other) const
Comparison operator
Definition: Settings2D.h:1348
bool operator!=(const Green &other) const
Comparison operator
Definition: Settings2D.h:1324
bool operator>(const Green &other) const
Comparison operator
Definition: Settings2D.h:1336
void reset()
Reset the node to unset state
Digital gain applied to red channel
Definition: Settings2D.h:1381
double ValueType
The type of the underlying value
Definition: Settings2D.h:1398
friend std::ostream & operator<<(std::ostream &stream, const Red &value)
Operator to serialize the value to a stream
Definition: Settings2D.h:1466
bool operator>=(const Red &other) const
Comparison operator
Definition: Settings2D.h:1460
bool operator<(const Red &other) const
Comparison operator
Definition: Settings2D.h:1442
bool operator<=(const Red &other) const
Comparison operator
Definition: Settings2D.h:1454
std::string toString() const
Get the value as string
static constexpr Range< double > validRange()
The range of valid values for Red
Definition: Settings2D.h:1401
bool hasValue() const
Check if the value is set
bool operator!=(const Red &other) const
Comparison operator
Definition: Settings2D.h:1436
constexpr Red(double value)
Constructor
Definition: Settings2D.h:1410
bool operator==(const Red &other) const
Comparison operator
Definition: Settings2D.h:1430
void reset()
Reset the node to unset state
bool operator>(const Red &other) const
Comparison operator
Definition: Settings2D.h:1448
Color balance settings
Definition: Settings2D.h:1139
const Settings2D::Processing::Color::Balance::Red & get() const
Definition: Settings2D.h:1688
Balance(Args &&...args)
Constructor taking variadic number of arguments
Definition: Settings2D.h:1521
Blue & blue()
Get Blue
Definition: Settings2D.h:1613
bool operator!=(const Balance &other) const
Inequality operator
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: Settings2D.h:1722
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter
Definition: Settings2D.h:1713
const Blue & blue() const
Get Blue
Definition: Settings2D.h:1607
bool operator==(const Balance &other) const
Equality operator
Balance & set(const Blue &value)
Set Blue
Definition: Settings2D.h:1619
Red & red()
Get Red
Definition: Settings2D.h:1651
Green & green()
Get Green
Definition: Settings2D.h:1632
Balance & set(const Green &value)
Set Green
Definition: Settings2D.h:1638
Balance copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition: Settings2D.h:1586
const Green & green() const
Get Green
Definition: Settings2D.h:1626
Balance & set(const Red &value)
Set Red
Definition: Settings2D.h:1657
const Settings2D::Processing::Color::Balance::Green & get() const
Definition: Settings2D.h:1678
const Red & red() const
Get Red
Definition: Settings2D.h:1645
std::string toString() const
Get the value as string
void set(Args &&...args)
Set multiple arguments
Definition: Settings2D.h:1550
friend std::ostream & operator<<(std::ostream &stream, const Balance &value)
Operator to send the value as string to a stream
Definition: Settings2D.h:1739
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition: Settings2D.h:1668
std::tuple< Settings2D::Processing::Color::Balance::Blue, Settings2D::Processing::Color::Balance::Green, Settings2D::Processing::Color::Balance::Red > Descendants
Definition: Settings2D.h:1492
Gamma applied to the color values. Gamma less than 1 makes the colors brighter, while gamma greater t...
Definition: Settings2D.h:1764
double ValueType
The type of the underlying value
Definition: Settings2D.h:1783
static constexpr Range< double > validRange()
The range of valid values for Gamma
Definition: Settings2D.h:1786
bool operator>(const Gamma &other) const
Comparison operator
Definition: Settings2D.h:1833
bool operator==(const Gamma &other) const
Comparison operator
Definition: Settings2D.h:1815
friend std::ostream & operator<<(std::ostream &stream, const Gamma &value)
Operator to serialize the value to a stream
Definition: Settings2D.h:1851
bool operator!=(const Gamma &other) const
Comparison operator
Definition: Settings2D.h:1821
bool hasValue() const
Check if the value is set
std::string toString() const
Get the value as string
bool operator<(const Gamma &other) const
Comparison operator
Definition: Settings2D.h:1827
void reset()
Reset the node to unset state
bool operator>=(const Gamma &other) const
Comparison operator
Definition: Settings2D.h:1845
constexpr Gamma(double value)
Constructor
Definition: Settings2D.h:1795
Gamma()=default
Default constructor
bool operator<=(const Gamma &other) const
Comparison operator
Definition: Settings2D.h:1839
Color settings
Definition: Settings2D.h:1121
void set(Args &&...args)
Set multiple arguments
Definition: Settings2D.h:1940
Color & set(const Balance::Green &value)
Set Balance::Green
Definition: Settings2D.h:2024
bool operator!=(const Color &other) const
Inequality operator
bool operator==(const Color &other) const
Equality operator
std::string toString() const
Get the value as string
const Balance & balance() const
Get Balance
Definition: Settings2D.h:1998
Color & set(const Balance::Blue &value)
Set Balance::Blue
Definition: Settings2D.h:2017
Balance & balance()
Get Balance
Definition: Settings2D.h:2004
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter
Definition: Settings2D.h:2115
friend std::ostream & operator<<(std::ostream &stream, const Color &value)
Operator to send the value as string to a stream
Definition: Settings2D.h:2139
Color(Args &&...args)
Constructor taking variadic number of arguments
Definition: Settings2D.h:1909
const Settings2D::Processing::Color::Gamma & get() const
Definition: Settings2D.h:2096
const Settings2D::Processing::Color::Balance::Green & get() const
Definition: Settings2D.h:2078
Gamma & gamma()
Get Gamma
Definition: Settings2D.h:2044
std::tuple< Settings2D::Processing::Color::Balance, Settings2D::Processing::Color::Balance::Blue, Settings2D::Processing::Color::Balance::Green, Settings2D::Processing::Color::Balance::Red, Settings2D::Processing::Color::Gamma > Descendants
Definition: Settings2D.h:1878
const Settings2D::Processing::Color::Balance::Red & get() const
Definition: Settings2D.h:2087
Color copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition: Settings2D.h:1977
const Settings2D::Processing::Color::Balance & get() const
Definition: Settings2D.h:2060
const Gamma & gamma() const
Get Gamma
Definition: Settings2D.h:2038
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition: Settings2D.h:2069
Color & set(const Balance &value)
Set Balance
Definition: Settings2D.h:2010
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: Settings2D.h:2123
Color & set(const Gamma &value)
Set Gamma
Definition: Settings2D.h:2050
Color & set(const Balance::Red &value)
Set Balance::Red
Definition: Settings2D.h:2031
Processing related settings
Definition: Settings2D.h:1103
const Settings2D::Processing::Color & get() const
Definition: Settings2D.h:2340
Processing & set(const Color::Gamma &value)
Set Color::Gamma
Definition: Settings2D.h:2331
bool operator!=(const Processing &other) const
Inequality operator
bool operator==(const Processing &other) const
Equality operator
Processing & set(const Color &value)
Set Color
Definition: Settings2D.h:2296
const Settings2D::Processing::Color::Balance & get() const
Definition: Settings2D.h:2348
friend std::ostream & operator<<(std::ostream &stream, const Processing &value)
Operator to send the value as string to a stream
Definition: Settings2D.h:2418
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter
Definition: Settings2D.h:2396
Color & color()
Get Color
Definition: Settings2D.h:2290
void set(Args &&...args)
Set multiple arguments
Definition: Settings2D.h:2227
Processing & set(const Color::Balance::Blue &value)
Set Color::Balance::Blue
Definition: Settings2D.h:2310
Processing & set(const Color::Balance &value)
Set Color::Balance
Definition: Settings2D.h:2303
std::tuple< Settings2D::Processing::Color, Settings2D::Processing::Color::Balance, Settings2D::Processing::Color::Balance::Blue, Settings2D::Processing::Color::Balance::Green, Settings2D::Processing::Color::Balance::Red, Settings2D::Processing::Color::Gamma > Descendants
Definition: Settings2D.h:2163
const Color & color() const
Get Color
Definition: Settings2D.h:2284
Processing & set(const Color::Balance::Red &value)
Set Color::Balance::Red
Definition: Settings2D.h:2324
const Settings2D::Processing::Color::Gamma & get() const
Definition: Settings2D.h:2383
const Settings2D::Processing::Color::Balance::Red & get() const
Definition: Settings2D.h:2375
Processing copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition: Settings2D.h:2264
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition: Settings2D.h:2357
const Settings2D::Processing::Color::Balance::Green & get() const
Definition: Settings2D.h:2366
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: Settings2D.h:2403
Processing()
Default constructor
Processing(Args &&...args)
Constructor taking variadic number of arguments
Definition: Settings2D.h:2195
Processing & set(const Color::Balance::Green &value)
Set Color::Balance::Green
Definition: Settings2D.h:2317
Settings used when capturing 2D images with a Zivid camera
Definition: Settings2D.h:123
Settings2D & set(const Processing &value)
Set Processing
Definition: Settings2D.h:2602
const Settings2D::Processing::Color & get() const
Definition: Settings2D.h:2665
const Settings2D::Processing::Color::Balance::Red & get() const
Definition: Settings2D.h:2699
const Settings2D::Processing::Color::Balance::Green & get() const
Definition: Settings2D.h:2691
void save(const std::string &fileName) const
Save to the given file
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition: Settings2D.h:2682
const Acquisitions & acquisitions() const
Get Acquisitions
Definition: Settings2D.h:2571
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: Settings2D.h:2734
Settings2D(Args &&...args)
Constructor taking variadic number of arguments
Definition: Settings2D.h:2479
const Settings2D::Acquisitions & get() const
Definition: Settings2D.h:2651
Settings2D()
Default constructor
const Settings2D::Processing::Color::Gamma & get() const
Definition: Settings2D.h:2707
Settings2D & set(const Acquisitions &value)
Set Acquisitions
Definition: Settings2D.h:2583
Settings2D(const std::string &fileName)
Construct Settings2D by loading from file
void load(const std::string &fileName)
Load from the given file
const Settings2D::Processing::Color::Balance & get() const
Definition: Settings2D.h:2673
Settings2D & set(const Processing::Color::Balance::Green &value)
Set Processing::Color::Balance::Green
Definition: Settings2D.h:2630
std::tuple< Settings2D::Acquisitions, Settings2D::Processing, Settings2D::Processing::Color, Settings2D::Processing::Color::Balance, Settings2D::Processing::Color::Balance::Blue, Settings2D::Processing::Color::Balance::Green, Settings2D::Processing::Color::Balance::Red, Settings2D::Processing::Color::Gamma > Descendants
Definition: Settings2D.h:2443
bool operator!=(const Settings2D &other) const
Inequality operator
Settings2D & set(const Processing::Color::Balance &value)
Set Processing::Color::Balance
Definition: Settings2D.h:2616
const Settings2D::Processing & get() const
Definition: Settings2D.h:2657
Settings2D & set(const Processing::Color::Balance::Red &value)
Set Processing::Color::Balance::Red
Definition: Settings2D.h:2637
void set(Args &&...args)
Set multiple arguments
Definition: Settings2D.h:2513
Processing & processing()
Get Processing
Definition: Settings2D.h:2596
const Processing & processing() const
Get Processing
Definition: Settings2D.h:2590
Settings2D copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition: Settings2D.h:2552
Settings2D & set(const Processing::Color::Balance::Blue &value)
Set Processing::Color::Balance::Blue
Definition: Settings2D.h:2623
Acquisitions & acquisitions()
Get Acquisitions
Definition: Settings2D.h:2577
std::string toString() const
Get the value as string
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter
Definition: Settings2D.h:2726
bool operator==(const Settings2D &other) const
Equality operator
friend std::ostream & operator<<(std::ostream &stream, const Settings2D &value)
Operator to send the value as string to a stream
Definition: Settings2D.h:2750
Settings2D & set(const Processing::Color &value)
Set Processing::Color
Definition: Settings2D.h:2609
Settings2D & set(const Processing::Color::Gamma &value)
Set Processing::Color::Gamma
Definition: Settings2D.h:2644
NodeType
Definition: NodeType.h:100
Ret validRange(const CameraInfo &cameraInfo)
Definition: SettingsInfo.h:225
The main Zivid namespace. All Zivid code is found here
Definition: Application.h:99