You.i Engine
YiTimer.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_TIMER_H_
3 #define _YI_TIMER_H_
4 
5 #include "framework/YiPredef.h"
6 #include "signal/YiSignal.h"
8 
9 class CYITimerPriv;
10 
27 class CYITimer : public CYISignalHandler
28 {
29 public:
33  enum class State
34  {
35  Off = 0,
36  Running,
37  Suspended
38  };
39 
45  CYITimer();
46 
54  CYITimer(int32_t timerID);
55  virtual ~CYITimer();
56 
60  CYITimer(CYITimer &&other);
61 
65  CYITimer &operator=(CYITimer &&other);
66 
72  uint64_t GetInterval() const;
73 
79  State GetState() const;
80 
86  bool IsSingleShot() const;
87 
91  void SetInterval(uint64_t intervalMs);
92 
100  void SetSingleShot(bool singleShot);
101 
111  void Start(uint64_t intervalMs);
112 
119  void Start();
120 
126  void Stop();
127 
133  void Suspend();
134 
140  void Resume();
141 
147  void SetTimerID(int32_t timerID);
148 
152  int32_t GetTimerID() const;
153 
160 
161 private:
162  std::unique_ptr<CYITimerPriv> m_pPriv;
163 
165 };
166 
169 #endif /* _YI_TIMER_H_ */
void SetTimerID(int32_t timerID)
void Suspend()
#define YI_DISALLOW_COPY_AND_ASSIGN(TypeName)
Delete the copy constructor and assignment operator (and consequently the move constructor as well) ...
Definition: YiPredef.h:122
State
Definition: YiTimer.h:33
void SetSingleShot(bool singleShot)
uint64_t GetInterval() const
void Stop()
int32_t GetTimerID() const
A low-precision timer driven by the update loop.
Definition: YiTimer.h:27
void Start()
void SetInterval(uint64_t intervalMs)
CYITimer & operator=(CYITimer &&other)
Definition: YiSignalHandler.h:175
virtual ~CYITimer()
bool IsSingleShot() const
State GetState() const
void Resume()
CYISignal< int32_t > TimedOut
Definition: YiTimer.h:159