Changed 'virtual' function override declarations to 'override' in automated-tests.
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / common / timer-impl.h
1 #ifndef DALI_INTERNAL_TIMER_H
2 #define DALI_INTERNAL_TIMER_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/dali-adaptor-common.h>
26 #include <dali/internal/system/common/timer-interface.h>
27 #include <dali/public-api/adaptor-framework/timer.h>
28
29 namespace Dali
30 {
31
32 namespace Internal
33 {
34
35 namespace Adaptor
36 {
37 class Timer;
38
39 typedef IntrusivePtr<Timer> TimerPtr;
40
41 /**
42  * Implementation of the timer
43  */
44 class Timer : public BaseObject, public TimerInterface
45 {
46 public:
47   static TimerPtr New( unsigned int milliSec );
48
49   /**
50    * Constructor
51    * @param[in]  milliSec  Interval in milliseconds.
52    */
53   Timer( unsigned int milliSec );
54
55   /**
56    * Destructor.
57    */
58   virtual ~Timer();
59
60 public:
61
62   /**
63    * @copydoc Dali::Timer::Start()
64    */
65   virtual void Start();
66
67   /**
68    * @copydoc Dali::Timer::Stop()
69    */
70   virtual void Stop();
71
72   /**
73    * @copydoc Dali::Timer::Pause()
74    */
75   virtual void Pause();
76
77   /**
78    * @copydoc Dali::Timer::Resume()
79    */
80   virtual void Resume();
81
82   /**
83    * @copydoc Dali::Timer::SetInterval()
84    */
85   virtual void SetInterval( unsigned int interval, bool restart );
86
87   /**
88    * @copydoc Dali::Timer::GetInterval()
89    */
90   virtual unsigned int GetInterval() const;
91
92   /**
93    * @copydoc Dali::Timer::IsRunning()
94    */
95   virtual bool IsRunning() const;
96
97   /**
98    * Tick
99    */
100   bool Tick();
101
102 public: // Signals
103
104   Dali::Timer::TimerSignalType& TickSignal();
105
106 private: // Implementation
107
108   // not implemented
109   Timer( const Timer& );
110   Timer& operator=( const Timer& );
111
112   /**
113    * Resets any stored timer data.
114    */
115   void ResetTimerData();
116
117 private: // Data
118
119   Dali::Timer::TimerSignalType mTickSignal;
120
121   // To hide away implementation details
122   struct Impl;
123   Impl* mImpl;
124 };
125
126 inline Timer& GetImplementation(Dali::Timer& timer)
127 {
128   DALI_ASSERT_ALWAYS(timer && "Timer handle is empty");
129
130   BaseObject& handle = timer.GetBaseObject();
131
132   return static_cast<Internal::Adaptor::Timer&>(handle);
133 }
134
135 inline const Timer& GetImplementation(const Dali::Timer& timer)
136 {
137   DALI_ASSERT_ALWAYS(timer && "Timer handle is empty");
138
139   const BaseObject& handle = timer.GetBaseObject();
140
141   return static_cast<const Internal::Adaptor::Timer&>(handle);
142 }
143
144 } // namespace Adaptor
145
146 } // namespace Internal
147
148 } // namespace Dali
149
150 #endif // DALI_INTERNAL_TIMER_H