rtt_rosclock_sim_clock_activity_manager.h
Go to the documentation of this file.
1 /*
2  * (C) 2013, Johannes Meyer, TU Darmstadt
3  * (C) 2013, Intermodalics BVBA
4  * (C) 2014, Jonathan Bohren, The Johns Hopkins University
5  * - Generalized for multiple time sources
6  * - Integrated with rtt_rosclock package
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  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16  * 3. Neither the name of the copyright holder nor the names of its contributors
17  * may be used to endorse or promote products derived from this software
18  * without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef __RTT_ROSCLOCK_RTT_ROSCLOCK_SIM_CLOCK_ACTIVITY_MANAGER_H
35 #define __RTT_ROSCLOCK_RTT_ROSCLOCK_SIM_CLOCK_ACTIVITY_MANAGER_H
36 
38 
39 #include <rtt/os/TimeService.hpp>
40 #include <rtt/os/Mutex.hpp>
41 
42 #include <list>
43 
44 namespace rtt_rosclock {
45 
46  class SimClockActivity;
47 
57  {
58  public:
61 
64 
66 
69 
71  void update();
72 
73  protected:
79 
80  private:
82  friend class SimClockActivity;
83 
85  void add(SimClockActivity *activity);
87  void remove(SimClockActivity *activity);
88 
89  private:
90 
92  static boost::weak_ptr<SimClockActivityManager> singleton;
93 
96 
98  std::list<SimClockActivity *> activities_;
99 
102  };
103 
104 }
105 
106 #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 Mon May 10 2021 02:45:33