service_server.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009, 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_HANDLE_H
29 #define ROSCPP_SERVICE_HANDLE_H
30 
31 #include "ros/forwards.h"
32 #include "common.h"
33 
34 namespace ros
35 {
36 
45 class ROSCPP_DECL ServiceServer
46 {
47 public:
49  ServiceServer(const ServiceServer& rhs);
50  ~ServiceServer();
51  ServiceServer& operator=(const ServiceServer& other) = default;
52 
62  void shutdown();
63 
64  std::string getService() const;
65 
66  operator void*() const { return (impl_ && impl_->isValid()) ? (void*)1 : (void*)0; }
67 
68  bool operator<(const ServiceServer& rhs) const
69  {
70  return impl_ < rhs.impl_;
71  }
72 
73  bool operator==(const ServiceServer& rhs) const
74  {
75  return impl_ == rhs.impl_;
76  }
77 
78  bool operator!=(const ServiceServer& rhs) const
79  {
80  return impl_ != rhs.impl_;
81  }
82 
83 private:
84  ServiceServer(const std::string& service, const NodeHandle& node_handle);
85 
86  class Impl
87  {
88  public:
89  Impl();
90  ~Impl();
91 
92  void unadvertise();
93  bool isValid() const;
94 
95  std::string service_;
98  };
100  typedef boost::weak_ptr<Impl> ImplWPtr;
101 
103 
104  friend class NodeHandle;
106 };
107 typedef std::vector<ServiceServer> V_ServiceServer;
108 
109 }
110 
111 #endif // ROSCPP_SERVICE_HANDLE_H
112 
113 
ros::V_ServiceServer
std::vector< ServiceServer > V_ServiceServer
Definition: service_server.h:107
boost::shared_ptr< NodeHandle >
forwards.h
ros::ServiceServer::operator<
bool operator<(const ServiceServer &rhs) const
Definition: service_server.h:68
ros::ServiceServer::ImplWPtr
boost::weak_ptr< Impl > ImplWPtr
Definition: service_server.h:100
ros
ros::shutdown
ROSCPP_DECL void shutdown()
Disconnects everything and unregisters from the master. It is generally not necessary to call this fu...
Definition: init.cpp:605
ros::NodeHandleBackingCollection
Definition: node_handle.cpp:58
ros::ServiceServer::Impl
Definition: service_server.h:86
ros::ServiceServer::Impl::unadvertised_
bool unadvertised_
Definition: service_server.h:97
ros::ServiceServer::Impl::service_
std::string service_
Definition: service_server.h:95
ros::ServiceServer::ServiceServer
ServiceServer()
Definition: service_server.h:48
ros::NodeHandle
roscpp's interface for creating subscribers, publishers, etc.
Definition: node_handle.h:87
ros::ServiceServer::operator!=
bool operator!=(const ServiceServer &rhs) const
Definition: service_server.h:78
ros::ServiceServer::impl_
ImplPtr impl_
Definition: service_server.h:102
ros::ServiceServer
Manages an service advertisement.
Definition: service_server.h:45
ros::ServiceServer::Impl::node_handle_
NodeHandlePtr node_handle_
Definition: service_server.h:96
ros::ServiceServer::operator==
bool operator==(const ServiceServer &rhs) const
Definition: service_server.h:73
ros::ServiceServer::ImplPtr
boost::shared_ptr< Impl > ImplPtr
Definition: service_server.h:99


roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas , Jacob Perron
autogenerated on Thu Nov 23 2023 04:01:44