Orocos Real-Time Toolkit
2.8.3
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
rtt
extras
FileDescriptorActivity.hpp
Go to the documentation of this file.
1
/***************************************************************************
2
tag: Peter Soetens Thu Oct 22 11:59:08 CEST 2009 FileDescriptorActivity.hpp
3
4
FileDescriptorActivity.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 FILEDESCRIPTOR_ACTIVITY_HPP
40
#define FILEDESCRIPTOR_ACTIVITY_HPP
41
42
#include "
FileDescriptorActivityInterface.hpp
"
43
#include "../Activity.hpp"
44
#include <set>
45
46
namespace
RTT
{
namespace
extras {
47
104
class
RTT_API
FileDescriptorActivity
:
public
extras::FileDescriptorActivityInterface
,
105
public
Activity
106
{
107
std::set<int> m_watched_fds;
108
bool
m_running;
109
int
m_interrupt_pipe[2];
110
int
m_timeout_us;
111
Seconds
m_period;
112
113
mutable
RTT::os::Mutex
m_lock;
114
fd_set m_fd_set;
115
fd_set m_fd_work;
116
bool
m_has_error;
117
bool
m_has_timeout;
118
119
static
const
char
CMD_ANY_COMMAND = 0;
120
RTT::os::Mutex
m_command_mutex;
121
bool
m_break_loop;
122
bool
m_trigger;
123
bool
m_update_sets;
124
128
void
triggerUpdateSets();
129
130
public
:
140
FileDescriptorActivity
(
int
priority,
base::RunnableInterface
* _r = 0,
const
std::string& name =
"FileDescriptorActivity"
);
141
152
FileDescriptorActivity
(
int
scheduler,
int
priority,
base::RunnableInterface
* _r = 0,
const
std::string& name =
"FileDescriptorActivity"
);
153
165
FileDescriptorActivity
(
int
scheduler,
int
priority,
Seconds
period,
base::RunnableInterface
* _r = 0,
const
std::string& name =
"FileDescriptorActivity"
);
166
179
FileDescriptorActivity
(
int
scheduler,
int
priority,
Seconds
period,
unsigned
cpu_affinity,
180
base::RunnableInterface
* _r = 0,
const
std::string& name =
"FileDescriptorActivity"
);
181
182
virtual
~
FileDescriptorActivity
();
183
184
bool
isRunning()
const
;
185
187
virtual
Seconds
getPeriod()
const
;
188
190
virtual
bool
setPeriod(
Seconds
period);
191
198
void
watch(
int
fd);
199
206
void
unwatch(
int
fd);
207
209
void
clearAllWatches();
210
215
bool
isWatched(
int
fd)
const
;
216
225
bool
isUpdated(
int
fd)
const
;
226
234
bool
hasTimeout()
const
;
235
243
bool
hasError()
const
;
244
252
void
setTimeout(
int
timeout);
253
261
void
setTimeout_us(
int
timeout_us);
262
268
int
getTimeout()
const
;
269
275
int
getTimeout_us()
const
;
276
277
virtual
bool
start();
278
virtual
void
loop();
279
virtual
bool
breakLoop();
280
virtual
bool
stop();
281
285
virtual
void
step();
286
290
virtual
bool
trigger();
291
};
292
}}
293
294
#endif
RTT::extras::FileDescriptorActivity
An activity which is triggered by the availability of data on a set of file descriptors.
Definition:
FileDescriptorActivity.hpp:104
RTT::Seconds
double Seconds
Seconds are stored as a double precision float.
Definition:
Time.hpp:53
RTT::base::RunnableInterface
A class for running a certain piece of code in a thread.
Definition:
RunnableInterface.hpp:69
RTT_API
#define RTT_API
Definition:
rtt-config.h:97
RTT::extras::FileDescriptorActivityInterface
An activity which is triggered by the availability of data on a set of file descriptors.
Definition:
FileDescriptorActivityInterface.hpp:95
RTT::Activity
An Activity is an object that represents a thread.
Definition:
Activity.hpp:63
RTT::os::Mutex
An object oriented wrapper around a non recursive mutex.
Definition:
Mutex.hpp:82
RTT
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition:
Activity.cpp:51
FileDescriptorActivityInterface.hpp
Generated on Fri Apr 5 2019 12:14:47 for Orocos Real-Time Toolkit by
1.8.11