Engine.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 #pragma once
4 
5 #include "PhysiologyEngine.h"
6 #include "controller/Controller.h"
7 PULSE_BIND_DECL(StateData)
8 //--------------------------------------------------------------------------------------------------
15 //--------------------------------------------------------------------------------------------------
16 class PULSE_DECL PulseEngine : public PhysiologyEngine, public PulseController
17 {
18  friend class PBPulseState;//friend the serialization class
19 public:
20 
21  PulseEngine(Logger* logger, const std::string& data_dir=".");
22  PulseEngine(const std::string&, const std::string& data_dir=".");
23  virtual ~PulseEngine();
24 
25  virtual bool SerializeFromFile(const std::string& file, SerializationFormat m);
26  virtual bool SerializeFromFile(const std::string& file, SerializationFormat m, const SEScalarTime* simTime, const SEEngineConfiguration* config);
27  virtual bool SerializeToFile(const std::string& file, SerializationFormat m) const;
28 
29  virtual bool SerializeFromString(const std::string& state, SerializationFormat m);
30  virtual bool SerializeFromString(const std::string& state, SerializationFormat m, const SEScalarTime* simTime, const SEEngineConfiguration* config);
31  virtual bool SerializeToString(std::string& state, SerializationFormat m) const;
32 
33  virtual const SEConditionManager& GetConditionManager() const;
34 
35  virtual Logger* GetLogger() const;
36  virtual SEEngineTracker* GetEngineTracker() const;
37 
38  virtual bool InitializeEngine(const std::string& patient_configuration, SerializationFormat m, const SEEngineConfiguration* config = nullptr);
39 
40  virtual bool InitializeEngine(const SEPatientConfiguration& patient_configuration, const SEEngineConfiguration* config = nullptr);
41 
42  virtual const SEEngineConfiguration* GetConfiguration() const;
43 
44  virtual double GetTimeStep(const TimeUnit& unit) const;
45  virtual double GetSimulationTime(const TimeUnit& unit) const;
46 
47  virtual void AdvanceModelTime();
48  virtual void AdvanceModelTime(double time, const TimeUnit& unit);
49  virtual bool ProcessAction(const SEAction& action);
50  virtual const SEActionManager& GetActionManager() const;
51 
52  virtual SESubstanceManager& GetSubstanceManager();
53  virtual const SESubstanceManager& GetSubstanceManager() const;
54  virtual void SetAdvanceHandler(SEAdvanceHandler* handler);
55  virtual void SetEventHandler(SEEventHandler* handler);
56  virtual const SEPatient& GetPatient() const;
57  virtual bool GetPatientAssessment(SEPatientAssessment& assessment) const;
58 
59  virtual const SEEnvironment* GetEnvironment() const;
60  virtual const SEBloodChemistrySystem* GetBloodChemistrySystem() const;
61  virtual const SECardiovascularSystem* GetCardiovascularSystem() const;
62  virtual const SEDrugSystem* GetDrugSystem() const;
63  virtual const SEEndocrineSystem* GetEndocrineSystem() const;
64  virtual const SEEnergySystem* GetEnergySystem() const;
65  virtual const SEGastrointestinalSystem* GetGastrointestinalSystem() const;
66  virtual const SEHepaticSystem* GetHepaticSystem() const;
67  virtual const SENervousSystem* GetNervousSystem() const;
68  virtual const SERenalSystem* GetRenalSystem() const;
69  virtual const SERespiratorySystem* GetRespiratorySystem() const;
70  virtual const SETissueSystem* GetTissueSystem() const;
71  virtual const SEAnesthesiaMachine* GetAnesthesiaMachine() const;
72  virtual const SEElectroCardioGram* GetElectroCardioGram() const;
73  virtual const SEInhaler* GetInhaler() const;
74 
75  virtual const SECompartmentManager& GetCompartments() const;
76 
77 
78  virtual void AdvanceCallback(double time_s);
79 protected:
80 
81  virtual bool IsReady() const;
82 
84  std::stringstream m_ss;
85 };
Definition: SESubstanceManager.h:8
Definition: SEElectroCardioGram.h:7
Definition: SEInhaler.h:11
Definition: SEPatient.h:61
Definition: Logger.h:61
SEEngineTracker * m_EngineTrack
Definition: Engine.h:83
Manages and controls execution of all data/systems in Pulse.
Definition: Controller.h:50
Definition: SEAnesthesiaMachine.h:30
Definition: SEEngineConfiguration.h:7
static bool SerializeToFile(const PulseEngine &src, const std::string &filename, SerializationFormat m)
Definition: PBPulseState.cpp:307
Definition: SEEngineTracker.h:59
Definition: SEAction.h:7
Definition: SENervousSystem.h:8
static bool SerializeToString(const PulseEngine &src, std::string &output, SerializationFormat m)
Definition: PBPulseState.cpp:301
Definition: SEGastrointestinalSystem.h:8
Definition: SERespiratorySystem.h:8
Definition: SECardiovascularSystem.h:11
Definition: SEActionManager.h:12
Definition: SEEventHandler.h:8
Definition: SERenalSystem.h:7
Definition: SEScalarTime.h:7
Definition: SETissueSystem.h:7
This is the implementation of the PhysiologyEngine interface for the this engines.
Definition: Engine.h:16
Definition: SEHepaticSystem.h:7
Definition: SECompartmentManager.h:24
Definition: SEConditionManager.h:20
Definition: SEPatientConfiguration.h:10
Definition: SEBloodChemistrySystem.h:9
Definition: PhysiologyEngine.h:52
Definition: PBPulseState.h:9
Definition: SEEnergySystem.h:7
Data formed at a level of a clinicians report. This is high level data, such as a mean or generalized...
Definition: SEPatientAssessment.h:21
static bool SerializeFromFile(const std::string &filename, PulseEngine &dst, SerializationFormat m, const SEScalarTime *simTime, const SEEngineConfiguration *config)
Definition: PBPulseState.cpp:323
Definition: SEEndocrineSystem.h:7
Definition: SEScalarTime.h:23
Definition: SEEnvironment.h:12
Definition: SEAdvanceHandler.h:7
Definition: SEDrugSystem.h:8
std::stringstream m_ss
Definition: Engine.h:84
static bool SerializeFromString(const std::string &src, PulseEngine &dst, SerializationFormat m, const SEScalarTime *simTime, const SEEngineConfiguration *config)
Definition: PBPulseState.cpp:315