YARP
Yet Another Robot Platform
PeriodicThread.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3
* Copyright (C) 2006-2010 RobotCub Consortium
4
* All rights reserved.
5
*
6
* This software may be modified and distributed under the terms of the
7
* BSD-3-Clause license. See the accompanying LICENSE file for details.
8
*/
9
10
#ifndef YARP_OS_PERIODICTHREAD_H
11
#define YARP_OS_PERIODICTHREAD_H
12
13
#include <
yarp/os/api.h
>
14
#include <
yarp/os/Time.h
>
15
16
namespace
yarp
{
17
namespace
os {
18
24
class
YARP_os_API
PeriodicThread
25
{
26
public
:
38
explicit
PeriodicThread
(
double
period,
39
ShouldUseSystemClock
useSystemClock
= ShouldUseSystemClock::No);
40
41
virtual
~
PeriodicThread
();
42
47
bool
start();
48
54
void
step();
55
62
void
stop();
63
68
void
askToStop();
69
73
bool
isRunning()
const
;
74
78
bool
isSuspended()
const
;
79
85
bool
setPeriod(
double
period);
86
91
double
getPeriod()
const
;
92
97
void
suspend();
98
102
void
resume();
103
107
void
resetStat();
108
112
double
getEstimatedPeriod()
const
;
113
119
void
getEstimatedPeriod(
double
& av,
double
& std)
const
;
120
124
unsigned
int
getIterations()
const
;
125
130
double
getEstimatedUsed()
const
;
131
137
void
getEstimatedUsed(
double
& av,
double
& std)
const
;
138
152
int
setPriority(
int
priority,
int
policy = -1);
153
158
int
getPriority()
const
;
159
164
int
getPolicy()
const
;
165
166
protected
:
178
virtual
bool
threadInit();
179
186
virtual
void
threadRelease();
187
199
virtual
void
run
() = 0;
200
205
virtual
void
beforeStart();
206
212
virtual
void
afterStart(
bool
success);
213
214
#ifndef DOXYGEN_SHOULD_SKIP_THIS
215
private
:
216
class
Private
;
217
Private
* mPriv;
218
#endif // DOXYGEN_SHOULD_SKIP_THIS
219
};
220
221
}
// namespace os
222
}
// namespace yarp
223
224
#endif // YARP_OS_PERIODICTHREAD_H
api.h
YARP_os_API
#define YARP_os_API
Definition:
api.h:19
yarp::os::Time::useSystemClock
void useSystemClock()
Configure YARP to use system time (this is the default).
Definition:
Time.cpp:147
yarp::os::PeriodicThread
An abstraction for a periodic thread.
Definition:
PeriodicThread.h:25
yarp::os::PeriodicThread::Private
Definition:
PeriodicThread.cpp:24
yarp
The main, catch-all namespace for YARP.
Definition:
environment.h:18
yarp::os::ShouldUseSystemClock
ShouldUseSystemClock
Definition:
Time.h:23
Time.h
yarp::os::PeriodicThread::run
virtual void run()=0
Loop function.
YARP
3.4.100+20201223.2+gitb8ea4d712
src
libYARP_os
src
yarp
os
PeriodicThread.h
Generated on Sun Jan 3 2021 02:46:25 for YARP by
1.8.20