Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
roswrap::ServiceClient Class Reference

Provides a handle-based interface to service client connections. More...

#include <service_client.h>

Classes

struct  Impl
 

Public Member Functions

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. More...
 
bool call (const SerializedMessage &req, SerializedMessage &resp, const std::string &service_md5sum)
 
template<class MReq , class MRes >
bool call (MReq &req, MRes &res)
 Call the service aliased by this handle with the specified request/response messages. More...
 
template<class Service >
bool call (Service &service)
 Call the service aliased by this handle with the specified service request/response. More...
 
bool exists ()
 Checks if this is both advertised and available. More...
 
std::string getService ()
 Returns the name of the service this ServiceClient connects to. More...
 
bool isPersistent () const
 Returns true if this handle points to a persistent service, false otherwise. More...
 
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. More...
 
 operator void * () const
 
bool operator!= (const ServiceClient &rhs) const
 
bool operator< (const ServiceClient &rhs) const
 
bool operator== (const ServiceClient &rhs) const
 
 ServiceClient ()
 
 ServiceClient (const ServiceClient &rhs)
 
 ServiceClient (const std::string &service_name, bool persistent, const M_string &header_values, const std::string &service_md5sum)
 
void shutdown ()
 Shutdown the connection associated with this ServiceClient. More...
 
bool waitForExistence (ros::Duration timeout=ros::Duration(-1))
 Wait for this service to be advertised and available. Blocks until it is. More...
 
 ~ServiceClient ()
 

Private Types

typedef std::shared_ptr< ImplImplPtr
 
typedef std::weak_ptr< ImplImplWPtr
 

Private Member Functions

void deserializeFailed (const std::exception &e)
 

Private Attributes

ImplPtr impl_
 

Friends

class NodeHandle
 
class NodeHandleBackingCollection
 

Detailed Description

Provides a handle-based interface to service client connections.

Definition at line 43 of file service_client.h.

Member Typedef Documentation

◆ ImplPtr

typedef std::shared_ptr<Impl> roswrap::ServiceClient::ImplPtr
private

Definition at line 204 of file service_client.h.

◆ ImplWPtr

typedef std::weak_ptr<Impl> roswrap::ServiceClient::ImplWPtr
private

Definition at line 205 of file service_client.h.

Constructor & Destructor Documentation

◆ ServiceClient() [1/3]

roswrap::ServiceClient::ServiceClient ( )
inline

Definition at line 46 of file service_client.h.

◆ ServiceClient() [2/3]

roswrap::ServiceClient::ServiceClient ( const std::string &  service_name,
bool  persistent,
const M_string header_values,
const std::string &  service_md5sum 
)

◆ ServiceClient() [3/3]

roswrap::ServiceClient::ServiceClient ( const ServiceClient rhs)

◆ ~ServiceClient()

roswrap::ServiceClient::~ServiceClient ( )

Member Function Documentation

◆ call() [1/4]

template<typename MReq , typename MRes >
bool roswrap::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 98 of file service_client.h.

◆ call() [2/4]

bool roswrap::ServiceClient::call ( const SerializedMessage req,
SerializedMessage resp,
const std::string &  service_md5sum 
)

◆ call() [3/4]

template<class MReq , class MRes >
bool roswrap::ServiceClient::call ( MReq &  req,
MRes &  res 
)
inline

Call the service aliased by this handle with the specified request/response messages.

Note
The request/response message types must match the types specified in the templated call to NodeHandle::serviceClient()/servicecreateClient()

Definition at line 56 of file service_client.h.

◆ call() [4/4]

template<class Service >
bool roswrap::ServiceClient::call ( Service &  service)
inline

Call the service aliased by this handle with the specified service request/response.

Definition at line 82 of file service_client.h.

◆ deserializeFailed()

void roswrap::ServiceClient::deserializeFailed ( const std::exception &  e)
inlineprivate

Definition at line 184 of file service_client.h.

◆ exists()

bool roswrap::ServiceClient::exists ( )

Checks if this is both advertised and available.

Returns
true if the service is up and available, false otherwise

◆ getService()

std::string roswrap::ServiceClient::getService ( )

Returns the name of the service this ServiceClient connects to.

◆ isPersistent()

bool roswrap::ServiceClient::isPersistent ( ) const

Returns true if this handle points to a persistent service, false otherwise.

◆ isValid()

bool roswrap::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.

◆ operator void *()

roswrap::ServiceClient::operator void * ( ) const
inline

Definition at line 164 of file service_client.h.

◆ operator!=()

bool roswrap::ServiceClient::operator!= ( const ServiceClient rhs) const
inline

Definition at line 175 of file service_client.h.

◆ operator<()

bool roswrap::ServiceClient::operator< ( const ServiceClient rhs) const
inline

Definition at line 165 of file service_client.h.

◆ operator==()

bool roswrap::ServiceClient::operator== ( const ServiceClient rhs) const
inline

Definition at line 170 of file service_client.h.

◆ shutdown()

void roswrap::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.

◆ waitForExistence()

bool roswrap::ServiceClient::waitForExistence ( ros::Duration  timeout = ros::Duration(-1))

Wait for this service to be advertised and available. Blocks until it is.

Parameters
timeoutThe amount of time to wait for before timing out. If timeout is -1 (default), waits until the node is shutdown
Returns
true on success, false otherwise

Friends And Related Function Documentation

◆ NodeHandle

friend class NodeHandle
friend

Definition at line 209 of file service_client.h.

◆ NodeHandleBackingCollection

friend class NodeHandleBackingCollection
friend

Definition at line 210 of file service_client.h.

Member Data Documentation

◆ impl_

ImplPtr roswrap::ServiceClient::impl_
private

Definition at line 207 of file service_client.h.


The documentation for this class was generated from the following file:


sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:15