publication.h
Go to the documentation of this file.
00001 #ifndef ROSRTT_PUBLICATION_H
00002 #define ROSRTT_PUBLICATION_H
00003 
00004 #include "oro/channel_data_element.hpp"
00005 #include "ros/ros.h"
00006 #include "hpcl_rtt/connection_base.h"
00007 namespace hpcl_rtt
00008 {
00009 //class Publication;
00010 //typedef boost::shared_ptr<Publication> PublicationPtr;
00011 //typedef std::vector<PublicationPtr> V_Publication;
00012 
00013 template <class M>
00014 class Publication : public ConnectionBase
00015 {
00016 public:
00017   typedef boost::shared_ptr< Publication<M> > shared_ptr;
00018   
00019   Publication(const std::string& topic) : ConnectionBase(topic) {}
00020   ~Publication() {}
00021 
00022   bool publish(M message)
00023   {
00024     typename ChannelElement<M>::shared_ptr output
00025                 = boost::static_pointer_cast< ChannelElement<M> >(this->getChannelElement());
00026     if (output)
00027     {
00028       output->write(message);
00029       return true;
00030     }
00031     else
00032     {
00033       return false;
00034     }
00035   }
00036 
00037 };
00038 
00039 }
00040 
00041 #endif


hpcl_rtt
Author(s): sukha
autogenerated on Thu Aug 27 2015 16:43:53