semantic_digital_twin.mixin#

Attributes#

TUniqueSimulatorProperty

The concrete kind of property a lookup asks for, so that the lookup returns that kind

Classes#

SimulatorAttributeName

Marks a field of a simulator property whose attribute the simulator spells

SimulatorAdditionalProperty

Class representing an additional property for a simulator.

UniqueSimulatorProperty

A simulator property an entity carries at most one of, such as the physical

HasSimulatorProperties

Mixin class to add simulator additional properties to a data class.

Module Contents#

class semantic_digital_twin.mixin.SimulatorAttributeName#

Bases: krrood.patterns.field_metadata.FieldMetadata

Marks a field of a simulator property whose attribute the simulator spells differently than the field is named.

attribute_name: str#

The simulator’s own name for the attribute.

class semantic_digital_twin.mixin.SimulatorAdditionalProperty#

Class representing an additional property for a simulator.

to_dict() Dict[str, Any]#
Returns:

The fields as a dictionary, each under the simulator’s own name for it if the field declares one (see SimulatorAttributeName), else under its own.

class semantic_digital_twin.mixin.UniqueSimulatorProperty#

Bases: SimulatorAdditionalProperty

A simulator property an entity carries at most one of, such as the physical settings of one body or one geometry; a simulator reads exactly one and would silently ignore the rest.

Properties an entity may carry several of, such as cameras or lights, are plain SimulatorAdditionalProperty.

semantic_digital_twin.mixin.TUniqueSimulatorProperty#

The concrete kind of property a lookup asks for, so that the lookup returns that kind rather than the base class.

class semantic_digital_twin.mixin.HasSimulatorProperties#

Mixin class to add simulator additional properties to a data class.

simulator_additional_properties: List[SimulatorAdditionalProperty] = []#

A list of additional properties for the simulator, it can contain properties of multiple simulators. Extend it with add_simulator_property(), which keeps a UniqueSimulatorProperty from being attached twice.

add_simulator_property(simulator_property: SimulatorAdditionalProperty) None#

Attach a property to this entity.

Parameters:

simulator_property – The property to attach.

Raises:

DuplicateSimulatorPropertyError – If the property is a UniqueSimulatorProperty and one of its type is attached already.

get_simulator_property_of_type(property_type: Type[TUniqueSimulatorProperty]) TUniqueSimulatorProperty | None#

The property of property_type this entity carries.

Parameters:

property_type – The type of property to look up.

Returns:

The property, or None if none of that type is attached.