Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-core.git] / dali / internal / update / common / property-condition-step-functions.h
1 #ifndef DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H
2 #define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H
3
4 /*
5  * Copyright (c) 2021 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/update/common/scene-graph-property-notification.h>
23 #include <dali/public-api/object/property-value.h>
24
25 namespace Dali
26 {
27 namespace Internal
28 {
29 class Object;
30 class PropertyNotification;
31
32 namespace SceneGraph
33 {
34 /**
35  * Step condition class,
36  * Checks if a Property has stepped a certain amount from the reference point
37  *
38  * float      => value has stepped arg1 amount from arg0.
39  * Vector2    => 2 dimensional length of vector has stepped arg1 amount from arg0.
40  * Vector3    => 3 dimensional length of vector has stepped arg1 amount from arg0.
41  * Vector4    => 4 dimensional length of vector has stepped arg1 amount from arg0.
42  * Default    => return false.
43  */
44 class Step
45 {
46 public:
47   /**
48    * @return function pointer to the correct condition function, based on
49    * the type of value being examined.
50    */
51   static ConditionFunction GetFunction(Property::Type valueType);
52
53   /**
54    * @return function pointer to the correct condition function, based on
55    * the type of value being examined.
56    *
57    * This function pointer is to compare previous and current components for the swapping case.
58    */
59   static ConditionFunction GetCompareFunction(Property::Type valueType);
60
61 private:
62   static bool Evaluate(const float propertyValue, PropertyNotification::RawArgumentContainer& arg);
63
64   /**
65    * Checks if integer is Outside
66    * @param[in] value The value being examined.
67    * @param[in] arg The supplied arguments for the condition.
68    * @return Condition result (true if condition met, false if not)
69    */
70   static bool EvalInteger(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
71
72   /**
73    * Checks if float is Outside
74    * @param[in] value The value being examined.
75    * @param[in] arg The supplied arguments for the condition.
76    * @return Condition result (true if condition met, false if not)
77    */
78   static bool EvalFloat(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
79
80   /**
81    * Checks if Vector2.Length() is Outside
82    * @param[in] value The value being examined.
83    * @param[in] arg The supplied arguments for the condition.
84    * @return Condition result (true if condition met, false if not)
85    */
86   static bool EvalVector2(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
87
88   /**
89    * Checks if Vector3.Length() is Outside
90    * @param[in] value The value being examined.
91    * @param[in] arg The supplied arguments for the condition.
92    * @return Condition result (true if condition met, false if not)
93    */
94   static bool EvalVector3(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
95
96   /**
97    * Checks if Vector3.Length() is Outside
98    *
99    * If previous Vector3.Lenght() and current are same, the raw datas are checked with comparing these values.
100    *
101    * @param[in] value The value being examined.
102    * @param[in] arg The supplied arguments for the condition.
103    * @return Condition result (true if condition met, false if not)
104    */
105   static bool EvalAndCompareVector3(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
106
107   /**
108    * Checks if Vector4.Length() is Outside
109    * @param[in] value The value being examined.
110    * @param[in] arg The supplied arguments for the condition.
111    * @return Condition result (true if condition met, false if not)
112    */
113   static bool EvalVector4(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
114
115   /**
116    * Default check for other types.
117    * @param[in] value The value being examined.
118    * @param[in] arg The supplied arguments for the condition.
119    * @return Condition result (true if condition met, false if not)
120    */
121   static bool EvalDefault(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
122 };
123
124 } // namespace SceneGraph
125
126 } // namespace Internal
127
128 } // namespace Dali
129
130 #endif // DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H