* @brief Claims a free pool slot, copies @p src + @p ts into it, and returns an aliasing * shared_ptr: no deleter, no per-frame control block. */
| 283 | * shared_ptr: no deleter, no per-frame control block. |
| 284 | */ |
| 285 | SS_HOT DataModel::TimestampedFramePtr DataModel::FrameBuilder::acquireFrame( |
| 286 | const DataModel::Frame& src, const DataModel::TimestampedFrame::SteadyTimePoint& ts) |
| 287 | { |
| 288 | const size_t idx = claimPoolSlot(); |
| 289 | if (idx == kInvalidSlotIdx) [[unlikely]] { |
| 290 | notePoolExhausted(); |
| 291 | auto heap = std::make_shared<TimestampedFrame>(src, ts); |
| 292 | heap->structureGeneration = m_framePoolGeneration; |
| 293 | return heap; |
| 294 | } |
| 295 | |
| 296 | const auto& slotOwner = m_framePool[idx]; |
| 297 | auto* slotRaw = slotOwner.get(); |
| 298 | |
| 299 | if (preparePooledSlot(slotRaw, src)) [[likely]] |
| 300 | copy_frame_values(slotRaw->frame.data, src); |
| 301 | |
| 302 | slotRaw->frame.timestamp = ts; |
| 303 | slotRaw->frame.structureGeneration = m_framePoolGeneration; |
| 304 | Q_ASSERT(slotRaw->frame.data.groups.size() == src.groups.size()); |
| 305 | |
| 306 | return TimestampedFramePtr(slotOwner, &slotRaw->frame); |
| 307 | } |
| 308 | |
| 309 | /** |
| 310 | * @brief Convenience overload that timestamps the slot with SteadyClock::now(). |
nothing calls this directly
no test coverage detected