1 #ifndef DALI_PROPERTY_INPUT_INDEXER_H
2 #define DALI_PROPERTY_INPUT_INDEXER_H
5 * Copyright (c) 2021 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>
29 * Helper object to map public-api PropertyInput methods to internal
30 * PropertyInputImpl methods (which require the current buffer index).
32 template<typename AccessorType>
33 class PropertyInputIndexer : public PropertyInput
37 * Create an indexer object.
38 * @param[in] bufferIndex The current buffer index.
39 * @param[in] input The internal property input.
41 PropertyInputIndexer(BufferIndex bufferIndex, const AccessorType* input)
42 : mBufferIndex(bufferIndex),
50 PropertyInputIndexer(const PropertyInputIndexer& other)
51 : mBufferIndex(other.mBufferIndex),
59 PropertyInputIndexer& operator=(const PropertyInputIndexer& other)
63 mBufferIndex = other.mBufferIndex;
64 mInput = other.mInput;
73 ~PropertyInputIndexer() override = default;
76 * @copydoc Dali::Internal::PropertyInput::GetType()
78 Property::Type GetType() const override
80 return mInput->GetType();
84 * @copydoc Dali::Internal::PropertyInput::GetBoolean()
86 const bool& GetBoolean() const override
88 return mInput->GetConstraintInputBoolean(mBufferIndex);
92 * @copydoc Dali::Internal::PropertyInput::GetInteger()
94 const int& GetInteger() const override
96 return mInput->GetConstraintInputInteger(mBufferIndex);
100 * @copydoc Dali::Internal::PropertyInput::GetFloat()
102 const float& GetFloat() const override
104 return mInput->GetConstraintInputFloat(mBufferIndex);
108 * @copydoc Dali::Internal::PropertyInput::GetVector2()
110 const Vector2& GetVector2() const override
112 return mInput->GetConstraintInputVector2(mBufferIndex);
116 * @copydoc Dali::Internal::PropertyInput::GetVector3()
118 const Vector3& GetVector3() const override
120 return mInput->GetConstraintInputVector3(mBufferIndex);
124 * @copydoc Dali::Internal::PropertyInput::GetVector4()
126 const Vector4& GetVector4() const override
128 return mInput->GetConstraintInputVector4(mBufferIndex);
132 * @copydoc Dali::Internal::PropertyInput::GetMatrix3()
134 const Matrix3& GetMatrix3() const override
136 return mInput->GetConstraintInputMatrix3(mBufferIndex);
140 * @copydoc Dali::Internal::PropertyInput::GetMatrix()
142 const Matrix& GetMatrix() const override
144 return mInput->GetConstraintInputMatrix(mBufferIndex);
148 * @copydoc Dali::Internal::PropertyInput::Quaternion()
150 const Quaternion& GetQuaternion() const override
152 return mInput->GetConstraintInputQuaternion(mBufferIndex);
156 BufferIndex mBufferIndex;
157 const AccessorType* mInput;
160 } // namespace Internal
164 #endif // DALI_PROPERTY_INPUT_INDEXER_H