Stride Reference Manual  - generated for commit 9643b11
ContactPoolSys.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 2017, 2018, Kuylen E, Willem L, Broeckhove J
14  */
15 
21 #include "ContactPoolSys.h"
22 
23 using namespace std;
24 using namespace stride::ContactType;
25 
26 namespace stride {
27 
28 ContactPoolSys::ContactPoolSys() : m_currentContactPoolId(), m_sys()
29 {
30  for (Id typ : IdList) {
31  m_sys[typ].emplace_back(ContactPool(0U, typ));
32  m_currentContactPoolId[typ] = 1;
33  }
34 }
35 
37 {
38  return m_sys[typeId].emplace_back(m_currentContactPoolId[typeId]++, typeId);
39 }
40 
41 } // 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...
Container for the contact pools of various type (household, work, ...).
constexpr std::initializer_list< Id > IdList
To allow iteration over the type ids.
Definition: ContactType.h:75
ContactType::IdSubscriptArray< unsigned int > m_currentContactPoolId
The contact pool counters (one per type id) for assigning pool UIDs.
STL namespace.
Namespace for the simulator and related classes.
Definition: Calendar.cpp:28
Namespace to manage types of ContactPool.
Definition: ContactType.cpp:28