00001 #ifndef __EMCCONFIGURATIONFILE_H__ 00002 #define __EMCCONFIGURATIONFILE_H__ 00003 00004 #ifndef __EMCMANAGEABLE_H__ 00005 #include "emcManageable.h" 00006 #endif 00007 #ifndef __PHTIMESTAMP_H__ 00008 #include "PHTimeStamp.h" 00009 #endif 00010 #include <string> 00011 00014 class emcConfigurationFile : public emcManageable 00015 { 00016 public: 00017 00019 emcConfigurationFile() : fCurrent(0),fIsValid(false),fContent(""),fStart(0),fEnd(0) 00020 { fEnd.setToFarFuture(); } 00021 00023 emcConfigurationFile(const char* filename); 00024 00026 virtual ~emcConfigurationFile() {; } 00027 00029 const PHTimeStamp& GetStartValTime(void) const { return fStart; } 00030 00032 const PHTimeStamp& GetEndValTime(void) const { return fEnd; } 00033 00035 size_t GetSize(void) const { return fContent.size(); } 00036 00038 bool IsValid(void) const { return fIsValid; } 00039 00041 bool IsValid(const PHTimeStamp& when) const; 00042 00044 virtual const char* GetCategory(void) const { return "CONFIG"; } 00045 00047 void SetValidityPeriod(const PHTimeStamp& t1, const PHTimeStamp& t2) { 00048 fStart = t1; fEnd = t2; 00049 } 00050 00052 void SetContent(const char* content) { fIsValid = true; fContent = content; } 00053 00055 const char* GetContent(void) const { return fContent.c_str(); } 00056 00058 virtual void Reset(void) { fContent=""; } 00059 00061 void Rewind(void) { fCurrent = 0; } 00062 00064 bool GetLine(char* s, int size); 00065 00066 private: 00067 int fCurrent; 00068 bool fIsValid; 00069 std::string fContent; 00070 PHTimeStamp fStart; 00071 PHTimeStamp fEnd; 00072 }; 00073 00074 #endif