Attribute.cpp
Go to the documentation of this file.
1 #include "Attribute.hpp"
2 
3 namespace iv
4 {
5 
7 {
8  { Attribute::ValueMode::Disabled, "Disabled" },
9  { Attribute::ValueMode::Value, "Value" },
10  { Attribute::ValueMode::ValueModify, "ValueModify" }
11 };
12 
14 {
20 };
21 
22 Attribute::Attribute( ClientMarker * cm, AttributeEventProcessor * processor, bool allow_ModifyMode ) :
23  cm( cm ),
24  _mode( Attribute::ValueMode::Disabled ),
25  _processor( processor ),
26  _allow_ModifyMode( allow_ModifyMode )
27 {
28 }
29 
31 {
32  return this->cm;
33 }
34 
36 {
37  this->_processor->AttributeEvent( AttributeEventProcessor::Event::AddListener, this, listener );
38 }
39 
41 {
42  this->_processor->AttributeEvent( AttributeEventProcessor::Event::RemoveListener, this, listener );
43 }
44 
45 std::type_index Attribute::Type()
46 {
47  return this->Type_Impl();
48 }
49 
51 {
52  return this->GetAny_Impl();
53 }
54 
56 {
57  if( !this->_allow_ModifyMode )
58  {
59  this->owner()->warning( SRC_INFO, "Can not modify Attribute mode - it is not allowed by the owner of this Attribute to modify its mode with public Attribute::ModifyMode method." );
60  return;
61  }
62 
63  this->SetAttributeMode( mode );
64  this->SourceValueChanged();
65 }
66 
67 void Attribute::ModifyAny( ClientMarker * modifier, std::any val )
68 {
69  this->ModifyAny_Impl( modifier, val );
70 }
71 
73 {
74  return this->_mode;
75 }
76 
78 {
79  this->_mode = val;
80  this->SourceValueChanged();
81 }
82 
84 {
85  if( this->_processor )
86  this->_processor->AttributeEvent( AttributeEventProcessor::Event::Activated, this, nullptr );
87 }
88 
90 {
91  if( this->_processor )
92  this->_processor->AttributeEvent( AttributeEventProcessor::Event::Deactivated, this, nullptr );
93 }
94 
96 {
97  if( this->_processor )
98  this->_processor->AttributeEvent( AttributeEventProcessor::Event::Changed, this, nullptr );
99 }
100 
102 {
103  return this->_processor;
104 }
105 
107 {
108  this->_processor = processor;
109 }
110 
112 {
113  return this->_allow_ModifyMode;
114 }
115 
116 }