mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
Fix latebound entity inheritance hierarchy wrt id() #5822 - not ideal, because BaseEntity.declation now returns declaration
This commit is contained in:
+14
-14
@@ -124,19 +124,6 @@ public:
|
||||
void toString(std::ostream&, bool upper = false) const;
|
||||
};
|
||||
|
||||
class IFC_PARSE_API IfcLateBoundEntity : public IfcBaseClass {
|
||||
private:
|
||||
const IfcParse::declaration* decl_;
|
||||
|
||||
public:
|
||||
IfcLateBoundEntity(const IfcParse::declaration* decl, IfcEntityInstanceData&& data) : IfcBaseClass(std::move(data)),
|
||||
decl_(decl) {}
|
||||
|
||||
virtual const IfcParse::declaration& declaration() const {
|
||||
return *decl_;
|
||||
}
|
||||
};
|
||||
|
||||
class IFC_PARSE_API IfcBaseEntity : public IfcBaseClass {
|
||||
public:
|
||||
IfcBaseEntity(IfcEntityInstanceData&& data);
|
||||
@@ -145,7 +132,7 @@ class IFC_PARSE_API IfcBaseEntity : public IfcBaseClass {
|
||||
: IfcBaseClass(IfcEntityInstanceData(storage_t(n)))
|
||||
{}
|
||||
|
||||
virtual const IfcParse::entity& declaration() const = 0;
|
||||
virtual const IfcParse::declaration& declaration() const = 0;
|
||||
|
||||
AttributeValue get(const std::string& name) const;
|
||||
|
||||
@@ -162,6 +149,19 @@ class IFC_PARSE_API IfcBaseEntity : public IfcBaseClass {
|
||||
void populate_derived();
|
||||
};
|
||||
|
||||
class IFC_PARSE_API IfcLateBoundEntity : public IfcBaseEntity {
|
||||
private:
|
||||
const IfcParse::declaration* decl_;
|
||||
|
||||
public:
|
||||
IfcLateBoundEntity(const IfcParse::declaration* decl, IfcEntityInstanceData&& data) : IfcBaseEntity(std::move(data)),
|
||||
decl_(decl) {}
|
||||
|
||||
virtual const IfcParse::declaration& declaration() const {
|
||||
return *decl_;
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: Investigate whether these should be template classes instead
|
||||
class IFC_PARSE_API IfcBaseType : public IfcBaseClass {
|
||||
public:
|
||||
|
||||
@@ -207,10 +207,10 @@ IfcUtil::IfcBaseEntity::IfcBaseEntity(IfcEntityInstanceData&& data)
|
||||
{}
|
||||
|
||||
void IfcUtil::IfcBaseEntity::populate_derived() {
|
||||
for (auto it = declaration().derived().begin(); it != declaration().derived().end(); ++it) {
|
||||
for (auto it = declaration().as_entity()->derived().begin(); it != declaration().as_entity()->derived().end(); ++it) {
|
||||
if (*it) {
|
||||
this->data().storage_.set(
|
||||
std::distance(declaration().derived().begin(), it),
|
||||
std::distance(declaration().as_entity()->derived().begin(), it),
|
||||
Derived{}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user