Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
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 ConnectionPtr & getConnection () 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 76 of file service_server_link.h.

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

Definition at line 80 of file service_server_link.h.

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

Definition at line 77 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.

Definition at line 63 of file service_server_link.cpp.


Member Function Documentation

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 327 of file service_server_link.cpp.

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 251 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.

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 96 of file service_server_link.h.

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

Definition at line 99 of file service_server_link.h.

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

Definition at line 100 of file service_server_link.h.

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

Definition at line 98 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 94 of file service_server_link.h.

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

Definition at line 382 of file service_server_link.cpp.

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

Definition at line 169 of file service_server_link.cpp.

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

Definition at line 138 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 180 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 228 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 187 of file service_server_link.cpp.

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 278 of file service_server_link.cpp.


Member Data Documentation

Definition at line 148 of file service_server_link.h.

Definition at line 149 of file service_server_link.h.

ConnectionPtr ros::ServiceServerLink::connection_ [private]

Definition at line 138 of file service_server_link.h.

Definition at line 151 of file service_server_link.h.

Definition at line 153 of file service_server_link.h.

Definition at line 144 of file service_server_link.h.

Definition at line 146 of file service_server_link.h.

Definition at line 145 of file service_server_link.h.

Definition at line 140 of file service_server_link.h.

Definition at line 141 of file service_server_link.h.

Definition at line 142 of file service_server_link.h.

Definition at line 139 of file service_server_link.h.


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


roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim
autogenerated on Thu Jun 6 2019 21:10:06