service_manager.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 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_MANAGER_H
29 #define ROSCPP_SERVICE_MANAGER_H
30 
31 #include "forwards.h"
32 #include "common.h"
34 #include "service_client_options.h"
35 
36 #include <boost/thread/mutex.hpp>
37 #include <boost/thread/recursive_mutex.hpp>
38 
39 namespace ros
40 {
41 
42 class ServiceManager;
44 
45 class PollManager;
47 
48 class XMLRPCManager;
50 
51 class ConnectionManager;
53 
54 class ROSCPP_DECL ServiceManager
55 {
56 public:
57  static const ServiceManagerPtr& instance();
58 
60  ~ServiceManager();
61 
72  ServicePublicationPtr lookupServicePublication(const std::string& service);
73 
83  ServiceServerLinkPtr createServiceServerLink(const std::string& service,
84  bool persistent,
85  const std::string& request_md5sum, const std::string& response_md5sum,
86  const M_string& header_values);
87 
92  void removeServiceServerLink(const ServiceServerLinkPtr& client);
93 
100  bool lookupService(const std::string& name, std::string& serv_host, uint32_t& serv_port);
101 
116  bool unadvertiseService(const std::string& serv_name);
117 
118  bool advertiseService(const AdvertiseServiceOptions& ops);
119 
120  void start();
121  void shutdown();
122 private:
123 
124  bool isServiceAdvertised(const std::string& serv_name);
125  bool unregisterService(const std::string& service);
126 
127  bool isShuttingDown() { return shutting_down_; }
128 
131 
134 
135  volatile bool shutting_down_;
136  boost::recursive_mutex shutting_down_mutex_;
137 
138  PollManagerPtr poll_manager_;
139  ConnectionManagerPtr connection_manager_;
140  XMLRPCManagerPtr xmlrpc_manager_;
141 };
142 
143 } // namespace ros
144 
145 #endif // ROSCPP_SERVICE_MANAGER_H
ConnectionManagerPtr connection_manager_
volatile bool shutting_down_
L_ServiceServerLink service_server_links_
ROSCPP_DECL void start()
Actually starts the internals of the node (spins up threads, starts the network polling and xmlrpc lo...
Definition: init.cpp:293
L_ServicePublication service_publications_
boost::shared_ptr< ServiceManager > ServiceManagerPtr
Definition: forwards.h:182
boost::shared_ptr< XMLRPCManager > XMLRPCManagerPtr
Definition: forwards.h:188
std::list< ServiceServerLinkPtr > L_ServiceServerLink
Definition: forwards.h:87
PollManagerPtr poll_manager_
std::list< ServicePublicationPtr > L_ServicePublication
Definition: forwards.h:83
boost::shared_ptr< ConnectionManager > ConnectionManagerPtr
Encapsulates all options available for creating a ServiceServer.
std::map< std::string, std::string > M_string
boost::mutex service_server_links_mutex_
ROSCPP_DECL void shutdown()
Disconnects everything and unregisters from the master. It is generally not necessary to call this fu...
Definition: init.cpp:578
boost::mutex service_publications_mutex_
boost::recursive_mutex shutting_down_mutex_
XMLRPCManagerPtr xmlrpc_manager_
boost::shared_ptr< PollManager > PollManagerPtr


roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim
autogenerated on Sun Feb 3 2019 03:29:54