xentara-plugin v1.2
The Xentara Plugin Framework
|
Common interface shared by all plugin element classes. More...
Classes | |
class | FallbackConfigHandler |
Called by the framework to resolve an attribute with a specific name. More... | |
Public Member Functions | |
auto | name() const -> std::string_view |
Gets the name of the element. More... | |
auto | primaryKey() const -> std::string_view |
Gets the primary key of the element. More... | |
auto | uuid() const -> xentara::utils::core::Uuid |
Gets the UUID of the element. More... | |
virtual auto | resolveAttribute (std::string_view name) -> const xentara::model::Attribute * |
Called by the framework to resolve an attribute with a specific name. More... | |
virtual auto | resolveTask (std::string_view name) -> std::shared_ptr< xentara::process::Task > |
Called by the framework to resolve a task with a specific name. More... | |
virtual auto | resolveEvent (std::string_view name) -> std::shared_ptr< xentara::process::Event > |
Called by the framework to resolve an event with a specific name. More... | |
virtual auto | readHandle (const xentara::model::Attribute &attribute) const noexcept -> xentara::data::ReadHandle |
Called by the framework to get a read handle for a specific attribute. More... | |
virtual auto | writeHandle (const xentara::model::Attribute &attribute) const noexcept -> xentara::data::WriteHandle |
Called by the framework to get a write handle for a specific attribute. More... | |
Protected Types | |
using | ConfigIntializer = xentara::memory::Initializer<xentara::memory::Array> |
Type alias for an initializer for the configuration. More... | |
Protected Member Functions | |
virtual auto | loadConfig (const ConfigIntializer &initializer, xentara::utils::json::decoder::Object &jsonObject, xentara::config::Resolver &resolver, const FallbackConfigHandler &fallbackHandler) -> void |
Called by the framework to load the element's configuration from a JSON object. More... | |
virtual auto | realize () -> void |
Called by the framework once all references have been resolved. More... | |
virtual auto | prepare () -> void |
Called by the framework to prepare the element for operation. More... | |
virtual auto | cleanup () -> void |
Called by the framework to cleanup the element after operation. More... | |
auto | configBlock () const noexcept -> const xentara::memory::ArrayBlock & |
Gets the memory block that the configuration is stored in. More... | |
Common interface shared by all plugin element classes.
This documentation describes the common interface shared by all plugin element classes. See the individual classes for more detailed information.
| protected |
Type alias for an initializer for the configuration.
| protectednoexcept |
Gets the memory block that the configuration is stored in.
| protectedvirtual |
Called by the framework to load the element's configuration from a JSON object.
initializer | An initializer object for the memory block that contains the configuration. Use this object to access the storage for any configuration attributes you added to the config() array in the element class. |
jsonObject | The JSON object |
resolver | An object that allows you to resolve cross references |
fallbackHandler | An object that handles config parameters unknown to the sub class. You should call the function call operator of this object for any config parameters you do not recognize. |
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
auto Element::name | ( | ) | const -> std::string |
Gets the name of the element.
| protectedvirtual |
Called by the framework to prepare the element for operation.
This method is called by the framework after all objects have been realized, but before any processing is done. It allows you to prepare the object for operation. This is the place where read and write handles for attributes should be fetched, for example.
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
| protectedvirtual |
Called by the framework to cleanup the element after operation
This method is called by the framework after Xentara has completely shut down.
auto Element::primaryKey | ( | ) | const -> std::string |
Gets the primary key of the element.
| virtualnoexcept |
Called by the framework to get a read handle for a specific attribute.
The implementation for this method must return a read handle for the given attribute's value.
attribute | The desired attribute. This will never be one of the standard configuration attributes, as these are handled automatically by the framework. |
| virtualnoexcept |
Called by the framework to get a write handle for a specific attribute.
The implementation for this method must return a write handle for the given attribute's value.
attribute | The desired attribute. This will never be one of the standard configuration attributes, as these are handled automatically by the framework. |
| protectedvirtual |
Called by the framework once all references have been resolved.
This method is called by the framework after the configuration has been completely loaded and all references have been resolved, but before the objects are prepared for processing. Use this function to perform initialization that requires access to the objects you submitted to the resolver in loadConfig().
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
| virtual |
Called by the framework to resolve an attribute with a specific name
The implementation for this method must return a reference to the attribute with the given name, if the element supports it.
Attributes are always resolved after Xentara model elements. This means that when this function is called, all references to Xentara model elements you submitted in loadConfig() have already been resolved.
name | The name of the desired attribute, in UTF-8 encoding. This will never be one of the standard configuration attributes, as these are resolved automatically by the framework. |
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
| virtual |
Called by the framework to resolve an event with a specific name.
The implementation for this method must return a pointer to the event with the given name. You can either create the event on demand from within this function, or return a pointer to an existing event.
If the event you which to return is not a shared object itself, but a regular member of the element, you can derive your element class from xentara::plugin::EnableSharedFromThis and use the aliasing constructor (8) of std::shared_ptr together with sharedFromThis():
Events are always resolved after Xentara model elements. This means that when this function is called, all references to Xentara model elements you submitted in loadConfig() have already been resolved.
name | The name of the desired event, in UTF-8 encoding |
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
| virtual |
Called by the framework to resolve a task with a specific name.
The implementation for this method must return a pointer to the task with the given name. You can either create the task on demand from within this function, or return a pointer to an existing task.
If the task you which to return is not a shared object itself, but a regular member of the element, you can derive your element class from xentara::plugin::EnableSharedFromThis and use the aliasing constructor (8) of std::shared_ptr together with sharedFromThis():
Events are always resolved after Xentara model elements. This means that when this function is called, all references to Xentara model elements you submitted in loadConfig() have already been resolved.
name | The name of the desired task, in UTF-8 encoding |
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
auto Element::uuid | ( | ) | const -> xentara::utils::core::Uuid |
Gets the uuid of the element.