MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / RemoveCommandClassValues

Method RemoveCommandClassValues

cpp/src/value_classes/ValueStore.cpp:137–168  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Remove all the values associated with a command class from the store -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

135// Remove all the values associated with a command class from the store
136//-----------------------------------------------------------------------------
137void ValueStore::RemoveCommandClassValues
138(
139 uint8 const _commandClassId
140)
141{
142 map<uint32,Value*>::iterator it = m_values.begin();
143 while( it != m_values.end() )
144 {
145 Value* value = it->second;
146 ValueID const& valueId = value->GetID();
147 if( _commandClassId == valueId.GetCommandClassId() )
148 {
149 // The value belongs to the specified command class
150
151 // First notify the watchers
152 if( Driver* driver = Manager::Get()->GetDriver( valueId.GetHomeId() ) )
153 {
154 Notification* notification = new Notification( Notification::Type_ValueRemoved );
155 notification->SetValueId( valueId );
156 driver->QueueNotification( notification );
157 }
158
159 // Now release and remove the value from the store
160 value->Release();
161 m_values.erase( it++ );
162 }
163 else
164 {
165 ++it;
166 }
167 }
168}
169
170//-----------------------------------------------------------------------------
171// <ValueStore::GetValue>

Callers 2

RemoveCommandClassMethod · 0.80
ReadXMLMethod · 0.80

Calls 7

QueueNotificationMethod · 0.80
GetFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
GetCommandClassIdMethod · 0.45
GetDriverMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected