[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / internal / model-motion / motion-index / motion-index-impl.h
1 #ifndef DALI_SCENE3D_MODEL_MOTION_MOTION_INDEX_IMPL_H
2 #define DALI_SCENE3D_MODEL_MOTION_MOTION_INDEX_IMPL_H
3
4 /*
5  * Copyright (c) 2023 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
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/public-api/common/intrusive-ptr.h>
24 #include <dali/public-api/object/base-object.h>
25
26 // INTERNAL INCLUDES
27 #include <dali-scene3d/public-api/model-motion/motion-index/motion-index.h>
28
29 namespace Dali
30 {
31 namespace Scene3D
32 {
33 namespace Internal
34 {
35 using MotionIndexPtr = IntrusivePtr<MotionIndex>;
36
37 /**
38  * @brief Internal abstract data for Scene3D::MotionIndex.
39  * The drived class can implemet there own GetPropertyIndex() and GetPropertyName() API.
40  */
41 class MotionIndex : public BaseObject
42 {
43 protected:
44   /**
45    * @brief Construct a new MotionIndex.
46    */
47   MotionIndex();
48
49   /**
50    * @brief Virtual destructor.
51    */
52   virtual ~MotionIndex();
53
54 public: // Public Method
55   /**
56    * @copydoc Dali::Scene3D::MotionIndex::SetModelNodeId()
57    */
58   void SetModelNodeId(Property::Key modelNodeId);
59
60   /**
61    * @copydoc Dali::Scene3D::MotionIndex::GetModelNodeId()
62    */
63   Property::Key GetModelNodeId() const;
64
65 public: // Virtual Method
66   /**
67    * @copydoc Dali::Scene3D::MotionIndex::GetPropertyName()
68    */
69   virtual std::string GetPropertyName(Scene3D::ModelNode node = Scene3D::ModelNode()) = 0;
70
71   /**
72    * @copydoc Dali::Scene3D::MotionIndex::GetPropertyIndex()
73    */
74   virtual Property::Index GetPropertyIndex(Scene3D::ModelNode node = Scene3D::ModelNode()) = 0;
75
76 protected:
77   Property::Key mModelNodeId{Property::INVALID_KEY}; ///< The id of model node
78 };
79
80 } // namespace Internal
81
82 // Helpers for public-api forwarding methods
83
84 inline Internal::MotionIndex& GetImplementation(Dali::Scene3D::MotionIndex& motionIndex)
85 {
86   DALI_ASSERT_ALWAYS(motionIndex && "MotionIndex handle is empty");
87
88   BaseObject& handle = motionIndex.GetBaseObject();
89
90   return static_cast<Internal::MotionIndex&>(handle);
91 }
92
93 inline const Internal::MotionIndex& GetImplementation(const Dali::Scene3D::MotionIndex& motionIndex)
94 {
95   DALI_ASSERT_ALWAYS(motionIndex && "MotionIndex handle is empty");
96
97   const BaseObject& handle = motionIndex.GetBaseObject();
98
99   return static_cast<const Internal::MotionIndex&>(handle);
100 }
101
102 } // namespace Scene3D
103
104 } // namespace Dali
105
106 #endif // DALI_SCENE3D_MODEL_MOTION_MOTION_INDEX_IMPL_H