68# pragma warning(disable : 4251)
85 static constexpr const char *path{
"" };
88 static constexpr const char *name{
"SceneConditions" };
91 static constexpr const char *description{
92 R
"description(A description of the ambient conditions detected by the camera.
96 static constexpr size_t version{ 1 };
106 static constexpr std::array<uint8_t, 3> binaryId{
'c',
's',
'c' };
121 static constexpr const char *path{
"AmbientLight" };
124 static constexpr const char *name{
"AmbientLight" };
127 static constexpr const char *description{ R
"description(The ambient light detected by the camera.
148 static constexpr const char *path{
"AmbientLight/FlickerClassification" };
151 static constexpr const char *name{
"FlickerClassification" };
154 static constexpr const char *description{
155 R
"description(A classification of the detected ambient light flicker, if any.
156The values `grid50hz` and `grid60hz` indicate that ambient
157light matching a 50 Hz or 60 Hz power grid was detected in the
158scene. In those cases it is recommended to use Ambient Light
159Adaptation for better point cloud quality. The value
160`unknownFlicker` indicates that some significant time-varying
161ambient light was detected, but it did not match the
162characteristics of a standard power grid.
183 ValueType::noFlicker, ValueType::unknownFlicker, ValueType::grid50hz, ValueType::grid60hz
192 : m_value{ verifyValue(value) }
210 return m_value == other.m_value;
216 return m_value != other.m_value;
226 void setFromString(
const std::string &value);
228 constexpr ValueType
static verifyValue(
const ValueType &value)
230 return value == ValueType::noFlicker || value == ValueType::unknownFlicker
231 || value == ValueType::grid50hz || value == ValueType::grid60hz
233 :
throw std::invalid_argument{
234 "Invalid value: FlickerClassification{ "
235 + std::to_string(
static_cast<std::underlying_type<ValueType>::type
>(value)) +
" }"
244 using Descendants = std::tuple<SceneConditions::AmbientLight::FlickerClassification>;
263 typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0,
264 typename std::enable_if<
265 Zivid::Detail::TypeTraits::AllArgsAreInTuple<
Descendants,
typename std::decay<Args>::type...>::
269 template<typename... Args>
273 using namespace Zivid::Detail::TypeTraits;
276 AllArgsDecayedAreUnique<Args...>::value,
277 "Found duplicate types among the arguments passed to AmbientLight(...). "
278 "Types should be listed at most once.");
280 set(std::forward<Args>(args)...);
294 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 2,
int>::type = 0>
296 template<typename... Args>
300 using namespace Zivid::Detail::TypeTraits;
302 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
304 AllArgsAreDescendantNodes::value,
"All arguments passed to set(...) must be descendant nodes.");
307 AllArgsDecayedAreUnique<Args...>::value,
308 "Found duplicate types among the arguments passed to set(...). "
309 "Types should be listed at most once.");
311 Zivid::DataModel::Detail::invokeSetWithEachArgument(*
this, std::forward<Args>(args)...);
326 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0>
328 template<typename... Args>
332 using namespace Zivid::Detail::TypeTraits;
334 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
336 AllArgsAreDescendantNodes::value,
337 "All arguments passed to copyWith(...) must be descendant nodes.");
340 AllArgsDecayedAreUnique<Args...>::value,
341 "Found duplicate types among the arguments passed to copyWith(...). "
342 "Types should be listed at most once.");
345 copy.set(std::forward<Args>(args)...);
352 return m_flickerClassification;
358 return m_flickerClassification;
364 m_flickerClassification = value;
370 typename std::enable_if<
371 std::is_same<T, SceneConditions::AmbientLight::FlickerClassification>::value,
375 return m_flickerClassification;
378 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
381 return m_flickerClassification;
388 f(m_flickerClassification);
395 f(m_flickerClassification);
414 void setFromString(
const std::string &value);
416 void setFromString(
const std::string &fullPath,
const std::string &value);
418 std::string getString(
const std::string &fullPath)
const;
422 friend struct DataModel::Detail::Befriend<
AmbientLight>;
426 std::tuple<SceneConditions::AmbientLight, SceneConditions::AmbientLight::FlickerClassification>;
463 typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0,
464 typename std::enable_if<
465 Zivid::Detail::TypeTraits::AllArgsAreInTuple<
Descendants,
typename std::decay<Args>::type...>::value,
468 template<typename... Args>
472 using namespace Zivid::Detail::TypeTraits;
475 AllArgsDecayedAreUnique<Args...>::value,
476 "Found duplicate types among the arguments passed to SceneConditions(...). "
477 "Types should be listed at most once.");
479 set(std::forward<Args>(args)...);
494 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 2,
int>::type = 0>
496 template<typename... Args>
500 using namespace Zivid::Detail::TypeTraits;
502 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
504 AllArgsAreDescendantNodes::value,
"All arguments passed to set(...) must be descendant nodes.");
507 AllArgsDecayedAreUnique<Args...>::value,
508 "Found duplicate types among the arguments passed to set(...). "
509 "Types should be listed at most once.");
511 Zivid::DataModel::Detail::invokeSetWithEachArgument(*
this, std::forward<Args>(args)...);
527 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0>
529 template<typename... Args>
533 using namespace Zivid::Detail::TypeTraits;
535 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
537 AllArgsAreDescendantNodes::value,
"All arguments passed to copyWith(...) must be descendant nodes.");
540 AllArgsDecayedAreUnique<Args...>::value,
541 "Found duplicate types among the arguments passed to copyWith(...). "
542 "Types should be listed at most once.");
545 copy.set(std::forward<Args>(args)...);
552 return m_ambientLight;
558 return m_ambientLight;
564 m_ambientLight = value;
571 m_ambientLight.
set(value);
577 typename std::enable_if<std::is_same<T, SceneConditions::AmbientLight>::value,
int>::type = 0>
580 return m_ambientLight;
585 typename std::enable_if<std::is_same<T, SceneConditions::AmbientLight::FlickerClassification>::value,
int>::
592 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
595 return m_ambientLight;
628 void save(
const std::string &fileName)
const;
631 void load(
const std::string &fileName);
634 void setFromString(
const std::string &value);
636 void setFromString(
const std::string &fullPath,
const std::string &value);
638 std::string getString(
const std::string &fullPath)
const;
647 struct SceneConditions::Version<1>
674# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
679 struct tuple_size<
Zivid::SceneConditions::AmbientLight> : integral_constant<size_t, 1>
683 struct tuple_element<i,
Zivid::SceneConditions::AmbientLight>
685 static_assert(i < tuple_size<Zivid::SceneConditions::AmbientLight>::value,
"Index must be less than 1");
688 =
decltype(declval<Zivid::SceneConditions::AmbientLight>().get<i>());
692 struct tuple_size<
Zivid::SceneConditions> : integral_constant<size_t, 1>
696 struct tuple_element<i,
Zivid::SceneConditions>
698 static_assert(i < tuple_size<Zivid::SceneConditions>::value,
"Index must be less than 1");
701 =
decltype(declval<Zivid::SceneConditions>().get<i>());
710#if defined(__has_include) && !defined(NO_DOC)
711# if __has_include("Zivid/SceneConditionsInternal.h") && __has_include("Zivid/DataModelNodeMetaData.h")
712# include "Zivid/SceneConditionsInternal.h"
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
A classification of the detected ambient light flicker, if any. The values grid50hz and grid60hz indi...
Definition SceneConditions.h:142
bool operator==(const FlickerClassification &other) const
Comparison operator.
Definition SceneConditions.h:208
static const FlickerClassification grid50hz
grid50hz
Definition SceneConditions.h:176
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:220
static std::set< ValueType > validValues()
All valid values of FlickerClassification.
Definition SceneConditions.h:180
ValueType value() const
Get the value.
bool operator!=(const FlickerClassification &other) const
Comparison operator.
Definition SceneConditions.h:214
ValueType
The type of the underlying value.
Definition SceneConditions.h:168
static const FlickerClassification noFlicker
noFlicker
Definition SceneConditions.h:174
FlickerClassification()=default
Default constructor.
static const FlickerClassification grid60hz
grid60hz
Definition SceneConditions.h:177
friend std::ostream & operator<<(std::ostream &stream, const FlickerClassification::ValueType &value)
Operator to serialize ValueType to a stream.
Definition SceneConditions.h:202
static const FlickerClassification unknownFlicker
unknownFlicker
Definition SceneConditions.h:175
constexpr FlickerClassification(ValueType value)
Constructor.
Definition SceneConditions.h:191
The ambient light detected by the camera.
Definition SceneConditions.h:115
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:386
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:330
const SceneConditions::AmbientLight::FlickerClassification & get() const
Definition SceneConditions.h:373
std::string toString() const
Get the value as string.
AmbientLight & set(const FlickerClassification &value)
Set FlickerClassification.
Definition SceneConditions.h:362
FlickerClassification & flickerClassification()
Get FlickerClassification.
Definition SceneConditions.h:356
std::tuple< SceneConditions::AmbientLight::FlickerClassification > Descendants
Definition SceneConditions.h:244
bool operator!=(const AmbientLight &other) const
Inequality operator.
const FlickerClassification & flickerClassification() const
Get FlickerClassification.
Definition SceneConditions.h:350
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition SceneConditions.h:393
AmbientLight()
Default constructor.
friend std::ostream & operator<<(std::ostream &stream, const AmbientLight &value)
Operator to send the value as string to a stream.
Definition SceneConditions.h:408
bool operator==(const AmbientLight &other) const
Equality operator.
void set(Args &&...args)
Set multiple arguments.
Definition SceneConditions.h:298
A description of the ambient conditions detected by the camera.
Definition SceneConditions.h:79
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition SceneConditions.h:607
const SceneConditions::AmbientLight::FlickerClassification & get() const
Definition SceneConditions.h:587
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.
std::tuple< SceneConditions::AmbientLight, SceneConditions::AmbientLight::FlickerClassification > Descendants
Definition SceneConditions.h:425
bool operator==(const SceneConditions &other) const
Equality operator.
void set(Args &&...args)
Set multiple arguments.
Definition SceneConditions.h:498
friend std::ostream & operator<<(std::ostream &stream, const SceneConditions &value)
Operator to send the value as string to a stream.
Definition SceneConditions.h:622
const SceneConditions::AmbientLight & get() const
Definition SceneConditions.h:578
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:531
AmbientLight & ambientLight()
Get AmbientLight.
Definition SceneConditions.h:556
SceneConditions & set(const AmbientLight &value)
Set AmbientLight.
Definition SceneConditions.h:562
SceneConditions(Args &&...args)
Constructor taking variadic number of arguments.
Definition SceneConditions.h:470
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:600
bool operator!=(const SceneConditions &other) const
Inequality operator.
SceneConditions & set(const AmbientLight::FlickerClassification &value)
Set AmbientLight::FlickerClassification.
Definition SceneConditions.h:569
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:550
std::string serialize() const
Serialize to a string.
NodeType
Definition NodeType.h:49
Definition EnvironmentInfo.h:74
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:84