SEAnesthesiaMachine.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 #include "system/SESystem.h"
6 class SEEventHandler;
12 
13 // Keep enums in sync with appropriate schema/cdm/AnesthesiaMachineEnums.proto file !!
14 enum class eAnesthesiaMachine_Event { OxygenBottleOneExhausted = 0, OxygenBottleTwoExhausted, ReliefValveActive };
15 extern const std::string& eAnesthesiaMachine_Event_Name(eAnesthesiaMachine_Event m);
16 
17 // Keep enums in sync with appropriate schema/cdm/AnesthesiaMachineEnums.proto file !!
18 enum class eAnesthesiaMachine_OxygenSource { NullSource = 0, NoSource, Wall, BottleOne, BottleTwo };
19 extern const std::string& eAnesthesiaMachine_OxygenSource_Name(eAnesthesiaMachine_OxygenSource m);
20 
21 // Keep enums in sync with appropriate schema/cdm/AnesthesiaMachineEnums.proto file !!
22 enum class eAnesthesiaMachine_PrimaryGas { NullGas = 0, NoGas, Air, Nitrogen };
23 extern const std::string& eAnesthesiaMachine_PrimaryGas_Name(eAnesthesiaMachine_PrimaryGas m);
24 
25 // Keep enums in sync with appropriate schema/cdm/AnesthesiaMachineEnums.proto file !!
26 enum class eAnesthesiaMachine_Connection { NullConnection = 0, Off, Mask, Tube };
27 extern const std::string& eAnesthesiaMachine_Connection_Name(eAnesthesiaMachine_Connection m);
28 
29 
30 class CDM_DECL SEAnesthesiaMachine : public SESystem
31 {
32  friend class PBAnesthesiaMachine;//friend the serialization class
33 protected:
35 public:
36 
38  virtual ~SEAnesthesiaMachine();
39 
40  virtual void Clear();
41 
42  bool SerializeToString(std::string& output, SerializationFormat m) const;
43  bool SerializeToFile(const std::string& filename, SerializationFormat m) const;
44  bool SerializeFromString(const std::string& src, SerializationFormat m);
45  bool SerializeFromFile(const std::string& filename, SerializationFormat m);
46 
47 protected:
48 
54  virtual void StateChange(){};
55  virtual void Merge(const SEAnesthesiaMachine& from);
56  virtual void ProcessConfiguration(const SEAnesthesiaMachineConfiguration& config);
57 
58 public:
59 
60  virtual const SEScalar* GetScalar(const std::string& name);
61 
62  virtual const std::map<eAnesthesiaMachine_Event, bool>& GetEventStates() const { return m_EventState; }
63  virtual void SetEvent(eAnesthesiaMachine_Event state, bool active, const SEScalarTime& time);
64  virtual bool IsEventActive(eAnesthesiaMachine_Event state) const;
65  virtual double GetEventDuration(eAnesthesiaMachine_Event type, const TimeUnit& unit) const;
66  virtual void UpdateEvents(const SEScalarTime& timeStep);
74  virtual void ForwardEvents(SEEventHandler* handler);
75 
76  virtual eAnesthesiaMachine_Connection GetConnection() const;
77  virtual void SetConnection(eAnesthesiaMachine_Connection c);
78 
79  virtual bool HasInletFlow() const;
80  virtual SEScalarVolumePerTime& GetInletFlow();
81  virtual double GetInletFlow(const VolumePerTimeUnit& unit) const;
82 
83  virtual bool HasInspiratoryExpiratoryRatio() const;
84  virtual SEScalar& GetInspiratoryExpiratoryRatio();
85  virtual double GetInspiratoryExpiratoryRatio() const;
86 
87  virtual bool HasOxygenFraction() const;
88  virtual SEScalar0To1& GetOxygenFraction();
89  virtual double GetOxygenFraction() const;
90 
91  virtual eAnesthesiaMachine_OxygenSource GetOxygenSource() const;
92  virtual void SetOxygenSource(eAnesthesiaMachine_OxygenSource name);
93 
94  virtual bool HasPositiveEndExpiredPressure() const;
95  virtual SEScalarPressure& GetPositiveEndExpiredPressure();
96  virtual double GetPositiveEndExpiredPressure(const PressureUnit& unit) const;
97 
98  virtual eAnesthesiaMachine_PrimaryGas GetPrimaryGas() const;
99  virtual void SetPrimaryGas(eAnesthesiaMachine_PrimaryGas name);
100 
101  virtual bool HasRespiratoryRate() const;
102  virtual SEScalarFrequency& GetRespiratoryRate();
103  virtual double GetRespiratoryRate(const FrequencyUnit& unit) const;
104 
105  virtual bool HasReliefValvePressure() const;
106  virtual SEScalarPressure& GetReliefValvePressure();
107  virtual double GetReliefValvePressure(const PressureUnit& unit) const;
108 
109  virtual bool HasVentilatorPressure() const;
110  virtual SEScalarPressure& GetVentilatorPressure();
111  virtual double GetVentilatorPressure(const PressureUnit& unit) const;
112 
113  virtual bool HasLeftChamber() const;
114  virtual SEAnesthesiaMachineChamber& GetLeftChamber();
115  virtual const SEAnesthesiaMachineChamber* GetLeftChamber() const;
116  virtual void RemoveLeftChamber();
117 
118  virtual bool HasRightChamber() const;
119  virtual SEAnesthesiaMachineChamber& GetRightChamber();
120  virtual const SEAnesthesiaMachineChamber* GetRightChamber() const;
121  virtual void RemoveRightChamber();
122 
123  virtual bool HasOxygenBottleOne() const;
124  virtual SEAnesthesiaMachineOxygenBottle& GetOxygenBottleOne();
125  virtual const SEAnesthesiaMachineOxygenBottle* GetOxygenBottleOne() const;
126  virtual void RemoveOxygenBottleOne();
127 
128  virtual bool HasOxygenBottleTwo() const;
129  virtual SEAnesthesiaMachineOxygenBottle& GetOxygenBottleTwo();
130  virtual const SEAnesthesiaMachineOxygenBottle* GetOxygenBottleTwo() const;
131  virtual void RemoveOxygenBottleTwo();
132 
133 protected:
134 
136  std::map<eAnesthesiaMachine_Event, bool> m_EventState;
137  std::map<eAnesthesiaMachine_Event, double> m_EventDuration_s;
138 
139  eAnesthesiaMachine_Connection m_Connection;
143  eAnesthesiaMachine_OxygenSource m_OxygenSource;
145  eAnesthesiaMachine_PrimaryGas m_PrimaryGas;
148 
150 
153 
156 
158 };
Definition: SESubstanceManager.h:8
friend SEAnesthesiaMachineConfiguration
Definition: SEAnesthesiaMachine.h:34
Definition: SEAnesthesiaMachineChamber.h:9
SEScalarFrequency * m_RespiratoryRate
Definition: SEAnesthesiaMachine.h:146
Definition: SEScalar.h:19
SEAnesthesiaMachineOxygenBottle * m_OxygenBottleTwo
Definition: SEAnesthesiaMachine.h:155
SEAnesthesiaMachineChamber * m_LeftChamber
Definition: SEAnesthesiaMachine.h:151
SEScalarPressure * m_ReliefValvePressure
Definition: SEAnesthesiaMachine.h:147
Definition: PBAnesthesiaMachine.h:9
static bool SerializeFromString(const std::string &src, SEAnesthesiaMachine &dst, SerializationFormat m)
Definition: PBAnesthesiaMachine.cpp:200
eAnesthesiaMachine_Connection m_Connection
Definition: SEAnesthesiaMachine.h:139
static bool SerializeToFile(const SEAnesthesiaMachine &src, const std::string &filename, SerializationFormat m)
Definition: PBAnesthesiaMachine.cpp:191
Definition: SEAnesthesiaMachineConfiguration.h:8
Definition: SEAnesthesiaMachine.h:30
Definition: SEAnesthesiaMachineOxygenBottle.h:8
Definition: SEScalarPressure.h:23
virtual void StateChange()
Definition: SEAnesthesiaMachine.h:54
SEScalarPressure * m_PositiveEndExpiredPressure
Definition: SEAnesthesiaMachine.h:144
SEAnesthesiaMachineChamber * m_RightChamber
Definition: SEAnesthesiaMachine.h:152
Definition: SEEventHandler.h:8
static bool SerializeFromFile(const std::string &filename, SEAnesthesiaMachine &dst, SerializationFormat m)
Definition: PBAnesthesiaMachine.cpp:208
Definition: SEScalarVolumePerTime.h:7
Definition: SEScalarTime.h:7
SESubstanceManager & m_Substances
Definition: SEAnesthesiaMachine.h:157
std::map< eAnesthesiaMachine_Event, double > m_EventDuration_s
Definition: SEAnesthesiaMachine.h:137
Definition: SEScalarPressure.h:7
Definition: SESystem.h:7
SEScalarPressure * m_VentilatorPressure
Definition: SEAnesthesiaMachine.h:149
std::map< eAnesthesiaMachine_Event, bool > m_EventState
Definition: SEAnesthesiaMachine.h:136
Definition: SEScalarVolumePerTime.h:26
eAnesthesiaMachine_OxygenSource m_OxygenSource
Definition: SEAnesthesiaMachine.h:143
eAnesthesiaMachine_PrimaryGas m_PrimaryGas
Definition: SEAnesthesiaMachine.h:145
SEEventHandler * m_EventHandler
Definition: SEAnesthesiaMachine.h:135
Definition: SEScalarFrequency.h:7
Definition: SEScalarTime.h:23
SEScalar0To1 * m_OxygenFraction
Definition: SEAnesthesiaMachine.h:142
Definition: SEScalarFrequency.h:21
virtual const std::map< eAnesthesiaMachine_Event, bool > & GetEventStates() const
Definition: SEAnesthesiaMachine.h:62
SEScalar * m_InspiratoryExpiratoryRatio
Definition: SEAnesthesiaMachine.h:141
Definition: SEGasSubstanceQuantity.h:9
SEAnesthesiaMachineOxygenBottle * m_OxygenBottleOne
Definition: SEAnesthesiaMachine.h:154
Definition: SEScalar0To1.h:7
static bool SerializeToString(const SEAnesthesiaMachine &src, std::string &output, SerializationFormat m)
Definition: PBAnesthesiaMachine.cpp:185
SEScalarVolumePerTime * m_InletFlow
Definition: SEAnesthesiaMachine.h:140