ClientBaseIndex Class

The ClientBaseIndex class provides a common ROS service abstraction. More...

Header: #include "ontologenius/clientsIndex/ClientBaseIndex.h"
Inherited By: OntologyIndexClient
Namespace: onto

Public Functions

ClientBaseIndex(std::string name)
size_t nb()
resetNb()
int getErrorCode()
std::vector<std::string> call(const std::string& action, const std::string& param)
std::vector<int64_t> callIndexes(const std::string& action, const std::string& param)
std::string callStr(const std::string& action, const std::string& param)
int64_t callIndex(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 ClientBaseIndex class provides an abstraction for any ROS services based on indexes.

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.

See also ClientBase.

Public Function Documentation

ClientBaseIndex::ClientBaseIndex(const std::string& name)

Constructs a ROS client linked to the service name.

size_t ClientBaseIndex::nb()

Gives the total number of service calls from all ClientBaseIndex instances since the last reset.

ClientBaseIndex::resetNb()

Reset Call Counter for all instances of ClientBaseIndex.

int ClientBaseIndex::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> ClientBaseIndex::call(const std::string& action, const std::string& param)

Calls the service set up in the constructor of ClientBaseIndex 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::vector<int64_t> ClientBaseIndex::callIndexes(const std::string& action, const std::string& param)

Calls the service set up in the constructor of ClientBaseIndex with the request composed of an action action and parameters param

If the service call fails, the first element of the returned vector is 0.

inline std::string ClientBaseIndex::callStr(const std::string& action, const std::string& param)

Calls the service set up in the constructor of ClientBaseIndex 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 int64_t ClientBaseIndex::callIndex(const std::string& action, const std::string& param)

Calls the service set up in the constructor of ClientBaseIndex with the request composed of an action action and parameters param

If the service call fails or has no response, the returned value is 0.

inline bool ClientBaseIndex::callNR(const std::string& action, const std::string& param)

Calls the service set up in the constructor of ClientBaseIndex with the request composed of an action action and parameters param

Returns false if the service call fails.

inline bool ClientBaseIndex::callBool(const std::string& action, const std::string& param)

Calls the service set up in the constructor of ClientBaseIndex 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.