QBaseClient Class Reference
[Networking]

Inheritance diagram for QBaseClient:

QApolloSocketClient QDaqClient QMsgClient QSlowControlClient

List of all members.


Detailed Description

base class implementing all protocol-related methods common to all network clients involved in apollo.

Author:
sergio.didomizio@ge.infn.it

andrea.giachero@lngs.infn.it


Public Member Functions

virtual ~QBaseClient ()
 destructor
void SetConnectionMode (bool alwaysOpen)
 set connection mode
bool GetConnectionMode () const
 get connection mode
const QErrorGetError () const
 get last error

Protected Member Functions

 QBaseClient (const std::string &serverType)
 constructor with default addres and port (from environment variables)
 QBaseClient (const std::string &address, const std::string &port)
 constructor with server address and port
bool GetInt (const std::string &name, int &val)
 get int parameter
bool GetBool (const std::string &name, bool &val)
 get bool parameter
bool GetDouble (const std::string &name, double &val)
 get double parameter
bool GetString (const std::string &name, std::string &val)
 get string parameter
bool GetParList (const std::string &name, std::list< std::string > &values)
 get list of values associated to parameter name formatted as string
bool IsParamDefined (const std::string &name)
 check whether a parameter named name is defined
bool ExecCommand (const QNwMessageBuilder &builder, std::string &answer)
 execute command contained in builder

Protected Attributes

bool fConnMode
QError fError

Private Member Functions

void ProcessAnswer (std::string answer)
 fill fAnswerMap or set error based on the content of answer string received from server
void BuildError ()
 extract QError from server response

Private Attributes

std::map< std::string,
std::list< std::string > > 
fAnswerMap

Constructor & Destructor Documentation

QBaseClient::QBaseClient ( const std::string &  serverType  )  [protected]

constructor with default addres and port (from environment variables)

Parameters:
serverType string specifying the name of the environment varibles the constructor will search for. Allowed values are "SLOW", for communication with SlowServer, "DAQ", for DaqServer and "MSG" for MsgServer

QBaseClient::QBaseClient ( const std::string &  address,
const std::string &  port 
) [protected]

constructor with server address and port

Parameters:
address server address connection port


Member Function Documentation

void QBaseClient::SetConnectionMode ( bool  alwaysOpen  )  [inline]

set connection mode

Parameters:
alwaysOpen if true, connection is opened when first command is executed and is closed when this object is destroyed. If false, connection is opened and closed every time a command is executed

References fConnMode.

bool QBaseClient::GetConnectionMode (  )  const [inline]

get connection mode

Returns:
connection mode. See SetConnectionMode() documentation to understand the meaning of this parameter

References fConnMode.

bool QBaseClient::GetInt ( const std::string &  name,
int &  val 
) [protected]

bool QBaseClient::GetBool ( const std::string &  name,
bool &  val 
) [protected]

get bool parameter

Parameters:
val is filled with value of requested parameter
Returns:
true on success, false if requested parameter cannot be found in parameters map or if conversion to bool fails
This method returns the first element of the list of values for parameter named name, converted to int

References fAnswerMap, IsParamDefined(), QError::Set(), and QStringHandler::StringToBool().

Referenced by QSlowControlClient::GetBSFilterEnable(), QSlowControlClient::GetFEBiasPolarity(), QSlowControlClient::GetFEInput(), QSlowControlClient::GetFELoadResistor(), QSlowControlClient::GetFEOffsetPolarity(), QSlowControlClient::GetFEOffsetSpecialBit(), and QSlowControlClient::GetPSupplyOutputEnable().

bool QBaseClient::GetDouble ( const std::string &  name,
double &  val 
) [protected]

get double parameter

Parameters:
val is filled with value of requested parameter
Returns:
true on success, false if requested parameter cannot be found in parameters map or if conversion to double fails
This method returns the first element of the list of values for parameter named name

References fAnswerMap, IsParamDefined(), QError::Set(), and QStringHandler::StringToDouble().

Referenced by QSlowControlClient::GetPSupplyIout(), QSlowControlClient::GetPSupplyIset(), QSlowControlClient::GetPSupplyVout(), and QSlowControlClient::GetPSupplyVset().

bool QBaseClient::GetString ( const std::string &  name,
std::string &  val 
) [protected]

get string parameter

Parameters:
val is filled with value of requested parameter
Returns:
true on success, false if requested parameter cannot be found in parameters map
This method returns the first element of the list of values for parameter named name

References fAnswerMap, and IsParamDefined().

Referenced by QDaqClient::GetDaqStatus(), QMsgClient::GetFormattedMessage(), QSlowControlClient::GetInterface(), QMsgClient::GetMessage(), QSlowControlClient::GetMode(), and QMsgClient::GetStatus().

bool QBaseClient::GetParList ( const std::string &  name,
std::list< std::string > &  values 
) [protected]

get list of values associated to parameter name formatted as string

Returns:
true unless parameter name is not defined

References fAnswerMap, and IsParamDefined().

Referenced by QMsgClient::GetRegisteredProcesses().

bool QBaseClient::ExecCommand ( const QNwMessageBuilder builder,
std::string &  answer 
) [protected]

execute command contained in builder

Parameters:
builder QNwMessageBuilder object containing requested command
answer is filled with server answer
Returns:
true on success

References QNwMessageBuilder::BuildMessage(), QApolloSocketClient::Close(), fAnswerMap, fConnMode, QApolloSocketClient::Open(), ProcessAnswer(), QApolloSocketClient::Read(), QError::Set(), and QApolloSocketClient::Write().

Referenced by QSlowControlClient::AdjustFEOffset(), QSlowControlClient::GetBasket(), QSlowControlClient::GetBSCutFreq(), QSlowControlClient::GetBSFilterEnable(), QDaqClient::GetCurrentRunNumber(), QDaqClient::GetDaqStatus(), QSlowControlClient::GetEleRegister(), QSlowControlClient::GetFEBias(), QSlowControlClient::GetFEBiasPolarity(), QSlowControlClient::GetFEGain(), QSlowControlClient::GetFEInput(), QSlowControlClient::GetFELoadResistor(), QSlowControlClient::GetFEOffsetDAC(), QSlowControlClient::GetFEOffsetMSB(), QSlowControlClient::GetFEOffsetPolarity(), QSlowControlClient::GetFEOffsetSpecialBit(), QSlowControlClient::GetFETestSignal(), QMsgClient::GetFirstMessageId(), QMsgClient::GetFormattedMessage(), QSlowControlClient::GetInterface(), QMsgClient::GetLastMessageId(), QMsgClient::GetMessage(), QMsgClient::GetMessageIdByTime(), QSlowControlClient::GetMode(), QSlowControlClient::GetPSupplyIout(), QSlowControlClient::GetPSupplyIset(), QSlowControlClient::GetPSupplyOutputEnable(), QSlowControlClient::GetPSupplyVout(), QSlowControlClient::GetPSupplyVset(), QSlowControlClient::GetPulserRegister(), QMsgClient::GetRegisteredProcesses(), QMsgClient::GetStatus(), QSlowControlClient::LoadDevice(), QMsgClient::RegisterProcess(), QMsgClient::SendLog(), QMsgClient::SendStatus(), QSlowControlClient::SetBaseMode(), QSlowControlClient::SetBSCutFreq(), QSlowControlClient::SetBSFilterEnable(), QSlowControlClient::SetEleRegister(), QSlowControlClient::SetFEBias(), QSlowControlClient::SetFEBiasPolarity(), QSlowControlClient::SetFEGain(), QSlowControlClient::SetFEInput(), QSlowControlClient::SetFELoadResistor(), QSlowControlClient::SetFEOffsetDAC(), QSlowControlClient::SetFEOffsetMSB(), QSlowControlClient::SetFEOffsetPolarity(), QSlowControlClient::SetFEOffsetSpecialBit(), QSlowControlClient::SetFETestSignal(), QSlowControlClient::SetPSupplyIset(), QSlowControlClient::SetPSupplyOutputEnable(), QSlowControlClient::SetPSupplyVset(), QSlowControlClient::SetRunMode(), QSlowControlClient::SetTuningMode(), QSlowControlClient::SetWriteMode(), QDaqClient::StartRun(), QDaqClient::StopRun(), QMsgClient::UnregisterProcess(), and QSlowControlClient::WritePulser().


Member Data Documentation

bool QBaseClient::fConnMode [protected]

connection mode. If true, connection is open when the first command is executed and is closed when this object is destroyed. If false, connection is opened and closed every time a command is executed

Referenced by ExecCommand(), GetConnectionMode(), and SetConnectionMode().

std::map<std::string, std::list<std::string> > QBaseClient::fAnswerMap [private]

map containing command answer
key: parameter name value: list of parameter values formatted as string

Referenced by BuildError(), ExecCommand(), GetBool(), GetDouble(), GetInt(), GetParList(), GetString(), IsParamDefined(), and ProcessAnswer().


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

Generated on Tue Nov 16 10:50:04 2010 for CUORE Software by  doxygen 1.5.6