Base class for all reactor elements. More...
#include <xronos/sdk/element.hh>
Public Member Functions | |
| Element (Element &&)=default | |
| Move constructor. | |
| virtual | ~Element ()=default |
| Virtual destructor. | |
| auto | add_attribute (std::string_view key, const AttributeValue &value) noexcept -> bool |
| Annotate an element with an attribute. | |
| template<std::ranges::input_range R> requires requires(std::ranges::range_value_t<R> pair) { { pair.first } -> std::convertible_to<std::string_view>; { pair.second } -> std::convertible_to<AttributeValue>; } | |
| auto | add_attributes (const R &range) noexcept -> bool |
| Annotate an element with multiple attributes. | |
| auto | add_attributes (std::initializer_list< std::pair< std::string_view, AttributeValue > > attributes) -> bool |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| auto | fqn () const noexcept -> const std::string & |
| Get the element's fully qualified name. | |
| auto | name () const noexcept -> const std::string & |
| Get the element's name. | |
| auto | operator= (Element &&) -> Element &=default |
| Move assignment operator. | |
| auto | uid () const noexcept -> std::uint64_t |
| Get the element's unique ID. | |
Base class for all reactor elements.
Reactor elements are objects that can be contained by reactors and that have special meaning to the Xronos SDK.
|
noexcept |
Annotate an element with an attribute.
Adding the attribute only succeeds, if the given key has not been set before on the same element.
See Attributes for more information.
| key | The name of the attribute to add. |
| value | The value of the attribute to add. |
|
noexcept |
Annotate an element with multiple attributes.
Attributes apply per key. Each attribute is added only if its key has not been set before on the same element. Attributes with rejected keys do not prevent the remaining attributes from being added.
See Attributes for more information.
| R | Type of the range. |
| range | Range of key-value-pairs to be added as attributes. |
| auto xronos::sdk::Element::add_attributes | ( | std::initializer_list< std::pair< std::string_view, AttributeValue > > | attributes | ) | -> bool |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Accepts an initializer list of key value pairs.
|
nodiscardnoexcept |
Get the element's fully qualified name.
The fully qualified name (FQN) represents the containment hierarchy. It consists of the containing reactor's FQN plus the element's name separated by a .. For top-level reactors (those owned by the Environment), the FQN is equal to the name.
|
nodiscardnoexcept |
Get the element's name.
|
nodiscardnoexcept |
Get the element's unique ID.
Returns an integer ID that is unique within an environment.