GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
TGo4ClientTask Class Reference

#include <TGo4ClientTask.h>

+ Inheritance diagram for TGo4ClientTask:

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 ()
 
Int_t Initialization () override
 
void Quit () override
 
TGo4TaskStatusCreateStatus () override
 
TGo4TaskHandlerGetTaskHandler () override
 
void AddLocalCommand (TGo4Command *com)
 
TGo4BufferQueueGetCommandQueue (const char *task=nullptr) override
 
TGo4BufferQueueGetStatusQueue (const char *task=nullptr) override
 
TGo4BufferQueueGetDataQueue (const char *task=nullptr) override
 
Bool_t ConnectServer (const char *node, UInt_t negport, Go4CommandMode_t role=kGo4ComModeRefused, const char *passwd=nullptr)
 
Bool_t DisconnectServer (Bool_t isterminating=kFALSE)
 
const char * GetServerHostName () const
 
Bool_t IsConnected () const
 
- Public Member Functions inherited from TGo4Task
 TGo4Task (const char *name, Bool_t blockingmode, Bool_t autostart=kFALSE, Bool_t autocreate=kTRUE, Bool_t ismaster=kFALSE)
 
virtual ~TGo4Task ()
 
virtual void Start ()
 
virtual void Stop ()
 
virtual void KillMain ()
 
virtual void RestartMain ()
 
void Terminate (Bool_t termapp=kTRUE) override
 
void TerminateFast () override
 
virtual void ExecuteString (const char *command)
 
Bool_t IsMaster () const
 
void SetOwner (TGo4TaskOwner *owner)
 
void AddUserCommand (TGo4Command *com)
 
void AddUserCommandList (TGo4CommandProtoList *comlist)
 
TGo4StatusNextStatus (Bool_t wait=kTRUE)
 
TObject * NextObject (Bool_t wait=kTRUE)
 
virtual TGo4CommandNextCommand ()
 
void SendObject (TObject *obj, const char *receiver=nullptr)
 
virtual void SendStatus (TGo4Status *stat, const char *receiver=nullptr)
 
virtual void SendStatusBuffer ()
 
TMutex * GetStatusBufferMutex ()
 
void SendStatusMessage (Int_t level, Bool_t printout, const char *text,...)
 
void UpdateStatusBuffer ()
 
Int_t Initialization () override
 
Bool_t SubmitCommand (const char *name)
 
Bool_t SubmitEmergencyCommand (Go4EmergencyCommand_t val)
 
Bool_t SubmitEmergencyData (Go4EmergencyCommand_t val, const char *receiver=nullptr)
 
Bool_t SubmitLocalCommand (TGo4Command *com)
 
Bool_t SubmitCommand (TGo4Command *com)
 
TGo4CommandMakeCommand (const char *name)
 
void WakeCommandQueue (Int_t id=0)
 
virtual Int_t StartWorkThreads ()
 
virtual Int_t StopWorkThreads ()
 
Bool_t IsWorkStopped () const
 
virtual void GetStatus ()
 
const char * GetCommanderName () const
 
TGo4MasterGetMaster () const
 
TGo4SlaveGetSlave () const
 
void SendStopBuffers (const char *taskname=nullptr)
 
TBuffer * GetAbortBuffer ()
 
- Public Member Functions inherited from TGo4ThreadManager
 TGo4ThreadManager (const TGo4ThreadManager &right)
 
 TGo4ThreadManager (const char *name, Bool_t blockingmode=kTRUE, Bool_t autostart=kTRUE, Bool_t autocreate=kTRUE)
 
virtual ~TGo4ThreadManager ()
 
void SetTimer (TGo4AppControlTimer *ctrltimer)
 
TGo4ThreadHandlerGetWorkHandler () const
 
Bool_t BlockApp ()
 
Bool_t UnBlockApp (Int_t mode=0)
 
Bool_t IsInitDone () const
 
Bool_t IsTerminating () const
 
Bool_t IsTerminateApp () const
 
Bool_t IsAppBlocking () const
 
Bool_t IsBeingQuit () const
 
void SetBeingQuit (Bool_t on)
 
void Launch ()
 
- Public Member Functions inherited from TGo4CommandReceiver
 TGo4CommandReceiver ()
 
virtual ~TGo4CommandReceiver ()
 

Protected Member Functions

void UpdateStatus (TGo4TaskStatus *state) override
 
- Protected Member Functions inherited from TGo4Task
virtual TGo4TaskHandlerCommandListCreateCommandList ()
 
TGo4TaskHandlerCommandListGetPrototype ()
 
TGo4ObjectQueueGetLocalCommandQueue ()
 
void SetMaster (Bool_t on=kTRUE)
 
void SetWorkIsStopped (Bool_t on)
 

Private Attributes

TGo4BufferQueuefxStatusQ {nullptr}
 
TGo4BufferQueuefxDataQ {nullptr}
 
TGo4BufferQueuefxCommandQ {nullptr}
 
TGo4TaskHandlerfxTaskHandler {nullptr}
 
TString fxServerHostname
 
Bool_t fbAutoConnect {kFALSE}
 
Bool_t fbServerConnected {kFALSE}
 

Additional Inherited Members

- Public Types inherited from TGo4ThreadManager
enum  { fguTEXTLENGTH = 256 }
 
- Static Public Member Functions inherited from TGo4Task
static Int_t Get_fgiTERMID ()
 
- Static Public Attributes inherited from TGo4ThreadManager
static const Long_t fglTIMERPERIOD = 200
 
- Protected Attributes inherited from TGo4Task
TMutex * fxStatusMutex {nullptr}
 
TBuffer * fxStatusBuffer {nullptr}
 
- Protected Attributes inherited from TGo4ThreadManager
Bool_t fbInitDone {kFALSE}
 
Bool_t fbTerminating {kFALSE}
 
Bool_t fbTerminateApplication {kFALSE}
 
Bool_t fbAppBlocking {kFALSE}
 
Bool_t fbAutoCreate {kFALSE}
 
Bool_t fbAutoStart {kFALSE}
 
Int_t fbBeingQuit {0}
 
TGo4AppControlTimerfxBlocker {nullptr}
 
TGo4ThreadHandlerfxWorkHandler {nullptr}
 

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 33 of file TGo4ClientTask.h.

Constructor & Destructor Documentation

◆ TGo4ClientTask()

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 
)

◆ ~TGo4ClientTask()

TGo4ClientTask::~TGo4ClientTask ( )
virtual

Definition at line 51 of file TGo4ClientTask.cxx.

References DisconnectServer(), and fxTaskHandler.

Member Function Documentation

◆ AddLocalCommand()

void TGo4ClientTask::AddLocalCommand ( TGo4Command com)

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

Definition at line 169 of file TGo4ClientTask.cxx.

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

◆ ConnectServer()

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

◆ CreateStatus()

TGo4TaskStatus * TGo4ClientTask::CreateStatus ( )
overridevirtual

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 154 of file TGo4ClientTask.cxx.

References UpdateStatus().

◆ DisconnectServer()

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 119 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().

◆ GetCommandQueue()

TGo4BufferQueue * TGo4ClientTask::GetCommandQueue ( const char *  task = nullptr)
overridevirtual

Reimplemented from TGo4Task.

Definition at line 180 of file TGo4ClientTask.cxx.

References fxCommandQ.

Referenced by DisconnectServer().

◆ GetDataQueue()

TGo4BufferQueue * TGo4ClientTask::GetDataQueue ( const char *  task = nullptr)
overridevirtual

Reimplemented from TGo4Task.

Definition at line 189 of file TGo4ClientTask.cxx.

References fxDataQ.

Referenced by TGo4ExampleClient::TGo4ExampleClient().

◆ GetServerHostName()

const char* TGo4ClientTask::GetServerHostName ( ) const
inline

Definition at line 100 of file TGo4ClientTask.h.

References fxServerHostname.

Referenced by Initialization(), and UpdateStatus().

◆ GetStatusQueue()

TGo4BufferQueue * TGo4ClientTask::GetStatusQueue ( const char *  task = nullptr)
overridevirtual

Reimplemented from TGo4Task.

Definition at line 185 of file TGo4ClientTask.cxx.

References fxStatusQ.

◆ GetTaskHandler()

TGo4TaskHandler * TGo4ClientTask::GetTaskHandler ( )
overridevirtual

Reimplemented from TGo4Task.

Definition at line 57 of file TGo4ClientTask.cxx.

References fxTaskHandler.

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

◆ Initialization()

Int_t TGo4ClientTask::Initialization ( )
overridevirtual

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

Reimplemented from TGo4ThreadManager.

Definition at line 62 of file TGo4ClientTask.cxx.

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

◆ IsConnected()

Bool_t TGo4ClientTask::IsConnected ( ) const
inline

Definition at line 102 of file TGo4ClientTask.h.

References fbServerConnected, and UpdateStatus().

Referenced by TGo4TaskOwner::IsConnected().

◆ Quit()

void TGo4ClientTask::Quit ( )
overridevirtual

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

Reimplemented from TGo4Task.

Definition at line 144 of file TGo4ClientTask.cxx.

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

◆ UpdateStatus()

void TGo4ClientTask::UpdateStatus ( TGo4TaskStatus state)
overrideprotectedvirtual

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.

Reimplemented in TGo4ExampleClient.

Definition at line 161 of file TGo4ClientTask.cxx.

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

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

Member Data Documentation

◆ fbAutoConnect

Bool_t TGo4ClientTask::fbAutoConnect {kFALSE}
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 132 of file TGo4ClientTask.h.

Referenced by Initialization().

◆ fbServerConnected

Bool_t TGo4ClientTask::fbServerConnected {kFALSE}
private

true if connection to server is established, otherwise false

Definition at line 137 of file TGo4ClientTask.h.

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

◆ fxCommandQ

TGo4BufferQueue* TGo4ClientTask::fxCommandQ {nullptr}
private

Definition at line 117 of file TGo4ClientTask.h.

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

◆ fxDataQ

TGo4BufferQueue* TGo4ClientTask::fxDataQ {nullptr}
private

Definition at line 116 of file TGo4ClientTask.h.

Referenced by GetDataQueue(), and TGo4ClientTask().

◆ fxServerHostname

TString TGo4ClientTask::fxServerHostname
private

hostname of server machine

Definition at line 126 of file TGo4ClientTask.h.

Referenced by GetServerHostName(), and TGo4ClientTask().

◆ fxStatusQ

TGo4BufferQueue* TGo4ClientTask::fxStatusQ {nullptr}
private

Definition at line 115 of file TGo4ClientTask.h.

Referenced by GetStatusQueue(), and TGo4ClientTask().

◆ fxTaskHandler

TGo4TaskHandler* TGo4ClientTask::fxTaskHandler {nullptr}
private

The documentation for this class was generated from the following files: