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 
61  void shutdown();
62 
63  std::string getService() const;
64 
65  operator void*() const { return (impl_ && impl_->isValid()) ? (void*)1 : (void*)0; }
66 
67  bool operator<(const ServiceServer& rhs) const
68  {
69  return impl_ < rhs.impl_;
70  }
71 
72  bool operator==(const ServiceServer& rhs) const
73  {
74  return impl_ == rhs.impl_;
75  }
76 
77  bool operator!=(const ServiceServer& rhs) const
78  {
79  return impl_ != rhs.impl_;
80  }
81 
82 private:
83  ServiceServer(const std::string& service, const NodeHandle& node_handle);
84 
85  class Impl
86  {
87  public:
88  Impl();
89  ~Impl();
90 
91  void unadvertise();
92  bool isValid() const;
93 
94  std::string service_;
97  };
99  typedef boost::weak_ptr<Impl> ImplWPtr;
100 
101  ImplPtr impl_;
102 
103  friend class NodeHandle;
105 };
106 typedef std::vector<ServiceServer> V_ServiceServer;
107 
108 }
109 
110 #endif // ROSCPP_SERVICE_HANDLE_H
111 
112 
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
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:578


roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim
autogenerated on Wed Mar 21 2018 07:13:27