Public Member Functions | |
QMsgClient () | |
default constructor: server address and port are determined from environment variables. A QError is thrown if they are not set. | |
QMsgClient (const std::string &address, const std::string &port) | |
default constructor | |
virtual | ~QMsgClient () |
destructor | |
bool | RegisterProcess (const std::string &processName, const std::string &host, pid_t processPid) |
register a process to message server | |
bool | UnregisterProcess (const std::string &processName) |
unregister a process previously registered to message server | |
bool | SendStatus (const std::string &processName, QDaqCommonDefs::ProcessStatus_t status) |
inform message server about the status of a process | |
bool | SendLog (const std::string &processName, const std::string &message, MsgLevel level=InfoMsg) |
send log message to message server | |
bool | GetStatus (const std::string &processName, QDaqCommonDefs::ProcessStatus_t &status) |
get current status for a certain process | |
bool | GetRegisteredProcesses (std::list< std::string > &processes) |
get a list of registered processes | |
bool | IsRegistered (const std::string &processName, bool &isReg) |
check whether a certain process is registered | |
bool | GetMessageIdByTime (time_t time, int &id) |
get id of first message logged after a given time | |
bool | GetFirstMessageId (int &id) |
get id associated to the oldest message recorded by the logger | |
bool | GetLastMessageId (int &id) |
get id associated to the most recent message recorded by the logger | |
bool | GetFormattedMessage (int id, std::string &message) |
get message formatted as string | |
bool | GetMessage (int id, QLogInfo &logInfo) |
retrieve QLogInfo object associated to a given log id |
QMsgClient::QMsgClient | ( | const std::string & | address, | |
const std::string & | port | |||
) |
default constructor
address | network address of the MsgLogger server | |
port | port for network connection |
bool QMsgClient::RegisterProcess | ( | const std::string & | processName, | |
const std::string & | host, | |||
pid_t | processPid | |||
) |
register a process to message server
processName | process name with which the server will identify the client in future communications | |
host | the host name from which the client is connecting | |
pid | process id of the process that is being registered |
References QBaseClient::ExecCommand(), QStringHandler::IntToString(), QNwMessageBuilder::SetCommand(), QNwMessageBuilder::SetModifier(), and QNwMessageBuilder::SetParameter().
Referenced by QApolloMessenger::RegisterProcess().
bool QMsgClient::UnregisterProcess | ( | const std::string & | processName | ) |
unregister a process previously registered to message server
processName | name of the process to be released |
References QBaseClient::ExecCommand(), QNwMessageBuilder::SetCommand(), QNwMessageBuilder::SetModifier(), and QNwMessageBuilder::SetParameter().
Referenced by QApolloMessenger::UnregisterProcess().
bool QMsgClient::SendStatus | ( | const std::string & | processName, | |
QDaqCommonDefs::ProcessStatus_t | status | |||
) |
inform message server about the status of a process
processName | name of the process | |
status | process status to be sent return true on success, false if process was not previously registered or an error occurred in the network communication |
References QBaseClient::ExecCommand(), QDaqCommonDefs::ProcessStatusEnumToString(), QNwMessageBuilder::SetCommand(), QNwMessageBuilder::SetModifier(), and QNwMessageBuilder::SetParameter().
Referenced by QApolloMessenger::SendStatus().
bool QMsgClient::SendLog | ( | const std::string & | processName, | |
const std::string & | message, | |||
MsgLevel | level = InfoMsg | |||
) |
send log message to message server
processName | name of the process that is sending the message | |
message | log message | |
level | log level (defaults to InfoMsg) |
References QBaseClient::ExecCommand(), QStringHandler::IntToString(), QNwMessageBuilder::SetCommand(), QNwMessageBuilder::SetModifier(), and QNwMessageBuilder::SetParameter().
Referenced by QApolloMessenger::Send().
bool QMsgClient::GetStatus | ( | const std::string & | processName, | |
QDaqCommonDefs::ProcessStatus_t & | status | |||
) |
get current status for a certain process
processName | name of the process for which informations are requested | |
status | is filled with current status of the process |
References QBaseClient::ExecCommand(), QBaseClient::GetString(), QDaqCommonDefs::ProcessStatusStringToEnum(), QNwMessageBuilder::SetCommand(), QNwMessageBuilder::SetModifier(), and QNwMessageBuilder::SetParameter().
Referenced by QDaqServer::CheckStatus().
bool QMsgClient::GetRegisteredProcesses | ( | std::list< std::string > & | processes | ) |
get a list of registered processes
processes | filled with the names of registered processes |
References QBaseClient::ExecCommand(), QBaseClient::GetInt(), QBaseClient::GetParList(), QNwMessageBuilder::SetCommand(), and QNwMessageBuilder::SetModifier().
Referenced by IsRegistered().
bool QMsgClient::IsRegistered | ( | const std::string & | processName, | |
bool & | isReg | |||
) |
check whether a certain process is registered
processName | name of the process to eb cheched | |
isReg | will be set to true if process is regstered |
References GetRegisteredProcesses().
Referenced by QDaqServer::CheckStatus(), and QDaqServer::Unregistered().
bool QMsgClient::GetMessageIdByTime | ( | time_t | time, | |
int & | id | |||
) |
get id of first message logged after a given time
time | requested time (unix time) | |
id | filled with id associated to first log message occurring after requested time, or zero if the last message was logged before the requested time |
References QBaseClient::ExecCommand(), QBaseClient::GetInt(), QStringHandler::IntToString(), QNwMessageBuilder::SetCommand(), QNwMessageBuilder::SetModifier(), and QNwMessageBuilder::SetParameter().
bool QMsgClient::GetFirstMessageId | ( | int & | id | ) |
get id associated to the oldest message recorded by the logger
id | filled with the requested id, or zero if no messages are present in the message queue |
References QBaseClient::ExecCommand(), QBaseClient::GetInt(), QNwMessageBuilder::SetCommand(), QNwMessageBuilder::SetModifier(), and QNwMessageBuilder::SetParameter().
bool QMsgClient::GetLastMessageId | ( | int & | id | ) |
get id associated to the most recent message recorded by the logger
id | filled with the requested id, or zero if no messages are present in the message queue |
References QBaseClient::ExecCommand(), QBaseClient::GetInt(), QNwMessageBuilder::SetCommand(), QNwMessageBuilder::SetModifier(), and QNwMessageBuilder::SetParameter().
bool QMsgClient::GetFormattedMessage | ( | int | id, | |
std::string & | message | |||
) |
get message formatted as string
id | requested log id | |
message | string filled with log message |
References QBaseClient::ExecCommand(), QBaseClient::GetString(), QStringHandler::IntToString(), QNwMessageBuilder::SetCommand(), QNwMessageBuilder::SetModifier(), and QNwMessageBuilder::SetParameter().
bool QMsgClient::GetMessage | ( | int | id, | |
QLogInfo & | logInfo | |||
) |
retrieve QLogInfo object associated to a given log id
id | requested log id | |
logInfo | filled with requested QLogInfo object |
References QBaseClient::ExecCommand(), QLogInfo::Fill(), QBaseClient::GetInt(), QBaseClient::GetString(), QStringHandler::IntToString(), QError::Set(), QNwMessageBuilder::SetCommand(), QNwMessageBuilder::SetModifier(), and QNwMessageBuilder::SetParameter().