FRED
Health.h
00001 // -*- C++ -*-
00002 /*
00003   Copyright 2009 by the University of Pittsburgh
00004   Licensed under the Academic Free License version 3.0
00005   See the file "LICENSE" for more information
00006 */
00007 
00008 //
00009 //
00010 // File: Health.h
00011 //
00012 
00013 #ifndef _FRED_HEALTH_H
00014 #define _FRED_HEALTH_H
00015 
00016 #include <vector>
00017 using namespace std;
00018 
00019 #include "Infection.h"
00020 #include "Disease.h"
00021 
00022 class Person;
00023 class Infection;
00024 class Disease;
00025 class Antiviral;
00026 class Antivirals;
00027 class AV_Manager;
00028 class AV_Health;
00029 class Vaccine;
00030 class Vaccine_Health;
00031 class Vaccine_Manager;
00032 
00033 class Health {
00034 public:
00035 
00041   Health(Person * person);
00042 
00043   ~Health();
00044 
00050   void update(int day);
00051 
00057   void become_susceptible(int disease_id);
00058   void become_susceptible(Disease * disease);
00059 
00065   void become_unsusceptible(Disease * disease);
00066 
00072   void become_infectious(Disease * disease);
00073 
00079   void become_symptomatic(Disease *disease);
00080 
00086   void become_immune(Disease* disease);
00087 
00093   void become_removed(int disease_id);
00094 
00100   void declare_at_risk(Disease* disease);
00101 
00107   void recover(Disease * disease);
00108 
00115   bool is_susceptible (int disease_id) const {return susceptible[disease_id];}
00116 
00123   bool is_infectious(int disease_id) const { return (infectious[disease_id]); }
00124 
00130   bool is_symptomatic() const { return has_symptoms; }
00131   bool is_symptomatic(int disease_id) { return symptomatic[disease_id]; }
00132 
00139   bool is_immune(Disease* disease) const {
00140     return immunity[disease->get_id()];
00141   }
00142 
00149   bool is_at_risk(Disease* disease) const {
00150     return at_risk[disease->get_id()];
00151   }
00152 
00159   bool is_at_risk(int disease_id) const {
00160     return at_risk[disease_id];
00161   }
00162 
00168   Person* get_self() const {
00169     return self;
00170   }
00171 
00176   int get_exposure_date(int disease_id) const;
00177 
00182   int get_infectious_date(int disease_id) const;
00183 
00188   int get_recovered_date(int disease_id) const;
00189 
00194   int get_symptomatic_date(int disease_id) const;
00195 
00200   int get_infector(int disease_id) const;
00201 
00206   int get_infected_place(int disease_id) const;
00207 
00212   char * get_infected_place_label(int disease_id) const;
00213 
00218   char get_infected_place_type(int disease_id) const;
00219 
00224   int get_infectees(int disease_id) const;
00225 
00230   double get_susceptibility(int disease_id) const;
00231 
00237   double get_infectivity(int disease_id, int day) const;
00238 
00243   Infection* get_infection(int disease_id) const {
00244     return infection[disease_id];
00245   }
00246 
00254   bool is_on_av_for_disease(int day, int disease_id) const;
00255 
00263   void infect(Person *infectee, int disease_id, Transmission *transmission);
00264 
00269   void become_exposed(Disease *disease, Transmission *transmission);
00270 
00271   //Medication operators
00278   void take(Vaccine *vacc, int day, Vaccine_Manager* vm);
00279 
00285   void take(Antiviral *av, int day);
00286 
00290   int get_number_av_taken()             const {
00291     return av_health.size();
00292   }
00293 
00298   int get_checked_for_av(int s)             const {
00299     return checked_for_av[s];
00300   }
00301 
00306   void flip_checked_for_av(int s) {
00307     checked_for_av[s] = 1;
00308   }
00309 
00313   bool is_vaccinated() const {
00314     return vaccine_health.size();
00315   }
00316 
00320   int get_number_vaccines_taken()        const {
00321     return vaccine_health.size();
00322   }
00323 
00327   AV_Health * get_av_health(int i)            const {
00328     return av_health[i];
00329   }
00330 
00334   Vaccine_Health * get_vaccine_health(int i)  const {
00335     return vaccine_health[i];
00336   }
00337   bool takes_av;
00338   bool takes_vaccine;
00339 
00340   //Modifiers
00346   void modify_susceptibility(int disease_id, double multp);
00347 
00353   void modify_infectivity(int disease_id, double multp);
00354 
00365   void modify_infectious_period(int disease_id, double multp, int cur_day);
00366 
00376   void modify_symptomatic_period(int disease_id, double multp, int cur_day);
00377 
00387   void modify_asymptomatic_period(int disease_id, double multp, int cur_day);
00388 
00399   void modify_develops_symptoms(int disease_id, bool symptoms, int cur_day);
00400 
00401   void terminate();
00402 
00403 private:
00404   Person * self;
00405   Infection **infection;
00406   vector < bool > immunity;
00407   vector < bool > at_risk;  // Agent is/isn't at risk for severe complications
00408   double *susceptibility_multp;
00409   vector < bool > checked_for_av;
00410   vector < AV_Health * > av_health;
00411   vector < Vaccine_Health * > vaccine_health;
00412   int * infectee_count;
00413   int * susceptible_date;
00414   bool * susceptible;
00415   bool * infectious;
00416   bool * symptomatic;
00417   bool has_symptoms;
00418   bool alive;
00419 protected:
00420   Health() { }
00421 };
00422 
00423 #endif // _FRED_HEALTH_H
 All Classes Functions