RDK Documentation (Open Sourced RDK Components)
Timer.h
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 
21 /**
22 * @defgroup trm
23 * @{
24 * @defgroup common
25 * @{
26 **/
27 
28 
29 #ifndef TRM_TIMER_H_
30 #define TRM_TIMER_H_
31 
32 #include <stdint.h>
33 
34 #include "TRM.h"
35 
36 TRM_BEGIN_NAMESPACE
37 class TimerTask
38 {
39 public:
40  virtual void run(void) {};
41  virtual ~TimerTask() {};
42  virtual TimerTask* clone() = 0;
43 };
44 
45 class Timer
46 {
47 public:
48  Timer(const std::string &token);
49  void schedule(TimerTask &task, int64_t milliSecs, bool absolute = false);
50  const std::string& getToken(void) const {return token;}
51  void cancel(void);
52  ~Timer(void);
53 private:
54  void *data;
55  std::string token;
56 };
57 
58 
59 TRM_END_NAMESPACE
60 #endif
61 
62 
63 /** @} */
64 /** @} */
TRM::TimerTask
Definition: Timer.h:37
TRM::Timer
Definition: Timer.h:45