68 # pragma warning(push)
69 # pragma warning(disable : 4251)
74 namespace CaptureAssistant
84 static constexpr
const char *path{
"" };
87 static constexpr
const char *name{
"SuggestSettingsParameters" };
90 static constexpr
const char *description{
91 R
"description(Used to specify a constraint on the total capture time for the settings suggested by the Capture Assistant, and optionally specify the ambient light frequency. The capture time constraint assumes a computer meeting Zivid's recommended minimum compute power.)description"
94 static constexpr
size_t version{ 1 };
104 static constexpr std::array<uint8_t, 3> binaryId{
's',
's',
'p' };
116 static constexpr
const char *path{
"AmbientLightFrequency" };
119 static constexpr
const char *name{
"AmbientLightFrequency" };
122 static constexpr
const char *description{ R
"description(Ambient light frequency)description" };
138 return { ValueType::none, ValueType::hz50, ValueType::hz60 };
146 : m_value{ verifyValue(value) }
164 return m_value == other.m_value;
170 return m_value != other.m_value;
180 void setFromString(
const std::string &value);
182 constexpr ValueType verifyValue(
const ValueType &value)
const
184 return value == ValueType::none || value == ValueType::hz50 || value == ValueType::hz60
186 :
throw std::invalid_argument{
187 "Invalid value: AmbientLightFrequency{ "
188 + std::to_string(
static_cast<std::underlying_type<ValueType>::type
>(value)) +
" }"
205 static constexpr
const char *path{
"MaxCaptureTime" };
208 static constexpr
const char *name{
"MaxCaptureTime" };
211 static constexpr
const char *description{ R
"description(Capture time budget)description" };
219 return { std::chrono::milliseconds{ 200 }, std::chrono::milliseconds{ 10000 } };
227 : m_value{ verifyValue(value) }
231 std::chrono::milliseconds
value()
const;
239 return m_value == other.m_value;
245 return m_value != other.m_value;
251 return m_value < other.m_value;
257 return m_value > other.m_value;
267 void setFromString(
const std::string &value);
269 constexpr ValueType verifyValue(
const ValueType &value)
const
273 :
throw std::out_of_range{
"MaxCaptureTime{ " + std::to_string(value.count())
274 +
" } is not in range ["
275 + std::to_string(
validRange().min().count()) +
", "
276 + std::to_string(
validRange().max().count()) +
"]" };
279 std::chrono::milliseconds m_value{ 1200 };
285 std::tuple<SuggestSettingsParameters::AmbientLightFrequency, SuggestSettingsParameters::MaxCaptureTime>;
306 template<
typename... Args,
307 typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0,
308 typename std::enable_if<
309 Zivid::Detail::TypeTraits::AllArgsAreInTuple<
Descendants,
310 typename std::decay<Args>::type...>::value,
313 template<typename... Args>
317 using namespace Zivid::Detail::TypeTraits;
319 static_assert(AllArgsDecayedAreUnique<Args...>::value,
320 "Found duplicate types among the arguments passed to SuggestSettingsParameters(...). "
321 "Types should be listed at most once.");
323 set(std::forward<Args>(args)...);
338 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 2,
int>::type = 0>
340 template<typename... Args>
344 using namespace Zivid::Detail::TypeTraits;
346 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
347 static_assert(AllArgsAreDescendantNodes::value,
348 "All arguments passed to set(...) must be descendant nodes.");
350 static_assert(AllArgsDecayedAreUnique<Args...>::value,
351 "Found duplicate types among the arguments passed to set(...). "
352 "Types should be listed at most once.");
354 Zivid::DataModel::Detail::invokeSetWithEachArgument(*
this, std::forward<Args>(args)...);
370 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0>
372 template<typename... Args>
376 using namespace Zivid::Detail::TypeTraits;
378 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
379 static_assert(AllArgsAreDescendantNodes::value,
380 "All arguments passed to copyWith(...) must be descendant nodes.");
382 static_assert(AllArgsDecayedAreUnique<Args...>::value,
383 "Found duplicate types among the arguments passed to copyWith(...). "
384 "Types should be listed at most once.");
387 copy.set(std::forward<Args>(args)...);
394 return m_ambientLightFrequency;
400 return m_ambientLightFrequency;
406 m_ambientLightFrequency = value;
413 return m_maxCaptureTime;
419 return m_maxCaptureTime;
425 m_maxCaptureTime = value;
430 typename std::enable_if<std::is_same<T, SuggestSettingsParameters::AmbientLightFrequency>::value,
434 return m_ambientLightFrequency;
438 typename std::enable_if<std::is_same<T, SuggestSettingsParameters::MaxCaptureTime>::value,
442 return m_maxCaptureTime;
445 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
448 return m_ambientLightFrequency;
451 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
454 return m_maxCaptureTime;
461 f(m_ambientLightFrequency);
469 f(m_ambientLightFrequency);
489 void save(
const std::string &fileName)
const;
492 void load(
const std::string &fileName);
495 void setFromString(
const std::string &value);
497 void setFromString(
const std::string &fullPath,
const std::string &value);
499 std::string getString(
const std::string &fullPath)
const;
509 struct SuggestSettingsParameters::Version<1>
519 # pragma warning(pop)
523 # if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
527 struct tuple_size<
Zivid::CaptureAssistant::SuggestSettingsParameters> : integral_constant<size_t, 2>
531 struct tuple_element<i,
Zivid::CaptureAssistant::SuggestSettingsParameters>
533 static_assert(i < tuple_size<Zivid::CaptureAssistant::SuggestSettingsParameters>::value,
534 "Index must be less than 2");
537 = decltype(declval<Zivid::CaptureAssistant::SuggestSettingsParameters>().get<i>());
#define ZIVID_CORE_EXPORT
Definition: CoreExport.h:57
Ambient light frequency
Definition: SuggestSettingsParameters.h:110
ValueType value() const
Get the value
friend std::ostream & operator<<(std::ostream &stream, const AmbientLightFrequency::ValueType &value)
Operator to serialize ValueType to a stream
Definition: SuggestSettingsParameters.h:156
constexpr AmbientLightFrequency(ValueType value)
Constructor
Definition: SuggestSettingsParameters.h:145
AmbientLightFrequency()=default
Default constructor
static const AmbientLightFrequency none
none
Definition: SuggestSettingsParameters.h:131
bool operator==(const AmbientLightFrequency &other) const
Comparison operator
Definition: SuggestSettingsParameters.h:162
static std::set< ValueType > validValues()
All valid values of AmbientLightFrequency
Definition: SuggestSettingsParameters.h:136
static const AmbientLightFrequency hz60
hz60
Definition: SuggestSettingsParameters.h:133
friend std::ostream & operator<<(std::ostream &stream, const AmbientLightFrequency &value)
Operator to serialize the value to a stream
Definition: SuggestSettingsParameters.h:174
bool operator!=(const AmbientLightFrequency &other) const
Comparison operator
Definition: SuggestSettingsParameters.h:168
static const AmbientLightFrequency hz50
hz50
Definition: SuggestSettingsParameters.h:132
std::string toString() const
Get the value as string
ValueType
The type of the underlying value
Definition: SuggestSettingsParameters.h:126
Capture time budget
Definition: SuggestSettingsParameters.h:199
bool operator>(const MaxCaptureTime &other) const
Comparison operator
Definition: SuggestSettingsParameters.h:255
bool operator==(const MaxCaptureTime &other) const
Comparison operator
Definition: SuggestSettingsParameters.h:237
bool operator<(const MaxCaptureTime &other) const
Comparison operator
Definition: SuggestSettingsParameters.h:249
static constexpr Range< std::chrono::milliseconds > validRange()
The range of valid values for MaxCaptureTime
Definition: SuggestSettingsParameters.h:217
constexpr MaxCaptureTime(std::chrono::milliseconds value)
Constructor
Definition: SuggestSettingsParameters.h:226
bool operator!=(const MaxCaptureTime &other) const
Comparison operator
Definition: SuggestSettingsParameters.h:243
std::chrono::milliseconds ValueType
The type of the underlying value
Definition: SuggestSettingsParameters.h:214
std::string toString() const
Get the value as string
friend std::ostream & operator<<(std::ostream &stream, const MaxCaptureTime &value)
Operator to serialize the value to a stream
Definition: SuggestSettingsParameters.h:261
MaxCaptureTime()=default
Default constructor
std::chrono::milliseconds value() const
Get the value
Used to specify a constraint on the total capture time for the settings suggested by the Capture Assi...
Definition: SuggestSettingsParameters.h:78
std::tuple< SuggestSettingsParameters::AmbientLightFrequency, SuggestSettingsParameters::MaxCaptureTime > Descendants
Definition: SuggestSettingsParameters.h:285
const MaxCaptureTime & maxCaptureTime() const
Get MaxCaptureTime
Definition: SuggestSettingsParameters.h:411
friend std::ostream & operator<<(std::ostream &stream, const SuggestSettingsParameters &value)
Operator to send the value as string to a stream
Definition: SuggestSettingsParameters.h:483
MaxCaptureTime & maxCaptureTime()
Get MaxCaptureTime
Definition: SuggestSettingsParameters.h:417
SuggestSettingsParameters & set(const AmbientLightFrequency &value)
Set AmbientLightFrequency
Definition: SuggestSettingsParameters.h:404
void save(const std::string &fileName) const
Save to the given file
AmbientLightFrequency & ambientLightFrequency()
Get AmbientLightFrequency
Definition: SuggestSettingsParameters.h:398
void set(Args &&...args)
Set multiple arguments
Definition: SuggestSettingsParameters.h:342
const SuggestSettingsParameters::MaxCaptureTime & get() const
Definition: SuggestSettingsParameters.h:440
SuggestSettingsParameters copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition: SuggestSettingsParameters.h:374
SuggestSettingsParameters(Args &&...args)
Constructor taking variadic number of arguments
Definition: SuggestSettingsParameters.h:315
bool operator!=(const SuggestSettingsParameters &other) const
Inequality operator
SuggestSettingsParameters & set(const MaxCaptureTime &value)
Set MaxCaptureTime
Definition: SuggestSettingsParameters.h:423
bool operator==(const SuggestSettingsParameters &other) const
Equality operator
SuggestSettingsParameters(const std::string &fileName)
Construct SuggestSettingsParameters by loading from file
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter
Definition: SuggestSettingsParameters.h:459
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: SuggestSettingsParameters.h:467
const AmbientLightFrequency & ambientLightFrequency() const
Get AmbientLightFrequency
Definition: SuggestSettingsParameters.h:392
SuggestSettingsParameters()
Default constructor
std::string toString() const
Get the value as string
const SuggestSettingsParameters::AmbientLightFrequency & get() const
Definition: SuggestSettingsParameters.h:432
void load(const std::string &fileName)
Load from the given file
Class describing a range of values for a given type T
Definition: Range.h:58
NodeType
Definition: NodeType.h:56
Ret validRange(const CameraInfo &cameraInfo)
Definition: SettingsInfo.h:158
The main Zivid namespace. All Zivid code is found here
Definition: Application.h:55