|
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 component's configuration from a JSON object.
|
|
virtual auto | realize () -> void |
| Called by the framework once all references have been resolved.
|
|
virtual auto | postRealize () -> void |
| Called by the framework after all I/O points and sub components have been realized.
|
|
virtual auto | prepare () -> void |
| Called by the framework to prepare the component for operation.
|
|
virtual auto | postPrepare () -> void |
| Called by the framework after all I/O points and sub components have been prepared.
|
|
virtual auto | preCleanup () -> void |
| Called by the framework before the I/O points and sub components are cleaned up.
|
|
virtual auto | cleanup () -> void |
| Called by the framework to clean up the component after operation.
|
|
auto | configBlock () const noexcept -> const memory::ArrayBlock & |
| Gets the memory block that the configuration is stored in.
|
|
An I/O component in a Xentara system.
An I/O component is a physical or logical component of the I/O system controlled by the driver. The components form a hierarchy that ultimately contains all of the [I/O points](xentara::io::Io). Examples for components include devices, boards, controllers, modules, etc.
- See also
- I/O Components
-
I/O Components in the Xentara user manual
Called by the framework to create a new I/O point for this component.
The implementation for this method must use the given factory to create a new I/O point of the given I/O point class:
return factory.makeShared<MyIo>();
If your driver requires access to the I/O point later (for example, to poll or service it), you must store an std::weak_ptr to it somewhere.
The framework will call loadConfig() on the newly created I/O point.
- Default Implementation
- The default implementation returns nullptr, denoting that the component does not support I/O points directly.
- Parameters
-
ioClass | The class for the new I/O point |
factory | The factory that must be used to create the I/O point |
- Returns
- The newly created I/O point, or nullptr if the component does not support I/O points of the given class directly
- Exceptions
-
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
- See also
- Creating Plugin Element Objects
Called by the framework to create a new I/O batch for this component.
The implementation for this method must use the given factory to create a new I/O batch of the given I/O batch class:
return factory.makeShared<MyIoBatch>();
If your driver requires access to the I/O batch later (for example, to poll or service it), you must store an std::weak_ptr to it somewhere.
The framework will call loadConfig() on the newly created I/O batch.
- Default Implementation
- The default implementation returns nullptr, denoting that the component does not support embedded I/O batches.
- Parameters
-
ioBatchClass | The class for the new I/O batch |
factory | The factory that must be used to create the I/O batch |
- Returns
- The newly created I/O batch, or nullptr if the component does not support embedded I/O batches of the given class
- Exceptions
-
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
- See also
- Creating Plugin Element Objects
Called by the framework to create a new sub component of this component.
The implementation for this method must use the given factory to create a new component of the given component class:
return factory.makeShared<MySubComponent>();
If your driver requires access to the sub component later (for example, to poll or service it), you must store an std::weak_ptr to it somewhere.
The framework will call loadConfig() on the newly created component.
- Default Implementation
- The default implementation returns nullptr, denoting that the component does not support sub components.
- Parameters
-
componentClass | The class for the new component |
factory | The factory that must be used to create the component |
- Returns
- The newly created component, or nullptr if the component does not support sub components of the given class
- Exceptions
-
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
- See also
- Creating Plugin Element Objects
virtual auto xentara::io::Component::prepare |
( |
| ) |
-> void |
|
protectedvirtual |
Called by the framework to prepare the component 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.
This method is called before the prepare() method of any I/O points or sub components. You can override postPrepare() if you need to perform actions after all I/O points and sub components have been prepared.
- Exceptions
-
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
- Default Implementation
- The default implementation does nothing.
- See also
- Loading Element Configs
virtual auto xentara::io::Component::realize |
( |
| ) |
-> void |
|
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().
This method is called before the realize() method of any I/O points or sub components. You can override postRealize() if you need to perform actions after all I/O points and sub components have been realized.
- Exceptions
-
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
- Default Implementation
- The default implementation does nothing.
- See also
- Loading Element Configs
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 component, you can derive your component 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.
- Default Implementation
- The default implementation returns nullptr, denoting that the component does not provide an event with the given name.
- Parameters
-
name | The name of the desired event, in UTF-8 encoding |
- Returns
- A pointer to the event, or nullptr if the component does not provide an event with the given name
- Exceptions
-
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
- See also
- Publishing Events
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 component, you can derive your component 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.
- Default Implementation
- The default implementation returns nullptr, denoting that the component does not provide a task with the given name.
- Parameters
-
name | The name of the desired task, in UTF-8 encoding |
- Returns
- A pointer to the task, or nullptr if the component does not provide a task with the given name
- Exceptions
-
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
- See also
- Publishing Tasks