CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/EventFilter/StorageManager/interface/WebPageHelper.h

Go to the documentation of this file.
00001 // $Id: WebPageHelper.h,v 1.13 2011/03/07 15:31:32 mommsen Exp $
00003 
00004 #ifndef EventFilter_StorageManager_WebPageHelper_h
00005 #define EventFilter_StorageManager_WebPageHelper_h
00006 
00007 #include <map>
00008 #include <string>
00009 
00010 #include "xdaq/ApplicationDescriptor.h"
00011 #include "xgi/Input.h"
00012 #include "xgi/Output.h"
00013 
00014 #include "EventFilter/Utilities/interface/Css.h"
00015 
00016 #include "EventFilter/StorageManager/interface/DQMEventMonitorCollection.h"
00017 #include "EventFilter/StorageManager/interface/XHTMLMaker.h"
00018 
00019 
00020 namespace stor {
00021 
00030   template<class T>
00031   class WebPageHelper
00032   {
00033   public:
00034 
00035     WebPageHelper
00036     (
00037       xdaq::ApplicationDescriptor*,
00038       const std::string& cvsVersion,
00039       T* callee,
00040       void (T::*addHyperLinks)(XHTMLMaker&, XHTMLMaker::Node*) const
00041     );
00042 
00046     void css(xgi::Input *in, xgi::Output *out)
00047     { css_.css(in,out); }
00048         
00049     
00050   protected:
00051 
00055     std::string baseURL() const;
00056 
00060     XHTMLMaker::Node* createWebPageBody
00061     (
00062       XHTMLMaker&,
00063       const std::string& pageTitle,
00064       const std::string& externallyVisibleState,
00065       const std::string& innerStateName,
00066       const std::string& errorMsg
00067     ) const;
00068     
00072     void addDOMforHyperLinks(XHTMLMaker& maker, XHTMLMaker::Node* parent) const
00073     { (callee_->*addHyperLinks_)(maker, parent); } 
00074 
00078     void addDurationToTableHead
00079     (
00080       XHTMLMaker& maker,
00081       XHTMLMaker::Node* tableRow,
00082       const utils::Duration_t
00083     ) const;
00084 
00088     void addDOMforProcessedDQMEvents
00089     (
00090       XHTMLMaker& maker,
00091       XHTMLMaker::Node* parent,
00092       DQMEventMonitorCollection const&
00093     ) const;
00094 
00098     void addDOMforDQMEventStatistics
00099     (
00100       XHTMLMaker& maker,
00101       XHTMLMaker::Node* parent,
00102       DQMEventMonitorCollection const&
00103     ) const;
00104 
00108     void addDQMEventStats
00109     (
00110       XHTMLMaker& maker,
00111       XHTMLMaker::Node* table,
00112       DQMEventMonitorCollection::DQMEventStats const&,
00113       const MonitoredQuantity::DataSetType
00114     ) const;
00115     
00119     void addRowForDQMEventsProcessed
00120     (
00121       XHTMLMaker& maker,
00122       XHTMLMaker::Node* table,
00123       DQMEventMonitorCollection::DQMEventStats const&,
00124       const MonitoredQuantity::DataSetType
00125     ) const;
00126 
00130     void addRowForDQMEventBandwidth
00131     (
00132       XHTMLMaker& maker,
00133       XHTMLMaker::Node* table,
00134       DQMEventMonitorCollection::DQMEventStats const&,
00135       const MonitoredQuantity::DataSetType
00136     ) const;
00137 
00141     void addRowForTotalDQMEventVolume
00142     (
00143       XHTMLMaker& maker,
00144       XHTMLMaker::Node* table,
00145       DQMEventMonitorCollection::DQMEventStats const&,
00146       const MonitoredQuantity::DataSetType
00147     ) const;
00148 
00152     void addRowForMaxDQMEventBandwidth
00153     (
00154       XHTMLMaker& maker,
00155       XHTMLMaker::Node* table,
00156       DQMEventMonitorCollection::DQMEventStats const&,
00157       const MonitoredQuantity::DataSetType
00158     ) const;
00159 
00163     void addRowForMinDQMEventBandwidth
00164     (
00165       XHTMLMaker& maker,
00166       XHTMLMaker::Node* table,
00167       DQMEventMonitorCollection::DQMEventStats const&,
00168       const MonitoredQuantity::DataSetType
00169     ) const;
00170 
00171 
00172     xdaq::ApplicationDescriptor* appDescriptor_;
00173 
00174     XHTMLMaker::AttrMap tableAttr_;
00175     XHTMLMaker::AttrMap rowAttr_;
00176     XHTMLMaker::AttrMap tableLabelAttr_;
00177     XHTMLMaker::AttrMap tableValueAttr_;
00178     XHTMLMaker::AttrMap specialRowAttr_;
00179 
00180     std::map<unsigned int, std::string> alarmColors_;
00181 
00182   private:
00183 
00184     //Prevent copying of the WebPageHelper
00185     WebPageHelper(WebPageHelper const&);
00186     WebPageHelper& operator=(WebPageHelper const&);
00187 
00188     evf::Css css_;
00189     const std::string cvsVersion_;
00190     T* callee_;
00191     void (T::*addHyperLinks_)(XHTMLMaker&, XHTMLMaker::Node*) const;
00192 
00193   };
00194 
00195 } // namespace stor
00196 
00197 #endif // EventFilter_StorageManager_WebPageHelper_h 
00198 
00199