mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
Unique filter on IfcEntityList
This commit is contained in:
@@ -62,6 +62,7 @@ void IfcEntityList::remove(IfcUtil::IfcBaseClass* instance) {
|
||||
ls.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
IfcEntityList::ptr IfcEntityList::filtered(const std::set<IfcSchema::Type::Enum>& entities) {
|
||||
IfcEntityList::ptr return_value(new IfcEntityList);
|
||||
for (it it = begin(); it != end(); ++it) {
|
||||
@@ -79,6 +80,18 @@ IfcEntityList::ptr IfcEntityList::filtered(const std::set<IfcSchema::Type::Enum>
|
||||
return return_value;
|
||||
}
|
||||
|
||||
IfcEntityList::ptr IfcEntityList::unique() {
|
||||
std::set<IfcUtil::IfcBaseClass*> encountered;
|
||||
IfcEntityList::ptr return_value(new IfcEntityList);
|
||||
for (it it = begin(); it != end(); ++it) {
|
||||
if (encountered.find(*it) == encountered.end()) {
|
||||
return_value->push(*it);
|
||||
encountered.insert(*it);
|
||||
}
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
unsigned int IfcUtil::IfcBaseType::getArgumentCount() const { return 1; }
|
||||
Argument* IfcUtil::IfcBaseType::getArgument(unsigned int i) const { return entity->getArgument(i); }
|
||||
|
||||
Reference in New Issue
Block a user