Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:55

0001 #ifndef ONLMONHTML_H
0002 #define ONLMONHTML_H
0003 
0004 #include <filesystem>
0005 #include <set>
0006 #include <string>
0007 
0008 class RunDBodbc;
0009 
0010 /**@name Helper class to centralize HTML generation code.
0011  */
0012 
0013 class OnlMonHtml
0014 {
0015  public:
0016   explicit OnlMonHtml(const std::string& topdir);
0017   //! delete copy ctor and assignment opertor (cppcheck)
0018   explicit OnlMonHtml(const OnlMonHtml&) = delete;
0019   OnlMonHtml& operator=(const OnlMonHtml&) = delete;
0020 
0021   virtual ~OnlMonHtml();
0022 
0023   /** Generate a bit of the navigation menu for a given file (link).
0024    *  @param path the path as it will appear in the menu
0025    *  @param relfilename the filename that will be served when using
0026    *  path in the menu (must not be a fullpathname, but a plain filename).
0027    */
0028   void addMenu(const std::string& header, const std::string& path,
0029                const std::string& relfilename);
0030 
0031   /** Generate filenames, to be used to produce e.g. gif or html files.
0032    *  @param drawer the OnlMonDraw child class for which filename must be built
0033    *  @param basefilename the beginning of the filename
0034    *  (will be completed e.g. with the run number by this method)
0035    *  @param ext the extension of the file (e.g. gif or html)
0036    *  @return fullfilename = path+filename of the generated filename.
0037    *  @return filename = only filename of the generated filename
0038    */
0039   void namer(const std::string& header, const std::string& basefilename,
0040              const std::string& ext,
0041              std::string& fullfilename,
0042              std::string& filename);
0043 
0044   /** Generate a full filename from specified pieces, *and* register
0045    * the file to the navigation menu
0046    * @param drawer the OnlMonDraw child class for which filename must be built
0047    * @param path the path that will be used in the *navigation menu*
0048    * @param basefilename the beginning of the filename
0049    * (will be completed e.g. with the run number by this method)
0050    * @param ext the extension of the file (e.g. gif or html)
0051    * @return the full filename (i.e. full path + filename)
0052    */
0053   std::string registerPage(const std::string& header,
0054                            const std::string& path,
0055                            const std::string& basefilename,
0056                            const std::string& ext);
0057 
0058   void runNumber(const int runnumber);
0059   int runNumber() const { return fRunNumber; }
0060 
0061   void verbosity(const int v) { fVerbosity = v; }
0062   int verbosity() const { return fVerbosity; }
0063 
0064  protected:
0065   void plainHtmlMenu(const std::set<std::string>&);
0066   void runInit();
0067   std::string runRange();
0068   void set_group_sticky_bit(const std::filesystem::path& dir);
0069 
0070   RunDBodbc* rundb = nullptr;
0071 
0072   int fVerbosity = 0;
0073   int fRunNumber = 0;
0074 
0075   std::string fHtmlDir;
0076   std::string fHtmlRunDir;
0077 };
0078 
0079 #endif