[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / internal / model-motion / motion-value-impl.h
1 #ifndef DALI_SCENE3D_MODEL_MOTION_MOTION_VALUE_IMPL_H
2 #define DALI_SCENE3D_MODEL_MOTION_MOTION_VALUE_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-value.h>
28
29 namespace Dali
30 {
31 namespace Scene3D
32 {
33 namespace Internal
34 {
35 using MotionValuePtr = IntrusivePtr<MotionValue>;
36
37 /**
38  * @brief Internal data for Scene3D::MotionValue.
39  */
40 class MotionValue : public BaseObject
41 {
42 public: // Creation & Destruction
43   /**
44    * @brief Create a new MotionValue object.
45    * @return A smart-pointer to the newly allocated MotionValue.
46    */
47   static MotionValuePtr New();
48
49 protected:
50   /**
51    * @brief Construct a new MotionValue.
52    */
53   MotionValue();
54
55   /**
56    * @brief Second-phase constructor.
57    */
58   void Initialize();
59
60   /**
61    * @brief Virtual destructor.
62    */
63   virtual ~MotionValue();
64
65 public: // Public Method
66   /**
67    * @copydoc Dali::Scene3D::MotionValue::GetValueType()
68    */
69   Scene3D::MotionValue::ValueType GetValueType() const;
70
71   /**
72    * @copydoc Dali::Scene3D::MotionValue::SetValue()
73    */
74   void SetValue(Property::Value propertyValue);
75
76   /**
77    * @copydoc Dali::Scene3D::MotionValue::SetValue()
78    */
79   void SetValue(Dali::KeyFrames keyFrames);
80
81   /**
82    * @copydoc Dali::Scene3D::MotionValue::Clear()
83    */
84   void Clear();
85
86   /**
87    * @copydoc Dali::Scene3D::MotionValue::GetPropertyValue()
88    */
89   Property::Value GetPropertyValue() const;
90
91   /**
92    * @copydoc Dali::Scene3D::MotionValue::GetKeyFrames()
93    */
94   KeyFrames GetKeyFrames() const;
95
96 private:
97   Scene3D::MotionValue::ValueType mType{Scene3D::MotionValue::ValueType::INVALID};
98
99   Property::Value mPropertyValue{};
100   Dali::KeyFrames mKeyFrames{};
101 };
102
103 } // namespace Internal
104
105 // Helpers for public-api forwarding methods
106
107 inline Internal::MotionValue& GetImplementation(Dali::Scene3D::MotionValue& motionValue)
108 {
109   DALI_ASSERT_ALWAYS(motionValue && "MotionValue handle is empty");
110
111   BaseObject& handle = motionValue.GetBaseObject();
112
113   return static_cast<Internal::MotionValue&>(handle);
114 }
115
116 inline const Internal::MotionValue& GetImplementation(const Dali::Scene3D::MotionValue& motionValue)
117 {
118   DALI_ASSERT_ALWAYS(motionValue && "MotionValue handle is empty");
119
120   const BaseObject& handle = motionValue.GetBaseObject();
121
122   return static_cast<const Internal::MotionValue&>(handle);
123 }
124
125 } // namespace Scene3D
126
127 } // namespace Dali
128
129 #endif // DALI_SCENE3D_MODEL_MOTION_MOTION_VALUE_IMPL_H