69# pragma warning(disable : 4251)
86 static constexpr const char *path{
"" };
89 static constexpr const char *name{
"SceneConditions" };
92 static constexpr const char *description{
93 R
"description(A description of the ambient conditions detected by the camera.
97 static constexpr size_t version{ 2 };
107 static constexpr std::array<uint8_t, 3> binaryId{
'c',
's',
'c' };
122 static constexpr const char *path{
"AmbientLight" };
125 static constexpr const char *name{
"AmbientLight" };
128 static constexpr const char *description{ R
"description(The ambient light detected by the camera.
151 static constexpr const char *path{
"AmbientLight/FlickerClassification" };
154 static constexpr const char *name{
"FlickerClassification" };
157 static constexpr const char *description{
158 R
"description(A classification of the detected ambient light flicker, if any.
159The values `grid50hz` and `grid60hz` indicate that ambient
160light matching a 50 Hz or 60 Hz power grid was detected in the
161scene. In those cases it is recommended to use Ambient Light
162Adaptation for better point cloud quality. The value
163`unknownFlicker` indicates that some significant time-varying
164ambient light was detected, but it was not possible to
165determine the frequency. `otherFlicker` indicates that ambient
166light of a particular frequency was detected but it did not
167match the characteristics of a standard power grid.
189 return { ValueType::noFlicker,
190 ValueType::unknownFlicker,
193 ValueType::otherFlicker };
201 : m_value{ verifyValue(value) }
219 return m_value == other.m_value;
225 return m_value != other.m_value;
235 void setFromString(
const std::string &value);
237 constexpr ValueType
static verifyValue(
const ValueType &value)
239 return value == ValueType::noFlicker || value == ValueType::unknownFlicker
240 || value == ValueType::grid50hz || value == ValueType::grid60hz
241 || value == ValueType::otherFlicker
243 :
throw std::invalid_argument{
244 "Invalid value: FlickerClassification{ "
245 + std::to_string(
static_cast<std::underlying_type<ValueType>::type
>(value)) +
" }"
266 static constexpr const char *path{
"AmbientLight/FlickerFrequency" };
269 static constexpr const char *name{
"FlickerFrequency" };
272 static constexpr const char *description{
273 R
"description(This field contains the actual frequency unless the
274classification is `noFlicker` or `unknownFlicker`.
284 return { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max() };
313 return m_opt == other.m_opt;
319 return m_opt != other.m_opt;
325 return m_opt < other.m_opt;
331 return m_opt > other.m_opt;
337 return m_opt <= other.m_opt;
343 return m_opt >= other.m_opt;
353 void setFromString(
const std::string &value);
355 std::optional<double> m_opt;
382 typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0,
383 typename std::enable_if<
384 Zivid::Detail::TypeTraits::AllArgsAreInTuple<
Descendants,
typename std::decay<Args>::type...>::
388 template<typename... Args>
392 using namespace Zivid::Detail::TypeTraits;
395 AllArgsDecayedAreUnique<Args...>::value,
396 "Found duplicate types among the arguments passed to AmbientLight(...). "
397 "Types should be listed at most once.");
399 set(std::forward<Args>(args)...);
414 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 2,
int>::type = 0>
416 template<typename... Args>
420 using namespace Zivid::Detail::TypeTraits;
422 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
424 AllArgsAreDescendantNodes::value,
"All arguments passed to set(...) must be descendant nodes.");
427 AllArgsDecayedAreUnique<Args...>::value,
428 "Found duplicate types among the arguments passed to set(...). "
429 "Types should be listed at most once.");
431 Zivid::DataModel::Detail::invokeSetWithEachArgument(*
this, std::forward<Args>(args)...);
447 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0>
449 template<typename... Args>
453 using namespace Zivid::Detail::TypeTraits;
455 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
457 AllArgsAreDescendantNodes::value,
458 "All arguments passed to copyWith(...) must be descendant nodes.");
461 AllArgsDecayedAreUnique<Args...>::value,
462 "Found duplicate types among the arguments passed to copyWith(...). "
463 "Types should be listed at most once.");
466 copy.set(std::forward<Args>(args)...);
473 return m_flickerClassification;
479 return m_flickerClassification;
485 m_flickerClassification = value;
492 return m_flickerFrequency;
498 return m_flickerFrequency;
504 m_flickerFrequency = value;
510 typename std::enable_if<
511 std::is_same<T, SceneConditions::AmbientLight::FlickerClassification>::value,
515 return m_flickerClassification;
520 typename std::enable_if<std::is_same<T, SceneConditions::AmbientLight::FlickerFrequency>::value,
int>::
524 return m_flickerFrequency;
527 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
530 return m_flickerClassification;
533 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
536 return m_flickerFrequency;
543 f(m_flickerClassification);
544 f(m_flickerFrequency);
551 f(m_flickerClassification);
552 f(m_flickerFrequency);
571 void setFromString(
const std::string &value);
573 void setFromString(
const std::string &fullPath,
const std::string &value);
575 std::string getString(
const std::string &fullPath)
const;
577 FlickerClassification m_flickerClassification;
580 friend struct DataModel::Detail::Befriend<
AmbientLight>;
624 typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0,
625 typename std::enable_if<
626 Zivid::Detail::TypeTraits::AllArgsAreInTuple<
Descendants,
typename std::decay<Args>::type...>::value,
629 template<typename... Args>
633 using namespace Zivid::Detail::TypeTraits;
636 AllArgsDecayedAreUnique<Args...>::value,
637 "Found duplicate types among the arguments passed to SceneConditions(...). "
638 "Types should be listed at most once.");
640 set(std::forward<Args>(args)...);
656 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 2,
int>::type = 0>
658 template<typename... Args>
662 using namespace Zivid::Detail::TypeTraits;
664 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
666 AllArgsAreDescendantNodes::value,
"All arguments passed to set(...) must be descendant nodes.");
669 AllArgsDecayedAreUnique<Args...>::value,
670 "Found duplicate types among the arguments passed to set(...). "
671 "Types should be listed at most once.");
673 Zivid::DataModel::Detail::invokeSetWithEachArgument(*
this, std::forward<Args>(args)...);
690 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0>
692 template<typename... Args>
696 using namespace Zivid::Detail::TypeTraits;
698 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
700 AllArgsAreDescendantNodes::value,
"All arguments passed to copyWith(...) must be descendant nodes.");
703 AllArgsDecayedAreUnique<Args...>::value,
704 "Found duplicate types among the arguments passed to copyWith(...). "
705 "Types should be listed at most once.");
708 copy.set(std::forward<Args>(args)...);
715 return m_ambientLight;
721 return m_ambientLight;
727 m_ambientLight = value;
734 m_ambientLight.
set(value);
741 m_ambientLight.
set(value);
747 typename std::enable_if<std::is_same<T, SceneConditions::AmbientLight>::value,
int>::type = 0>
750 return m_ambientLight;
755 typename std::enable_if<std::is_same<T, SceneConditions::AmbientLight::FlickerClassification>::value,
int>::
764 typename std::enable_if<std::is_same<T, SceneConditions::AmbientLight::FlickerFrequency>::value,
int>::
771 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
774 return m_ambientLight;
807 void save(
const std::string &fileName)
const;
810 void load(
const std::string &fileName);
813 void setFromString(
const std::string &value);
815 void setFromString(
const std::string &fullPath,
const std::string &value);
817 std::string getString(
const std::string &fullPath)
const;
826 struct SceneConditions::Version<2>
853# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
858 struct tuple_size<
Zivid::SceneConditions::AmbientLight> : integral_constant<size_t, 2>
862 struct tuple_element<i,
Zivid::SceneConditions::AmbientLight>
864 static_assert(i < tuple_size<Zivid::SceneConditions::AmbientLight>::value,
"Index must be less than 2");
867 =
decltype(declval<Zivid::SceneConditions::AmbientLight>().get<i>());
871 struct tuple_size<
Zivid::SceneConditions> : integral_constant<size_t, 1>
875 struct tuple_element<i,
Zivid::SceneConditions>
877 static_assert(i < tuple_size<Zivid::SceneConditions>::value,
"Index must be less than 1");
880 =
decltype(declval<Zivid::SceneConditions>().get<i>());
889#if defined(__has_include) && !defined(NO_DOC)
890# if __has_include("Zivid/SceneConditionsInternal.h") && __has_include("Zivid/DataModelNodeMetaData.h")
891# include "Zivid/SceneConditionsInternal.h"
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
Class describing a range of values for a given type T.
Definition Range.h:75
A classification of the detected ambient light flicker, if any. The values grid50hz and grid60hz indi...
Definition SceneConditions.h:145
bool operator==(const FlickerClassification &other) const
Comparison operator.
Definition SceneConditions.h:217
static const FlickerClassification grid50hz
grid50hz
Definition SceneConditions.h:182
std::string toString() const
Get the value as string.
friend std::ostream & operator<<(std::ostream &stream, const FlickerClassification &value)
Operator to serialize the value to a stream.
Definition SceneConditions.h:229
static std::set< ValueType > validValues()
All valid values of FlickerClassification.
Definition SceneConditions.h:187
ValueType value() const
Get the value.
bool operator!=(const FlickerClassification &other) const
Comparison operator.
Definition SceneConditions.h:223
ValueType
The type of the underlying value.
Definition SceneConditions.h:173
static const FlickerClassification noFlicker
noFlicker
Definition SceneConditions.h:180
FlickerClassification()=default
Default constructor.
static const FlickerClassification grid60hz
grid60hz
Definition SceneConditions.h:183
static const FlickerClassification otherFlicker
otherFlicker
Definition SceneConditions.h:184
friend std::ostream & operator<<(std::ostream &stream, const FlickerClassification::ValueType &value)
Operator to serialize ValueType to a stream.
Definition SceneConditions.h:211
static const FlickerClassification unknownFlicker
unknownFlicker
Definition SceneConditions.h:181
constexpr FlickerClassification(ValueType value)
Constructor.
Definition SceneConditions.h:200
This field contains the actual frequency unless the classification is noFlicker or unknownFlicker.
Definition SceneConditions.h:260
bool operator<(const FlickerFrequency &other) const
Comparison operator.
Definition SceneConditions.h:323
void reset()
Reset the node to unset state.
double value() const
Get the value.
bool operator>=(const FlickerFrequency &other) const
Comparison operator.
Definition SceneConditions.h:341
std::string toString() const
Get the value as string.
bool operator>(const FlickerFrequency &other) const
Comparison operator.
Definition SceneConditions.h:329
static constexpr Range< double > validRange()
The range of valid values for FlickerFrequency.
Definition SceneConditions.h:282
bool operator!=(const FlickerFrequency &other) const
Comparison operator.
Definition SceneConditions.h:317
FlickerFrequency()=default
Default constructor.
bool hasValue() const
Check if the value is set.
friend std::ostream & operator<<(std::ostream &stream, const FlickerFrequency &value)
Operator to serialize the value to a stream.
Definition SceneConditions.h:347
bool operator==(const FlickerFrequency &other) const
Comparison operator.
Definition SceneConditions.h:311
double ValueType
The type of the underlying value.
Definition SceneConditions.h:279
bool operator<=(const FlickerFrequency &other) const
Comparison operator.
Definition SceneConditions.h:335
constexpr FlickerFrequency(double value)
Constructor.
Definition SceneConditions.h:291
The ambient light detected by the camera.
Definition SceneConditions.h:116
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition SceneConditions.h:541
AmbientLight copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition SceneConditions.h:451
const SceneConditions::AmbientLight::FlickerClassification & get() const
Definition SceneConditions.h:513
std::string toString() const
Get the value as string.
AmbientLight & set(const FlickerClassification &value)
Set FlickerClassification.
Definition SceneConditions.h:483
AmbientLight & set(const FlickerFrequency &value)
Set FlickerFrequency.
Definition SceneConditions.h:502
FlickerClassification & flickerClassification()
Get FlickerClassification.
Definition SceneConditions.h:477
bool operator!=(const AmbientLight &other) const
Inequality operator.
const FlickerClassification & flickerClassification() const
Get FlickerClassification.
Definition SceneConditions.h:471
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition SceneConditions.h:549
AmbientLight()
Default constructor.
std::tuple< SceneConditions::AmbientLight::FlickerClassification, SceneConditions::AmbientLight::FlickerFrequency > Descendants
Definition SceneConditions.h:360
const SceneConditions::AmbientLight::FlickerFrequency & get() const
Definition SceneConditions.h:522
friend std::ostream & operator<<(std::ostream &stream, const AmbientLight &value)
Operator to send the value as string to a stream.
Definition SceneConditions.h:565
FlickerFrequency & flickerFrequency()
Get FlickerFrequency.
Definition SceneConditions.h:496
bool operator==(const AmbientLight &other) const
Equality operator.
const FlickerFrequency & flickerFrequency() const
Get FlickerFrequency.
Definition SceneConditions.h:490
void set(Args &&...args)
Set multiple arguments.
Definition SceneConditions.h:418
A description of the ambient conditions detected by the camera.
Definition SceneConditions.h:80
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition SceneConditions.h:786
SceneConditions & set(const AmbientLight::FlickerFrequency &value)
Set AmbientLight::FlickerFrequency.
Definition SceneConditions.h:739
std::tuple< SceneConditions::AmbientLight, SceneConditions::AmbientLight::FlickerClassification, SceneConditions::AmbientLight::FlickerFrequency > Descendants
Definition SceneConditions.h:583
const SceneConditions::AmbientLight::FlickerClassification & get() const
Definition SceneConditions.h:757
static SceneConditions fromSerialized(const std::string &value)
Construct a new SceneConditions instance from a previously serialized string.
void load(const std::string &fileName)
Load from the given file.
SceneConditions(const std::string &fileName)
Construct SceneConditions by loading from file.
bool operator==(const SceneConditions &other) const
Equality operator.
void set(Args &&...args)
Set multiple arguments.
Definition SceneConditions.h:660
friend std::ostream & operator<<(std::ostream &stream, const SceneConditions &value)
Operator to send the value as string to a stream.
Definition SceneConditions.h:801
const SceneConditions::AmbientLight & get() const
Definition SceneConditions.h:748
SceneConditions copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition SceneConditions.h:694
AmbientLight & ambientLight()
Get AmbientLight.
Definition SceneConditions.h:719
SceneConditions & set(const AmbientLight &value)
Set AmbientLight.
Definition SceneConditions.h:725
SceneConditions(Args &&...args)
Constructor taking variadic number of arguments.
Definition SceneConditions.h:631
SceneConditions()
Default constructor.
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition SceneConditions.h:779
bool operator!=(const SceneConditions &other) const
Inequality operator.
SceneConditions & set(const AmbientLight::FlickerClassification &value)
Set AmbientLight::FlickerClassification.
Definition SceneConditions.h:732
std::string toString() const
Get the value as string.
void save(const std::string &fileName) const
Save to the given file.
const AmbientLight & ambientLight() const
Get AmbientLight.
Definition SceneConditions.h:713
std::string serialize() const
Serialize to a string.
const SceneConditions::AmbientLight::FlickerFrequency & get() const
Definition SceneConditions.h:766
NodeType
Definition NodeType.h:49
Definition EnvironmentInfo.h:74
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:84