Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

TempReader Class Reference

#include <TempReader.h>

List of all members.

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


Constructor & Destructor Documentation

TempReader::TempReader  ) 
 

Definition at line 22 of file TempReader.cxx.

00022                       :
00023   fTemperatures()
00024 {
00025 }

TempReader::~TempReader  )  [virtual]
 

Definition at line 27 of file TempReader.cxx.

00028 {}


Member Function Documentation

void TempReader::AddTemps const char *  filename  ) 
 

Definition at line 30 of file TempReader.cxx.

References AddTemps(), and s().

00031 {
00032   string s(filename);
00033   AddTemps(s);
00034 }

void TempReader::AddTemps std::string  filename  ) 
 

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 }    

std::map< time_t, float >::iterator TempReader::GetTempBegin  )  [inline]
 

Definition at line 40 of file TempReader.h.

References fTemperatures.

00041 {return fTemperatures.begin();}

std::map< time_t, float >::iterator TempReader::GetTempEnd  )  [inline]
 

Definition at line 42 of file TempReader.h.

References fTemperatures.

00043 {return fTemperatures.end();}

float TempReader::GetTempFromTime time_t  time  ) 
 

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

std::map< time_t, float > * TempReader::GetTempsMap  )  [inline]
 

Definition at line 39 of file TempReader.h.

00039 {return &fTemperatures;}


Member Data Documentation

std::map<time_t,float> TempReader::fTemperatures [private]
 

Definition at line 34 of file TempReader.h.

Referenced by AddTemps(), GetTempBegin(), GetTempEnd(), and GetTempFromTime().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:21 2010 for loon by  doxygen 1.3.9.1