Dali 3D User Interface Engine
timer-impl.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_TIMER_H__
2 #define __DALI_INTERNAL_TIMER_H__
3 
4 /*
5  * Copyright (c) 2014 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
24 
25 // INTERNAL INCLUDES
27 #include <timer.h>
28 
29 namespace Dali
30 {
31 
32 namespace Internal
33 {
34 
35 namespace Adaptor
36 {
37 class Timer;
38 
40 
44 class Timer : public BaseObject, public TimerInterface
45 {
46 public:
47  static TimerPtr New( unsigned int milliSec );
48 
53  Timer( unsigned int milliSec );
54 
58  virtual ~Timer();
59 
60 public:
61 
65  virtual void Start();
66 
70  virtual void Stop();
71 
75  virtual void SetInterval( unsigned int interval );
76 
80  virtual unsigned int GetInterval() const;
81 
85  virtual bool IsRunning() const;
86 
90  bool Tick();
91 
92 public: // Signals
93 
95 
96 private: // Implementation
97 
98  // not implemented
99  Timer( const Timer& );
100  Timer& operator=( const Timer& );
101 
102 private: // Data
103 
105 
106  // To hide away implementation details
107  struct Impl;
108  Impl* mImpl;
109 };
110 
112 {
113  DALI_ASSERT_ALWAYS(timer && "Timer handle is empty");
114 
115  BaseObject& handle = timer.GetBaseObject();
116 
117  return static_cast<Internal::Adaptor::Timer&>(handle);
118 }
119 
120 inline const Timer& GetImplementation(const Dali::Timer& timer)
121 {
122  DALI_ASSERT_ALWAYS(timer && "Timer handle is empty");
123 
124  const BaseObject& handle = timer.GetBaseObject();
125 
126  return static_cast<const Internal::Adaptor::Timer&>(handle);
127 }
128 
129 } // namespace Adaptor
130 
131 } // namespace Internal
132 
133 } // namespace Dali
134 
135 #endif // __DALI_INTERNAL_TIMER_H__
Dali Docs Home
Read more about Dali