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

Function flattenColumnsImpl

pj_datastore/src/plugin_data_host.cpp:146–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146void flattenColumnsImpl(
147 const TypeTreeNode& node, std::string_view prefix, FieldId& next_id, std::vector<ColumnDescriptor>& out) {
148 std::string path = prefix.empty() ? node.name : fmt::format("{}.{}", prefix, node.name);
149 switch (node.kind) {
150 case TypeKind::kPrimitive: {
151 ColumnDescriptor desc;
152 desc.field_id = next_id++;
153 desc.logical_type = node.primitive_type.value_or(PrimitiveType::kFloat64);
154 desc.field_path = std::move(path);
155 out.push_back(std::move(desc));
156 return;
157 }
158 case TypeKind::kEnum: {
159 ColumnDescriptor desc;
160 desc.field_id = next_id++;
161 desc.logical_type = node.primitive_type.value_or(PrimitiveType::kInt32);
162 desc.field_path = std::move(path);
163 out.push_back(std::move(desc));
164 return;
165 }
166 case TypeKind::kStruct:
167 for (const auto& child : node.children) {
168 flattenColumnsImpl(*child, path, next_id, out);
169 }
170 return;
171 case TypeKind::kArray:
172 return;
173 }
174}
175
176[[nodiscard]] std::vector<ColumnDescriptor> buildSchemaColumns(const TypeTreeNode& root) {
177 std::vector<ColumnDescriptor> result;

Callers 1

buildSchemaColumnsFunction · 0.70

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected