MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / columnsForTopic

Function columnsForTopic

pj_datastore/src/reader.cpp:89–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89[[nodiscard]] std::vector<ColumnDescriptor> columnsForTopic(const DataEngine& engine, const TopicStorage& storage) {
90 if (!storage.columnDescriptors().empty()) {
91 return storage.columnDescriptors();
92 }
93
94 const auto& chunks = storage.sealedChunks();
95 if (!chunks.empty()) {
96 std::vector<ColumnDescriptor> columns;
97 columns.reserve(chunks.front().columns.size());
98 for (const auto& column : chunks.front().columns) {
99 if (column.descriptor) {
100 columns.push_back(*column.descriptor);
101 }
102 }
103 return columns;
104 }
105
106 const TypeTreeNode* type_tree = engine.typeRegistry().lookup(storage.descriptor().schema_id);
107 if (type_tree == nullptr) {
108 return {};
109 }
110
111 std::vector<ColumnDescriptor> columns;
112 FieldId next_id = 0;
113 if (type_tree->kind == TypeKind::kStruct) {
114 for (const auto& child : type_tree->children) {
115 flattenColumns(*child, "", next_id, columns);
116 }
117 } else {
118 flattenColumns(*type_tree, "", next_id, columns);
119 }
120 return columns;
121}
122
123} // namespace
124

Callers 1

seriesMethod · 0.85

Calls 6

flattenColumnsFunction · 0.85
reserveMethod · 0.80
descriptorMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
lookupMethod · 0.45

Tested by

no test coverage detected