* @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. */
| 336 | * value is a successful no-op that leaves the slot version untouched. |
| 337 | */ |
| 338 | bool 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 |