![]() |
flux sdk
v01.02.02-3-g292b3a7
Embedded C++ SDK
|
Parameters represent the method to read or pass in a specific data value to an operation object withing the SDK. Parameters can be thought of as the data values passed into or returned from a function call. Parameter objects provide a means to support dynamically discoverable input and output data for a particular operation within the framework.
There are two types of Parameter objects with the framework: Input Parameters ("functions") and Output Parameters
The following are key attributes of parameters within the framework
The following types are available for properties
Setting an value of a Input Parameter - named input
in this example:
Getting a value of an Output Parameter - named output
in this example:
For the framework, two types of Parameter classes exist.
The get and set operations on a parameter are mapped to methods implemented by the containing class.
These parameter objects are used to define a input parameter to an operation. Besides allowing introspection at runtime, they also pass on the provided value to a method.
Within the definition of the class the parameter is for, the input parameter is defined using the following pattern:
Where:
& operator
, to the writer is providedThese methods are implemented on the containing class and are called when the value of a parameter is set. These methods have the following signature:
Where:
By convention, writer method names are prefixed by
write_
* By convention declaring the input writer method as private. This can be optional
- The writer method must be declared before defining the parameter
- The use of the
write_
prefix on the writer methods help identify the methods as supporting a parameter.
Data limits define restrictions on the values the input parameter accepts. There are two types of data limits: range and valid value sets.
Data Range
This represents the minimum and maximum values a input parameter will accept. The values can be specified at parameter definition and also set at runtime.
To set the range at parameter definition, just set the declared parameter to the range using a cpp initializer list { min, max}
Additionally, the method clearDataLimit()
can be called to delete the current limit.
Using the example from above:
To set/change the range value at runtime, the method setDataLimitRange(min, max)
is called on the input parameter object.
Using the example parameter from above:
This changes the data range accepted by the input parameter and deletes any existing data limit.
Data Valid Value Set
This represents data limit provides a defined set of valid values for the input parameter. The limit is defined by a set of name,value pairs that enable a human readable presentation for the values a input parameter will accept. The values can be specified at parameter definition and also set at runtime.
To set the valid values at parameter definition, just set the declared parameter to the range using a cpp initializer list of name value pairs:
Using the example from above:
To set/change the range value at runtime, the method addDataLimitValidValue()
is called on the input parameter object. This object has two calling sequences:
Additionally, the method clearDataLimit()
can be called to delete the current limit
Using the example parameter from above:
Or for an entire parameter list:
The values are added to the current valid value list. If a ValidValue data limit was not it i place when called, the current limit is deleted and a valid value limit is put in place.
These parameter objects are used to define a output parameter to an operation. Besides allowing introspection at runtime, they also retrieve the desired value from a method.
Within the definition of the class the parameter is for, the output parameter is defined using the following pattern:
Where:
& operator
, to the reader is providedThese methods are implemented on the containing class and are called when the value of a parameter is requested. These methods have the following signature:
Where:
[!note]
By convention, reader method names are prefixed by
read_
* By convention declaring the output reader method as private. This can be optional
- The reader method must be declared before defining the parameter
- The use of the
read_
prefix on the writer methods help identify the methods as supporting a parameter.
For outputs that have array values, an array output parameter is declared. These are declared and operate in a similar fashion as scalar output parameters.
Within the definition of the class the parameter is for, the output array parameter is defined using the following pattern:
Where:
& operator
, to the reader is providedThese methods are implemented on the containing class and are called when the value of a parameter is requested. These methods have the following signature:
Where
By convention, reader method names are prefixed by
read_
In the reader methods, the data and dimensions of the array are set in the array object.
or for two dimensional arrays...
[!note]
- By default the set method will make a copy of the data array passed in.
- To prevent the array copy, pass in the optional no_copy parameter set to
true
* By convention declaring the output reader method as private. This can be optional
- The reader method must be declared before defining the parameter
- The use of the
read_
prefix on the writer methods help identify the methods as supporting a parameter.
When an instance of the object that contains the parameter is created, the parameter is registered with that object using the flxRegister()
function. This step connects the object instance with the parameter.
The calling sequence for flxRegister is:
Where:
For the example above, the registration call looks like: