DirtyAttr.inl
Go to the documentation of this file.
1 namespace iv
2 {
3 
4 //-------------------------------
5 template< class T >
6 DirtyAttr_I< T >::DirtyAttr_I( ClientMarker * cm, AttributeEventProcessor * processor, T const & initial_value ) :
7  Attr< T >( cm, processor, false ),
8  _value( initial_value ),
9  _dirty( true )
10 {
11  this->SetAttributeMode( Attribute::ValueMode::ValueModify );
12 }
13 
14 
15 template< class T >
16 bool DirtyAttr_I< T >::operator<( DirtyAttr_I< T > const & right ) const
17 {
18  return std::tie( this->_value, this->_dirty ) < std::tie( right._value, right._dirty );
19 }
20 
21 template< class T >
23 {
24  bool result = this->_dirty;
25  this->_dirty = false;
26  return result;
27 }
28 
29 template< class T >
31 {
32  return this->_dirty;
33 }
34 
35 template< class T >
36 void DirtyAttr_I< T >::GetSourceValue( T & out ) const
37 {
38  out = this->_value;
39 }
40 
41 template< class T >
42 void DirtyAttr_I< T >::ModifySource( T const & val )
43 {
44  if( this->_value == val )
45  return;
46 
47  this->_value = val;
48  this->_dirty = true;
49  this->Attr< T >::SourceValueChanged();
50 }
51 
52 template< class T >
53 void DirtyAttr_I< T >::Set( T const & val )
54 {
55  this->ModifySource( val );
56 }
57 
58 //-----------------------
59 template< class T >
60 DirtyAttr< T >::DirtyAttr( ClientMarker * cm, T const & initial_value ) :
61  Local_AEP(),
62  DirtyAttr_I< T >( cm, this, initial_value )
63 {
64  this->Notify_Activated();
65 }
66 
67 template< class T >
69 {
70  this->Notify_Deactivated();
71 }
72 
73 }