service_manager.h
Go to the documentation of this file.
1 #include "sick_scan/sick_scan_base.h" /* Base definitions included in all header files, added by add_sick_scan_base_header.py. Do not edit this line. */
2 /*
3  * Copyright (C) 2009, Willow Garage, Inc.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the names of Willow Garage, Inc. nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef ROSCPP_SERVICE_MANAGER_H
30 #define ROSCPP_SERVICE_MANAGER_H
31 
32 #include "forwards.h"
33 #include "common.h"
35 #include "service_client_options.h"
36 
37 #include <mutex>
38 //#include <boost/thread/recursive_mutex.hpp>
39 
40 namespace roswrap
41 {
42 
43 class ServiceManager;
44 typedef std::shared_ptr<ServiceManager> ServiceManagerPtr;
45 
46 class PollManager;
47 typedef std::shared_ptr<PollManager> PollManagerPtr;
48 
49 class XMLRPCManager;
50 typedef std::shared_ptr<XMLRPCManager> XMLRPCManagerPtr;
51 
52 class ConnectionManager;
53 typedef std::shared_ptr<ConnectionManager> ConnectionManagerPtr;
54 
56 {
57 public:
58  static const ServiceManagerPtr& instance();
59 
61  ~ServiceManager();
62 
73  ServicePublicationPtr lookupServicePublication(const std::string& service);
74 
84  ServiceServerLinkPtr createServiceServerLink(const std::string& service,
85  bool persistent,
86  const std::string& request_md5sum, const std::string& response_md5sum,
87  const M_string& header_values);
88 
93  void removeServiceServerLink(const ServiceServerLinkPtr& client);
94 
101  bool lookupService(const std::string& name, std::string& serv_host, uint32_t& serv_port);
102 
117  bool unadvertiseService(const std::string& serv_name);
118 
119  bool advertiseService(const AdvertiseServiceOptions& ops);
120 
121  void start();
122  void shutdown();
123 private:
124 
125  bool isServiceAdvertised(const std::string& serv_name);
126  bool unregisterService(const std::string& service);
127 
128  bool isShuttingDown() { return shutting_down_; }
129 
132 
135 
136  volatile bool shutting_down_;
137  boost::recursive_mutex shutting_down_mutex_;
138 
142 };
143 
144 } // namespace roswrap
145 
146 #endif // ROSCPP_SERVICE_MANAGER_H
roswrap::XMLRPCManagerPtr
std::shared_ptr< XMLRPCManager > XMLRPCManagerPtr
Definition: forwards.h:172
service_client_options.h
roswrap::AdvertiseServiceOptions
Encapsulates all options available for creating a ServiceServer.
Definition: advertise_service_options.h:44
roswrap::ConnectionManagerPtr
std::shared_ptr< ConnectionManager > ConnectionManagerPtr
Definition: connection_manager.h:42
forwards.h
roswrap::M_string
std::map< std::string, std::string > M_string
Definition: datatypes.h:46
roswrap::shutdown
ROSCPP_DECL void shutdown()
Disconnects everything and unregisters from the master. It is generally not necessary to call this fu...
Definition: rossimu.cpp:269
roswrap::ServiceManager::service_server_links_mutex_
std::mutex service_server_links_mutex_
Definition: service_manager.h:134
roswrap::L_ServiceServerLink
std::list< ServiceServerLinkPtr > L_ServiceServerLink
Definition: forwards.h:89
roswrap::ServiceManager::shutting_down_mutex_
boost::recursive_mutex shutting_down_mutex_
Definition: service_manager.h:137
advertise_service_options.h
roswrap::L_ServicePublication
std::list< ServicePublicationPtr > L_ServicePublication
Definition: forwards.h:85
api.setup.name
name
Definition: python/api/setup.py:12
advertiseService
ServiceServer advertiseService(ros::NodeHandle n, std::string name, boost::function< bool(const typename ActionSpec::_action_goal_type::_goal_type &, typename ActionSpec::_action_result_type::_result_type &result)> service_cb)
roswrap::ServiceManager::isShuttingDown
bool isShuttingDown()
Definition: service_manager.h:128
roswrap
Definition: param_modi.cpp:41
roswrap::ServiceManager::service_publications_
L_ServicePublication service_publications_
Definition: service_manager.h:130
roswrap::PollManagerPtr
std::shared_ptr< PollManager > PollManagerPtr
Definition: connection_manager.h:39
roswrap::ServiceManager::poll_manager_
PollManagerPtr poll_manager_
Definition: service_manager.h:139
common.h
roswrap::ServiceManager::connection_manager_
ConnectionManagerPtr connection_manager_
Definition: service_manager.h:140
roswrap::ServiceServerLinkPtr
std::shared_ptr< ServiceServerLink > ServiceServerLinkPtr
Definition: forwards.h:87
roswrap::ServiceManager::shutting_down_
volatile bool shutting_down_
Definition: service_manager.h:136
roswrap::ServiceManagerPtr
std::shared_ptr< ServiceManager > ServiceManagerPtr
Definition: forwards.h:166
sick_scan_base.h
roswrap::ServiceManager::service_publications_mutex_
std::mutex service_publications_mutex_
Definition: service_manager.h:131
roswrap::ServicePublicationPtr
std::shared_ptr< ServicePublication > ServicePublicationPtr
Definition: forwards.h:83
ROSCPP_DECL
#define ROSCPP_DECL
Definition: roswrap/src/cfgsimu/sick_scan/ros/common.h:63
roswrap::ServiceManager
Definition: service_manager.h:55
roswrap::start
ROSCPP_DECL void start()
Actually starts the internals of the node (spins up threads, starts the network polling and xmlrpc lo...
roswrap::ServiceManager::service_server_links_
L_ServiceServerLink service_server_links_
Definition: service_manager.h:133
roswrap::ServiceManager::xmlrpc_manager_
XMLRPCManagerPtr xmlrpc_manager_
Definition: service_manager.h:141


sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:10