Merge "Added animation and constraint support for UNSIGNED_INTEGER property type...
[platform/core/uifw/dali-core.git] / dali / internal / event / animation / property-input-indexer.h
1 #ifndef __DALI_PROPERTY_INPUT_INDEXER_H__
2 #define __DALI_PROPERTY_INPUT_INDEXER_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 // INTERNAL INCLUDES
22 #include <dali/internal/event/common/property-input-impl.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 /**
31  * Helper object to map public-api PropertyInput methods to internal
32  * PropertyInputImpl methods (which require the current buffer index).
33  */
34 template < typename AccessorType >
35 class PropertyInputIndexer : public PropertyInput
36 {
37 public:
38
39   /**
40    * Create an indexer object.
41    * @param[in] bufferIndex The current buffer index.
42    * @param[in] input The internal property input.
43    */
44   PropertyInputIndexer( BufferIndex bufferIndex, const AccessorType* input )
45   : mBufferIndex( bufferIndex ),
46     mInput( input )
47   {
48   }
49
50   /**
51    * Copy constructor
52    */
53   PropertyInputIndexer( const PropertyInputIndexer& other )
54   : mBufferIndex( other.mBufferIndex ),
55     mInput( other.mInput )
56   {
57   }
58
59   /**
60    * Assignment operator
61    */
62   PropertyInputIndexer& operator=( const PropertyInputIndexer& other )
63   {
64     mBufferIndex = other.mBufferIndex;
65     mInput = other.mInput;
66
67     return *this;
68   }
69
70   /**
71    * Virtual Destructor
72    */
73   virtual ~PropertyInputIndexer()
74   {
75   }
76
77   /**
78    * @copydoc Dali::Internal::PropertyInput::GetType()
79    */
80   virtual Property::Type GetType() const
81   {
82     return mInput->GetType();
83   }
84
85   /**
86    * @copydoc Dali::Internal::PropertyInput::GetBoolean()
87    */
88   virtual const bool& GetBoolean() const
89   {
90     return mInput->GetConstraintInputBoolean( mBufferIndex );
91   }
92
93   /**
94    * @copydoc Dali::Internal::PropertyInput::GetInteger()
95    */
96   virtual const int& GetInteger() const
97   {
98     return mInput->GetConstraintInputInteger( mBufferIndex );
99   }
100
101   /**
102    * @copydoc Dali::Internal::PropertyInput::GetUnsignedInteger()
103    */
104   virtual const unsigned int& GetUnsignedInteger() const
105   {
106     return mInput->GetConstraintInputUnsignedInteger( mBufferIndex );
107   }
108
109   /**
110    * @copydoc Dali::Internal::PropertyInput::GetFloat()
111    */
112   virtual const float& GetFloat() const
113   {
114     return mInput->GetConstraintInputFloat( mBufferIndex );
115   }
116
117   /**
118    * @copydoc Dali::Internal::PropertyInput::GetVector2()
119    */
120   virtual const Vector2& GetVector2() const
121   {
122     return mInput->GetConstraintInputVector2( mBufferIndex );
123   }
124
125   /**
126    * @copydoc Dali::Internal::PropertyInput::GetVector3()
127    */
128   virtual const Vector3& GetVector3() const
129   {
130     return mInput->GetConstraintInputVector3( mBufferIndex );
131   }
132
133   /**
134    * @copydoc Dali::Internal::PropertyInput::GetVector4()
135    */
136   virtual const Vector4& GetVector4() const
137   {
138     return mInput->GetConstraintInputVector4( mBufferIndex );
139   }
140
141   /**
142    * @copydoc Dali::Internal::PropertyInput::GetMatrix3()
143    */
144   virtual const Matrix3& GetMatrix3() const
145   {
146     return mInput->GetConstraintInputMatrix3( mBufferIndex );
147   }
148
149   /**
150    * @copydoc Dali::Internal::PropertyInput::GetMatrix()
151    */
152   virtual const Matrix& GetMatrix() const
153   {
154     return mInput->GetConstraintInputMatrix( mBufferIndex );
155   }
156
157   /**
158    * @copydoc Dali::Internal::PropertyInput::Quaternion()
159    */
160   virtual const Quaternion& GetQuaternion() const
161   {
162     return mInput->GetConstraintInputQuaternion( mBufferIndex );
163   }
164
165 public:
166
167   unsigned int mBufferIndex;
168   const AccessorType* mInput;
169 };
170
171 } // namespace Internal
172
173 } // namespace Dali
174
175 #endif // __DALI_PROPERTY_INPUT_INDEXER_H__