ros::ServiceServerLink Class Reference

Handles a connection to a service. If it's a non-persistent client, automatically disconnects when its first service call has finished. More...

#include <service_server_link.h>

List of all members.

Classes

struct  CallInfo

Public Types

typedef std::map< std::string,
std::string > 
M_string

Public Member Functions

bool call (const SerializedMessage &req, SerializedMessage &resp)
 Blocking call the service this client is connected to.
const ConnectionPtrgetConnection () const
const std::string & getRequestMD5Sum () const
const std::string & getResponseMD5Sum () const
const std::string & getServiceName () const
bool initialize (const ConnectionPtr &connection)
bool isPersistent () const
 Returns whether this is a persistent connection.
bool isValid () const
 Returns whether this client is still valid, ie. its connection has not been dropped.
 ServiceServerLink (const std::string &service_name, bool persistent, const std::string &request_md5sum, const std::string &response_md5sum, const M_string &header_values)
virtual ~ServiceServerLink ()

Private Types

typedef boost::shared_ptr
< CallInfo
CallInfoPtr
typedef std::queue< CallInfoPtrQ_CallInfo

Private Member Functions

void callFinished ()
 Called when the currently queued call has finished. Clears out the current call, notifying it that it has finished, then calls processNextCall().
void cancelCall (const CallInfoPtr &info)
 Cancel a queued call, notifying it that it has failed.
void clearCalls ()
 Clear all calls, notifying them that they've failed.
void onConnectionDropped (const ConnectionPtr &conn)
bool onHeaderReceived (const ConnectionPtr &conn, const Header &header)
void onHeaderWritten (const ConnectionPtr &conn)
void onRequestWritten (const ConnectionPtr &conn)
void onResponse (const ConnectionPtr &conn, const boost::shared_array< uint8_t > &buffer, uint32_t size, bool success)
void onResponseOkAndLength (const ConnectionPtr &conn, const boost::shared_array< uint8_t > &buffer, uint32_t size, bool success)
void processNextCall ()
 Pops the next call off the queue if one is available. If this is a non-persistent connection and the queue is empty it will also drop the connection.

Private Attributes

Q_CallInfo call_queue_
boost::mutex call_queue_mutex_
ConnectionPtr connection_
CallInfoPtr current_call_
bool dropped_
M_string extra_outgoing_header_values_
bool header_read_
bool header_written_
bool persistent_
std::string request_md5sum_
std::string response_md5sum_
std::string service_name_

Detailed Description

Handles a connection to a service. If it's a non-persistent client, automatically disconnects when its first service call has finished.

Definition at line 58 of file service_server_link.h.


Member Typedef Documentation

typedef boost::shared_ptr<CallInfo> ros::ServiceServerLink::CallInfoPtr [private]

Definition at line 74 of file service_server_link.h.

typedef std::map<std::string, std::string> ros::ServiceServerLink::M_string

Definition at line 78 of file service_server_link.h.

typedef std::queue<CallInfoPtr> ros::ServiceServerLink::Q_CallInfo [private]

Definition at line 75 of file service_server_link.h.


Constructor & Destructor Documentation

ros::ServiceServerLink::ServiceServerLink ( const std::string &  service_name,
bool  persistent,
const std::string &  request_md5sum,
const std::string &  response_md5sum,
const M_string header_values 
)

Definition at line 50 of file service_server_link.cpp.

ros::ServiceServerLink::~ServiceServerLink (  )  [virtual]

Definition at line 63 of file service_server_link.cpp.


Member Function Documentation

bool ros::ServiceServerLink::call ( const SerializedMessage &  req,
SerializedMessage &  resp 
)

Blocking call the service this client is connected to.

If there is already a call happening in another thread, this will queue up the call and still block until it has finished.

Definition at line 316 of file service_server_link.cpp.

void ros::ServiceServerLink::callFinished (  )  [private]

Called when the currently queued call has finished. Clears out the current call, notifying it that it has finished, then calls processNextCall().

Definition at line 240 of file service_server_link.cpp.

void ros::ServiceServerLink::cancelCall ( const CallInfoPtr info  )  [private]

Cancel a queued call, notifying it that it has failed.

Definition at line 70 of file service_server_link.cpp.

void ros::ServiceServerLink::clearCalls (  )  [private]

Clear all calls, notifying them that they've failed.

Definition at line 88 of file service_server_link.cpp.

const ConnectionPtr& ros::ServiceServerLink::getConnection (  )  const [inline]

Definition at line 94 of file service_server_link.h.

const std::string& ros::ServiceServerLink::getRequestMD5Sum (  )  const [inline]

Definition at line 97 of file service_server_link.h.

const std::string& ros::ServiceServerLink::getResponseMD5Sum (  )  const [inline]

Definition at line 98 of file service_server_link.h.

const std::string& ros::ServiceServerLink::getServiceName (  )  const [inline]

Definition at line 96 of file service_server_link.h.

bool ros::ServiceServerLink::initialize ( const ConnectionPtr connection  ) 

Definition at line 114 of file service_server_link.cpp.

bool ros::ServiceServerLink::isPersistent (  )  const [inline]

Returns whether this is a persistent connection.

Definition at line 92 of file service_server_link.h.

bool ros::ServiceServerLink::isValid (  )  const

Returns whether this client is still valid, ie. its connection has not been dropped.

Definition at line 365 of file service_server_link.cpp.

void ros::ServiceServerLink::onConnectionDropped ( const ConnectionPtr conn  )  [private]

Definition at line 167 of file service_server_link.cpp.

bool ros::ServiceServerLink::onHeaderReceived ( const ConnectionPtr conn,
const Header header 
) [private]

Definition at line 137 of file service_server_link.cpp.

void ros::ServiceServerLink::onHeaderWritten ( const ConnectionPtr conn  )  [private]

Definition at line 132 of file service_server_link.cpp.

void ros::ServiceServerLink::onRequestWritten ( const ConnectionPtr conn  )  [private]

Definition at line 178 of file service_server_link.cpp.

void ros::ServiceServerLink::onResponse ( const ConnectionPtr conn,
const boost::shared_array< uint8_t > &  buffer,
uint32_t  size,
bool  success 
) [private]

Definition at line 221 of file service_server_link.cpp.

void ros::ServiceServerLink::onResponseOkAndLength ( const ConnectionPtr conn,
const boost::shared_array< uint8_t > &  buffer,
uint32_t  size,
bool  success 
) [private]

Definition at line 184 of file service_server_link.cpp.

void ros::ServiceServerLink::processNextCall (  )  [private]

Pops the next call off the queue if one is available. If this is a non-persistent connection and the queue is empty it will also drop the connection.

Definition at line 267 of file service_server_link.cpp.


Member Data Documentation

Definition at line 146 of file service_server_link.h.

Definition at line 147 of file service_server_link.h.

Definition at line 136 of file service_server_link.h.

Definition at line 149 of file service_server_link.h.

Definition at line 151 of file service_server_link.h.

Definition at line 142 of file service_server_link.h.

Definition at line 144 of file service_server_link.h.

Definition at line 143 of file service_server_link.h.

Definition at line 138 of file service_server_link.h.

Definition at line 139 of file service_server_link.h.

Definition at line 140 of file service_server_link.h.

Definition at line 137 of file service_server_link.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


roscpp
Author(s): Morgan Quigley mquigley@cs.stanford.edu, Josh Faust jfaust@willowgarage.com, Brian Gerkey gerkey@willowgarage.com
autogenerated on Fri Jan 11 10:08:41 2013