* @brief Builds the replay column layout from the export schema (uniqueId-ordered, virtual * datasets included) and installs the per-source FrameBuilder lookup map. */
| 889 | * datasets included) and installs the per-source FrameBuilder lookup map. |
| 890 | */ |
| 891 | void CSV::Player::buildReplayLayout() |
| 892 | { |
| 893 | m_sourceColumnsByIndex.clear(); |
| 894 | |
| 895 | DataModel::Frame frame; |
| 896 | frame.groups = DataModel::ProjectModel::instance().groups(); |
| 897 | frame.sources = DataModel::ProjectModel::instance().sources(); |
| 898 | const auto schema = DataModel::buildExportSchema(frame); |
| 899 | const int colCount = static_cast<int>(schema.columns.size()); |
| 900 | |
| 901 | QSet<int> sources; |
| 902 | for (const auto& col : schema.columns) |
| 903 | sources.insert(col.sourceId); |
| 904 | |
| 905 | m_multiSource = sources.size() > 1; |
| 906 | |
| 907 | std::unordered_map<int, std::unordered_map<int, int>> replay; |
| 908 | |
| 909 | if (!m_multiSource) { |
| 910 | for (int i = 0; i < colCount; ++i) |
| 911 | replay[0][schema.columns[static_cast<size_t>(i)].uniqueId] = i; |
| 912 | } |
| 913 | |
| 914 | else { |
| 915 | std::unordered_map<int, int> nextLocal; |
| 916 | for (int i = 0; i < colCount; ++i) { |
| 917 | const auto& col = schema.columns[static_cast<size_t>(i)]; |
| 918 | m_sourceColumnsByIndex[col.sourceId].append(i); |
| 919 | replay[col.sourceId][col.uniqueId] = nextLocal[col.sourceId]++; |
| 920 | } |
| 921 | } |
| 922 | |
| 923 | DataModel::FrameBuilder::instance().setReplayColumnMap(std::move(replay)); |
| 924 | } |
| 925 | |
| 926 | /** |
| 927 | * @brief Injects a CSV frame, splitting per source when in multi-source mode. |
nothing calls this directly
no test coverage detected