##

PublicationTransport.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef _PUBLICATIONTRANSPORT_HH_
#define _PUBLICATIONTRANSPORT_HH_
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <string>
#include "gazebo/transport/Connection.hh"
#include "gazebo/common/Event.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace transport
{
class GZ_TRANSPORT_VISIBLE PublicationTransport
{
public: PublicationTransport(const std::string &_topic,
const std::string &_msgType);
public: virtual ~PublicationTransport();
public: void Init(const ConnectionPtr &_conn, bool _latched);
public: void Fini();
public: void AddCallback(
const boost::function<void(const std::string &)> &_cb);
public: const ConnectionPtr GetConnection() const;
public: std::string GetTopic() const;
public: std::string GetMsgType() const;
private: void OnPublish(const std::string &_data);
private: std::string topic;
private: std::string msgType;
private: ConnectionPtr connection;
private: boost::function<void (const std::string &)> callback;
private: static int counter;
private: int id;
};
}
}
#endif
gazebo::transport::PublicationTransport::~PublicationTransport
virtual ~PublicationTransport()
Destructor.
gazebo::transport::PublicationTransport::GetConnection
const ConnectionPtr GetConnection() const
Get the underlying connection.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::transport::PublicationTransport::AddCallback
void AddCallback(const boost::function< void(const std::string &)> &_cb)
Add a callback to the transport.
Connection.hh
gazebo::transport::PublicationTransport::Init
void Init(const ConnectionPtr &_conn, bool _latched)
Initialize the transport.
system.hh
gazebo::transport::PublicationTransport::GetMsgType
std::string GetMsgType() const
Get the topic type.
gazebo::transport::PublicationTransport::GetTopic
std::string GetTopic() const
Get the topic name.
gazebo::transport::PublicationTransport
Reads data from a remote advertiser, and passes the data along to local subscribers.
Definition: PublicationTransport.hh:40
gazebo::transport::PublicationTransport::PublicationTransport
PublicationTransport(const std::string &_topic, const std::string &_msgType)
Constructor.
gazebo::transport::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: Connection.hh:50
gazebo::transport::PublicationTransport::Fini
void Fini()
Finalize the transport.
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
transport
transport
Definition: ConnectionManager.hh:35
Event.hh