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

Method setByHandle

app/src/DataModel/DataTable.cpp:407–429  ·  view source on GitHub ↗

* @brief Hot-path write by handle; non-computed (guard matches set()), stale, or invalid handles * are ignored silently, with no warning so a misused handle cannot spam the log per frame. * An identical value is a successful no-op that leaves the slot version untouched. */

Source from the content-addressed store, hash-verified

405 * An identical value is a successful no-op that leaves the slot version untouched.
406 */
407bool DataModel::DataTableStore::setByHandle(qint64 handle, const RegisterValue& val)
408{
409 Q_ASSERT(m_initialized);
410 Q_ASSERT(m_isComputed.size() == m_storage.size());
411
412 if (handle < 0) [[unlikely]]
413 return false;
414
415 const int gen = static_cast<int>(handle >> kHandleIndexBits);
416 const int index = static_cast<int>(handle & kHandleIndexMask);
417 if (gen != m_generation || index >= static_cast<int>(m_storage.size())) [[unlikely]]
418 return false;
419
420 if (!m_isComputed[static_cast<size_t>(index)]) [[unlikely]]
421 return false;
422
423 if (sameRegisterValue(m_storage[static_cast<size_t>(index)], val))
424 return true;
425
426 m_storage[static_cast<size_t>(index)] = val;
427 m_version[static_cast<size_t>(index)] = ++m_writeClock;
428 return true;
429}
430
431//--------------------------------------------------------------------------------------------------
432// System dataset table

Callers 3

valueSetHMethod · 0.80
tableSetHMethod · 0.80
luaTableSetHFunction · 0.80

Calls 2

sameRegisterValueFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected