From 4874e6f845b07c83d4943bcfdf8e27e4edf702b8 Mon Sep 17 00:00:00 2001 From: Matthew Carroll <28577806+MJC598@users.noreply.github.com> Date: Wed, 12 Nov 2025 12:39:27 -0500 Subject: [PATCH] updating the setting for current_time --- include/hepce/model/person.hpp | 3 ++- src/model/internals/person_internals.hpp | 6 +++++- src/model/simulation.cpp | 6 ++++++ tests/mocks/person_mock.hpp | 3 ++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/hepce/model/person.hpp b/include/hepce/model/person.hpp index 0ad063cc..7e6597e3 100644 --- a/include/hepce/model/person.hpp +++ b/include/hepce/model/person.hpp @@ -4,7 +4,7 @@ // Created Date: 2025-04-17 // // Author: Matthew Carroll // // ----- // -// Last Modified: 2025-10-09 // +// Last Modified: 2025-11-12 // // Modified By: Matthew Carroll // // ----- // // Copyright (c) 2025 Syndemics Lab at Boston Medical Center // @@ -32,6 +32,7 @@ class Person { Die(data::DeathReason deathReason = data::DeathReason::kBackground) = 0; virtual void SetPersonDetails(const data::PersonSelect &select) = 0; + virtual void SetStartTime(const int start_time = 0) = 0; // HCV virtual data::HCVDetails GetHCVDetails() const = 0; diff --git a/src/model/internals/person_internals.hpp b/src/model/internals/person_internals.hpp index 19c12794..6414ab41 100644 --- a/src/model/internals/person_internals.hpp +++ b/src/model/internals/person_internals.hpp @@ -4,7 +4,7 @@ // Created Date: 2025-04-18 // // Author: Matthew Carroll // // ----- // -// Last Modified: 2025-10-09 // +// Last Modified: 2025-11-12 // // Modified By: Matthew Carroll // // ----- // // Copyright (c) 2025 Syndemics Lab at Boston Medical Center // @@ -45,6 +45,10 @@ class PersonImpl : public Person { void SetPersonDetails(const data::PersonSelect &select) override; + void SetStartTime(const int start_time) override { + _current_time = start_time; + } + // Section Getters inline data::HCVDetails GetHCVDetails() const override { return _hcv_details; diff --git a/src/model/simulation.cpp b/src/model/simulation.cpp index dde792f7..f6f1afea 100644 --- a/src/model/simulation.cpp +++ b/src/model/simulation.cpp @@ -109,9 +109,12 @@ HepceImpl::ReadICPopulation(const int population_size, std::vector vec = std::any_cast>(storage); std::vector> population = {}; + int start_time = + utils::GetIntFromConfig("simulation.start_time", model_data); for (const auto &ps : vec) { auto person = model::Person::Create(GetLogName()); person->SetPersonDetails(ps); + person->SetStartTime(start_time); population.push_back(std::move(person)); } return population; @@ -160,9 +163,12 @@ HepceImpl::ReadPopPopulation(const int population_size, std::vector vec = std::any_cast>(storage); std::vector> population = {}; + int start_time = + utils::GetIntFromConfig("simulation.start_time", model_data); for (const auto &ps : vec) { auto person = model::Person::Create(GetLogName()); person->SetPersonDetails(ps); + person->SetStartTime(start_time); population.push_back(std::move(person)); } return population; diff --git a/tests/mocks/person_mock.hpp b/tests/mocks/person_mock.hpp index 87c77ff8..eb1a8651 100644 --- a/tests/mocks/person_mock.hpp +++ b/tests/mocks/person_mock.hpp @@ -4,7 +4,7 @@ // Created: 2025-01-06 // // Author: Matthew Carroll // // ----- // -// Last Modified: 2025-10-09 // +// Last Modified: 2025-11-12 // // Modified By: Matthew Carroll // // ----- // // Copyright (c) 2025 Syndemics Lab at Boston Medical Center // @@ -31,6 +31,7 @@ class MockPerson : public virtual Person { MOCK_METHOD(void, Die, (data::DeathReason deathReason), (override)); MOCK_METHOD(void, SetPersonDetails, (const data::PersonSelect &select), (override)); + MOCK_METHOD(void, SetStartTime, (const int), (override)); // HCV MOCK_METHOD(data::HCVDetails, GetHCVDetails, (), (const, override));