Adaptor refactor
[platform/core/uifw/dali-adaptor.git] / dali / public-api / adaptor-framework / timer.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/public-api/adaptor-framework/timer.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/system/common/timer-impl.h>
26
27 namespace Dali
28 {
29
30 Timer::Timer()
31 {
32 }
33
34 Timer Timer::New( unsigned int milliSec )
35 {
36   Internal::Adaptor::TimerPtr internal = Internal::Adaptor::Timer::New( milliSec );
37   return Timer(internal.Get());
38 }
39
40 Timer::Timer( const Timer& timer )
41 : BaseHandle(timer)
42 {
43 }
44
45 Timer& Timer::operator=( const Timer& timer )
46 {
47   // check self assignment
48   if( *this != timer )
49   {
50     BaseHandle::operator=(timer);
51   }
52   return *this;
53 }
54
55 Timer::~Timer()
56 {
57 }
58
59 Timer Timer::DownCast( BaseHandle handle )
60 {
61   return Timer( dynamic_cast<Internal::Adaptor::Timer*>( handle.GetObjectPtr() ) );
62 }
63
64 void Timer::Start()
65 {
66   Internal::Adaptor::GetImplementation(*this).Start();
67 }
68
69 void Timer::Stop()
70 {
71   Internal::Adaptor::GetImplementation(*this).Stop();
72 }
73
74 void Timer::SetInterval( unsigned int interval )
75 {
76   Internal::Adaptor::GetImplementation(*this).SetInterval( interval );
77 }
78
79 unsigned int Timer::GetInterval() const
80 {
81   return Internal::Adaptor::GetImplementation(*this).GetInterval();
82 }
83
84 bool Timer::IsRunning() const
85 {
86   return Internal::Adaptor::GetImplementation(*this).IsRunning();
87 }
88
89 Timer::TimerSignalType& Timer::TickSignal()
90 {
91   return Internal::Adaptor::GetImplementation(*this).TickSignal();
92 }
93
94 Timer::Timer(Internal::Adaptor::Timer* timer)
95 : BaseHandle(timer)
96 {
97 }
98
99
100 } // namespace Dali