MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / set

Method set

app/src/DataModel/DataTable.cpp:338–360  ·  view source on GitHub ↗

* @brief Writes to a computed register; no-op for constant or system registers, and an identical * value is a successful no-op that leaves the slot version untouched. */

Source from the content-addressed store, hash-verified

336 * value is a successful no-op that leaves the slot version untouched.
337 */
338bool DataModel::DataTableStore::set(const QString& table,
339 const QString& reg,
340 const RegisterValue& val)
341{
342 Q_ASSERT(m_initialized);
343 Q_ASSERT(m_isComputed.size() == m_storage.size());
344
345 const int idx = indexOf(table, reg);
346 if (idx < 0) [[unlikely]]
347 return false;
348
349 if (!m_isComputed[static_cast<size_t>(idx)]) [[unlikely]] {
350 qWarning() << "[DataTableStore] Cannot write to non-computed register" << table << "/" << reg;
351 return false;
352 }
353
354 if (sameRegisterValue(m_storage[static_cast<size_t>(idx)], val))
355 return true;
356
357 m_storage[static_cast<size_t>(idx)] = val;
358 m_version[static_cast<size_t>(idx)] = ++m_writeClock;
359 return true;
360}
361
362//--------------------------------------------------------------------------------------------------
363// Handle (pointer) fast path

Callers 15

valueSetMethod · 0.45
setVertexColorFunction · 0.45
setVertexColorFunction · 0.45
tableSetMethod · 0.45
translate_ts_fileFunction · 0.45
reset_translationsFunction · 0.45
stopMethod · 0.45
mainFunction · 0.45
stopMethod · 0.45
test_race_conditionsFunction · 0.45
race_threadMethod · 0.45
saboteurMethod · 0.45

Calls 2

sameRegisterValueFunction · 0.85
sizeMethod · 0.45

Tested by 4

stopMethod · 0.36
test_race_conditionsFunction · 0.36
saboteurMethod · 0.36