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

Method loadTimestampIndex

app/src/Sessions/PlayerLoaderWorker.cpp:126–153  ·  view source on GitHub ↗

* @brief Loads the distinct frame timestamps for the session, with periodic cancel checks. */

Source from the content-addressed store, hash-verified

124 * @brief Loads the distinct frame timestamps for the session, with periodic cancel checks.
125 */
126bool Sessions::PlayerLoaderWorker::loadTimestampIndex(QSqlDatabase& db,
127 int sessionId,
128 PlayerSessionPayload& payload,
129 QString& errorOut)
130{
131 QSqlQuery q(db);
132 q.setForwardOnly(true);
133 q.prepare("SELECT DISTINCT timestamp_ns FROM readings "
134 "WHERE session_id = ? ORDER BY timestamp_ns ASC");
135 q.bindValue(0, sessionId);
136 if (!q.exec()) {
137 errorOut = q.lastError().text();
138 return false;
139 }
140
141 qint64 row = 0;
142 while (q.next()) {
143 if ((row & 0xFFFF) == 0 && m_cancelRequested.load(std::memory_order_acquire)) {
144 errorOut = tr("Cancelled");
145 return false;
146 }
147
148 payload.timestampsNs.push_back(q.value(0).toLongLong());
149 ++row;
150 }
151
152 return true;
153}
154
155/**
156 * @brief Opens the file, fetches column order + project JSON + timestamp index, ships it back.

Callers

nothing calls this directly

Calls 6

execMethod · 0.80
nextMethod · 0.80
textMethod · 0.45
lastErrorMethod · 0.45
loadMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected