Orocos Real-Time Toolkit
2.8.3
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
rtt
extras
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
31
#include "
FileDescriptorSimulationActivity.hpp
"
32
#include "
os/MainThread.hpp
"
33
34
using namespace
RTT
;
35
using namespace
extras;
36
37
FileDescriptorSimulationActivity::FileDescriptorSimulationActivity
(
int
priority,
38
base::RunnableInterface
* _r,
39
const
std::string& name) :
40
base
::
ActivityInterface
(_r),
41
period(0),
42
running(false)
43
{
44
// prevent compiler warnings
45
(void)priority;
46
(void)name;
47
}
48
49
FileDescriptorSimulationActivity::FileDescriptorSimulationActivity
(
int
scheduler,
50
int
priority,
51
base::RunnableInterface
* _r,
52
const
std::string& name) :
53
base
::
ActivityInterface
(_r),
54
period
(0),
55
running
(false)
56
{
57
// prevent compiler warnings
58
(void)priority;
59
(void)name;
60
}
61
62
FileDescriptorSimulationActivity::FileDescriptorSimulationActivity
(
int
scheduler,
63
int
priority,
64
Seconds
_p,
65
base::RunnableInterface
* _r,
66
const
std::string& name) :
67
base
::
ActivityInterface
(_r),
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
77
FileDescriptorSimulationActivity::FileDescriptorSimulationActivity
(
int
scheduler,
78
int
priority,
79
Seconds
_p,
80
unsigned
cpu_affinity,
81
base::RunnableInterface
* _r,
82
const
std::string& name) :
83
base
::
ActivityInterface
(_r),
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
94
FileDescriptorSimulationActivity::~FileDescriptorSimulationActivity
()
95
{
96
stop
();
97
}
98
99
/***************************************************************************
100
* FDAInterface functions
101
***************************************************************************/
102
103
void
FileDescriptorSimulationActivity::watch
(
int
fd)
104
{
105
(void)fd;
// prevent compiler warning
106
}
107
108
void
FileDescriptorSimulationActivity::unwatch
(
int
fd)
109
{
110
(void)fd;
// prevent compiler warning
111
}
112
113
void
FileDescriptorSimulationActivity::clearAllWatches
()
114
{
115
}
116
117
bool
FileDescriptorSimulationActivity::isWatched
(
int
fd)
const
118
{
119
(void)fd;
// prevent compiler warning
120
return
false
;
121
}
122
123
bool
FileDescriptorSimulationActivity::isUpdated
(
int
fd)
const
124
{
125
return
false
;
126
}
127
128
bool
FileDescriptorSimulationActivity::hasTimeout
()
const
129
{
130
return
false
;
131
}
132
133
bool
FileDescriptorSimulationActivity::hasError
()
const
134
{
135
return
false
;
136
}
137
138
void
FileDescriptorSimulationActivity::setTimeout
(
int
timeout)
139
{
140
(void)timeout;
// prevent compiler warning
141
}
142
143
void
FileDescriptorSimulationActivity::setTimeout_us
(
int
timeout_us)
144
{
145
(void)timeout_us;
// prevent compiler warning
146
}
147
148
int
FileDescriptorSimulationActivity::getTimeout
()
const
149
{
150
return
0;
151
}
152
153
int
FileDescriptorSimulationActivity::getTimeout_us
()
const
154
{
155
return
0;
156
}
157
158
/***************************************************************************
159
* ActivityInterface functions
160
***************************************************************************/
161
162
163
bool
FileDescriptorSimulationActivity::start
()
164
{
165
if
(
running
) {
166
return
false
;
167
}
168
running
=
true
;
169
return
true
;
170
}
171
172
bool
FileDescriptorSimulationActivity::stop
()
173
{
174
if
(!
running
) {
175
return
false
;
176
}
177
running
=
false
;
178
return
true
;
179
}
180
181
bool
FileDescriptorSimulationActivity::isRunning
()
const
182
{
183
return
running
;
184
}
185
186
bool
FileDescriptorSimulationActivity::isActive
()
const
187
{
188
return
running
;
189
}
190
191
Seconds
FileDescriptorSimulationActivity::getPeriod
()
const
192
{
193
return
period
;
194
}
195
196
bool
FileDescriptorSimulationActivity::isPeriodic
()
const
197
{
198
return
(0 !=
period
);
199
}
200
201
bool
FileDescriptorSimulationActivity::setPeriod
(
Seconds
s)
202
{
203
if
(s < 0) {
204
return
false
;
205
}
206
period
= s;
207
return
true
;
208
}
209
210
unsigned
FileDescriptorSimulationActivity::getCpuAffinity
()
const
211
{
212
return
0;
213
}
214
215
bool
FileDescriptorSimulationActivity::setCpuAffinity
(
unsigned
cpu)
216
{
217
(void)cpu;
// prevent compiler warning
218
return
true
;
219
}
220
221
bool
FileDescriptorSimulationActivity::execute
()
222
{
223
return
true
;
224
}
225
226
bool
FileDescriptorSimulationActivity::trigger
()
227
{
228
return
true
;
229
}
230
231
os::ThreadInterface
*
FileDescriptorSimulationActivity::thread
()
232
{
233
return
os::MainThread::Instance
();
234
}
RTT::extras::FileDescriptorSimulationActivity::FileDescriptorSimulationActivity
FileDescriptorSimulationActivity(int priority, base::RunnableInterface *_r=0, const std::string &name="FileDescriptorSimulationActivity")
Definition:
FileDescriptorSimulationActivity.cpp:37
RTT::extras::FileDescriptorSimulationActivity::thread
virtual os::ThreadInterface * thread()
Returns os::MainThread::Instance()
Definition:
FileDescriptorSimulationActivity.cpp:231
RTT::Seconds
double Seconds
Seconds are stored as a double precision float.
Definition:
Time.hpp:53
RTT::os::MainThread::Instance
static ThreadInterface * Instance()
Return an object which represents the main thread.
Definition:
MainThread.cpp:58
RTT::extras::FileDescriptorSimulationActivity::setPeriod
virtual bool setPeriod(Seconds s)
If s>0 then returns true and period == s, otherwise returns false.
Definition:
FileDescriptorSimulationActivity.cpp:201
RTT::extras::FileDescriptorSimulationActivity::getPeriod
virtual Seconds getPeriod() const
Returns period.
Definition:
FileDescriptorSimulationActivity.cpp:191
RTT::extras::FileDescriptorSimulationActivity::watch
void watch(int fd)
Does nothing.
Definition:
FileDescriptorSimulationActivity.cpp:103
RTT::base::RunnableInterface
A class for running a certain piece of code in a thread.
Definition:
RunnableInterface.hpp:69
RTT::extras::FileDescriptorSimulationActivity::isUpdated
bool isUpdated(int fd) const
Return false.
Definition:
FileDescriptorSimulationActivity.cpp:123
RTT::extras::FileDescriptorSimulationActivity::trigger
virtual bool trigger()
Returns true.
Definition:
FileDescriptorSimulationActivity.cpp:226
RTT::extras::FileDescriptorSimulationActivity::getCpuAffinity
virtual unsigned getCpuAffinity() const
Returns 0.
Definition:
FileDescriptorSimulationActivity.cpp:210
FileDescriptorSimulationActivity.hpp
RTT::extras::FileDescriptorSimulationActivity::running
bool running
Definition:
FileDescriptorSimulationActivity.hpp:165
RTT::os::ThreadInterface
A thread which is being run.
Definition:
ThreadInterface.hpp:56
RTT::extras::FileDescriptorSimulationActivity::hasTimeout
bool hasTimeout() const
Return false.
Definition:
FileDescriptorSimulationActivity.cpp:128
RTT::extras::FileDescriptorSimulationActivity::unwatch
void unwatch(int fd)
Does nothing.
Definition:
FileDescriptorSimulationActivity.cpp:108
RTT::extras::FileDescriptorSimulationActivity::setCpuAffinity
virtual bool setCpuAffinity(unsigned cpu)
Returns true.
Definition:
FileDescriptorSimulationActivity.cpp:215
MainThread.hpp
RTT::extras::FileDescriptorSimulationActivity::isRunning
virtual bool isRunning() const
Returns true.
Definition:
FileDescriptorSimulationActivity.cpp:181
RTT::base::ActivityInterface
Interface to start/stop and query a Activity.
Definition:
ActivityInterface.hpp:62
RTT::extras::FileDescriptorSimulationActivity::getTimeout
int getTimeout() const
Return 0.
Definition:
FileDescriptorSimulationActivity.cpp:148
RTT::extras::FileDescriptorSimulationActivity::isWatched
bool isWatched(int fd) const
Returns false always.
Definition:
FileDescriptorSimulationActivity.cpp:117
RTT::extras::FileDescriptorSimulationActivity::~FileDescriptorSimulationActivity
virtual ~FileDescriptorSimulationActivity()
Cleanup and notify the base::RunnableInterface that we are gone.
Definition:
FileDescriptorSimulationActivity.cpp:94
RTT::extras::FileDescriptorSimulationActivity::isActive
virtual bool isActive() const
Returns true.
Definition:
FileDescriptorSimulationActivity.cpp:186
RTT::extras::FileDescriptorSimulationActivity::hasError
bool hasError() const
True if one of the file descriptors has a problem (for instance it has been closed) ...
Definition:
FileDescriptorSimulationActivity.cpp:133
base
RTT::extras::FileDescriptorSimulationActivity::stop
virtual bool stop()
Returns true.
Definition:
FileDescriptorSimulationActivity.cpp:172
RTT::extras::FileDescriptorSimulationActivity::setTimeout_us
void setTimeout_us(int timeout_us)
Does nothing.
Definition:
FileDescriptorSimulationActivity.cpp:143
RTT::extras::FileDescriptorSimulationActivity::getTimeout_us
int getTimeout_us() const
Returns 0.
Definition:
FileDescriptorSimulationActivity.cpp:153
RTT::extras::FileDescriptorSimulationActivity::period
Seconds period
Fake period - some classes require period!=0.
Definition:
FileDescriptorSimulationActivity.hpp:163
RTT::extras::FileDescriptorSimulationActivity::execute
virtual bool execute()
Returns true.
Definition:
FileDescriptorSimulationActivity.cpp:221
RTT
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition:
Activity.cpp:51
RTT::extras::FileDescriptorSimulationActivity::isPeriodic
virtual bool isPeriodic() const
Returns true iff (0 != period)
Definition:
FileDescriptorSimulationActivity.cpp:196
RTT::extras::FileDescriptorSimulationActivity::setTimeout
void setTimeout(int timeout)
Does nothing.
Definition:
FileDescriptorSimulationActivity.cpp:138
RTT::extras::FileDescriptorSimulationActivity::start
virtual bool start()
Returns true.
Definition:
FileDescriptorSimulationActivity.cpp:163
RTT::extras::FileDescriptorSimulationActivity::clearAllWatches
void clearAllWatches()
Does nothing.
Definition:
FileDescriptorSimulationActivity.cpp:113
Generated on Fri Apr 5 2019 12:14:47 for Orocos Real-Time Toolkit by
1.8.11