![]() |
flux sdk
v01.02.02-3-g292b3a7
Embedded C++ SDK
|
Properties represent the "_settings_" for a particular object within the system. This property values describe their object, as well as how the object behaves/operates within the system.
It's worth noting that properties don't reflect the input or output data from an object within the framework - this managed by parameter objects.
The following are key attributes of properties within the framework
The following types are available for properties
Setting an value:
Getting a value:
For the framework, two types of property classes exist.
get()
method on a value request and calls a set()
method when it's value is set.For each of the above types, besides normal property types that are visible and stored as is, there are three different attributes available:
flxPropertyHidden<type>
, flxPropertyRWHidden<type>
- The property isn't presented in menu systems, but can be used by an object to store/persist it's value.flxPropertySecure<type>
, flxPropertyRWSecure<type>
-The value of the property is encrypted before saving the value. This value is only written internally (not to a public JSON file)flxPropertySecret<type>
, flxPropertyRWSecret<type>
- The value is hidden and secure.These property objects define a typed property and provided storage for this property. As such, they act like a instance variable for their containment class.
Within the definition of the class the property is for, the property is defined using the following pattern:
Where:
Available Property Types:
The initial value for a property can be set in it's declaration statement by assigning the desired value to the declared variable. The value is set using a standard C++ initialization list syntax - aka {}
braces.
In the above example, setting an initial value of 42 to my_property looks like:
When an instance of the object that contains the property is created, the property is registered with that object using the flxRegister()
function. This step connects the object instance with the property.
The calling sequence for flxRegister is:
Where:
For the example above, the registration call looks like:
Internally, the flxRegister() call makes the containing object aware of the property object - adding it to an internal property list. This allows the system to enumerate properties at runtime as part of an introspection process.
These property objects define a typed property and required a get and set method be provided to enable reading/writing of the property value.
By calling methods on read and write of the property, the Read/Write property objects allow for the immediate, dynamic response to a property operation.
Within the definition of a class the property is for, the property is defined using the following pattern:
Where:
& operator
, to the getter is provided& operator
, to the getter is providedThese methods are implemented on the containing class and are called when the value of a property is requested. These methods have the following signature:
Where
Note >By convention, getters method names are prefixed by get_
These methods are implemented on the containing class and are called when the value of a property is set. These methods have the following signature:
Where
Note
By convention, getters method names are prefixed by
set_
* By convention the getters and setters are declared as private. This can be optional
- The getter and setter methods must be declared before defining the property
- The use of
set_
andget_
prefixes on the setter and getter methods help identify the methods as supporting a property.- If an initial value is set for a RW property it it's declaration statement, the setter method called with the initial value when the property is registered via flxRegister().
When an instance of the object that contains the property is created, the property is registered with that object using the flxRegister()
function. This step connects the object instance with the property.
The calling sequence for flxRegister is:
Where:
For the example above, the registration call looks like:
Note: If an initial value was set for the property, the value is passed to the setter method as part of the registration process.
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 property definition (the preferred method) and also set at runtime.
To set the range at parameter definition, just set the declared parameter to the range using a C++ initializer list { min, max}
Additionally, the method clearDataLimit()
can be called to delete the current limit.
A range examples for properties:
If providing an initial value, the declaration has the form {initial value, min, max}
.
To set/change the range value at runtime, the method setDataLimitRange(min, max)
is called on the object.
For Example:
This changes the data range accepted by the object and deletes any existing data limit.
Data Valid Value Set
This represents data limit provides a defined set of valid values for the property. The limit is defined by a set of name, value pairs that enable a human readable presentation for the values a property will accept. The values can be specified at property definition and also set at runtime.
To set the valid values at property definition, just set the declared property to the range using a C++ initializer list of name value pairs:
An example of a Valid Value Set - note an initial value is provided in this example:
To set/change the range value at runtime, the method addDataLimitValidValue()
is called on the property object. This object has two calling sequences:
Additionally, the method clearDataLimit()
can be called to delete the current limit
Simple Example:
Or for an entire parameter list:
The values are added to the current valid value list. If a ValidValue data limit was not in place when called, any current limit (i.e. range limit) is deleted and a valid value limit is put in place.