Initialize the attributes of IfcLateBoundEntity to NULL upon construction.

Make sure IfcWritableEntity does not return null pointers, since getArgumentCount() is unreliable for instances being created from keyword arguments in Python.
This commit is contained in:
Thomas Krijnen
2015-02-19 20:20:47 +00:00
parent 6822e84849
commit 8f853ac5af
2 changed files with 10 additions and 1 deletions
+6 -1
View File
@@ -71,7 +71,12 @@ IfcEntityList::ptr IfcWritableEntity::getInverse(IfcSchema::Type::Enum type, int
}
std::string IfcWritableEntity::datatype() const { return IfcSchema::Type::ToString(_type); }
Argument* IfcWritableEntity::getArgument (unsigned int i) { if ( i >= getArgumentCount() ) throw IfcParse::IfcException("Argument not set"); return args[i]; }
Argument* IfcWritableEntity::getArgument (unsigned int i) {
if (args[i] == 0) {
_setArgument(i, boost::none);
}
return args[i];
}
unsigned int IfcWritableEntity::getArgumentCount() const {return args.size(); }
IfcSchema::Type::Enum IfcWritableEntity::type() const { return _type; }
bool IfcWritableEntity::is(IfcSchema::Type::Enum v) const { return _type == v; }