Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
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>

Inheritance diagram for ros::ServiceServerLink:
Inheritance graph
[legend]

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. More...
 
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. More...
 
bool isValid () const
 Returns whether this client is still valid, ie. its connection has not been dropped. More...
 
 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< CallInfoCallInfoPtr
 
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() More...
 
void cancelCall (const CallInfoPtr &info)
 Cancel a queued call, notifying it that it has failed. More...
 
void clearCalls ()
 Clear all calls, notifying them that they've failed. More...
 
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. More...
 

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

Member Typedef Documentation

Definition at line 77 of file service_server_link.h.

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

Definition at line 81 of file service_server_link.h.

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

Definition at line 78 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 330 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 253 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 97 of file service_server_link.h.

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

Definition at line 100 of file service_server_link.h.

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

Definition at line 101 of file service_server_link.h.

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

Definition at line 99 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 95 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 385 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 229 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.

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

Member Data Documentation

Q_CallInfo ros::ServiceServerLink::call_queue_
private

Definition at line 149 of file service_server_link.h.

boost::mutex ros::ServiceServerLink::call_queue_mutex_
private

Definition at line 150 of file service_server_link.h.

ConnectionPtr ros::ServiceServerLink::connection_
private

Definition at line 139 of file service_server_link.h.

CallInfoPtr ros::ServiceServerLink::current_call_
private

Definition at line 152 of file service_server_link.h.

bool ros::ServiceServerLink::dropped_
private

Definition at line 154 of file service_server_link.h.

M_string ros::ServiceServerLink::extra_outgoing_header_values_
private

Definition at line 145 of file service_server_link.h.

bool ros::ServiceServerLink::header_read_
private

Definition at line 147 of file service_server_link.h.

bool ros::ServiceServerLink::header_written_
private

Definition at line 146 of file service_server_link.h.

bool ros::ServiceServerLink::persistent_
private

Definition at line 141 of file service_server_link.h.

std::string ros::ServiceServerLink::request_md5sum_
private

Definition at line 142 of file service_server_link.h.

std::string ros::ServiceServerLink::response_md5sum_
private

Definition at line 143 of file service_server_link.h.

std::string ros::ServiceServerLink::service_name_
private

Definition at line 140 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, Dirk Thomas
autogenerated on Mon Nov 2 2020 03:52:27