FileDescriptorSimulationActivity.cpp
Go to the documentation of this file.
1 /***************************************************************************
2 
3  ***************************************************************************
4  * This library is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public *
6  * License as published by the Free Software Foundation; *
7  * version 2 of the License. *
8  * *
9  * As a special exception, you may use this file as part of a free *
10  * software library without restriction. Specifically, if other files *
11  * instantiate templates or use macros or inline functions from this *
12  * file, or you compile this file and link it with other files to *
13  * produce an executable, this file does not by itself cause the *
14  * resulting executable to be covered by the GNU General Public *
15  * License. This exception does not however invalidate any other *
16  * reasons why the executable file might be covered by the GNU General *
17  * Public License. *
18  * *
19  * This library is distributed in the hope that it will be useful, *
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22  * Lesser General Public License for more details. *
23  * *
24  * You should have received a copy of the GNU General Public *
25  * License along with this library; if not, write to the Free Software *
26  * Foundation, Inc., 59 Temple Place, *
27  * Suite 330, Boston, MA 02111-1307 USA *
28  * *
29  ***************************************************************************/
30 
32 #include "os/MainThread.hpp"
33 
34 using namespace RTT;
35 using namespace extras;
36 
39  const std::string& name) :
41  period(0),
42  running(false),
43  lastReason(base::RunnableInterface::TimeOut)
44 {
45  // prevent compiler warnings
46  (void)priority;
47  (void)name;
48 }
49 
51  int priority,
53  const std::string& name) :
55  period(0),
56  running(false),
58 {
59  // prevent compiler warnings
60  (void)priority;
61  (void)name;
62 }
63 
65  int priority,
66  Seconds _p,
68  const std::string& name) :
70  period(_p >= 0.0 ? _p : 0.0),
71  running(false),
73 {
74  // prevent compiler warnings
75  (void)scheduler;
76  (void)priority;
77  (void)name;
78 }
79 
81  int priority,
82  Seconds _p,
83  unsigned cpu_affinity,
85  const std::string& name) :
87  period(_p >= 0.0 ? _p : 0.0),
88  running(false),
90 {
91  // prevent compiler warnings
92  (void)scheduler;
93  (void)priority;
94  (void)cpu_affinity;
95  (void)name;
96 }
97 
99 {
100  stop();
101 }
102 
103 /***************************************************************************
104  * FDAInterface functions
105  ***************************************************************************/
106 
108 {
109  (void)fd; // prevent compiler warning
110 }
111 
113 {
114  (void)fd; // prevent compiler warning
115 }
116 
118 {
119 }
120 
122 {
123  (void)fd; // prevent compiler warning
124  return false;
125 }
126 
128 {
130 }
131 
133 {
135 }
136 
138 {
139  return false;
140 }
141 
143 {
144  (void)timeout; // prevent compiler warning
145 }
146 
148 {
149  (void)timeout_us; // prevent compiler warning
150 }
151 
153 {
154  return 0;
155 }
156 
158 {
159  return 0;
160 }
161 
162 /***************************************************************************
163  * ActivityInterface functions
164  ***************************************************************************/
165 
166 
168 {
169  if (running) {
170  return false;
171  }
172  running = true;
173  return true;
174 }
175 
177 {
178  if (!running) {
179  return false;
180  }
181  running = false;
182  return true;
183 }
184 
186 {
187  return running;
188 }
189 
191 {
192  return running;
193 }
194 
196 {
197  return period;
198 }
199 
201 {
202  return (0 != period);
203 }
204 
206 {
207  if (s < 0) {
208  return false;
209  }
210  period = s;
211  return true;
212 }
213 
215 {
216  return 0;
217 }
218 
220 {
221  (void)cpu; // prevent compiler warning
222  return true;
223 }
224 
226 {
227  return true;
228 }
229 
231 {
232  return true;
233 }
234 
236 {
237  return true;
238 }
239 
241 {
242  return os::MainThread::Instance();
243 }
244 
246 {
247  if (0 != runner) {
248  runner->work(reason);
249  lastReason = reason;
250  }
251 }
virtual void work(WorkReason reason)
FileDescriptorSimulationActivity(int priority, base::RunnableInterface *_r=0, const std::string &name="FileDescriptorSimulationActivity")
virtual os::ThreadInterface * thread()
Returns os::MainThread::Instance()
double Seconds
Definition: os/Time.hpp:53
static ThreadInterface * Instance()
Definition: MainThread.cpp:58
virtual bool setPeriod(Seconds s)
If s>0 then returns true and period == s, otherwise returns false.
A class for running a certain piece of code in a thread.
Interface to start/stop and query a Activity.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
virtual bool isPeriodic() const
Returns true iff (0 != period)
virtual void work(base::RunnableInterface::WorkReason reason)
If have a runner then pass the reason to the runner and store in lastReason.


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:33