Stride Reference Manual  - generated for commit 9643b11
ContactPoolSys.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 "ContactType.h"
24 #include "IdSubscriptArray.h"
25 #include "contact/ContactPool.h"
26 #include "util/SegmentedVector.h"
27 
28 namespace stride {
29 
37 {
38 public:
41 
44 
48  template <ContactType::Id T>
50  {
51  return m_sys[T].emplace_back(m_currentContactPoolId[T]++, T);
52  }
53 
58 
62  template <ContactType::Id T>
64  {
65  return m_sys[T];
66  }
67 
68 private:
73 
74  friend class DefaultPopBuilder;
75  friend class Sim;
76 
77 private:
87 
93 };
94 
95 } // namespace stride
ContactPool * CreateContactPool()
Templated version of for use when type id is fixed.
Id
Enumerates the ContactPool types.
Definition: ContactType.h:34
A group of Persons that potentially have contacts with one another.
Definition: ContactPool.h:38
ContactType::IdSubscriptArray< util::SegmentedVector< ContactPool > > m_sys
Pool system container: array that is subscriptable with ContactType::Ids and for each Id contains a S...
Header for the core ContactPool class.
util::SegmentedVector< ContactPool > & RefPools(ContactType::Id id)
/// Access through non-const reference to ContactPools of type &#39;id&#39;.
const util::SegmentedVector< ContactPool > & CRefPools() const
Templated version of for use when the type id is fixed.
ContactType::IdSubscriptArray< unsigned int > m_currentContactPoolId
The contact pool counters (one per type id) for assigning pool UIDs.
Interface and implementation for SegmentedVector class.
const util::SegmentedVector< ContactPool > & CRefPools(ContactType::Id id) const
Access through const reference to ContactPools of type &#39;id&#39;.
Simulator can time step and reveal some of the key data.
Definition: Sim.h:46
Container that stores objects "almost contiguously" (in a chain of blocks) and guarantees that pointe...
Definition of ContactPool Id Type.
Container for the contact pools of various type (household, work, ...).
ContactPoolSys()
Empty system.
Initializes Population objects.
ContactPoolSys contains for each of the type of pools (Household, K12School, ...) a vector of with al...
Namespace for the simulator and related classes.
Definition: Calendar.cpp:28