Stride Reference Manual  - generated for commit 9643b11
InfectedFileViewer.cpp
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 2018, Kuylen E, Willem L, Broeckhove J
14  */
15 
21 #include "InfectedFileViewer.h"
22 
23 #include "pop/Population.h"
24 #include "sim/Sim.h"
25 #include "sim/SimRunner.h"
26 
27 using namespace std;
28 using namespace stride::sim_event;
29 
30 namespace stride {
31 namespace viewers {
32 
33 void InfectedFileViewer::Update(const sim_event::Id id)
34 {
35  switch (id) {
36  case Id::AtStart:
37  case Id::Stepped: {
38  const auto pop = m_runner->GetSim()->GetPopulation();
39  m_infected.push_back(pop->GetInfectedCount());
40  break;
41  }
42  case Id::Finished: {
43  m_infected_file.Print(m_infected);
44  break;
45  }
46  default: break;
47  }
48 }
49 
50 } // namespace viewers
51 } // namespace stride
Namespace to manage events signalled by the SimRunner.
Definition: Id.cpp:27
Id
Enumerates the event.
Definition: Id.h:30
STL namespace.
Observer for Infected output.
Header file for the core Population class.
Header for the Simulator class.
Namespace for the simulator and related classes.
Definition: Calendar.cpp:28
Header for the SimRunner class.