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
void
work(
base::RunnableInterface::WorkReason
reason);
291
295
virtual
bool
trigger
();
296
300
virtual
bool
timeout();
301
};
302
}}
303
304
#endif
RTT::extras::FileDescriptorActivity
Definition:
FileDescriptorActivity.hpp:104
RTT::Seconds
double Seconds
Definition:
os/Time.hpp:53
RTT::extras::FileDescriptorActivity::m_trigger
bool m_trigger
Definition:
FileDescriptorActivity.hpp:122
RTT::extras::FileDescriptorActivity::m_timeout_us
int m_timeout_us
Definition:
FileDescriptorActivity.hpp:110
RTT::extras::FileDescriptorActivity::m_break_loop
bool m_break_loop
Definition:
FileDescriptorActivity.hpp:121
RTT::base::RunnableInterface
A class for running a certain piece of code in a thread.
Definition:
RunnableInterface.hpp:69
RTT::base::RunnableInterface::WorkReason
WorkReason
Definition:
RunnableInterface.hpp:76
RTT::extras::FileDescriptorActivity::m_update_sets
bool m_update_sets
Definition:
FileDescriptorActivity.hpp:123
RTT::extras::FileDescriptorActivity::m_command_mutex
RTT::os::Mutex m_command_mutex
Definition:
FileDescriptorActivity.hpp:120
RTT::extras::FileDescriptorActivity::m_fd_work
fd_set m_fd_work
Definition:
FileDescriptorActivity.hpp:115
RTT::extras::FileDescriptorActivity::m_fd_set
fd_set m_fd_set
Definition:
FileDescriptorActivity.hpp:114
RTT::extras::FileDescriptorActivityInterface
Definition:
FileDescriptorActivityInterface.hpp:95
RTT::extras::FileDescriptorActivity::m_has_error
bool m_has_error
Definition:
FileDescriptorActivity.hpp:116
RTT::Activity
An Activity executes a RunnableInterface object in a (periodic) thread.
Definition:
Activity.hpp:70
RTT::extras::FileDescriptorActivity::m_watched_fds
std::set< int > m_watched_fds
Definition:
FileDescriptorActivity.hpp:107
RTT::extras::FileDescriptorActivity::m_has_timeout
bool m_has_timeout
Definition:
FileDescriptorActivity.hpp:117
RTT::os::Mutex
An object oriented wrapper around a non recursive mutex.
Definition:
Mutex.hpp:92
RTT
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition:
Activity.cpp:53
RTT::extras::FileDescriptorActivity::m_period
Seconds m_period
timeout in microseconds
Definition:
FileDescriptorActivity.hpp:111
RTT::extras::FileDescriptorActivity::m_running
bool m_running
Definition:
FileDescriptorActivity.hpp:108
FileDescriptorActivityInterface.hpp
RTT::extras::FileDescriptorActivity::m_lock
RTT::os::Mutex m_lock
intended period
Definition:
FileDescriptorActivity.hpp:113
adaptor::trigger
static bool trigger(TaskContext *tc)
Definition:
dataflow_performance_test.cpp:334
rtt
Author(s): RTT Developers
autogenerated on Tue Jun 25 2019 19:33:24