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

#include <TGo4Slave.h>

+ Inheritance diagram for TGo4Slave:

Public Member Functions

 TGo4Slave ()
 
 TGo4Slave (const char *name, Bool_t isserver=kTRUE, const char *serverhost="localhost", UInt_t negotport=5000)
 
virtual ~TGo4Slave ()
 
virtual void Start ()
 
virtual void Stop ()
 
virtual void KillMain ()
 
virtual void RestartMain ()
 
virtual void Terminate (Bool_t termapp=kTRUE)
 
virtual void TerminateFast ()
 
virtual TGo4TaskStatusCreateStatus ()
 
Bool_t MainIsRunning () const
 
TGo4CommandNextCommand ()
 
void SendObject (TObject *obj, const char *receiver=nullptr)
 
void SendStatus (TGo4Status *stat, const char *receiver=nullptr)
 
virtual Int_t Initialization ()
 
TGo4ThreadHandlerGetThreadHandler ()
 
void SendStatusBuffer ()
 
virtual void SendStatusMessage (Int_t level, Bool_t printout, const TString &text)
 
void UpdateStatusBuffer ()
 
virtual void ExecuteString (const char *command)
 
- Public Member Functions inherited from TGo4TaskOwner
 TGo4TaskOwner ()
 
 TGo4TaskOwner (Bool_t isserver)
 
virtual ~TGo4TaskOwner ()
 
Bool_t IsServer () const
 
TGo4TaskGetTask () const
 
virtual Int_t StartWorkThreads ()
 
virtual Int_t StopWorkThreads ()
 
virtual void Quit ()
 
const char * GetName () const
 
Bool_t IsConnected ()
 
Bool_t IsBeingQuit ()
 
TMutex * GetTaskManagerMutex ()
 
- Public Member Functions inherited from TGo4CommandReceiver
 TGo4CommandReceiver ()
 
virtual ~TGo4CommandReceiver ()
 

Protected Member Functions

virtual void UpdateStatus (TGo4TaskStatus *state)
 
- Protected Member Functions inherited from TGo4TaskOwner
void SetTask (TGo4Task *task, Bool_t delold=kTRUE)
 

Private Attributes

Bool_t fbMainIsRunning {kFALSE}
 

Detailed Description

Baseclass for all slave process entities. A Slave receives commands and may send data and status objects via the TGo4Task connection. This can run either as server or client task.

Definition at line 30 of file TGo4Slave.h.

Constructor & Destructor Documentation

◆ TGo4Slave() [1/2]

TGo4Slave::TGo4Slave ( )

Definition at line 53 of file TGo4Slave.cxx.

◆ TGo4Slave() [2/2]

TGo4Slave::TGo4Slave ( const char *  name,
Bool_t  isserver = kTRUE,
const char *  serverhost = "localhost",
UInt_t  negotport = 5000 
)

◆ ~TGo4Slave()

TGo4Slave::~TGo4Slave ( )
virtual

Definition at line 57 of file TGo4Slave.cxx.

References TGo4CommandInvoker::UnRegister().

Member Function Documentation

◆ CreateStatus()

TGo4TaskStatus * TGo4Slave::CreateStatus ( )
virtual

create a status object with information on the current (slave) task. this object may be sent to the master or may be used to restore current status by memento mechanism

Reimplemented in TGo4AnalysisClient.

Definition at line 97 of file TGo4Slave.cxx.

References TGo4TaskOwner::GetName(), and UpdateStatus().

Referenced by TGo4Task::UpdateStatusBuffer().

◆ ExecuteString()

void TGo4Slave::ExecuteString ( const char *  command)
virtual

Execute string command. Uses gInterpreter by default. May be overridden to evaluate go4 command strings in subclass.

Reimplemented in TGo4AnalysisClient.

Definition at line 157 of file TGo4Slave.cxx.

Referenced by TGo4Task::ExecuteString(), and MainIsRunning().

◆ GetThreadHandler()

TGo4ThreadHandler * TGo4Slave::GetThreadHandler ( )

◆ Initialization()

Int_t TGo4Slave::Initialization ( )
virtual

Overrides the ThreadManager Initialization; is used to setup the client connections on demand; checks for fbConnectRequest flag

Reimplemented in TGo4AnalysisClient.

Definition at line 127 of file TGo4Slave.cxx.

Referenced by TGo4Task::Initialization(), and MainIsRunning().

◆ KillMain()

void TGo4Slave::KillMain ( )
virtual

Kill the main thread; method to be called from command, should be overridden in user implementation

Reimplemented in TGo4AnalysisClient.

Definition at line 76 of file TGo4Slave.cxx.

Referenced by TGo4Task::KillMain().

◆ MainIsRunning()

Bool_t TGo4Slave::MainIsRunning ( ) const
inline

◆ NextCommand()

TGo4Command * TGo4Slave::NextCommand ( )

Delivers next command from command queue.

Definition at line 110 of file TGo4Slave.cxx.

References TGo4TaskOwner::GetTask(), and TGo4Task::NextCommand().

Referenced by MainIsRunning(), and TGo4AnalysisMainRunnable::Run().

◆ RestartMain()

void TGo4Slave::RestartMain ( )
virtual

Restart the main thread; method to be called from command, should be overridden in user implementation

Reimplemented in TGo4AnalysisClient.

Definition at line 81 of file TGo4Slave.cxx.

Referenced by TGo4Task::RestartMain().

◆ SendObject()

void TGo4Slave::SendObject ( TObject *  obj,
const char *  receiver = nullptr 
)

◆ SendStatus()

void TGo4Slave::SendStatus ( TGo4Status stat,
const char *  receiver = nullptr 
)

Send status object via status channel to the server.

Definition at line 121 of file TGo4Slave.cxx.

References TGo4TaskOwner::GetTask(), and TGo4Task::SendStatus().

Referenced by TGo4ComGetAnalysisStatus::ExeCom(), TGo4ComSetObject::ExeCom(), MainIsRunning(), and TGo4AnalysisClient::SendAnalysisStatus().

◆ SendStatusBuffer()

void TGo4Slave::SendStatusBuffer ( )

Send internal status buffer to the server.

Definition at line 139 of file TGo4Slave.cxx.

References TGo4TaskOwner::GetTask(), and TGo4Task::SendStatusBuffer().

Referenced by MainIsRunning(), and TGo4AnalysisClient::SendAnalysisClientStatus().

◆ SendStatusMessage()

void TGo4Slave::SendStatusMessage ( Int_t  level,
Bool_t  printout,
const TString &  text 
)
virtual

Send message string in a status object to the gui. Will be displayed in status window. Level indicates info, warning or error,

Reimplemented in TGo4AnalysisClient.

Definition at line 145 of file TGo4Slave.cxx.

References TGo4TaskOwner::GetTask(), and TGo4Task::SendStatusMessage().

Referenced by MainIsRunning(), and TGo4AnalysisClient::SendStatusMessage().

◆ Start()

void TGo4Slave::Start ( )
virtual

General start method of slave application to be called from remote command; should be re-implemented by application

Reimplemented in TGo4AnalysisClient.

Definition at line 63 of file TGo4Slave.cxx.

References TGo4Log::Debug(), fbMainIsRunning, and TGo4TaskOwner::GetName().

Referenced by TGo4Task::Start(), and TGo4AnalysisClient::Start().

◆ Stop()

void TGo4Slave::Stop ( )
virtual

General stop method of slave application to be called from remote command; should be re-implemented by application

Reimplemented in TGo4AnalysisClient.

Definition at line 70 of file TGo4Slave.cxx.

References TGo4Log::Debug(), fbMainIsRunning, and TGo4TaskOwner::GetName().

Referenced by TGo4AnalysisClient::Constructor(), TGo4AnalysisClient::Initialization(), TGo4ServerTask::Quit(), TGo4ServerTask::Shutdown(), TGo4Task::Stop(), and TGo4AnalysisClient::Stop().

◆ Terminate()

void TGo4Slave::Terminate ( Bool_t  termapp = kTRUE)
virtual

Reimplemented in TGo4AnalysisClient.

Definition at line 86 of file TGo4Slave.cxx.

References TGo4TaskOwner::GetTask().

Referenced by TGo4Task::Terminate(), and TerminateFast().

◆ TerminateFast()

void TGo4Slave::TerminateFast ( )
virtual

Reimplemented in TGo4AnalysisClient.

Definition at line 92 of file TGo4Slave.cxx.

References Terminate().

Referenced by TGo4TaskHandlerAbortException::Handle(), and TGo4Task::TerminateFast().

◆ UpdateStatus()

void TGo4Slave::UpdateStatus ( TGo4TaskStatus state)
protectedvirtual

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

Reimplemented in TGo4AnalysisClient.

Definition at line 104 of file TGo4Slave.cxx.

References TGo4TaskOwner::GetTask(), and TGo4Task::UpdateStatus().

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

◆ UpdateStatusBuffer()

void TGo4Slave::UpdateStatusBuffer ( )

Create status object and stream it into the status send buffer. To be executed from the main thread; buffer will be send by status thread.

Definition at line 152 of file TGo4Slave.cxx.

References TGo4TaskOwner::GetTask(), and TGo4Task::UpdateStatusBuffer().

Referenced by TGo4AnalysisClient::Constructor(), TGo4AnalysisClient::Initialization(), TGo4Analysis::MainCycle(), MainIsRunning(), TGo4AnalysisWatchRunnable::Run(), TGo4AnalysisClient::Start(), and TGo4AnalysisClient::Stop().

Member Data Documentation

◆ fbMainIsRunning

Bool_t TGo4Slave::fbMainIsRunning {kFALSE}
private

True if analysis main loop is running. If false, the slave main thread will just wait on incoming commands without processing main loop.

Definition at line 37 of file TGo4Slave.h.

Referenced by MainIsRunning(), Start(), and Stop().


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