use modern construct '= default' for special functions.
[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) 2019 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     if( this != &other )
65     {
66       mBufferIndex = other.mBufferIndex;
67       mInput = other.mInput;
68     }
69
70     return *this;
71   }
72
73   /**
74    * Virtual Destructor
75    */
76   ~PropertyInputIndexer() override = default;
77
78   /**
79    * @copydoc Dali::Internal::PropertyInput::GetType()
80    */
81   Property::Type GetType() const override
82   {
83     return mInput->GetType();
84   }
85
86   /**
87    * @copydoc Dali::Internal::PropertyInput::GetBoolean()
88    */
89   const bool& GetBoolean() const override
90   {
91     return mInput->GetConstraintInputBoolean( mBufferIndex );
92   }
93
94   /**
95    * @copydoc Dali::Internal::PropertyInput::GetInteger()
96    */
97   const int& GetInteger() const override
98   {
99     return mInput->GetConstraintInputInteger( mBufferIndex );
100   }
101
102   /**
103    * @copydoc Dali::Internal::PropertyInput::GetFloat()
104    */
105   const float& GetFloat() const override
106   {
107     return mInput->GetConstraintInputFloat( mBufferIndex );
108   }
109
110   /**
111    * @copydoc Dali::Internal::PropertyInput::GetVector2()
112    */
113   const Vector2& GetVector2() const override
114   {
115     return mInput->GetConstraintInputVector2( mBufferIndex );
116   }
117
118   /**
119    * @copydoc Dali::Internal::PropertyInput::GetVector3()
120    */
121   const Vector3& GetVector3() const override
122   {
123     return mInput->GetConstraintInputVector3( mBufferIndex );
124   }
125
126   /**
127    * @copydoc Dali::Internal::PropertyInput::GetVector4()
128    */
129   const Vector4& GetVector4() const override
130   {
131     return mInput->GetConstraintInputVector4( mBufferIndex );
132   }
133
134   /**
135    * @copydoc Dali::Internal::PropertyInput::GetMatrix3()
136    */
137   const Matrix3& GetMatrix3() const override
138   {
139     return mInput->GetConstraintInputMatrix3( mBufferIndex );
140   }
141
142   /**
143    * @copydoc Dali::Internal::PropertyInput::GetMatrix()
144    */
145   const Matrix& GetMatrix() const override
146   {
147     return mInput->GetConstraintInputMatrix( mBufferIndex );
148   }
149
150   /**
151    * @copydoc Dali::Internal::PropertyInput::Quaternion()
152    */
153   const Quaternion& GetQuaternion() const override
154   {
155     return mInput->GetConstraintInputQuaternion( mBufferIndex );
156   }
157
158 public:
159
160   BufferIndex mBufferIndex;
161   const AccessorType* mInput;
162 };
163
164 } // namespace Internal
165
166 } // namespace Dali
167
168 #endif // DALI_PROPERTY_INPUT_INDEXER_H