Skip to content

Commit 90ea599

Browse files
committed
Added PhysiolgyEngine& to non public processAction calls to allow Actions and Conditions to record initnalization conditions from patientdata
(cherry picked from commit 757df66)
1 parent 0af74de commit 90ea599

15 files changed

+58
-43
lines changed

projects/biogears/libBiogears/include/biogears/cdm/engine/PhysiologyEngine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class BIOGEARS_API PhysiologyEngine {
158158
//! \brief
159159
//! returns the current time of the simulation.
160160
//!-------------------------------------------------------------------------------------------------
161-
virtual double GetSimulationTime(const TimeUnit& unit) = 0;
161+
virtual double GetSimulationTime(const TimeUnit& unit) const = 0;
162162

163163
//!-------------------------------------------------------------------------------------------------
164164
//! \brief

projects/biogears/libBiogears/include/biogears/cdm/scenario/SEActionManager.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ specific language governing permissions and limitations under the License.
1919
namespace biogears {
2020
class SESubstanceManager;
2121
class SEAction;
22+
class PhysiologyEngine;
2223

2324
class BIOGEARS_API SEActionManager : public Loggable {
2425
public:
@@ -29,8 +30,8 @@ class BIOGEARS_API SEActionManager : public Loggable {
2930

3031
void Unload(std::vector<CDM::ActionData*>& to);
3132

32-
bool ProcessAction(const SEAction& action);
33-
bool ProcessAction(const CDM::ActionData& in);
33+
bool ProcessAction(const SEAction& action, const PhysiologyEngine& engine);
34+
bool ProcessAction(const CDM::ActionData& in, const PhysiologyEngine& engine);
3435

3536
SEEnvironmentActionCollection& GetEnvironmentActions() { return m_EnvironmentActions; }
3637
SEPatientActionCollection& GetPatientActions() { return m_PatientActions; }

projects/biogears/libBiogears/include/biogears/cdm/scenario/SEAnesthesiaMachineActionCollection.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ specific language governing permissions and limitations under the License.
2929
#include <biogears/cdm/system/equipment/Anesthesia/actions/SEYPieceDisconnect.h>
3030

3131
namespace biogears {
32+
class PhysiologyEngine;
33+
3234
class BIOGEARS_API SEAnesthesiaMachineActionCollection : public Loggable {
3335
public:
3436
SEAnesthesiaMachineActionCollection(SESubstanceManager&);
@@ -38,8 +40,8 @@ class BIOGEARS_API SEAnesthesiaMachineActionCollection : public Loggable {
3840

3941
void Unload(std::vector<CDM::ActionData*>& to);
4042

41-
bool ProcessAction(const SEAnesthesiaMachineAction& action);
42-
bool ProcessAction(const CDM::AnesthesiaMachineActionData& action);
43+
bool ProcessAction(const SEAnesthesiaMachineAction& action, const PhysiologyEngine& engine);
44+
bool ProcessAction(const CDM::AnesthesiaMachineActionData& action, const PhysiologyEngine& engine);
4345

4446
// STATE ACTION
4547
bool HasConfiguration() const;

projects/biogears/libBiogears/include/biogears/cdm/scenario/SEConditionManager.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ specific language governing permissions and limitations under the License.
3232
CDM_BIND_DECL(ConditionData);
3333

3434
namespace biogears {
35+
class PhysiologyEngine;
3536

3637
class BIOGEARS_API SEConditionManager : public Loggable {
3738
public:
@@ -42,8 +43,8 @@ class BIOGEARS_API SEConditionManager : public Loggable {
4243

4344
void Unload(std::vector<CDM::ConditionData*>& to);
4445

45-
bool ProcessCondition(const SECondition& condition);
46-
bool ProcessCondition(const CDM::ConditionData& condition);
46+
bool ProcessCondition(const SECondition& condition, const PhysiologyEngine& engine);
47+
bool ProcessCondition(const CDM::ConditionData& condition, const PhysiologyEngine& engine);
4748

4849
// Not too many conditions, so just have one manager
4950
// If we start getting alot, I will make patient/environment/equipment condition managers, like the action managers

projects/biogears/libBiogears/include/biogears/cdm/scenario/SEEnvironmentActionCollection.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ specific language governing permissions and limitations under the License.
1717
#include <biogears/schema/cdm/EnvironmentActions.hxx>
1818

1919
namespace biogears {
20+
class PhysiologyEngine;
21+
2022
class BIOGEARS_API SEEnvironmentActionCollection : public Loggable {
2123
public:
2224
SEEnvironmentActionCollection(SESubstanceManager&);
@@ -26,8 +28,8 @@ class BIOGEARS_API SEEnvironmentActionCollection : public Loggable {
2628

2729
void Unload(std::vector<CDM::ActionData*>& to);
2830

29-
bool ProcessAction(const SEEnvironmentAction& action);
30-
bool ProcessAction(const CDM::EnvironmentActionData& action);
31+
bool ProcessAction(const SEEnvironmentAction& action, const PhysiologyEngine& engine);
32+
bool ProcessAction(const CDM::EnvironmentActionData& action, const PhysiologyEngine& engine);
3133

3234
// STATE ACTION
3335
bool HasChange() const;

projects/biogears/libBiogears/include/biogears/cdm/scenario/SEInhalerActionCollection.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ specific language governing permissions and limitations under the License.
1717
#include <biogears/cdm/system/equipment/Inhaler/actions/SEInhalerConfiguration.h>
1818

1919
namespace biogears {
20+
class PhysiologyEngine;
21+
2022
class BIOGEARS_API SEInhalerActionCollection : public Loggable {
2123
public:
2224
SEInhalerActionCollection(SESubstanceManager&);
@@ -26,8 +28,8 @@ class BIOGEARS_API SEInhalerActionCollection : public Loggable {
2628

2729
void Unload(std::vector<CDM::ActionData*>& to);
2830

29-
bool ProcessAction(const SEInhalerAction& action);
30-
bool ProcessAction(const CDM::InhalerActionData& action);
31+
bool ProcessAction(const SEInhalerAction& action, const PhysiologyEngine& engine);
32+
bool ProcessAction(const CDM::InhalerActionData& action, const PhysiologyEngine& engine);
3133

3234
// STATE ACTION
3335
bool HasConfiguration() const;

projects/biogears/libBiogears/include/biogears/cdm/scenario/SEPatientActionCollection.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ class BIOGEARS_API SEPatientActionCollection : public Loggable {
207207

208208
void Unload(std::vector<CDM::ActionData*>& to);
209209

210-
bool ProcessAction(const SEPatientAction& action);
211-
bool ProcessAction(const CDM::PatientActionData& action);
210+
bool ProcessAction(const SEPatientAction& action, const PhysiologyEngine& engine);
211+
bool ProcessAction(const CDM::PatientActionData& action, const PhysiologyEngine& engine);
212212

213213
bool HasAcuteRespiratoryDistress() const;
214214
SEAcuteRespiratoryDistress* GetAcuteRespiratoryDistress() const;
@@ -434,6 +434,8 @@ class BIOGEARS_API SEPatientActionCollection : public Loggable {
434434
SEUrinate* m_Urinate;
435435
SEOverride* m_OverrideAction;
436436

437+
double m_BurnIntroductionTimeStamp;
438+
437439
std::map<std::string, SEHemorrhage*> m_Hemorrhages;
438440
mutable std::map<std::string, SEHemorrhage*>::const_iterator m_HemorrhageItr;
439441

projects/biogears/libBiogears/include/biogears/engine/Controller/BioGearsEngine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class BIOGEARS_API BioGearsEngine : public PhysiologyEngine, public BioGears {
6969
virtual const PhysiologyEngineConfiguration* GetConfiguration() override;
7070

7171
virtual double GetTimeStep(const TimeUnit& unit) override;
72-
virtual double GetSimulationTime(const TimeUnit& unit) override;
72+
virtual double GetSimulationTime(const TimeUnit& unit) const override;
7373

7474
//!-------------------------------------------------------------------------------------------------
7575
//! \brief

projects/biogears/libBiogears/src/cdm/scenario/SEActionManager.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ specific language governing permissions and limitations under the License.
1111
**************************************************************************************/
1212

1313
#include <biogears/cdm/scenario/SEActionManager.h>
14+
#include <biogears/cdm/engine/PhysiologyEngine.h>
1415

1516
namespace biogears {
1617
SEActionManager::SEActionManager(SESubstanceManager& substances)
@@ -37,20 +38,20 @@ void SEActionManager::Clear()
3738
m_ProcessedActions.clear();
3839
}
3940
//-------------------------------------------------------------------------------
40-
bool SEActionManager::ProcessAction(const CDM::ActionData& in)
41+
bool SEActionManager::ProcessAction(const CDM::ActionData& in, const PhysiologyEngine& engine)
4142
{
4243
const CDM::PatientActionData* pAction = dynamic_cast<const CDM::PatientActionData*>(&in);
4344
if (pAction != nullptr)
44-
return m_PatientActions.ProcessAction(*pAction);
45+
return m_PatientActions.ProcessAction(*pAction, engine);
4546
const CDM::EnvironmentActionData* eAction = dynamic_cast<const CDM::EnvironmentActionData*>(&in);
4647
if (eAction != nullptr)
47-
return m_EnvironmentActions.ProcessAction(*eAction);
48+
return m_EnvironmentActions.ProcessAction(*eAction, engine);
4849
const CDM::AnesthesiaMachineActionData* aAction = dynamic_cast<const CDM::AnesthesiaMachineActionData*>(&in);
4950
if (aAction != nullptr)
50-
return m_AnesthesiaMachineActions.ProcessAction(*aAction);
51+
return m_AnesthesiaMachineActions.ProcessAction(*aAction, engine);
5152
const CDM::InhalerActionData* iAction = dynamic_cast<const CDM::InhalerActionData*>(&in);
5253
if (iAction != nullptr)
53-
return m_InhalerActions.ProcessAction(*iAction);
54+
return m_InhalerActions.ProcessAction(*iAction, engine);
5455
Error("Unknown Action Type");
5556
return false;
5657
}
@@ -63,24 +64,24 @@ void SEActionManager::Unload(std::vector<CDM::ActionData*>& to)
6364
m_InhalerActions.Unload(to);
6465
}
6566
//-------------------------------------------------------------------------------
66-
bool SEActionManager::ProcessAction(const SEAction& action)
67+
bool SEActionManager::ProcessAction(const SEAction& action, const PhysiologyEngine& engine)
6768
{
6869
// Store the action data. This is intended to be able to
6970
// Serialize out all the actions that the engine was asked to perform
7071
CDM::ActionData* aData = action.Unload();
7172
m_ProcessedActions.push_back(action.Unload());
7273

7374
if (dynamic_cast<const SEPatientAction*>(&action) != nullptr)
74-
return m_PatientActions.ProcessAction(dynamic_cast<const CDM::PatientActionData&>(*aData));
75+
return m_PatientActions.ProcessAction(dynamic_cast<const CDM::PatientActionData&>(*aData, engine));
7576

7677
if (dynamic_cast<const SEAnesthesiaMachineAction*>(&action) != nullptr)
77-
return m_AnesthesiaMachineActions.ProcessAction(dynamic_cast<const CDM::AnesthesiaMachineActionData&>(*aData));
78+
return m_AnesthesiaMachineActions.ProcessAction(dynamic_cast<const CDM::AnesthesiaMachineActionData&>(*aData, engine));
7879

7980
if (dynamic_cast<const SEEnvironmentAction*>(&action) != nullptr)
80-
return m_EnvironmentActions.ProcessAction(dynamic_cast<const CDM::EnvironmentActionData&>(*aData));
81+
return m_EnvironmentActions.ProcessAction(dynamic_cast<const CDM::EnvironmentActionData&>(*aData, engine));
8182

8283
if (dynamic_cast<const SEInhalerAction*>(&action) != nullptr)
83-
return m_InhalerActions.ProcessAction(dynamic_cast<const CDM::InhalerActionData&>(*aData));
84+
return m_InhalerActions.ProcessAction(dynamic_cast<const CDM::InhalerActionData&>(*aData, engine));
8485

8586
/// \error Unsupported Action
8687
Error("Unsupported Action");

projects/biogears/libBiogears/src/cdm/scenario/SEAnesthesiaMachineActionCollection.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ void SEAnesthesiaMachineActionCollection::Unload(std::vector<CDM::ActionData*>&
9797
to.push_back(GetYPieceDisconnect()->Unload());
9898
}
9999
//-------------------------------------------------------------------------------
100-
bool SEAnesthesiaMachineActionCollection::ProcessAction(const SEAnesthesiaMachineAction& action)
100+
bool SEAnesthesiaMachineActionCollection::ProcessAction(const SEAnesthesiaMachineAction& action, const PhysiologyEngine& engine)
101101
{
102102
if (!IsValid(action))
103103
return false;
104104
CDM::AnesthesiaMachineActionData* bind = action.Unload();
105-
bool b = ProcessAction(*bind);
105+
bool b = ProcessAction(*bind, engine);
106106
delete bind;
107107
return b;
108108
}
109109
//-------------------------------------------------------------------------------
110-
bool SEAnesthesiaMachineActionCollection::ProcessAction(const CDM::AnesthesiaMachineActionData& action)
110+
bool SEAnesthesiaMachineActionCollection::ProcessAction(const CDM::AnesthesiaMachineActionData& action, const PhysiologyEngine& engine)
111111
{
112112
const CDM::AnesthesiaMachineConfigurationData* config = dynamic_cast<const CDM::AnesthesiaMachineConfigurationData*>(&action);
113113
if (config != nullptr) {

0 commit comments

Comments
 (0)