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: Age_Map.h 00010 // 00011 // Age_Map is a class that holds a set of age-specific ranged values 00012 // The age ranges must be mutually exclusive. 00013 // 00014 00015 #ifndef _FRED_AGEMAP_H 00016 #define _FRED_AGEMAP_H 00017 00018 #include "Global.h" 00019 #include <stdio.h> 00020 #include <vector> 00021 #include <string> 00022 #include <sstream> 00023 00024 #include "Params.h" 00025 00026 using namespace std; 00027 00038 class Age_Map { 00039 public: 00040 // Creation operations 00044 Age_Map(); 00045 00051 Age_Map(string Name); 00052 00056 int get_num_ages() const { return ages.size(); } 00057 00061 int get_minimum_age() const; 00062 00066 int get_maximum_age() const; 00067 00071 bool is_empty() const { return ages.empty(); } 00072 00073 // Additional creation operations for building an Age_Map 00077 void read_from_input(string Input); 00078 00085 void read_from_input(string Input, int i); 00086 00094 void read_from_input(string Input, int i, int j); 00095 00103 void add_value(int lower_age, int upper_age, double val); 00104 00105 // Operations 00113 double find_value(int age) const; 00114 00115 // Utility functions 00119 void print() const; 00120 00126 bool quality_control() const; 00127 00128 private: 00129 string Name; 00130 vector < vector<int> > ages; // vector to hold the age ranges 00131 vector <double> values; // vector to hold the values for each age range 00132 }; 00133 00134 #endif