Base class for all reactor elements. More...
#include <xronos/sdk/element.hh>
Public Member Functions | |
auto | name () const noexcept -> const std::string & |
Get the element's name. | |
auto | fqn () const noexcept -> const std::string & |
Get the element's fully qualified name. | |
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. | |
virtual | ~Element ()=default |
Virtual destructor. |
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.
|
nodiscardnoexcept |
Get the element's name.
|
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.
|
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.
Adding the attributes only succeeds, if the given key has not been set before on the same element.
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.