Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4ServerTask.h

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #ifndef TGO4SERVERTASK_H
00017 #define TGO4SERVERTASK_H
00018 
00019 #include "TGo4Task.h"
00020 
00021 class TGo4TaskManager;
00022 class TGo4TaskHandler;
00023 class TGo4BufferQueue;
00024 class TGo4ObjectQueue;
00025 class TGo4Command;
00026 class TGo4Socket;
00027 class TGo4Status;
00028 class TGo4TaskConnectorTimer;
00029 
00030 class TGo4ServerTask : public TGo4Task {
00031    public:
00032 
00033       TGo4ServerTask(const char* name,
00034                      UInt_t negotiationport=0,
00035                      Bool_t blockingmode=kFALSE,
00036                      Bool_t standalone=kFALSE,
00037                      Bool_t autostart=kTRUE,
00038                      Bool_t autocreate=kTRUE,
00039                      Bool_t ismaster=kTRUE);
00040 
00041       virtual ~TGo4ServerTask();
00042 
00047       virtual void Quit();
00048 
00053       void Shutdown();
00054 
00057     virtual void LockAll();
00058 
00061     virtual void UnLockAll();
00062 
00063       TGo4TaskManager* GetTaskManager();
00064 
00066       TGo4TaskHandler* GetCurrentTaskHandler();
00067 
00069       TGo4TaskHandler* GetTaskHandler();
00070 
00072       TGo4TaskHandler* GetTaskHandler(const char* name);
00073 
00074       TGo4BufferQueue* GetCommandQueue(const char* task=0);
00075 
00076       TGo4BufferQueue* GetStatusQueue(const char* task=0);
00077 
00078       TGo4BufferQueue* GetDataQueue(const char* task=0);
00079 
00084       virtual TGo4Command* NextCommand();
00085 
00086 
00090     virtual void SendStatus(TGo4Status * stat, const char* receiver=0);
00091 
00093     virtual void SendStatusBuffer();
00094 
00100       virtual Bool_t StartConnectorThread();
00101 
00112       virtual Bool_t StopConnectorThread();
00113 
00118       Bool_t ConnectorThreadIsStopped();
00119 
00123       void SetCurrentTask(const char* name);
00124 
00125       void SetConnect(TGo4Socket * trans, const char* host, UInt_t port, Bool_t keepserv=kFALSE);
00126 
00127       void SetDisConnect(TGo4Socket * trans);
00128 
00129       TGo4Socket* GetConnectTransport();
00130 
00131       const char* GetConnectorName() const { return fxConnectorName.Data();}
00132 
00133       const char* GetConnectHost() const { return fxConnectHost.Data();}
00134 
00140       virtual Int_t TimerConnect();
00141 
00146       virtual Int_t RemoveAllClients(Bool_t force=false);
00147 
00153       virtual Bool_t RemoveClient(const char* name, Bool_t clientwait=kTRUE, Bool_t isterminating=kFALSE);
00154 
00158       Bool_t RemoveCurrentClient();
00159 
00160       Int_t WaitForOpen();
00161 
00162 //      /**
00163 //       * Overrides the ThreadManager Initialization; is used to setup the
00164 //       * client connections on demand; checks for fbConnectRequest flag
00165 //       */
00166 //      virtual Int_t Initialization();
00167 
00168       Int_t WaitForClose();
00169 
00170       Int_t WaitForConnection();
00171 
00172       static const char* Get_fgcLAUNCHPREFSFILE();
00173 
00174    protected:
00176       // public static constants:
00178       static const Int_t fgiOPENWAITCYCLES;
00179 
00181       static const UInt_t fguOPENWAITCYCLETIME;
00182 
00184       static const Int_t fgiCLOSEWAITCYCLES;
00185 
00187       static const UInt_t fguCLOSEWAITCYCLETIME;
00188 
00190       static const Int_t fgiCONNECTWAITCYCLES;
00191 
00193       static const UInt_t fguCONNECTWAITCYCLETIME;
00194 
00196       static const UInt_t fguCONNECTTIMERPERIOD;
00197 
00199       static const char* fgcLAUNCHPREFSFILE;
00200 
00201 private:
00202 
00206       TString fxConnectorName;
00207 
00210       TGo4TaskManager * fxTaskManager;
00211 
00213       TGo4TaskHandler * fxCurrentTaskHandler; 
00214 
00219       TGo4Socket * fxConnectTransport; 
00220 
00225       TGo4Socket * fxDisConnectTransport; 
00226 
00230       TString fxConnectHost;
00231 
00235       UInt_t fuConnectPort;
00236 
00237 
00241       Bool_t fbKeepServerSocket;
00242 
00246       Bool_t fbConnectRequest;
00247 
00251       Bool_t fbDisConnectRequest;
00252 
00253 
00257       Bool_t fbConnectIsOpen;
00258 
00263       Bool_t fbConnectIsDone;
00264 
00269       Bool_t fbConnectIsClose;
00271 
00276       TGo4TaskConnectorTimer * fxConnectorTimer;
00277 public:
00278 
00279       enum ELaunchmodes{
00280       kSecureShell    = BIT(0),     // kTRUE=launch client with ssh, otherwise rsh
00281       kGuiEmbed       = BIT(1)      // kTRUE=client terminial embedded in gui otherwise in Xterm
00282     };
00283 
00284 
00285 ClassDef(TGo4ServerTask,1)
00286 };
00287 
00288 #endif //TGO4SERVERTASK_H
00289 
00290 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:29 2008 for Go4-v3.04-1 by  doxygen 1.4.2