| 1510 | |
| 1511 | template <typename T> |
| 1512 | void set(IfcUtil::IfcBaseClass* inst, const std::string& attr, T t) { |
| 1513 | auto decl = inst->declaration().as_entity(); |
| 1514 | auto i = decl->attribute_index(attr); |
| 1515 | |
| 1516 | auto attr_type = decl->attribute_by_index(i)->type_of_attribute(); |
| 1517 | if (attr_type->as_named_type() && attr_type->as_named_type()->declared_type()->as_enumeration_type() && !std::is_same<T, EnumerationReference>::value) { |
| 1518 | set_enumeration(inst, attr, attr_type->as_named_type()->declared_type()->as_enumeration_type(), t); |
| 1519 | } else { |
| 1520 | inst->set_attribute_value(i, t); |
| 1521 | } |
| 1522 | } |
| 1523 | |
| 1524 | IfcUtil::IfcBaseClass* create(IfcParse::IfcFile& f, const std::string& entity) { |
| 1525 | auto decl = f.schema()->declaration_by_name(entity); |