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 
102  ImplPtr impl_;
103 
104  friend class NodeHandle;
106 };
107 typedef std::vector<ServiceServer> V_ServiceServer;
108 
109 }
110 
111 #endif // ROSCPP_SERVICE_HANDLE_H
112 
113 
bool operator==(const ServiceServer &rhs) const
std::vector< ServiceServer > V_ServiceServer
NodeHandlePtr node_handle_
boost::weak_ptr< Impl > ImplWPtr
bool operator<(const ServiceServer &rhs) const
boost::shared_ptr< Impl > ImplPtr
roscpp&#39;s interface for creating subscribers, publishers, etc.
Definition: node_handle.h:87
bool operator!=(const ServiceServer &rhs) const
Manages an service advertisement.
ROSCPP_DECL void shutdown()
Disconnects everything and unregisters from the master. It is generally not necessary to call this fu...
Definition: init.cpp:594


roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas
autogenerated on Mon Feb 28 2022 23:33:27