Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ConsumerList.h

Go to the documentation of this file.
00001 //*************************************************************************
00002 //             ConsumerList for the Consumer Project
00003 // the ConsumerList class contains a list with all consumers. This list can
00004 // be displayed on the WWW,be read from a Webpage and sent/received via 
00005 // Socket.  
00006 //     (based on the DisplayServer by Frank Hartmann and Hans Wenzel)
00007 //
00008 //                    04/14/00 Harmut Stadie       first check in
00009 //************************************************************************
00010 //****************************************************************************
00011 // RCS Current Revision Record
00012 //-----------------------------------------------------------------------------
00013 // $Source: /cvs/minoscvs/rep1/minossoft/CDFMonitoringFwk/ConsumerList.h,v $
00014 // $Revision: 1.4 $
00015 // $Date: 2003/10/17 20:35:58 $
00016 // $Author: dap56 $
00017 // $State: Exp $
00018 // $Locker:  $
00019 //*****************************************************************************
00020 #ifndef CONSUMERLIST_HH
00021 #define CONSUMERLIST_HH
00022 
00023 #include <vector>
00024 #include <iostream>
00025 
00026 #include "TString.h"
00027 #include "TUrl.h"
00028 
00029 class ConsumerList
00030 {
00031 public:
00032   ConsumerList(TString sitename="");
00033   ~ConsumerList();
00034   
00035   int nEntries() const;
00036   const TString& consumername(int i) const;
00037   const TString& hostname(int i) const;
00038   int port(int i) const;
00039   int nevents(int i) const;
00040   int runnumber(int i) const;
00041   int status(int i) const;
00042   const char* statusString(int i) const;
00043   const TString& updateTime(int i) const;
00044   int readWebPage();
00045   void setPort(int i, int port);
00046   void setNevents(int i, int nev);
00047   void setStatus(int i , int status);
00048   void setRunnumber(int i, int runn);
00049   void setUpdateTime(int i,char *tm);
00050   int watchServers(const int port,const char *filename); // command for the StateManager
00051   void test();
00052   void print(std::ostream& output = std::cout) const;
00053   void addEntry(TString nam, TString hostnam,int port,
00054                 int nev,int runn,int stat,TString tm = "");
00055   void removeEntry(const char* hostname,int port);
00056   int sendList(const char *host,const int port);
00057   enum 
00058   {
00059     Unknown  = 0, 
00060     Dead     = 1,
00061     Running  = 2,
00062     Stopped  = 3,
00063     Crashed  = 4,
00064     Finished = 5
00065   };
00066   int writeWebPage(const char *filename);
00067 private:
00068   //int writeWebPage(const char *filename);
00069   struct ConsumerEntry
00070   {
00071     TString name;
00072     TString hostname;
00073     int port;
00074     int nevents;
00075     int runnumber;
00076     int status;
00077     TString time;
00078     ConsumerEntry(TString nam, TString hostnam,int p,
00079                   int nev,int runn,int stat,TString tm = "");
00080     ConsumerEntry();
00081   }; 
00082   ConsumerList(const ConsumerList& sm);
00083   std::vector<ConsumerEntry> _consumerlist;
00084   TString _websitename;
00085   const char *_statusnames[6];
00086 public:
00087   static bool sortbyName(const ConsumerEntry a, const ConsumerEntry b);
00088 };
00089   
00090 #endif
00091 
00092 
00093 

Generated on Mon Feb 15 11:06:33 2010 for loon by  doxygen 1.3.9.1