Unique filter on IfcEntityList

This commit is contained in:
Thomas Krijnen
2017-06-20 18:54:55 +02:00
parent 1e8b1d9c9c
commit e60202b738
2 changed files with 14 additions and 0 deletions
+13
View File
@@ -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); }