Provides a handle-based interface to service client connections. More...
#include <service_client.h>
Classes | |
struct | Impl |
Public Member Functions | |
bool | call (const SerializedMessage &req, SerializedMessage &resp, const std::string &service_md5sum) |
template<typename MReq , typename MRes > | |
bool | call (const MReq &req, MRes &resp, const std::string &service_md5sum) |
Mostly for internal use, the other templated versions of call() just call into this one. | |
template<class Service > | |
bool | call (Service &service) |
Call the service aliased by this handle with the specified service request/response. | |
template<class MReq , class MRes > | |
bool | call (MReq &req, MRes &res) |
Call the service aliased by this handle with the specified request/response messages. | |
bool | exists () |
Checks if this is both advertised and available. | |
std::string | getService () |
Returns the name of the service this ServiceClient connects to. | |
bool | isValid () const |
Returns whether or not this handle is valid. For a persistent service, this becomes false when the connection has dropped. Non-persistent service handles are always valid. | |
operator void * () const | |
bool | operator!= (const ServiceClient &rhs) const |
bool | operator< (const ServiceClient &rhs) const |
bool | operator== (const ServiceClient &rhs) const |
ServiceClient (const ServiceClient &rhs) | |
ServiceClient (const std::string &service_name, bool persistent, const M_string &header_values, const std::string &service_md5sum) | |
ServiceClient () | |
void | shutdown () |
Shutdown the connection associated with this ServiceClient. | |
bool | waitForExistence (ros::Duration timeout=ros::Duration(-1)) |
Wait for this service to be advertised and available. Blocks until it is. | |
~ServiceClient () | |
Private Types | |
typedef boost::shared_ptr< Impl > | ImplPtr |
typedef boost::weak_ptr< Impl > | ImplWPtr |
Private Member Functions | |
void | deserializeFailed (const std::exception &e) |
Private Attributes | |
ImplPtr | impl_ |
Friends | |
class | NodeHandle |
class | NodeHandleBackingCollection |
Provides a handle-based interface to service client connections.
Definition at line 42 of file service_client.h.
typedef boost::shared_ptr<Impl> ros::ServiceClient::ImplPtr [private] |
Definition at line 199 of file service_client.h.
typedef boost::weak_ptr<Impl> ros::ServiceClient::ImplWPtr [private] |
Definition at line 200 of file service_client.h.
ros::ServiceClient::ServiceClient | ( | ) | [inline] |
Definition at line 45 of file service_client.h.
ros::ServiceClient::ServiceClient | ( | const std::string & | service_name, | |
bool | persistent, | |||
const M_string & | header_values, | |||
const std::string & | service_md5sum | |||
) |
Definition at line 85 of file service_client.cpp.
ros::ServiceClient::ServiceClient | ( | const ServiceClient & | rhs | ) |
Definition at line 99 of file service_client.cpp.
ros::ServiceClient::~ServiceClient | ( | ) |
Definition at line 104 of file service_client.cpp.
bool ros::ServiceClient::call | ( | const SerializedMessage & | req, | |
SerializedMessage & | resp, | |||
const std::string & | service_md5sum | |||
) |
Definition at line 109 of file service_client.cpp.
bool ros::ServiceClient::call | ( | const MReq & | req, | |
MRes & | resp, | |||
const std::string & | service_md5sum | |||
) | [inline] |
Mostly for internal use, the other templated versions of call() just call into this one.
Definition at line 97 of file service_client.h.
bool ros::ServiceClient::call | ( | Service & | service | ) | [inline] |
Call the service aliased by this handle with the specified service request/response.
Definition at line 81 of file service_client.h.
bool ros::ServiceClient::call | ( | MReq & | req, | |
MRes & | res | |||
) | [inline] |
Call the service aliased by this handle with the specified request/response messages.
Definition at line 55 of file service_client.h.
void ros::ServiceClient::deserializeFailed | ( | const std::exception & | e | ) | [inline, private] |
Definition at line 178 of file service_client.h.
bool ros::ServiceClient::exists | ( | ) |
Checks if this is both advertised and available.
Definition at line 184 of file service_client.cpp.
std::string ros::ServiceClient::getService | ( | ) |
Returns the name of the service this ServiceClient connects to.
Definition at line 194 of file service_client.cpp.
bool ros::ServiceClient::isValid | ( | ) | const |
Returns whether or not this handle is valid. For a persistent service, this becomes false when the connection has dropped. Non-persistent service handles are always valid.
Definition at line 156 of file service_client.cpp.
ros::ServiceClient::operator void * | ( | ) | const [inline] |
Definition at line 158 of file service_client.h.
bool ros::ServiceClient::operator!= | ( | const ServiceClient & | rhs | ) | const [inline] |
Definition at line 169 of file service_client.h.
bool ros::ServiceClient::operator< | ( | const ServiceClient & | rhs | ) | const [inline] |
Definition at line 159 of file service_client.h.
bool ros::ServiceClient::operator== | ( | const ServiceClient & | rhs | ) | const [inline] |
Definition at line 164 of file service_client.h.
void ros::ServiceClient::shutdown | ( | ) |
Shutdown the connection associated with this ServiceClient.
This method usually does not need to be explicitly called, as automatic shutdown happens when all copies of this ServiceClient go out of scope
This method overrides the automatic reference counted shutdown, and does so immediately.
Definition at line 166 of file service_client.cpp.
bool ros::ServiceClient::waitForExistence | ( | ros::Duration | timeout = ros::Duration(-1) |
) |
Wait for this service to be advertised and available. Blocks until it is.
timeout | The amount of time to wait for before timing out. If timeout is -1 (default), waits until the node is shutdown |
Definition at line 174 of file service_client.cpp.
friend class NodeHandle [friend] |
Definition at line 204 of file service_client.h.
friend class NodeHandleBackingCollection [friend] |
Definition at line 205 of file service_client.h.
ImplPtr ros::ServiceClient::impl_ [private] |
Definition at line 202 of file service_client.h.