00001 // $Id: TGo4TaskManager.h 478 2009-10-29 12:26:09Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #ifndef TGO4TASKMANAGER_H 00015 #define TGO4TASKMANAGER_H 00016 00017 #include "TNamed.h" 00018 #include "TGo4Command.h" 00019 00020 class TObjArray; 00021 class TMutex; 00022 class TGo4ServerTask; 00023 class TGo4Socket; 00024 class TGo4TaskHandler; 00025 class TIterator; 00026 00027 class TGo4TaskManager : public TNamed { 00028 public: 00029 00030 TGo4TaskManager(const char* name, TGo4ServerTask * server, UInt_t negotiationport=0, Bool_t createconnector=kTRUE); 00031 00032 virtual ~TGo4TaskManager(); 00033 00037 Int_t ServeClient(); 00038 00043 Go4CommandMode_t ClientLogin(); 00044 00050 Int_t ConnectClient(const char* client, const char* host, Go4CommandMode_t role=kGo4ComModeController); 00051 00056 Int_t DisConnectClient(const char* name , Bool_t clientwait=kTRUE); 00057 00062 Int_t DisConnectClient(TGo4TaskHandler * taskhandler, Bool_t clientwait=kTRUE); 00063 00068 Bool_t AddClient(const char* client, const char* host, Go4CommandMode_t role); 00069 00073 Bool_t AddTaskHandler(TGo4TaskHandler* han); 00074 00078 TGo4TaskHandler* NewTaskHandler(const char* name); 00079 00083 Bool_t RemoveTaskHandler(const char* name); 00084 00088 TGo4TaskHandler* GetTaskHandler(const char* name); 00089 00093 TGo4TaskHandler* GetLastTaskHandler(); 00094 00101 TGo4TaskHandler* NextTaskHandler(Bool_t reset=kFALSE); 00102 00103 TMutex* GetMutex(){return fxListMutex;} 00104 00106 UInt_t GetTaskCount() const { return fuTaskCount; } 00107 00113 UInt_t GetNegotiationPort(); 00114 00115 00116 Int_t WaitForClientRemoved(); 00117 00118 Bool_t HasControllerTask(){return fbHasControllerConnection;} 00119 00123 static const Int_t fgiDISCONCYCLES; 00124 00128 static const UInt_t fguDISCONTIME; 00129 private: 00130 // do not use this ctors and assignment operators: 00131 00132 TGo4TaskManager(); 00133 00134 TGo4TaskManager(const TGo4TaskManager &right); 00135 00136 // private members: 00137 00138 TGo4ServerTask* fxServer; 00139 00140 TGo4Socket* fxTransport; 00141 00144 TObjArray* fxTaskList; 00145 00146 TMutex* fxListMutex; 00147 00149 TIterator* fxTaskIter; 00150 00156 /*# TGo4TaskHandler lnkTGo4TaskHandler1; */ 00157 UInt_t fuTaskCount; 00158 00162 UInt_t fuNegotiationPort; 00163 00169 Bool_t fbClientIsRemoved; 00170 00174 Bool_t fbHasControllerConnection; 00175 }; 00176 00177 #endif //TGO4TASKMANAGER_H 00178