1 #ifndef __DALI_INTERNAL_TIMER_H__
2 #define __DALI_INTERNAL_TIMER_H__
5 * Copyright (c) 2017 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/common/dali-common.h>
23 #include <dali/public-api/object/base-object.h>
26 #include <base/interfaces/timer-interface.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::SetInterval()
75 virtual void SetInterval( unsigned int interval );
78 * @copydoc Dali::Timer::GetInterval()
80 virtual unsigned int GetInterval() const;
83 * @copydoc Dali::Timer::IsRunning()
85 virtual bool IsRunning() const;
94 Dali::Timer::TimerSignalType& TickSignal();
96 private: // Implementation
99 Timer( const Timer& );
100 Timer& operator=( const Timer& );
103 * Resets any stored timer data.
105 void ResetTimerData();
109 Dali::Timer::TimerSignalType mTickSignal;
111 // To hide away implementation details
116 inline Timer& GetImplementation(Dali::Timer& timer)
118 DALI_ASSERT_ALWAYS(timer && "Timer handle is empty");
120 BaseObject& handle = timer.GetBaseObject();
122 return static_cast<Internal::Adaptor::Timer&>(handle);
125 inline const Timer& GetImplementation(const Dali::Timer& timer)
127 DALI_ASSERT_ALWAYS(timer && "Timer handle is empty");
129 const BaseObject& handle = timer.GetBaseObject();
131 return static_cast<const Internal::Adaptor::Timer&>(handle);
134 } // namespace Adaptor
136 } // namespace Internal
140 #endif // __DALI_INTERNAL_TIMER_H__