29 #ifndef SWRI_ROSCPP_SERVICE_SERVER_IMPL_H_    30 #define SWRI_ROSCPP_SERVICE_SERVER_IMPL_H_    54     total_stats_.
merge(success, runtime);
    55     if (instrument_per_client_) {
    56       client_stats_[caller_name].merge(success, runtime);
    63     unmapped_service_(
"uninitialized"),
    64     mapped_service_(
"initialized"),
    65     instrument_per_client_(false),
    73     client_stats_.clear();
    83     instrument_per_client_ = enable;
    84     if (!instrument_per_client_) {
    85       client_stats_.clear();
    93     std::vector<std::string> names;
    94     names.reserve(client_stats_.size());
    96     std::map<std::string, ServiceServerStatistics>::const_iterator it;
    97     for (it = client_stats_.begin(); it != client_stats_.end(); it++) {
    98       names.push_back(it->first);
   104     const std::string &
name)
 const   106     std::map<std::string, ServiceServerStatistics>::const_iterator it;
   107     it = client_stats_.find(name);
   108     if (it == client_stats_.end()) {
   123 template<
class MReq, 
class MRes, 
class T>
   127   bool (T::*callback_plain_)(MReq &, MRes &);
   129   bool (T::*callback_with_name_)(
const std::string &, 
const MReq &, MRes &);
   132                   const std::string &service)
   140       ROS_INFO(
"Serving to '%s' at '%s'.",
   153       ROS_INFO(
"Service '%s' called by '%s'",
   155                event.getCallerName().c_str());
   162       if (callback_plain_) {
   163         result = (obj_->*callback_plain_)(
   165       } 
else if (callback_with_name_) {
   166         result = (obj_->*callback_with_name_)(
   167           event.
getCallerName(), 
event.getRequest(), 
event.getResponse());
   169         result = (obj_->*callback_with_event_)(event);
   184     callback_plain_(NULL),
   185     callback_with_event_(NULL),
   186     callback_with_name_(NULL)
   191                          const std::string &service,
   192                          bool(T::*srv_func)(MReq &, MRes &),
   196     callback_plain_ = srv_func;
   197     callback_with_event_ = NULL;
   198     callback_with_name_ = NULL;
   203                          const std::string &service,
   208     callback_plain_ = NULL;
   209     callback_with_event_ = srv_func;
   210     callback_with_name_ = NULL;
   215                          const std::string &service,
   216                          bool(T::*srv_func)(
const std::string &, 
const MReq &, MRes &),
   220     callback_plain_ = NULL;
   221     callback_with_event_ = NULL;
   222     callback_with_name_ = srv_func;
   227 #endif  // SWRI_ROSCPP_SERVICE_SERVER_IMPL_H_ bool instrument_per_client_
ServiceServerStatistics total_stats_
std::vector< std::string > clientNames() const 
const std::string & getCallerName() const 
ResponseType & getResponse() const 
void setLogCalls(bool enable)
std::string mapped_service_
ROSCONSOLE_DECL void initialize()
std::string resolveName(const std::string &name, bool remap=true) const 
void setInstrumentPerClient(bool enable)
TypedServiceServerImpl(ros::NodeHandle &nh, const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
ServiceServerStatistics clientStatistics(const std::string &name) const 
ros::ServiceServer server_
void processServing(const std::string caller_name, bool success, const ros::WallDuration &runtime)
std::map< std::string, ServiceServerStatistics > client_stats_
void initialize(ros::NodeHandle &nh, const std::string &service)
const RequestType & getRequest() const 
TypedServiceServerImpl(ros::NodeHandle &nh, const std::string &service, bool(T::*srv_func)(ros::ServiceEvent< MReq, MRes > &), T *obj)
const ServiceServerStatistics & totalStats() const 
void merge(bool success, const ros::WallDuration &runtime)
TypedServiceServerImpl(ros::NodeHandle &nh, const std::string &service, bool(T::*srv_func)(const std::string &, const MReq &, MRes &), T *obj)
bool handleService(ros::ServiceEvent< MReq, MRes > &event)
std::string unmapped_service_
bool instrumentPerClient() const 
const std::string & unmappedService() const 
const std::string & mappedService() const