CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/EventFilter/Utilities/interface/WebGUI.h

Go to the documentation of this file.
00001 #ifndef WEBGUI_H
00002 #define WEBGUI_H 1
00003 
00004 
00005 #include "EventFilter/Utilities/interface/StateMachine.h"
00006 #include "EventFilter/Utilities/interface/Css.h"
00007 
00008 #include "xdaq/Application.h"
00009 
00010 #include "toolbox/lang/Class.h"
00011 
00012 #include "xdata/Serializable.h"
00013 #include "xdata/UnsignedInteger32.h"
00014 #include "xdata/InfoSpaceFactory.h"
00015 
00016 #include "xgi/Method.h"
00017 #include "xgi/Input.h"
00018 #include "xgi/Output.h"
00019 #include "xgi/exception/Exception.h"
00020 
00021 #include <string>
00022 #include <vector>
00023 
00024 
00025 namespace evf {
00026   
00027   class WebGUI : public toolbox::lang::Class
00028   {
00029   public:
00030     //
00031     // typedefs
00032     //
00033     typedef xdata::Serializable                             Param_t;
00034     typedef xdata::UnsignedInteger32                        Counter_t;
00035     typedef std::vector<std::pair<std::string,Param_t*> >   ParamVec_t;
00036     typedef std::vector<std::pair<std::string,Counter_t*> > CounterVec_t;
00037     typedef std::vector<std::pair<std::string,void*> >      UpdateVec_t;
00038     typedef xgi::Input                                      Input_t;
00039     typedef xgi::Output                                     Output_t;
00040     typedef const std::string                               CString_t;
00041     typedef xgi::exception::Exception                       XgiException_t;
00042     
00043     
00044     //
00045     // construction/destruction
00046     //
00047     WebGUI(xdaq::Application* app,StateMachine* fsm);
00048     virtual ~WebGUI();
00049     
00050     
00051     //
00052     // public memeber functions
00053     //
00054     void defaultWebPage(Input_t *in, Output_t *out) throw (XgiException_t);
00055     void debugWebPage(Input_t *in, Output_t *out)   throw (XgiException_t);
00056     void css(Input_t *in,Output_t *out)             throw (XgiException_t);
00057     
00058     void addStandardParam(CString_t& name,Param_t* param);
00059     void addMonitorParam(CString_t& name,Param_t* param);
00060     void addDebugParam(CString_t& name,Param_t* param);
00061     
00062     void addStandardCounter(CString_t& name,Counter_t* counter);
00063     void addMonitorCounter(CString_t& name,Counter_t* counter);
00064     void addDebugCounter(CString_t& name,Counter_t* counter);
00065 
00066     void exportParameters(); // must be called once after registering all params!
00067     void resetCounters();
00068     
00069     void addItemChangedListener(CString_t& name,xdata::ActionListener* l);
00070 
00071     xdata::InfoSpace* appInfoSpace() { return appInfoSpace_; }
00072     xdata::InfoSpace* monInfoSpace() { return monInfoSpace_; }
00073     
00074     void setLargeAppIcon(CString_t& icon) { largeAppIcon_=icon; }
00075     void setSmallAppIcon(CString_t& icon) { smallAppIcon_=icon; }
00076     void setSmallDbgIcon(CString_t& icon) { smallDbgIcon_=icon; }
00077     void setHyperDAQIcon(CString_t& icon) { hyperDAQIcon_=icon; }
00078     
00079 
00080     void htmlTable(Input_t*in,Output_t*out,
00081                    CString_t& title,const ParamVec_t& params);
00082     void htmlHead(Input_t*in,Output_t*out,CString_t& pageTitle);
00083     void htmlHeadline(Input_t*in,Output_t*out);
00084 
00085 
00086   private:
00087     //
00088     // private member functions
00089     //
00090     void addParamsToInfoSpace(const ParamVec_t& params,xdata::InfoSpace* infoSpace);
00091     void addCountersToParams();
00092     bool isMonitorParam(CString_t& name);
00093     void updateParams();
00094 
00095     
00096     
00097   private:
00098     //
00099     // member data
00100     //
00101     xdaq::Application     *app_;
00102     StateMachine          *fsm_;
00103     Css                    css_;
00104     Logger                 log_;
00105 
00106     std::string            sourceId_;
00107     std::string            urn_;
00108     
00109     xdata::InfoSpace      *appInfoSpace_;
00110     xdata::InfoSpace      *monInfoSpace_;
00111 
00112     xdata::ActionListener *itemGroupListener_;
00113     
00114     ParamVec_t             standardParams_;
00115     ParamVec_t             monitorParams_;
00116     ParamVec_t             debugParams_;
00117     CounterVec_t           standardCounters_;
00118     CounterVec_t           monitorCounters_;
00119     CounterVec_t           debugCounters_;
00120     
00121     bool                   parametersExported_;
00122     bool                   countersAddedToParams_;
00123 
00124     std::string            largeAppIcon_;
00125     std::string            smallAppIcon_;
00126     std::string            smallDbgIcon_;
00127     std::string            smallCtmIcon_;
00128     std::string            hyperDAQIcon_;
00129 
00130   };
00131   
00132 
00133 } // namespace evf
00134 
00135 
00136 #endif