132 lines
9.4 KiB
C++
Generated
132 lines
9.4 KiB
C++
Generated
///
|
|
/// NativePRVMetrics.hpp
|
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
/// https://github.com/mrousavy/nitro
|
|
/// Copyright © Marc Rousavy @ Margelo
|
|
///
|
|
|
|
#pragma once
|
|
|
|
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
#include <NitroModules/JSIConverter.hpp>
|
|
#else
|
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
#endif
|
|
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
#include <NitroModules/NitroDefines.hpp>
|
|
#else
|
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
#endif
|
|
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
#include <NitroModules/JSIHelpers.hpp>
|
|
#else
|
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
#endif
|
|
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
#include <NitroModules/PropNameIDCache.hpp>
|
|
#else
|
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
#endif
|
|
|
|
|
|
|
|
#include <optional>
|
|
|
|
namespace margelo::nitro::haptika::ppg {
|
|
|
|
/**
|
|
* A struct which can be represented as a JavaScript object (NativePRVMetrics).
|
|
*/
|
|
struct NativePRVMetrics final {
|
|
public:
|
|
std::optional<double> estimatedRmssdMs SWIFT_PRIVATE;
|
|
std::optional<double> estimatedSdnnMs SWIFT_PRIVATE;
|
|
std::optional<double> meanIpiMs SWIFT_PRIVATE;
|
|
std::optional<double> medianIpiMs SWIFT_PRIVATE;
|
|
std::optional<double> pnn50Percent SWIFT_PRIVATE;
|
|
std::optional<double> rangeIpiMs SWIFT_PRIVATE;
|
|
std::optional<double> modeIpiMs SWIFT_PRIVATE;
|
|
std::optional<double> amo50Percent SWIFT_PRIVATE;
|
|
std::optional<double> coefficientOfVariation SWIFT_PRIVATE;
|
|
double validIntervalCount SWIFT_PRIVATE;
|
|
double rejectedIntervalCount SWIFT_PRIVATE;
|
|
double rejectedIntervalRatio SWIFT_PRIVATE;
|
|
bool reliable SWIFT_PRIVATE;
|
|
|
|
public:
|
|
NativePRVMetrics() = default;
|
|
explicit NativePRVMetrics(std::optional<double> estimatedRmssdMs, std::optional<double> estimatedSdnnMs, std::optional<double> meanIpiMs, std::optional<double> medianIpiMs, std::optional<double> pnn50Percent, std::optional<double> rangeIpiMs, std::optional<double> modeIpiMs, std::optional<double> amo50Percent, std::optional<double> coefficientOfVariation, double validIntervalCount, double rejectedIntervalCount, double rejectedIntervalRatio, bool reliable): estimatedRmssdMs(estimatedRmssdMs), estimatedSdnnMs(estimatedSdnnMs), meanIpiMs(meanIpiMs), medianIpiMs(medianIpiMs), pnn50Percent(pnn50Percent), rangeIpiMs(rangeIpiMs), modeIpiMs(modeIpiMs), amo50Percent(amo50Percent), coefficientOfVariation(coefficientOfVariation), validIntervalCount(validIntervalCount), rejectedIntervalCount(rejectedIntervalCount), rejectedIntervalRatio(rejectedIntervalRatio), reliable(reliable) {}
|
|
|
|
public:
|
|
friend bool operator==(const NativePRVMetrics& lhs, const NativePRVMetrics& rhs) = default;
|
|
};
|
|
|
|
} // namespace margelo::nitro::haptika::ppg
|
|
|
|
namespace margelo::nitro {
|
|
|
|
// C++ NativePRVMetrics <> JS NativePRVMetrics (object)
|
|
template <>
|
|
struct JSIConverter<margelo::nitro::haptika::ppg::NativePRVMetrics> final {
|
|
static inline margelo::nitro::haptika::ppg::NativePRVMetrics fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
jsi::Object obj = arg.asObject(runtime);
|
|
return margelo::nitro::haptika::ppg::NativePRVMetrics(
|
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedRmssdMs"))),
|
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedSdnnMs"))),
|
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "meanIpiMs"))),
|
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "medianIpiMs"))),
|
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pnn50Percent"))),
|
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rangeIpiMs"))),
|
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modeIpiMs"))),
|
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amo50Percent"))),
|
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coefficientOfVariation"))),
|
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validIntervalCount"))),
|
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalCount"))),
|
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalRatio"))),
|
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "reliable")))
|
|
);
|
|
}
|
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativePRVMetrics& arg) {
|
|
jsi::Object obj(runtime);
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "estimatedRmssdMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.estimatedRmssdMs));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "estimatedSdnnMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.estimatedSdnnMs));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "meanIpiMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.meanIpiMs));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "medianIpiMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.medianIpiMs));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "pnn50Percent"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.pnn50Percent));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rangeIpiMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.rangeIpiMs));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "modeIpiMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.modeIpiMs));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "amo50Percent"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.amo50Percent));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "coefficientOfVariation"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.coefficientOfVariation));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "validIntervalCount"), JSIConverter<double>::toJSI(runtime, arg.validIntervalCount));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalCount"), JSIConverter<double>::toJSI(runtime, arg.rejectedIntervalCount));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalRatio"), JSIConverter<double>::toJSI(runtime, arg.rejectedIntervalRatio));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "reliable"), JSIConverter<bool>::toJSI(runtime, arg.reliable));
|
|
return obj;
|
|
}
|
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
if (!value.isObject()) {
|
|
return false;
|
|
}
|
|
jsi::Object obj = value.getObject(runtime);
|
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
return false;
|
|
}
|
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedRmssdMs")))) return false;
|
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedSdnnMs")))) return false;
|
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "meanIpiMs")))) return false;
|
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "medianIpiMs")))) return false;
|
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pnn50Percent")))) return false;
|
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rangeIpiMs")))) return false;
|
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modeIpiMs")))) return false;
|
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amo50Percent")))) return false;
|
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coefficientOfVariation")))) return false;
|
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validIntervalCount")))) return false;
|
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalCount")))) return false;
|
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalRatio")))) return false;
|
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "reliable")))) return false;
|
|
return true;
|
|
}
|
|
};
|
|
|
|
} // namespace margelo::nitro
|