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

Method getByHandle

app/src/DataModel/DataTable.cpp:386–400  ·  view source on GitHub ↗

* @brief Hot-path read by handle; a stale, out-of-range, or -1 handle is a safe nullptr. */

Source from the content-addressed store, hash-verified

384 * @brief Hot-path read by handle; a stale, out-of-range, or -1 handle is a safe nullptr.
385 */
386const DataModel::RegisterValue* DataModel::DataTableStore::getByHandle(qint64 handle) const
387{
388 Q_ASSERT(m_initialized);
389
390 if (handle < 0) [[unlikely]]
391 return nullptr;
392
393 const int gen = static_cast<int>(handle >> kHandleIndexBits);
394 const int index = static_cast<int>(handle & kHandleIndexMask);
395 if (gen != m_generation || index >= static_cast<int>(m_storage.size())) [[unlikely]]
396 return nullptr;
397
398 captureRead(index);
399 return &m_storage[static_cast<size_t>(index)];
400}
401
402/**
403 * @brief Hot-path write by handle; non-computed (guard matches set()), stale, or invalid handles

Callers 3

valueGetHMethod · 0.80
tableGetHMethod · 0.80
luaTableGetHFunction · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected