00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef ORO_PERIODIC_ACTIVITY_HPP
00039 #define ORO_PERIODIC_ACTIVITY_HPP
00040
00041 #include "../base/RunnableInterface.hpp"
00042
00043 #include "../Time.hpp"
00044 #include "../base/ActivityInterface.hpp"
00045 #include "TimerThread.hpp"
00046
00047 #ifdef ORO_PRAGMA_INTERFACE
00048 #pragma interface
00049 #endif
00050
00051 namespace RTT
00052 { namespace extras {
00053
00054
00070 class RTT_API PeriodicActivity
00071 : public base::ActivityInterface
00072 {
00073 public:
00074
00088 PeriodicActivity(int priority, Seconds period, base::RunnableInterface* r=0 );
00089
00105 PeriodicActivity(int scheduler, int priority, Seconds period, base::RunnableInterface* r=0 );
00106
00124 PeriodicActivity(int scheduler, int priority, Seconds period, unsigned cpu_affinity, base::RunnableInterface* r=0 );
00125
00126
00136 PeriodicActivity(TimerThreadPtr thread, base::RunnableInterface* r=0);
00137
00149 PeriodicActivity(Seconds period, TimerThreadPtr thread, base::RunnableInterface* r=0 );
00150
00164 PeriodicActivity(secs sec, nsecs nsec, TimerThreadPtr thread, base::RunnableInterface* r=0 );
00165
00169 virtual ~PeriodicActivity();
00170
00171 virtual bool start();
00172
00173 virtual bool execute();
00174
00175 virtual bool trigger();
00176
00177 virtual bool stop();
00178
00179 virtual bool isRunning() const;
00180
00181 virtual bool isActive() const;
00182
00183 virtual bool isPeriodic() const;
00184
00185 virtual Seconds getPeriod() const;
00186
00187 virtual bool setPeriod(Seconds s);
00188
00189 virtual unsigned getCpuAffinity() const;
00190
00191 virtual bool setCpuAffinity(unsigned cpu);
00192
00193 virtual os::ThreadInterface* thread();
00194
00198 virtual bool initialize();
00199
00203 virtual void step();
00204
00208 virtual void finalize();
00209
00210 protected:
00211 void init();
00212
00216 bool running;
00217
00221 bool active;
00222
00226 TimerThreadPtr thread_;
00227 };
00228
00229 }}
00230
00231 #endif