Stride Reference Manual  - generated for commit 9643b11
InfectorMap.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 2018, Kuylen E, Willem L, Broeckhove J
14  */
15 
21 #pragma once
22 
23 #include "contact/ContactLogMode.h"
24 #include "contact/Infector.h"
25 #include "contact/InfectorExec.h"
26 
27 #include <map>
28 #include <tuple>
29 #include <utility>
30 
31 namespace stride {
32 
33 class Calendar;
34 class Population;
35 
39 class InfectorMap : public std::map<std::tuple<stride::ContactLogMode::Id, bool>, InfectorExec*>
40 {
41 public:
44  {
45  Add<true>();
46  Add<false>();
47  }
48 
49 private:
51  template <bool B>
52  void Add()
53  {
54  using namespace ContactLogMode;
55 
56  this->emplace(
57  std::make_pair(std::make_tuple(Id::Susceptibles, B), &Infector<Id::Susceptibles, B>::Exec));
58  this->emplace(
59  std::make_pair(std::make_tuple(Id::Transmissions, B), &Infector<Id::Transmissions, B>::Exec));
60  this->emplace(std::make_pair(std::make_tuple(Id::All, B), &Infector<Id::All, B>::Exec));
61  this->emplace(std::make_pair(std::make_tuple(Id::None, B), &Infector<Id::None, B>::Exec));
62  }
63 };
64 
65 } // namespace stride
Mechanism to select the appropriate Infector template to execute.
Definition: InfectorMap.h:39
Header for the InfectorExec class.
Key Data structure: container for (a) all individuals in the population (b) the ContactPoolSys wchich...
Definition: Population.h:47
Header for the Infector class.
Class that keeps track of the &#39;state&#39; of simulated world.
Definition: Calendar.h:42
Header for the ContactLogMode class.
InfectorMap()
Fully initialized.
Definition: InfectorMap.h:43
Actual contacts and transmission in contactpool (primary template).
Definition: Infector.h:69
Namespace for the simulator and related classes.
Definition: Calendar.cpp:28
void Add()
Filling up the InfectorMap.
Definition: InfectorMap.h:52