Stride Reference Manual  - generated for commit 9643b11
stride::ContactPoolSys Class Reference

ContactPoolSys contains for each of the type of pools (Household, K12School, ...) a vector of with all of the contact pools of the type. More...

#include <ContactPoolSys.h>

Collaboration diagram for stride::ContactPoolSys:
Collaboration graph

Public Member Functions

 ContactPoolSys ()
 Empty system. More...
 
ContactPoolCreateContactPool (ContactType::Id typeId)
 Create a new contact pool of a given type. More...
 
template<ContactType::Id T>
ContactPoolCreateContactPool ()
 Templated version of for use when type id is fixed. More...
 
const util::SegmentedVector< ContactPool > & CRefPools (ContactType::Id id) const
 Access through const reference to ContactPools of type 'id'. More...
 
template<ContactType::Id T>
const util::SegmentedVector< ContactPool > & CRefPools () const
 Templated version of for use when the type id is fixed. More...
 

Private Member Functions

util::SegmentedVector< ContactPool > & RefPools (ContactType::Id id)
 /// Access through non-const reference to ContactPools of type 'id'. More...
 

Private Attributes

ContactType::IdSubscriptArray< unsigned int > m_currentContactPoolId
 The contact pool counters (one per type id) for assigning pool UIDs. More...
 
ContactType::IdSubscriptArray< util::SegmentedVector< ContactPool > > m_sys
 Pool system container: array that is subscriptable with ContactType::Ids and for each Id contains a SegmentedVector with the ContactPools for that ContactType::Id. More...
 

Friends

class DefaultPopBuilder
 
class Sim
 

Detailed Description

ContactPoolSys contains for each of the type of pools (Household, K12School, ...) a vector of with all of the contact pools of the type.

The ContactPoolSys container is an std::array extended to be subscriptable with the enum class of the pool type Ids.

Definition at line 36 of file ContactPoolSys.h.

Constructor & Destructor Documentation

stride::ContactPoolSys::ContactPoolSys ( )

Empty system.

Definition at line 28 of file ContactPoolSys.cpp.

References stride::ContactType::IdList, m_currentContactPoolId, and m_sys.

Member Function Documentation

ContactPool * stride::ContactPoolSys::CreateContactPool ( ContactType::Id  typeId)

Create a new contact pool of a given type.

Definition at line 36 of file ContactPoolSys.cpp.

References m_currentContactPoolId, and m_sys.

Referenced by geopop::Generator< ID >::AddPools(), geopop::GeoGridJSONReader::ParseContactPool(), and geopop::GeoGridProtoReader::ParseContactPool().

Here is the caller graph for this function:

template<ContactType::Id T>
ContactPool* stride::ContactPoolSys::CreateContactPool ( )
inline

Templated version of for use when type id is fixed.

Template Parameters
TOne of the ContactType::Id's (Household, K12 School, ...).
Returns
Pointer to the newly created ContactPool.

Definition at line 49 of file ContactPoolSys.h.

References m_currentContactPoolId, and m_sys.

const util::SegmentedVector<ContactPool>& stride::ContactPoolSys::CRefPools ( ContactType::Id  id) const
inline

Access through const reference to ContactPools of type 'id'.

Parameters
idContactType::Id of pools container you want to access.
Returns
The requested reference.

Definition at line 57 of file ContactPoolSys.h.

References m_sys.

template<ContactType::Id T>
const util::SegmentedVector<ContactPool>& stride::ContactPoolSys::CRefPools ( ) const
inline

Templated version of for use when the type id is fixed.

Template Parameters
TContactType::Id of pools container you want to access.
Returns
The requested reference.

Definition at line 63 of file ContactPoolSys.h.

References m_sys.

util::SegmentedVector<ContactPool>& stride::ContactPoolSys::RefPools ( ContactType::Id  id)
inlineprivate

/// Access through non-const reference to ContactPools of type 'id'.

Parameters
idContactType::Id of pools container you want to access.
Returns
The requested reference.

Definition at line 72 of file ContactPoolSys.h.

References m_sys.

Friends And Related Function Documentation

friend class DefaultPopBuilder
friend

Definition at line 74 of file ContactPoolSys.h.

friend class Sim
friend

Definition at line 75 of file ContactPoolSys.h.

Member Data Documentation

ContactType::IdSubscriptArray<unsigned int> stride::ContactPoolSys::m_currentContactPoolId
private

The contact pool counters (one per type id) for assigning pool UIDs.

Counters generate a non zero UID that's unique per type of pool, so <type, UID> uniquely detemines the pool. UID zero means 'NA" e.g. wor[lace UID for a K12school student will be zero. As a defensive measure, the ContactPoolSys gets initialized with (for each type) an empty pool in the vecotor storing the contact pools. As a consequence, one has: if UID != 0 then ContactPoolSys[type][UID].GetId() == UID for all type the index in the vector with pools is identical to the pool's UID.

Definition at line 86 of file ContactPoolSys.h.

Referenced by ContactPoolSys(), and CreateContactPool().

ContactType::IdSubscriptArray<util::SegmentedVector<ContactPool> > stride::ContactPoolSys::m_sys
private

Pool system container: array that is subscriptable with ContactType::Ids and for each Id contains a SegmentedVector with the ContactPools for that ContactType::Id.

We use the SegmentedVector not to run in re-allocations and to be able to use pointers into the SegmentedVector.

Definition at line 92 of file ContactPoolSys.h.

Referenced by ContactPoolSys(), CreateContactPool(), CRefPools(), and RefPools().


The documentation for this class was generated from the following files: