Stride Reference Manual  1.0
Health.h
Go to the documentation of this file.
1 #pragma once
2 /*
3  * This is free software: you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * any later version.
7  * The software is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License
12  * along with the software. If not, see <http://www.gnu.org/licenses/>.
13  *
14  * Copyright 2017, Willem L, Kuylen E, Stijven S & Broeckhove J
15  */
16 
17 namespace stride {
18 
19 enum class HealthStatus {
20  Susceptible = 0U, Exposed = 1U, Infectious = 2U,
22 };
23 
24 
25 class Health {
26 public:
28  Health(unsigned int start_infectiousness, unsigned int start_symptomatic,
29  unsigned int time_infectious, unsigned int time_symptomatic);
30 
32  HealthStatus getHealthStatus() const { return m_status; }
33 
35  unsigned int getEndInfectiousness() const { return m_end_infectiousness; }
36 
38  unsigned int getEndSymptomatic() const { return m_end_symptomatic; }
39 
41  unsigned int getStartInfectiousness() const { return m_start_infectiousness; }
42 
44  unsigned int getStartSymptomatic() const { return m_start_symptomatic; }
45 
47  bool isImmune() const { return m_status == HealthStatus::Immune; }
48 
50  bool isInfected() const {
51  return m_status == HealthStatus::Exposed
52  || m_status == HealthStatus::Infectious
54  || m_status == HealthStatus::Symptomatic;
55  }
56 
58  bool isInfectious() const {
59  return m_status == HealthStatus::Infectious
61  }
62 
64  bool isRecovered() const { return m_status == HealthStatus::Recovered; }
65 
67  bool isSusceptible() const { return m_status == HealthStatus::Susceptible; }
68 
70  bool isSymptomatic() const {
71  return m_status == HealthStatus::Symptomatic
73  }
74 
76  void setImmune();
77 
79  void startInfection();
80 
82  void stopInfection();
83 
85  void update();
86 
87 private:
89  unsigned int getDiseaseCounter() const { return m_disease_counter; }
90 
92  void incrementDiseaseCounter() { m_disease_counter++; }
93 
95  void resetDiseaseCounter() { m_disease_counter = 0U; }
96 
97 private:
98  unsigned int m_disease_counter;
100 
101  unsigned int m_start_infectiousness;
102  unsigned int m_start_symptomatic;
103  unsigned int m_end_infectiousness;
104  unsigned int m_end_symptomatic;
105 
106 private:
107  friend class Hdf5Loader;
108 
109  friend class Hdf5Saver;
110 };
111 
112 }
unsigned int getDiseaseCounter() const
Get the disease counter.
Definition: Health.h:89
Time Dependent Person DataType.
Definition: NoBehaviour.h:17
void resetDiseaseCounter()
Reset the disease counter.
Definition: Health.h:95
unsigned int getStartInfectiousness() const
Definition: Health.h:41
void incrementDiseaseCounter()
Increment disease counter.
Definition: Health.h:92
unsigned int m_start_infectiousness
Days after infection to become infectious.
Definition: Health.h:101
bool isInfected() const
Definition: Health.h:50
HealthStatus getHealthStatus() const
Definition: Health.h:32
unsigned int m_end_infectiousness
Days after infection to end infectious state.
Definition: Health.h:103
bool isRecovered() const
Definition: Health.h:64
unsigned int getEndSymptomatic() const
Definition: Health.h:38
unsigned int getStartSymptomatic() const
Definition: Health.h:44
bool isImmune() const
Definition: Health.h:47
HealthStatus m_status
The current status of the person w.r.t. the disease.
Definition: Health.h:99
bool isInfectious() const
Definition: Health.h:58
HealthStatus
Definition: Health.h:19
unsigned int m_start_symptomatic
Days after infection to become symptomatic.
Definition: Health.h:102
unsigned int m_end_symptomatic
Days after infection to end symptomatic state.
Definition: Health.h:104
unsigned int m_disease_counter
The disease counter.
Definition: Health.h:98
bool isSusceptible() const
Is this person susceptible?
Definition: Health.h:67
bool isSymptomatic() const
Is this person symptomatic?
Definition: Health.h:70
unsigned int getEndInfectiousness() const
Definition: Health.h:35