GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4TaskManager.h
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGO4TASKMANAGER_H
15 #define TGO4TASKMANAGER_H
16 
17 #include "TNamed.h"
18 #include "TGo4Command.h"
19 
20 class TObjArray;
21 class TMutex;
22 class TGo4ServerTask;
23 class TGo4Socket;
24 class TGo4TaskHandler;
25 class TIterator;
26 
27 class TGo4TaskManager : public TNamed {
28  public:
29 
30  TGo4TaskManager(const char *name, TGo4ServerTask *server, UInt_t negotiationport = 0, Bool_t createconnector = kTRUE);
31 
32  virtual ~TGo4TaskManager();
33 
37  Int_t ServeClient();
38 
44 
50  Int_t ConnectClient(const char *client, const char *host, Go4CommandMode_t role=kGo4ComModeController);
51 
56  Int_t DisConnectClient(const char *name, Bool_t clientwait=kTRUE);
57 
62  Int_t DisConnectClient(TGo4TaskHandler * taskhandler, Bool_t clientwait=kTRUE);
63 
68  Bool_t AddClient(const char *client, const char *host, Go4CommandMode_t role);
69 
73  Bool_t AddTaskHandler(TGo4TaskHandler *han);
74 
78  TGo4TaskHandler *NewTaskHandler(const char *name);
79 
83  Bool_t RemoveTaskHandler(const char *name);
84 
88  TGo4TaskHandler *GetTaskHandler(const char *name);
89 
94 
101  TGo4TaskHandler *NextTaskHandler(Bool_t reset=kFALSE);
102 
103  TMutex *GetMutex(){return fxListMutex;}
104 
106  UInt_t GetTaskCount() const { return fuTaskCount; }
107 
113  UInt_t GetNegotiationPort();
114 
115 
116  Int_t WaitForClientRemoved();
117 
119 
123  static const Int_t fgiDISCONCYCLES;
124 
128  static const UInt_t fguDISCONTIME;
129  private:
130  // do not use this ctors and assignment operators:
131 
132  TGo4TaskManager();
133 
134  TGo4TaskManager(const TGo4TaskManager &right);
135 
136  // private members:
137 
139 
141 
142  TObjArray *fxTaskList{nullptr};
143 
144  TMutex *fxListMutex{nullptr};
145 
147  TIterator *fxTaskIter{nullptr};
148 
149  UInt_t fuTaskCount{0};
150 
152  UInt_t fuNegotiationPort{0};
153 
157  Bool_t fbClientIsRemoved{kFALSE};
158 
163 };
164 
165 #endif //TGO4TASKMANAGER_H
166 
Bool_t AddTaskHandler(TGo4TaskHandler *han)
Bool_t HasControllerTask()
UInt_t GetTaskCount() const
virtual ~TGo4TaskManager()
TGo4TaskHandler * NextTaskHandler(Bool_t reset=kFALSE)
Int_t ConnectClient(const char *client, const char *host, Go4CommandMode_t role=kGo4ComModeController)
Go4CommandMode_t
Definition: TGo4Command.h:27
UInt_t GetNegotiationPort()
Bool_t fbHasControllerConnection
TGo4ServerTask * fxServer
Go4CommandMode_t ClientLogin()
static const UInt_t fguDISCONTIME
Bool_t RemoveTaskHandler(const char *name)
TIterator * fxTaskIter
Int_t DisConnectClient(const char *name, Bool_t clientwait=kTRUE)
TGo4TaskHandler * GetTaskHandler(const char *name)
TMutex * GetMutex()
Bool_t AddClient(const char *client, const char *host, Go4CommandMode_t role)
static const Int_t fgiDISCONCYCLES
TGo4Socket * fxTransport
TObjArray * fxTaskList
TGo4TaskHandler * GetLastTaskHandler()
Int_t WaitForClientRemoved()
TGo4TaskHandler * NewTaskHandler(const char *name)