Public Member Functions | |
virtual | ~QBaseClient () |
destructor | |
void | SetConnectionMode (bool alwaysOpen) |
set connection mode | |
bool | GetConnectionMode () const |
get connection mode | |
const QError & | GetError () 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 |
QBaseClient::QBaseClient | ( | const std::string & | serverType | ) | [protected] |
constructor with default addres and port (from environment variables)
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
address | server address connection port |
void QBaseClient::SetConnectionMode | ( | bool | alwaysOpen | ) | [inline] |
set connection mode
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
References fConnMode.
bool QBaseClient::GetInt | ( | const std::string & | name, | |
int & | val | |||
) | [protected] |
get int parameter
val | is filled with value of requested parameter |
References fAnswerMap, IsParamDefined(), QError::Set(), and QStringHandler::StringToInt().
Referenced by QSlowControlClient::GetBasket(), QSlowControlClient::GetBSCutFreq(), QDaqClient::GetCurrentRunNumber(), QSlowControlClient::GetEleRegister(), QSlowControlClient::GetFEBias(), QSlowControlClient::GetFEGain(), QSlowControlClient::GetFEOffsetDAC(), QSlowControlClient::GetFEOffsetMSB(), QSlowControlClient::GetFETestSignal(), QMsgClient::GetFirstMessageId(), QMsgClient::GetLastMessageId(), QMsgClient::GetMessage(), QMsgClient::GetMessageIdByTime(), QSlowControlClient::GetPulserRegister(), and QMsgClient::GetRegisteredProcesses().
bool QBaseClient::GetBool | ( | const std::string & | name, | |
bool & | val | |||
) | [protected] |
get bool parameter
val | is filled with value of requested parameter |
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
val | is filled with value of requested parameter |
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
val | is filled with value of requested parameter |
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
References fAnswerMap, and IsParamDefined().
Referenced by QMsgClient::GetRegisteredProcesses().
bool QBaseClient::ExecCommand | ( | const QNwMessageBuilder & | builder, | |
std::string & | answer | |||
) | [protected] |
execute command contained in builder
builder | QNwMessageBuilder object containing requested command | |
answer | is filled with server answer |
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().
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().