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


roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim
autogenerated on Sun Aug 26 2018 03:03:33