FRED
|
00001 /* 00002 Copyright 2009 by the University of Pittsburgh 00003 Licensed under the Academic Free License version 3.0 00004 See the file "LICENSE" for more information 00005 */ 00006 00007 // 00008 // 00009 // File: Demographics.h 00010 // 00011 00012 #ifndef _FRED_DEMOGRAPHICS_H 00013 #define _FRED_DEMOGRAPHICS_H 00014 00015 class Person; 00016 class Date; 00017 00018 class Demographics { 00019 public: 00020 00021 static const int MAX_AGE = 110; 00022 static const int MAX_PREGNANCY_AGE = 60; 00023 static const double MEAN_PREG_DAYS = 280.0; //40 weeks 00024 static const double STDDEV_PREG_DAYS = 7.0; //1 week 00025 00029 Demographics(); 00030 00041 Demographics(Person* _self, int _age, char _sex, int _marital_status, int rel, 00042 int _profession, int day, bool is_newborn = false); 00043 00044 ~Demographics(); 00045 00051 void update(int day); 00052 00056 double get_real_age(int day); 00057 00061 int get_age() { return age; } 00062 00066 char get_sex() { return sex; } 00067 00071 int get_marital_status() { return marital_status; } 00072 00076 int get_profession() { return profession; } 00077 00081 bool is_pregnant() { return pregnant; } 00082 00086 bool is_deceased() { return deceased; } 00087 00091 void print(); 00092 00096 int get_init_age() { return init_age; } 00097 00101 int get_init_marital_status() { return init_marital_status; } 00102 00106 int get_init_profession() { return init_profession; } 00107 00108 void set_relationship(int rel) { relationship = rel; } 00109 int get_relationship() { return relationship; } 00110 bool is_householder() { return relationship == 1; } 00111 00112 void terminate(){} 00113 00114 private: 00115 Person *self; // Pointer to the person class belongs 00116 int init_age; // Initial age of the agent 00117 int init_marital_status; // Initial marital status 00118 int init_profession; // Initial profession (from census) 00119 Date *birthdate; // When the agent was born 00120 Date *deceased_date; // When the agent (will die) / (died) 00121 Date *conception_date; // When the agent will conceive 00122 Date *due_date; // When the agent will give birth 00123 int age; // Current age of the agent 00124 char sex; // Male or female? 00125 int marital_status; // Current marital status 00126 int profession; // Current profession (from census) 00127 bool pregnant; // Is the agent pregnant 00128 bool deceased; // Is the agent deceased 00129 int relationship; 00130 00131 static double age_yearly_mortality_rate_male[MAX_AGE + 1]; 00132 static double age_yearly_mortality_rate_female[MAX_AGE + 1]; 00133 static double age_yearly_birth_rate[MAX_PREGNANCY_AGE + 1]; 00134 static double age_daily_birth_rate[MAX_PREGNANCY_AGE + 1]; 00135 static bool is_initialized; 00136 00140 void read_init_files(); 00141 }; 00142 00143 #endif // _FRED_DEMOGRAPHICS_H