Commit 000cb896 authored by Aaron Bray's avatar Aaron Bray
Browse files

Refactor Pulse controller architecture to support different engine implementations

parent 17a8fab0
......@@ -291,6 +291,7 @@ add_library_ex(CommonDataModel
system/physiology/SERespiratorySystem.h
system/physiology/SETissueSystem.h
utils/ConfigParser.h
utils/CSV.h
utils/DataPeak.h
utils/DataTrack.h
utils/EnumHashSpecialization.h
......@@ -620,6 +621,7 @@ add_library_ex(CommonDataModel
system/physiology/SERespiratorySystem.cpp
system/physiology/SETissueSystem.cpp
utils/ConfigParser.cpp
utils/CSV.cpp
utils/DataPeak.cpp
utils/DataTrack.cpp
utils/FileUtils.cpp
......
/* Distributed under the Apache License, Version 2.0.
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "CSV.h"
#include "properties/SEScalar.h"
#include <algorithm>
#include <fstream>
#include <sstream>
#include <cctype>
// ----------------------------------------------------------------------------
std::string trim(std::string const& in)
{
if (in.empty())
{
return {};
}
int (*isspace)(int) = &std::isspace;
auto const begin = std::find_if_not(in.begin(), in.end(), isspace);
if (begin == in.end())
{
return {};
}
auto end = std::find_if_not(in.rbegin(), in.rend(), isspace);
return {begin, end.base()};
}
// ----------------------------------------------------------------------------
class CSV::Private
{
public:
Private(std::string const& path)
: stream{path}
{
}
std::ifstream stream;
std::stringstream record;
};
// ----------------------------------------------------------------------------
CSV::CSV(std::string const& path)
: m_p{new Private{path}}
{
}
// ----------------------------------------------------------------------------
CSV::CSV(CSV&& other)
: m_p{std::move(other.m_p)}
{
}
// ----------------------------------------------------------------------------
CSV::~CSV()
{
}
// ----------------------------------------------------------------------------
bool CSV::NextRecord()
{
auto buffer = std::string{};
for (;;)
{
// Read next line from stream
if (!std::getline(m_p->stream, buffer))
{
return false;
}
buffer = trim(buffer);
// Skip blank lines and comments
if (buffer.empty() || buffer[0] == '#')
{
continue;
}
// Reset record stream
m_p->record = std::stringstream{buffer};
return true;
}
}
// ----------------------------------------------------------------------------
std::string CSV::NextValue(unsigned skip)
{
for (;;)
{
auto out = std::string{};
if (std::getline(m_p->record, out, ','))
{
if (skip)
{
--skip;
continue;
}
return trim(out);
}
}
return "";
}
// ----------------------------------------------------------------------------
double CSV::NextValueAsDouble(unsigned skip)
{
std::string v = NextValue(skip);
if (!v.empty())
{
auto p = static_cast<char*>(nullptr);
auto const out = std::strtod(v.c_str(), &p);
if (*p == 0) // All characters were consumed
{
return out;
}
}
return SEScalar::dNaN();
}
// ----------------------------------------------------------------------------
std::string CSV::Record() const
{
return m_p->record.str();
}
/* Distributed under the Apache License, Version 2.0.
See accompanying NOTICE file for details.*/
#pragma once
#include <memory>
#include <string>
// ----------------------------------------------------------------------------
/// Utility class to read a CSV file
class CDM_DECL CSV
{
public:
/// Constructor.
///
/// \param config Path to CSV file to read.
CSV(std::string const& path);
CSV(CSV&&);
~CSV();
bool NextRecord();
std::string NextValue(unsigned skip = 0);
double NextValueAsDouble(unsigned skip = 0);
std::string Record() const;
private:
CSV(CSV const&) = delete;
class Private;
std::unique_ptr<Private> m_p;
};
......@@ -11,7 +11,6 @@ add_library_ex(CommonPulseModels
controller/Compartments.h
controller/Controller.h
controller/Engine.h
controller/PatientSetup.h
controller/Substances.h
controller/System.h
environment/Environment.h
......@@ -46,8 +45,9 @@ add_library_ex(CommonPulseModels
controller/Compartments.cpp
controller/Controller.cpp
controller/Engine.cpp
controller/PatientSetup.cpp
controller/Substances.cpp
controller/SetupPatient.cpp
controller/SetupCircuitsAndCompartments.cpp
environment/Environment.cpp
equipment/AnesthesiaMachine.cpp
equipment/ECG.cpp
......
......@@ -33,7 +33,7 @@ See accompanying NOTICE file for details.*/
class PULSE_DECL PulseBloodChemistrySystem : public SEBloodChemistrySystem, public PulseSystem
{
public:
PulseBloodChemistrySystem(Logger* logger) : SEBloodChemistrySystem(logger) {}
PulseBloodChemistrySystem(PulseData& data) : SEBloodChemistrySystem(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseBloodChemistrySystem() = default;
virtual const SEScalar* GetScalar(const std::string& name) override
......@@ -54,7 +54,7 @@ protected:
class PULSE_DECL PulseCardiovascularSystem : public SECardiovascularSystem, public PulseSystem
{
public:
PulseCardiovascularSystem(Logger* logger) : SECardiovascularSystem(logger) {}
PulseCardiovascularSystem(PulseData& data) : SECardiovascularSystem(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseCardiovascularSystem() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -75,7 +75,7 @@ protected:
class PULSE_DECL PulseDrugSystem : public SEDrugSystem, public PulseSystem
{
public:
PulseDrugSystem(Logger* logger) : SEDrugSystem(logger) {}
PulseDrugSystem(PulseData& data) : SEDrugSystem(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseDrugSystem() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -96,7 +96,7 @@ protected:
class PULSE_DECL PulseEndocrineSystem : public SEEndocrineSystem, public PulseSystem
{
public:
PulseEndocrineSystem(Logger* logger) : SEEndocrineSystem(logger) {}
PulseEndocrineSystem(PulseData& data) : SEEndocrineSystem(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseEndocrineSystem() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -117,7 +117,7 @@ protected:
class PULSE_DECL PulseEnergySystem : public SEEnergySystem, public PulseSystem
{
public:
PulseEnergySystem(Logger* logger) : SEEnergySystem(logger) {}
PulseEnergySystem(PulseData& data) : SEEnergySystem(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseEnergySystem() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -138,7 +138,7 @@ protected:
class PULSE_DECL PulseGastrointestinalSystem : public SEGastrointestinalSystem, public PulseSystem
{
public:
PulseGastrointestinalSystem(Logger* logger) : SEGastrointestinalSystem(logger) {}
PulseGastrointestinalSystem(PulseData& data) : SEGastrointestinalSystem(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseGastrointestinalSystem() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -159,7 +159,7 @@ protected:
class PULSE_DECL PulseHepaticSystem : public SEHepaticSystem, public PulseSystem
{
public:
PulseHepaticSystem(Logger* logger) : SEHepaticSystem(logger) {}
PulseHepaticSystem(PulseData& data) : SEHepaticSystem(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseHepaticSystem() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -180,7 +180,7 @@ protected:
class PULSE_DECL PulseNervousSystem : public SENervousSystem, public PulseSystem
{
public:
PulseNervousSystem(Logger* logger) : SENervousSystem(logger) {}
PulseNervousSystem(PulseData& data) : SENervousSystem(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseNervousSystem() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -201,7 +201,7 @@ protected:
class PULSE_DECL PulseRenalSystem : public SERenalSystem, public PulseSystem
{
public:
PulseRenalSystem(Logger* logger) : SERenalSystem(logger) {}
PulseRenalSystem(PulseData& data) : SERenalSystem(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseRenalSystem() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -222,7 +222,7 @@ protected:
class PULSE_DECL PulseRespiratorySystem : public SERespiratorySystem, public PulseSystem
{
public:
PulseRespiratorySystem(Logger* logger) : SERespiratorySystem(logger) {}
PulseRespiratorySystem(PulseData& data) : SERespiratorySystem(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseRespiratorySystem() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -246,7 +246,7 @@ public:
class PULSE_DECL PulseTissueSystem : public SETissueSystem, public PulseSystem
{
public:
PulseTissueSystem(Logger* logger) : SETissueSystem(logger) {}
PulseTissueSystem(PulseData& data) : SETissueSystem(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseTissueSystem() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -267,7 +267,7 @@ protected:
class PULSE_DECL PulseEnvironmentSystem : public SEEnvironment, public PulseSystem
{
public:
PulseEnvironmentSystem(Logger* logger) : SEEnvironment(logger) {}
PulseEnvironmentSystem(PulseData& data) : SEEnvironment(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseEnvironmentSystem() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -288,7 +288,7 @@ protected:
class PULSE_DECL PulseAnesthesiaMachine : public SEAnesthesiaMachine, public PulseSystem
{
public:
PulseAnesthesiaMachine(Logger* logger) : SEAnesthesiaMachine(logger) {}
PulseAnesthesiaMachine(PulseData& data) : SEAnesthesiaMachine(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseAnesthesiaMachine() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -309,7 +309,7 @@ protected:
class PULSE_DECL PulseElectroCardioGram : public SEElectroCardioGram, public PulseSystem
{
public:
PulseElectroCardioGram(Logger* logger) : SEElectroCardioGram(logger) {}
PulseElectroCardioGram(PulseData& data) : SEElectroCardioGram(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseElectroCardioGram() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -330,7 +330,7 @@ protected:
class PULSE_DECL PulseInhaler : public SEInhaler, public PulseSystem
{
public:
PulseInhaler(Logger* logger) : SEInhaler(logger) {}
PulseInhaler(PulseData& data) : SEInhaler(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseInhaler() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......@@ -351,7 +351,7 @@ protected:
class PULSE_DECL PulseMechanicalVentilator : public SEMechanicalVentilator, public PulseSystem
{
public:
PulseMechanicalVentilator(Logger* logger) : SEMechanicalVentilator(logger) {}
PulseMechanicalVentilator(PulseData& data) : SEMechanicalVentilator(data.GetLogger()), PulseSystem(data) {}
virtual ~PulseMechanicalVentilator() = default;
virtual const SEScalar* GetScalar(const std::string & name) override
......
......@@ -23,26 +23,26 @@ public:
virtual void SetReadOnlyFluid(bool b);
// Active methods return the circuit configuration to be calculated
SEFluidCircuit& GetActiveCardiovascularCircuit();
SEFluidCircuit& GetCardiovascularCircuit();
SEFluidCircuit& GetRenalCircuit();
SEFluidCircuit& GetActiveRespiratoryCircuit();
SEFluidCircuit& GetRespiratoryCircuit();
SEFluidCircuit& GetRespiratoryAndAnesthesiaMachineCircuit();
SEFluidCircuit& GetRespiratoryAndInhalerCircuit();
SEFluidCircuit& GetRespiratoryAndNasalCannulaCircuit();
SEFluidCircuit& GetRespiratoryAndSimpleMaskCircuit();
SEFluidCircuit& GetRespiratoryAndNonRebreatherMaskCircuit();
SEFluidCircuit& GetRespiratoryAndMechanicalVentilationCircuit();
SEFluidCircuit& GetRespiratoryAndMechanicalVentilatorCircuit();
SEThermalCircuit& GetTemperatureCircuit();
SEThermalCircuit& GetExternalTemperatureCircuit();
SEThermalCircuit& GetInternalTemperatureCircuit();
SEFluidCircuit& GetAnesthesiaMachineCircuit();
SEFluidCircuit& GetMechanicalVentilatorCircuit();
virtual SEFluidCircuit& GetActiveCardiovascularCircuit();
virtual SEFluidCircuit& GetCardiovascularCircuit();
virtual SEFluidCircuit& GetRenalCircuit();
virtual SEFluidCircuit& GetActiveRespiratoryCircuit();
virtual SEFluidCircuit& GetRespiratoryCircuit();
virtual SEFluidCircuit& GetRespiratoryAndAnesthesiaMachineCircuit();
virtual SEFluidCircuit& GetRespiratoryAndInhalerCircuit();
virtual SEFluidCircuit& GetRespiratoryAndNasalCannulaCircuit();
virtual SEFluidCircuit& GetRespiratoryAndSimpleMaskCircuit();
virtual SEFluidCircuit& GetRespiratoryAndNonRebreatherMaskCircuit();
virtual SEFluidCircuit& GetRespiratoryAndMechanicalVentilationCircuit();
virtual SEFluidCircuit& GetRespiratoryAndMechanicalVentilatorCircuit();
virtual SEThermalCircuit& GetTemperatureCircuit();
virtual SEThermalCircuit& GetExternalTemperatureCircuit();
virtual SEThermalCircuit& GetInternalTemperatureCircuit();
virtual SEFluidCircuit& GetAnesthesiaMachineCircuit();
virtual SEFluidCircuit& GetMechanicalVentilatorCircuit();
protected:
......
......@@ -16,91 +16,91 @@ public:
PulseCompartments(PulseData& data);
virtual ~PulseCompartments();
void Clear();
void StateChange();
void UpdateAirwayGraph() { m_UpdateActiveAirwayGraph = true; m_UpdateActiveAerosolGraph = true; }
SELiquidCompartmentGraph& GetActiveCardiovascularGraph();
SELiquidCompartmentGraph& GetCardiovascularGraph();
SELiquidCompartmentGraph& GetRenalGraph();
SEGasCompartmentGraph& GetActiveRespiratoryGraph();
SEGasCompartmentGraph& GetRespiratoryGraph();
SEGasCompartmentGraph& GetRespiratoryAndAnesthesiaMachineGraph();
SEGasCompartmentGraph& GetRespiratoryAndInhalerGraph();
SEGasCompartmentGraph& GetRespiratoryAndNasalCannulaGraph();
SEGasCompartmentGraph& GetRespiratoryAndSimpleMaskGraph();
SEGasCompartmentGraph& GetRespiratoryAndNonRebreatherMaskGraph();
SEGasCompartmentGraph& GetRespiratoryAndMechanicalVentilationGraph();
SEGasCompartmentGraph& GetRespiratoryAndMechanicalVentilatorGraph();
SEGasCompartmentGraph& GetAnesthesiaMachineGraph();
SEGasCompartmentGraph& GetMechanicalVentilatorGraph();
SELiquidCompartmentGraph& GetActiveAerosolGraph();
SELiquidCompartmentGraph& GetAerosolGraph();
SELiquidCompartmentGraph& GetAerosolAndInhalerGraph();
SELiquidCompartmentGraph& GetAerosolAndMechanicalVentilationGraph();
SELiquidCompartmentGraph& GetAerosolAndMechanicalVentilatorGraph();
virtual void Clear();
virtual void StateChange();
virtual void UpdateAirwayGraph() { m_UpdateActiveAirwayGraph = true; m_UpdateActiveAerosolGraph = true; }
virtual SELiquidCompartmentGraph& GetActiveCardiovascularGraph();
virtual SELiquidCompartmentGraph& GetCardiovascularGraph();
virtual SELiquidCompartmentGraph& GetRenalGraph();
virtual SEGasCompartmentGraph& GetActiveRespiratoryGraph();
virtual SEGasCompartmentGraph& GetRespiratoryGraph();
virtual SEGasCompartmentGraph& GetRespiratoryAndAnesthesiaMachineGraph();
virtual SEGasCompartmentGraph& GetRespiratoryAndInhalerGraph();
virtual SEGasCompartmentGraph& GetRespiratoryAndNasalCannulaGraph();
virtual SEGasCompartmentGraph& GetRespiratoryAndSimpleMaskGraph();
virtual SEGasCompartmentGraph& GetRespiratoryAndNonRebreatherMaskGraph();
virtual SEGasCompartmentGraph& GetRespiratoryAndMechanicalVentilationGraph();
virtual SEGasCompartmentGraph& GetRespiratoryAndMechanicalVentilatorGraph();
virtual SEGasCompartmentGraph& GetAnesthesiaMachineGraph();
virtual SEGasCompartmentGraph& GetMechanicalVentilatorGraph();
virtual SELiquidCompartmentGraph& GetActiveAerosolGraph();
virtual SELiquidCompartmentGraph& GetAerosolGraph();
virtual SELiquidCompartmentGraph& GetAerosolAndInhalerGraph();
virtual SELiquidCompartmentGraph& GetAerosolAndMechanicalVentilationGraph();
virtual SELiquidCompartmentGraph& GetAerosolAndMechanicalVentilatorGraph();
// Compartment Helpers
const std::vector<SELiquidCompartment*>& GetAerosolCompartments() { return m_AerosolCompartments; }
const std::vector<SELiquidCompartment*>& GetAerosolLeafCompartments() { return m_AerosolLeafCompartments; }
std::vector<SELiquidCompartment*>const& GetAerosolCompartments() { return m_AerosolCompartments; }
std::vector<SELiquidCompartment*>const& GetAerosolLeafCompartments() { return m_AerosolLeafCompartments; }
const std::vector<SELiquidCompartment*>& GetChymeCompartments() { return m_ChymeCompartments; }
const std::vector<SELiquidCompartment*>& GetChymeLeafCompartments() { return m_ChymeLeafCompartments; }
std::vector<SELiquidCompartment*>const& GetChymeCompartments() { return m_ChymeCompartments; }
std::vector<SELiquidCompartment*>const& GetChymeLeafCompartments() { return m_ChymeLeafCompartments; }
const std::vector<SEGasCompartment*>& GetPulmonaryCompartments() { return m_PulmonaryCompartments; }
const std::vector<SEGasCompartment*>& GetPulmonaryLeafCompartments() { return m_PulmonaryLeafCompartments; }
std::vector<SEGasCompartment*>const& GetPulmonaryCompartments() { return m_PulmonaryCompartments; }
std::vector<SEGasCompartment*>const& GetPulmonaryLeafCompartments() { return m_PulmonaryLeafCompartments; }
const std::vector<SEThermalCompartment*>& GetTemperatureCompartments() { return m_TemperatureCompartments; }
const std::vector<SEThermalCompartment*>& GetTemperatureLeafCompartments() { return m_TemperatureLeafCompartments; }
std::vector<SEThermalCompartment*>const& GetTemperatureCompartments() { return m_TemperatureCompartments; }
std::vector<SEThermalCompartment*>const& GetTemperatureLeafCompartments() { return m_TemperatureLeafCompartments; }
const std::vector<SETissueCompartment*>& GetTissueCompartments() { return m_TissueCompartments; }
const std::vector<SETissueCompartment*>& GetTissueLeafCompartments() { return m_TissueLeafCompartments; }
std::vector<SETissueCompartment*>const& GetTissueCompartments() { return m_TissueCompartments; }
std::vector<SETissueCompartment*>const& GetTissueLeafCompartments() { return m_TissueLeafCompartments; }
const std::vector<SELiquidCompartment*>& GetUrineCompartments() { return m_UrineCompartments; }
const std::vector<SELiquidCompartment*>& GetUrineLeafCompartments() { return m_UrineLeafCompartments; }
std::vector<SELiquidCompartment*>const& GetUrineCompartments() { return m_UrineCompartments; }
std::vector<SELiquidCompartment*>const& GetUrineLeafCompartments() { return m_UrineLeafCompartments; }
const std::vector<SELiquidCompartment*>& GetVascularCompartments() { return m_VascularCompartments; }
const std::vector<SELiquidCompartment*>& GetVascularLeafCompartments() { return m_VascularLeafCompartments; }
std::vector<SELiquidCompartment*>const& GetVascularCompartments() { return m_VascularCompartments; }
std::vector<SELiquidCompartment*>const& GetVascularLeafCompartments() { return m_VascularLeafCompartments; }
const std::vector<SEGasCompartment*>& GetAnesthesiaMachineCompartments() { return m_AnesthesiaMachineCompartments; }
const std::vector<SEGasCompartment*>& GetAnesthesiaMachineLeafCompartments() { return m_AnesthesiaMachineLeafCompartments; }
std::vector<SEGasCompartment*>const& GetAnesthesiaMachineCompartments() { return m_AnesthesiaMachineCompartments; }
std::vector<SEGasCompartment*>const& GetAnesthesiaMachineLeafCompartments() { return m_AnesthesiaMachineLeafCompartments; }
const std::vector<SEGasCompartment*>& GetInhalerCompartments() { return m_InhalerCompartments; }
const std::vector<SEGasCompartment*>& GetInhalerLeafCompartments() { return m_InhalerLeafCompartments; }
std::vector<SEGasCompartment*>const& GetInhalerCompartments() { return m_InhalerCompartments; }
std::vector<SEGasCompartment*>const& GetInhalerLeafCompartments() { return m_InhalerLeafCompartments; }
const std::vector<SELiquidCompartment*>& GetInhalerAerosolCompartments() { return m_InhalerAerosolCompartments; }
const std::vector<SELiquidCompartment*>& GetInhalerAerosolLeafCompartments() { return m_InhalerAerosolLeafCompartments; }
std::vector<SELiquidCompartment*>const& GetInhalerAerosolCompartments() { return m_InhalerAerosolCompartments; }
std::vector<SELiquidCompartment*>const& GetInhalerAerosolLeafCompartments() { return m_InhalerAerosolLeafCompartments; }
const std::vector<SEGasCompartment*>& GetMechanicalVentilationCompartments() { return m_MechanicalVentilationCompartments; }
const std::vector<SEGasCompartment*>& GetMechanicalVentilationLeafCompartments() { return m_MechanicalVentilationLeafCompartments; }
std::vector<SEGasCompartment*>const& GetMechanicalVentilationCompartments() { return m_MechanicalVentilationCompartments; }
std::vector<SEGasCompartment*>const& GetMechanicalVentilationLeafCompartments() { return m_MechanicalVentilationLeafCompartments; }
const std::vector<SELiquidCompartment*>& GetMechanicalVentilationAerosolCompartments() { return m_MechanicalVentilationAerosolCompartments; }
const std::vector<SELiquidCompartment*>& GetMechanicalVentilationAerosolLeafCompartments() { return m_MechanicalVentilationAerosolCompartments; }
std::vector<SELiquidCompartment*>const& GetMechanicalVentilationAerosolCompartments() { return m_MechanicalVentilationAerosolCompartments; }
std::vector<SELiquidCompartment*>const& GetMechanicalVentilationAerosolLeafCompartments() { return m_MechanicalVentilationAerosolCompartments; }
const std::vector<SEGasCompartment*>& GetMechanicalVentilatorCompartments() { return m_MechanicalVentilatorCompartments; }
const std::vector<SEGasCompartment*>& GetMechanicalVentilatorLeafCompartments() { return m_MechanicalVentilatorLeafCompartments; }
std::vector<SEGasCompartment*>const& GetMechanicalVentilatorCompartments() { return m_MechanicalVentilatorCompartments; }
std::vector<SEGasCompartment*>const& GetMechanicalVentilatorLeafCompartments() { return m_MechanicalVentilatorLeafCompartments; }
const std::vector<SELiquidCompartment*>& GetMechanicalVentilatorAerosolCompartments() { return m_MechanicalVentilatorAerosolCompartments; }
const std::vector<SELiquidCompartment*>& GetMechanicalVentilatorAerosolLeafCompartments() { return m_MechanicalVentilatorAerosolCompartments; }
std::vector<SELiquidCompartment*>const& GetMechanicalVentilatorAerosolCompartments() { return m_MechanicalVentilatorAerosolCompartments; }
std::vector<SELiquidCompartment*>const& GetMechanicalVentilatorAerosolLeafCompartments() { return m_MechanicalVentilatorAerosolCompartments; }
const std::vector<SEGasCompartment*>& GetNasalCannulaCompartments() { return m_NasalCannulaCompartments; }
const std::vector<SEGasCompartment*>& GetNasalCannulaLeafCompartments() { return m_NasalCannulaLeafCompartments; }
std::vector<SEGasCompartment*>const& GetNasalCannulaCompartments() { return m_NasalCannulaCompartments; }
std::vector<SEGasCompartment*>const& GetNasalCannulaLeafCompartments() { return m_NasalCannulaLeafCompartments; }
const std::vector<SEGasCompartment*>& GetNonRebreatherMaskCompartments() { return m_NonRebreatherMaskCompartments; }
const std::vector<SEGasCompartment*>& GetNonRebreatherMaskLeafCompartments() { return m_NonRebreatherMaskLeafCompartments; }
std::vector<SEGasCompartment*>const& GetNonRebreatherMaskCompartments() { return m_NonRebreatherMaskCompartments; }
std::vector<SEGasCompartment*>const& GetNonRebreatherMaskLeafCompartments() { return m_NonRebreatherMaskLeafCompartments; }
const std::vector<SEGasCompartment*>& GetSimpleMaskCompartments() { return m_SimpleMaskCompartments; }
const std::vector<SEGasCompartment*>& GetSimpleMaskLeafCompartments() { return m_SimpleMaskLeafCompartments; }
std::vector<SEGasCompartment*>const& GetSimpleMaskCompartments() { return m_SimpleMaskCompartments; }
std::vector<SEGasCompartment*>const& GetSimpleMaskLeafCompartments() { return m_SimpleMaskLeafCompartments; }
SELiquidCompartment& GetExtracellularFluid(SETissueCompartment& t) { return *m_ExtracellularFluid[&t]; }
SELiquidCompartment& GetIntracellularFluid(SETissueCompartment& t) { return *m_IntracellularFluid[&t]; }
const std::map<SETissueCompartment*, SELiquidCompartment*>& GetExtracellularFluid() { return m_ExtracellularFluid; }
const std::map<SETissueCompartment*, SELiquidCompartment*>& GetIntracellularFluid() { return m_IntracellularFluid; }
std::map<SETissueCompartment*, SELiquidCompartment*>const& GetExtracellularFluid() { return m_ExtracellularFluid; }
std::map<SETissueCompartment*, SELiquidCompartment*>const& GetIntracellularFluid() { return m_IntracellularFluid; }
protected:
// I don't want these exposed in Pulse, you should be calling the Substance manager
......
This diff is collapsed.
......@@ -52,20 +52,21 @@ enum class EngineState { NotReady=0,
// Keep enums in sync with appropriate proto file !!
enum class eAirwayMode{ Free=0,
AnesthesiaMachine,
Inhaler,
MechanicalVentilation,// Action
MechanicalVentilator, // Equipment
NasalCannula,
NonRebreatherMask,
SimpleMask};
AnesthesiaMachine,
Inhaler,
MechanicalVentilation,// Action
MechanicalVentilator, // Equipment
NasalCannula,
NonRebreatherMask,
SimpleMask};
extern const std::string& eAirwayMode_Name(eAirwayMode m);
class PULSE_DECL PulseData : public Loggable
{
friend class PulseEngine;
protected:// Create via PulseEngine
PulseData(Logger* logger = nullptr);
public:
PulseData(Logger* logger=nullptr);
virtual ~PulseData();
virtual std::string GetDataRoot() const { return m_DataDir; }
......@@ -84,22 +85,38 @@ public:
virtual const SEPatient& GetInitialPatient() const;
virtual SEPatient& GetCurrentPatient() const;
virtual bool HasBloodChemistry() const;
virtual SEBloodChemistrySystem& GetBloodChemistry() const;
virtual bool HasCardiovascular() const;
virtual SECardiovascularSystem& GetCardiovascular() const;
virtual bool HasDrugs() const;
virtual SEDrugSystem& GetDrugs() const;
virtual bool HasEndocrine() const;
virtual SEEndocrineSystem& GetEndocrine() const;
virtual bool HasEnergy() const;
virtual SEEnergySystem&