#ifndef ROOT_TProofServ
#define ROOT_TProofServ
#ifndef ROOT_TApplication
#include "TApplication.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_TSysEvtHandler
#include "TSysEvtHandler.h"
#endif
#ifndef ROOT_TStopwatch
#include "TStopwatch.h"
#endif
#ifndef ROOT_TTimer
#include "TTimer.h"
#endif
#ifndef ROOT_TProofQueryResult
#include "TProofQueryResult.h"
#endif
class TDSet;
class TProof;
class TVirtualProofPlayer;
class TProofLockPath;
class TSocket;
class THashList;
class TList;
class TDSetElement;
class TMessage;
class TTimer;
class TMutex;
typedef Int_t (*OldProofServAuthSetup_t)(TSocket *, Bool_t, Int_t,
                                         TString &, TString &, TString &);
class TProofServ : public TApplication {
friend class TXProofServ;
public:
   enum EQueryAction { kQueryOK, kQueryModify, kQueryStop };
private:
   TString       fService;          
   TString       fUser;             
   TString       fGroup;            
   TString       fConfDir;          
   TString       fConfFile;         
   TString       fWorkDir;          
   TString       fImage;            
   TString       fSessionTag;       
   TString       fSessionDir;       
   TString       fPackageDir;       
   THashList    *fGlobalPackageDirList;  
   TString       fCacheDir;         
   TString       fQueryDir;         
   TString       fDataSetDir;       
   TProofLockPath *fPackageLock;    
   TProofLockPath *fCacheLock;      
   TProofLockPath *fQueryLock;      
   TProofLockPath *fDataSetLock;    
   TString       fArchivePath;      
   TSocket      *fSocket;           
   TProof       *fProof;            
   TVirtualProofPlayer *fPlayer;    
   FILE         *fLogFile;          
   Int_t         fLogFileDes;       
   TList        *fEnabledPackages;  
   Int_t         fProtocol;         
   TString       fOrdinal;          
   Int_t         fGroupId;          
   Int_t         fGroupSize;        
   Int_t         fLogLevel;         
   Int_t         fNcmd;             
   Int_t         fGroupPriority;    
   Bool_t        fEndMaster;        
   Bool_t        fMasterServ;       
   Bool_t        fInterrupt;        
   Float_t       fRealTime;         
   Float_t       fCpuTime;          
   TStopwatch    fLatency;          
   TStopwatch    fCompute;          
   Int_t         fSeqNum;           
   Int_t         fDrawQueries;      
   Int_t         fKeptQueries;      
   TList        *fQueries;          
   TList        *fPreviousQueries;  
   TList        *fWaitingQueries;   
   Bool_t        fIdle;             
   TString       fPrefix;           
   Bool_t        fRealTimeLog;      
   Bool_t        fShutdownWhenIdle; 
   TTimer       *fShutdownTimer;    
   TMutex       *fShutdownTimerMtx; 
   Int_t         fInflateFactor;    
   static Int_t  fgMaxQueries;      
   void          RedirectOutput();
   Int_t         CatMotd();
   Int_t         UnloadPackage(const char *package);
   Int_t         UnloadPackages();
   Int_t         OldAuthSetup(TString &wconf);
   Int_t         GetPriority();
   
   void          AddLogFile(TProofQueryResult *pq);
   Int_t         CleanupQueriesDir();
   void          FinalizeQuery(TProofQueryResult *pq);
   TList        *GetDataSet(const char *name);
   TProofQueryResult *MakeQueryResult(Long64_t nentries, const char *opt,
                                      TList *inl, Long64_t first, TDSet *dset,
                                      const char *selec, TEventList *evl);
   TProofQueryResult *LocateQuery(TString queryref, Int_t &qry, TString &qdir);
   void          RemoveQuery(TQueryResult *qr, Bool_t soft = kFALSE);
   void          RemoveQuery(const char *queryref);
   void          SaveQuery(TQueryResult *qr, const char *fout = 0);
   void          SetQueryRunning(TProofQueryResult *pq);
   Int_t         LockSession(const char *sessiontag, TProofLockPath **lck);
   Int_t         CleanupSession(const char *sessiontag);
   void          ScanPreviousQueries(const char *dir);
protected:
   virtual void  HandleArchive(TMessage *mess);
   virtual Int_t HandleCache(TMessage *mess);
   virtual Int_t HandleDataSets(TMessage *mess);
   virtual void  HandleCheckFile(TMessage *mess);
   virtual void  HandleLibIncPath(TMessage *mess);
   virtual void  HandleProcess(TMessage *mess);
   virtual void  HandleQueryList(TMessage *mess);
   virtual void  HandleRemove(TMessage *mess);
   virtual void  HandleRetrieve(TMessage *mess);
   virtual void  HandleWorkerLists(TMessage *mess);
   virtual void  HandleSocketInputDuringProcess();
   virtual Int_t Setup();
   virtual void  MakePlayer();
   virtual void  DeletePlayer();
   virtual void  SetShutdownTimer(Bool_t, Int_t) { }
   static void   ErrorHandler(Int_t level, Bool_t abort, const char *location,
                              const char *msg);
public:
   TProofServ(Int_t *argc, char **argv, FILE *flog = 0);
   virtual ~TProofServ();
   virtual Int_t  CreateServer();
   TProof        *GetProof()      const { return fProof; }
   const char    *GetService()    const { return fService; }
   const char    *GetConfDir()    const { return fConfDir; }
   const char    *GetConfFile()   const { return fConfFile; }
   const char    *GetUser()       const { return fUser; }
   const char    *GetGroup()      const { return fGroup; }
   const char    *GetWorkDir()    const { return fWorkDir; }
   const char    *GetImage()      const { return fImage; }
   const char    *GetSessionDir() const { return fSessionDir; }
   Int_t          GetProtocol()   const { return fProtocol; }
   const char    *GetOrdinal()    const { return fOrdinal; }
   Int_t          GetGroupId()    const { return fGroupId; }
   Int_t          GetGroupSize()  const { return fGroupSize; }
   Int_t          GetLogLevel()   const { return fLogLevel; }
   TSocket       *GetSocket()     const { return fSocket; }
   Float_t        GetRealTime()   const { return fRealTime; }
   Float_t        GetCpuTime()    const { return fCpuTime; }
   void           GetOptions(Int_t *argc, char **argv);
   Int_t          GetInflateFactor() const { return fInflateFactor; }
   const char    *GetPrefix()     const { return fPrefix; }
   void           FlushLogFile();
   Int_t          CopyFromCache(const char *name);
   Int_t          CopyToCache(const char *name, Int_t opt = 0);
   virtual EQueryAction GetWorkers(TList *workers, Int_t &prioritychange);
   virtual void   HandleSocketInput();
   virtual void   HandleUrgentData();
   virtual void   HandleSigPipe();
   virtual void   HandleTermination() { Terminate(0); }
   void           Interrupt() { fInterrupt = kTRUE; }
   Bool_t         IsEndMaster() const { return fEndMaster; }
   Bool_t         IsMaster() const { return fMasterServ; }
   Bool_t         IsParallel() const;
   Bool_t         IsTopMaster() const { return fOrdinal == "0"; }
   void           Run(Bool_t retrn = kFALSE);
   void           Print(Option_t *option="") const;
   TObject       *Get(const char *namecycle);
   TDSetElement  *GetNextPacket(Long64_t totalEntries = -1);
   void           Reset(const char *dir);
   Int_t          ReceiveFile(const char *file, Bool_t bin, Long64_t size);
   virtual Int_t  SendAsynMessage(const char *msg, Bool_t lf = kTRUE);
   virtual void   SendLogFile(Int_t status = 0, Int_t start = -1, Int_t end = -1);
   void           SendStatistics();
   void           SendParallel();
   
   virtual void   DisableTimeout() { }
   virtual void   EnableTimeout() { }
   virtual void   Terminate(Int_t status);
   static Bool_t      IsActive();
   static TProofServ *This();
   ClassDef(TProofServ,0)  
};
R__EXTERN TProofServ *gProofServ;
class TProofLockPath : public TNamed {
private:
   Int_t         fLockId;        
public:
   TProofLockPath(const char *path) : TNamed(path,path), fLockId(-1) { }
   ~TProofLockPath() { if (IsLocked()) Unlock(); }
   Int_t         Lock();
   Int_t         Unlock();
   Bool_t        IsLocked() const { return (fLockId > -1); }
};
class TProofLockPathGuard {
private:
   TProofLockPath  *fLocker; 
public:
   TProofLockPathGuard(TProofLockPath *l) { fLocker = l; if (fLocker) fLocker->Lock(); }
   ~TProofLockPathGuard() { if (fLocker) fLocker->Unlock(); }
};
class TProofServLogHandler : public TFileHandler {
private:
   TSocket     *fSocket; 
   FILE        *fFile;   
   TString      fPfx;    
   static TString fgPfx; 
public:
   enum EStatusBits { kFileIsPipe = BIT(23) };
   TProofServLogHandler(const char *cmd, TSocket *s, const char *pfx = "");
   TProofServLogHandler(FILE *f, TSocket *s, const char *pfx = "");
   virtual ~TProofServLogHandler();
   Bool_t IsValid() { return ((fFile && fSocket) ? kTRUE : kFALSE); }
   Bool_t Notify();
   Bool_t ReadNotify() { return Notify(); }
   static void SetDefaultPrefix(const char *pfx);
};
class TProofServLogHandlerGuard {
private:
   TProofServLogHandler   *fExecHandler;
public:
   TProofServLogHandlerGuard(const char *cmd, TSocket *s,
                             const char *pfx = "", Bool_t on = kTRUE);
   TProofServLogHandlerGuard(FILE *f, TSocket *s,
                             const char *pfx = "", Bool_t on = kTRUE);
   virtual ~TProofServLogHandlerGuard();
};
class TShutdownTimer : public TTimer {
private:
   TProofServ    *fProofServ;
public:
   TShutdownTimer(TProofServ *p, Int_t delay) : TTimer(delay, kFALSE), fProofServ(p) { }
   Bool_t Notify();
};
#endif
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.