All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TransportIface.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2012 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef _GAZEBO_TRANSPORTIFACE_HH_
18 #define _GAZEBO_TRANSPORTIFACE_HH_
19 
20 #include <boost/bind.hpp>
21 #include <string>
22 #include <list>
23 #include <map>
24 
27 #include "gazebo/transport/Node.hh"
29 
30 namespace gazebo
31 {
32  namespace transport
33  {
37 
44  bool get_master_uri(std::string &_master_host, unsigned int &_master_port);
45 
52  bool init(const std::string &_master_host ="",
53  unsigned int _master_port = 0);
54 
58  void run();
59 
62  void get_topic_namespaces(std::list<std::string> &_namespaces);
63 
66  bool is_stopped();
67 
69  void stop();
70 
72  void fini();
73 
75  void clear_buffers();
76 
80  void pause_incoming(bool _pause);
81 
89  boost::shared_ptr<msgs::Response> request(const std::string &_worldName,
90  const std::string &_request,
91  const std::string &_data = "");
92 
99  void requestNoReply(const std::string &_worldName,
100  const std::string &_request,
101  const std::string &_data = "");
102 
108  void requestNoReply(NodePtr _node, const std::string &_request,
109  const std::string &_data = "");
110 
117  template<typename M> void publish(const std::string &_topic,
118  const google::protobuf::Message &_message)
119  {
121  node->Init();
122  node->Publish<M>(_topic, _message);
123  }
124 
128  std::map<std::string, std::list<std::string> > getAdvertisedTopics();
129 
135  std::list<std::string> getAdvertisedTopics(const std::string &_msgType);
136 
140  std::string getTopicMsgType(const std::string &_topicName);
141 
144  void setMinimalComms(bool _enabled);
145 
148  bool getMinimalComms();
149 
151  }
152 }
153 #endif