Activity.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Thu Oct 22 11:59:07 CEST 2009 Activity.hpp
3 
4  Activity.hpp - description
5  -------------------
6  begin : Thu October 22 2009
7  copyright : (C) 2009 Peter Soetens
8  email : peter@thesourcworks.com
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public *
13  * License as published by the Free Software Foundation; *
14  * version 2 of the License. *
15  * *
16  * As a special exception, you may use this file as part of a free *
17  * software library without restriction. Specifically, if other files *
18  * instantiate templates or use macros or inline functions from this *
19  * file, or you compile this file and link it with other files to *
20  * produce an executable, this file does not by itself cause the *
21  * resulting executable to be covered by the GNU General Public *
22  * License. This exception does not however invalidate any other *
23  * reasons why the executable file might be covered by the GNU General *
24  * Public License. *
25  * *
26  * This library is distributed in the hope that it will be useful, *
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
29  * Lesser General Public License for more details. *
30  * *
31  * You should have received a copy of the GNU General Public *
32  * License along with this library; if not, write to the Free Software *
33  * Foundation, Inc., 59 Temple Place, *
34  * Suite 330, Boston, MA 02111-1307 USA *
35  * *
36  ***************************************************************************/
37 
38 
39 #ifndef ORO_ACTIVITY_HPP
40 #define ORO_ACTIVITY_HPP
41 
42 #include "Time.hpp"
45 #include "os/Thread.hpp"
46 #include "os/Mutex.hpp"
47 #include "os/Condition.hpp"
48 
49 namespace RTT
50 {
51 
70  class RTT_API Activity
71  : public base::ActivityInterface, public os::Thread
72  {
73  public:
82  Activity(base::RunnableInterface* r = 0, const std::string& name ="Activity" );
83 
94  Activity(int priority,
95  base::RunnableInterface* r = 0, const std::string& name ="Activity");
96 
109  Activity(int priority, Seconds period,
110  base::RunnableInterface* r = 0, const std::string& name ="Activity");
111 
124  Activity(int scheduler, int priority,
125  base::RunnableInterface* r = 0, const std::string& name ="Activity");
126 
141  Activity(int scheduler, int priority, Seconds period,
142  base::RunnableInterface* r = 0, const std::string& name ="Activity");
143 
160  Activity(int scheduler, int priority, Seconds period, unsigned cpu_affinity,
161  base::RunnableInterface* r = 0, const std::string& name ="Activity");
162 
166  virtual ~Activity();
167 
168  virtual bool start();
169 
170  virtual bool execute();
171 
172  virtual bool trigger();
173 
174  virtual bool timeout();
175 
176  virtual bool stop();
177 
178  virtual bool isRunning() const;
179 
180  virtual bool isActive() const;
181 
182  virtual bool isPeriodic() const;
183 
184  virtual Seconds getPeriod() const;
185 
186  virtual bool setPeriod(Seconds period);
187 
188  virtual unsigned getCpuAffinity() const;
189 
190  virtual bool setCpuAffinity(unsigned cpu);
191 
192  void setWaitPeriodPolicy(int p);
193 
194  virtual os::ThreadInterface* thread();
195 
199  virtual bool initialize();
200 
204  virtual void step();
205 
209  virtual void loop();
210 
211  virtual void work(base::RunnableInterface::WorkReason reason);
212 
216  virtual bool breakLoop();
217 
221  virtual void finalize();
222  protected:
229 
233  bool mtimeout;
236  };
237 
238 }
239 
240 #endif
double update_period
Definition: Activity.hpp:228
double Seconds
Definition: os/Time.hpp:53
A class for running a certain piece of code in a thread.
bool mstopRequested
Definition: Activity.hpp:234
An object oriented wrapper around a condition variable.
Definition: Condition.hpp:60
static RTT_UNUSED bool setCpuAffinity(ThreadInterface *thread, const std::bitset< 16 > &cpu_affinity)
Interface to start/stop and query a Activity.
An Activity executes a RunnableInterface object in a (periodic) thread.
Definition: Activity.hpp:70
os::Condition msg_cond
Definition: Activity.hpp:224
static std::bitset< 16 > getCpuAffinity(ThreadInterface *thread)
An object oriented wrapper around a non recursive mutex.
Definition: Mutex.hpp:92
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
os::Mutex msg_lock
Definition: Activity.hpp:223
static bool trigger(TaskContext *tc)


rtt
Author(s): RTT Developers
autogenerated on Tue Jun 25 2019 19:33:19