EmotionalMath constructor

EmotionalMath(
  1. MathLibSettings mathSettings,
  2. ArtifactsDetectSetting detectionSettings,
  3. ShortArtifactsDetectSetting shortDetectionSettings,
  4. MentalAndSpectralSetting mentalSpectralSettings,
)

Implementation

EmotionalMath(
  MathLibSettings mathSettings,
  ArtifactsDetectSetting detectionSettings,
  ShortArtifactsDetectSetting shortDetectionSettings,
  MentalAndSpectralSetting mentalSpectralSettings,
) {
  _usingOp((arena, opStatus) {
    final nativeSettings = arena<NativeMathLibSetting>();
    nativeSettings.ref.fillFromManaged(mathSettings);

    final nativeDetectionSettings = arena<NativeArtifactDetectSetting>();
    nativeDetectionSettings.ref.fillFromManaged(detectionSettings);

    final nativeShortDetectionSettings = arena<NativeShortArtifactDetectSetting>();
    nativeShortDetectionSettings.ref.fillFromManaged(shortDetectionSettings);

    final nativeMentalSpectralSettings = arena<NativeMentalAndSpectralSetting>();
    nativeMentalSpectralSettings.ref.fillFromManaged(mentalSpectralSettings);

    _pointer = bindings.createMathLib(
      nativeSettings.ref,
      nativeDetectionSettings.ref,
      nativeShortDetectionSettings.ref,
      nativeMentalSpectralSettings.ref,
      opStatus,
    );

    opStatus.ref.throwIfNotSuccessful();
  });
}