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

Method handleOf

app/src/DataModel/DataTable.cpp:372–381  ·  view source on GitHub ↗

* @brief Resolves (table, register) to a generation-tagged handle (gen<<24|index), or -1 if * unknown; run once off the hot path. Silent on miss: -1 is the documented sentinel and * probing for optional registers is a legitimate pattern, so (unlike get()) it does not * warn -- a typo surfaces through the name-based get() path instead. */

Source from the content-addressed store, hash-verified

370 * warn -- a typo surfaces through the name-based get() path instead.
371 */
372qint64 DataModel::DataTableStore::handleOf(const QString& table, const QString& reg) const
373{
374 Q_ASSERT(m_initialized);
375
376 const int idx = indexOf(table, reg);
377 if (idx < 0) [[unlikely]]
378 return -1;
379
380 return (static_cast<qint64>(m_generation) << kHandleIndexBits) | static_cast<qint64>(idx);
381}
382
383/**
384 * @brief Hot-path read by handle; a stale, out-of-range, or -1 handle is a safe nullptr.

Callers 5

valueHandleMethod · 0.80
tableHandleMethod · 0.80
tableHandleManyMethod · 0.80
luaTableHandleFunction · 0.80
luaTableHandleManyFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected