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

DisplayServer.h

Go to the documentation of this file.
00001 //-------------------------------------------------------------------------
00002 // File: DisplayServer.hh
00003 //
00004 // The DisplayServer class comprises methods to receive monitoring data from
00005 // the consumers, store them and send them to the HistoDisplay clients.
00006 // The communication between the consumers, the DisplayServer and the
00007 // HistoDisplay is implemented with TSockets.
00008 //
00009 // Author: Wolfgang Wagner 
00010 //
00011 //-------------------------------------------------------------------------
00012 //****************************************************************************
00013 // RCS Current Revision Record
00014 //-----------------------------------------------------------------------------
00015 // $Source: /cvs/minoscvs/rep1/minossoft/CDFMonitoringFwk/DisplayServer.h,v $
00016 // $Revision: 1.1 $
00017 // $Date: 2001/07/16 18:33:48 $
00018 // $Author: dap56 $
00019 // $State: Exp $
00020 // $Locker:  $
00021 //*****************************************************************************
00022 #ifndef DISPLAYSERVER_HH
00023 #define DISPLAYSERVER_HH
00024 
00025 #include <string>
00026 #include <map>
00027 
00028 #include "TServerSocket.h"
00029 #include "TSocket.h"
00030 #include "TMonitor.h"
00031 #include "TList.h"
00032 #include "TROOT.h"
00033 #include "TTimer.h"
00034 #include "TNamed.h"
00035 
00036 // Include files from Consumer Framework
00037 #include "TConsumerInfo.h"
00038 #include "ConsumerList.h"
00039 
00040 
00041 using std::string;
00042 using std::map;
00043 
00044 const char spaces[]  = "               ";
00045 const char barrier[] = 
00046   "===========================================================================";
00047 
00048 
00049 class DisplayServer : TNamed
00050 {
00051 public:
00052   DisplayServer(char* host, int consPort, TROOT* rt, ConsumerList* cl, 
00053   bool useTimer=true);
00054   ~DisplayServer();
00055 
00056   enum DSErrorCode {
00057     DS_OK = 0,
00058     DS_NO_CONNECTION = -1,
00059     DS_BAD_CLIENT_SSOCKET = -2
00060   };
00061   // Error code explaination:
00062   // DS_NO_CONNECTION = It was not possible to connect to the server socket 
00063   //                    of the consumer.  
00064 
00065 
00066   int  pollConsumer();
00067   void connectClient();
00068   void pollClients();
00069   TConsumerInfo* getCurrentInfo();
00070   int  errorFlag() const { return _error;}
00071                  
00072 private:
00073   static const string _clName;
00074   string _hostName;
00075   int   _consumerPort;
00076   int   _clientPort;
00077   int   _error;
00078   int   _debugFlags;
00079   int   _updateTimeDiff;
00080   bool  _useTimer; 
00081   map<string,bool> _clientMap;
00082   TServerSocket* _ss;      // Server socket for the display clients.
00083   TSocket* _conSock;       // Socket for consumer connection. 
00084   TMonitor _consMoni;      // Monitor for the consumer socket.
00085   TMonitor _clientMoni;    // Monitor for the client sockets. 
00086   TList _currList;         // List to store the objects currently provided.
00087   TList _outdatedList;     // List of objects which are not provided anymore.
00088   TConsumerInfo* _currInfo;
00089   ConsumerList*  _conList; 
00090   TROOT*     _glRoot;      // Global Root
00091   TTimer*    _updateTimer; // ROOT timer for triggering the status update   
00092 
00093   // private methods
00094   Bool_t HandleTimer(TTimer* timer);
00095   void editStorageList(const string& nameString);
00096   void updateStateManager();
00097   void setRequireUpdateBits();
00098   int openClientServerSocket(); 
00099 
00100   DisplayServer(const DisplayServer& ds);
00101   DisplayServer& operator=(const DisplayServer& ds);
00102 
00103 };  
00104   
00105 #endif

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