ClientBase Class
The ClientBase class provides a common ROS service abstraction. More...
Header: | #include "ontologenius/clients/ClientBase.h" |
Inherited By: | OntologyClient, ActionClient, ManagerClient, ReasonerClient |
Namespace: | onto |
Public Functions
ClientBase(std::string name) | |
size_t | nb() |
resetNb() | |
int | getErrorCode() |
std::vector<std::string> | call(const std::string& action, const std::string& param) |
std::string | callStr(const std::string& action, const std::string& param) |
bool | callNR(const std::string& action, const std::string& param) |
bool | callBool(const std::string& action, const std::string& param) |
Detailed Description
The ClientBase class provides an abstraction for any ROS services.
This class ensure a persistent connection with the service based on. The persistent connection ensures a minimal response time. A reconnection logic is implemented in the event that the persistent connection fails.
Public Function Documentation
ClientBase::ClientBase(const std::string& name)
Constructs a ROS client linked to the service name.
size_t ClientBase::nb()
Gives the total number of service calls from all ClientBase instances since the last reset.
ClientBase::resetNb()
Reset Call Counter for all instances of ClientBase.
int ClientBase::getErrorCode()
Gives the error code of the last service call. Code 0 corresponds to no error. Code -1 corresponds to service call error. Code 1 corresponds to an internal error. Code 2 corresponds to unknown query. Code 3 corresponds to unclosed ontology.
inline std::vector<std::string> ClientBase::call(const std::string& action, const std::string& param)
Calls the service set up in the constructor of ClientBase with the request composed of an action action and parameters param
If the service call fails, the first element of the returned vector is "ERR:SERVICE_FAIL". Error detail can be queried using getError method.
inline std::string ClientBase::callStr(const std::string& action, const std::string& param)
Calls the service set up in the constructor of ClientBase with the request composed of an action action and parameters param
If the service call fails, the returned value is "ERR:SERVICE_FAIL". Error detail can be queried using getError method.
inline bool ClientBase::callNR(const std::string& action, const std::string& param)
Calls the service set up in the constructor of ClientBase with the request composed of an action action and parameters param
Returns false if the service call fails.
inline bool ClientBase::callBool(const std::string& action, const std::string& param)
Calls the service set up in the constructor of ClientBase with the request composed of an action action and parameters param
Returns false if the service call fails or the result code of the service is different from SUCCESS.