MCPcopy Create free account
hub / github.com/comaps/comaps / BuildHierarchy

Function BuildHierarchy

generator/hierarchy.cpp:260–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260HierarchyLinker::Node::Ptrs BuildHierarchy(std::vector<feature::FeatureBuilder> && fbs,
261 GetMainTypeFn const & getMainType,
262 std::shared_ptr<FilterInterface> const & filter)
263{
264 base::EraseIf(fbs, [&](auto const & fb) { return !filter->IsAccepted(fb); });
265 HierarchyLinker::Node::Ptrs places;
266 places.reserve(fbs.size());
267 base::Transform(fbs, std::back_inserter(places),
268 [](auto const & fb) { return tree_node::MakeTreeNode(HierarchyPlace(fb)); });
269 auto nodes = HierarchyLinker(std::move(places)).Link();
270 // We leave only the trees.
271 base::EraseIf(nodes, [](auto const & node) { return node->HasParent(); });
272 return nodes;
273}
274
275void AddChildrenTo(HierarchyLinker::Node::Ptrs & trees,
276 std::function<std::vector<HierarchyPlace>(CompositeId const &)> const & fn)

Callers 2

ProcessMethod · 0.85
UNIT_CLASS_TESTFunction · 0.85

Calls 10

EraseIfFunction · 0.85
TransformFunction · 0.85
MakeTreeNodeFunction · 0.85
HierarchyPlaceClass · 0.85
HierarchyLinkerClass · 0.85
IsAcceptedMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
LinkMethod · 0.45
HasParentMethod · 0.45

Tested by 1

UNIT_CLASS_TESTFunction · 0.68