CamiTK Action API Change: use external files to describe action and parameters
As a | CEP developer |
I would like to | quickly change the description and parameters of my actions |
So that | I can get a prototype faster |
Epic/Topics | CamiTK API Change |
As a | CamiTK developer |
I would like to | easily list available action and allow for duplex feature in the wizard |
So that | I can simplify CamiTK and decrease the learning curve |
Epic/Topics | CamiTK API Change |
Description / Overview
This story describes the motivation and how to use external file to define Action description and parameters
Rationale
Instead of defining the Action description (name, family...) and parameters (using CamiTK Property
) using hard-coded C++ lines in the constructor, the description and parameters should be externally defined in two separate .json
or .xml
files.
Implementation
In the Action
constructor, one only have to write this:
MyAction::MyAction(..) : ... {
loadDescription(); // load file MyAction.json or MyAction.xml
loadProperties(); // load file MyActionProperties.json or MyActionProperties.xml
MyAction.json
or MyAction.xml
Description in - action name
- description
- target component
- etc..
MyActionProperties.json
or MyActionProperties.xml
Properties in Properties/parameters should be described in a separate file as the same mechanism can be used for Components!
All the properties are described in a separate MyActionProperties.json
(or MyActionProperties.xml
), including all supported restriction: min/max value, steps, readOnly etc...
Automatic code generation
At compile time, cmake can easily parse the file (or we can build a kind of camitk-moc
that read the .json
or .xml
file), and automatically generate a MyActionExtra.cpp
containing:
MyAction::loadDescription() {
setName(..);
setFamily(...);
...
}
MyAction::loadProperties() {
Property *prop = new Property(...);
...
addParameter(prop);
prop = new Property(...);
...
}
.cep
Reuse in catalog, wizard and Reading these files is a much easier task than loading the action dll and explore the description and properties with introspection. This can therefore simplify the following tasks:
- publishing the catalog
- creating a "camitk-wizard-update" to update using the description or properties using a GUI wizard
- creating/publishing
.cep
and manifest files for.cep
Other uses
This type of file should be use to describe extensions (ActionExtension
and ComponentExtension
) as well as CEP.