Stride Reference Manual  - generated for commit 9643b11
Person.h
Go to the documentation of this file.
1 /*
2  * This is free software: you can redistribute it and/or modify it
3  * under the terms of the GNU General Public License as published by
4  * the Free Software Foundation, either version 3 of the License, or
5  * any later version.
6  * The software is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  * You should have received a copy of the GNU General Public License
11  * along with the software. If not, see <http://www.gnu.org/licenses/>.
12  *
13  * Copyright 2017, Kuylen E, Willem L, Broeckhove J
14  */
15 
21 #pragma once
22 
23 #include "contact/ContactType.h"
25 #include "disease/Health.h"
26 
27 #include <cstddef>
28 
29 namespace stride {
30 
34 class Person
35 {
36 public:
39 
41  Person(unsigned int id, float age, unsigned int householdId, unsigned int k12SchoolId, unsigned int collegeId,
42  unsigned int workId, unsigned int primaryCommunityId, unsigned int secondaryCommunityId)
43  : m_age(age), m_id(id), m_pool_ids{householdId, k12SchoolId, collegeId,
44  workId, primaryCommunityId, secondaryCommunityId},
45  m_health(), m_in_pools(true), m_is_participant(false)
46  {
47  }
48 
50  bool operator!=(const Person& p) const { return p.m_id != m_id; }
51 
53  float GetAge() const { return m_age; }
54 
56  Health& GetHealth() { return m_health; }
57 
59  const Health& GetHealth() const { return m_health; }
60 
62  unsigned int GetId() const { return m_id; }
63 
65  unsigned int GetPoolId(const ContactType::Id& poolType) const { return m_pool_ids[poolType]; }
66 
68  bool IsInPool(const ContactType::Id& poolType) const { return m_in_pools[poolType]; }
69 
71  bool IsSurveyParticipant() const { return m_is_participant; }
72 
75 
77  void Update(bool isWorkOff, bool isSchoolOff, bool adaptiveSymptomaticBehavior);
78 
80  void SetAge(unsigned int newAge) { m_age = newAge; }
81 
83  void SetId(unsigned int id) { m_id = id; }
84 
86  void SetPoolId(ContactType::Id type, unsigned int poolId)
87  {
88  m_pool_ids[type] = poolId;
89  m_in_pools[type] = (poolId != 0); // Means present in Household, absent elsewhere.
90  }
91 
92 private:
93  float m_age;
94  unsigned int m_id;
95 
99 
102 
105 
108 };
109 
110 } // namespace stride
Health & GetHealth()
Return person&#39;s health status.
Definition: Person.h:56
Id
Enumerates the ContactPool types.
Definition: ContactType.h:34
bool IsSurveyParticipant() const
Does this person participates in the social contact study?
Definition: Person.h:71
Health m_health
Is person present/absent in pools of each of the types (school, work, etc)?
Definition: Person.h:101
Specialisation of IdSubscriptArray foor booleans.
Person(unsigned int id, float age, unsigned int householdId, unsigned int k12SchoolId, unsigned int collegeId, unsigned int workId, unsigned int primaryCommunityId, unsigned int secondaryCommunityId)
Constructor: set the person data.
Definition: Person.h:41
unsigned int GetPoolId(const ContactType::Id &poolType) const
Get ID of contactpool_type.
Definition: Person.h:65
void SetId(unsigned int id)
Set the id.
Definition: Person.h:83
unsigned int m_id
The id.
Definition: Person.h:94
unsigned int GetId() const
Get the id.
Definition: Person.h:62
void SetPoolId(ContactType::Id type, unsigned int poolId)
Sets (for the type of ContactPool) the Id of the ContactPool the person belongs to.
Definition: Person.h:86
Holds a person&#39;s health data.
Definition: Health.h:38
ContactType::IdSubscriptArray< unsigned int > m_pool_ids
Health info (immune, infected, etc) for this person.
Definition: Person.h:98
bool m_is_participant
Definition: Person.h:107
float GetAge() const
Get the age.
Definition: Person.h:53
Header for the Health class.
Definition of ContactPool Id Type.
Container for the contact pools of various type (household, work, ...).
const Health & GetHealth() const
Return person&#39;s health status.
Definition: Person.h:59
bool IsInPool(const ContactType::Id &poolType) const
Check if a person is present today in a given contact pool.
Definition: Person.h:68
void SetAge(unsigned int newAge)
Set the age of the person.
Definition: Person.h:80
Person()
Default construction (for population vector).
Definition: Person.h:38
float m_age
The age..
Definition: Person.h:93
Store and handle person data.
Definition: Person.h:34
Namespace for the simulator and related classes.
Definition: Calendar.cpp:28
void Update(bool isWorkOff, bool isSchoolOff, bool adaptiveSymptomaticBehavior)
Update the health status and presence in contact pools.
Definition: Person.cpp:31
ContactType::IdSubscriptArray< bool > m_in_pools
Is this a participant in the social contact study?
Definition: Person.h:104
bool operator!=(const Person &p) const
Is this person not equal to the given person?
Definition: Person.h:50
void ParticipateInSurvey()
Participate in social contact study and log person details.
Definition: Person.h:74