1 #ifndef DALI_PROPERTY_INPUT_INDEXER_H
2 #define DALI_PROPERTY_INPUT_INDEXER_H
5 * Copyright (c) 2019 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/internal/event/common/property-input-impl.h>
31 * Helper object to map public-api PropertyInput methods to internal
32 * PropertyInputImpl methods (which require the current buffer index).
34 template < typename AccessorType >
35 class PropertyInputIndexer : public PropertyInput
40 * Create an indexer object.
41 * @param[in] bufferIndex The current buffer index.
42 * @param[in] input The internal property input.
44 PropertyInputIndexer( BufferIndex bufferIndex, const AccessorType* input )
45 : mBufferIndex( bufferIndex ),
53 PropertyInputIndexer( const PropertyInputIndexer& other )
54 : mBufferIndex( other.mBufferIndex ),
55 mInput( other.mInput )
62 PropertyInputIndexer& operator=( const PropertyInputIndexer& other )
66 mBufferIndex = other.mBufferIndex;
67 mInput = other.mInput;
76 ~PropertyInputIndexer() override = default;
79 * @copydoc Dali::Internal::PropertyInput::GetType()
81 Property::Type GetType() const override
83 return mInput->GetType();
87 * @copydoc Dali::Internal::PropertyInput::GetBoolean()
89 const bool& GetBoolean() const override
91 return mInput->GetConstraintInputBoolean( mBufferIndex );
95 * @copydoc Dali::Internal::PropertyInput::GetInteger()
97 const int& GetInteger() const override
99 return mInput->GetConstraintInputInteger( mBufferIndex );
103 * @copydoc Dali::Internal::PropertyInput::GetFloat()
105 const float& GetFloat() const override
107 return mInput->GetConstraintInputFloat( mBufferIndex );
111 * @copydoc Dali::Internal::PropertyInput::GetVector2()
113 const Vector2& GetVector2() const override
115 return mInput->GetConstraintInputVector2( mBufferIndex );
119 * @copydoc Dali::Internal::PropertyInput::GetVector3()
121 const Vector3& GetVector3() const override
123 return mInput->GetConstraintInputVector3( mBufferIndex );
127 * @copydoc Dali::Internal::PropertyInput::GetVector4()
129 const Vector4& GetVector4() const override
131 return mInput->GetConstraintInputVector4( mBufferIndex );
135 * @copydoc Dali::Internal::PropertyInput::GetMatrix3()
137 const Matrix3& GetMatrix3() const override
139 return mInput->GetConstraintInputMatrix3( mBufferIndex );
143 * @copydoc Dali::Internal::PropertyInput::GetMatrix()
145 const Matrix& GetMatrix() const override
147 return mInput->GetConstraintInputMatrix( mBufferIndex );
151 * @copydoc Dali::Internal::PropertyInput::Quaternion()
153 const Quaternion& GetQuaternion() const override
155 return mInput->GetConstraintInputQuaternion( mBufferIndex );
160 BufferIndex mBufferIndex;
161 const AccessorType* mInput;
164 } // namespace Internal
168 #endif // DALI_PROPERTY_INPUT_INDEXER_H