solarpowerlog trunk
/home/tobi/workspace/solarpowerlog/src/DataFilters/HTMLWriter/CHTMLWriter.h
Go to the documentation of this file.
00001 /*
00002  * CHTMLWriter.h
00003  *
00004  *  Created on: Dec 20, 2009
00005  *      Author: tobi
00006  */
00007 
00008 #ifndef CHTMLWRITER_H_
00009 #define CHTMLWRITER_H_
00010 
00011 #ifdef HAVE_CONFIG_H
00012 #include "config.h"
00013 #endif
00014 
00015 #ifdef HAVE_FILTER_HTMLWRITER
00016 
00017 #include "DataFilters/interfaces/IDataFilter.h"
00018 
00019 extern "C" {
00020 #include "ctemplate/ctemplate.h"
00021 }
00022 
00033 class CHTMLWriter: public IDataFilter
00034 {
00035 public:
00036      CHTMLWriter(const string &name, const string & configurationpath);
00037 
00038      virtual ~CHTMLWriter();
00039 
00040      virtual bool CheckConfig();
00041 
00042      virtual void Update(const IObserverSubject *subject);
00043 
00044      virtual void ExecuteCommand(const ICommand *cmd);
00045 
00046      enum Commands
00047      {
00048           CMD_INIT,
00049           CMD_UPDATED,
00050           CMD_CYCLIC,
00051      };
00052 
00053 
00054 private:
00055 
00056      void CheckOrUnSubscribe( bool subscribe = true );
00057 
00058      // Configuraion cache
00059      float writeevery;
00060      bool derivetiming;
00061      bool generatetemplate;
00062      std::string generatetemplatedir;
00063      std::string htmlfile;
00064      std::string templatefile;
00065 
00066      bool updated;
00067      bool datavalid;
00068 
00070      void ScheduleCyclicEvent(enum CHTMLWriter::Commands cmd);
00071 
00073      void DoCyclicCmd(const ICommand *);
00074 
00075 };
00076 
00077 #endif
00078 
00079 #endif /* CHTMLWRITER_H_ */