Health-GPS
1.2.2.0
Global Health Policy Simulation model (Health-GPS)
|
Defines the virtual population data type. More...
#include <population.h>
Public Types | |
using | IteratorType = std::vector< Person >::iterator |
Population iterator. More... | |
using | ConstIteratorType = std::vector< Person >::const_iterator |
Read-only population iterator. More... | |
Public Member Functions | |
Population ()=delete | |
Population (const std::size_t size) | |
Initialises a new instance of the Population class. More... | |
std::size_t | size () const noexcept |
Gets the current size of the population. More... | |
std::size_t | initial_size () const noexcept |
Gets the initial size of the population. More... | |
std::size_t | current_active_size () const noexcept |
Gets the current active size of the population. More... | |
Person & | operator[] (std::size_t index) |
Gets a Person by index without bounds checking. More... | |
const Person & | operator[] (std::size_t index) const |
Gets a Person by index without bounds checking. More... | |
Person & | at (std::size_t index) |
Gets a Person by index with bounds checking. More... | |
const Person & | at (std::size_t index) const |
Gets a Person by index with bounds checking. More... | |
void | add (Person &&person, unsigned int time) noexcept |
Adds a Person to the virtual population. More... | |
void | add_newborn_babies (std::size_t number, core::Gender gender, unsigned int time) noexcept |
Adds newborn babies of gender to the virtual population, age = 0. More... | |
IteratorType | begin () noexcept |
Gets an iterator to the beginning of the virtual population. More... | |
IteratorType | end () noexcept |
Gets an iterator to the element following the last Person of the population. More... | |
ConstIteratorType | begin () const noexcept |
Gets an read-only iterator to the beginning of the virtual population. More... | |
ConstIteratorType | end () const noexcept |
Gets a read-only iterator to the element following the last Person of the population. More... | |
ConstIteratorType | cbegin () const noexcept |
Gets an read-only iterator to the beginning of the virtual population. More... | |
ConstIteratorType | cend () const noexcept |
Gets a read-only iterator to the element following the last Person of the population. More... | |
Defines the virtual population data type.
The virtual population size is dynamic and can change due to births, deaths and emigration. When possible, the Population class recycles the dead and migrated individuals slots with newborn babies to minimise memory allocation and clear-up the inactive population.
using hgps::Population::ConstIteratorType = std::vector<Person>::const_iterator |
Read-only population iterator.
using hgps::Population::IteratorType = std::vector<Person>::iterator |
Population iterator.
|
delete |
|
explicit |
Initialises a new instance of the Population class.
size | Initial population size |
|
noexcept |
|
noexcept |
Adds newborn babies of gender to the virtual population, age = 0.
number | The number of newborn babies to add |
gender | The gender of the newborn babies |
time | Current simulation time |
Person & hgps::Population::at | ( | std::size_t | index | ) |
const Person & hgps::Population::at | ( | std::size_t | index | ) | const |
|
inlinenoexcept |
Gets an read-only iterator to the beginning of the virtual population.
|
inlinenoexcept |
Gets an iterator to the beginning of the virtual population.
|
inlinenoexcept |
Gets an read-only iterator to the beginning of the virtual population.
|
inlinenoexcept |
|
noexcept |
Gets the current active size of the population.
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
Gets the initial size of the population.
Person & hgps::Population::operator[] | ( | std::size_t | index | ) |
const Person & hgps::Population::operator[] | ( | std::size_t | index | ) | const |
|
noexcept |
Gets the current size of the population.