rtt_rostopic_ros_publish_activity.hpp
Go to the documentation of this file.
1 /*
2  * (C) 2010 Ruben Smits, ruben.smits@mech.kuleuven.be
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the names of its contributors
13  * may be used to endorse or promote products derived from this software
14  * without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef __RTT_ROSCOMM_ROS_MSG_ACTIVITY_HPP_
31 #define __RTT_ROSCOMM_ROS_MSG_ACTIVITY_HPP_
32 
33 #include <rtt/Activity.hpp>
34 #include <rtt/os/Mutex.hpp>
35 #include <rtt/os/MutexLock.hpp>
36 #include <boost/shared_ptr.hpp>
37 #include <rtt/Logger.hpp>
38 
39 #include <ros/ros.h>
40 
41 #include <set>
42 
43 namespace rtt_roscomm{
44 
49  struct RosPublisher
50  {
51  public:
55  virtual void publish()=0;
56  };
57 
58 
68  {
69  public:
71  private:
72  typedef boost::weak_ptr<RosPublishActivity> weak_ptr;
74  static weak_ptr ros_pub_act;
75 
79  typedef std::set< RosPublisher* > Publishers;
80  typedef Publishers::iterator iterator;
81  Publishers publishers;
83 
84  RosPublishActivity( const std::string& name);
85 
86  void loop();
87 
88  public:
96  static shared_ptr Instance();
97 
98  void addPublisher(RosPublisher* pub);
99  void removePublisher(RosPublisher* pub);
100 
102 
103  };//class
104 }//namespace
105 #endif
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 Mon May 10 2021 02:45:04