PulseEngineJNI.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #include <jni.h>
5 #include <iostream>
6 #include "PulsePhysiologyEngine.h"
7 #include "controller/Engine.h"
8 #include "scenario/SEScenarioExec.h"
9 #include "engine/SEEventHandler.h"
10 #include "engine/SEAdvanceHandler.h"
11 
12 #include <memory>
13 
15 {
16 public:
17  PulseEngineJNI(const std::string& logFile);
19 
20  void Reset();
21 
22  void ForwardDebug(const std::string& msg, const std::string& origin);
23  void ForwardInfo(const std::string& msg, const std::string& origin);
24  void ForwardWarning(const std::string& msg, const std::string& origin);
25  void ForwardError(const std::string& msg, const std::string& origin);
26  void ForwardFatal(const std::string& msg, const std::string& origin);
27  void PushData(double time_s);
28 
29  void OnAdvance(double time_s, const PhysiologyEngine& engine);
30  void HandlePatientEvent(ePatient_Event type, bool active, const SEScalarTime* time = nullptr);
31  void HandleAnesthesiaMachineEvent(eAnesthesiaMachine_Event type, bool active, const SEScalarTime* time = nullptr);
32 
33  JNIEnv* jniEnv;
34  jobject jniObj;
40  std::unique_ptr<PulseEngine> eng;
41 
42  jmethodID jniDebugMethodID;
43  jmethodID jniInfoMethodID;
44  jmethodID jniWarnMethodID;
45  jmethodID jniErrorMethodID;
46  jmethodID jniFatalMethodID;
47 };
PulseEngineJNI(const std::string &logFile)
Definition: PulseEngineJNI.cpp:388
Definition: DataTrack.h:24
void ForwardFatal(const std::string &msg, const std::string &origin)
Definition: PulseEngineJNI.cpp:510
int updateFrequency_cnt
Definition: PulseEngineJNI.h:39
void PushData(double time_s)
Definition: PulseEngineJNI.cpp:425
void ForwardInfo(const std::string &msg, const std::string &origin)
Definition: PulseEngineJNI.cpp:474
void ForwardWarning(const std::string &msg, const std::string &origin)
Definition: PulseEngineJNI.cpp:486
bool firstUpdate
Definition: PulseEngineJNI.h:37
void ForwardError(const std::string &msg, const std::string &origin)
Definition: PulseEngineJNI.cpp:498
Overloaded scenario exector to run a Pulse specific scenario.
Definition: ScenarioExec.h:14
Definition: SEEventHandler.h:8
DataTrack * trk
Definition: PulseEngineJNI.h:35
void Reset()
Definition: PulseEngineJNI.cpp:402
int update_cnt
Definition: PulseEngineJNI.h:38
void HandlePatientEvent(ePatient_Event type, bool active, const SEScalarTime *time=nullptr)
Definition: PulseEngineJNI.cpp:527
Definition: PulseEngineJNI.h:14
PulseScenarioExec * exec
Definition: PulseEngineJNI.h:36
Definition: PhysiologyEngine.h:52
jmethodID jniErrorMethodID
Definition: PulseEngineJNI.h:45
jmethodID jniWarnMethodID
Definition: PulseEngineJNI.h:44
void OnAdvance(double time_s, const PhysiologyEngine &engine)
Definition: PulseEngineJNI.cpp:417
jmethodID jniInfoMethodID
Definition: PulseEngineJNI.h:43
jmethodID jniFatalMethodID
Definition: PulseEngineJNI.h:46
Definition: Logger.h:49
jmethodID jniDebugMethodID
Definition: PulseEngineJNI.h:42
Definition: SEScalarTime.h:23
void HandleAnesthesiaMachineEvent(eAnesthesiaMachine_Event type, bool active, const SEScalarTime *time=nullptr)
Definition: PulseEngineJNI.cpp:537
jobject jniObj
Definition: PulseEngineJNI.h:34
Definition: SEAdvanceHandler.h:7
JNIEnv * jniEnv
Definition: PulseEngineJNI.h:33
std::unique_ptr< PulseEngine > eng
Definition: PulseEngineJNI.h:40
void ForwardDebug(const std::string &msg, const std::string &origin)
Definition: PulseEngineJNI.cpp:462
~PulseEngineJNI()
Definition: PulseEngineJNI.cpp:397