rtt_rosclock_sim_clock_activity_manager.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2013, Johannes Meyer, TU Darmstadt
5  * Copyright (c) 2013, Intermodalics BVBA
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of TU Darmstadt and Intermodalics BVBA
19  * nor the names of its contributors may be
20  * used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * Copyright (c) 2014, Jonathan Bohren, The Johns Hopkins University
37  * - Generalized for multiple time sources
38  * - Integrated with rtt_rosclock package
39  *********************************************************************/
40 
41 #ifndef __RTT_ROSCLOCK_RTT_ROSCLOCK_SIM_CLOCK_ACTIVITY_MANAGER_H
42 #define __RTT_ROSCLOCK_RTT_ROSCLOCK_SIM_CLOCK_ACTIVITY_MANAGER_H
43 
45 
46 #include <rtt/os/TimeService.hpp>
47 #include <rtt/os/Mutex.hpp>
48 
49 #include <list>
50 
51 namespace rtt_rosclock {
52 
53  class SimClockActivity;
54 
64  {
65  public:
68 
71 
73 
76 
78  void update();
79 
80  protected:
86 
87  private:
89  friend class SimClockActivity;
90 
92  void add(SimClockActivity *activity);
94  void remove(SimClockActivity *activity);
95 
96  private:
97 
99  static boost::weak_ptr<SimClockActivityManager> singleton;
100 
103 
105  std::list<SimClockActivity *> activities_;
106 
109  };
110 
111 }
112 
113 #endif // ifndef __RTT_ROSCLOCK_RTT_ROSCLOCK_SIM_CLOCK_ACTIVITY_MANAGER_H
double Seconds
void operator=(SimClockActivityManager const &)
static boost::shared_ptr< SimClockActivityManager > Instance()
Get an instance of the singleton.
XmlRpcServer s
static boost::weak_ptr< SimClockActivityManager > singleton
SimClockActivityManager singleton.
SimClockActivityManager()
The SimClockActivityManager is a singleton and is constructed by calling Instance() ...
RTT::os::Mutex modify_activities_mutex_
Mutex used to exclude adding and removing activities from the update to all activities.
void add(SimClockActivity *activity)
Add an activity to the manager.
static boost::shared_ptr< SimClockActivityManager > GetInstance()
Get an instance of the singleton if it exists, null pointer otherwise.
A centralized list of all TaskContexts using SimClockActivity.
std::list< SimClockActivity * > activities_
All existing SimClockActivities.
void update()
Execute all activities modulo their desired periods.
RTT::Seconds simulation_period_
The desired/expected simulation period.


rtt_rosclock
Author(s):
autogenerated on Sat Jun 8 2019 18:06:00