MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / filter

Function filter

src/ifcgeom/taxonomy.h:1702–1716  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1700 // @nb traverses nested collections
1701 template <typename Fn>
1702 taxonomy::collection::ptr filter(const taxonomy::collection::ptr& collection, Fn fn) {
1703 auto filtered = taxonomy::make<taxonomy::collection>();
1704 for (auto& child : collection->children) {
1705 if (apply_predicate_to_collection(child, fn)) {
1706 filtered->children.push_back(clone(child));
1707 }
1708 }
1709 if (filtered->children.empty()) {
1710#ifdef TAXONOMY_USE_NAKED_PTR
1711 delete filtered;
1712#endif
1713 return nullptr;
1714 }
1715 return filtered;
1716 }
1717
1718 // @nb traverses nested collections
1719 template <typename Fn>

Callers 10

create_socketFunction · 0.50
__call__Method · 0.50
yml_to_classes.pyFile · 0.50
toggle_wireframeMethod · 0.50
filter_elementsMethod · 0.50
get_filtered_elementsMethod · 0.50
get_dictionariesMethod · 0.50

Calls 4

push_backMethod · 0.80
cloneFunction · 0.70
emptyMethod · 0.45

Tested by 1