Last change
on this file since 28 was 13, checked in by Bayard Gildas, 9 years ago |
formatting script + include reformatted
|
File size:
886 bytes
|
Line | |
---|
1 | // %flair:license{
|
---|
2 | // This file is part of the Flair framework distributed under the
|
---|
3 | // CECILL-C License, Version 1.0.
|
---|
4 | // %flair:license}
|
---|
5 | /*!
|
---|
6 | * \file Watchdog.h
|
---|
7 | * \brief Watchdog Class
|
---|
8 | * \author Gildas Bayard, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
9 | * \date 2016/02/25
|
---|
10 | * \version 1.0
|
---|
11 | */
|
---|
12 |
|
---|
13 | #ifndef WATCHDOG_H
|
---|
14 | #define WATCHDOG_H
|
---|
15 |
|
---|
16 | #include <Thread.h>
|
---|
17 | #include <functional>
|
---|
18 |
|
---|
19 | namespace flair {
|
---|
20 | namespace core {
|
---|
21 |
|
---|
22 | /*! \class Watchdog
|
---|
23 | *
|
---|
24 | * \brief Watchdog class
|
---|
25 | *
|
---|
26 | * Calls a given function if not touched within a specified period of time
|
---|
27 | *
|
---|
28 | */
|
---|
29 | class Watchdog : public Thread {
|
---|
30 | public:
|
---|
31 | Watchdog(const Object *parent, std::function<void()> _expired, Time _timer);
|
---|
32 | ~Watchdog();
|
---|
33 |
|
---|
34 | // reset the timer
|
---|
35 | void Touch();
|
---|
36 | void SetTimer(Time _Timer);
|
---|
37 |
|
---|
38 | private:
|
---|
39 | void Run();
|
---|
40 | std::function<void()> expired;
|
---|
41 | Time timer;
|
---|
42 | };
|
---|
43 |
|
---|
44 | } // end namespace core
|
---|
45 | } // end namespace flair
|
---|
46 |
|
---|
47 | #endif // WATCHDOG_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.