#include <TempReader.h>
Public Member Functions | |
| TempReader () | |
| virtual | ~TempReader () |
| void | AddTemps (std::string filename) |
| void | AddTemps (const char *filename) |
| float | GetTempFromTime (time_t time) |
| std::map< time_t, float > * | GetTempsMap () |
| std::map< time_t, float >::iterator | GetTempBegin () |
| std::map< time_t, float >::iterator | GetTempEnd () |
Private Attributes | |
| std::map< time_t, float > | fTemperatures |
|
|
Definition at line 22 of file TempReader.cxx. 00022 : 00023 fTemperatures() 00024 { 00025 }
|
|
|
Definition at line 27 of file TempReader.cxx. 00028 {}
|
|
|
Definition at line 30 of file TempReader.cxx. References AddTemps(), and s().
|
|
|
Definition at line 35 of file TempReader.cxx. References fTemperatures. Referenced by AddTemps(), and UberHeader::ReadTemperature(). 00036 {
00037
00038 ifstream instream(filename.c_str());
00039 if(!instream){
00040 cout<<"Could not open Temperature input file "<<filename<<endl;
00041 return;
00042 }
00043
00044 string tmp;
00045 instream>>tmp;
00046 while(!instream.eof()){
00047 string dates = tmp;
00048 string times;
00049 float temper;
00050 instream>>times;
00051 instream>>temper;
00052 instream>>tmp;
00053 //cout<<dates<<" "<<times<<" "<<temper<<endl;
00054 struct tm readtime;
00055 readtime.tm_mon = atoi((dates.substr(0,2)).c_str())-1;
00056 readtime.tm_mday = atoi((dates.substr(3,2)).c_str());
00057 readtime.tm_year = atoi((dates.substr(6,2)).c_str())+100;
00058 readtime.tm_hour = atoi((times.substr(0,2)).c_str());
00059 readtime.tm_min = atoi((times.substr(3,2)).c_str());
00060 readtime.tm_sec = atoi((times.substr(6,2)).c_str());
00061
00062 time_t rtime = mktime(&readtime);
00063 //cout<<ctime(&rtime)<<endl;
00064 fTemperatures[rtime]=temper;
00065
00066 }
00067 return;
00068 }
|
|
|
Definition at line 40 of file TempReader.h. References fTemperatures. 00041 {return fTemperatures.begin();}
|
|
|
Definition at line 42 of file TempReader.h. References fTemperatures. 00043 {return fTemperatures.end();}
|
|
|
Definition at line 70 of file TempReader.cxx. References fTemperatures. Referenced by UberHeader::ReadTemperature(). 00071 {
00072 if(fTemperatures.size()<1){
00073 return -99.9;
00074 }
00075 map<time_t, float>::iterator it(fTemperatures.lower_bound(time));
00076 if(it==fTemperatures.end()){
00077 return -99.9;
00078 }
00079 if(it==fTemperatures.begin()){
00080 return -99.9;
00081 }
00082 return it->second;
00083
00084 }//end GetTempFromTime
|
|
|
Definition at line 39 of file TempReader.h. 00039 {return &fTemperatures;}
|
|
|
Definition at line 34 of file TempReader.h. Referenced by AddTemps(), GetTempBegin(), GetTempEnd(), and GetTempFromTime(). |
1.3.9.1