GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4ServerTask.h
Go to the documentation of this file.
1 // $Id: TGo4ServerTask.h 1457 2015-05-28 14:59:14Z linev $
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 für 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 TGO4SERVERTASK_H
15 #define TGO4SERVERTASK_H
16 
17 #include "TGo4Task.h"
18 
19 class TGo4TaskManager;
20 class TGo4TaskHandler;
21 class TGo4BufferQueue;
22 class TGo4ObjectQueue;
23 class TGo4Command;
24 class TGo4Socket;
25 class TGo4Status;
27 
28 class TGo4ServerTask : public TGo4Task {
29  public:
30 
31  TGo4ServerTask(const char* name,
32  UInt_t negotiationport=0,
33  Bool_t blockingmode=kFALSE,
34  Bool_t standalone=kFALSE,
35  Bool_t autostart=kTRUE,
36  Bool_t autocreate=kTRUE,
37  Bool_t ismaster=kTRUE);
38 
39  virtual ~TGo4ServerTask();
40 
45  virtual void Quit();
46 
51  void Shutdown();
52 
54 
57 
60 
62  TGo4TaskHandler* GetTaskHandler(const char* name);
63 
64  TGo4BufferQueue* GetCommandQueue(const char* task=0);
65 
66  TGo4BufferQueue* GetStatusQueue(const char* task=0);
67 
68  TGo4BufferQueue* GetDataQueue(const char* task=0);
69 
74  virtual TGo4Command* NextCommand();
75 
76 
80  virtual void SendStatus(TGo4Status * stat, const char* receiver=0);
81 
83  virtual void SendStatusBuffer();
84 
90  virtual Bool_t StartConnectorThread();
91 
102  virtual Bool_t StopConnectorThread();
103 
108  Bool_t ConnectorThreadIsStopped();
109 
113  void SetCurrentTask(const char* name);
114 
115  void SetConnect(TGo4Socket * trans, const char* host, UInt_t port, Bool_t keepserv=kFALSE);
116 
117  void SetDisConnect(TGo4Socket * trans);
118 
120 
121  const char* GetConnectorName() const { return fxConnectorName.Data();}
122 
123  const char* GetConnectHost() const { return fxConnectHost.Data();}
124 
130  virtual Int_t TimerConnect();
131 
136  virtual Int_t RemoveAllClients(Bool_t force=false);
137 
143  virtual Bool_t RemoveClient(const char* name, Bool_t clientwait=kTRUE, Bool_t isterminating=kFALSE);
144 
148  Bool_t RemoveCurrentClient();
149 
150  Int_t WaitForOpen();
151 
152  Int_t WaitForClose();
153 
154  Int_t WaitForConnection();
155 
156  static const char* Get_fgcLAUNCHPREFSFILE();
157 
158  protected:
160  // public static constants:
162  static const Int_t fgiOPENWAITCYCLES;
163 
165  static const UInt_t fguOPENWAITCYCLETIME;
166 
168  static const Int_t fgiCLOSEWAITCYCLES;
169 
171  static const UInt_t fguCLOSEWAITCYCLETIME;
172 
174  static const Int_t fgiCONNECTWAITCYCLES;
175 
177  static const UInt_t fguCONNECTWAITCYCLETIME;
178 
180  static const UInt_t fguCONNECTTIMERPERIOD;
181 
183  static const char* fgcLAUNCHPREFSFILE;
184 
185 private:
186 
191 
195 
198 
204 
210 
214  TString fxConnectHost;
215 
220 
225 
230 
235 
236 
241 
247 
254 
260 public:
261 
263  kSecureShell = BIT(0), // kTRUE=launch client with ssh, otherwise rsh
264  kGuiEmbed = BIT(1) // kTRUE=client terminial embedded in gui otherwise in Xterm
265  };
266 
267 
268 ClassDef(TGo4ServerTask,1)
269 };
270 
271 #endif //TGO4SERVERTASK_H
virtual Bool_t RemoveClient(const char *name, Bool_t clientwait=kTRUE, Bool_t isterminating=kFALSE)
virtual void SendStatus(TGo4Status *stat, const char *receiver=0)
TString fxConnectorName
Bool_t fbDisConnectRequest
virtual void SendStatusBuffer()
static const UInt_t fguCONNECTWAITCYCLETIME
Int_t WaitForConnection()
Bool_t RemoveCurrentClient()
void SetDisConnect(TGo4Socket *trans)
TGo4TaskConnectorTimer * fxConnectorTimer
Bool_t fbConnectIsOpen
virtual void Quit()
void SetConnect(TGo4Socket *trans, const char *host, UInt_t port, Bool_t keepserv=kFALSE)
TGo4TaskHandler * fxCurrentTaskHandler
Bool_t fbConnectIsDone
virtual Bool_t StopConnectorThread()
static const UInt_t fguCONNECTTIMERPERIOD
virtual TGo4Command * NextCommand()
TGo4Socket * fxDisConnectTransport
static const UInt_t fguCLOSEWAITCYCLETIME
virtual Int_t TimerConnect()
static const char * Get_fgcLAUNCHPREFSFILE()
const char * GetConnectHost() const
TGo4BufferQueue * GetStatusQueue(const char *task=0)
static const Int_t fgiCONNECTWAITCYCLES
TString fxConnectHost
static const UInt_t fguOPENWAITCYCLETIME
static const Int_t fgiOPENWAITCYCLES
Bool_t ConnectorThreadIsStopped()
Bool_t fbKeepServerSocket
TGo4ServerTask(const char *name, UInt_t negotiationport=0, Bool_t blockingmode=kFALSE, Bool_t standalone=kFALSE, Bool_t autostart=kTRUE, Bool_t autocreate=kTRUE, Bool_t ismaster=kTRUE)
TGo4Socket * GetConnectTransport()
TGo4BufferQueue * GetCommandQueue(const char *task=0)
Bool_t fbConnectRequest
TGo4TaskManager * fxTaskManager
virtual Int_t RemoveAllClients(Bool_t force=false)
static const Int_t fgiCLOSEWAITCYCLES
TGo4BufferQueue * GetDataQueue(const char *task=0)
virtual ~TGo4ServerTask()
Bool_t fbConnectIsClose
TGo4TaskHandler * GetCurrentTaskHandler()
void SetCurrentTask(const char *name)
static const char * fgcLAUNCHPREFSFILE
TGo4TaskHandler * GetTaskHandler()
TGo4TaskManager * GetTaskManager()
TGo4Socket * fxConnectTransport
const char * GetConnectorName() const
virtual Bool_t StartConnectorThread()