Commit de9a04cf authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - reverted some changes from #65533d24f595 and #06877cbf5e95 to...

[CHANGE] - reverted some changes from #65533d24f595 and #06877cbf5e95 to WFlag, WProperties and WPropertyVariable as
these classes correspond to the Observer/Observable pattern. It is not useful to clone the change conditions if
the instance itself is cloned. You won't expect to wake up if you wait for a copy of a flag to change and the original
(which is completely decoupled from your clone) is changed, right?
parent 4612dd3f
......@@ -206,8 +206,8 @@ WFlag< T >::WFlag( boost::shared_ptr< WCondition > condition, T initial ):
template < typename T >
WFlag< T >::WFlag( const WFlag& from ):
m_condition( from.m_condition ),
m_valueChangeCondition( from.m_valueChangeCondition ),
m_condition( boost::shared_ptr< WCondition >( new WCondition() ) ),
m_valueChangeCondition( boost::shared_ptr< WCondition >( new WCondition() ) ),
m_flag( from.m_flag ),
m_changed( from.m_changed )
{
......
......@@ -65,8 +65,7 @@ WProperties::WProperties( const WProperties& from ):
from.m_propAccess->endRead();
// add the change condition of the prop list
//m_updateCondition->add( m_properties.getChangeCondition() );
m_updateCondition = from.m_updateCondition;
m_updateCondition->add( m_properties.getChangeCondition() );
}
boost::shared_ptr< WPropertyBase > WProperties::clone()
......
......@@ -439,7 +439,6 @@ WPropertyVariable< T >::WPropertyVariable( std::string name, std::string descrip
// set constraint and change condition to update condition set of WPropertyBase
m_updateCondition->add( m_constraints->getChangeCondition() );
m_updateCondition->add( WFlag< T >::getCondition() );
m_updateCondition->add( WFlag< T >::getValueChangeCondition() );
}
......@@ -453,7 +452,6 @@ WPropertyVariable< T >::WPropertyVariable( std::string name, std::string descrip
// set constraint and change condition to update condition set of WPropertyBase
m_updateCondition->add( m_constraints->getChangeCondition() );
m_updateCondition->add( WFlag< T >::getCondition() );
m_updateCondition->add( WFlag< T >::getValueChangeCondition() );
}
......@@ -468,7 +466,6 @@ WPropertyVariable< T >::WPropertyVariable( std::string name, std::string descrip
// set constraint and change condition to update condition set of WPropertyBase
m_updateCondition->add( m_constraints->getChangeCondition() );
m_updateCondition->add( WFlag< T >::getCondition() );
m_updateCondition->add( WFlag< T >::getValueChangeCondition() );
// set custom notifier
......@@ -489,7 +486,6 @@ WPropertyVariable< T >::WPropertyVariable( std::string name, std::string descrip
// set constraint and change condition to update condition set of WPropertyBase
m_updateCondition->add( m_constraints->getChangeCondition() );
m_updateCondition->add( WFlag< T >::getCondition() );
m_updateCondition->add( WFlag< T >::getValueChangeCondition() );
// set custom notifier
......@@ -531,7 +527,6 @@ WPropertyVariable< T >::~WPropertyVariable()
{
// clean up
m_updateCondition->remove( m_constraints->getChangeCondition() );
m_updateCondition->remove( WFlag< T >::getCondition() );
m_updateCondition->remove( WFlag< T >::getValueChangeCondition() );
m_notifierConnection.disconnect();
......
......@@ -202,9 +202,9 @@ public:
TS_ASSERT( flag->get() != flagClone->get() );
// the conditions need to be different
// (ledig) really? because thats what the clone is for which (eichelbaum) changed in the config editor and therefor crashed the whole thing
//TS_ASSERT( flag->getCondition() != flagClone->getCondition() );
//TS_ASSERT( flag->getValueChangeCondition() != flagClone->getValueChangeCondition() );
// This is because the flag is another one and you won't expect to wake up if someone changes a Flag you do not know
TS_ASSERT( flag->getCondition() != flagClone->getCondition() );
TS_ASSERT( flag->getValueChangeCondition() != flagClone->getValueChangeCondition() );
}
};
......
......@@ -278,14 +278,14 @@ public:
// the first should not fire, but the condition of the clone
TS_ASSERT( m_testTemporary1 == false );
//TS_ASSERT( m_testTemporary2 == true );
TS_ASSERT( m_testTemporary2 == true );
// the same thing but vice versa
m_testTemporary1 = false;
m_testTemporary2 = false;
orig->addProperty( "1", "test1", false );
// this time, the first should fire but not the second
//TS_ASSERT( m_testTemporary2 == false );
TS_ASSERT( m_testTemporary2 == false );
TS_ASSERT( m_testTemporary1 == true );
/////////////////////
......
......@@ -152,7 +152,7 @@ public:
m_testTemporary1 = false;
m_testTemporary2 = false;
clone->set( 4 );
//TS_ASSERT( !m_testTemporary1 );
TS_ASSERT( !m_testTemporary1 );
TS_ASSERT( m_testTemporary2 );
// and test vice versa
......@@ -160,7 +160,7 @@ public:
m_testTemporary2 = false;
p->set( 2 );
TS_ASSERT( m_testTemporary1 );
//TS_ASSERT( !m_testTemporary2 );
TS_ASSERT( !m_testTemporary2 );
// do the same for constraints
m_testTemporary1 = false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment