rtt_rostopic_ros_publish_activity.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Ruben Smits Tue Nov 16 09:18:49 CET 2010 ros_publish_activity.hpp
3 
4  ros_publish_activity.hpp - description
5  -------------------
6  begin : Tue November 16 2010
7  copyright : (C) 2010 Ruben Smits
8  email : first.last@mech.kuleuven.be
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU Lesser General Public *
13  * License as published by the Free Software Foundation; either *
14  * version 2.1 of the License, or (at your option) any later version. *
15  * *
16  * This library is distributed in the hope that it will be useful, *
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
19  * Lesser General Public License for more details. *
20  * *
21  * You should have received a copy of the GNU Lesser General Public *
22  * License along with this library; if not, write to the Free Software *
23  * Foundation, Inc., 59 Temple Place, *
24  * Suite 330, Boston, MA 02111-1307 USA *
25  * *
26  ***************************************************************************/
27 
28 
29 #ifndef __RTT_ROSCOMM_ROS_MSG_ACTIVITY_HPP_
30 #define __RTT_ROSCOMM_ROS_MSG_ACTIVITY_HPP_
31 
32 #include <rtt/Activity.hpp>
33 #include <rtt/os/Mutex.hpp>
34 #include <rtt/os/MutexLock.hpp>
35 #include <boost/shared_ptr.hpp>
36 #include <rtt/Logger.hpp>
37 
38 #include <ros/ros.h>
39 
40 #include <set>
41 
42 namespace rtt_roscomm{
43 
48  struct RosPublisher
49  {
50  public:
54  virtual void publish()=0;
55  };
56 
57 
67  {
68  public:
70  private:
71  typedef boost::weak_ptr<RosPublishActivity> weak_ptr;
73  static weak_ptr ros_pub_act;
74 
78  typedef std::set< RosPublisher* > Publishers;
79  typedef Publishers::iterator iterator;
80  Publishers publishers;
82 
83  RosPublishActivity( const std::string& name);
84 
85  void loop();
86 
87  public:
95  static shared_ptr Instance();
96 
97  void addPublisher(RosPublisher* pub);
98  void removePublisher(RosPublisher* pub);
99 
101 
102  };//class
103 }//namespace
104 #endif
105 
virtual void publish()=0
static weak_ptr ros_pub_act
This pointer may not be refcounted since it would prevent cleanup.
boost::shared_ptr< RosPublishActivity > shared_ptr
boost::weak_ptr< RosPublishActivity > weak_ptr


rtt_roscomm
Author(s): Ruben Smits, Jonathan Bohren
autogenerated on Sat Jun 8 2019 18:05:17