pub struct EntityDef {
pub name: String,
pub supertype: Option<String>,
pub abstract_: bool,
pub attributes: Vec<Attribute>,
pub derived: Vec<String>,
}Expand description
One structural entity declaration.
Fields§
§name: StringDeclared entity name.
supertype: Option<String>First direct supertype, when a SUBTYPE OF clause is present.
abstract_: boolWhether the declaration includes ABSTRACT.
attributes: Vec<Attribute>Explicit attributes declared by this entity, excluding derived and inverse declarations.
derived: Vec<String>Names of attributes this entity declares in its DERIVE block.
A subtype may redeclare an inherited explicit attribute as derived:
DERIVE
SELF\IfcGeometricRepresentationContext.Precision : IfcReal
:= NVL(ParentContext.Precision, 1.E-5);The redeclaration keeps the attribute’s inherited position but
removes it from what an instance may state: Part 21 writes such a slot
as *, not as a value and not as $. A consumer that does not know an
attribute is derived cannot tell those apart, so this list is the
minimum needed to write a conforming file.
Names are stored unqualified — the SELF\Entity. prefix is stripped —
because that is how they match the inherited attribute they redeclare.
Entries are in declaration order. Derived attributes that are new
rather than redeclarations appear here too; they occupy no positional
slot, so consumers resolving slots should match against inherited
attribute names rather than assuming every entry is positional.
Implementations§
Source§impl EntityDef
impl EntityDef
Sourcepub fn with_supertype(self, supertype: impl Into<String>) -> Self
pub fn with_supertype(self, supertype: impl Into<String>) -> Self
Sets the direct supertype.
Sourcepub fn with_attribute(self, attribute: Attribute) -> Self
pub fn with_attribute(self, attribute: Attribute) -> Self
Appends an explicit attribute in declaration order.
Sourcepub fn with_derived(self, name: impl Into<String>) -> Self
pub fn with_derived(self, name: impl Into<String>) -> Self
Declares an attribute name as derived, as a DERIVE block would.
Sourcepub fn is_derived(&self, name: &str) -> bool
pub fn is_derived(&self, name: &str) -> bool
Whether name is declared derived by this entity.
Comparison is ASCII case-insensitive: EXPRESS identifiers are case-sensitive in principle, but schema text and Part 21 keywords disagree on case often enough that matching exactly is a foot-gun.