QDaqServer Class Reference

List of all members.

Detailed Description

the object that does the real work through the command visitors

Author:
Marco Pallavicini

sergio.didomizio@ge.infn.it


Public Member Functions

virtual ~QDaqServer ()
 dtor
const QDaqState GetState () const
 get current daq state
int GetCurrentRun () const
 get current run number
bool SetTriggerFlag (const unsigned int crateId, const bool flag)
bool StartProcesses (int settingsBasket, int run, int shifterSet)
bool Pause ()
bool Resume ()
bool Stop (int shifterSet)
void ResetError ()
bool HasError () const
const QErrorGetError () const

Static Public Member Functions

static QDaqServerGetInstance ()
 singleton getter

Private Member Functions

 QDaqServer ()
 private constructor
bool StartRun ()
 send start signal to readers, senders and receivers
bool Abort ()
 kill all non server processes that are known to be running
void SetState (const QDaqState &s)
 set daq state
bool StartMuonReader (const std::string &address)
 start muon reader process
bool StartPulserController (const std::string &address)
 start muon pulser controller process
bool StartReader (int crateId, const std::string &address, int extClock)
 start DataReader process
bool StartSender (int crateId, const std::string &address)
 start DataSender process
bool StartReceiver (int crateId)
 start DataReceiver process
bool StartBuilder ()
 start Builder process
bool StartProcess (const std::string &process, const std::string &address, const std::string &options, ProcessStatus_t status)
 start a process on a certain host
bool KillProcess (const std::string &process, const std::string &host, const std::string &signal)
bool KillProcess (const std::string &process, const std::string &host, const std::string &signal, const std::string &killOpts)
ProcessStatus_t AskStatus (const std::string &process)
bool CheckStatus (const std::string &process, ProcessStatus_t status, float timeout)
 check real process status again supplied status code
bool Unregistered (const std::string &process, float timeout)
 wait for a process to unregister from message logger server
ProcessStatus_t GetStatusCode (const std::string &message)
 convert message server answer to corresponding status code
void Clear ()
const char * GetDateString () const

Private Attributes

QDaqState fDaqState
int fSettingsBasket
int fRun
std::string fDaqUser
std::string fPathBin
std::string fPathLog
std::string fReceiverAddr
std::string fPulserAddr
std::string fLoggerAddr
std::string fLoggerPort
std::string fDianaCfg
std::string fEnvFile
int ReceiverBasePort
bool fUseMuonReader
bool fUsePulser
bool fUseBuilder
bool fReleaseReceiver
bool fSaveChannels
int fSimulaHardware
const float fTimeOut
bool fBuilderIsRunning
bool fPulserControllerIsRunning
bool fMuonReaderIsRunning
QError fError
std::map< std::string, std::string > fReaders
std::map< std::string, std::string > fSenders
std::vector< std::string > fReceivers


Member Function Documentation

bool QDaqServer::StartRun (  )  [private]

send start signal to readers, senders and receivers

Returns:
true on success or false if any of the involved processes fail to switch to running status

bool QDaqServer::Abort (  )  [private]

kill all non server processes that are known to be running

Returns:
true on success or false on failure
Builder, MuonReader and PulserController are killed by a single signal, while readers, senders and receivers need 2 signals to be killed: a stop signal and the actual kill signal. If all processes are killed succesfully the daq server status is set to Q_Idle_State and Clear() is called. If any of the processes fails to stop server status is set to Q_Unknown_State.

bool QDaqServer::StartMuonReader ( const std::string &  address  )  [private]

start muon reader process

Parameters:
address network address of the computer on which the muon reader is to be started
Returns:
true if process has started succesfully, false in case of error. In case of error, fError is set.

bool QDaqServer::StartPulserController ( const std::string &  address  )  [private]

start muon pulser controller process

Parameters:
address network address of the computer on which the pulser controller is to be started
Returns:
true if process has started succesfully, false in case of error. In case of error, fError is set.

bool QDaqServer::StartReader ( int  crateId,
const std::string &  address,
int  extClock 
) [private]

start DataReader process

Parameters:
crateId id of the crate connected to the reader to be started
addres network address of the computer hosting the reader
extClock whether or not to use external clock for data acquisition
Returns:
true on success, false on failure
Format process name and options and call StartProcess(). If StartProcess() succeeds the new reader is added to fReaders map.

bool QDaqServer::StartSender ( int  crateId,
const std::string &  address 
) [private]

start DataSender process

Parameters:
crateId id of the reader associated to the sender to be started
addres network address of the computer hosting the sender
Returns:
true on success, false on failure
Format process name and options and call StartProcess(). If StartProcess() succeeds the new sender is added to fSenders map.

bool QDaqServer::StartReceiver ( int  crateId  )  [private]

start DataReceiver process

Parameters:
crateId id of the sender associated to the receiver to be started
Returns:
true on success, false on failure
Format process name and options and call StartProcess(). If StartProcess() succeeds the new sender is added to fReceivers vector.

bool QDaqServer::StartBuilder (  )  [private]

start Builder process

Returns:
true on success, false on failure
Format options and call StartProcess(). If StartProcess() succeeds fBuilderIsRunning is set to true

bool QDaqServer::StartProcess ( const std::string &  process,
const std::string &  address,
const std::string &  options,
ProcessStatus_t  status 
) [private]

start a process on a certain host

Parameters:
process name of the process to be started
address network address of the host where the process will be started
options string containing command line options that will be passed to the process
status expected status that the newly started process will have
Returns:
true on success, false on failure. In case of failure fError is set.

bool QDaqServer::CheckStatus ( const std::string &  process,
ProcessStatus_t  status,
float  timeout 
) [private]

check real process status again supplied status code

Parameters:
process process for which status is checked
status status code against which real process status is compared
timeout time to wait before giving up and returning false
Returns:
true as soon as a AskStatus call matches status; false if status is not matched before timeout expires or if an error occurred in the message logger client. In this second case fError is set to the error occurred in the client

bool QDaqServer::Unregistered ( const std::string &  process,
float  timeout 
) [private]

wait for a process to unregister from message logger server

Parameters:
process process to be checked
timeout time to wait before giving up and returning false
Returns:
true as soon as process unregistered; false if process does not unregister before timeout expires or if an error occurred in the message logger client. In this second case fError is set to the error occurred in the client

ProcessStatus_t QDaqServer::GetStatusCode ( const std::string &  message  )  [private]

convert message server answer to corresponding status code

Parameters:
message answer to be converted
Returns:
status code or -1 in case of failure


Member Data Documentation

QDaqState QDaqServer::fDaqState [private]

current daq status

int QDaqServer::fSettingsBasket [private]

settings basket identifier

int QDaqServer::fRun [private]

run number

std::string QDaqServer::fDaqUser [private]

username for ssh connections

std::string QDaqServer::fPathBin [private]

path to binaries

std::string QDaqServer::fPathLog [private]

path to log files

std::string QDaqServer::fReceiverAddr [private]

DataReceiver host name

std::string QDaqServer::fPulserAddr [private]

PulserController host name

std::string QDaqServer::fLoggerAddr [private]

message server address

std::string QDaqServer::fLoggerPort [private]

message server port

std::string QDaqServer::fDianaCfg [private]

Builder config file name

std::string QDaqServer::fEnvFile [private]

file containing environment variables

int QDaqServer::ReceiverBasePort [private]

base value for receiver listen port

bool QDaqServer::fUseMuonReader [private]

whether or not muon reader is in use

bool QDaqServer::fUsePulser [private]

whether or not pulser controller is in use

bool QDaqServer::fUseBuilder [private]

whether or not event builder is in use

bool QDaqServer::fReleaseReceiver [private]

whether or not to release data in receiver

bool QDaqServer::fSaveChannels [private]

whether or not to save continuous data stream

int QDaqServer::fSimulaHardware [private]

whether or not to simulate hardware for DAQ

const float QDaqServer::fTimeOut [private]

timeout for CheckStatus() method

bool QDaqServer::fBuilderIsRunning [private]

true if Builder is running

bool QDaqServer::fPulserControllerIsRunning [private]

true if PulserController is running

bool QDaqServer::fMuonReaderIsRunning [private]

true if MuonReader is running

QError QDaqServer::fError [private]

stores error informations in case of failure

std::map<std::string,std::string> QDaqServer::fReaders [private]

map of running reader processes and corresponding network host

std::map<std::string,std::string> QDaqServer::fSenders [private]

map of running sender processes and corresponding network host

std::vector<std::string> QDaqServer::fReceivers [private]

vector of running receiver processes


The documentation for this class was generated from the following files:
Generated on Fri Mar 6 13:40:42 2009 for CUORE Software by  doxygen 1.5.1