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

A group of Persons that potentially have contacts with one another. More...

#include <ContactPool.h>

Collaboration diagram for stride::ContactPool:
Collaboration graph

Public Types

using iterator = std::vector< stride::Person * >::iterator
 

Public Member Functions

 ContactPool (unsigned int poolId, ContactType::Id type)
 Initializing constructor. More...
 
 ~ContactPool ()=default
 Default will do. More...
 
void AddMember (Person *p)
 Add the given Person. More...
 
unsigned int GetId () const
 Get the pool id. More...
 
unsigned int GetInfectedCount () const
 Get Infected count. More...
 
const std::vector< Person * > & GetPool () const
 Get the entire pool of members. More...
 
ContactType::Id GetType () const
 Get the type of ContactPool, used for logging and tests. More...
 
iterator begin ()
 Iterator to first person. More...
 
iterator end ()
 Iterator to end of persons. More...
 
size_t size () const
 Gets current size of Location storage. More...
 
Person *const & operator[] (size_t index) const
 Gets a Person by index, doesn't performs a range check. More...
 

Private Member Functions

std::tuple< bool, unsigned int > SortMembers ()
 Sort w.r.t. health status: order: exposed/infected/recovered, susceptible, immune. More...
 

Private Attributes

unsigned int m_index_immune
 Index of the first immune member in the ContactPool. More...
 
unsigned int m_pool_id
 The ID of the ContactPool (for logging purposes). More...
 
ContactType::Id m_pool_type
 The type of the ContactPool (for logging and testing purposes). More...
 
std::vector< Person * > m_members
 Pointers to contactpool members (raw pointers intentional). More...
 

Friends

template<ContactLogMode::Id LL, bool TIC, bool TO>
class Infector
 Calculates contacts and transmissions; accesses private methods and data. More...
 

Detailed Description

A group of Persons that potentially have contacts with one another.

We do not expose the vector that stores pool members because adding & sorting it takes some care.

Definition at line 38 of file ContactPool.h.

Member Typedef Documentation

Definition at line 64 of file ContactPool.h.

Constructor & Destructor Documentation

stride::ContactPool::ContactPool ( unsigned int  poolId,
ContactType::Id  type 
)

Initializing constructor.

Definition at line 32 of file ContactPool.cpp.

stride::ContactPool::~ContactPool ( )
default

Default will do.

Member Function Documentation

void stride::ContactPool::AddMember ( Person p)

Add the given Person.

Definition at line 37 of file ContactPool.cpp.

References m_index_immune, and m_members.

unsigned int stride::ContactPool::GetId ( ) const
inline

Get the pool id.

Definition at line 51 of file ContactPool.h.

References GetInfectedCount(), and m_pool_id.

Referenced by geopop::GeoGridJSONWriter::WriteContactPool(), and geopop::GeoGridProtoWriter::WriteContactPool().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int stride::ContactPool::GetInfectedCount ( ) const

Get Infected count.

Definition at line 43 of file ContactPool.cpp.

References m_members.

Referenced by GetId().

Here is the caller graph for this function:

const std::vector<Person*>& stride::ContactPool::GetPool ( ) const
inline

Get the entire pool of members.

Definition at line 57 of file ContactPool.h.

References m_members.

Referenced by stride::Immunizer::Cocoon().

Here is the caller graph for this function:

ContactType::Id stride::ContactPool::GetType ( ) const
inline

Get the type of ContactPool, used for logging and tests.

Definition at line 60 of file ContactPool.h.

References m_pool_type.

iterator stride::ContactPool::begin ( )
inline

Iterator to first person.

Definition at line 67 of file ContactPool.h.

References m_members.

iterator stride::ContactPool::end ( )
inline

Iterator to end of persons.

Definition at line 70 of file ContactPool.h.

References m_members.

size_t stride::ContactPool::size ( ) const
inline

Gets current size of Location storage.

Definition at line 73 of file ContactPool.h.

References m_members.

Person* const& stride::ContactPool::operator[] ( size_t  index) const
inline

Gets a Person by index, doesn't performs a range check.

Definition at line 76 of file ContactPool.h.

References m_members, and SortMembers().

Here is the call graph for this function:

std::tuple< bool, unsigned int > stride::ContactPool::SortMembers ( )
private

Sort w.r.t. health status: order: exposed/infected/recovered, susceptible, immune.

Definition at line 55 of file ContactPool.cpp.

References m_index_immune, and m_members.

Referenced by stride::Infector< LL, TIC, true >::Exec(), and operator[]().

Here is the caller graph for this function:

Friends And Related Function Documentation

template<ContactLogMode::Id LL, bool TIC, bool TO>
friend class Infector
friend

Calculates contacts and transmissions; accesses private methods and data.

Definition at line 84 of file ContactPool.h.

Member Data Documentation

unsigned int stride::ContactPool::m_index_immune
private

Index of the first immune member in the ContactPool.

Definition at line 87 of file ContactPool.h.

Referenced by AddMember(), stride::Infector< LL, TIC, true >::Exec(), and SortMembers().

unsigned int stride::ContactPool::m_pool_id
private

The ID of the ContactPool (for logging purposes).

Definition at line 88 of file ContactPool.h.

Referenced by GetId().

ContactType::Id stride::ContactPool::m_pool_type
private

The type of the ContactPool (for logging and testing purposes).

Definition at line 89 of file ContactPool.h.

Referenced by stride::Infector< LL, TIC, TO >::Exec(), stride::Infector< LL, TIC, true >::Exec(), and GetType().

std::vector<Person*> stride::ContactPool::m_members
private

Pointers to contactpool members (raw pointers intentional).

Definition at line 90 of file ContactPool.h.

Referenced by AddMember(), begin(), end(), stride::Infector< LL, TIC, TO >::Exec(), stride::Infector< LL, TIC, true >::Exec(), GetInfectedCount(), GetPool(), operator[](), size(), and SortMembers().


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