Simpact Cyan
Population based event driven simulation using mNRM
Public Member Functions | List of all members
PopulationDistributionCSV Class Reference

This class allows you to pick random ages according to the data loaded from a CSV file. More...

#include <populationdistributioncsv.h>

Inheritance diagram for PopulationDistributionCSV:
Inheritance graph
[legend]
Collaboration diagram for PopulationDistributionCSV:
Collaboration graph
[legend]

Public Member Functions

 PopulationDistributionCSV (GslRandomNumberGenerator *pRndGen)
 Constructor of the class, which needs the random number generator to use. More...
 
bool load (const std::string &csvFile)
 Load the age distribution from the specified file. More...
 
void clear ()
 Clears the previously loaded data. More...
 
double pickAge (bool male) const
 This function generates the random age, for either a man or a woman. More...
 
- Public Member Functions inherited from PopulationDistribution
 PopulationDistribution (GslRandomNumberGenerator *pRndGen)
 Constructor of the class, in which you need to specify a random number generator which can then be used internally. More...
 
- Public Member Functions inherited from errut::ErrorBase
 ErrorBase ()
 Creates an instance without an explicit object name. More...
 
 ErrorBase (const std::string &objName)
 Creates an instance with the object name set to objName. More...
 
std::string getObjectName () const
 Returns the stored object name. More...
 
std::string getErrorString () const
 Returns the currently stored error message. More...
 

Additional Inherited Members

- Protected Member Functions inherited from PopulationDistribution
GslRandomNumberGeneratorgetRandomNumberGenerator ()
 This function can be used to obtain the random number generator specified in the constructor. More...
 
- Protected Member Functions inherited from errut::ErrorBase
void setErrorString (const std::string &str) const
 Derived classes can use this member function to store an error message. More...
 

Detailed Description

This class allows you to pick random ages according to the data loaded from a CSV file.

Constructor & Destructor Documentation

PopulationDistributionCSV::PopulationDistributionCSV ( GslRandomNumberGenerator pRndGen)

Constructor of the class, which needs the random number generator to use.

Member Function Documentation

void PopulationDistributionCSV::clear ( )

Clears the previously loaded data.

bool PopulationDistributionCSV::load ( const std::string &  csvFile)

Load the age distribution from the specified file.

The file should look something like this:

"Start of age bin", "Number of men in bin", "Number of women in bin"
..., ..., ...
double PopulationDistributionCSV::pickAge ( bool  male) const
virtual

This function generates the random age, for either a man or a woman.

Implements PopulationDistribution.


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