File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ class IFC_PARSE_API IfcEntityList {
5050 }
5151 void remove (IfcUtil::IfcBaseClass*);
5252 IfcEntityList::ptr filtered (const std::set<IfcSchema::Type::Enum>& entities);
53+ IfcEntityList::ptr unique ();
5354};
5455
5556template <class T >
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ void IfcEntityList::remove(IfcUtil::IfcBaseClass* instance) {
6262 ls.erase (it);
6363 }
6464}
65+
6566IfcEntityList::ptr IfcEntityList::filtered (const std::set<IfcSchema::Type::Enum>& entities) {
6667 IfcEntityList::ptr return_value (new IfcEntityList);
6768 for (it it = begin (); it != end (); ++it) {
@@ -79,6 +80,18 @@ IfcEntityList::ptr IfcEntityList::filtered(const std::set<IfcSchema::Type::Enum>
7980 return return_value;
8081}
8182
83+ IfcEntityList::ptr IfcEntityList::unique () {
84+ std::set<IfcUtil::IfcBaseClass*> encountered;
85+ IfcEntityList::ptr return_value (new IfcEntityList);
86+ for (it it = begin (); it != end (); ++it) {
87+ if (encountered.find (*it) == encountered.end ()) {
88+ return_value->push (*it);
89+ encountered.insert (*it);
90+ }
91+ }
92+ return return_value;
93+ }
94+
8295
8396unsigned int IfcUtil::IfcBaseType::getArgumentCount () const { return 1 ; }
8497Argument* IfcUtil::IfcBaseType::getArgument (unsigned int i) const { return entity->getArgument (i); }
You can’t perform that action at this time.
0 commit comments