/// /// NativeBPMEstimate.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 #include namespace margelo::nitro::haptika::ppg { /** * A struct which can be represented as a JavaScript object (NativeBPMEstimate). */ struct NativeBPMEstimate final { public: std::optional bpm SWIFT_PRIVATE; std::optional temporalBpm SWIFT_PRIVATE; std::optional frequencyBpm SWIFT_PRIVATE; std::optional methodAgreementBpm SWIFT_PRIVATE; double validPeakCount SWIFT_PRIVATE; double rejectedPeakCount SWIFT_PRIVATE; double confidence SWIFT_PRIVATE; std::string selectedChannel SWIFT_PRIVATE; public: NativeBPMEstimate() = default; explicit NativeBPMEstimate(std::optional bpm, std::optional temporalBpm, std::optional frequencyBpm, std::optional methodAgreementBpm, double validPeakCount, double rejectedPeakCount, double confidence, std::string selectedChannel): bpm(bpm), temporalBpm(temporalBpm), frequencyBpm(frequencyBpm), methodAgreementBpm(methodAgreementBpm), validPeakCount(validPeakCount), rejectedPeakCount(rejectedPeakCount), confidence(confidence), selectedChannel(selectedChannel) {} public: friend bool operator==(const NativeBPMEstimate& lhs, const NativeBPMEstimate& rhs) = default; }; } // namespace margelo::nitro::haptika::ppg namespace margelo::nitro { // C++ NativeBPMEstimate <> JS NativeBPMEstimate (object) template <> struct JSIConverter final { static inline margelo::nitro::haptika::ppg::NativeBPMEstimate fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { jsi::Object obj = arg.asObject(runtime); return margelo::nitro::haptika::ppg::NativeBPMEstimate( JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bpm"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "temporalBpm"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "frequencyBpm"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "methodAgreementBpm"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validPeakCount"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedPeakCount"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selectedChannel"))) ); } static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativeBPMEstimate& arg) { jsi::Object obj(runtime); obj.setProperty(runtime, PropNameIDCache::get(runtime, "bpm"), JSIConverter>::toJSI(runtime, arg.bpm)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "temporalBpm"), JSIConverter>::toJSI(runtime, arg.temporalBpm)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "frequencyBpm"), JSIConverter>::toJSI(runtime, arg.frequencyBpm)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "methodAgreementBpm"), JSIConverter>::toJSI(runtime, arg.methodAgreementBpm)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "validPeakCount"), JSIConverter::toJSI(runtime, arg.validPeakCount)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "rejectedPeakCount"), JSIConverter::toJSI(runtime, arg.rejectedPeakCount)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "confidence"), JSIConverter::toJSI(runtime, arg.confidence)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "selectedChannel"), JSIConverter::toJSI(runtime, arg.selectedChannel)); 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, "bpm")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "temporalBpm")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "frequencyBpm")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "methodAgreementBpm")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validPeakCount")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedPeakCount")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selectedChannel")))) return false; return true; } }; } // namespace margelo::nitro