Removed unnecessary templating and initializing internal objects with exported constants 03/31003/4
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Fri, 28 Nov 2014 11:22:18 +0000 (11:22 +0000)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Fri, 28 Nov 2014 12:38:34 +0000 (04:38 -0800)
--> reduces export table lookups and speeds up compilation due to less template mess

Change-Id: I22d70a20277a5b522e7c156366a266a2cce441db

dali/internal/update/common/animatable-property.h
dali/internal/update/common/double-buffered.h
dali/internal/update/common/inherited-property.h
dali/internal/update/dynamics/scene-graph-dynamics-body.cpp
dali/internal/update/dynamics/scene-graph-dynamics-body.h
dali/internal/update/node-attachments/scene-graph-camera-attachment.cpp
dali/internal/update/node-attachments/scene-graph-camera-attachment.h
dali/internal/update/nodes/node.cpp
dali/internal/update/nodes/node.h

index a5f30c4..e0d4917 100644 (file)
@@ -818,6 +818,15 @@ public:
 
   /**
    * Create an animatable property.
+   */
+  AnimatableProperty()
+  : mValue(),
+    mBaseValue()
+  {
+  }
+
+  /**
+   * Create an animatable property.
    * @param [in] initialValue The initial value of the property.
    */
   AnimatableProperty( const Vector3& initialValue )
@@ -1511,6 +1520,15 @@ public:
 
   /**
    * Create an animatable property.
+   */
+  AnimatableProperty()
+  : mValue(),
+    mBaseValue()
+  {
+  }
+
+  /**
+   * Create an animatable property.
    * @param [in] initialValue The initial value of the property.
    */
   AnimatableProperty( const Quaternion& initialValue )
index beeff58..981caed 100644 (file)
@@ -40,117 +40,24 @@ namespace SceneGraph
 
 /**
  * Templated class for a double-buffered value.
- * This simplifies init code, and forces explicit initialization.
  */
 template <typename T>
 class DoubleBuffered
 {
 public:
 
-  DoubleBuffered(const T& val)
-  : mValue1(val),
-    mValue2(val)
-  {
-  }
-
-  inline T& operator[](const size_t i)
-  {
-    DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
-
-    return *(&mValue1+i);
-  }
-
-  inline const T& operator[](const size_t i) const
+  DoubleBuffered()
+  : mValue1(),
+    mValue2()
   {
-    DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
-
-    return *(&mValue1+i);
   }
 
-private:
-
-  // Undefined
-  DoubleBuffered<T>(const DoubleBuffered<T>&);
-
-  // Undefined
-  DoubleBuffered<T>& operator=(const DoubleBuffered<T>& rhs);
-
-private:
-
-  T mValue1;
-  T mValue2;
-};
-
-/**
- * Templated class for a double-buffered value, initialized with 3 value parameters.
- * This simplifies init code, and forces explicit initialization.
- */
-template <typename T, typename P>
-class DoubleBuffered3
-{
-public:
-
-  DoubleBuffered3(const T& val)
-  : mValue1(val),
-    mValue2(val)
-  {
-  }
-
-  DoubleBuffered3(P val1, P val2, P val3)
-  : mValue1(val1, val2, val3),
-    mValue2(val1, val2, val3)
-  {
-  }
-
-  inline T& operator[](const size_t i)
-  {
-    DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
-
-    return *(&mValue1+i);
-  }
-
-  inline const T& operator[](const size_t i) const
-  {
-    DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
-
-    return *(&mValue1+i);
-  }
-
-private:
-
-  // Undefined
-  DoubleBuffered3<T,P>(const DoubleBuffered3<T,P>&);
-
-  // Undefined
-  DoubleBuffered3<T,P>& operator=(const DoubleBuffered3<T,P>& rhs);
-
-private:
-
-  T mValue1;
-  T mValue2;
-};
-
-/**
- * Templated class for a double-buffered value, initialized with 4 value parameters.
- * This simplifies init code, and forces explicit initialization.
- */
-template <typename T, typename P>
-class DoubleBuffered4
-{
-public:
-
-  DoubleBuffered4(const T& val)
+  DoubleBuffered(const T& val)
   : mValue1(val),
     mValue2(val)
   {
   }
 
-  DoubleBuffered4(P val1, P val2, P val3, P val4)
-  : mValue1(val1, val2, val3, val4),
-    mValue2(val1, val2, val3, val4)
-  {
-  }
-
   inline T& operator[](const size_t i)
   {
     DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
@@ -168,10 +75,10 @@ public:
 private:
 
   // Undefined
-  DoubleBuffered4<T,P>(const DoubleBuffered4<T,P>&);
+  DoubleBuffered<T>(const DoubleBuffered<T>&);
 
   // Undefined
-  DoubleBuffered4<T,P>& operator=(const DoubleBuffered4<T,P>& rhs);
+  DoubleBuffered<T>& operator=(const DoubleBuffered<T>& rhs);
 
 private:
 
@@ -179,17 +86,6 @@ private:
   T mValue2;
 };
 
-typedef DoubleBuffered<int>   DoubleBufferedInt;
-typedef DoubleBuffered<float> DoubleBufferedFloat;
-typedef DoubleBuffered<bool>  DoubleBufferedBool;
-
-typedef DoubleBuffered3<Vector3,float>      DoubleBufferedVector3;
-typedef DoubleBuffered4<Vector4,float>      DoubleBufferedVector4;
-
-typedef DoubleBuffered4<Quaternion, float>  DoubleBufferedQuaternion;
-
-typedef DoubleBuffered<Matrix> DoubleBufferedMatrix;
-
 } // namespace SceneGraph
 
 } // namespace Internal
index 6a13c24..b6d8348 100644 (file)
@@ -37,32 +37,37 @@ namespace Internal
 namespace SceneGraph
 {
 
-template <class T>
-class InheritedProperty;
-
 /**
  * An inherited Vector3 property.
  */
-template <>
-class InheritedProperty<Vector3> : public PropertyInputImpl
+class InheritedVector3 : public PropertyInputImpl
 {
 public:
 
   /**
-   * Create an inherited property.
+   * Create an inherited Vector3.
+   */
+  InheritedVector3()
+  : mValue(),
+    mInheritedFlag( false ),
+    mReinheritedFlag( true )
+  {
+  }
+
+  /**
+   * Create an inherited Vector3.
    * @param [in] initialValue The initial value of the property.
    */
-  InheritedProperty( const Vector3& initialValue )
+  InheritedVector3( const Vector3& initialValue )
   : mValue( initialValue ),
     mInheritedFlag( false ),
     mReinheritedFlag( true )
   {
   }
-
   /**
    * Virtual destructor.
    */
-  virtual ~InheritedProperty()
+  virtual ~InheritedVector3()
   {
   }
 
@@ -179,10 +184,10 @@ public:
 private:
 
   // Undefined
-  InheritedProperty(const InheritedProperty& property);
+  InheritedVector3(const InheritedVector3& property);
 
   // Undefined
-  InheritedProperty& operator=(const InheritedProperty& rhs);
+  InheritedVector3& operator=(const InheritedVector3& rhs);
 
 private:
 
@@ -366,17 +371,15 @@ private:
 /**
  * An inherited Quaternion property.
  */
-template <>
-class InheritedProperty<Quaternion> : public PropertyInputImpl
+class InheritedQuaternion : public PropertyInputImpl
 {
 public:
 
   /**
    * Create an inherited property.
-   * @param [in] initialValue The initial value of the property.
    */
-  InheritedProperty( const Quaternion& initialValue )
-  : mValue( initialValue ),
+  InheritedQuaternion()
+  : mValue(),
     mInheritedFlag( false ),
     mReinheritedFlag( true )
   {
@@ -385,7 +388,7 @@ public:
   /**
    * Virtual destructor.
    */
-  virtual ~InheritedProperty()
+  virtual ~InheritedQuaternion()
   {
   }
 
@@ -502,13 +505,10 @@ public:
 private:
 
   // Undefined
-  InheritedProperty();
-
-  // Undefined
-  InheritedProperty(const InheritedProperty& property);
+  InheritedQuaternion(const InheritedQuaternion& property);
 
   // Undefined
-  InheritedProperty& operator=(const InheritedProperty& rhs);
+  InheritedQuaternion& operator=(const InheritedQuaternion& rhs);
 
 private:
 
@@ -521,8 +521,7 @@ private:
 /**
  * An inherited Matrix property.
  */
-template <>
-class InheritedProperty<Matrix> : public PropertyInputImpl
+class InheritedMatrix : public PropertyInputImpl
 {
 public:
 
@@ -530,8 +529,8 @@ public:
    * Create an inherited property.
    * @param [in] initialValue The initial value of the property.
    */
-  InheritedProperty( const Matrix& initialValue )
-  : mValue( initialValue ),
+  InheritedMatrix()
+  : mValue(),
     mInheritedFlag( false ),
     mReinheritedFlag( true )
   {
@@ -540,7 +539,7 @@ public:
   /**
    * Virtual destructor.
    */
-  virtual ~InheritedProperty()
+  virtual ~InheritedMatrix()
   {
   }
 
@@ -683,13 +682,10 @@ public:
 private:
 
   // Undefined
-  InheritedProperty();
-
-  // Undefined
-  InheritedProperty(const InheritedProperty& property);
+  InheritedMatrix(const InheritedMatrix& property);
 
   // Undefined
-  InheritedProperty& operator=(const InheritedProperty& rhs);
+  InheritedMatrix& operator=(const InheritedMatrix& rhs);
 
 private:
 
index 406461e..9a62179 100644 (file)
@@ -43,8 +43,8 @@ DynamicsBody::DynamicsBody(DynamicsWorld& world, Node& node )
 : mBody(NULL),
   mNode(node),
   mWorld(world),
-  mLinearVelocity(Vector3::ZERO),
-  mAngularVelocity(Vector3::ZERO)
+  mLinearVelocity(),
+  mAngularVelocity()
 {
   DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__);
 }
index 5d91ef1..4e1fcd2 100644 (file)
@@ -181,8 +181,8 @@ private:
   DynamicsWorld& mWorld;
   Mesh*          mMesh;
 
-  DoubleBufferedVector3 mLinearVelocity;
-  DoubleBufferedVector3 mAngularVelocity;
+  DoubleBuffered<Vector3> mLinearVelocity;
+  DoubleBuffered<Vector3> mAngularVelocity;
 
 }; // class DynamicsBody
 
index 7becbff..f78ce4a 100644 (file)
@@ -166,8 +166,8 @@ CameraAttachment::CameraAttachment()
   mFarClippingPlane( DEFAULT_FAR_CLIPPING_PLANE ),
   mStereoBias( DEFAULT_STEREO_BIAS ),
   mTargetPosition( DEFAULT_TARGET_POSITION ),
-  mViewMatrix( Matrix::IDENTITY ),
-  mProjectionMatrix( Matrix::IDENTITY ),
+  mViewMatrix(),
+  mProjectionMatrix(),
   mInverseViewProjection( Matrix::IDENTITY )
 {
 }
index d27e13b..ce6966a 100644 (file)
@@ -255,8 +255,8 @@ public:  // PROPERTIES
   Vector2                       mStereoBias;
   Vector3                       mTargetPosition;
 
-  InheritedProperty<Matrix>     mViewMatrix;           ///< The view-matrix; this is double buffered for input handling.
-  InheritedProperty<Matrix>     mProjectionMatrix;     ///< The projection-matrix; this is double buffered for input handling.
+  InheritedMatrix mViewMatrix;           ///< The view-matrix; this is double buffered for input handling.
+  InheritedMatrix mProjectionMatrix;     ///< The projection-matrix; this is double buffered for input handling.
 
   DoubleBuffered< Matrix >      mInverseViewProjection;///< Inverted viewprojection; double buffered for input handling
 
index 39d6834..dda0a87 100644 (file)
@@ -44,16 +44,16 @@ Node* Node::New()
 Node::Node()
 : mParentOrigin( ParentOrigin::DEFAULT ),
   mAnchorPoint( AnchorPoint::DEFAULT ),
-  mSize( Vector3::ZERO ),
-  mPosition( Vector3::ZERO ),
-  mRotation( Quaternion::IDENTITY ),
+  mSize(),     // zero initialized by default
+  mPosition(), // zero initialized by default
+  mRotation(), // initialized to identity by default
   mScale( Vector3::ONE ),
   mVisible( true ),
   mColor( Color::WHITE ),
-  mWorldPosition( Vector3::ZERO ),
-  mWorldRotation( Quaternion::IDENTITY ),
+  mWorldPosition(), // zero initialized by default
+  mWorldRotation(), // initialized to identity by default
   mWorldScale( Vector3::ONE ),
-  mWorldMatrix( Matrix::IDENTITY ),
+  mWorldMatrix(),
   mWorldColor( Color::WHITE ),
   mParent( NULL ),
   mExclusiveRenderTask( NULL ),
index b5cc583..bd63c0f 100644 (file)
@@ -1044,11 +1044,11 @@ public: // Default properties
 
   // Inherited properties; read-only from public API
 
-  InheritedProperty<Vector3>    mWorldPosition; ///< Full inherited position
-  InheritedProperty<Quaternion> mWorldRotation; ///< Full inherited rotation
-  InheritedProperty<Vector3>    mWorldScale;    ///< Full inherited scale
-  InheritedProperty<Matrix>     mWorldMatrix;   ///< Full inherited world matrix
-  InheritedColor                mWorldColor;    ///< Full inherited color
+  InheritedVector3    mWorldPosition; ///< Full inherited position
+  InheritedQuaternion mWorldRotation; ///< Full inherited rotation
+  InheritedVector3    mWorldScale;    ///< Full inherited scale
+  InheritedMatrix     mWorldMatrix;   ///< Full inherited world matrix
+  InheritedColor      mWorldColor;    ///< Full inherited color
 
 protected: