Remove a few exports by getting rid of two std::vectors and two std::sets 99/30099/12
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Mon, 10 Nov 2014 17:53:42 +0000 (17:53 +0000)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Wed, 12 Nov 2014 13:01:24 +0000 (05:01 -0800)
[Problem]
[Cause]
[Solution]

Change-Id: I84df0e7804fd732002cd09db72879b4f82c9f211

dali/internal/event/animation/active-constraint-base.cpp
dali/internal/event/animation/active-constraint-base.h
dali/internal/event/animation/active-constraint-impl.h
dali/internal/render/gl-resources/context.cpp
dali/internal/render/gl-resources/context.h
dali/internal/update/animation/scene-graph-constraint-base.cpp
dali/internal/update/animation/scene-graph-constraint-base.h
dali/internal/update/animation/scene-graph-constraint.h
dali/internal/update/common/property-owner.h
dali/internal/update/nodes/node.h

index 9accd09..55ec3e5 100644 (file)
@@ -509,9 +509,9 @@ void ActiveConstraintBase::SceneObjectRemoved( ProxyObject& proxy )
 void ActiveConstraintBase::ProxyDestroyed( ProxyObject& proxy )
 {
   // Remove proxy pointer from observation set
-  ProxyObjectIter iter = mObservedProxies.find( &proxy );
-  DALI_ASSERT_DEBUG( mObservedProxies.end() != iter );
-  mObservedProxies.erase( iter );
+  ProxyObjectIter iter = std::find( mObservedProxies.Begin(), mObservedProxies.End(), &proxy );
+  DALI_ASSERT_DEBUG( mObservedProxies.End() != iter );
+  mObservedProxies.Erase( iter );
 
   // Stop observing the remaining proxies
   StopObservation();
@@ -524,41 +524,43 @@ void ActiveConstraintBase::ProxyDestroyed( ProxyObject& proxy )
 
 void ActiveConstraintBase::ObserveProxy( ProxyObject& proxy )
 {
-  if ( mObservedProxies.end() == mObservedProxies.find(&proxy) )
+  ProxyObjectIter iter = std::find( mObservedProxies.Begin(), mObservedProxies.End(), &proxy );
+  if ( mObservedProxies.End() == iter )
   {
     proxy.AddObserver( *this );
-    mObservedProxies.insert( &proxy );
+    mObservedProxies.PushBack( &proxy );
   }
 }
 
 void ActiveConstraintBase::StopObservation()
 {
-  for( ProxyObjectIter iter = mObservedProxies.begin(); mObservedProxies.end() != iter; ++iter )
+  const ProxyObjectIter end = mObservedProxies.End();
+  for( ProxyObjectIter iter = mObservedProxies.Begin(); iter != end; ++iter )
   {
     (*iter)->RemoveObserver( *this );
   }
 
-  mObservedProxies.clear();
+  mObservedProxies.Clear();
 }
 
 void ActiveConstraintBase::FirstApplyFinished( Object* object )
 {
-  ActiveConstraintBase& self = dynamic_cast<ActiveConstraintBase&>( *object );
+  // trust the object is correct as its set in FirstApply (in this same file)
+  ActiveConstraintBase* self = static_cast<ActiveConstraintBase*>( object );
 
   // This is necessary when the constraint was not added to scene-graph during the animation
-  self.SetWeight( Dali::ActiveConstraint::FINAL_WEIGHT );
+  self->SetWeight( Dali::ActiveConstraint::FINAL_WEIGHT );
 
   // The animation is no longer needed
-  GetImplementation(self.mApplyAnimation).SetFinishedCallback( NULL, NULL );
-  self.mApplyAnimation.Reset();
+  GetImplementation(self->mApplyAnimation).SetFinishedCallback( NULL, NULL );
+  self->mApplyAnimation.Reset();
 
   // Chain "Finish" to "Applied" signal
 
-  if ( !self.mAppliedSignal.Empty() )
+  if ( !self->mAppliedSignal.Empty() )
   {
-    Dali::ActiveConstraint handle( &self );
-
-    self.mAppliedSignal.Emit( handle );
+    Dali::ActiveConstraint handle( self );
+    self->mAppliedSignal.Emit( handle );
   }
 
   // WARNING - this constraint may now have been deleted; don't do anything else here
index d17912e..f7670b1 100644 (file)
@@ -27,7 +27,6 @@
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/time-period.h>
 #include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/common/set-wrapper.h>
 #include <dali/internal/event/animation/constraint-source-impl.h>
 
 namespace Dali
@@ -37,8 +36,8 @@ namespace Internal
 {
 
 class EventToUpdate;
-typedef std::set<ProxyObject*>         ProxyObjectContainer;
-typedef ProxyObjectContainer::iterator ProxyObjectIter;
+typedef Dali::Vector<ProxyObject*>     ProxyObjectContainer;
+typedef ProxyObjectContainer::Iterator ProxyObjectIter;
 
 namespace SceneGraph
 {
index a0d9253..3a20508 100644 (file)
@@ -22,7 +22,6 @@
 #include <boost/function.hpp>
 
 // INTERNAL INCLUDES
-#include <dali/public-api/common/set-wrapper.h>
 #include <dali/internal/common/event-to-update.h>
 #include <dali/internal/common/message.h>
 #include <dali/internal/event/common/proxy-object.h>
@@ -45,6 +44,21 @@ namespace Internal
 {
 
 /**
+ * Helper to add only unique entries to the propertyOwner container
+ * @param propertyOwners to add the entries to
+ * @param object to add
+ */
+inline void AddUnique( SceneGraph::PropertyOwnerContainer& propertyOwners, SceneGraph::PropertyOwner* object )
+{
+  const SceneGraph::PropertyOwnerIter iter = std::find( propertyOwners.Begin(), propertyOwners.End(), object );
+  if( iter == propertyOwners.End() )
+  {
+    // each owner should only be added once
+    propertyOwners.PushBack( object );
+  }
+}
+
+/**
  * Connects a constraint which takes another property as an input.
  */
 template < typename PropertyType >
@@ -149,9 +163,9 @@ private:
       return;
     }
 
-    // Build a set of property-owners, providing the scene-graph properties
-    SceneGraph::PropertyOwnerSet propertyOwners;
-    propertyOwners.insert( targetObject );
+    // Build a container of property-owners, providing the scene-graph properties
+    SceneGraph::PropertyOwnerContainer propertyOwners;
+    propertyOwners.PushBack( targetObject );
 
     // Build the constraint function; this requires a scene-graph property from each source
     ConstraintFunctionPtr func( ConnectConstraintFunction( propertyOwners ) );
@@ -188,11 +202,11 @@ private:
 
   /**
    * Helper for ConnectConstraint. Creates a connected constraint-function.
-   * Also populates the property-owner set, for each input connected to the constraint-function.
-   * @param[out] propertyOwners The set of property-owners providing the scene-graph properties.
+   * Also populates the property-owner container, for each input connected to the constraint-function.
+   * @param[out] propertyOwners The container of property-owners providing the scene-graph properties.
    * @return A connected constraint-function, or NULL if the scene-graph properties are not available.
    */
-  PropertyConstraintBase<PropertyType>* ConnectConstraintFunction( SceneGraph::PropertyOwnerSet& propertyOwners )
+  PropertyConstraintBase<PropertyType>* ConnectConstraintFunction( SceneGraph::PropertyOwnerContainer& propertyOwners )
   {
     PropertyConstraintBase<PropertyType>* func = mUserFunction->Clone();
     bool usingComponentFunc( false );
@@ -213,7 +227,7 @@ private:
         // The property owner will not exist, if the target proxy-object is off-stage
         if( NULL != owner )
         {
-          propertyOwners.insert( owner );
+          AddUnique( propertyOwners, owner );
           inputProperty = const_cast< PropertyInputImpl* >( source.object->GetSceneObjectInputProperty( source.propertyIndex ) );
           componentIndex = source.object->GetPropertyComponentIndex( source.propertyIndex );
 
@@ -247,7 +261,7 @@ private:
           // The property owner will not exist, if the parent proxy-object is off-stage
           if ( NULL != owner )
           {
-            propertyOwners.insert( owner );
+            AddUnique( propertyOwners, owner );
             inputProperty = const_cast< PropertyInputImpl* >( proxyParent->GetSceneObjectInputProperty( source.propertyIndex ) );
             componentIndex = proxyParent->GetPropertyComponentIndex( source.propertyIndex );
 
@@ -396,9 +410,9 @@ private:
       return;
     }
 
-    // Build a set of property-owners, providing the scene-graph properties
-    SceneGraph::PropertyOwnerSet propertyOwners;
-    propertyOwners.insert( targetObject );
+    // Build a container of property-owners, providing the scene-graph properties
+    SceneGraph::PropertyOwnerContainer propertyOwners;
+    propertyOwners.PushBack( targetObject );
 
     // Build the constraint function; this requires a scene-graph property from each source
     ConstraintFunctionPtr func( ConnectConstraintFunction( propertyOwners ) );
@@ -497,11 +511,11 @@ private:
 
   /**
    * Helper for ConnectConstraint. Creates a connected constraint-function.
-   * Also populates the property-owner set, for each input connected to the constraint-function.
-   * @param[out] propertyOwners The set of property-owners providing the scene-graph properties.
+   * Also populates the property-owner container, for each input connected to the constraint-function.
+   * @param[out] propertyOwners The container of property-owners providing the scene-graph properties.
    * @return A connected constraint-function, or NULL if the scene-graph properties are not available.
    */
-  PropertyConstraintBase<float>* ConnectConstraintFunction( SceneGraph::PropertyOwnerSet& propertyOwners )
+  PropertyConstraintBase<float>* ConnectConstraintFunction( SceneGraph::PropertyOwnerContainer& propertyOwners )
   {
     PropertyConstraintBase<float>* func = mUserFunction->Clone();
     bool usingComponentFunc( false );
@@ -522,7 +536,7 @@ private:
         // The property owner will not exist, if the target proxy-object is off-stage
         if( NULL != owner )
         {
-          propertyOwners.insert( owner );
+          AddUnique( propertyOwners, owner );
           inputProperty = const_cast< PropertyInputImpl* >( source.object->GetSceneObjectInputProperty( source.propertyIndex ) );
           componentIndex = source.object->GetPropertyComponentIndex( source.propertyIndex );
 
@@ -556,7 +570,7 @@ private:
           // The property owner will not exist, if the parent proxy-object is off-stage
           if ( NULL != owner )
           {
-            propertyOwners.insert( owner );
+            AddUnique( propertyOwners, owner );
             inputProperty = const_cast< PropertyInputImpl* >( proxyParent->GetSceneObjectInputProperty( source.propertyIndex ) );
             componentIndex = proxyParent->GetPropertyComponentIndex( source.propertyIndex );
 
index eff48a5..d943940 100644 (file)
@@ -100,7 +100,6 @@ Context::Context(Integration::GlAbstraction& glAbstraction)
   mBlendEquationSeparateModeRGB( GL_FUNC_ADD ),
   mBlendEquationSeparateModeAlpha( GL_FUNC_ADD ),
   mMaxTextureSize(0),
-  mMaxTextureUnits(0),
   mClearColor(Color::WHITE),    // initial color, never used until it's been set by the user
   mCullFaceMode(CullNone),
   mViewPort( 0, 0, 0, 0 ),
@@ -333,12 +332,8 @@ void Context::ResetGlState()
   mGlAbstraction.FrontFace(GL_CCW);
   mGlAbstraction.CullFace(GL_BACK);
 
-  // get max texture units
-  mGlAbstraction.GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &mMaxTextureUnits);
-  DALI_ASSERT_DEBUG(mMaxTextureUnits > 7);  // according to GLES 2.0 specification
-  mBound2dTextureId.reserve(mMaxTextureUnits);
   // rebind texture units
-  for( int i=0; i < mMaxTextureUnits; ++i )
+  for( unsigned int i=0; i < MAX_TEXTURE_UNITS; ++i )
   {
     mBound2dTextureId[ i ] = 0;
     // set active texture
@@ -354,7 +349,7 @@ void Context::ResetGlState()
   mGlAbstraction.GetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES, &numProgramBinaryFormats);
   if( GL_NO_ERROR == mGlAbstraction.GetError() && 0 != numProgramBinaryFormats )
   {
-    mProgramBinaryFormats.resize(numProgramBinaryFormats);
+    mProgramBinaryFormats.Resize(numProgramBinaryFormats);
     mGlAbstraction.GetIntegerv(GL_PROGRAM_BINARY_FORMATS_OES, &mProgramBinaryFormats[0]);
   }
 
index 073a2a0..e285ae6 100644 (file)
@@ -21,7 +21,7 @@
 // INTERNAL INCLUDES
 #include <dali/integration-api/gl-defines.h>
 #include <dali/public-api/common/map-wrapper.h>
-#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/common/dali-vector.h>
 #include <dali/public-api/actors/renderable-actor.h>
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/gl-abstraction.h>
@@ -64,6 +64,8 @@ public:
    */
   static const unsigned int MAX_ATTRIBUTE_CACHE_SIZE = 8;
 
+  static const unsigned int MAX_TEXTURE_UNITS = 8; // for GLES 2.0 its 8, which is more than DALi uses anyways
+
   /**
    * Creates the Dali Context object.
    * This method does not create an OpenGL context i.e. that is done from outside dali-core.
@@ -636,7 +638,7 @@ public:
 
     // reset the cached texture id's incase the driver re-uses them
     // when creating new textures
-    for( int i=0; i < mMaxTextureUnits; ++i )
+    for( unsigned int i=0; i < MAX_TEXTURE_UNITS; ++i )
     {
        mBound2dTextureId[ i ] = 0;
     }
@@ -1615,7 +1617,7 @@ public:
    */
   GLint CachedNumberOfProgramBinaryFormats() const
   {
-    return mProgramBinaryFormats.size();
+    return mProgramBinaryFormats.Count();
   }
 
   /**
@@ -1625,7 +1627,7 @@ public:
    */
   GLint CachedProgramBinaryFormat( const unsigned int formatIndex = 0 ) const
   {
-    DALI_ASSERT_ALWAYS( formatIndex < mProgramBinaryFormats.size() && "formatIndex out of bounds");
+    DALI_ASSERT_ALWAYS( formatIndex < mProgramBinaryFormats.Count() && "formatIndex out of bounds");
 
     return mProgramBinaryFormats[ formatIndex ];
   }
@@ -1797,7 +1799,7 @@ private: // Data
 
   // glBindTexture() state
   unsigned int mActiveTextureUnit;
-  std::vector<GLuint> mBound2dTextureId;  ///< The ID passed to glBindTexture(GL_TEXTURE_2D)
+  GLuint mBound2dTextureId[ MAX_TEXTURE_UNITS ];  ///< The ID passed to glBindTexture(GL_TEXTURE_2D)
 
   // glBlendColor() state
   bool mUsingDefaultBlendColor;
@@ -1813,10 +1815,9 @@ private: // Data
   GLenum mBlendEquationSeparateModeAlpha;  ///< Controls Alpha blend mode
 
   GLint mMaxTextureSize;      ///< return value from GetIntegerv(GL_MAX_TEXTURE_SIZE)
-  GLint mMaxTextureUnits;     ///< return value from GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS)
   Vector4 mClearColor;        ///< clear color
 
-  std::vector<GLint>  mProgramBinaryFormats; ///< array of supported program binary formats
+  Dali::Vector<GLint>  mProgramBinaryFormats; ///< array of supported program binary formats
 
   // Face culling mode
   CullFaceMode mCullFaceMode;
index 19b0373..56cd82c 100644 (file)
@@ -35,7 +35,7 @@ namespace SceneGraph
   unsigned int ConstraintBase::mTotalInstanceCount   = 0;
 #endif
 
-ConstraintBase::ConstraintBase( PropertyOwnerSet& ownerSet )
+ConstraintBase::ConstraintBase( PropertyOwnerContainer& ownerSet )
 : mWeight( Dali::ActiveConstraint::DEFAULT_WEIGHT ),
   mRemoveAction( Dali::Constraint::DEFAULT_REMOVE_ACTION ),
   mFirstApply( true ),
index 06dce2f..05bbda5 100644 (file)
@@ -41,6 +41,9 @@ template <> struct ParameterType< Dali::Constraint::RemoveAction >
 namespace SceneGraph
 {
 
+typedef Dali::Vector<PropertyOwner*>     PropertyOwnerContainer;
+typedef PropertyOwnerContainer::Iterator PropertyOwnerIter;
+
 /**
  * An abstract base class for Constraints.
  * This can be used to constrain a property of a scene-object, after animations have been applied.
@@ -54,7 +57,7 @@ public:
   /**
    * Constructor
    */
-  ConstraintBase( PropertyOwnerSet& ownerSet );
+  ConstraintBase( PropertyOwnerContainer& ownerContainer );
 
   /**
    * Virtual destructor.
@@ -143,7 +146,8 @@ private:
    */
   void StartObservation()
   {
-    for( PropertyOwnerIter iter = mObservedOwners.begin(); mObservedOwners.end() != iter; ++iter )
+    const PropertyOwnerIter end =  mObservedOwners.End();
+    for( PropertyOwnerIter iter = mObservedOwners.Begin(); end != iter; ++iter )
     {
       (*iter)->AddObserver( *this );
     }
@@ -154,12 +158,13 @@ private:
    */
   void StopObservation()
   {
-    for( PropertyOwnerIter iter = mObservedOwners.begin(); mObservedOwners.end() != iter; ++iter )
+    const PropertyOwnerIter end =  mObservedOwners.End();
+    for( PropertyOwnerIter iter = mObservedOwners.Begin(); end != iter; ++iter )
     {
       (*iter)->RemoveObserver( *this );
     }
 
-    mObservedOwners.clear();
+    mObservedOwners.Clear();
   }
 
   /**
@@ -178,10 +183,10 @@ private:
     if ( !mDisconnected )
     {
       // Discard pointer to disconnected property owner
-      PropertyOwnerIter iter = mObservedOwners.find( &owner );
-      if( mObservedOwners.end() != iter )
+      PropertyOwnerIter iter = std::find( mObservedOwners.Begin(), mObservedOwners.End(), &owner );
+      if( mObservedOwners.End() != iter )
       {
-        mObservedOwners.erase( iter );
+        mObservedOwners.Erase( iter );
 
         // Stop observing the remaining property owners
         StopObservation();
@@ -217,7 +222,7 @@ protected:
 
 private:
 
-  PropertyOwnerSet mObservedOwners; ///< A set of pointers to each observed object. Not owned.
+  PropertyOwnerContainer mObservedOwners; ///< A set of pointers to each observed object. Not owned.
 
 #ifdef DEBUG_ENABLED
   static unsigned int mCurrentInstanceCount;  ///< The current number of Constraint instances in existence.
index de9b4b5..4866d6a 100644 (file)
@@ -62,7 +62,7 @@ public:
    * @return A smart-pointer to a newly allocated constraint.
    */
   static ConstraintBase* New( const PropertyBase& targetProperty,
-                              PropertyOwnerSet& ownerSet,
+                              PropertyOwnerContainer& ownerContainer,
                               ConstraintFunctionPtr func,
                               InterpolatorFunc interpolator,
                               const AnimatableProperty<float>* customWeight )
@@ -71,7 +71,7 @@ public:
     PropertyBase& property = const_cast< PropertyBase& >( targetProperty );
 
     return new Constraint< PropertyType, PropertyAccessorType >( property,
-                                                                 ownerSet,
+                                                                 ownerContainer,
                                                                  func,
                                                                  interpolator,
                                                                  customWeight );
@@ -159,11 +159,11 @@ private:
    * @copydoc Dali::Internal::SceneGraph::Constraint::New()
    */
   Constraint( PropertyBase& targetProperty,
-              PropertyOwnerSet& ownerSet,
+              PropertyOwnerContainer& ownerContainer,
               ConstraintFunctionPtr func,
               InterpolatorFunc interpolator,
               const AnimatableProperty<float>* customWeight )
-  : ConstraintBase( ownerSet ),
+  : ConstraintBase( ownerContainer ),
     mTargetProperty( &targetProperty ),
     mFunc( func ),
     mInterpolator( interpolator ),
index f9e0369..ffce83f 100644 (file)
@@ -22,7 +22,6 @@
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/common/set-wrapper.h>
 #include <dali/internal/common/message.h>
 #include <dali/internal/common/owner-container.h>
 #include <dali/internal/update/common/property-base.h>
@@ -40,9 +39,6 @@ namespace SceneGraph
 
 class PropertyOwner;
 
-typedef std::set<PropertyOwner*>   PropertyOwnerSet;
-typedef PropertyOwnerSet::iterator PropertyOwnerIter;
-
 typedef OwnerContainer< PropertyBase* > OwnedPropertyContainer;
 typedef OwnedPropertyContainer::Iterator  OwnedPropertyIter;
 
index ce2125a..b5cc583 100644 (file)
@@ -21,6 +21,7 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/actors/actor-enumerations.h>
 #include <dali/public-api/actors/draw-mode.h>
+#include <dali/public-api/common/set-wrapper.h>
 #include <dali/public-api/math/quaternion.h>
 #include <dali/public-api/math/math-utils.h>
 #include <dali/public-api/math/vector3.h>