Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
rtt
extras
FileDescriptorSimulationActivity.hpp
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
#ifndef FILEDESCRIPTORSIMULATION_ACTIVITY_HPP
32
#define FILEDESCRIPTORSIMULATION_ACTIVITY_HPP
33
34
#include "../base/ActivityInterface.hpp"
35
#include "../base/RunnableInterface.hpp"
36
#include "../extras/FileDescriptorActivityInterface.hpp"
37
38
namespace
RTT
{
namespace
extras {
39
58
class
RTT_API
FileDescriptorSimulationActivity
:
public
extras::FileDescriptorActivityInterface
,
59
public
base::ActivityInterface
60
{
61
public
:
62
// priority and name are ignored
63
FileDescriptorSimulationActivity
(
int
priority,
64
base::RunnableInterface
* _r = 0,
65
const
std::string& name =
"FileDescriptorSimulationActivity"
);
66
67
// scheduler, priority, and name, are ignored
68
FileDescriptorSimulationActivity
(
int
scheduler,
69
int
priority,
70
base::RunnableInterface
* _r = 0,
71
const
std::string& name =
"FileDescriptorSimulationActivity"
);
72
73
// scheduler, priority, and name, are ignored
74
FileDescriptorSimulationActivity
(
int
scheduler,
75
int
priority,
76
Seconds
period,
77
base::RunnableInterface
* _r = 0,
78
const
std::string& name =
"FileDescriptorSimulationActivity"
);
79
80
// scheduler, priority, cpu_affinity, and name, are ignored
81
FileDescriptorSimulationActivity
(
int
scheduler,
82
int
priority,
83
Seconds
period,
84
unsigned
cpu_affinity,
85
base::RunnableInterface
* _r = 0,
86
const
std::string& name =
"FileDescriptorSimulationActivity"
);
87
91
virtual
~
FileDescriptorSimulationActivity
();
92
93
/**********************************************************************
94
* FDAInterface functions
95
**********************************************************************/
96
98
void
watch(
int
fd);
99
101
void
unwatch(
int
fd);
102
104
void
clearAllWatches();
105
107
bool
isWatched(
int
fd)
const
;
108
111
bool
isUpdated(
int
fd)
const
;
112
115
bool
hasTimeout()
const
;
116
117
bool
hasError()
const
;
118
120
void
setTimeout(
int
timeout);
121
123
void
setTimeout_us(
int
timeout_us);
124
126
int
getTimeout()
const
;
127
129
int
getTimeout_us()
const
;
130
131
/**********************************************************************
132
* ActivityInterface functions
133
**********************************************************************/
134
136
virtual
bool
start();
138
virtual
bool
stop();
140
virtual
bool
isRunning()
const
;
142
virtual
bool
isActive()
const
;
144
virtual
Seconds
getPeriod()
const
;
146
virtual
bool
isPeriodic()
const
;
148
virtual
bool
setPeriod(
Seconds
s) ;
150
virtual
unsigned
getCpuAffinity
()
const
;
152
virtual
bool
setCpuAffinity
(
unsigned
cpu) ;
154
virtual
bool
execute();
156
virtual
bool
trigger
();
158
virtual
bool
timeout() ;
160
virtual
os::ThreadInterface
* thread();
161
163
virtual
void
work(
base::RunnableInterface::WorkReason
reason);
164
protected
:
167
Seconds
period
;
169
bool
running
;
172
base::RunnableInterface::WorkReason
lastReason
;
173
};
174
}}
175
176
#endif
RTT::Seconds
double Seconds
Definition:
os/Time.hpp:53
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::FileDescriptorSimulationActivity::running
bool running
Definition:
FileDescriptorSimulationActivity.hpp:169
RTT::os::ThreadInterface
Definition:
ThreadInterface.hpp:56
RTT::extras::FileDescriptorSimulationActivity
Definition:
FileDescriptorSimulationActivity.hpp:58
adaptor::setCpuAffinity
static RTT_UNUSED bool setCpuAffinity(ThreadInterface *thread, const std::bitset< 16 > &cpu_affinity)
Definition:
dataflow_performance_test.cpp:346
RTT::base::ActivityInterface
Interface to start/stop and query a Activity.
Definition:
ActivityInterface.hpp:62
RTT::extras::FileDescriptorActivityInterface
Definition:
FileDescriptorActivityInterface.hpp:95
RTT::extras::FileDescriptorSimulationActivity::period
Seconds period
Definition:
FileDescriptorSimulationActivity.hpp:167
adaptor::getCpuAffinity
static std::bitset< 16 > getCpuAffinity(ThreadInterface *thread)
Definition:
dataflow_performance_test.cpp:352
RTT
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition:
Activity.cpp:53
RTT::extras::FileDescriptorSimulationActivity::lastReason
base::RunnableInterface::WorkReason lastReason
Definition:
FileDescriptorSimulationActivity.hpp:172
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