28 #include <boost/shared_ptr.hpp>
30 #include "WCondition.h"
36 template <
typename T >
48 typedef boost::shared_ptr< WFlag< T > >
SPtr;
53 typedef boost::shared_ptr< const WFlag< T > >
ConstSPtr;
73 WFlag( boost::shared_ptr< WCondition > condition,
const T& initial );
98 virtual const T&
get(
bool resetChangeState = false );
105 virtual const T&
get()
const;
119 virtual operator T()
const;
124 virtual void wait()
const;
136 virtual bool set(
const T& value,
bool suppressNotification = false );
168 virtual bool accept(
const T& newValue );
185 virtual bool changed(
bool reset =
false );
217 template <
typename T >
219 m_condition( boost::shared_ptr<
WCondition >( condition ) ),
226 template <
typename T >
228 m_condition( condition ),
235 template <
typename T >
239 m_flag( from.m_flag ),
240 m_changed( from.m_changed )
244 template <
typename T >
249 template <
typename T >
255 template <
typename T >
258 if( resetChangeState )
265 template <
typename T >
271 template <
typename T >
277 template <
typename T >
283 template <
typename T >
289 template <
typename T >
293 if( m_flag == value )
299 if( !accept( value ) )
308 if( !suppressNotification )
310 m_condition->notify();
312 m_valueChangeCondition->notify();
317 template <
typename T >
323 template <
typename T >
326 return m_valueChangeCondition;
329 template <
typename T >
336 template <
typename T >
339 return accept(
get() );
342 template <
typename T >
345 bool tmp = m_changed;