112# pragma warning(push)
113# pragma warning(disable : 4251)
118 namespace CaptureAssistant
128 static constexpr const char *path{
"" };
131 static constexpr const char *name{
"SuggestSettingsParameters" };
134 static constexpr const char *description{
135 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"
138 static constexpr size_t version{ 1 };
148 static constexpr std::array<uint8_t, 3> binaryId{
's',
's',
'p' };
160 static constexpr const char *path{
"AmbientLightFrequency" };
163 static constexpr const char *name{
"AmbientLightFrequency" };
166 static constexpr const char *description{ R
"description(Ambient light frequency)description" };
182 return { ValueType::none, ValueType::hz50, ValueType::hz60 };
190 : m_value{ verifyValue(value) }
208 return m_value == other.m_value;
214 return m_value != other.m_value;
224 void setFromString(
const std::string &value);
226 constexpr ValueType
static verifyValue(
const ValueType &value)
228 return value == ValueType::none || value == ValueType::hz50 || value == ValueType::hz60
230 :
throw std::invalid_argument{
231 "Invalid value: AmbientLightFrequency{ "
232 + std::to_string(
static_cast<std::underlying_type<ValueType>::type
>(value)) +
" }"
249 static constexpr const char *path{
"MaxCaptureTime" };
252 static constexpr const char *name{
"MaxCaptureTime" };
255 static constexpr const char *description{ R
"description(Capture time budget)description" };
263 return { std::chrono::milliseconds{ 200 }, std::chrono::milliseconds{ 10000 } };
271 : m_value{ verifyValue(value) }
275 std::chrono::milliseconds
value()
const;
283 return m_value == other.m_value;
289 return m_value != other.m_value;
295 return m_value < other.m_value;
301 return m_value > other.m_value;
311 void setFromString(
const std::string &value);
313 constexpr ValueType
static verifyValue(
const ValueType &value)
317 :
throw std::out_of_range{
"MaxCaptureTime{ " + std::to_string(value.count())
318 +
" } is not in range ["
319 + std::to_string(
validRange().min().count()) +
", "
320 + std::to_string(
validRange().max().count()) +
"]" };
323 std::chrono::milliseconds m_value{ 1200 };
329 std::tuple<SuggestSettingsParameters::AmbientLightFrequency, SuggestSettingsParameters::MaxCaptureTime>;
350 template<
typename... Args,
351 typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0,
352 typename std::enable_if<
353 Zivid::Detail::TypeTraits::AllArgsAreInTuple<
Descendants,
354 typename std::decay<Args>::type...>::value,
357 template<typename... Args>
361 using namespace Zivid::Detail::TypeTraits;
363 static_assert(AllArgsDecayedAreUnique<Args...>::value,
364 "Found duplicate types among the arguments passed to SuggestSettingsParameters(...). "
365 "Types should be listed at most once.");
367 set(std::forward<Args>(args)...);
382 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 2,
int>::type = 0>
384 template<typename... Args>
388 using namespace Zivid::Detail::TypeTraits;
390 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
391 static_assert(AllArgsAreDescendantNodes::value,
392 "All arguments passed to set(...) must be descendant nodes.");
394 static_assert(AllArgsDecayedAreUnique<Args...>::value,
395 "Found duplicate types among the arguments passed to set(...). "
396 "Types should be listed at most once.");
398 Zivid::DataModel::Detail::invokeSetWithEachArgument(*
this, std::forward<Args>(args)...);
414 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0>
416 template<typename... Args>
420 using namespace Zivid::Detail::TypeTraits;
422 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
423 static_assert(AllArgsAreDescendantNodes::value,
424 "All arguments passed to copyWith(...) must be descendant nodes.");
426 static_assert(AllArgsDecayedAreUnique<Args...>::value,
427 "Found duplicate types among the arguments passed to copyWith(...). "
428 "Types should be listed at most once.");
431 copy.
set(std::forward<Args>(args)...);
438 return m_ambientLightFrequency;
444 return m_ambientLightFrequency;
450 m_ambientLightFrequency = value;
457 return m_maxCaptureTime;
463 return m_maxCaptureTime;
469 m_maxCaptureTime = value;
474 typename std::enable_if<std::is_same<T, SuggestSettingsParameters::AmbientLightFrequency>::value,
478 return m_ambientLightFrequency;
482 typename std::enable_if<std::is_same<T, SuggestSettingsParameters::MaxCaptureTime>::value,
486 return m_maxCaptureTime;
489 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
492 return m_ambientLightFrequency;
495 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
498 return m_maxCaptureTime;
505 f(m_ambientLightFrequency);
513 f(m_ambientLightFrequency);
533 void save(
const std::string &fileName)
const;
536 void load(
const std::string &fileName);
539 void setFromString(
const std::string &value);
541 void setFromString(
const std::string &fullPath,
const std::string &value);
543 std::string getString(
const std::string &fullPath)
const;
553 struct SuggestSettingsParameters::Version<1>
567# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
571 struct tuple_size<
Zivid::CaptureAssistant::SuggestSettingsParameters> : integral_constant<size_t, 2>
575 struct tuple_element<i,
Zivid::CaptureAssistant::SuggestSettingsParameters>
577 static_assert(i < tuple_size<Zivid::CaptureAssistant::SuggestSettingsParameters>::value,
578 "Index must be less than 2");
581 =
decltype(declval<Zivid::CaptureAssistant::SuggestSettingsParameters>().get<i>());
#define ZIVID_CORE_EXPORT
Definition: CoreExport.h:101
Ambient light frequency
Definition: SuggestSettingsParameters.h:154
ValueType value() const
Get the value
constexpr AmbientLightFrequency(ValueType value)
Constructor
Definition: SuggestSettingsParameters.h:189
static std::set< ValueType > validValues()
All valid values of AmbientLightFrequency
Definition: SuggestSettingsParameters.h:180
AmbientLightFrequency()=default
Default constructor
static const AmbientLightFrequency none
none
Definition: SuggestSettingsParameters.h:175
bool operator==(const AmbientLightFrequency &other) const
Comparison operator
Definition: SuggestSettingsParameters.h:206
static const AmbientLightFrequency hz60
hz60
Definition: SuggestSettingsParameters.h:177
friend std::ostream & operator<<(std::ostream &stream, const AmbientLightFrequency::ValueType &value)
Operator to serialize ValueType to a stream
Definition: SuggestSettingsParameters.h:200
bool operator!=(const AmbientLightFrequency &other) const
Comparison operator
Definition: SuggestSettingsParameters.h:212
static const AmbientLightFrequency hz50
hz50
Definition: SuggestSettingsParameters.h:176
friend std::ostream & operator<<(std::ostream &stream, const AmbientLightFrequency &value)
Operator to serialize the value to a stream
Definition: SuggestSettingsParameters.h:218
std::string toString() const
Get the value as string
ValueType
The type of the underlying value
Definition: SuggestSettingsParameters.h:170
Capture time budget
Definition: SuggestSettingsParameters.h:243
bool operator>(const MaxCaptureTime &other) const
Comparison operator
Definition: SuggestSettingsParameters.h:299
bool operator==(const MaxCaptureTime &other) const
Comparison operator
Definition: SuggestSettingsParameters.h:281
bool operator<(const MaxCaptureTime &other) const
Comparison operator
Definition: SuggestSettingsParameters.h:293
static constexpr Range< std::chrono::milliseconds > validRange()
The range of valid values for MaxCaptureTime
Definition: SuggestSettingsParameters.h:261
constexpr MaxCaptureTime(std::chrono::milliseconds value)
Constructor
Definition: SuggestSettingsParameters.h:270
bool operator!=(const MaxCaptureTime &other) const
Comparison operator
Definition: SuggestSettingsParameters.h:287
std::chrono::milliseconds ValueType
The type of the underlying value
Definition: SuggestSettingsParameters.h:258
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:305
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:122
std::tuple< SuggestSettingsParameters::AmbientLightFrequency, SuggestSettingsParameters::MaxCaptureTime > Descendants
Definition: SuggestSettingsParameters.h:329
SuggestSettingsParameters & set(const MaxCaptureTime &value)
Set MaxCaptureTime
Definition: SuggestSettingsParameters.h:467
void save(const std::string &fileName) const
Save to the given file
void set(Args &&...args)
Set multiple arguments
Definition: SuggestSettingsParameters.h:386
const AmbientLightFrequency & ambientLightFrequency() const
Get AmbientLightFrequency
Definition: SuggestSettingsParameters.h:436
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:418
SuggestSettingsParameters(Args &&...args)
Constructor taking variadic number of arguments
Definition: SuggestSettingsParameters.h:359
AmbientLightFrequency & ambientLightFrequency()
Get AmbientLightFrequency
Definition: SuggestSettingsParameters.h:442
MaxCaptureTime & maxCaptureTime()
Get MaxCaptureTime
Definition: SuggestSettingsParameters.h:461
bool operator!=(const SuggestSettingsParameters &other) const
Inequality operator
const SuggestSettingsParameters::MaxCaptureTime & get() const
Definition: SuggestSettingsParameters.h:484
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:503
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter
Definition: SuggestSettingsParameters.h:511
SuggestSettingsParameters()
Default constructor
const MaxCaptureTime & maxCaptureTime() const
Get MaxCaptureTime
Definition: SuggestSettingsParameters.h:455
SuggestSettingsParameters & set(const AmbientLightFrequency &value)
Set AmbientLightFrequency
Definition: SuggestSettingsParameters.h:448
std::string toString() const
Get the value as string
friend std::ostream & operator<<(std::ostream &stream, const SuggestSettingsParameters &value)
Operator to send the value as string to a stream
Definition: SuggestSettingsParameters.h:527
void load(const std::string &fileName)
Load from the given file
const SuggestSettingsParameters::AmbientLightFrequency & get() const
Definition: SuggestSettingsParameters.h:476
Class describing a range of values for a given type T
Definition: Range.h:102
NodeType
Definition: NodeType.h:100
Ret validRange(const CameraInfo &cameraInfo)
Definition: SettingsInfo.h:201
The main Zivid namespace. All Zivid code is found here
Definition: Application.h:99