1 #ifndef __DALI_INTERNAL_TIMER_H__
2 #define __DALI_INTERNAL_TIMER_H__
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/base-object.h>
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>
39 typedef IntrusivePtr<Timer> TimerPtr;
42 * Implementation of the timer
44 class Timer : public BaseObject, public TimerInterface
47 static TimerPtr New( unsigned int milliSec );
51 * @param[in] milliSec Interval in milliseconds.
53 Timer( unsigned int milliSec );
63 * @copydoc Dali::Timer::Start()
68 * @copydoc Dali::Timer::Stop()
73 * @copydoc Dali::Timer::Pause()
78 * @copydoc Dali::Timer::Resume()
80 virtual void Resume();
83 * @copydoc Dali::Timer::SetInterval()
85 virtual void SetInterval( unsigned int interval, bool restart );
88 * @copydoc Dali::Timer::GetInterval()
90 virtual unsigned int GetInterval() const;
93 * @copydoc Dali::Timer::IsRunning()
95 virtual bool IsRunning() const;
104 Dali::Timer::TimerSignalType& TickSignal();
106 private: // Implementation
109 Timer( const Timer& );
110 Timer& operator=( const Timer& );
113 * Resets any stored timer data.
115 void ResetTimerData();
119 Dali::Timer::TimerSignalType mTickSignal;
121 // To hide away implementation details
126 inline Timer& GetImplementation(Dali::Timer& timer)
128 DALI_ASSERT_ALWAYS(timer && "Timer handle is empty");
130 BaseObject& handle = timer.GetBaseObject();
132 return static_cast<Internal::Adaptor::Timer&>(handle);
135 inline const Timer& GetImplementation(const Dali::Timer& timer)
137 DALI_ASSERT_ALWAYS(timer && "Timer handle is empty");
139 const BaseObject& handle = timer.GetBaseObject();
141 return static_cast<const Internal::Adaptor::Timer&>(handle);
144 } // namespace Adaptor
146 } // namespace Internal
150 #endif // __DALI_INTERNAL_TIMER_H__