xentara-plugin v1.2.1
The Xentara Plugin Framework
|
An I/O batch in a Xentara system. More...
#include <io/IoBatch.hpp>
Classes | |
class | FallbackConfigHandler |
A helper object used to handle config parameters unknown to the sub class. More... | |
Public Member Functions | |
virtual internal | ~IoBatch ()=0 |
Virtual destructor. | |
auto | name () const -> std::string |
Gets the name of the I/O batch. | |
auto | primaryKey () const -> std::string |
Gets the primary key of the I/O batch. | |
auto | uuid () const -> utils::core::Uuid |
Gets the UUID of the I/O batch. | |
virtual auto | resolveAttribute (std::string_view name) -> const model::Attribute * |
Called by the framework to resolve an attribute with a specific name. | |
virtual auto | resolveTask (std::string_view name) -> std::shared_ptr< process::Task > |
Called by the framework to resolve a task with a specific name. | |
virtual auto | resolveEvent (std::string_view name) -> std::shared_ptr< process::Event > |
Called by the framework to resolve an event with a specific name. | |
virtual auto | readHandle (const model::Attribute &attribute) const noexcept -> data::ReadHandle |
Called by the framework to get a read handle for a specific attribute. | |
virtual auto | writeHandle (const model::Attribute &attribute) noexcept -> data::WriteHandle |
Called by the framework to get a write handle for a specific attribute. | |
Public Member Functions inherited from xentara::utils::tools::DisableCopy | |
constexpr | DisableCopy () noexcept=default |
DisableCopy (const DisableCopy &)=delete | |
DisableCopy & | operator= (const DisableCopy &)=delete |
Protected Types | |
using | ConfigIntializer = memory::Initializer< memory::Array > |
Type alias for an initializer for the configuration. | |
Protected Member Functions | |
virtual auto | loadConfig (const ConfigIntializer &initializer, utils::json::decoder::Object &jsonObject, config::Resolver &resolver, const FallbackConfigHandler &fallbackHandler) -> void=0 |
Called by the framework to load the I/o batch's configuration from a JSON object. | |
virtual auto | realize () -> void |
Called by the framework once all references have been resolved. | |
virtual auto | prepare () -> void |
Called by the framework to prepare the I/O batch for operation. | |
virtual auto | cleanup () -> void |
Called by the framework to cleanup the I/O batch after operation. | |
auto | configBlock () const noexcept -> const memory::ArrayBlock & |
Gets the memory block that the configuration is stored in. | |
An I/O batch in a Xentara system.
I/O batches are used to group together I/O points that have common attributes, or that are handled together as a unit. Examples include database queries, polls, transactions, etc.
|
protected |
Type alias for an initializer for the configuration.
|
pure virtualdefault |
Virtual destructor.
|
protectedvirtual |
Called by the framework to cleanup the I/O batch after operation.
This method is called by the framework after Xentara has completely shut down.
|
protectednoexcept |
Gets the memory block that the configuration is stored in.
|
protectedpure virtual |
Called by the framework to load the I/o batch'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 I/O batch 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 xentara::io::IoBatch::name | ( | ) | const -> std::string |
Gets the name of the I/O batch.
|
protectedvirtual |
Called by the framework to prepare the I/O batch 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 |
auto xentara::io::IoBatch::primaryKey | ( | ) | const -> std::string |
Gets the primary key of the I/O batch.
|
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. |
|
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 I/O batch 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 I/O batch, you can derive your I/O batch 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 I/O batch, you can derive your I/O batch class from xentara::plugin::EnableSharedFromThis and use the aliasing constructor (8) of std::shared_ptr together with sharedFromThis():
Tasks 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 xentara::io::IoBatch::uuid | ( | ) | const -> utils::core::Uuid |
Gets the UUID of the I/O batch.
|
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. |