A Xentara skill.
More...
#include <xentara/skill/Skill.hpp>
◆ ~Skill()
xentara::skill::Skill::~Skill |
( |
| ) |
|
|
pure virtualdefault |
◆ createElement()
Called by the framework to create a new top-level element.
This function is called to create elements that are not children of any other elements belonging to the same skill. To create an element that is the child of another skill element, Element::createChildElement() is called instead.
The implementation for this method must use the given factory to create a new element of the given element class:
return factory.makeShared<MyElement>();
If your skill requires access to the element later, you must store a pointer or reference to it.
The framework will call load() on the newly created element.
- Parameters
-
elementClass | The class for the new element |
factory | The factory that must be used to create the element |
- Returns
- The newly created element, or nullptr if the skill does not support top-level elements 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 Skill Element Objects
Implemented in xentara::io::Driver::Environment, and xentara::process::ServiceProvider::Environment.
◆ loadConfig()
Called by the framework to load the skill’s configuration from a JSON object.
This callback is called if the Xentara configuration file contains a section for this skill.
If there is no section for this skill in the Xentara configuration file, this function is never called. The skill should generally provide default values for all configuration parameters, but if a default value is not possible, then the skill must handle that situation gracefully. This means that no exception must be thrown if no skill element belonging to this skill is created. Otherwise, the mere presence of the skill plugin on the system will force the user to configure the skill, even if it is not used. Generally, the first skill element that needs the configuration should throw an error if it is missing, not the skill itself.
- Default Implementation
- The default implementation throws an error denoting that the skill does not have any configurable parameters.
- Parameters
-
jsonObject | The JSON object |
context | A context that can be used to find external configurations. The context cannot be used to resolve cross-references or create synthetic children, as that only makes sense when loading the Xentara model file. |
- Exceptions
-
std::runtime_error | The function must throw this exception (or a suitable subclass) if an error occurs |
◆ persistentDataPath()
Makes a path suitable for storing persistent data for a skill.
- Parameters
-
skillSubdirectory | The skill subdirectory. This should generally be the skill name without any “Xentara” prefix, in all lowercase, with dashes as word separator. The skill subdirectory for the Xentara EtherCAT Driver, for example, should be “xentara-ethercat-driver”. |
subPath | The sub path beneath the skill subdirectory. |
- Returns
- The absolute path to use to store the data.