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

TGo4ClientTask Class Reference

This class controls a client application running in a task which is controlled by another server task via transport channels which are held by a task handler object. More...

#include <TGo4ClientTask.h>

Inheritance diagram for TGo4ClientTask:

TGo4Task TGo4ThreadManager TGo4CommandReceiver TGo4ExampleClient List of all members.

Public Member Functions

 TGo4ClientTask (const char *name, const char *serverhost="localhost", UInt_t negotiationport=0, Bool_t blockingmode=kTRUE, Bool_t standalone=kFALSE, Bool_t autostart=kFALSE, Bool_t autocreate=kTRUE, Bool_t ismaster=kFALSE, Bool_t autoconnect=kTRUE)
virtual ~TGo4ClientTask ()
virtual Int_t Initialization ()
 override the ThreadManager Initialization used by AppControlTimer to let this thing initialize the client transport connection
virtual void Quit ()
 Quit the client; method to be called from command object, may be overridden in user implementation.
virtual TGo4TaskStatusCreateStatus ()
 create a status object with information on the current client state.
TGo4TaskHandlerGetTaskHandler ()
void AddLocalCommand (TGo4Command *com)
 Put command into the command queue for local execution in main thread.
TGo4BufferQueueGetCommandQueue (const char *task=0)
TGo4BufferQueueGetStatusQueue (const char *task=0)
TGo4BufferQueueGetDataQueue (const char *task=0)
Bool_t ConnectServer (const char *node, UInt_t negport, Go4CommandMode_t role=kGo4ComModeRefused, const char *passwd=0)
 Connect this client to a waiting server task on node with negotiation channel negport.
Bool_t DisconnectServer (Bool_t isterminating=kFALSE)
 Disconnect the current server task, but do not terminate the client.
const char * GetServerHostName ()
Bool_t IsConnected ()

Protected Member Functions

virtual void UpdateStatus (TGo4TaskStatus *state)
 method needed by method CreateStatus of any status subclasses to set the values of the clienttask specific part of the status object.

Private Attributes

TGo4BufferQueuefxStatusQ
TGo4BufferQueuefxDataQ
TGo4BufferQueuefxCommandQ
TGo4TaskHandlerfxTaskHandler
 1 1
TString fxServerHostname
 hostname of server machine
Bool_t fbAutoConnect
 !True if client task shall try to connect automatically at Initialization.
Bool_t fbServerConnected
 true if connection to server is established, otherwise false

Detailed Description

This class controls a client application running in a task which is controlled by another server task via transport channels which are held by a task handler object.

Apart from the transport threads, the application class which inherits from client task may provide working threads to serve the data queues and do the actual work

Definition at line 36 of file TGo4ClientTask.h.


Constructor & Destructor Documentation

TGo4ClientTask::TGo4ClientTask const char *  name,
const char *  serverhost = "localhost",
UInt_t  negotiationport = 0,
Bool_t  blockingmode = kTRUE,
Bool_t  standalone = kFALSE,
Bool_t  autostart = kFALSE,
Bool_t  autocreate = kTRUE,
Bool_t  ismaster = kFALSE,
Bool_t  autoconnect = kTRUE
 

Definition at line 31 of file TGo4ClientTask.cxx.

References fxCommandQ, fxDataQ, fxServerHostname, fxStatusQ, fxTaskHandler, GetTaskHandler(), TGo4Task::IsMaster(), and TGo4ThreadManager::Launch().

TGo4ClientTask::~TGo4ClientTask  )  [virtual]
 

Definition at line 59 of file TGo4ClientTask.cxx.

References DisconnectServer(), and fxTaskHandler.


Member Function Documentation

Int_t TGo4ClientTask::Initialization  )  [virtual]
 

override the ThreadManager Initialization used by AppControlTimer to let this thing initialize the client transport connection

Reimplemented from TGo4Task.

Definition at line 71 of file TGo4ClientTask.cxx.

References ConnectServer(), fbAutoConnect, TGo4ThreadManager::fbInitDone, GetServerHostName(), TGo4Task::Initialization(), and TGo4Task::Terminate().

void TGo4ClientTask::Quit  )  [virtual]
 

Quit the client; method to be called from command object, may be overridden in user implementation.

Reimplemented from TGo4Task.

Definition at line 179 of file TGo4ClientTask.cxx.

References TGo4Log::Debug(), DisconnectServer(), TGo4Task::IsMaster(), TGo4Task::SendStatusMessage(), and TGo4Task::Terminate().

TGo4TaskStatus * TGo4ClientTask::CreateStatus  )  [virtual]
 

create a status object with information on the current client state.

this object may be sent to the server or may be used to restore current status by memento mechanism

Reimplemented from TGo4Task.

Reimplemented in TGo4ExampleClient.

Definition at line 187 of file TGo4ClientTask.cxx.

References UpdateStatus().

TGo4TaskHandler * TGo4ClientTask::GetTaskHandler  )  [virtual]
 

Reimplemented from TGo4Task.

Definition at line 66 of file TGo4ClientTask.cxx.

References fxTaskHandler.

Referenced by TGo4ClientTask(), and TGo4ExampleClient::TGo4ExampleClient().

void TGo4ClientTask::AddLocalCommand TGo4Command com  ) 
 

Put command into the command queue for local execution in main thread.

Definition at line 203 of file TGo4ClientTask.cxx.

References TGo4BufferQueue::AddBufferFromObject(), TGo4Log::Debug(), and fxCommandQ.

TGo4BufferQueue * TGo4ClientTask::GetCommandQueue const char *  task = 0  )  [virtual]
 

Reimplemented from TGo4Task.

Definition at line 216 of file TGo4ClientTask.cxx.

References fxCommandQ.

Referenced by DisconnectServer().

TGo4BufferQueue * TGo4ClientTask::GetStatusQueue const char *  task = 0  )  [virtual]
 

Reimplemented from TGo4Task.

Definition at line 221 of file TGo4ClientTask.cxx.

References fxStatusQ.

TGo4BufferQueue * TGo4ClientTask::GetDataQueue const char *  task = 0  )  [virtual]
 

Reimplemented from TGo4Task.

Definition at line 225 of file TGo4ClientTask.cxx.

References fxDataQ.

Referenced by TGo4ExampleClient::TGo4ExampleClient().

Bool_t TGo4ClientTask::ConnectServer const char *  node,
UInt_t  negport,
Go4CommandMode_t  role = kGo4ComModeRefused,
const char *  passwd = 0
 

Connect this client to a waiting server task on node with negotiation channel negport.

Returns connection state, true if connection is established, otherwise false.

Definition at line 100 of file TGo4ClientTask.cxx.

References TGo4TaskHandler::ClearQueues(), TGo4TaskHandler::Connect(), TGo4Log::Error(), fbServerConnected, fxTaskHandler, TGo4ThreadManager::fxWorkHandler, TGo4Task::IsMaster(), kGo4ComModeAdministrator, kGo4ComModeController, kGo4ComModeObserver, TGo4Task::SendStatusMessage(), TGo4TaskHandler::SetAdminAccount(), TGo4TaskHandler::SetCtrlAccount(), TGo4TaskHandler::SetNegotiationPort(), TGo4TaskHandler::SetObservAccount(), TGo4TaskHandler::SetRole(), TGo4ThreadHandler::StartAll(), and TGo4Log::Warn().

Referenced by TGo4AnalysisProxy::ConnectToServer(), and Initialization().

Bool_t TGo4ClientTask::DisconnectServer Bool_t  isterminating = kFALSE  ) 
 

Disconnect the current server task, but do not terminate the client.

Return value indicates success state: true if disconnected, false if connection is still existing. If isterminating=true, work threads are not restarted again.

Definition at line 155 of file TGo4ClientTask.cxx.

References TGo4Queue::Clear(), TGo4TaskHandler::DisConnect(), fbServerConnected, fxTaskHandler, TGo4Task::Get_fgiTERMID(), GetCommandQueue(), TGo4Task::IsMaster(), TGo4Task::SendStopBuffers(), TGo4Task::StartWorkThreads(), TGo4Task::StopWorkThreads(), and TGo4Task::WakeCommandQueue().

Referenced by TGo4Master::DisconnectSlave(), Quit(), and ~TGo4ClientTask().

const char* TGo4ClientTask::GetServerHostName  )  [inline]
 

Definition at line 103 of file TGo4ClientTask.h.

References fxServerHostname.

Referenced by Initialization(), and UpdateStatus().

Bool_t TGo4ClientTask::IsConnected  )  [inline]
 

Definition at line 106 of file TGo4ClientTask.h.

References fbServerConnected.

Referenced by TGo4TaskOwner::IsConnected().

void TGo4ClientTask::UpdateStatus TGo4TaskStatus state  )  [protected, virtual]
 

method needed by method CreateStatus of any status subclasses to set the values of the clienttask specific part of the status object.

Reimplemented from TGo4Task.

Definition at line 195 of file TGo4ClientTask.cxx.

References GetServerHostName(), TGo4ClientStatus::SetNames(), and TGo4Task::UpdateStatus().

Referenced by CreateStatus(), and TGo4ExampleClient::UpdateStatus().


Member Data Documentation

TGo4BufferQueue* TGo4ClientTask::fxStatusQ [private]
 

Definition at line 120 of file TGo4ClientTask.h.

Referenced by GetStatusQueue(), and TGo4ClientTask().

TGo4BufferQueue* TGo4ClientTask::fxDataQ [private]
 

Definition at line 121 of file TGo4ClientTask.h.

Referenced by GetDataQueue(), and TGo4ClientTask().

TGo4BufferQueue* TGo4ClientTask::fxCommandQ [private]
 

Definition at line 122 of file TGo4ClientTask.h.

Referenced by AddLocalCommand(), GetCommandQueue(), and TGo4ClientTask().

TGo4TaskHandler* TGo4ClientTask::fxTaskHandler [private]
 

1 1

Definition at line 128 of file TGo4ClientTask.h.

Referenced by ConnectServer(), DisconnectServer(), GetTaskHandler(), TGo4ClientTask(), and ~TGo4ClientTask().

TString TGo4ClientTask::fxServerHostname [private]
 

hostname of server machine

Definition at line 131 of file TGo4ClientTask.h.

Referenced by GetServerHostName(), and TGo4ClientTask().

Bool_t TGo4ClientTask::fbAutoConnect [private]
 

!True if client task shall try to connect automatically at Initialization.

This is the previous behaviour with standalone client. If false, connection will be done on ConnectServer method.

Definition at line 137 of file TGo4ClientTask.h.

Referenced by Initialization().

Bool_t TGo4ClientTask::fbServerConnected [private]
 

true if connection to server is established, otherwise false

Definition at line 142 of file TGo4ClientTask.h.

Referenced by ConnectServer(), DisconnectServer(), and IsConnected().


The documentation for this class was generated from the following files:
Generated on Fri Nov 28 13:00:34 2008 for Go4-v3.04-1 by  doxygen 1.4.2