1 #ifndef __DALI_INTERNAL_TIMER_H__
2 #define __DALI_INTERNAL_TIMER_H__
5 * Copyright (c) 2014 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>
27 #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::TimerSignalV2& TickSignal();
96 private: // Implementation
99 Timer( const Timer& );
100 Timer& operator=( const Timer& );
104 Dali::Timer::TimerSignalV2 mTickSignal;
106 // To hide away implementation details
111 inline Timer& GetImplementation(Dali::Timer& timer)
113 DALI_ASSERT_ALWAYS(timer && "Timer handle is empty");
115 BaseObject& handle = timer.GetBaseObject();
117 return static_cast<Internal::Adaptor::Timer&>(handle);
120 inline const Timer& GetImplementation(const Dali::Timer& timer)
122 DALI_ASSERT_ALWAYS(timer && "Timer handle is empty");
124 const BaseObject& handle = timer.GetBaseObject();
126 return static_cast<const Internal::Adaptor::Timer&>(handle);
129 } // namespace Adaptor
131 } // namespace Internal
135 #endif // __DALI_INTERNAL_TIMER_H__