source: flair-dev/trunk/include/FlairCore/Watchdog.h@ 2

Last change on this file since 2 was 2, checked in by Sanahuja Guillaume, 8 years ago

initial commit flaircore

File size: 974 bytes
RevLine 
[2]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
19namespace flair {
20namespace 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 private:
38 void Run();
39 std::function<void()> expired;
40 Time timer;
41 };
42
43} // end namespace core
44} // end namespace flair
45
46#endif // WATCHDOG_H
Note: See TracBrowser for help on using the repository browser.