Stride Reference Manual  1.0
Population.cpp
Go to the documentation of this file.
1 
2 #include "Population.h"
3 
4 using namespace stride;
5 using namespace util;
6 using namespace std;
7 
8 // Population
9 // ----------
10 
11 unsigned int Population::getInfectedCount() const {
12  unsigned int total = 0;
13  for (const auto& p : *this) {
14  const auto& h = p.getHealth();
15  total += h.isInfected() || h.isRecovered();
16  }
17  return total;
18 }
19 
20 #define PopulationBeginEnd(mod, type) \
21 type Population::begin() mod { \
22  type it = type(*this, -1); \
23  it++; \
24  return it; \
25 } \
26 type Population::end() mod { \
27  return type(*this, 0, true, m_visitors.days()); \
28 }
29 
31 
33 
34 
35 // PopulationIterator
36 // ------------------
37 
38 Population::PersonType& PopulationIterator::operator*() const {
39  if (m_in_planner) return *((*m_day_iter->get())[m_index]);
40  else return m_pop.m_original[m_index];
41 }
Time Dependent Person DataType.
Definition: NoBehaviour.h:17
unsigned int getInfectedCount() const
Get the cumulative number of cases.
Definition: Population.cpp:11
Header file for the core Population class.
Container for persons in population.
Definition: Population.h:132
STL namespace.
#define PopulationBeginEnd(mod, type)
Definition: Population.cpp:20