tet_infoline(" UtcDaliPropertyConditionGetArguments");
PropertyCondition condition = GreaterThanCondition( 50.0f );
- PropertyCondition::ArgumentContainer arguments = condition.GetArguments();
- DALI_TEST_EQUALS( arguments.size(), 1u, TEST_LOCATION );
- Property::Value value = arguments[0];
- DALI_TEST_EQUALS( value.Get<float>(), 50.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( condition.GetArgumentCount(), 1u, TEST_LOCATION );
+ float value = condition.GetArgument( 0 );
+ DALI_TEST_EQUALS( value, 50.0f, TEST_LOCATION );
condition = InsideCondition( 125.0f, 250.0f );
- arguments = condition.GetArguments();
- DALI_TEST_EQUALS( arguments.size(), 2u, TEST_LOCATION );
- Property::Value value1 = arguments[0];
- Property::Value value2 = arguments[1];
- DALI_TEST_EQUALS( value1.Get<float>(), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( value2.Get<float>(), 250.0f, TEST_LOCATION );
- END_TEST;
-}
-
-namespace
-{
-
-class PropertyConditionConstWrapper
-{
-public:
-
- PropertyConditionConstWrapper(PropertyCondition propertyCondition)
- :mPropertyCondition(propertyCondition)
- {
-
- }
-
- /**
- * Returns const reference to property arguments.
- * @return const reference.
- */
- const PropertyCondition::ArgumentContainer& GetArguments() const
- {
- return mPropertyCondition.GetArguments();
- }
-
- PropertyCondition mPropertyCondition;
-};
-} // anon namespace
-
-int UtcDaliPropertyConditionGetArgumentsConst(void)
-{
- TestApplication application;
- tet_infoline(" UtcDaliPropertyConditionGetArgumentsConst");
-
- PropertyCondition condition = GreaterThanCondition( 50.0f );
- PropertyConditionConstWrapper conditionConst(condition);
- const PropertyCondition::ArgumentContainer& argumentsRef1 = conditionConst.GetArguments();
- const PropertyCondition::ArgumentContainer& argumentsRef2 = conditionConst.GetArguments();
-
- DALI_TEST_CHECK( (&argumentsRef1) == (&argumentsRef2) );
- DALI_TEST_EQUALS( argumentsRef1.size(), 1u, TEST_LOCATION );
- Property::Value value = argumentsRef1[0];
- DALI_TEST_EQUALS( value.Get<float>(), 50.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( condition.GetArgumentCount(), 2u, TEST_LOCATION );
+ float value1 = condition.GetArgument( 0 );
+ float value2 = condition.GetArgument( 1 );
+ DALI_TEST_EQUALS( value1, 125.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value2, 250.0f, TEST_LOCATION );
END_TEST;
}
Actor actor = Actor::New();
Stage::GetCurrent().Add(actor);
- std::vector<float> values;
+ Dali::Vector<float> values;
const float averageStep = 100.0f;
for( int i = 1 ; i < 10 ; i++ )
{
- values.push_back(i * averageStep + (i % 2 == 0 ? -(averageStep * 0.2f) : (averageStep * 0.2f)));
+ values.PushBack(i * averageStep + (i % 2 == 0 ? -(averageStep * 0.2f) : (averageStep * 0.2f)));
}
// float
PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, VariableStepCondition(values) );
actor.SetPosition(Vector3(values[0] - averageStep, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- for( unsigned int i = 0 ; i < values.size() - 1 ; ++i )
+ for( unsigned int i = 0 ; i < values.Count() - 1 ; ++i )
{
gCallBackCalled = false;
// set position half way between the current values
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
#define __DALI_INTERNAL_PROPERTY_CONDITIONS_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
VariableStep ///< Similar to step, except user can define a list of steps from reference value
};
- typedef Dali::PropertyCondition::ArgumentContainer ArgumentContainer;
- typedef Dali::PropertyCondition::ArgumentIter ArgumentIter;
- typedef Dali::PropertyCondition::ArgumentConstIter ArgumentConstIter;
-
+ /**
+ * Constructor
+ */
PropertyCondition();
+ /**
+ * Virtual destructor
+ */
virtual ~PropertyCondition();
private:
-private:
-
// Not implemented
PropertyCondition(const PropertyCondition& rhs);
public:
- Type type; ///< The condition Type.
- ArgumentContainer arguments; ///< The condition Arguments.
+ Type type; ///< The condition Type.
+ Dali::Vector<float> arguments; ///< The condition Arguments.
};
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
return propertyNotification;
}
-PropertyNotification::PropertyNotification(UpdateManager& updateManager,
- PropertyNotificationManager& propertyNotificationManager,
- Property& target,
- int componentIndex,
- const Dali::PropertyCondition& condition)
-: mUpdateManager(updateManager),
- mPropertyNotification(NULL),
- mPropertyNotificationManager(propertyNotificationManager),
- mObjectPropertyIndex(target.propertyIndex),
- mPropertyType(Property::NONE),
- mComponentIndex(componentIndex),
- mCondition(condition),
- mNotifyMode(Dali::PropertyNotification::NotifyOnTrue),
- mNotifyResult(false)
-{
- // Set condition arguments (as simple vector of floats)
- PropertyCondition::ArgumentContainer arguments = GetImplementation(condition).arguments;
- PropertyCondition::ArgumentConstIter iter = arguments.begin();
-
- while( iter != arguments.end() )
+PropertyNotification::PropertyNotification( UpdateManager& updateManager,
+ PropertyNotificationManager& propertyNotificationManager,
+ Property& target,
+ int componentIndex,
+ const Dali::PropertyCondition& condition )
+: mUpdateManager( updateManager ),
+ mPropertyNotification( NULL ),
+ mPropertyNotificationManager( propertyNotificationManager ),
+ mObjectPropertyIndex( target.propertyIndex ),
+ mPropertyType( Property::NONE ),
+ mComponentIndex( componentIndex ),
+ mCondition( condition ),
+ mNotifyMode( Dali::PropertyNotification::NotifyOnTrue ),
+ mNotifyResult( false )
+{
+ const Internal::PropertyCondition& conditionImpl = GetImplementation( condition );
+
+ Dali::Vector<float>::SizeType count = conditionImpl.arguments.Count();
+ for( Dali::Vector<float>::SizeType index = 0; index < count; ++index )
{
- const Property::Value& value = *iter;
- float floatValue;
- value.Get(floatValue);
-
- mRawConditionArgs.PushBack( floatValue );
- ++iter;
+ mRawConditionArgs.PushBack( conditionImpl.arguments[ index ] );
}
// Observe target object and create/destroy notification scene object accordingly.
#define __DALI_INTERNAL_PROPERTY_NOTIFICATION_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
typedef Dali::PropertyNotification::NotifyMode NotifyMode;
typedef PropertyCondition::Type ConditionType;
- typedef PropertyCondition::ArgumentContainer ArgumentContainer;
/**
* RawArgumentContainer provides fast direct access to arguments for condition evaluation.
* @param [in] child The child.
* @post The child will be referenced by its parent. This means that the child will be kept alive,
* even if the handle passed into this method is reset or destroyed.
- * @post This may invalidate ActorContainer iterators.
*/
void Add(Actor child);
* @post The child will be referenced by its parent. This means that the child will be kept alive,
* even if the handle passed into this method is reset or destroyed.
* @post If the index is greater than the current child count, it will be ignored and added at the end.
- * @post This may invalidate ActorContainer iterators.
*/
void Insert(unsigned int index, Actor child);
* @pre This Actor (the parent) has been initialized.
* @pre The child actor is not the same as the parent actor.
* @param [in] child The child.
- * @post This may invalidate ActorContainer iterators.
*/
void Remove(Actor child);
*
* If the actor has no parent, this method does nothing.
* @pre The (child) actor has been initialized.
- * @post This may invalidate ActorContainer iterators.
*/
void Unparent();
}
-PropertyCondition::PropertyCondition(const PropertyCondition& handle)
+PropertyCondition::PropertyCondition( const PropertyCondition& handle )
: BaseHandle(handle)
{
}
-PropertyCondition& PropertyCondition::operator=(const PropertyCondition& rhs)
+PropertyCondition& PropertyCondition::operator=( const PropertyCondition& rhs )
{
BaseHandle::operator=(rhs);
return *this;
}
-PropertyCondition::ArgumentContainer PropertyCondition::GetArguments()
+std::size_t PropertyCondition::GetArgumentCount() const
{
- return GetImplementation(*this).arguments;
+ return GetImplementation(*this).arguments.Count();
}
-const PropertyCondition::ArgumentContainer& PropertyCondition::GetArguments() const
+float PropertyCondition::GetArgument( std::size_t index ) const
{
- return GetImplementation(*this).arguments;
+ return GetImplementation(*this).arguments[ index ];
}
-PropertyCondition LessThanCondition(float arg)
+PropertyCondition LessThanCondition( float arg )
{
PropertyCondition condition;
- GetImplementation(condition).type = Internal::PropertyCondition::LessThan;
- GetImplementation(condition).arguments.push_back(Property::Value(arg));
+ Internal::PropertyCondition& impl = GetImplementation( condition );
+ impl.type = Internal::PropertyCondition::LessThan;
+ impl.arguments.PushBack( arg );
return condition;
}
-PropertyCondition GreaterThanCondition(float arg)
+PropertyCondition GreaterThanCondition( float arg )
{
PropertyCondition condition;
- GetImplementation(condition).type = Internal::PropertyCondition::GreaterThan;
- GetImplementation(condition).arguments.push_back(Property::Value(arg));
+ Internal::PropertyCondition& impl = GetImplementation( condition );
+ impl.type = Internal::PropertyCondition::GreaterThan;
+ impl.arguments.PushBack( arg );
return condition;
}
-PropertyCondition InsideCondition(float arg0, float arg1)
+PropertyCondition InsideCondition( float arg0, float arg1 )
{
PropertyCondition condition;
- GetImplementation(condition).type = Internal::PropertyCondition::Inside;
- GetImplementation(condition).arguments.push_back(Property::Value(arg0));
- GetImplementation(condition).arguments.push_back(Property::Value(arg1));
+ Internal::PropertyCondition& impl = GetImplementation( condition );
+ impl.type = Internal::PropertyCondition::Inside;
+ impl.arguments.PushBack( arg0 );
+ impl.arguments.PushBack( arg1 );
return condition;
}
-PropertyCondition OutsideCondition(float arg0, float arg1)
+PropertyCondition OutsideCondition( float arg0, float arg1 )
{
PropertyCondition condition;
- GetImplementation(condition).type = Internal::PropertyCondition::Outside;
- GetImplementation(condition).arguments.push_back(Property::Value(arg0));
- GetImplementation(condition).arguments.push_back(Property::Value(arg1));
+ Internal::PropertyCondition& impl = GetImplementation( condition );
+ impl.type = Internal::PropertyCondition::Outside;
+ impl.arguments.PushBack( arg0 );
+ impl.arguments.PushBack( arg1 );
return condition;
}
-PropertyCondition StepCondition(float stepAmount, float referenceValue)
+PropertyCondition StepCondition( float stepAmount, float referenceValue )
{
PropertyCondition condition;
- GetImplementation(condition).type = Internal::PropertyCondition::Step;
- GetImplementation(condition).arguments.push_back(Property::Value(referenceValue));
- GetImplementation(condition).arguments.push_back(Property::Value(1.0f / stepAmount));
- GetImplementation(condition).arguments.push_back(Property::Value(0.0f)); // current step
+ Internal::PropertyCondition& impl = GetImplementation( condition );
+ impl.type = Internal::PropertyCondition::Step;
+ impl.arguments.PushBack( referenceValue );
+ impl.arguments.PushBack( 1.0f / stepAmount );
+ impl.arguments.PushBack( 0.0f ); // current step
return condition;
}
-PropertyCondition VariableStepCondition(const std::vector<float>& stepAmount)
+PropertyCondition VariableStepCondition( const Dali::Vector<float>& stepAmount )
{
PropertyCondition condition;
- GetImplementation(condition).type = Internal::PropertyCondition::VariableStep;
- GetImplementation(condition).arguments.push_back(Property::Value(0.0f)); // current step
- int size = stepAmount.size();
- GetImplementation(condition).arguments.push_back(Property::Value(static_cast<float>(size))); // store number of steps
- for( std::vector<float>::const_iterator it = stepAmount.begin(), endIt = stepAmount.end(); it != endIt; ++it )
+ Internal::PropertyCondition& impl = GetImplementation( condition );
+ impl.type = Internal::PropertyCondition::VariableStep;
+ impl.arguments.PushBack( 0.0f ); // current step
+ Dali::Vector<float>::SizeType count = stepAmount.Count();
+ impl.arguments.PushBack( float( count ) ); // store number of steps
+ for( Dali::Vector<float>::SizeType index = 0; index < count; ++index )
{
- GetImplementation(condition).arguments.push_back(Property::Value( *it ));
+ impl.arguments.PushBack( stepAmount[index] );
}
return condition;
*/
// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/object/property.h>
public:
/**
- * @brief Argument container, represents the arguments to be supplied to the condition function.
- */
- typedef std::vector<Property::Value> ArgumentContainer;
- typedef ArgumentContainer::iterator ArgumentIter; ///< Iterator for Dali::PropertyCondition::ArgumentContainer
- typedef ArgumentContainer::const_iterator ArgumentConstIter;///< Const Iterator for Dali::PropertyCondition::ArgumentContainer
-
-public:
-
- /**
* @brief Constructor for condition clause.
*/
PropertyCondition();
*
* @param [in] handle A reference to the copied handle
*/
- PropertyCondition(const PropertyCondition& handle);
+ PropertyCondition( const PropertyCondition& handle );
/**
* @brief This assignment operator is required for (smart) pointer semantics.
* @param [in] rhs A reference to the copied handle
* @return A reference to this
*/
- PropertyCondition& operator=(const PropertyCondition& rhs);
+ PropertyCondition& operator=( const PropertyCondition& rhs );
public:
*
* @return The arguments used for this condition
*/
- ArgumentContainer GetArguments();
+ std::size_t GetArgumentCount() const;
/**
* @brief Retrieve the arguments that this condition uses.
* @return The arguments used for this condition
* @note The container will only be valid as long PropertyCondition is valid.
*/
- const ArgumentContainer& GetArguments() const;
+ float GetArgument( std::size_t index ) const;
};
* @param[in] arg The argument for the condition
* @return A property condition function object
*/
-DALI_IMPORT_API PropertyCondition LessThanCondition(float arg);
+DALI_IMPORT_API PropertyCondition LessThanCondition( float arg );
/**
* @brief GreaterThanCondition compares whether property is greater than arg.
* @param[in] arg The argument for the condition
* @return A property condition function object
*/
-DALI_IMPORT_API PropertyCondition GreaterThanCondition(float arg);
+DALI_IMPORT_API PropertyCondition GreaterThanCondition( float arg );
/**
* @brief InsideCondition compares whether property is greater than arg0 and less than arg1.
* @param[in] arg1 The second argument for the condition
* @return A property condition function object
*/
-DALI_IMPORT_API PropertyCondition InsideCondition(float arg0, float arg1);
+DALI_IMPORT_API PropertyCondition InsideCondition( float arg0, float arg1 );
/**
* @brief OutsideCondition compares whether property is less than arg0 or greater than arg1.
* @param[in] arg1 The second argument for the condition
* @return A property condition function object
*/
-DALI_IMPORT_API PropertyCondition OutsideCondition(float arg0, float arg1);
+DALI_IMPORT_API PropertyCondition OutsideCondition( float arg0, float arg1 );
/**
* @brief Detects when a property changes by stepAmount from initialValue, in both positive and negative directions. This will continue checking for multiples of stepAmount
* @param[in] initialValue The initial value to step from
* @return A property condition function object
*/
-DALI_IMPORT_API PropertyCondition StepCondition(float stepAmount, float initialValue = 0.0f);
+DALI_IMPORT_API PropertyCondition StepCondition( float stepAmount, float initialValue = 0.0f );
/**
* @brief Receive notifications as a property goes above/below the inputted values. Values must be ordered and can be either ascending or descending
* @param[in] steps List of values to receive notifications for as a property crosses them
* @return A property condition function object
*/
-DALI_IMPORT_API PropertyCondition VariableStepCondition(const std::vector<float>& steps);
+DALI_IMPORT_API PropertyCondition VariableStepCondition( const Dali::Vector<float>& steps );
} // namespace Dali
// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/signals/dali-signal.h>
namespace Dali