All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PublicationTransport.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 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 
18 #ifndef _PUBLICATIONTRANSPORT_HH_
19 #define _PUBLICATIONTRANSPORT_HH_
20 
21 #include <boost/shared_ptr.hpp>
22 #include <string>
23 
25 #include "gazebo/common/Event.hh"
26 #include "gazebo/util/system.hh"
27 
28 namespace gazebo
29 {
30  namespace transport
31  {
34 
40  {
44  public: PublicationTransport(const std::string &_topic,
45  const std::string &_msgType);
46 
48  public: virtual ~PublicationTransport();
49 
54  public: void Init(const ConnectionPtr &_conn, bool _latched);
55 
57  public: void Fini();
58 
61  public: void AddCallback(
62  const boost::function<void(const std::string &)> &_cb);
63 
66  public: const ConnectionPtr GetConnection() const;
67 
70  public: std::string GetTopic() const;
71 
74  public: std::string GetMsgType() const;
75 
78  private: void OnPublish(const std::string &_data);
79 
81  private: std::string topic;
82 
84  private: std::string msgType;
85 
87  private: ConnectionPtr connection;
88 
90  private: boost::function<void (const std::string &)> callback;
91 
93  private: static int counter;
94 
96  private: int id;
97  };
99  }
100 }
101 #endif
boost::shared_ptr< Connection > ConnectionPtr
Definition: Connection.hh:50
transport/transport.hh
Definition: PublicationTransport.hh:39
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48