Revert "[Tizen] Add screen and client rotation itself function"
[platform/core/uifw/dali-core.git] / dali / internal / event / common / property-input-impl.h
index 30a9bdb..ca46246 100644 (file)
@@ -1,21 +1,25 @@
-#ifndef __DALI_INTERNAL_PROPERTY_INPUT_IMPL_H__
-#define __DALI_INTERNAL_PROPERTY_INPUT_IMPL_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+#ifndef DALI_INTERNAL_PROPERTY_INPUT_IMPL_H
+#define DALI_INTERNAL_PROPERTY_INPUT_IMPL_H
+
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <iostream>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/object/property-input.h>
@@ -34,18 +38,6 @@ namespace Internal
 {
 
 /**
- * These dummy values are used to handle PropertyInputImpl errors
- */
-static const bool DUMMY_BOOLEAN_VALUE( false );
-static const float DUMMY_FLOAT_VALUE( 0.0f );
-static const Vector2 DUMMY_VECTOR2_VALUE( 0.0f, 0.0f );
-static const Vector3 DUMMY_VECTOR3_VALUE( 0.0f, 0.0f, 0.0f );
-static const Vector4 DUMMY_VECTOR4_VALUE( 0.0f, 0.0f, 0.0f, 0.0f );
-static const Matrix3 DUMMY_MATRIX3_VALUE;
-static const Matrix DUMMY_MATRIX_VALUE;
-static const Quaternion DUMMY_QUATERNION_VALUE( 1.0f, 0.0f, 0.0f, 0.0f );
-
-/**
  * An abstract interface for receiving property values, and for querying whether
  * a property value has changed i.e. whether a constraint needs to be reapplied.
  */
@@ -86,8 +78,20 @@ public:
    */
   virtual const bool& GetBoolean( BufferIndex bufferIndex ) const
   {
-    DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_BOOLEAN_VALUE;
+    // the return will never be executed, it's just to keep the compiler happy
+    return reinterpret_cast<const bool&>(*this);
+  }
+
+  /**
+   * Retrieve an integer value.
+   * @pre GetType() returns Property::INTEGER.
+   * @param[in] bufferIndex The buffer to read from.
+   * @return The integer value.
+   */
+  virtual const int& GetInteger( BufferIndex bufferIndex ) const
+  {
+    // the return will never be executed, it's just to keep the compiler happy
+    return reinterpret_cast<const int&>(*this);
   }
 
   /**
@@ -98,8 +102,8 @@ public:
    */
   virtual const float& GetFloat( BufferIndex bufferIndex ) const
   {
-    DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_FLOAT_VALUE;
+    // the return will never be executed, it's just to keep the compiler happy
+    return reinterpret_cast<const float&>(*this);
   }
 
   /**
@@ -110,8 +114,8 @@ public:
    */
   virtual const Vector2& GetVector2( BufferIndex bufferIndex ) const
   {
-    DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_VECTOR2_VALUE;
+    // the return will never be executed, it's just to keep the compiler happy
+    return reinterpret_cast<const Vector2&>(*this);
   }
 
   /**
@@ -122,8 +126,8 @@ public:
    */
   virtual const Vector3& GetVector3( BufferIndex bufferIndex ) const
   {
-    DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_VECTOR3_VALUE;
+    // the return will never be executed, it's just to keep the compiler happy
+    return reinterpret_cast<const Vector3&>(*this);
   }
 
   /**
@@ -134,8 +138,8 @@ public:
    */
   virtual const Vector4& GetVector4( BufferIndex bufferIndex ) const
   {
-    DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_VECTOR4_VALUE;
+    // the return will never be executed, it's just to keep the compiler happy
+    return reinterpret_cast<const Vector4&>(*this);
   }
 
   /**
@@ -146,8 +150,8 @@ public:
    */
   virtual const Quaternion& GetQuaternion( BufferIndex bufferIndex ) const
   {
-    DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_QUATERNION_VALUE;
+    // the return will never be executed, it's just to keep the compiler happy
+    return reinterpret_cast<const Quaternion&>(*this);
   }
 
   /**
@@ -158,8 +162,8 @@ public:
    */
   virtual const Matrix3& GetMatrix3( BufferIndex bufferIndex ) const
   {
-    DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_MATRIX3_VALUE;
+    // the return will never be executed, it's just to keep the compiler happy
+    return reinterpret_cast<const Matrix3&>(*this);
   }
 
   /**
@@ -170,8 +174,8 @@ public:
    */
   virtual const Matrix& GetMatrix( BufferIndex bufferIndex ) const
   {
-    DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_MATRIX_VALUE;
+    // the return will never be executed, it's just to keep the compiler happy
+    return reinterpret_cast<const Matrix&>(*this);
   }
 
   // Accessors for Constraint functions
@@ -190,6 +194,19 @@ public:
   }
 
   /**
+   * Retrieve an integer input for a constraint function.
+   * @note For inherited properties, this method should be overriden to return the value
+   * from the previous frame i.e. not from the current update buffer.
+   * @pre GetType() returns Property::INTEGER.
+   * @param[in] updateBufferIndex The current update buffer index.
+   * @return The integer value.
+   */
+  virtual const int& GetConstraintInputInteger( BufferIndex updateBufferIndex ) const
+  {
+    return GetInteger( updateBufferIndex );
+  }
+
+  /**
    * Retrieve a float input for a constraint function.
    * @note For inherited properties, this method should be overriden to return the value
    * from the previous frame i.e. not from the current update buffer.
@@ -281,9 +298,20 @@ public:
   }
 
   /**
+   * Query whether the property belongs to the
+   * transform manager or not.
+   * @return True if it is a transform manager property, false otherwise
+   */
+  virtual bool IsTransformManagerProperty() const
+  {
+    return false;
+  }
+
+  /**
    * Print the property value using a stream.
    * @param[in] debugStream The output stream.
    * @param[in] bufferIndex The buffer to read from.
+   * @todo Place this far-too-large-to-be-inlined function in a cpp and remove <iostream> header dependency from this file.
    */
   void DebugPrint( std::ostream& debugStream, BufferIndex bufferIndex ) const
   {
@@ -295,6 +323,12 @@ public:
         break;
       }
 
+      case Property::INTEGER:
+      {
+        debugStream << GetInteger( bufferIndex );
+        break;
+      }
+
       case Property::FLOAT:
       {
         debugStream << GetFloat( bufferIndex );
@@ -347,4 +381,4 @@ public:
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_PROPERTY_INPUT_IMPL_H__
+#endif // DALI_INTERNAL_PROPERTY_INPUT_IMPL_H