GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
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
20class TObjArray;
21class TMutex;
22class TGo4ServerTask;
23class TGo4Socket;
24class TGo4TaskHandler;
25class TIterator;
26
30
31class TGo4TaskManager : public TNamed {
32 public:
33
34 TGo4TaskManager(const char *name, TGo4ServerTask *server, UInt_t negotiationport = 0, Bool_t createconnector = kTRUE);
35
36 virtual ~TGo4TaskManager();
37
41 Int_t ServeClient();
42
48
54 Int_t ConnectClient(const char *client, const char *host, Go4CommandMode_t role=kGo4ComModeController);
55
60 Int_t DisConnectClient(const char *name, Bool_t clientwait=kTRUE);
61
66 Int_t DisConnectClient(TGo4TaskHandler * taskhandler, Bool_t clientwait=kTRUE);
67
72 Bool_t AddClient(const char *client, const char *host, Go4CommandMode_t role);
73
78
82 TGo4TaskHandler *NewTaskHandler(const char *name);
83
87 Bool_t RemoveTaskHandler(const char *name);
88
92 TGo4TaskHandler *GetTaskHandler(const char *name);
93
98
105 TGo4TaskHandler *NextTaskHandler(Bool_t reset=kFALSE);
106
107 TMutex *GetMutex(){return fxListMutex;}
108
110 UInt_t GetTaskCount() const { return fuTaskCount; }
111
117 UInt_t GetNegotiationPort();
118
119
120 Int_t WaitForClientRemoved();
121
123
127 static const Int_t fgiDISCONCYCLES;
128
132 static const UInt_t fguDISCONTIME;
133 private:
134 // do not use this ctors and assignment operators:
135
137
139
140 // private members:
141
143
145
146 TObjArray *fxTaskList{nullptr};
147
148 TMutex *fxListMutex{nullptr};
149
151 TIterator *fxTaskIter{nullptr};
152
153 UInt_t fuTaskCount{0};
154
157
161 Bool_t fbClientIsRemoved{kFALSE};
162
167};
168
169#endif //TGO4TASKMANAGER_H
170
Go4CommandMode_t
These values define command execution rights.
Definition TGo4Command.h:27
@ kGo4ComModeController
Definition TGo4Command.h:30
Server task.
This class is responsible for the interconnection of two tasks: provided are three communication chan...
TGo4TaskHandler * NextTaskHandler(Bool_t reset=kFALSE)
For iteration over all connected task handlers.
TGo4TaskHandler * NewTaskHandler(const char *name)
creates new task handler with given name and adds it into array
TGo4TaskManager(const char *name, TGo4ServerTask *server, UInt_t negotiationport=0, Bool_t createconnector=kTRUE)
TGo4TaskManager(const TGo4TaskManager &right)
TIterator * fxTaskIter
Iterator over list of tasks.
UInt_t GetTaskCount() const
Number of entries in taskhandler list, i.e.
Go4CommandMode_t ClientLogin()
Check account and password of the client that requests a connection to this server.
TGo4TaskHandler * GetLastTaskHandler()
returns last task handler in list
UInt_t fuNegotiationPort
port number for the server client negotiation connections
Bool_t AddClient(const char *client, const char *host, Go4CommandMode_t role)
adds client task of name to manager: create server task handler and try to connect to client Command ...
Bool_t RemoveTaskHandler(const char *name)
removes task handler from array by name
UInt_t GetNegotiationPort()
returns the portnumber for client server negotiation port which is actually used by the running taskm...
TGo4Socket * fxTransport
Bool_t AddTaskHandler(TGo4TaskHandler *han)
adds external task handler to array
Int_t ServeClient()
used by connector runnable to wait for a client connect/disonnect request
TGo4TaskHandler * GetTaskHandler(const char *name)
returns certain task handler by name
TGo4ServerTask * fxServer
Bool_t fbHasControllerConnection
True if this server already has one connection to a master client that has the controller role.
static const Int_t fgiDISCONCYCLES
cycles to wait for client disconnection
TObjArray * fxTaskList
Bool_t HasControllerTask()
static const UInt_t fguDISCONTIME
time for each disonnection wait cycle
Bool_t fbClientIsRemoved
True if the last specified client is removed from server.
virtual ~TGo4TaskManager()
Int_t ConnectClient(const char *client, const char *host, Go4CommandMode_t role=kGo4ComModeController)
used by connector runnable to wait for a client request to connect to this server task.
Int_t DisConnectClient(const char *name, Bool_t clientwait=kTRUE)
disonnect an existing client by name, wait for negotiation OK if clientwait is true