service_publication.h
Go to the documentation of this file.
1 #include "sick_scan/sick_scan_base.h" /* Base definitions included in all header files, added by add_sick_scan_base_header.py. Do not edit this line. */
2 /*
3  * Copyright (C) 2008, Morgan Quigley and Willow Garage, Inc.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the names of Stanford University or Willow Garage, Inc. nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef ROSCPP_SERVICE_PUBLICATION_H
30 #define ROSCPP_SERVICE_PUBLICATION_H
31 
32 #include "ros/service_callback_helper.h"
33 #include "common.h"
34 #include "xmlrpcpp/XmlRpc.h"
35 
36 #include <mutex>
37 
38 #include <memory>
39 //#include <boost/shared_array.hpp>
40 #include <thread>
41 #include <memory>
42 
43 #include <vector>
44 #include <queue>
45 
46 namespace roswrap
47 {
48 
49 class ServiceClientLink;
50 typedef std::shared_ptr<ServiceClientLink> ServiceClientLinkPtr;
51 typedef std::vector<ServiceClientLinkPtr> V_ServiceClientLink;
53 
54 class Message;
55 
62 class ROSCPP_DECL ServicePublication : public std::enable_shared_from_this<ServicePublication>
63 {
64 public:
65  ServicePublication(const std::string& name, const std::string &md5sum, const std::string& data_type, const std::string& request_data_type,
66  const std::string& response_data_type, const ServiceCallbackHelperPtr& helper, CallbackQueueInterface* queue,
67  const VoidConstPtr& tracked_object);
69 
73  void processRequest(boost::shared_array<uint8_t> buf, size_t num_bytes, const ServiceClientLinkPtr& link);
74 
78  void addServiceClientLink(const ServiceClientLinkPtr& link);
82  void removeServiceClientLink(const ServiceClientLinkPtr& link);
83 
87  void drop();
91  bool isDropped() { return dropped_; }
92 
93  const std::string& getMD5Sum() { return md5sum_; }
94  const std::string& getRequestDataType() { return request_data_type_; }
95  const std::string& getResponseDataType() { return response_data_type_; }
96  const std::string& getDataType() { return data_type_; }
97  const std::string& getName() { return name_; }
98 
99 private:
100  void dropAllConnections();
101 
102  std::string name_;
103  std::string md5sum_;
104  std::string data_type_;
105  std::string request_data_type_;
106  std::string response_data_type_;
108 
111 
112  bool dropped_;
113 
117 };
118 typedef std::shared_ptr<ServicePublication> ServicePublicationPtr;
119 
120 }
121 
122 #endif // ROSCPP_SERVICE_PUBLICATION_H
roswrap::message_traits::md5sum
const char * md5sum()
returns MD5Sum<M>::value();
Definition: message_traits.h:227
roswrap::ServicePublication::name_
std::string name_
Definition: service_publication.h:102
roswrap::ServicePublication::getDataType
const std::string & getDataType()
Definition: service_publication.h:96
roswrap::ServicePublication::dropped_
bool dropped_
Definition: service_publication.h:112
roswrap::ServiceClientLinkPtr
std::shared_ptr< ServiceClientLink > ServiceClientLinkPtr
Definition: service_client_link.h:85
roswrap::VoidConstWPtr
std::weak_ptr< void const > VoidConstWPtr
Definition: forwards.h:55
roswrap::ServicePublication::data_type_
std::string data_type_
Definition: service_publication.h:104
roswrap::ServicePublication::md5sum_
std::string md5sum_
Definition: service_publication.h:103
api.setup.name
name
Definition: python/api/setup.py:12
roswrap::CallbackQueueInterface
Abstract interface for a queue used to handle all callbacks within roscpp.
Definition: callback_queue_interface.h:83
boost::shared_array< uint8_t >
roswrap::ServicePublication::getRequestDataType
const std::string & getRequestDataType()
Definition: service_publication.h:94
roswrap
Definition: param_modi.cpp:41
roswrap::ServicePublication
Manages an advertised service.
Definition: service_publication.h:62
roswrap::ServicePublication::client_links_mutex_
std::mutex client_links_mutex_
Definition: service_publication.h:110
roswrap::ServicePublication::callback_queue_
CallbackQueueInterface * callback_queue_
Definition: service_publication.h:114
common.h
roswrap::ServiceCallbackHelperPtr
std::shared_ptr< ServiceCallbackHelper > ServiceCallbackHelperPtr
Definition: service_callback_helper.h:141
roswrap::ServicePublication::getResponseDataType
const std::string & getResponseDataType()
Definition: service_publication.h:95
sick_scan_base.h
roswrap::V_ServiceClientLink
std::vector< ServiceClientLinkPtr > V_ServiceClientLink
Definition: service_publication.h:51
roswrap::ServicePublication::response_data_type_
std::string response_data_type_
Definition: service_publication.h:106
roswrap::ServicePublicationPtr
std::shared_ptr< ServicePublication > ServicePublicationPtr
Definition: forwards.h:83
ROSCPP_DECL
#define ROSCPP_DECL
Definition: roswrap/src/cfgsimu/sick_scan/ros/common.h:63
roswrap::ServicePublication::has_tracked_object_
bool has_tracked_object_
Definition: service_publication.h:115
roswrap::ServicePublication::getName
const std::string & getName()
Definition: service_publication.h:97
roswrap::VoidConstPtr
std::shared_ptr< void const > VoidConstPtr
Definition: forwards.h:54
roswrap::ServicePublication::helper_
ServiceCallbackHelperPtr helper_
Definition: service_publication.h:107
roswrap::ServicePublication::isDropped
bool isDropped()
Returns whether or not this service server is valid.
Definition: service_publication.h:91
roswrap::ServicePublication::tracked_object_
VoidConstWPtr tracked_object_
Definition: service_publication.h:116
roswrap::ServicePublication::client_links_
V_ServiceClientLink client_links_
Definition: service_publication.h:109
roswrap::ServicePublication::getMD5Sum
const std::string & getMD5Sum()
Definition: service_publication.h:93
roswrap::ServicePublication::request_data_type_
std::string request_data_type_
Definition: service_publication.h:105


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