CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/EventFilter/Utilities/interface/IndependentWebGUI.h

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