Zivid C++ API 2.11.1+de9b5dae-1
Settings2D.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{ "Settings2D" };
88
90 static constexpr const char *description{
91 R"description(Settings used when capturing 2D images with a Zivid camera)description"
92 };
93
94 static constexpr size_t version{ 3 };
95
96#ifndef NO_DOC
97 template<size_t>
98 struct Version;
99
100 using LatestVersion = Zivid::Settings2D;
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{ 's', 't', '2' };
105
106#endif
107
109
110 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
112 {
113 public:
115 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
116
118 static constexpr const char *path{ "Acquisition" };
119
121 static constexpr const char *name{ "Acquisition" };
122
124 static constexpr const char *description{ R"description(Settings for a single acquisition)description" };
125
129
130 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
132 {
133 public:
135 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
136
138 static constexpr const char *path{ "Acquisition/Aperture" };
139
141 static constexpr const char *name{ "Aperture" };
142
144 static constexpr const char *description{
145 R"description(Aperture setting for the camera. Specified as an f-number (the ratio of lens focal length to
146the effective aperture diameter).
147)description"
148 };
149
151 using ValueType = double;
152
154 static constexpr Range<double> validRange()
155 {
156 return { 1.4, 32.0 };
157 }
158
160 Aperture() = default;
161
163 explicit constexpr Aperture(double value)
164 : m_opt{ verifyValue(value) }
165 {}
166
171 double value() const;
172
174 bool hasValue() const;
175
177 void reset();
178
180 std::string toString() const;
181
183 bool operator==(const Aperture &other) const
184 {
185 return m_opt == other.m_opt;
186 }
187
189 bool operator!=(const Aperture &other) const
190 {
191 return m_opt != other.m_opt;
192 }
193
195 bool operator<(const Aperture &other) const
196 {
197 return m_opt < other.m_opt;
198 }
199
201 bool operator>(const Aperture &other) const
202 {
203 return m_opt > other.m_opt;
204 }
205
207 bool operator<=(const Aperture &other) const
208 {
209 return m_opt <= other.m_opt;
210 }
211
213 bool operator>=(const Aperture &other) const
214 {
215 return m_opt >= other.m_opt;
216 }
217
219 friend std::ostream &operator<<(std::ostream &stream, const Aperture &value)
220 {
221 return stream << value.toString();
222 }
223
224 private:
225 void setFromString(const std::string &value);
226
227 constexpr ValueType static verifyValue(const ValueType &value)
228 {
229 return validRange().isInRange(value)
230 ? value
231 : throw std::out_of_range{ "Aperture{ " + std::to_string(value) + " } is not in range ["
232 + std::to_string(validRange().min()) + ", "
233 + std::to_string(validRange().max()) + "]" };
234 }
235
236 Zivid::DataModel::Detail::Optional<double> m_opt;
237
238 friend struct DataModel::Detail::Befriend<Aperture>;
239 };
240
252
253 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
255 {
256 public:
258 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
259
261 static constexpr const char *path{ "Acquisition/Brightness" };
262
264 static constexpr const char *name{ "Brightness" };
265
267 static constexpr const char *description{
268 R"description(Brightness controls the light output from the projector.
269
270Brightness above 1.0 may be needed when the distance between the camera and the scene is large,
271or in case of high levels of ambient lighting.
272
273When brightness is above 1.0 the duty cycle of the camera (the percentage of time the camera
274can capture) will be reduced. The duty cycle in boost mode is 50%. The duty cycle is calculated
275over a 10 second period. This limitation is enforced automatically by the camera. Calling capture
276when the duty cycle limit has been reached will cause the camera to first wait (sleep) for a
277duration of time to cool down, before capture will start.
278)description"
279 };
280
282 using ValueType = double;
283
285 static constexpr Range<double> validRange()
286 {
287 return { 0, 2.5 };
288 }
289
291 Brightness() = default;
292
294 explicit constexpr Brightness(double value)
295 : m_opt{ verifyValue(value) }
296 {}
297
302 double value() const;
303
305 bool hasValue() const;
306
308 void reset();
309
311 std::string toString() const;
312
314 bool operator==(const Brightness &other) const
315 {
316 return m_opt == other.m_opt;
317 }
318
320 bool operator!=(const Brightness &other) const
321 {
322 return m_opt != other.m_opt;
323 }
324
326 bool operator<(const Brightness &other) const
327 {
328 return m_opt < other.m_opt;
329 }
330
332 bool operator>(const Brightness &other) const
333 {
334 return m_opt > other.m_opt;
335 }
336
338 bool operator<=(const Brightness &other) const
339 {
340 return m_opt <= other.m_opt;
341 }
342
344 bool operator>=(const Brightness &other) const
345 {
346 return m_opt >= other.m_opt;
347 }
348
350 friend std::ostream &operator<<(std::ostream &stream, const Brightness &value)
351 {
352 return stream << value.toString();
353 }
354
355 private:
356 void setFromString(const std::string &value);
357
358 constexpr ValueType static verifyValue(const ValueType &value)
359 {
360 return validRange().isInRange(value)
361 ? value
362 : throw std::out_of_range{ "Brightness{ " + std::to_string(value)
363 + " } is not in range [" + std::to_string(validRange().min())
364 + ", " + std::to_string(validRange().max()) + "]" };
365 }
366
367 Zivid::DataModel::Detail::Optional<double> m_opt;
368
369 friend struct DataModel::Detail::Befriend<Brightness>;
370 };
371
373
374 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
376 {
377 public:
379 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
380
382 static constexpr const char *path{ "Acquisition/ExposureTime" };
383
385 static constexpr const char *name{ "ExposureTime" };
386
388 static constexpr const char *description{ R"description(Exposure time for the image)description" };
389
391 using ValueType = std::chrono::microseconds;
392
395 {
396 return { std::chrono::microseconds{ 1677 }, std::chrono::microseconds{ 100000 } };
397 }
398
400 ExposureTime() = default;
401
403 explicit constexpr ExposureTime(std::chrono::microseconds value)
404 : m_opt{ verifyValue(value) }
405 {}
406
411 std::chrono::microseconds value() const;
412
414 bool hasValue() const;
415
417 void reset();
418
420 std::string toString() const;
421
423 bool operator==(const ExposureTime &other) const
424 {
425 return m_opt == other.m_opt;
426 }
427
429 bool operator!=(const ExposureTime &other) const
430 {
431 return m_opt != other.m_opt;
432 }
433
435 bool operator<(const ExposureTime &other) const
436 {
437 return m_opt < other.m_opt;
438 }
439
441 bool operator>(const ExposureTime &other) const
442 {
443 return m_opt > other.m_opt;
444 }
445
447 bool operator<=(const ExposureTime &other) const
448 {
449 return m_opt <= other.m_opt;
450 }
451
453 bool operator>=(const ExposureTime &other) const
454 {
455 return m_opt >= other.m_opt;
456 }
457
459 friend std::ostream &operator<<(std::ostream &stream, const ExposureTime &value)
460 {
461 return stream << value.toString();
462 }
463
464 private:
465 void setFromString(const std::string &value);
466
467 constexpr ValueType static verifyValue(const ValueType &value)
468 {
469 return validRange().isInRange(value)
470 ? value
471 : throw std::out_of_range{ "ExposureTime{ " + std::to_string(value.count())
472 + " } is not in range ["
473 + std::to_string(validRange().min().count()) + ", "
474 + std::to_string(validRange().max().count()) + "]" };
475 }
476
477 Zivid::DataModel::Detail::Optional<std::chrono::microseconds> m_opt;
478
479 friend struct DataModel::Detail::Befriend<ExposureTime>;
480 };
481
483
484 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
486 {
487 public:
489 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
490
492 static constexpr const char *path{ "Acquisition/Gain" };
493
495 static constexpr const char *name{ "Gain" };
496
498 static constexpr const char *description{ R"description(Analog gain in the camera)description" };
499
501 using ValueType = double;
502
504 static constexpr Range<double> validRange()
505 {
506 return { 1, 16 };
507 }
508
510 Gain() = default;
511
513 explicit constexpr Gain(double value)
514 : m_opt{ verifyValue(value) }
515 {}
516
521 double value() const;
522
524 bool hasValue() const;
525
527 void reset();
528
530 std::string toString() const;
531
533 bool operator==(const Gain &other) const
534 {
535 return m_opt == other.m_opt;
536 }
537
539 bool operator!=(const Gain &other) const
540 {
541 return m_opt != other.m_opt;
542 }
543
545 bool operator<(const Gain &other) const
546 {
547 return m_opt < other.m_opt;
548 }
549
551 bool operator>(const Gain &other) const
552 {
553 return m_opt > other.m_opt;
554 }
555
557 bool operator<=(const Gain &other) const
558 {
559 return m_opt <= other.m_opt;
560 }
561
563 bool operator>=(const Gain &other) const
564 {
565 return m_opt >= other.m_opt;
566 }
567
569 friend std::ostream &operator<<(std::ostream &stream, const Gain &value)
570 {
571 return stream << value.toString();
572 }
573
574 private:
575 void setFromString(const std::string &value);
576
577 constexpr ValueType static verifyValue(const ValueType &value)
578 {
579 return validRange().isInRange(value)
580 ? value
581 : throw std::out_of_range{ "Gain{ " + std::to_string(value) + " } is not in range ["
582 + std::to_string(validRange().min()) + ", "
583 + std::to_string(validRange().max()) + "]" };
584 }
585
586 Zivid::DataModel::Detail::Optional<double> m_opt;
587
588 friend struct DataModel::Detail::Befriend<Gain>;
589 };
590
591 using Descendants = std::tuple<
596
599
614#ifndef NO_DOC
615 template<
616 typename... Args,
617 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
618 typename std::enable_if<
619 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
620 value,
621 int>::type = 0>
622#else
623 template<typename... Args>
624#endif
625 explicit Acquisition(Args &&...args)
626 {
627 using namespace Zivid::Detail::TypeTraits;
628
629 static_assert(
630 AllArgsDecayedAreUnique<Args...>::value,
631 "Found duplicate types among the arguments passed to Acquisition(...). "
632 "Types should be listed at most once.");
633
634 set(std::forward<Args>(args)...);
635 }
636
650#ifndef NO_DOC
651 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
652#else
653 template<typename... Args>
654#endif
655 void set(Args &&...args)
656 {
657 using namespace Zivid::Detail::TypeTraits;
658
659 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
660 static_assert(
661 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
662
663 static_assert(
664 AllArgsDecayedAreUnique<Args...>::value,
665 "Found duplicate types among the arguments passed to set(...). "
666 "Types should be listed at most once.");
667
668 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
669 }
670
685#ifndef NO_DOC
686 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
687#else
688 template<typename... Args>
689#endif
690 Acquisition copyWith(Args &&...args) const
691 {
692 using namespace Zivid::Detail::TypeTraits;
693
694 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
695 static_assert(
696 AllArgsAreDescendantNodes::value,
697 "All arguments passed to copyWith(...) must be descendant nodes.");
698
699 static_assert(
700 AllArgsDecayedAreUnique<Args...>::value,
701 "Found duplicate types among the arguments passed to copyWith(...). "
702 "Types should be listed at most once.");
703
704 auto copy{ *this };
705 copy.set(std::forward<Args>(args)...);
706 return copy;
707 }
708
710 const Aperture &aperture() const
711 {
712 return m_aperture;
713 }
714
717 {
718 return m_aperture;
719 }
720
722 Acquisition &set(const Aperture &value)
723 {
724 m_aperture = value;
725 return *this;
726 }
727
729 const Brightness &brightness() const
730 {
731 return m_brightness;
732 }
733
736 {
737 return m_brightness;
738 }
739
742 {
743 m_brightness = value;
744 return *this;
745 }
746
749 {
750 return m_exposureTime;
751 }
752
755 {
756 return m_exposureTime;
757 }
758
761 {
762 m_exposureTime = value;
763 return *this;
764 }
765
767 const Gain &gain() const
768 {
769 return m_gain;
770 }
771
774 {
775 return m_gain;
776 }
777
779 Acquisition &set(const Gain &value)
780 {
781 m_gain = value;
782 return *this;
783 }
784
785 template<
786 typename T,
787 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::Aperture>::value, int>::type = 0>
789 {
790 return m_aperture;
791 }
792
793 template<
794 typename T,
795 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::Brightness>::value, int>::type = 0>
797 {
798 return m_brightness;
799 }
800
801 template<
802 typename T,
803 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::ExposureTime>::value, int>::type = 0>
805 {
806 return m_exposureTime;
807 }
808
809 template<
810 typename T,
811 typename std::enable_if<std::is_same<T, Settings2D::Acquisition::Gain>::value, int>::type = 0>
813 {
814 return m_gain;
815 }
816
817 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
819 {
820 return m_aperture;
821 }
822
823 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
825 {
826 return m_brightness;
827 }
828
829 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
831 {
832 return m_exposureTime;
833 }
834
835 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
837 {
838 return m_gain;
839 }
840
842 template<typename F>
843 void forEach(const F &f) const
844 {
845 f(m_aperture);
846 f(m_brightness);
847 f(m_exposureTime);
848 f(m_gain);
849 }
850
852 template<typename F>
853 void forEach(const F &f)
854 {
855 f(m_aperture);
856 f(m_brightness);
857 f(m_exposureTime);
858 f(m_gain);
859 }
860
862 bool operator==(const Acquisition &other) const;
863
865 bool operator!=(const Acquisition &other) const;
866
868 std::string toString() const;
869
871 friend std::ostream &operator<<(std::ostream &stream, const Acquisition &value)
872 {
873 return stream << value.toString();
874 }
875
876 private:
877 void setFromString(const std::string &value);
878
879 void setFromString(const std::string &fullPath, const std::string &value);
880
881 std::string getString(const std::string &fullPath) const;
882
883 Aperture m_aperture;
884 Brightness m_brightness;
885 ExposureTime m_exposureTime;
886 Gain m_gain;
887
888 friend struct DataModel::Detail::Befriend<Acquisition>;
889 };
890
892
893 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
895 {
896 public:
898 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafDataModelList;
899
901 static constexpr const char *path{ "Acquisitions" };
902
904 static constexpr const char *name{ "Acquisitions" };
905
907 static constexpr const char *description{
908 R"description(List of acquisitions. Note that the Zivid SDK only supports a single acquisition per capture in 2D mode.)description"
909 };
910
912 using ValueType = std::vector<Settings2D::Acquisition>;
913
916 {
917 return { 0, std::numeric_limits<ValueType::size_type>::max() };
918 }
919
921 Acquisitions() = default;
922
924 explicit Acquisitions(std::vector<Settings2D::Acquisition> value)
925 : m_value{ std::move(value) }
926 {}
927
929 explicit Acquisitions(std::initializer_list<Settings2D::Acquisition> value)
930 : Acquisitions{ ValueType{ value } }
931 {}
932
934 const std::vector<Settings2D::Acquisition> &value() const;
935
937 std::string toString() const;
938
940 std::size_t size() const noexcept;
941
943 bool isEmpty() const noexcept;
944
950 template<typename... Args>
951 void emplaceBack(Args &&...args)
952 {
953 m_value.emplace_back(std::forward<Args>(args)...);
954 }
955
961 Settings2D::Acquisition &at(std::size_t pos);
962
968 const Settings2D::Acquisition &at(std::size_t pos) const;
969
976
982 const Settings2D::Acquisition &operator[](std::size_t pos) const;
983
985 template<typename F>
986 void forEach(const F &f)
987 {
988 for(auto &child : m_value)
989 {
990 f(child);
991 }
992 }
993
995 template<typename F>
996 void forEach(const F &f) const
997 {
998 for(const auto &child : m_value)
999 {
1000 f(child);
1001 }
1002 }
1003
1005 using Iterator = std::vector<Settings2D::Acquisition>::iterator;
1006
1008 Iterator begin() noexcept;
1009
1011 Iterator end() noexcept;
1012
1014 using ConstIterator = std::vector<Settings2D::Acquisition>::const_iterator;
1015
1017 ConstIterator begin() const noexcept;
1018
1020 ConstIterator end() const noexcept;
1021
1023 ConstIterator cbegin() const noexcept;
1024
1026 ConstIterator cend() const noexcept;
1027
1029 bool operator==(const Acquisitions &other) const
1030 {
1031 return m_value == other.m_value;
1032 }
1033
1035 bool operator!=(const Acquisitions &other) const
1036 {
1037 return m_value != other.m_value;
1038 }
1039
1041 friend std::ostream &operator<<(std::ostream &stream, const Acquisitions &value)
1042 {
1043 return stream << value.toString();
1044 }
1045
1046 private:
1047 void setFromString(const std::string &value);
1048
1049 std::vector<Settings2D::Acquisition> m_value{};
1050
1051 friend struct DataModel::Detail::Befriend<Acquisitions>;
1052 };
1053
1055
1056 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1058 {
1059 public:
1061 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
1062
1064 static constexpr const char *path{ "Processing" };
1065
1067 static constexpr const char *name{ "Processing" };
1068
1070 static constexpr const char *description{ R"description(Processing related settings)description" };
1071
1073
1074 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1076 {
1077 public:
1079 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
1080
1082 static constexpr const char *path{ "Processing/Color" };
1083
1085 static constexpr const char *name{ "Color" };
1086
1088 static constexpr const char *description{ R"description(Color settings)description" };
1089
1091
1092 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1094 {
1095 public:
1097 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
1098
1100 static constexpr const char *path{ "Processing/Color/Balance" };
1101
1103 static constexpr const char *name{ "Balance" };
1104
1106 static constexpr const char *description{ R"description(Color balance settings)description" };
1107
1109
1110 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1112 {
1113 public:
1115 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1116
1118 static constexpr const char *path{ "Processing/Color/Balance/Blue" };
1119
1121 static constexpr const char *name{ "Blue" };
1122
1124 static constexpr const char *description{
1125 R"description(Digital gain applied to blue channel)description"
1126 };
1127
1129 using ValueType = double;
1130
1132 static constexpr Range<double> validRange()
1133 {
1134 return { 1.0, 8.0 };
1135 }
1136
1138 Blue() = default;
1139
1141 explicit constexpr Blue(double value)
1142 : m_opt{ verifyValue(value) }
1143 {}
1144
1149 double value() const;
1150
1152 bool hasValue() const;
1153
1155 void reset();
1156
1158 std::string toString() const;
1159
1161 bool operator==(const Blue &other) const
1162 {
1163 return m_opt == other.m_opt;
1164 }
1165
1167 bool operator!=(const Blue &other) const
1168 {
1169 return m_opt != other.m_opt;
1170 }
1171
1173 bool operator<(const Blue &other) const
1174 {
1175 return m_opt < other.m_opt;
1176 }
1177
1179 bool operator>(const Blue &other) const
1180 {
1181 return m_opt > other.m_opt;
1182 }
1183
1185 bool operator<=(const Blue &other) const
1186 {
1187 return m_opt <= other.m_opt;
1188 }
1189
1191 bool operator>=(const Blue &other) const
1192 {
1193 return m_opt >= other.m_opt;
1194 }
1195
1197 friend std::ostream &operator<<(std::ostream &stream, const Blue &value)
1198 {
1199 return stream << value.toString();
1200 }
1201
1202 private:
1203 void setFromString(const std::string &value);
1204
1205 constexpr ValueType static verifyValue(const ValueType &value)
1206 {
1207 return validRange().isInRange(value)
1208 ? value
1209 : throw std::out_of_range{ "Blue{ " + std::to_string(value)
1210 + " } is not in range ["
1211 + std::to_string(validRange().min()) + ", "
1212 + std::to_string(validRange().max()) + "]" };
1213 }
1214
1215 Zivid::DataModel::Detail::Optional<double> m_opt;
1216
1217 friend struct DataModel::Detail::Befriend<Blue>;
1218 };
1219
1221
1222 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1224 {
1225 public:
1227 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1228
1230 static constexpr const char *path{ "Processing/Color/Balance/Green" };
1231
1233 static constexpr const char *name{ "Green" };
1234
1236 static constexpr const char *description{
1237 R"description(Digital gain applied to green channel)description"
1238 };
1239
1241 using ValueType = double;
1242
1244 static constexpr Range<double> validRange()
1245 {
1246 return { 1.0, 8.0 };
1247 }
1248
1250 Green() = default;
1251
1253 explicit constexpr Green(double value)
1254 : m_opt{ verifyValue(value) }
1255 {}
1256
1261 double value() const;
1262
1264 bool hasValue() const;
1265
1267 void reset();
1268
1270 std::string toString() const;
1271
1273 bool operator==(const Green &other) const
1274 {
1275 return m_opt == other.m_opt;
1276 }
1277
1279 bool operator!=(const Green &other) const
1280 {
1281 return m_opt != other.m_opt;
1282 }
1283
1285 bool operator<(const Green &other) const
1286 {
1287 return m_opt < other.m_opt;
1288 }
1289
1291 bool operator>(const Green &other) const
1292 {
1293 return m_opt > other.m_opt;
1294 }
1295
1297 bool operator<=(const Green &other) const
1298 {
1299 return m_opt <= other.m_opt;
1300 }
1301
1303 bool operator>=(const Green &other) const
1304 {
1305 return m_opt >= other.m_opt;
1306 }
1307
1309 friend std::ostream &operator<<(std::ostream &stream, const Green &value)
1310 {
1311 return stream << value.toString();
1312 }
1313
1314 private:
1315 void setFromString(const std::string &value);
1316
1317 constexpr ValueType static verifyValue(const ValueType &value)
1318 {
1319 return validRange().isInRange(value)
1320 ? value
1321 : throw std::out_of_range{ "Green{ " + std::to_string(value)
1322 + " } is not in range ["
1323 + std::to_string(validRange().min()) + ", "
1324 + std::to_string(validRange().max()) + "]" };
1325 }
1326
1327 Zivid::DataModel::Detail::Optional<double> m_opt;
1328
1329 friend struct DataModel::Detail::Befriend<Green>;
1330 };
1331
1333
1334 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1336 {
1337 public:
1339 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1340
1342 static constexpr const char *path{ "Processing/Color/Balance/Red" };
1343
1345 static constexpr const char *name{ "Red" };
1346
1348 static constexpr const char *description{
1349 R"description(Digital gain applied to red channel)description"
1350 };
1351
1353 using ValueType = double;
1354
1356 static constexpr Range<double> validRange()
1357 {
1358 return { 1.0, 8.0 };
1359 }
1360
1362 Red() = default;
1363
1365 explicit constexpr Red(double value)
1366 : m_opt{ verifyValue(value) }
1367 {}
1368
1373 double value() const;
1374
1376 bool hasValue() const;
1377
1379 void reset();
1380
1382 std::string toString() const;
1383
1385 bool operator==(const Red &other) const
1386 {
1387 return m_opt == other.m_opt;
1388 }
1389
1391 bool operator!=(const Red &other) const
1392 {
1393 return m_opt != other.m_opt;
1394 }
1395
1397 bool operator<(const Red &other) const
1398 {
1399 return m_opt < other.m_opt;
1400 }
1401
1403 bool operator>(const Red &other) const
1404 {
1405 return m_opt > other.m_opt;
1406 }
1407
1409 bool operator<=(const Red &other) const
1410 {
1411 return m_opt <= other.m_opt;
1412 }
1413
1415 bool operator>=(const Red &other) const
1416 {
1417 return m_opt >= other.m_opt;
1418 }
1419
1421 friend std::ostream &operator<<(std::ostream &stream, const Red &value)
1422 {
1423 return stream << value.toString();
1424 }
1425
1426 private:
1427 void setFromString(const std::string &value);
1428
1429 constexpr ValueType static verifyValue(const ValueType &value)
1430 {
1431 return validRange().isInRange(value)
1432 ? value
1433 : throw std::out_of_range{ "Red{ " + std::to_string(value)
1434 + " } is not in range ["
1435 + std::to_string(validRange().min()) + ", "
1436 + std::to_string(validRange().max()) + "]" };
1437 }
1438
1439 Zivid::DataModel::Detail::Optional<double> m_opt;
1440
1441 friend struct DataModel::Detail::Befriend<Red>;
1442 };
1443
1444 using Descendants = std::tuple<
1448
1451
1465#ifndef NO_DOC
1466 template<
1467 typename... Args,
1468 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1469 typename std::enable_if<
1470 Zivid::Detail::TypeTraits::
1471 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
1472 int>::type = 0>
1473#else
1474 template<typename... Args>
1475#endif
1476 explicit Balance(Args &&...args)
1477 {
1478 using namespace Zivid::Detail::TypeTraits;
1479
1480 static_assert(
1481 AllArgsDecayedAreUnique<Args...>::value,
1482 "Found duplicate types among the arguments passed to Balance(...). "
1483 "Types should be listed at most once.");
1484
1485 set(std::forward<Args>(args)...);
1486 }
1487
1500#ifndef NO_DOC
1501 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1502#else
1503 template<typename... Args>
1504#endif
1505 void set(Args &&...args)
1506 {
1507 using namespace Zivid::Detail::TypeTraits;
1508
1509 using AllArgsAreDescendantNodes =
1510 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1511 static_assert(
1512 AllArgsAreDescendantNodes::value,
1513 "All arguments passed to set(...) must be descendant nodes.");
1514
1515 static_assert(
1516 AllArgsDecayedAreUnique<Args...>::value,
1517 "Found duplicate types among the arguments passed to set(...). "
1518 "Types should be listed at most once.");
1519
1520 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1521 }
1522
1536#ifndef NO_DOC
1537 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1538#else
1539 template<typename... Args>
1540#endif
1541 Balance copyWith(Args &&...args) const
1542 {
1543 using namespace Zivid::Detail::TypeTraits;
1544
1545 using AllArgsAreDescendantNodes =
1546 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1547 static_assert(
1548 AllArgsAreDescendantNodes::value,
1549 "All arguments passed to copyWith(...) must be descendant nodes.");
1550
1551 static_assert(
1552 AllArgsDecayedAreUnique<Args...>::value,
1553 "Found duplicate types among the arguments passed to copyWith(...). "
1554 "Types should be listed at most once.");
1555
1556 auto copy{ *this };
1557 copy.set(std::forward<Args>(args)...);
1558 return copy;
1559 }
1560
1562 const Blue &blue() const
1563 {
1564 return m_blue;
1565 }
1566
1569 {
1570 return m_blue;
1571 }
1572
1574 Balance &set(const Blue &value)
1575 {
1576 m_blue = value;
1577 return *this;
1578 }
1579
1581 const Green &green() const
1582 {
1583 return m_green;
1584 }
1585
1588 {
1589 return m_green;
1590 }
1591
1593 Balance &set(const Green &value)
1594 {
1595 m_green = value;
1596 return *this;
1597 }
1598
1600 const Red &red() const
1601 {
1602 return m_red;
1603 }
1604
1607 {
1608 return m_red;
1609 }
1610
1612 Balance &set(const Red &value)
1613 {
1614 m_red = value;
1615 return *this;
1616 }
1617
1618 template<
1619 typename T,
1620 typename std::enable_if<
1621 std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value,
1622 int>::type = 0>
1624 {
1625 return m_blue;
1626 }
1627
1628 template<
1629 typename T,
1630 typename std::enable_if<
1631 std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value,
1632 int>::type = 0>
1634 {
1635 return m_green;
1636 }
1637
1638 template<
1639 typename T,
1640 typename std::enable_if<
1641 std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value,
1642 int>::type = 0>
1644 {
1645 return m_red;
1646 }
1647
1648 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1650 {
1651 return m_blue;
1652 }
1653
1654 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1656 {
1657 return m_green;
1658 }
1659
1660 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
1662 {
1663 return m_red;
1664 }
1665
1667 template<typename F>
1668 void forEach(const F &f) const
1669 {
1670 f(m_blue);
1671 f(m_green);
1672 f(m_red);
1673 }
1674
1676 template<typename F>
1677 void forEach(const F &f)
1678 {
1679 f(m_blue);
1680 f(m_green);
1681 f(m_red);
1682 }
1683
1685 bool operator==(const Balance &other) const;
1686
1688 bool operator!=(const Balance &other) const;
1689
1691 std::string toString() const;
1692
1694 friend std::ostream &operator<<(std::ostream &stream, const Balance &value)
1695 {
1696 return stream << value.toString();
1697 }
1698
1699 private:
1700 void setFromString(const std::string &value);
1701
1702 void setFromString(const std::string &fullPath, const std::string &value);
1703
1704 std::string getString(const std::string &fullPath) const;
1705
1706 Blue m_blue;
1707 Green m_green;
1708 Red m_red;
1709
1710 friend struct DataModel::Detail::Befriend<Balance>;
1711 };
1712
1716
1717 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
1719 {
1720 public:
1722 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
1723
1725 static constexpr const char *path{ "Processing/Color/Gamma" };
1726
1728 static constexpr const char *name{ "Gamma" };
1729
1731 static constexpr const char *description{
1732 R"description(Gamma applied to the color values. Gamma less than 1 makes the colors brighter, while gamma
1733greater than 1 makes the colors darker.
1734)description"
1735 };
1736
1738 using ValueType = double;
1739
1741 static constexpr Range<double> validRange()
1742 {
1743 return { 0.25, 1.5 };
1744 }
1745
1747 Gamma() = default;
1748
1750 explicit constexpr Gamma(double value)
1751 : m_opt{ verifyValue(value) }
1752 {}
1753
1758 double value() const;
1759
1761 bool hasValue() const;
1762
1764 void reset();
1765
1767 std::string toString() const;
1768
1770 bool operator==(const Gamma &other) const
1771 {
1772 return m_opt == other.m_opt;
1773 }
1774
1776 bool operator!=(const Gamma &other) const
1777 {
1778 return m_opt != other.m_opt;
1779 }
1780
1782 bool operator<(const Gamma &other) const
1783 {
1784 return m_opt < other.m_opt;
1785 }
1786
1788 bool operator>(const Gamma &other) const
1789 {
1790 return m_opt > other.m_opt;
1791 }
1792
1794 bool operator<=(const Gamma &other) const
1795 {
1796 return m_opt <= other.m_opt;
1797 }
1798
1800 bool operator>=(const Gamma &other) const
1801 {
1802 return m_opt >= other.m_opt;
1803 }
1804
1806 friend std::ostream &operator<<(std::ostream &stream, const Gamma &value)
1807 {
1808 return stream << value.toString();
1809 }
1810
1811 private:
1812 void setFromString(const std::string &value);
1813
1814 constexpr ValueType static verifyValue(const ValueType &value)
1815 {
1816 return validRange().isInRange(value)
1817 ? value
1818 : throw std::out_of_range{ "Gamma{ " + std::to_string(value) + " } is not in range ["
1819 + std::to_string(validRange().min()) + ", "
1820 + std::to_string(validRange().max()) + "]" };
1821 }
1822
1823 Zivid::DataModel::Detail::Optional<double> m_opt;
1824
1825 friend struct DataModel::Detail::Befriend<Gamma>;
1826 };
1827
1828 using Descendants = std::tuple<
1834
1837
1853#ifndef NO_DOC
1854 template<
1855 typename... Args,
1856 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
1857 typename std::enable_if<
1858 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
1859 value,
1860 int>::type = 0>
1861#else
1862 template<typename... Args>
1863#endif
1864 explicit Color(Args &&...args)
1865 {
1866 using namespace Zivid::Detail::TypeTraits;
1867
1868 static_assert(
1869 AllArgsDecayedAreUnique<Args...>::value,
1870 "Found duplicate types among the arguments passed to Color(...). "
1871 "Types should be listed at most once.");
1872
1873 set(std::forward<Args>(args)...);
1874 }
1875
1890#ifndef NO_DOC
1891 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
1892#else
1893 template<typename... Args>
1894#endif
1895 void set(Args &&...args)
1896 {
1897 using namespace Zivid::Detail::TypeTraits;
1898
1899 using AllArgsAreDescendantNodes =
1900 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1901 static_assert(
1902 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
1903
1904 static_assert(
1905 AllArgsDecayedAreUnique<Args...>::value,
1906 "Found duplicate types among the arguments passed to set(...). "
1907 "Types should be listed at most once.");
1908
1909 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
1910 }
1911
1927#ifndef NO_DOC
1928 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
1929#else
1930 template<typename... Args>
1931#endif
1932 Color copyWith(Args &&...args) const
1933 {
1934 using namespace Zivid::Detail::TypeTraits;
1935
1936 using AllArgsAreDescendantNodes =
1937 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
1938 static_assert(
1939 AllArgsAreDescendantNodes::value,
1940 "All arguments passed to copyWith(...) must be descendant nodes.");
1941
1942 static_assert(
1943 AllArgsDecayedAreUnique<Args...>::value,
1944 "Found duplicate types among the arguments passed to copyWith(...). "
1945 "Types should be listed at most once.");
1946
1947 auto copy{ *this };
1948 copy.set(std::forward<Args>(args)...);
1949 return copy;
1950 }
1951
1953 const Balance &balance() const
1954 {
1955 return m_balance;
1956 }
1957
1960 {
1961 return m_balance;
1962 }
1963
1965 Color &set(const Balance &value)
1966 {
1967 m_balance = value;
1968 return *this;
1969 }
1970
1972 Color &set(const Balance::Blue &value)
1973 {
1974 m_balance.set(value);
1975 return *this;
1976 }
1977
1979 Color &set(const Balance::Green &value)
1980 {
1981 m_balance.set(value);
1982 return *this;
1983 }
1984
1986 Color &set(const Balance::Red &value)
1987 {
1988 m_balance.set(value);
1989 return *this;
1990 }
1991
1993 const Gamma &gamma() const
1994 {
1995 return m_gamma;
1996 }
1997
2000 {
2001 return m_gamma;
2002 }
2003
2005 Color &set(const Gamma &value)
2006 {
2007 m_gamma = value;
2008 return *this;
2009 }
2010
2011 template<
2012 typename T,
2013 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance>::value, int>::type =
2014 0>
2016 {
2017 return m_balance;
2018 }
2019
2020 template<
2021 typename T,
2022 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value, int>::
2023 type = 0>
2025 {
2026 return m_balance.get<Settings2D::Processing::Color::Balance::Blue>();
2027 }
2028
2029 template<
2030 typename T,
2031 typename std::
2032 enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value, int>::type = 0>
2034 {
2035 return m_balance.get<Settings2D::Processing::Color::Balance::Green>();
2036 }
2037
2038 template<
2039 typename T,
2040 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value, int>::
2041 type = 0>
2043 {
2044 return m_balance.get<Settings2D::Processing::Color::Balance::Red>();
2045 }
2046
2047 template<
2048 typename T,
2049 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Gamma>::value, int>::type =
2050 0>
2052 {
2053 return m_gamma;
2054 }
2055
2056 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2058 {
2059 return m_balance;
2060 }
2061
2062 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
2064 {
2065 return m_gamma;
2066 }
2067
2069 template<typename F>
2070 void forEach(const F &f) const
2071 {
2072 f(m_balance);
2073 f(m_gamma);
2074 }
2075
2077 template<typename F>
2078 void forEach(const F &f)
2079 {
2080 f(m_balance);
2081 f(m_gamma);
2082 }
2083
2085 bool operator==(const Color &other) const;
2086
2088 bool operator!=(const Color &other) const;
2089
2091 std::string toString() const;
2092
2094 friend std::ostream &operator<<(std::ostream &stream, const Color &value)
2095 {
2096 return stream << value.toString();
2097 }
2098
2099 private:
2100 void setFromString(const std::string &value);
2101
2102 void setFromString(const std::string &fullPath, const std::string &value);
2103
2104 std::string getString(const std::string &fullPath) const;
2105
2106 Balance m_balance;
2107 Gamma m_gamma;
2108
2109 friend struct DataModel::Detail::Befriend<Color>;
2110 };
2111
2112 using Descendants = std::tuple<
2119
2122
2139#ifndef NO_DOC
2140 template<
2141 typename... Args,
2142 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
2143 typename std::enable_if<
2144 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
2145 value,
2146 int>::type = 0>
2147#else
2148 template<typename... Args>
2149#endif
2150 explicit Processing(Args &&...args)
2151 {
2152 using namespace Zivid::Detail::TypeTraits;
2153
2154 static_assert(
2155 AllArgsDecayedAreUnique<Args...>::value,
2156 "Found duplicate types among the arguments passed to Processing(...). "
2157 "Types should be listed at most once.");
2158
2159 set(std::forward<Args>(args)...);
2160 }
2161
2177#ifndef NO_DOC
2178 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
2179#else
2180 template<typename... Args>
2181#endif
2182 void set(Args &&...args)
2183 {
2184 using namespace Zivid::Detail::TypeTraits;
2185
2186 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2187 static_assert(
2188 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
2189
2190 static_assert(
2191 AllArgsDecayedAreUnique<Args...>::value,
2192 "Found duplicate types among the arguments passed to set(...). "
2193 "Types should be listed at most once.");
2194
2195 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
2196 }
2197
2214#ifndef NO_DOC
2215 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
2216#else
2217 template<typename... Args>
2218#endif
2219 Processing copyWith(Args &&...args) const
2220 {
2221 using namespace Zivid::Detail::TypeTraits;
2222
2223 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2224 static_assert(
2225 AllArgsAreDescendantNodes::value,
2226 "All arguments passed to copyWith(...) must be descendant nodes.");
2227
2228 static_assert(
2229 AllArgsDecayedAreUnique<Args...>::value,
2230 "Found duplicate types among the arguments passed to copyWith(...). "
2231 "Types should be listed at most once.");
2232
2233 auto copy{ *this };
2234 copy.set(std::forward<Args>(args)...);
2235 return copy;
2236 }
2237
2239 const Color &color() const
2240 {
2241 return m_color;
2242 }
2243
2246 {
2247 return m_color;
2248 }
2249
2251 Processing &set(const Color &value)
2252 {
2253 m_color = value;
2254 return *this;
2255 }
2256
2259 {
2260 m_color.set(value);
2261 return *this;
2262 }
2263
2266 {
2267 m_color.set(value);
2268 return *this;
2269 }
2270
2273 {
2274 m_color.set(value);
2275 return *this;
2276 }
2277
2280 {
2281 m_color.set(value);
2282 return *this;
2283 }
2284
2287 {
2288 m_color.set(value);
2289 return *this;
2290 }
2291
2292 template<
2293 typename T,
2294 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color>::value, int>::type = 0>
2296 {
2297 return m_color;
2298 }
2299
2300 template<
2301 typename T,
2302 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance>::value, int>::type = 0>
2304 {
2306 }
2307
2308 template<
2309 typename T,
2310 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value, int>::
2311 type = 0>
2313 {
2315 }
2316
2317 template<
2318 typename T,
2319 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value, int>::
2320 type = 0>
2322 {
2324 }
2325
2326 template<
2327 typename T,
2328 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value, int>::
2329 type = 0>
2331 {
2332 return m_color.get<Settings2D::Processing::Color::Balance::Red>();
2333 }
2334
2335 template<
2336 typename T,
2337 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Gamma>::value, int>::type = 0>
2339 {
2340 return m_color.get<Settings2D::Processing::Color::Gamma>();
2341 }
2342
2343 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2345 {
2346 return m_color;
2347 }
2348
2350 template<typename F>
2351 void forEach(const F &f) const
2352 {
2353 f(m_color);
2354 }
2355
2357 template<typename F>
2358 void forEach(const F &f)
2359 {
2360 f(m_color);
2361 }
2362
2364 bool operator==(const Processing &other) const;
2365
2367 bool operator!=(const Processing &other) const;
2368
2370 std::string toString() const;
2371
2373 friend std::ostream &operator<<(std::ostream &stream, const Processing &value)
2374 {
2375 return stream << value.toString();
2376 }
2377
2378 private:
2379 void setFromString(const std::string &value);
2380
2381 void setFromString(const std::string &fullPath, const std::string &value);
2382
2383 std::string getString(const std::string &fullPath) const;
2384
2385 Color m_color;
2386
2387 friend struct DataModel::Detail::Befriend<Processing>;
2388 };
2389
2390 using Descendants = std::tuple<
2399
2402
2404 explicit Settings2D(const std::string &fileName);
2405
2424#ifndef NO_DOC
2425 template<
2426 typename... Args,
2427 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
2428 typename std::enable_if<
2429 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::value,
2430 int>::type = 0>
2431#else
2432 template<typename... Args>
2433#endif
2434 explicit Settings2D(Args &&...args)
2435 {
2436 using namespace Zivid::Detail::TypeTraits;
2437
2438 static_assert(
2439 AllArgsDecayedAreUnique<Args...>::value,
2440 "Found duplicate types among the arguments passed to Settings2D(...). "
2441 "Types should be listed at most once.");
2442
2443 set(std::forward<Args>(args)...);
2444 }
2445
2463#ifndef NO_DOC
2464 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
2465#else
2466 template<typename... Args>
2467#endif
2468 void set(Args &&...args)
2469 {
2470 using namespace Zivid::Detail::TypeTraits;
2471
2472 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2473 static_assert(
2474 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
2475
2476 static_assert(
2477 AllArgsDecayedAreUnique<Args...>::value,
2478 "Found duplicate types among the arguments passed to set(...). "
2479 "Types should be listed at most once.");
2480
2481 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
2482 }
2483
2502#ifndef NO_DOC
2503 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
2504#else
2505 template<typename... Args>
2506#endif
2507 Settings2D copyWith(Args &&...args) const
2508 {
2509 using namespace Zivid::Detail::TypeTraits;
2510
2511 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
2512 static_assert(
2513 AllArgsAreDescendantNodes::value, "All arguments passed to copyWith(...) must be descendant nodes.");
2514
2515 static_assert(
2516 AllArgsDecayedAreUnique<Args...>::value,
2517 "Found duplicate types among the arguments passed to copyWith(...). "
2518 "Types should be listed at most once.");
2519
2520 auto copy{ *this };
2521 copy.set(std::forward<Args>(args)...);
2522 return copy;
2523 }
2524
2527 {
2528 return m_acquisitions;
2529 }
2530
2533 {
2534 return m_acquisitions;
2535 }
2536
2539 {
2540 m_acquisitions = value;
2541 return *this;
2542 }
2543
2545 const Processing &processing() const
2546 {
2547 return m_processing;
2548 }
2549
2552 {
2553 return m_processing;
2554 }
2555
2558 {
2559 m_processing = value;
2560 return *this;
2561 }
2562
2565 {
2566 m_processing.set(value);
2567 return *this;
2568 }
2569
2572 {
2573 m_processing.set(value);
2574 return *this;
2575 }
2576
2579 {
2580 m_processing.set(value);
2581 return *this;
2582 }
2583
2586 {
2587 m_processing.set(value);
2588 return *this;
2589 }
2590
2593 {
2594 m_processing.set(value);
2595 return *this;
2596 }
2597
2600 {
2601 m_processing.set(value);
2602 return *this;
2603 }
2604
2605 template<typename T, typename std::enable_if<std::is_same<T, Settings2D::Acquisitions>::value, int>::type = 0>
2607 {
2608 return m_acquisitions;
2609 }
2610
2611 template<typename T, typename std::enable_if<std::is_same<T, Settings2D::Processing>::value, int>::type = 0>
2613 {
2614 return m_processing;
2615 }
2616
2617 template<
2618 typename T,
2619 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color>::value, int>::type = 0>
2621 {
2622 return m_processing.get<Settings2D::Processing::Color>();
2623 }
2624
2625 template<
2626 typename T,
2627 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance>::value, int>::type = 0>
2629 {
2630 return m_processing.get<Settings2D::Processing::Color::Balance>();
2631 }
2632
2633 template<
2634 typename T,
2635 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Blue>::value, int>::type =
2636 0>
2638 {
2639 return m_processing.get<Settings2D::Processing::Color::Balance::Blue>();
2640 }
2641
2642 template<
2643 typename T,
2644 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Green>::value, int>::type =
2645 0>
2647 {
2648 return m_processing.get<Settings2D::Processing::Color::Balance::Green>();
2649 }
2650
2651 template<
2652 typename T,
2653 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Balance::Red>::value, int>::type = 0>
2655 {
2656 return m_processing.get<Settings2D::Processing::Color::Balance::Red>();
2657 }
2658
2659 template<
2660 typename T,
2661 typename std::enable_if<std::is_same<T, Settings2D::Processing::Color::Gamma>::value, int>::type = 0>
2663 {
2664 return m_processing.get<Settings2D::Processing::Color::Gamma>();
2665 }
2666
2667 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2669 {
2670 return m_acquisitions;
2671 }
2672
2673 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
2675 {
2676 return m_processing;
2677 }
2678
2680 template<typename F>
2681 void forEach(const F &f) const
2682 {
2683 f(m_acquisitions);
2684 f(m_processing);
2685 }
2686
2688 template<typename F>
2689 void forEach(const F &f)
2690 {
2691 f(m_acquisitions);
2692 f(m_processing);
2693 }
2694
2696 bool operator==(const Settings2D &other) const;
2697
2699 bool operator!=(const Settings2D &other) const;
2700
2702 std::string toString() const;
2703
2705 friend std::ostream &operator<<(std::ostream &stream, const Settings2D &value)
2706 {
2707 return stream << value.toString();
2708 }
2709
2711 void save(const std::string &fileName) const;
2712
2714 void load(const std::string &fileName);
2715
2716 private:
2717 void setFromString(const std::string &value);
2718
2719 void setFromString(const std::string &fullPath, const std::string &value);
2720
2721 std::string getString(const std::string &fullPath) const;
2722
2723 Acquisitions m_acquisitions;
2724 Processing m_processing;
2725
2726 friend struct DataModel::Detail::Befriend<Settings2D>;
2727 };
2728
2729#ifndef NO_DOC
2731 namespace Detail
2732 {
2733 ZIVID_CORE_EXPORT void save(const Settings2D &dataModel, std::ostream &ostream);
2734 ZIVID_CORE_EXPORT void load(Settings2D &dataModel, std::istream &istream);
2735 } // namespace Detail
2736#endif
2737
2738#ifndef NO_DOC
2739 template<>
2740 struct Settings2D::Version<3>
2741 {
2742 using Type = Settings2D;
2743 };
2744#endif
2745
2746} // namespace Zivid
2747
2748#ifdef _MSC_VER
2749# pragma warning(pop)
2750#endif
2751
2752#ifndef NO_DOC
2753# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
2754namespace std // NOLINT
2755{
2756
2757 template<>
2758 struct tuple_size<Zivid::Settings2D::Processing> : integral_constant<size_t, 1>
2759 {};
2760
2761 template<size_t i>
2762 struct tuple_element<i, Zivid::Settings2D::Processing>
2763 {
2764 static_assert(i < tuple_size<Zivid::Settings2D::Processing>::value, "Index must be less than 1");
2765
2766 using type // NOLINT
2767 = decltype(declval<Zivid::Settings2D::Processing>().get<i>());
2768 };
2769
2770 template<>
2771 struct tuple_size<Zivid::Settings2D::Processing::Color> : integral_constant<size_t, 2>
2772 {};
2773
2774 template<size_t i>
2775 struct tuple_element<i, Zivid::Settings2D::Processing::Color>
2776 {
2777 static_assert(i < tuple_size<Zivid::Settings2D::Processing::Color>::value, "Index must be less than 2");
2778
2779 using type // NOLINT
2780 = decltype(declval<Zivid::Settings2D::Processing::Color>().get<i>());
2781 };
2782
2783 template<>
2784 struct tuple_size<Zivid::Settings2D::Processing::Color::Balance> : integral_constant<size_t, 3>
2785 {};
2786
2787 template<size_t i>
2788 struct tuple_element<i, Zivid::Settings2D::Processing::Color::Balance>
2789 {
2790 static_assert(
2791 i < tuple_size<Zivid::Settings2D::Processing::Color::Balance>::value,
2792 "Index must be less than 3");
2793
2794 using type // NOLINT
2795 = decltype(declval<Zivid::Settings2D::Processing::Color::Balance>().get<i>());
2796 };
2797
2798 template<>
2799 struct tuple_size<Zivid::Settings2D> : integral_constant<size_t, 2>
2800 {};
2801
2802 template<size_t i>
2803 struct tuple_element<i, Zivid::Settings2D>
2804 {
2805 static_assert(i < tuple_size<Zivid::Settings2D>::value, "Index must be less than 2");
2806
2807 using type // NOLINT
2808 = decltype(declval<Zivid::Settings2D>().get<i>());
2809 };
2810
2811} // namespace std
2812# endif
2813#endif
2814
2815// If we have access to the DataModel library, automatically include internal DataModel
2816// header. This header is necessary for serialization and deserialization.
2817#if defined(__has_include) && !defined(NO_DOC)
2818# if __has_include("Zivid/Settings2DInternal.h") && __has_include("Zivid/DataModelNodeMetaData.h")
2819# include "Zivid/Settings2DInternal.h"
2820# endif
2821#endif
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
Class describing a range of values for a given type T.
Definition Range.h:73
Aperture setting for the camera. Specified as an f-number (the ratio of lens focal length to the effe...
Definition Settings2D.h:132
void reset()
Reset the node to unset state.
bool operator!=(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:189
friend std::ostream & operator<<(std::ostream &stream, const Aperture &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:219
bool operator<(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:195
constexpr Aperture(double value)
Constructor.
Definition Settings2D.h:163
static constexpr Range< double > validRange()
The range of valid values for Aperture.
Definition Settings2D.h:154
bool operator>=(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:213
bool operator<=(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:207
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:201
Aperture()=default
Default constructor.
double ValueType
The type of the underlying value.
Definition Settings2D.h:151
bool operator==(const Aperture &other) const
Comparison operator.
Definition Settings2D.h:183
bool hasValue() const
Check if the value is set.
Brightness controls the light output from the projector.
Definition Settings2D.h:255
bool operator==(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:314
bool operator<=(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:338
bool operator>(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:332
bool operator<(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:326
static constexpr Range< double > validRange()
The range of valid values for Brightness.
Definition Settings2D.h:285
constexpr Brightness(double value)
Constructor.
Definition Settings2D.h:294
std::string toString() const
Get the value as string.
bool operator!=(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:320
bool operator>=(const Brightness &other) const
Comparison operator.
Definition Settings2D.h:344
friend std::ostream & operator<<(std::ostream &stream, const Brightness &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:350
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:282
Exposure time for the image.
Definition Settings2D.h:376
bool operator>(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:441
std::chrono::microseconds ValueType
The type of the underlying value.
Definition Settings2D.h:391
bool operator>=(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:453
void reset()
Reset the node to unset state.
constexpr ExposureTime(std::chrono::microseconds value)
Constructor.
Definition Settings2D.h:403
std::chrono::microseconds value() const
Get the value.
bool operator<(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:435
bool operator<=(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:447
static constexpr Range< std::chrono::microseconds > validRange()
The range of valid values for ExposureTime.
Definition Settings2D.h:394
bool operator!=(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:429
std::string toString() const
Get the value as string.
ExposureTime()=default
Default constructor.
bool operator==(const ExposureTime &other) const
Comparison operator.
Definition Settings2D.h:423
friend std::ostream & operator<<(std::ostream &stream, const ExposureTime &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:459
bool hasValue() const
Check if the value is set.
Analog gain in the camera.
Definition Settings2D.h:486
bool operator>(const Gain &other) const
Comparison operator.
Definition Settings2D.h:551
bool operator!=(const Gain &other) const
Comparison operator.
Definition Settings2D.h:539
bool operator==(const Gain &other) const
Comparison operator.
Definition Settings2D.h:533
friend std::ostream & operator<<(std::ostream &stream, const Gain &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:569
double ValueType
The type of the underlying value.
Definition Settings2D.h:501
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:513
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:563
bool operator<=(const Gain &other) const
Comparison operator.
Definition Settings2D.h:557
static constexpr Range< double > validRange()
The range of valid values for Gain.
Definition Settings2D.h:504
bool operator<(const Gain &other) const
Comparison operator.
Definition Settings2D.h:545
Settings for a single acquisition.
Definition Settings2D.h:112
const Settings2D::Acquisition::Gain & get() const
Definition Settings2D.h:812
const ExposureTime & exposureTime() const
Get ExposureTime.
Definition Settings2D.h:748
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:843
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:853
const Settings2D::Acquisition::Aperture & get() const
Definition Settings2D.h:788
ExposureTime & exposureTime()
Get ExposureTime.
Definition Settings2D.h:754
friend std::ostream & operator<<(std::ostream &stream, const Acquisition &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:871
bool operator!=(const Acquisition &other) const
Inequality operator.
Acquisition & set(const Gain &value)
Set Gain.
Definition Settings2D.h:779
std::string toString() const
Get the value as string.
Acquisition & set(const Aperture &value)
Set Aperture.
Definition Settings2D.h:722
std::tuple< Settings2D::Acquisition::Aperture, Settings2D::Acquisition::Brightness, Settings2D::Acquisition::ExposureTime, Settings2D::Acquisition::Gain > Descendants
Definition Settings2D.h:595
Gain & gain()
Get Gain.
Definition Settings2D.h:773
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:690
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:655
const Settings2D::Acquisition::ExposureTime & get() const
Definition Settings2D.h:804
Acquisition()
Default constructor.
Aperture & aperture()
Get Aperture.
Definition Settings2D.h:716
const Aperture & aperture() const
Get Aperture.
Definition Settings2D.h:710
Acquisition & set(const Brightness &value)
Set Brightness.
Definition Settings2D.h:741
const Brightness & brightness() const
Get Brightness.
Definition Settings2D.h:729
Brightness & brightness()
Get Brightness.
Definition Settings2D.h:735
const Gain & gain() const
Get Gain.
Definition Settings2D.h:767
const Settings2D::Acquisition::Brightness & get() const
Definition Settings2D.h:796
Acquisition & set(const ExposureTime &value)
Set ExposureTime.
Definition Settings2D.h:760
List of acquisitions. Note that the Zivid SDK only supports a single acquisition per capture in 2D mo...
Definition Settings2D.h:895
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:915
Acquisitions(std::initializer_list< Settings2D::Acquisition > value)
Constructor.
Definition Settings2D.h:929
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:924
void forEach(const F &f)
Run the given function on each element in the list.
Definition Settings2D.h:986
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:996
std::vector< Settings2D::Acquisition > ValueType
The type of the underlying value.
Definition Settings2D.h:912
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:1041
std::vector< Settings2D::Acquisition >::iterator Iterator
Iterator type for Acquisitions.
Definition Settings2D.h:1005
std::vector< Settings2D::Acquisition >::const_iterator ConstIterator
Constant iterator type for Acquisitions.
Definition Settings2D.h:1014
std::size_t size() const noexcept
Get the size of the list.
bool operator!=(const Acquisitions &other) const
Comparison operator.
Definition Settings2D.h:1035
Acquisitions()=default
Default constructor.
const std::vector< Settings2D::Acquisition > & value() const
Get the value.
Digital gain applied to blue channel.
Definition Settings2D.h:1112
friend std::ostream & operator<<(std::ostream &stream, const Blue &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:1197
bool operator<=(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1185
bool operator==(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1161
void reset()
Reset the node to unset state.
double ValueType
The type of the underlying value.
Definition Settings2D.h:1129
bool operator>(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1179
std::string toString() const
Get the value as string.
constexpr Blue(double value)
Constructor.
Definition Settings2D.h:1141
bool operator!=(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1167
bool hasValue() const
Check if the value is set.
static constexpr Range< double > validRange()
The range of valid values for Blue.
Definition Settings2D.h:1132
bool operator<(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1173
bool operator>=(const Blue &other) const
Comparison operator.
Definition Settings2D.h:1191
Digital gain applied to green channel.
Definition Settings2D.h:1224
double ValueType
The type of the underlying value.
Definition Settings2D.h:1241
static constexpr Range< double > validRange()
The range of valid values for Green.
Definition Settings2D.h:1244
bool operator==(const Green &other) const
Comparison operator.
Definition Settings2D.h:1273
std::string toString() const
Get the value as string.
constexpr Green(double value)
Constructor.
Definition Settings2D.h:1253
friend std::ostream & operator<<(std::ostream &stream, const Green &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:1309
bool operator<(const Green &other) const
Comparison operator.
Definition Settings2D.h:1285
bool hasValue() const
Check if the value is set.
bool operator<=(const Green &other) const
Comparison operator.
Definition Settings2D.h:1297
bool operator>=(const Green &other) const
Comparison operator.
Definition Settings2D.h:1303
bool operator!=(const Green &other) const
Comparison operator.
Definition Settings2D.h:1279
bool operator>(const Green &other) const
Comparison operator.
Definition Settings2D.h:1291
void reset()
Reset the node to unset state.
Digital gain applied to red channel.
Definition Settings2D.h:1336
double ValueType
The type of the underlying value.
Definition Settings2D.h:1353
friend std::ostream & operator<<(std::ostream &stream, const Red &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:1421
bool operator>=(const Red &other) const
Comparison operator.
Definition Settings2D.h:1415
bool operator<(const Red &other) const
Comparison operator.
Definition Settings2D.h:1397
bool operator<=(const Red &other) const
Comparison operator.
Definition Settings2D.h:1409
std::string toString() const
Get the value as string.
static constexpr Range< double > validRange()
The range of valid values for Red.
Definition Settings2D.h:1356
bool hasValue() const
Check if the value is set.
bool operator!=(const Red &other) const
Comparison operator.
Definition Settings2D.h:1391
constexpr Red(double value)
Constructor.
Definition Settings2D.h:1365
bool operator==(const Red &other) const
Comparison operator.
Definition Settings2D.h:1385
void reset()
Reset the node to unset state.
bool operator>(const Red &other) const
Comparison operator.
Definition Settings2D.h:1403
Color balance settings.
Definition Settings2D.h:1094
const Settings2D::Processing::Color::Balance::Red & get() const
Definition Settings2D.h:1643
Blue & blue()
Get Blue.
Definition Settings2D.h:1568
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:1677
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:1668
const Blue & blue() const
Get Blue.
Definition Settings2D.h:1562
bool operator==(const Balance &other) const
Equality operator.
Balance & set(const Blue &value)
Set Blue.
Definition Settings2D.h:1574
Red & red()
Get Red.
Definition Settings2D.h:1606
Green & green()
Get Green.
Definition Settings2D.h:1587
Balance & set(const Green &value)
Set Green.
Definition Settings2D.h:1593
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:1541
const Green & green() const
Get Green.
Definition Settings2D.h:1581
Balance & set(const Red &value)
Set Red.
Definition Settings2D.h:1612
const Settings2D::Processing::Color::Balance::Green & get() const
Definition Settings2D.h:1633
const Red & red() const
Get Red.
Definition Settings2D.h:1600
std::string toString() const
Get the value as string.
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:1505
friend std::ostream & operator<<(std::ostream &stream, const Balance &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:1694
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition Settings2D.h:1623
std::tuple< Settings2D::Processing::Color::Balance::Blue, Settings2D::Processing::Color::Balance::Green, Settings2D::Processing::Color::Balance::Red > Descendants
Definition Settings2D.h:1447
Gamma applied to the color values. Gamma less than 1 makes the colors brighter, while gamma greater t...
Definition Settings2D.h:1719
double ValueType
The type of the underlying value.
Definition Settings2D.h:1738
static constexpr Range< double > validRange()
The range of valid values for Gamma.
Definition Settings2D.h:1741
bool operator>(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:1788
bool operator==(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:1770
friend std::ostream & operator<<(std::ostream &stream, const Gamma &value)
Operator to serialize the value to a stream.
Definition Settings2D.h:1806
bool operator!=(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:1776
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:1782
void reset()
Reset the node to unset state.
bool operator>=(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:1800
constexpr Gamma(double value)
Constructor.
Definition Settings2D.h:1750
Gamma()=default
Default constructor.
bool operator<=(const Gamma &other) const
Comparison operator.
Definition Settings2D.h:1794
double value() const
Get the value.
Color settings.
Definition Settings2D.h:1076
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:1895
Color & set(const Balance::Green &value)
Set Balance::Green.
Definition Settings2D.h:1979
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:1953
Color & set(const Balance::Blue &value)
Set Balance::Blue.
Definition Settings2D.h:1972
Balance & balance()
Get Balance.
Definition Settings2D.h:1959
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:2070
friend std::ostream & operator<<(std::ostream &stream, const Color &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:2094
const Settings2D::Processing::Color::Gamma & get() const
Definition Settings2D.h:2051
const Settings2D::Processing::Color::Balance::Green & get() const
Definition Settings2D.h:2033
Gamma & gamma()
Get Gamma.
Definition Settings2D.h:1999
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:1833
const Settings2D::Processing::Color::Balance::Red & get() const
Definition Settings2D.h:2042
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:1932
const Settings2D::Processing::Color::Balance & get() const
Definition Settings2D.h:2015
const Gamma & gamma() const
Get Gamma.
Definition Settings2D.h:1993
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition Settings2D.h:2024
Color & set(const Balance &value)
Set Balance.
Definition Settings2D.h:1965
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:2078
Color & set(const Gamma &value)
Set Gamma.
Definition Settings2D.h:2005
Color & set(const Balance::Red &value)
Set Balance::Red.
Definition Settings2D.h:1986
Processing related settings.
Definition Settings2D.h:1058
const Settings2D::Processing::Color & get() const
Definition Settings2D.h:2295
Processing & set(const Color::Gamma &value)
Set Color::Gamma.
Definition Settings2D.h:2286
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:2251
const Settings2D::Processing::Color::Balance & get() const
Definition Settings2D.h:2303
friend std::ostream & operator<<(std::ostream &stream, const Processing &value)
Operator to send the value as string to a stream.
Definition Settings2D.h:2373
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:2351
Color & color()
Get Color.
Definition Settings2D.h:2245
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:2182
Processing & set(const Color::Balance::Blue &value)
Set Color::Balance::Blue.
Definition Settings2D.h:2265
Processing & set(const Color::Balance &value)
Set Color::Balance.
Definition Settings2D.h:2258
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:2118
const Color & color() const
Get Color.
Definition Settings2D.h:2239
Processing & set(const Color::Balance::Red &value)
Set Color::Balance::Red.
Definition Settings2D.h:2279
const Settings2D::Processing::Color::Gamma & get() const
Definition Settings2D.h:2338
const Settings2D::Processing::Color::Balance::Red & get() const
Definition Settings2D.h:2330
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:2219
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition Settings2D.h:2312
const Settings2D::Processing::Color::Balance::Green & get() const
Definition Settings2D.h:2321
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:2358
Processing()
Default constructor.
Processing & set(const Color::Balance::Green &value)
Set Color::Balance::Green.
Definition Settings2D.h:2272
Settings used when capturing 2D images with a Zivid camera.
Definition Settings2D.h:78
Settings2D & set(const Processing &value)
Set Processing.
Definition Settings2D.h:2557
const Settings2D::Processing::Color & get() const
Definition Settings2D.h:2620
const Settings2D::Processing::Color::Balance::Red & get() const
Definition Settings2D.h:2654
const Settings2D::Processing::Color::Balance::Green & get() const
Definition Settings2D.h:2646
void save(const std::string &fileName) const
Save to the given file.
const Settings2D::Processing::Color::Balance::Blue & get() const
Definition Settings2D.h:2637
const Acquisitions & acquisitions() const
Get Acquisitions.
Definition Settings2D.h:2526
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition Settings2D.h:2689
Settings2D(Args &&...args)
Constructor taking variadic number of arguments.
Definition Settings2D.h:2434
const Settings2D::Acquisitions & get() const
Definition Settings2D.h:2606
Settings2D()
Default constructor.
const Settings2D::Processing::Color::Gamma & get() const
Definition Settings2D.h:2662
Settings2D & set(const Acquisitions &value)
Set Acquisitions.
Definition Settings2D.h:2538
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:2628
Settings2D & set(const Processing::Color::Balance::Green &value)
Set Processing::Color::Balance::Green.
Definition Settings2D.h:2585
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:2398
bool operator!=(const Settings2D &other) const
Inequality operator.
Settings2D & set(const Processing::Color::Balance &value)
Set Processing::Color::Balance.
Definition Settings2D.h:2571
const Settings2D::Processing & get() const
Definition Settings2D.h:2612
Settings2D & set(const Processing::Color::Balance::Red &value)
Set Processing::Color::Balance::Red.
Definition Settings2D.h:2592
void set(Args &&...args)
Set multiple arguments.
Definition Settings2D.h:2468
Processing & processing()
Get Processing.
Definition Settings2D.h:2551
const Processing & processing() const
Get Processing.
Definition Settings2D.h:2545
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:2507
Settings2D & set(const Processing::Color::Balance::Blue &value)
Set Processing::Color::Balance::Blue.
Definition Settings2D.h:2578
Acquisitions & acquisitions()
Get Acquisitions.
Definition Settings2D.h:2532
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:2681
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:2705
Settings2D & set(const Processing::Color &value)
Set Processing::Color.
Definition Settings2D.h:2564
Settings2D & set(const Processing::Color::Gamma &value)
Set Processing::Color::Gamma.
Definition Settings2D.h:2599
NodeType
Definition NodeType.h:55
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:54