Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4TaskHandler/TGo4ServerTask.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE 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 "Go4ThreadManager/TGo4ThreadManager.h"
00020 #include "Go4CommandsBase/TGo4CommandReceiver.h"
00021 #include "Go4CommandsTaskHandler/Go4CommandsTaskHandler.h"
00022 #include "Go4TaskHandler/TGo4TaskConnectorTimer.h"
00023 #include "TGo4Task.h"
00024 #include "Rtypes.h"
00025 #include <Rtypes.h>
00026 
00027 class TGo4TaskManager;
00028 class TGo4TaskHandler;
00029 class TGo4BufferQueue;
00030 class TGo4ObjectQueue;
00031 class TGo4Command;
00032 class TGo4Socket;
00033 class TGo4Status;
00034 
00035 class TGo4ServerTask : public TGo4Task {
00036    public:
00037 
00038       TGo4ServerTask(const char* name,
00039                      UInt_t negotiationport=0,
00040                      Bool_t blockingmode=kFALSE,
00041                      Bool_t standalone=kFALSE,
00042                      Bool_t autostart=kTRUE,
00043                      Bool_t autocreate=kTRUE,
00044                      Bool_t ismaster=kTRUE);
00045 
00046       virtual ~TGo4ServerTask();
00047 
00052       virtual void Quit();
00053 
00058       void Shutdown();
00059 
00074       virtual Int_t LaunchClient(const char* name, 
00075                                  const char* remotehost=0,
00076                                  const char* remotedir=0, 
00077                                  const char* remotecommand=0, 
00078                                  Int_t mode=0);
00079 
00080       TGo4TaskManager* GetTaskManager();
00081 
00083       TGo4TaskHandler* GetCurrentTaskHandler();
00084 
00086       TGo4TaskHandler* GetTaskHandler();
00087 
00089       TGo4TaskHandler* GetTaskHandler(const char* name);
00090 
00091       TGo4BufferQueue* GetCommandQueue(const char* task=0);
00092 
00093       TGo4BufferQueue* GetStatusQueue(const char* task=0);
00094 
00095       TGo4BufferQueue* GetDataQueue(const char* task=0);
00096 
00101       virtual TGo4Command* NextCommand();
00102 
00103 
00107     virtual void SendStatus(TGo4Status * stat, const char* receiver=0);
00108 
00110     virtual void SendStatusBuffer();
00111 
00117       virtual Bool_t StartConnectorThread();
00118 
00129       virtual Bool_t StopConnectorThread();
00130 
00135       Bool_t ConnectorThreadIsStopped();
00136 
00140       void SetCurrentTask(const char* name);
00141 
00142       void SetConnect(TGo4Socket * trans, const char* host, UInt_t port, Bool_t keepserv=kFALSE);
00143 
00144       void SetDisConnect(TGo4Socket * trans);
00145 
00146       TGo4Socket* GetConnectTransport();
00147 
00148       const char* GetConnectorName() const { return fxConnectorName.Data();}
00149 
00150       const char* GetConnectHost() const { return fxConnectHost.Data();}
00151 
00157       virtual Int_t TimerConnect();
00158 
00162       virtual Int_t RemoveAllClients();
00163 
00169       virtual Bool_t RemoveClient(const char* name, Bool_t clientwait=kTRUE, Bool_t isterminating=kFALSE);
00170 
00174       Bool_t RemoveCurrentClient();
00175 
00176       Int_t WaitForOpen();
00177 
00178 //      /**
00179 //       * Overrides the ThreadManager Initialization; is used to setup the
00180 //       * client connections on demand; checks for fbConnectRequest flag
00181 //       */
00182 //      virtual Int_t Initialization();
00183 
00184       Int_t WaitForClose();
00185 
00186       Int_t WaitForConnection();
00187 
00189       // public static constants:
00193       static const Int_t fgiOPENWAITCYCLES;
00194 
00198       static const UInt_t fguOPENWAITCYCLETIME;
00199 
00203       static const Int_t fgiCLOSEWAITCYCLES;
00204 
00208       static const UInt_t fguCLOSEWAITCYCLETIME;
00209 
00213       static const Int_t fgiCONNECTWAITCYCLES;
00214 
00218       static const UInt_t fguCONNECTWAITCYCLETIME;
00219 
00223       static const UInt_t fguCONNECTTIMERPERIOD;
00224 private:
00225 
00229       TString fxConnectorName;  
00230 
00233       TGo4TaskManager * fxTaskManager;
00234 
00236       TGo4TaskHandler * fxCurrentTaskHandler; 
00237 
00242       TGo4Socket * fxConnectTransport; 
00243 
00248       TGo4Socket * fxDisConnectTransport; 
00249 
00253       TString fxConnectHost;  
00254 
00258       UInt_t fuConnectPort;
00259 
00260 
00264       Bool_t fbKeepServerSocket;
00265 
00269       Bool_t fbConnectRequest;
00270 
00274       Bool_t fbDisConnectRequest;
00275 
00276 
00280       Bool_t fbConnectIsOpen;
00281 
00286       Bool_t fbConnectIsDone;
00287 
00292       Bool_t fbConnectIsClose;
00294 
00299       TGo4TaskConnectorTimer * fxConnectorTimer;
00300 public:
00301 
00302       enum ELaunchmodes{
00303       kSecureShell    = BIT(0),     // kTRUE=launch client with ssh, otherwise rsh
00304       kGuiEmbed       = BIT(1)      // kTRUE=client terminial embedded in gui otherwise in Xterm
00305     };
00306 
00307 
00309       static const Text_t fgcLAUNCHPREFSFILE[];
00310 ClassDef(TGo4ServerTask,1)
00311 };
00312 
00313 #endif //TGO4SERVERTASK_H
00314 
00315 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:06 2005 for Go4-v2.10-5 by doxygen1.2.15