xentara-plugin v2.0.4
The Xentara Plugin Framework
Loading...
Searching...
No Matches
xentara::model::Element Class Referenceabstract

A generic element within a Xentara model. More...

#include <xentara/model/Element.hpp>

Public Member Functions

virtual ~Element ()=0
 Virtual destructor.
 
Access to the Properties
auto name () const noexcept -> utils::string::StringView
 Gets the name of the element.
 
auto primaryKey () const noexcept -> utils::string::StringView
 Gets the primary key of the element.
 
auto subElementPrimaryKey (std::string_view subElementName) const -> std::string
 Gets the primary key of a sub element (attribute, event, task, or child element)
 
auto uuid () const noexcept -> utils::core::Uuid
 Gets the UUID of the element.
 
auto type () const noexcept -> std::string_view
 Gets the type of the element.
 
auto category () const noexcept -> ElementCategory
 Gets the element category of the element.
 
Access to Elements Members
auto attribute (std::string_view name) const noexcept -> std::shared_ptr< const Attribute >
 Gets the attribute with a specific name.
 
auto attribute (const utils::core::Uuid &uuid) const noexcept -> std::shared_ptr< const Attribute >
 Gets the attribute with a specific UUID.
 
auto attribute (const Attribute::Role &role) const noexcept -> std::shared_ptr< const Attribute >
 Gets the attribute with a specific attribute role.
 
auto attributes () const -> std::vector< std::shared_ptr< const Attribute > >
 Returns a list of all the element’s attributes.
 
auto event (std::string_view name) const noexcept -> std::shared_ptr< const process::Event >
 Gets the event with a specific name.
 
auto event (std::string_view name) noexcept -> std::shared_ptr< process::Event >
 Gets the event with a specific name.
 
auto event (const utils::core::Uuid &uuid) const noexcept -> std::shared_ptr< const process::Event >
 Gets the event with a specific UUID.
 
auto event (const utils::core::Uuid &uuid) noexcept -> std::shared_ptr< process::Event >
 Gets the event with a specific UUID.
 
auto events () const -> std::vector< std::shared_ptr< const process::Event > >
 Returns a list of all the element’s events.
 
auto events () -> std::vector< std::shared_ptr< process::Event > >
 Returns a list of all the element’s events.
 
auto extendedEvent (std::string_view name) const noexcept -> process::ExtendedEvent
 Gets the event with a specific name, including change events for attributes.
 
auto extendedEvent (const utils::core::Uuid &uuid) const noexcept -> process::ExtendedEvent
 Gets the event with a specific UUID, including change events for attributes.
 
auto task (std::string_view name) const noexcept -> std::shared_ptr< const process::Task >
 Gets the task with a specific name.
 
auto task (std::string_view name) noexcept -> std::shared_ptr< process::Task >
 Gets the task with a specific name.
 
auto task (const utils::core::Uuid &uuid) const noexcept -> std::shared_ptr< const process::Task >
 Gets the task with a specific UUID.
 
auto task (const utils::core::Uuid &uuid) noexcept -> std::shared_ptr< process::Task >
 Gets the task with a specific UUID.
 
auto tasks () const -> std::vector< std::shared_ptr< const process::Task > >
 Returns a list of all the element’s tasks.
 
auto tasks () -> std::vector< std::shared_ptr< process::Task > >
 Returns a list of all the element’s tasks.
 
Access to the Element Hierarchy
auto childElement (std::string_view name) const noexcept -> std::shared_ptr< const Element >
 Gets the child element with a specific name.
 
auto childElement (std::string_view name) noexcept -> std::shared_ptr< Element >
 Gets the child element with a specific name.
 
auto childElements () const -> std::vector< std::shared_ptr< const Element > >
 Returns a list of all the element’s children.
 
auto childElements () -> std::vector< std::shared_ptr< Element > >
 Returns a list of all the element’s children.
 
auto parentElement () const -> std::shared_ptr< const Element >
 Returns the element’s parent.
 
auto parentElement () -> std::shared_ptr< Element >
 Returns the element’s parent.
 
auto rootElement () const -> std::shared_ptr< const Element >
 Returns the invisible root element of the model this element belongs to.
 
auto rootElement () -> std::shared_ptr< Element >
 Returns the invisible root element of the model this element belongs to.
 
Iterator Functions
template<std::invocable< const std::shared_ptr< const model::Attribute > & > Callback>
auto forEachAttribute (Callback &&callback) const -> bool
 Iterates over all the element’s attributes.
 
template<std::invocable< const utils::core::Uuid &, std::string_view, const std::shared_ptr< const process::Event > & > Callback>
auto forEachEvent (Callback &&callback) const -> bool
 Iterates over all the element’s events.
 
template<std::invocable< const utils::core::Uuid &, std::string_view, const std::shared_ptr< process::Event > & > Callback>
auto forEachEvent (Callback &&callback) -> bool
 Iterates over all the element’s events.
 
template<std::invocable< const utils::core::Uuid &, std::string_view, const std::shared_ptr< const process::Task > & > Callback>
auto forEachTask (Callback &&callback) const -> bool
 Iterates over all the element’s tasks.
 
template<std::invocable< const utils::core::Uuid &, std::string_view, const std::shared_ptr< process::Task > & > Callback>
auto forEachTask (Callback &&callback) -> bool
 Iterates over all the element’s tasks.
 
template<std::invocable< const std::shared_ptr< const Element > & > Callback>
auto forEachChildElement (Callback &&callback) const -> bool
 Iterates over all the child elements.
 
template<std::invocable< const std::shared_ptr< Element > & > Callback>
auto forEachChildElement (Callback &&callback) -> bool
 Iterates over all the child elements.
 
Creating Read and Write Handles
auto attributeReadHandle (const Attribute &attribute) const noexcept -> data::ReadHandle
 Gets a read handle for a specific attribute.
 
auto attributeReadHandle (std::string_view name) const noexcept -> data::ReadHandle
 Gets a read handle for the attribute with a specific name.
 
auto attributeReadHandle (const utils::core::Uuid &uuid) const noexcept -> data::ReadHandle
 Gets a read handle for the attribute with a specific UUID.
 
auto attributeReadHandle (const Attribute::Role &role) const noexcept -> data::ReadHandle
 Gets a read handle for a specific attribute role.
 
auto attributeWriteHandle (const Attribute &attribute) noexcept -> data::WriteHandle
 Gets a write handle for a specific attribute.
 
auto attributeWriteHandle (std::string_view name) noexcept -> data::WriteHandle
 Gets a write handle for the attribute with a specific name.
 
auto attributeWriteHandle (const utils::core::Uuid &uuid) noexcept -> data::WriteHandle
 Gets a write handle for the attribute with a specific UUID.
 
auto attributeWriteHandle (const Attribute::Role &role) noexcept -> data::WriteHandle
 Gets a write handle for a specific attribute role.
 
Global Lookup Functions
auto findAttribute (std::string_view primaryKey) -> ElementAttribute
 Finds the attribute with a specific primary key in the model this element belongs to.
 
auto findAttributeVerbose (std::string_view primaryKey) -> utils::eh::expected< ElementAttribute, std::string >
 Finds the attribute with a specific primary key in the model this element belongs to, returning an error message on error.
 
auto findEvent (std::string_view primaryKey) const -> std::shared_ptr< const process::Event >
 Finds the event with a specific primary key in the model this element belongs to.
 
auto findEvent (std::string_view primaryKey) -> std::shared_ptr< process::Event >
 Finds the event with a specific primary key in the model this element belongs to.
 
auto findEventVerbose (std::string_view primaryKey) const -> utils::eh::expected< std::shared_ptr< const process::Event >, std::string >
 Finds the event with a specific primary key in the model this element belongs to, returning an error message on error.
 
auto findEventVerbose (std::string_view primaryKey) -> utils::eh::expected< std::shared_ptr< process::Event >, std::string >
 Finds the event with a specific primary key in the model this element belongs to, returning an error message on error.
 
auto findExtendedEvent (std::string_view primaryKey) const -> process::ExtendedEvent
 Finds the extended event with a specific primary key in the model this element belongs to.
 
auto findExtendedEventVerbose (std::string_view primaryKey) const -> utils::eh::expected< process::ExtendedEvent, std::string >
 Finds the extended event with a specific primary key in the model this element belongs to, returning an error message on error.
 
auto findTask (std::string_view primaryKey) const -> std::shared_ptr< const process::Task >
 Finds the task with a specific primary key in the model this element belongs to.
 
auto findTask (std::string_view primaryKey) -> std::shared_ptr< process::Task >
 Finds the task with a specific primary key in the model this element belongs to.
 
auto findTaskVerbose (std::string_view primaryKey) const -> utils::eh::expected< std::shared_ptr< const process::Task >, std::string >
 Finds the task with a specific primary key in the model this element belongs to, returning an error message on error.
 
auto findTaskVerbose (std::string_view primaryKey) -> utils::eh::expected< std::shared_ptr< process::Task >, std::string >
 Finds the task with a specific primary key in the model this element belongs to, returning an error message on error.
 
auto findElement (std::string_view primaryKey) const -> std::shared_ptr< const Element >
 Finds the element with a specific primary key in the model this element belongs to.
 
auto findElement (std::string_view primaryKey) -> std::shared_ptr< Element >
 Finds the element with a specific primary key in the model this element belongs to.
 
auto findElementVerbose (std::string_view primaryKey) const -> utils::eh::expected< std::shared_ptr< const Element >, std::string >
 Finds the element with a specific primary key in the model this element belongs to, returning an error message on error.
 
auto findElementVerbose (std::string_view primaryKey) -> utils::eh::expected< std::shared_ptr< Element >, std::string >
 Finds the element with a specific primary key in the model this element belongs to, returning an error message on error.
 
auto findElement (const utils::core::Uuid &uuid) const -> std::shared_ptr< const Element >
 Finds the element with a specific UUID in the model this element belongs to.
 
auto findElement (const utils::core::Uuid &uuid) -> std::shared_ptr< Element >
 Finds the element with a specific UUID in the model this element belongs to.
 
auto findElementVerbose (const utils::core::Uuid &uuid) const -> utils::eh::expected< std::shared_ptr< const Element >, std::string >
 Finds the element with a specific UUID in the model this element belongs to, returning an error message on error.
 
auto findElementVerbose (const utils::core::Uuid &uuid) -> utils::eh::expected< std::shared_ptr< Element >, std::string >
 Finds the element with a specific UUID in the model this element belongs to, returning an error message on error.
 
Security Functions
auto checkAccess (const security::Authorization &authorization, const security::Entitlement &entitlement) const -> bool
 Checks an authorization for a certain entitlement using the ACL for this element.
 

Detailed Description

A generic element within a Xentara model.

Constructor & Destructor Documentation

◆ ~Element()

virtual xentara::model::Element::~Element ( )
pure virtual

Virtual destructor.

Member Function Documentation

◆ attribute() [1/3]

auto xentara::model::Element::attribute ( const Attribute::Role role) const -> std::shared_ptr< const Attribute >
noexcept

Gets the attribute with a specific attribute role.

Parameters
roleThe role of the desired attribute
Returns
A pointer to the corresponding attribute, or nullptr if no attribute with the specified role was found.

◆ attribute() [2/3]

auto xentara::model::Element::attribute ( const utils::core::Uuid uuid) const -> std::shared_ptr< const Attribute >
noexcept

Gets the attribute with a specific UUID.

Note
Elements belonging to skills that have not been updated to Xentara 2.0 may not be able to resolve some attributes by UUID.
Parameters
uuidThe UUID of the desired attribute
Returns
A pointer to the corresponding attribute, or nullptr if no attribute with the specified UUID was found.

◆ attribute() [3/3]

auto xentara::model::Element::attribute ( std::string_view  name) const -> std::shared_ptr< const Attribute >
noexcept

Gets the attribute with a specific name.

Parameters
nameThe name of the desired attribute, in UTF-8 encoding
Returns
A pointer to the corresponding attribute, or nullptr if no attribute with the specified name was found.

◆ attributeReadHandle() [1/4]

auto xentara::model::Element::attributeReadHandle ( const Attribute attribute) const -> data::ReadHandle
noexcept

Gets a read handle for a specific attribute.

Parameters
attributeThe desired attribute
Returns
Returns a read handle for the specified attribute. You can check whether the attribute is supported by the object by comparing the returned handle with data::ReadHandle::Error::Unknown.

◆ attributeReadHandle() [2/4]

auto xentara::model::Element::attributeReadHandle ( const Attribute::Role role) const -> data::ReadHandle
noexcept

Gets a read handle for a specific attribute role.

Parameters
roleThe role of the desired attribute
Returns
Returns a read handle for the specified attribute. You can check whether an attribute with the given role was found by comparing the returned handle with data::ReadHandle::Error::Unknown.

◆ attributeReadHandle() [3/4]

auto xentara::model::Element::attributeReadHandle ( const utils::core::Uuid uuid) const -> data::ReadHandle
noexcept

Gets a read handle for the attribute with a specific UUID.

Note
Elements belonging to skills that have not been updated to Xentara 2.0 may not be able to resolve some attributes by UUID.
Parameters
uuidThe UUID of the desired attribute
Returns
Returns a read handle for the specified attribute. You can check whether an attribute with the given UUID was found by comparing the returned handle with data::ReadHandle::Error::Unknown.

◆ attributeReadHandle() [4/4]

auto xentara::model::Element::attributeReadHandle ( std::string_view  name) const -> data::ReadHandle
noexcept

Gets a read handle for the attribute with a specific name.

Parameters
nameThe name of the desired attribute, in UTF-8 encoding
Returns
Returns a read handle for the specified attribute. You can check whether an attribute with the given name was found by comparing the returned handle with data::ReadHandle::Error::Unknown.

◆ attributes()

auto xentara::model::Element::attributes ( ) const -> std::vector< std::shared_ptr< const Attribute > >

Returns a list of all the element’s attributes.

Note
For elements belonging to skills that have not been updated to Xentara 2.0, the returned list may not be complete.

◆ attributeWriteHandle() [1/4]

auto xentara::model::Element::attributeWriteHandle ( const Attribute attribute) -> data::WriteHandle
noexcept

Gets a write handle for a specific attribute.

Parameters
attributeThe desired attribute
Returns
Returns a write handle for the specified attribute. You can check whether the attribute is supported by the object by comparing the returned handle with data::WriteHandle::Error::Unknown.

◆ attributeWriteHandle() [2/4]

auto xentara::model::Element::attributeWriteHandle ( const Attribute::Role role) -> data::WriteHandle
noexcept

Gets a write handle for a specific attribute role.

Parameters
roleThe role of the desired attribute
Returns
Returns a write handle for the specified attribute. You can check whether an attribute with the given role was found by comparing the returned handle with data::WriteHandle::Error::Unknown.

◆ attributeWriteHandle() [3/4]

auto xentara::model::Element::attributeWriteHandle ( const utils::core::Uuid uuid) -> data::WriteHandle
noexcept

Gets a write handle for the attribute with a specific UUID.

Note
Elements belonging to skills that have not been updated to Xentara 2.0 may not be able to resolve some attributes by UUID.
Parameters
uuidThe UUID of the desired attribute
Returns
Returns a write handle for the specified attribute. You can check whether an attribute with the given UUID was found by comparing the returned handle with data::WriteHandle::Error::Unknown.

◆ attributeWriteHandle() [4/4]

auto xentara::model::Element::attributeWriteHandle ( std::string_view  name) -> data::WriteHandle
noexcept

Gets a write handle for the attribute with a specific name.

Parameters
nameThe name of the desired attribute, in UTF-8 encoding
Returns
Returns a write handle for the specified attribute. You can check whether an attribute with the given name was found by comparing the returned handle with data::WriteHandle::Error::Unknown.

◆ category()

auto xentara::model::Element::category ( ) const -> ElementCategory
noexcept

Gets the element category of the element.

Note
The category of some elements may be incorrect before the prepare() phase of the loading process.
Returns
The element category that best describes the element.

◆ checkAccess()

auto xentara::model::Element::checkAccess ( const security::Authorization authorization,
const security::Entitlement entitlement 
) const -> bool

Checks an authorization for a certain entitlement using the ACL for this element.

◆ childElement() [1/2]

auto xentara::model::Element::childElement ( std::string_view  name) const -> std::shared_ptr< const Element >
noexcept

Gets the child element with a specific name.

Note
The complete list of children is only known once the configuration of the element has been loaded.
Parameters
nameThe name of the desired child element, in UTF-8 encoding
Returns
A pointer to the corresponding child element, or nullptr if no child element with the specified name was found.

◆ childElement() [2/2]

auto xentara::model::Element::childElement ( std::string_view  name) -> std::shared_ptr< Element >
noexcept

Gets the child element with a specific name.

Note
The complete list of children is only known once the configuration of the element has been loaded.
Parameters
nameThe name of the desired child element, in UTF-8 encoding
Returns
A pointer to the corresponding child element, or nullptr if no child element with the specified name was found.

◆ childElements() [1/2]

auto xentara::model::Element::childElements ( ) -> std::vector< std::shared_ptr< Element > >

Returns a list of all the element’s children.

Note
The complete list of children is only known once the configuration of the element has been loaded.

◆ childElements() [2/2]

auto xentara::model::Element::childElements ( ) const -> std::vector< std::shared_ptr< const Element > >

Returns a list of all the element’s children.

Note
The complete list of children is only known once the configuration of the element has been loaded.

◆ event() [1/4]

auto xentara::model::Element::event ( const utils::core::Uuid uuid) const -> std::shared_ptr< const process::Event >
noexcept

Gets the event with a specific UUID.

This function only finds free-standing events of type process::Event. It does not find change events for attributes. To include change events for attributes in the search, use extendedEvent() instead.

Note
Elements belonging to skills that have not been updated to Xentara 2.0 may not be able to resolve some events by UUID.
Parameters
uuidThe UUID of the desired event
Returns
A pointer to the corresponding event, or nullptr if no event with the specified UUID was found.

◆ event() [2/4]

auto xentara::model::Element::event ( const utils::core::Uuid uuid) -> std::shared_ptr< process::Event >
noexcept

Gets the event with a specific UUID.

This function only finds free-standing events of type process::Event. It does not find change events for attributes. To include change events for attributes in the search, use extendedEvent() instead.

Note
Elements belonging to skills that have not been updated to Xentara 2.0 may not be able to resolve some events by UUID.
Parameters
uuidThe UUID of the desired event
Returns
A pointer to the corresponding event, or nullptr if no event with the specified UUID was found.

◆ event() [3/4]

auto xentara::model::Element::event ( std::string_view  name) const -> std::shared_ptr< const process::Event >
noexcept

Gets the event with a specific name.

This function only finds free-standing events of type process::Event. It does not find change events for attributes. To include change events for attributes in the search, use extendedEvent() instead.

Parameters
nameThe name of the desired event, in UTF-8 encoding
Returns
A pointer to the corresponding event, or nullptr if no event with the specified name was found.

◆ event() [4/4]

auto xentara::model::Element::event ( std::string_view  name) -> std::shared_ptr< process::Event >
noexcept

Gets the event with a specific name.

This function only finds free-standing events of type process::Event. It does not find change events for attributes. To include change events for attributes in the search, use extendedEvent() instead.

Parameters
nameThe name of the desired event, in UTF-8 encoding
Returns
A pointer to the corresponding event, or nullptr if no event with the specified name was found.

◆ events() [1/2]

auto xentara::model::Element::events ( ) -> std::vector< std::shared_ptr< process::Event > >

Returns a list of all the element’s events.

This function only returns free-standing events of type process::Event. It does not include change events for attributes. You can call attributes() separately to get a list attributes if you need to list the change events as well.

Note
For elements belonging to skills that have not been updated to Xentara 2.0, the returned list may not be complete.

◆ events() [2/2]

auto xentara::model::Element::events ( ) const -> std::vector< std::shared_ptr< const process::Event > >

Returns a list of all the element’s events.

This function only returns free-standing events of type process::Event. It does not include change events for attributes. You can call attributes() separately to get a list attributes if you need to list the change events as well.

Note
For elements belonging to skills that have not been updated to Xentara 2.0, the returned list may not be complete.

◆ extendedEvent() [1/2]

auto xentara::model::Element::extendedEvent ( const utils::core::Uuid uuid) const -> process::ExtendedEvent
noexcept

Gets the event with a specific UUID, including change events for attributes.

This function will find any event with a specific name, including change events for attributes. This distuguished it from event(), which only finds free-standing events of type process::Event.

Note
Elements belonging to skills that have not been updated to Xentara 2.0 may not be able to resolve some events by UUID.
Parameters
uuidThe UUID of the desired event
Returns
A reference to the corresponding event, or a default constructed reference if no event or attribute with the specified UUID was found. You can use the operator bool() to determine whether the returned reference is valid.

◆ extendedEvent() [2/2]

auto xentara::model::Element::extendedEvent ( std::string_view  name) const -> process::ExtendedEvent
noexcept

Gets the event with a specific name, including change events for attributes.

This function will find any event with a specific name, including change events for attributes. This distuguished it from event(), which only finds free-standing events of type process::Event.

Parameters
nameThe name of the desired event, in UTF-8 encoding
Returns
A reference to the corresponding event, or a default constructed reference if no event or attribute with the specified UUID was found. You can use the operator bool() to determine whether the returned reference is valid.

◆ findAttribute()

auto xentara::model::Element::findAttribute ( std::string_view  primaryKey) -> ElementAttribute

Finds the attribute with a specific primary key in the model this element belongs to.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired attribute, in UTF-8 encoding.
Returns
A reference to the corresponding attribute, or a default constructed reference if no attribute with the specified primary key exists. You can use the [operator bool()]ElementAttribute::operator bool()) to check whether the returned reference is valid.

◆ findAttributeVerbose()

auto xentara::model::Element::findAttributeVerbose ( std::string_view  primaryKey) -> utils::eh::expected< ElementAttribute, std::string >

Finds the attribute with a specific primary key in the model this element belongs to, returning an error message on error.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired attribute, in UTF-8 encoding.
Returns
A pointer to the corresponding attribute, or an (English) error message if no attribute with the specified primary key exists.

◆ findElement() [1/4]

auto xentara::model::Element::findElement ( const utils::core::Uuid uuid) -> std::shared_ptr< Element >

Finds the element with a specific UUID in the model this element belongs to.

Note
The complete list of elements is only known once the entire configuration has been loaded.
Parameters
uuidThe UUID of desired element.
Returns
A pointer to the corresponding element, or nullptr if no element with the specified primary key exists.

◆ findElement() [2/4]

auto xentara::model::Element::findElement ( const utils::core::Uuid uuid) const -> std::shared_ptr< const Element >

Finds the element with a specific UUID in the model this element belongs to.

Note
The complete list of elements is only known once the entire configuration has been loaded.
Parameters
uuidThe UUID of desired element.
Returns
A pointer to the corresponding element, or nullptr if no element with the specified primary key exists.

◆ findElement() [3/4]

auto xentara::model::Element::findElement ( std::string_view  primaryKey) -> std::shared_ptr< Element >

Finds the element with a specific primary key in the model this element belongs to.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired element, in UTF-8 encoding.
Returns
A pointer to the corresponding element, or nullptr if no element with the specified primary key exists.

◆ findElement() [4/4]

auto xentara::model::Element::findElement ( std::string_view  primaryKey) const -> std::shared_ptr< const Element >

Finds the element with a specific primary key in the model this element belongs to.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired element, in UTF-8 encoding.
Returns
A pointer to the corresponding element, or nullptr if no element with the specified primary key exists.

◆ findElementVerbose() [1/4]

auto xentara::model::Element::findElementVerbose ( const utils::core::Uuid uuid) -> utils::eh::expected< std::shared_ptr< Element >, std::string >

Finds the element with a specific UUID in the model this element belongs to, returning an error message on error.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
uuidThe UUID of desired element.
Returns
A pointer to the corresponding element, or an (English) error message if no element with the specified primary key exists.

◆ findElementVerbose() [2/4]

auto xentara::model::Element::findElementVerbose ( const utils::core::Uuid uuid) const -> utils::eh::expected< std::shared_ptr< const Element >, std::string >

Finds the element with a specific UUID in the model this element belongs to, returning an error message on error.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
uuidThe UUID of desired element.
Returns
A pointer to the corresponding element, or an (English) error message if no element with the specified primary key exists.

◆ findElementVerbose() [3/4]

auto xentara::model::Element::findElementVerbose ( std::string_view  primaryKey) -> utils::eh::expected< std::shared_ptr< Element >, std::string >

Finds the element with a specific primary key in the model this element belongs to, returning an error message on error.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired element, in UTF-8 encoding.
Returns
A pointer to the corresponding element, or an (English) error message if no element with the specified primary key exists.

◆ findElementVerbose() [4/4]

auto xentara::model::Element::findElementVerbose ( std::string_view  primaryKey) const -> utils::eh::expected< std::shared_ptr< const Element >, std::string >

Finds the element with a specific primary key in the model this element belongs to, returning an error message on error.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired element, in UTF-8 encoding.
Returns
A pointer to the corresponding element, or an (English) error message if no element with the specified primary key exists.

◆ findEvent() [1/2]

auto xentara::model::Element::findEvent ( std::string_view  primaryKey) -> std::shared_ptr< process::Event >

Finds the event with a specific primary key in the model this element belongs to.

This function only finds free-standing events of type process::Event. It does not find change events for attributes. To include change events for attributes in the search, use findExtendedEvent() instead.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired event, in UTF-8 encoding.
Returns
A pointer to the corresponding event, or nullptr if no event with the specified primary key exists.

◆ findEvent() [2/2]

auto xentara::model::Element::findEvent ( std::string_view  primaryKey) const -> std::shared_ptr< const process::Event >

Finds the event with a specific primary key in the model this element belongs to.

This function only finds free-standing events of type process::Event. It does not find change events for attributes. To include change events for attributes in the search, use findExtendedEvent() instead.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired event, in UTF-8 encoding.
Returns
A pointer to the corresponding event, or nullptr if no event with the specified primary key exists.

◆ findEventVerbose() [1/2]

auto xentara::model::Element::findEventVerbose ( std::string_view  primaryKey) -> utils::eh::expected< std::shared_ptr< process::Event >, std::string >

Finds the event with a specific primary key in the model this element belongs to, returning an error message on error.

This function only finds free-standing events of type process::Event. It does not find change events for attributes. To include change events for attributes in the search, use findExtendedEvent() instead.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired event, in UTF-8 encoding.
Returns
A pointer to the corresponding event, or an (English) error message if no event with the specified primary key exists.

◆ findEventVerbose() [2/2]

auto xentara::model::Element::findEventVerbose ( std::string_view  primaryKey) const -> utils::eh::expected< std::shared_ptr< const process::Event >, std::string >

Finds the event with a specific primary key in the model this element belongs to, returning an error message on error.

This function only finds free-standing events of type process::Event. It does not find change events for attributes. To include change events for attributes in the search, use findExtendedEvent() instead.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired event, in UTF-8 encoding.
Returns
A pointer to the corresponding event, or an (English) error message if no event with the specified primary key exists.

◆ findExtendedEvent()

auto xentara::model::Element::findExtendedEvent ( std::string_view  primaryKey) const -> process::ExtendedEvent

Finds the extended event with a specific primary key in the model this element belongs to.

This function will find any event with a specific name, including change events for attributes. This distuguished it from findEvent(), which only finds free-standing events of type process::Event.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired event, in UTF-8 encoding.
Returns
A reference to the corresponding event, or a default constructed reference if no event or attribute with the specified UUID was found. You can use the operator bool() to determine whether the returned reference is valid.

◆ findExtendedEventVerbose()

auto xentara::model::Element::findExtendedEventVerbose ( std::string_view  primaryKey) const -> utils::eh::expected< process::ExtendedEvent, std::string >

Finds the extended event with a specific primary key in the model this element belongs to, returning an error message on error.

This function will find any event with a specific name, including change events for attributes. This distuguished it from findEventVerbose(), which only finds free-standing events of type process::Event.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired event, in UTF-8 encoding.
Returns
A reference to the corresponding event, or a default constructed reference if no event or attribute with the specified UUID was found. You can use the operator bool() to determine whether the returned reference is valid.

◆ findTask() [1/2]

auto xentara::model::Element::findTask ( std::string_view  primaryKey) -> std::shared_ptr< process::Task >

Finds the task with a specific primary key in the model this element belongs to.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired task, in UTF-8 encoding.
Returns
A pointer to the corresponding task, or nullptr if no task with the specified primary key exists.

◆ findTask() [2/2]

auto xentara::model::Element::findTask ( std::string_view  primaryKey) const -> std::shared_ptr< const process::Task >

Finds the task with a specific primary key in the model this element belongs to.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired task, in UTF-8 encoding.
Returns
A pointer to the corresponding task, or nullptr if no task with the specified primary key exists.

◆ findTaskVerbose() [1/2]

auto xentara::model::Element::findTaskVerbose ( std::string_view  primaryKey) -> utils::eh::expected< std::shared_ptr< process::Task >, std::string >

Finds the task with a specific primary key in the model this element belongs to, returning an error message on error.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired task, in UTF-8 encoding.
Returns
A pointer to the corresponding task, or an (English) error message if no task with the specified primary key exists.

◆ findTaskVerbose() [2/2]

auto xentara::model::Element::findTaskVerbose ( std::string_view  primaryKey) const -> utils::eh::expected< std::shared_ptr< const process::Task >, std::string >

Finds the task with a specific primary key in the model this element belongs to, returning an error message on error.

Note
The full hierarchy of elements is only known once the entire configuration has been loaded.
Parameters
primaryKeyThe primary key of desired task, in UTF-8 encoding.
Returns
A pointer to the corresponding task, or an (English) error message if no task with the specified primary key exists.

◆ forEachAttribute()

template<std::invocable< const std::shared_ptr< const model::Attribute > & > Callback>
auto xentara::model::Element::forEachAttribute ( Callback &&  callback) const -> bool

Iterates over all the element’s attributes.

This function takes a callback that will be called once for each attribute the element supports, in no particular order.

If the callback returns a value that can be converted to bool, then the return value is used to determine whether the iteration should be terminated early. If the callback returns a value that evaluates to true, then the iteration is stopped and the callback is not called again. If the return value evaluates to false, then iteration continues as normal.

Parameters
callbackThe callback that should be called for each attribute.
Returns
If callable returns a value convertible to bool, then the function returns true if the callable returned true for any attribute. Otherwise, false is returned.

◆ forEachChildElement() [1/2]

template<std::invocable< const std::shared_ptr< Element > & > Callback>
auto xentara::model::Element::forEachChildElement ( Callback &&  callback) -> bool

Iterates over all the child elements.

This function takes a callback that will be called once for each child element, in no particular order. The callback will be passed the UUID and the name of the task, as well as a pointer to the task itself.

If the callback returns a value that can be converted to bool, then the return value is used to determine whether the iteration should be terminated early. If the callback returns a value that evaluates to true, then the iteration is stopped and the callback is not called again. If the return value evaluates to false, then iteration continues as normal.

Parameters
callbackThe callback that should be called for each child element.
Returns
If callback returns a value convertible to bool, then the function returns true if the callback returned true for any element. Otherwise, false is returned.

◆ forEachChildElement() [2/2]

template<std::invocable< const std::shared_ptr< const Element > & > Callback>
auto xentara::model::Element::forEachChildElement ( Callback &&  callback) const -> bool

Iterates over all the child elements.

This function takes a callback that will be called once for each child element, in no particular order. The callback will be passed the UUID and the name of the task, as well as a pointer to the task itself.

If the callback returns a value that can be converted to bool, then the return value is used to determine whether the iteration should be terminated early. If the callback returns a value that evaluates to true, then the iteration is stopped and the callback is not called again. If the return value evaluates to false, then iteration continues as normal.

Parameters
callbackThe callback that should be called for each child element.
Returns
If callback returns a value convertible to bool, then the function returns true if the callback returned true for any element. Otherwise, false is returned.

◆ forEachEvent() [1/2]

template<std::invocable< const utils::core::Uuid &, std::string_view, const std::shared_ptr< process::Event > & > Callback>
auto xentara::model::Element::forEachEvent ( Callback &&  callback) -> bool

Iterates over all the element’s events.

This function takes a callback that will be called once for each event the element supports, in no particular order. The callable will be passed the UUID and the name of the event, as well as a pointer to the event itself.

If the callback returns a value that can be converted to bool, then the return value is used to determine whether the iteration should be terminated early. If the callback returns a value that evaluates to true, then the iteration is stopped and the callback is not called again. If the return value evaluates to false, then iteration continues as normal.

This function only iterates over free-standing events of type process::Event. It does not include change events for attributes. You can call forEachAttribute() separately if you need to iterate over the the attribute change events as well.

Parameters
callbackThe callback that should be called for each event.
Returns
If callback returns a value convertible to bool, then the function returns true if the callback returned true for any event. Otherwise, false is returned.

◆ forEachEvent() [2/2]

template<std::invocable< const utils::core::Uuid &, std::string_view, const std::shared_ptr< const process::Event > & > Callback>
auto xentara::model::Element::forEachEvent ( Callback &&  callback) const -> bool

Iterates over all the element’s events.

This function takes a callback that will be called once for each event the element supports, in no particular order. The callable will be passed the UUID and the name of the event, as well as a pointer to the event itself.

If the callback returns a value that can be converted to bool, then the return value is used to determine whether the iteration should be terminated early. If the callback returns a value that evaluates to true, then the iteration is stopped and the callback is not called again. If the return value evaluates to false, then iteration continues as normal.

This function only iterates over free-standing events of type process::Event. It does not include change events for attributes. You can call forEachAttribute() separately if you need to iterate over the the attribute change events as well.

Parameters
callbackThe callback that should be called for each event.
Returns
If callback returns a value convertible to bool, then the function returns true if the callback returned true for any event. Otherwise, false is returned.

◆ forEachTask() [1/2]

template<std::invocable< const utils::core::Uuid &, std::string_view, const std::shared_ptr< process::Task > & > Callback>
auto xentara::model::Element::forEachTask ( Callback &&  callback) -> bool

Iterates over all the element’s tasks.

This function takes a callback that will be called once for each event the element supports, in no particular order. The callback will be passed the UUID and the name of the event, as well as a pointer to the event itself.

If the callback returns a value that can be converted to bool, then the return value is used to determine whether the iteration should be terminated early. If the callback returns a value that evaluates to true, then the iteration is stopped and the callback is not called again. If the return value evaluates to false, then iteration continues as normal.

Parameters
callbackThe callback that should be called for each event.
Returns
If callback returns a value convertible to bool, then the function returns true if the callback returned true for any event. Otherwise, false is returned.

◆ forEachTask() [2/2]

template<std::invocable< const utils::core::Uuid &, std::string_view, const std::shared_ptr< const process::Task > & > Callback>
auto xentara::model::Element::forEachTask ( Callback &&  callback) const -> bool

Iterates over all the element’s tasks.

This function takes a callback that will be called once for each event the element supports, in no particular order. The callback will be passed the UUID and the name of the event, as well as a pointer to the event itself.

If the callback returns a value that can be converted to bool, then the return value is used to determine whether the iteration should be terminated early. If the callback returns a value that evaluates to true, then the iteration is stopped and the callback is not called again. If the return value evaluates to false, then iteration continues as normal.

Parameters
callbackThe callback that should be called for each event.
Returns
If callback returns a value convertible to bool, then the function returns true if the callback returned true for any event. Otherwise, false is returned.

◆ name()

auto xentara::model::Element::name ( ) const -> utils::string::StringView
noexcept

Gets the name of the element.

Note
The name is only known once the configuration of the element has been loaded.
Attention
The returned string view will remain valid only as long as the object is valid. If you are accessing the primary key through a shared pointer, you must not access the returned string view after destroying the pointer, as that may detroy the object. If you need to access the string after the shared pointer has been destroyed, you must first make a copy of it.
Returns
The name of the element, in UTF-8 encoding. For the invisible root element of the model (which has no name), an empty string is returned.

◆ parentElement() [1/2]

auto xentara::model::Element::parentElement ( ) -> std::shared_ptr< Element >

Returns the element’s parent.

Returns
The elemnt’s parent element, or nullptr if the element is the invisible root element. For top-level elements, the invisible root element is returned as parent element.
See also
rootElement()

◆ parentElement() [2/2]

auto xentara::model::Element::parentElement ( ) const -> std::shared_ptr< const Element >

Returns the element’s parent.

Returns
The elemnt’s parent element, or nullptr if the element is the invisible root element. For top-level elements, the invisible root element is returned as parent element.
See also
rootElement()

◆ primaryKey()

auto xentara::model::Element::primaryKey ( ) const -> utils::string::StringView
noexcept

Gets the primary key of the element.

Note
The primary key is only fully known once the entire configuration has been loaded.
Attention
The returned string view will remain valid only as long as the object is valid. If you are accessing the primary key through a shared pointer, you must not access the returned string view after destroying the pointer, as that may detroy the object. If you need to access the string after the shared pointer has been destroyed, you must first make a copy of it.
Returns
The primary key of the element, in UTF-8 encoding. For the invisible root element of the model (which has no primary key), an empty string is returned.

◆ rootElement() [1/2]

auto xentara::model::Element::rootElement ( ) -> std::shared_ptr< Element >

Returns the invisible root element of the model this element belongs to.

The invisible root element is the parent element of all top-level elements in the model. It does not have a name, a primary key, attributes, events, or tasks. The only thing the invisible root element can be used for is accessing its children using childElements() or forEachChildElement(), and getting its uuid().

Returns
The invisible root element of the model.

◆ rootElement() [2/2]

auto xentara::model::Element::rootElement ( ) const -> std::shared_ptr< const Element >

Returns the invisible root element of the model this element belongs to.

The invisible root element is the parent element of all top-level elements in the model. It does not have a name, a primary key, attributes, events, or tasks. The only thing the invisible root element can be used for is accessing its children using childElements() or forEachChildElement(), and getting its uuid().

Returns
The invisible root element of the model.

◆ subElementPrimaryKey()

auto xentara::model::Element::subElementPrimaryKey ( std::string_view  subElementName) const -> std::string

Gets the primary key of a sub element (attribute, event, task, or child element)

Note
The primary key is only fully known once the entire configuration has been loaded.
Parameters
subElementNameThe name of the sub element, in UTF-8 encoding.
Returns
The full primary key of the sub element, in UTF-8 encoding. If this element is the invisible root element of the model, subElementName is returned as-is.

◆ task() [1/4]

auto xentara::model::Element::task ( const utils::core::Uuid uuid) const -> std::shared_ptr< const process::Task >
noexcept

Gets the task with a specific UUID.

Note
Elements belonging to skills that have not been updated to Xentara 2.0 may not be able to resolve some tasks by UUID.
Parameters
uuidThe UUID of the desired task
Returns
A pointer to the corresponding task, or nullptr if no task with the specified UUID was found.

◆ task() [2/4]

auto xentara::model::Element::task ( const utils::core::Uuid uuid) -> std::shared_ptr< process::Task >
noexcept

Gets the task with a specific UUID.

Note
Elements belonging to skills that have not been updated to Xentara 2.0 may not be able to resolve some tasks by UUID.
Parameters
uuidThe UUID of the desired task
Returns
A pointer to the corresponding task, or nullptr if no task with the specified UUID was found.

◆ task() [3/4]

auto xentara::model::Element::task ( std::string_view  name) const -> std::shared_ptr< const process::Task >
noexcept

Gets the task with a specific name.

Parameters
nameThe name of the desired task, in UTF-8 encoding
Returns
A pointer to the corresponding task, or nullptr if no task with the specified name was found.

◆ task() [4/4]

auto xentara::model::Element::task ( std::string_view  name) -> std::shared_ptr< process::Task >
noexcept

Gets the task with a specific name.

Parameters
nameThe name of the desired task, in UTF-8 encoding
Returns
A pointer to the corresponding task, or nullptr if no task with the specified name was found.

◆ tasks() [1/2]

auto xentara::model::Element::tasks ( ) -> std::vector< std::shared_ptr< process::Task > >

Returns a list of all the element’s tasks.

Note
For elements belonging to skills that have not been updated to Xentara 2.0, the returned list may not be complete.

◆ tasks() [2/2]

auto xentara::model::Element::tasks ( ) const -> std::vector< std::shared_ptr< const process::Task > >

Returns a list of all the element’s tasks.

Note
For elements belonging to skills that have not been updated to Xentara 2.0, the returned list may not be complete.

◆ type()

auto xentara::model::Element::type ( ) const -> std::string_view
noexcept

Gets the type of the element.

Returns
The type of this element, in UTF-8 encoding.

◆ uuid()

auto xentara::model::Element::uuid ( ) const -> utils::core::Uuid
noexcept

Gets the UUID of the element.

Note
The UUID is only known once the configuration of the element has been loaded.
Returns
The UUID of the element.