/// /// 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() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #include namespace margelo::nitro::haptika::ppg { /** * A struct which can be represented as a JavaScript object (NativePRVMetrics). */ struct NativePRVMetrics final { public: std::optional estimatedRmssdMs SWIFT_PRIVATE; std::optional estimatedSdnnMs SWIFT_PRIVATE; std::optional meanIpiMs SWIFT_PRIVATE; std::optional medianIpiMs SWIFT_PRIVATE; std::optional pnn50Percent SWIFT_PRIVATE; std::optional rangeIpiMs SWIFT_PRIVATE; std::optional modeIpiMs SWIFT_PRIVATE; std::optional amo50Percent SWIFT_PRIVATE; std::optional 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 estimatedRmssdMs, std::optional estimatedSdnnMs, std::optional meanIpiMs, std::optional medianIpiMs, std::optional pnn50Percent, std::optional rangeIpiMs, std::optional modeIpiMs, std::optional amo50Percent, std::optional 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 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>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedRmssdMs"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedSdnnMs"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "meanIpiMs"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "medianIpiMs"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pnn50Percent"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rangeIpiMs"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modeIpiMs"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amo50Percent"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coefficientOfVariation"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validIntervalCount"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalCount"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalRatio"))), JSIConverter::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>::toJSI(runtime, arg.estimatedRmssdMs)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "estimatedSdnnMs"), JSIConverter>::toJSI(runtime, arg.estimatedSdnnMs)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "meanIpiMs"), JSIConverter>::toJSI(runtime, arg.meanIpiMs)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "medianIpiMs"), JSIConverter>::toJSI(runtime, arg.medianIpiMs)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "pnn50Percent"), JSIConverter>::toJSI(runtime, arg.pnn50Percent)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "rangeIpiMs"), JSIConverter>::toJSI(runtime, arg.rangeIpiMs)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "modeIpiMs"), JSIConverter>::toJSI(runtime, arg.modeIpiMs)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "amo50Percent"), JSIConverter>::toJSI(runtime, arg.amo50Percent)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "coefficientOfVariation"), JSIConverter>::toJSI(runtime, arg.coefficientOfVariation)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "validIntervalCount"), JSIConverter::toJSI(runtime, arg.validIntervalCount)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalCount"), JSIConverter::toJSI(runtime, arg.rejectedIntervalCount)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalRatio"), JSIConverter::toJSI(runtime, arg.rejectedIntervalRatio)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "reliable"), JSIConverter::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>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedRmssdMs")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedSdnnMs")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "meanIpiMs")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "medianIpiMs")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pnn50Percent")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rangeIpiMs")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modeIpiMs")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amo50Percent")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coefficientOfVariation")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validIntervalCount")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalCount")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalRatio")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "reliable")))) return false; return true; } }; } // namespace margelo::nitro