| 220 | // model. The second and third argument require a member function pointer. |
| 221 | template <typename T, typename U, typename V, typename F, typename G> |
| 222 | auto get_related(T* t, F f, G g) { |
| 223 | typename U::list::ptr li = (*t.*f)()->template as<U>(); |
| 224 | typename aggregate_of<V>::ptr acc(new aggregate_of<V>); |
| 225 | for (typename U::list::it it = li->begin(); it != li->end(); ++it) { |
| 226 | U* u = *it; |
| 227 | try { |
| 228 | acc->push((*u.*g)()->template as<V>()); |
| 229 | } catch (IfcParse::IfcException& e) { |
| 230 | Logger::Error(e); |
| 231 | } |
| 232 | } |
| 233 | return acc; |
| 234 | } |
| 235 | |
| 236 | // Descends into the tree by recursing into IfcRelContainedInSpatialStructure, |
| 237 | // IfcRelDecomposes, IfcRelDefinesByType, IfcRelDefinesByProperties relations. |