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

TGo4HistogramServer Class Reference

Handles a histogram server (mbs histogram protocol) for the histograms registered in the analysis. More...

#include <TGo4HistogramServer.h>

Inheritance diagram for TGo4HistogramServer:

TGo4CommandReceiver List of all members.

Public Member Functions

virtual ~TGo4HistogramServer ()
 TGo4HistogramServer (TGo4AnalysisClient *owner, const char *servername="localhost", const char *password="go4", Bool_t useobjectserver=kFALSE)
 TGo4HistogramServer ()
Int_t ServeObjectClient ()
 Used by object connector runnable to serve client request.
UInt_t GetObjPort ()
 returns the portnumber for object server connection
virtual Int_t TimerConnect ()
 This method is used by the object connectortimer Notify to connect or disconnect a transportchannel (TSocket) on demand; the connection process itself is handled by the connector runnable.
TGo4AnalysisClientGetAnalysisClient () const
TGo4AnalysisGetAnalysis () const

Static Public Attributes

static const Text_t fgcCONTHREADNAME [] = "HISTOSERV-"
 histogram server connector thread name
static const Text_t fgcOBJTHREADNAME [] = "OBJECTSERV-"
 object server connector thread name
static const Text_t fgcSHUTDOWNNAME [] = "__HServLast__"
 This string is send as histogram name for termination connection.
static const Text_t fgcCOMGETLIST [] = "__OServNamesList__"
 command string for object server nameslist request
static const UInt_t fguTIMERPERIOD = 200
 Period of connector timer, in ms.
static const Int_t fgiOPENWAITCYCLES = 100
 Maximum cycles to wait until transport is open.
static const UInt_t fguOPENWAITCYCLETIME = 500
 Time for each open wait cycle, in ms.
static const Int_t fgiCLOSEWAITCYCLES = 100
 Maximum cycles to wait until transport is closed.
static const UInt_t fguCLOSEWAITCYCLETIME = 500
 Time for each close wait cycle, in ms.
static const Int_t fgiCONNECTWAITCYCLES = 20
 Maximum cycles to wait until transport is connected.
static const UInt_t fguCONNECTWAITCYCLETIME = 500
 Time for each connect wait cycle, in ms.

Private Member Functions

const char * ConnectorName () const
const char * ObjectThreadName () const
const char * ConnectHost () const
void SetConnect (TGo4Socket *trans, const char *host, UInt_t port)
void SetDisConnect (TGo4Socket *trans)
Int_t WaitForOpen ()
Int_t WaitForClose ()
Int_t WaitForConnection ()
void DisconnectObjectClient ()
 Terminate connection to current object client, keep waiting for the next one.
Bool_t CheckLogin ()
 Checks basename and passwd login of connected client.
Int_t ConnectObjectClient ()
 Starts server socket waiting for the next client.
Bool_t HandleObjectRequest ()
 Ask for which object to send and give it to the client.
Bool_t SendObject (TObject *obj)
 Send object to the current object client.

Private Attributes

TGo4AnalysisClientfxAnalysisClient
TGo4AnalysisfxAnalysis
TGo4ThreadHandlerfxThreadHandler
TString fxServerName
 contains api server name
TString fxServerPass
 contains api server password
TString fxConnectorName
 Name of connector thread.
TString fxObjectThreadName
 Name of object server thread.
Int_t fiServerPort
 port number for server socket
TGo4SocketfxTransport
 socket for object server
UInt_t fuObjectPort
 port number for the object server connections
TGo4SocketfxConnectTransport
 link to the next TaskHandler transport instance that shall be connected by the Object connector Timer with the client
TGo4SocketfxDisConnectTransport
 link to the next TaskHandler transport instance that shall be disconnected by the connector Timer with the client
TString fcConnectHost
 hostname for timer connect
UInt_t fuConnectPort
 port number for timer connect
Bool_t fbConnectRequest
 True if fxConnectTransport shall be Open() by Timer.
Bool_t fbDisConnectRequest
 True if fxConnectTransport shall be Close() by Timer.
Bool_t fbConnectIsOpen
 True if fxConnectTransport waits in server Open() call.
Bool_t fbConnectIsDone
 True if fxConnectTransport has returned from Open(), i.e.
Bool_t fbConnectIsClose
 True if fxConnectTransport has returned from Close(), i.e.
TGo4ObjConnectorTimerfxConnectorTimer
 timer responsible for the connection/disconnection of clients; independent of application control timer 1
Bool_t fbUseObjectServer
 Switches Go4 objectserver option on/off.

Friends

class TGo4HisConnectorRunnable

Detailed Description

Handles a histogram server (mbs histogram protocol) for the histograms registered in the analysis.

Optionally, object server for root may be started using Go4 protocoll style. This was disabled for V3 by default 09/2005

Author:
J. Adamczewski
Since:
23-Sep-2002, reduced 14-Jan-2003

Definition at line 37 of file TGo4HistogramServer.h.


Constructor & Destructor Documentation

TGo4HistogramServer::~TGo4HistogramServer  )  [virtual]
 

remove and delete the objectserver thread:

Definition at line 151 of file TGo4HistogramServer.cxx.

References TGo4Socket::Close(), ConnectorName(), f_his_close(), f_his_gethis(), fbUseObjectServer, fgcSHUTDOWNNAME, fiServerPort, fxConnectorTimer, fxServerName, fxServerPass, fxThreadHandler, fxTransport, ObjectThreadName(), TGo4ThreadHandler::RemoveThread(), TGo4ThreadHandler::Stop(), and TGo4CommandInvoker::UnRegister().

TGo4HistogramServer::TGo4HistogramServer TGo4AnalysisClient owner,
const char *  servername = "localhost",
const char *  password = "go4",
Bool_t  useobjectserver = kFALSE
 

Definition at line 60 of file TGo4HistogramServer.cxx.

References COMM__SUCCESS, ConnectorName(), f_his_server(), fbUseObjectServer, fgcCONTHREADNAME, fgcOBJTHREADNAME, fguTIMERPERIOD, fiServerPort, fxAnalysis, fxAnalysisClient, fxConnectorName, fxConnectorTimer, fxObjectThreadName, fxServerName, fxServerPass, fxThreadHandler, fxTransport, TGo4AnalysisClient::GetAnalysis(), TGo4TaskOwner::GetName(), TGo4Slave::GetThreadHandler(), TGo4Analysis::Instance(), TGo4CommandInvoker::Instance(), TGo4ThreadHandler::NewThread(), ObjectThreadName(), TGo4CommandInvoker::Register(), TGo4ThreadHandler::Start(), and TGo4HisConnectorRunnable.

TGo4HistogramServer::TGo4HistogramServer  ) 
 

Definition at line 138 of file TGo4HistogramServer.cxx.

References TGo4CommandInvoker::Instance(), and TGo4CommandInvoker::Register().


Member Function Documentation

Int_t TGo4HistogramServer::ServeObjectClient  ) 
 

Used by object connector runnable to serve client request.

Definition at line 195 of file TGo4HistogramServer.cxx.

References CheckLogin(), ConnectObjectClient(), DisconnectObjectClient(), and HandleObjectRequest().

Referenced by TGo4ObjConnectorRunnable::Run().

UInt_t TGo4HistogramServer::GetObjPort  ) 
 

returns the portnumber for object server connection

Definition at line 573 of file TGo4HistogramServer.cxx.

References fuObjectPort, fxTransport, and TGo4Socket::GetPort().

Referenced by ConnectObjectClient().

Int_t TGo4HistogramServer::TimerConnect  )  [virtual]
 

This method is used by the object connectortimer Notify to connect or disconnect a transportchannel (TSocket) on demand; the connection process itself is handled by the connector runnable.

Definition at line 406 of file TGo4HistogramServer.cxx.

References TGo4Socket::Close(), ConnectHost(), fbConnectIsClose, fbConnectIsDone, fbConnectIsOpen, fbConnectRequest, fbDisConnectRequest, fuConnectPort, fxConnectTransport, fxDisConnectTransport, TGo4Socket::IsOpen(), TGo4Socket::Open(), and TRACE.

Referenced by TGo4ObjConnectorTimer::Notify().

TGo4AnalysisClient* TGo4HistogramServer::GetAnalysisClient  )  const [inline]
 

Definition at line 63 of file TGo4HistogramServer.h.

References fxAnalysisClient.

TGo4Analysis* TGo4HistogramServer::GetAnalysis  )  const [inline]
 

Definition at line 65 of file TGo4HistogramServer.h.

References fxAnalysis.

Referenced by TGo4HisConnectorRunnable::Run().

const char* TGo4HistogramServer::ConnectorName  )  const [inline, private]
 

Definition at line 102 of file TGo4HistogramServer.h.

References fxConnectorName.

Referenced by TGo4HistogramServer(), and ~TGo4HistogramServer().

const char* TGo4HistogramServer::ObjectThreadName  )  const [inline, private]
 

Definition at line 104 of file TGo4HistogramServer.h.

References fxObjectThreadName.

Referenced by TGo4HistogramServer(), and ~TGo4HistogramServer().

const char* TGo4HistogramServer::ConnectHost  )  const [inline, private]
 

Definition at line 106 of file TGo4HistogramServer.h.

References fcConnectHost.

Referenced by TimerConnect().

void TGo4HistogramServer::SetConnect TGo4Socket trans,
const char *  host,
UInt_t  port
[private]
 

Definition at line 390 of file TGo4HistogramServer.cxx.

References fbConnectRequest, fcConnectHost, fuConnectPort, fxConnectTransport, and TRACE.

Referenced by ConnectObjectClient().

void TGo4HistogramServer::SetDisConnect TGo4Socket trans  )  [private]
 

Definition at line 399 of file TGo4HistogramServer.cxx.

References fbDisConnectRequest, fxDisConnectTransport, and TRACE.

Referenced by DisconnectObjectClient().

Int_t TGo4HistogramServer::WaitForOpen  )  [private]
 

Definition at line 488 of file TGo4HistogramServer.cxx.

References fbConnectIsOpen, fgiOPENWAITCYCLES, fguOPENWAITCYCLETIME, fxAnalysisClient, TGo4TaskOwner::GetTask(), TGo4ThreadManager::IsTerminating(), TGo4Thread::Sleep(), and TRACE.

Referenced by ConnectObjectClient().

Int_t TGo4HistogramServer::WaitForClose  )  [private]
 

Definition at line 520 of file TGo4HistogramServer.cxx.

References fbConnectIsClose, fgiCLOSEWAITCYCLES, fguCLOSEWAITCYCLETIME, TGo4Thread::Sleep(), and TRACE.

Referenced by DisconnectObjectClient().

Int_t TGo4HistogramServer::WaitForConnection  )  [private]
 

Definition at line 546 of file TGo4HistogramServer.cxx.

References fbConnectIsDone, fguCONNECTWAITCYCLETIME, fxAnalysisClient, TGo4TaskOwner::GetTask(), TGo4ThreadManager::IsTerminating(), TGo4Thread::Sleep(), and TRACE.

Referenced by ConnectObjectClient().

void TGo4HistogramServer::DisconnectObjectClient  )  [private]
 

Terminate connection to current object client, keep waiting for the next one.

Definition at line 207 of file TGo4HistogramServer.cxx.

References fxTransport, SetDisConnect(), and WaitForClose().

Referenced by CheckLogin(), and ServeObjectClient().

Bool_t TGo4HistogramServer::CheckLogin  )  [private]
 

Checks basename and passwd login of connected client.

Definition at line 277 of file TGo4HistogramServer.cxx.

References DisconnectObjectClient(), fxServerName, fxServerPass, fxTransport, TGo4TaskHandler::Get_fgcERROR(), TGo4TaskHandler::Get_fgcOK(), TGo4Socket::RecvRaw(), and TGo4Socket::Send().

Referenced by ServeObjectClient().

Int_t TGo4HistogramServer::ConnectObjectClient  )  [private]
 

Starts server socket waiting for the next client.

Definition at line 216 of file TGo4HistogramServer.cxx.

References TGo4Log::Debug(), fuObjectPort, fxAnalysisClient, fxServerName, fxTransport, TGo4TaskHandler::Get_fgiPORTWAITCYCLES(), TGo4TaskHandler::Get_fguPORTWAITTIME(), GetObjPort(), TGo4TaskOwner::GetTask(), TGo4Analysis::Instance(), TGo4ThreadManager::IsTerminating(), SetConnect(), TGo4Thread::Sleep(), WaitForConnection(), and WaitForOpen().

Referenced by ServeObjectClient().

Bool_t TGo4HistogramServer::HandleObjectRequest  )  [private]
 

Ask for which object to send and give it to the client.

Definition at line 315 of file TGo4HistogramServer.cxx.

References fgcCOMGETLIST, TGo4ThreadManager::fguTEXTLENGTH, fxAnalysis, fxTransport, TGo4Analysis::GetNamesList(), TGo4Analysis::GetObject(), TGo4Socket::RecvRaw(), SendObject(), and TGo4Analysis::UpdateNamesList().

Referenced by ServeObjectClient().

Bool_t TGo4HistogramServer::SendObject TObject *  obj  )  [private]
 

Send object to the current object client.

Protocol matches TGo4ObjectClient::ReceiveObject()

Definition at line 347 of file TGo4HistogramServer.cxx.

References TGo4Log::Debug(), fxTransport, TGo4TaskHandler::Get_fgcERROR(), TGo4TaskHandler::Get_fgcOK(), TGo4Socket::RecvRaw(), TGo4Socket::Send(), TGo4Socket::SendBuffer(), and TGo4Buffer.

Referenced by HandleObjectRequest().


Friends And Related Function Documentation

friend class TGo4HisConnectorRunnable [friend]
 

Definition at line 39 of file TGo4HistogramServer.h.

Referenced by TGo4HistogramServer().


Member Data Documentation

const Text_t TGo4HistogramServer::fgcCONTHREADNAME = "HISTOSERV-" [static]
 

histogram server connector thread name

Definition at line 47 of file TGo4HistogramServer.cxx.

Referenced by TGo4HistogramServer().

const Text_t TGo4HistogramServer::fgcOBJTHREADNAME = "OBJECTSERV-" [static]
 

object server connector thread name

Definition at line 51 of file TGo4HistogramServer.cxx.

Referenced by TGo4HistogramServer().

const Text_t TGo4HistogramServer::fgcSHUTDOWNNAME = "__HServLast__" [static]
 

This string is send as histogram name for termination connection.

Definition at line 48 of file TGo4HistogramServer.cxx.

Referenced by TGo4HisConnectorRunnable::Run(), and ~TGo4HistogramServer().

const Text_t TGo4HistogramServer::fgcCOMGETLIST = "__OServNamesList__" [static]
 

command string for object server nameslist request

Definition at line 49 of file TGo4HistogramServer.cxx.

Referenced by HandleObjectRequest(), and TGo4ObjClient::RequestNamesList().

const UInt_t TGo4HistogramServer::fguTIMERPERIOD = 200 [static]
 

Period of connector timer, in ms.

Definition at line 52 of file TGo4HistogramServer.cxx.

Referenced by TGo4HistogramServer().

const Int_t TGo4HistogramServer::fgiOPENWAITCYCLES = 100 [static]
 

Maximum cycles to wait until transport is open.

Definition at line 53 of file TGo4HistogramServer.cxx.

Referenced by WaitForOpen().

const UInt_t TGo4HistogramServer::fguOPENWAITCYCLETIME = 500 [static]
 

Time for each open wait cycle, in ms.

Definition at line 54 of file TGo4HistogramServer.cxx.

Referenced by WaitForOpen().

const Int_t TGo4HistogramServer::fgiCLOSEWAITCYCLES = 100 [static]
 

Maximum cycles to wait until transport is closed.

Definition at line 55 of file TGo4HistogramServer.cxx.

Referenced by WaitForClose().

const UInt_t TGo4HistogramServer::fguCLOSEWAITCYCLETIME = 500 [static]
 

Time for each close wait cycle, in ms.

Definition at line 56 of file TGo4HistogramServer.cxx.

Referenced by WaitForClose().

const Int_t TGo4HistogramServer::fgiCONNECTWAITCYCLES = 20 [static]
 

Maximum cycles to wait until transport is connected.

Definition at line 57 of file TGo4HistogramServer.cxx.

const UInt_t TGo4HistogramServer::fguCONNECTWAITCYCLETIME = 500 [static]
 

Time for each connect wait cycle, in ms.

Definition at line 58 of file TGo4HistogramServer.cxx.

Referenced by WaitForConnection().

TGo4AnalysisClient* TGo4HistogramServer::fxAnalysisClient [private]
 

Definition at line 134 of file TGo4HistogramServer.h.

Referenced by ConnectObjectClient(), GetAnalysisClient(), TGo4HistogramServer(), WaitForConnection(), and WaitForOpen().

TGo4Analysis* TGo4HistogramServer::fxAnalysis [private]
 

Definition at line 135 of file TGo4HistogramServer.h.

Referenced by GetAnalysis(), HandleObjectRequest(), and TGo4HistogramServer().

TGo4ThreadHandler* TGo4HistogramServer::fxThreadHandler [private]
 

Definition at line 136 of file TGo4HistogramServer.h.

Referenced by TGo4HistogramServer(), and ~TGo4HistogramServer().

TString TGo4HistogramServer::fxServerName [private]
 

contains api server name

Definition at line 139 of file TGo4HistogramServer.h.

Referenced by CheckLogin(), ConnectObjectClient(), TGo4HistogramServer(), and ~TGo4HistogramServer().

TString TGo4HistogramServer::fxServerPass [private]
 

contains api server password

Definition at line 142 of file TGo4HistogramServer.h.

Referenced by CheckLogin(), TGo4HistogramServer(), and ~TGo4HistogramServer().

TString TGo4HistogramServer::fxConnectorName [private]
 

Name of connector thread.

Definition at line 145 of file TGo4HistogramServer.h.

Referenced by ConnectorName(), and TGo4HistogramServer().

TString TGo4HistogramServer::fxObjectThreadName [private]
 

Name of object server thread.

Definition at line 148 of file TGo4HistogramServer.h.

Referenced by ObjectThreadName(), and TGo4HistogramServer().

Int_t TGo4HistogramServer::fiServerPort [private]
 

port number for server socket

Definition at line 151 of file TGo4HistogramServer.h.

Referenced by TGo4HistogramServer(), and ~TGo4HistogramServer().

TGo4Socket* TGo4HistogramServer::fxTransport [private]
 

socket for object server

Definition at line 154 of file TGo4HistogramServer.h.

Referenced by CheckLogin(), ConnectObjectClient(), DisconnectObjectClient(), GetObjPort(), HandleObjectRequest(), SendObject(), TGo4HistogramServer(), and ~TGo4HistogramServer().

UInt_t TGo4HistogramServer::fuObjectPort [private]
 

port number for the object server connections

Definition at line 157 of file TGo4HistogramServer.h.

Referenced by ConnectObjectClient(), and GetObjPort().

TGo4Socket* TGo4HistogramServer::fxConnectTransport [private]
 

link to the next TaskHandler transport instance that shall be connected by the Object connector Timer with the client

Definition at line 161 of file TGo4HistogramServer.h.

Referenced by SetConnect(), and TimerConnect().

TGo4Socket* TGo4HistogramServer::fxDisConnectTransport [private]
 

link to the next TaskHandler transport instance that shall be disconnected by the connector Timer with the client

Definition at line 165 of file TGo4HistogramServer.h.

Referenced by SetDisConnect(), and TimerConnect().

TString TGo4HistogramServer::fcConnectHost [private]
 

hostname for timer connect

Definition at line 168 of file TGo4HistogramServer.h.

Referenced by ConnectHost(), and SetConnect().

UInt_t TGo4HistogramServer::fuConnectPort [private]
 

port number for timer connect

Definition at line 171 of file TGo4HistogramServer.h.

Referenced by SetConnect(), and TimerConnect().

Bool_t TGo4HistogramServer::fbConnectRequest [private]
 

True if fxConnectTransport shall be Open() by Timer.

Definition at line 174 of file TGo4HistogramServer.h.

Referenced by SetConnect(), and TimerConnect().

Bool_t TGo4HistogramServer::fbDisConnectRequest [private]
 

True if fxConnectTransport shall be Close() by Timer.

Definition at line 177 of file TGo4HistogramServer.h.

Referenced by SetDisConnect(), and TimerConnect().

Bool_t TGo4HistogramServer::fbConnectIsOpen [private]
 

True if fxConnectTransport waits in server Open() call.

Definition at line 180 of file TGo4HistogramServer.h.

Referenced by TimerConnect(), and WaitForOpen().

Bool_t TGo4HistogramServer::fbConnectIsDone [private]
 

True if fxConnectTransport has returned from Open(), i.e.

connection was established

Definition at line 184 of file TGo4HistogramServer.h.

Referenced by TimerConnect(), and WaitForConnection().

Bool_t TGo4HistogramServer::fbConnectIsClose [private]
 

True if fxConnectTransport has returned from Close(), i.e.

connection was closed

Definition at line 188 of file TGo4HistogramServer.h.

Referenced by TimerConnect(), and WaitForClose().

TGo4ObjConnectorTimer* TGo4HistogramServer::fxConnectorTimer [private]
 

timer responsible for the connection/disconnection of clients; independent of application control timer 1

Definition at line 194 of file TGo4HistogramServer.h.

Referenced by TGo4HistogramServer(), and ~TGo4HistogramServer().

Bool_t TGo4HistogramServer::fbUseObjectServer [private]
 

Switches Go4 objectserver option on/off.

Definition at line 197 of file TGo4HistogramServer.h.

Referenced by TGo4HistogramServer(), and ~TGo4HistogramServer().


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