Orocos Real-Time Toolkit  2.8.3
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 {
44  // prevent compiler warnings
45  (void)priority;
46  (void)name;
47 }
48 
50  int priority,
52  const std::string& name) :
54  period(0),
55  running(false)
56 {
57  // prevent compiler warnings
58  (void)priority;
59  (void)name;
60 }
61 
63  int priority,
64  Seconds _p,
66  const std::string& name) :
68  period(_p >= 0.0 ? _p : 0.0),
69  running(false)
70 {
71  // prevent compiler warnings
72  (void)scheduler;
73  (void)priority;
74  (void)name;
75 }
76 
78  int priority,
79  Seconds _p,
80  unsigned cpu_affinity,
82  const std::string& name) :
84  period(_p >= 0.0 ? _p : 0.0),
85  running(false)
86 {
87  // prevent compiler warnings
88  (void)scheduler;
89  (void)priority;
90  (void)cpu_affinity;
91  (void)name;
92 }
93 
95 {
96  stop();
97 }
98 
99 /***************************************************************************
100  * FDAInterface functions
101  ***************************************************************************/
102 
104 {
105  (void)fd; // prevent compiler warning
106 }
107 
109 {
110  (void)fd; // prevent compiler warning
111 }
112 
114 {
115 }
116 
118 {
119  (void)fd; // prevent compiler warning
120  return false;
121 }
122 
124 {
125  return false;
126 }
127 
129 {
130  return false;
131 }
132 
134 {
135  return false;
136 }
137 
139 {
140  (void)timeout; // prevent compiler warning
141 }
142 
144 {
145  (void)timeout_us; // prevent compiler warning
146 }
147 
149 {
150  return 0;
151 }
152 
154 {
155  return 0;
156 }
157 
158 /***************************************************************************
159  * ActivityInterface functions
160  ***************************************************************************/
161 
162 
164 {
165  if (running) {
166  return false;
167  }
168  running = true;
169  return true;
170 }
171 
173 {
174  if (!running) {
175  return false;
176  }
177  running = false;
178  return true;
179 }
180 
182 {
183  return running;
184 }
185 
187 {
188  return running;
189 }
190 
192 {
193  return period;
194 }
195 
197 {
198  return (0 != period);
199 }
200 
202 {
203  if (s < 0) {
204  return false;
205  }
206  period = s;
207  return true;
208 }
209 
211 {
212  return 0;
213 }
214 
216 {
217  (void)cpu; // prevent compiler warning
218  return true;
219 }
220 
222 {
223  return true;
224 }
225 
227 {
228  return true;
229 }
230 
232 {
233  return os::MainThread::Instance();
234 }
FileDescriptorSimulationActivity(int priority, base::RunnableInterface *_r=0, const std::string &name="FileDescriptorSimulationActivity")
virtual os::ThreadInterface * thread()
Returns os::MainThread::Instance()
double Seconds
Seconds are stored as a double precision float.
Definition: Time.hpp:53
static ThreadInterface * Instance()
Return an object which represents the main thread.
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.
A thread which is being run.
Interface to start/stop and query a Activity.
virtual ~FileDescriptorSimulationActivity()
Cleanup and notify the base::RunnableInterface that we are gone.
bool hasError() const
True if one of the file descriptors has a problem (for instance it has been closed) ...
Seconds period
Fake period - some classes require period!=0.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:51
virtual bool isPeriodic() const
Returns true iff (0 != period)