SubscriptionTransport.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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 _SUBSCRIPTIONTRANSPORT_HH_
18 #define _SUBSCRIPTIONTRANSPORT_HH_
19 
20 #include <boost/function.hpp>
21 #include <boost/shared_ptr.hpp>
22 #include <string>
23 
24 #include "Connection.hh"
25 #include "CallbackHelper.hh"
26 #include "gazebo/util/system.hh"
27 
28 namespace gazebo
29 {
30  namespace transport
31  {
34 
40  {
42  public: SubscriptionTransport();
43 
45  public: virtual ~SubscriptionTransport();
46 
51  public: void Init(ConnectionPtr _conn, bool _latching);
52 
59  public: virtual bool HandleData(const std::string &_newdata,
60  boost::function<void(uint32_t)> _cb, uint32_t _id);
61 
62  // Documentation inherited
63  public: virtual bool HandleMessage(MessagePtr _newMsg);
64 
67  public: const ConnectionPtr &GetConnection() const;
68 
72  public: virtual bool IsLocal() const;
73 
74  private: ConnectionPtr connection;
75  };
77  }
78 }
79 
80 #endif
boost::shared_ptr< Connection > ConnectionPtr
Definition: Connection.hh:50
A helper class to handle callbacks when messages arrive.
Definition: CallbackHelper.hh:44
transport/transport.hh
Definition: SubscriptionTransport.hh:39
boost::shared_ptr< google::protobuf::Message > MessagePtr
Definition: TransportTypes.hh:45
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
#define GZ_TRANSPORT_VISIBLE
Definition: system.hh:159