libvisiontransfer
10.6.0
|
The main Parameter class. A variant-like type with current and default values and a lot of metadata. Parameter data is softly typed, the getters and setters accept a template parameter and are interoperable; with the notable exception of Tensor-type parameters, which have specific accessors.
If OpenCv is included ahead of including this file in your project, header-only TYPE_TENSOR<->OpenCv adapters for cv::Size and cv::Mat are made available.
Definition at line 71 of file parameter.h.
#include <visiontransfer/parameter.h>
Public Member Functions | |
Parameter () | |
Parameter (const std::string &uid) | |
std::string | getUid () const |
std::string | getName () const |
std::string | getModuleName () const |
std::string | getCategoryName () const |
std::string | getDescription () const |
std::string | getUnit () const |
ParameterValue::ParameterType | getType () const |
ParameterAccessMode | getAccessForConfig () const |
ParameterAccessMode | getAccessForApi () const |
Parameter & | setAccessForConfig (ParameterAccessMode mode) |
Parameter & | setAccessForApi (ParameterAccessMode mode) |
ParameterInteractionHint | getInteractionHint () const |
Parameter & | setInteractionHint (ParameterInteractionHint hint) |
bool | getIsModified () const |
Parameter & | setIsModified (bool mod) |
GovernorType | getGovernorType () const |
std::string | getGovernorString () const |
Parameter & | setGovernor (GovernorType govType, const std::string &govStr) |
bool | getInvokeGovernorOnInit () const |
Parameter & | setInvokeGovernorOnInit (bool invoke) |
std::string | interpolateCommandLine (const ParameterValue &newVal) |
bool | isTensor () const |
bool | isScalar () const |
bool | isCommand () const |
unsigned int | getTensorDimension () const |
std::vector< unsigned int > | getTensorShape () const |
unsigned int | getTensorNumElements () const |
std::vector< double > | getTensorData () const |
std::vector< double > | getTensorDefaultData () const |
std::vector< double > & | getTensorDataReference () |
std::vector< double > & | getTensorDefaultDataReference () |
Parameter & | setTensorData (const std::vector< double > &data) |
Parameter & | setTensorDefaultData (const std::vector< double > &data) |
Parameter & | setTensorFromCvSize (const cv::Size &cvSize) |
void | setCvSizeFromTensor (cv::Size &cvSize) |
template<typename T > | |
Parameter & | setTensorFromCvMat (const cv::Mat_< T > &cvMat) |
template<typename T > | |
void | setCvMatFromTensor (cv::Mat_< T > &cvMat) |
Parameter & | setName (const std::string &name) |
Parameter & | setModuleName (const std::string &n) |
Parameter & | setCategoryName (const std::string &n) |
Parameter & | setDescription (const std::string &d) |
Parameter & | setUnit (const std::string &d) |
Parameter & | setType (ParameterValue::ParameterType t) |
Parameter & | setAsTensor (const std::vector< unsigned int > &shape) |
template<typename T > | |
bool | isValidNewValue (T t) const |
bool | ensureValidDefault () |
bool | ensureValidCurrent () |
template<typename T > | |
T | enforceIncrement (T t) |
template<typename T > | |
Parameter & | setDefault (T t) |
template<typename T > | |
Parameter & | setRange (T mn, T mx) |
Parameter & | unsetRange () |
template<typename T > | |
Parameter & | setIncrement (T t) |
template<typename T > | |
Parameter & | setCurrent (T t) |
Parameter & | setCurrentFrom (const Parameter &from) |
Parameter & | setCurrentFromDefault () |
template<typename T > | |
Parameter & | setOptions (const std::vector< T > &opts, const std::vector< std::string > &descriptions) |
template<typename T > | |
Parameter & | setOptions (std::initializer_list< T > opts, std::initializer_list< std::string > descriptions) |
template<typename T > | |
std::vector< T > | getOptions () const |
std::vector< std::string > | getOptionDescriptions () const |
ParameterValue | getCurrentParameterValue () |
template<typename T > | |
T | getCurrent () const |
ParameterValue | getDefaultParameterValue () |
template<typename T > | |
T | getDefault () const |
template<typename T > | |
T | getMin () const |
template<typename T > | |
T | getMax () const |
template<typename T > | |
T | getIncrement () const |
bool | hasOptions () const |
bool | hasCurrent () const |
bool | hasDefault () const |
bool | hasRange () const |
bool | hasIncrement () const |
double | at (unsigned int x) |
double | at (unsigned int y, unsigned int x) |
double | at (unsigned int z, unsigned int y, unsigned int x) |
template<> | |
VT_EXPORT bool | enforceIncrement (bool t) |
template<> | |
VT_EXPORT int | enforceIncrement (int t) |
template<> | |
VT_EXPORT double | enforceIncrement (double t) |
template<> | |
VT_EXPORT std::string | enforceIncrement (std::string t) |
|
inline |
Generate a new Parameter for manual filling
Definition at line 104 of file parameter.h.
visiontransfer::param::Parameter::Parameter | ( | const std::string & | uid | ) |
Generate a new Parameter with specified UID (preferred) for manual filling
Definition at line 54 of file parameter.cpp.
|
inline |
Returns the x-th element of a 1-d tensor (vector). Also extends to higher dimensional tensors by indexing the flat data (as if getTensorData() has been used)
Definition at line 471 of file parameter.h.
|
inline |
Returns the y-th row, x-th column data element for a 2-dimensional tensor. Fails for other shapes or types
Definition at line 473 of file parameter.h.
|
inline |
Returns the z-th slice, y-th row, x-th column data element for a 3-dimensional tensor. Fails for other shapes or types
Definition at line 475 of file parameter.h.
T visiontransfer::param::Parameter::enforceIncrement | ( | T | t | ) |
Returns value with any increment applied (starting at minimum, if specified)
bool visiontransfer::param::Parameter::ensureValidCurrent | ( | ) |
Ensures that the current value is in the valid options (if set) or range (if set). Returns whether value was revised.
Definition at line 338 of file parameter.cpp.
bool visiontransfer::param::Parameter::ensureValidDefault | ( | ) |
Ensures that the default value is in the valid options (if set) or range (if set). Returns whether value was revised.
Definition at line 294 of file parameter.cpp.
|
inline |
Return the visibility / access mode for the external API bridge
Definition at line 124 of file parameter.h.
|
inline |
Return the visibility / access mode for the configuration web interface
Definition at line 122 of file parameter.h.
|
inline |
Return the finer-grained category name within a module
Definition at line 114 of file parameter.h.
|
inline |
Returns the current value for the Parameter. Not supported for tensors (use getTensorData() instead).
Definition at line 406 of file parameter.h.
|
inline |
Returns the ParameterValue representing the Parameters current or default value
Definition at line 393 of file parameter.h.
|
inline |
Returns the default value for the Parameter. Not supported for tensors.
Definition at line 422 of file parameter.h.
|
inline |
Return the parameter description (explanatory comment string)
Definition at line 116 of file parameter.h.
|
inline |
Return the governor string, i.e. the specific script cmdline or the controlling D-Bus name
Definition at line 140 of file parameter.h.
|
inline |
Return the governor type (whether setting the parameter is controlled by a script, D-Bus, or nothing yet)
Definition at line 138 of file parameter.h.
|
inline |
Returns the increment (granularity) for the Parameter (or the smallest possible value for the inferred template type if unset). Not supported for tensors.
Definition at line 437 of file parameter.h.
|
inline |
Gets the interaction UI hint (invisible / inactive / active)
Definition at line 130 of file parameter.h.
|
inline |
Gets the oninit action (after first load). False = do nothing; true = perform the same action as on change. Used for calling governor scripts immediately when the parameter daemon initializes.
Definition at line 144 of file parameter.h.
|
inline |
Returns whether the Parameter has unsaved (and unreverted) run-time modifications to its previously saved value, according to the parameter server.
Definition at line 134 of file parameter.h.
|
inline |
Returns the maximum value for the Parameter (or the highest possible value for the inferred template type if unset). Not supported for tensors.
Definition at line 432 of file parameter.h.
|
inline |
Returns the minimum value for the Parameter (or the lowest representable value for the inferred template type if unset). Not supported for tensors.
Definition at line 427 of file parameter.h.
|
inline |
Return the overarching module name (abstract categorization for GUI etc.)
Definition at line 112 of file parameter.h.
|
inline |
Return the current human-readable name
Definition at line 110 of file parameter.h.
|
inline |
Returns the list of option descriptions for an enum-style Parameter (or an empty list for non-enums).
Definition at line 389 of file parameter.h.
|
inline |
Returns the list of possible values for an enum-style Parameter (or an empty list for non-enums).
Definition at line 381 of file parameter.h.
std::vector< double > visiontransfer::param::Parameter::getTensorData | ( | ) | const |
Returns a flat copy of the tensor data as a vector<double>
Definition at line 266 of file parameter.cpp.
std::vector< double > & visiontransfer::param::Parameter::getTensorDataReference | ( | ) |
Returns a reference to the tensor data (CAUTION)
Definition at line 254 of file parameter.cpp.
std::vector< double > visiontransfer::param::Parameter::getTensorDefaultData | ( | ) | const |
Returns a flat copy of the tensor default data as a vector<double> (mostly internal use)
Definition at line 286 of file parameter.cpp.
std::vector< double > & visiontransfer::param::Parameter::getTensorDefaultDataReference | ( | ) |
Returns a reference to the tensor default data (CAUTION)
Definition at line 278 of file parameter.cpp.
|
inline |
Returns the tensor dimension, i.e. 1 for vectors, 2 for matrices etc.
Definition at line 158 of file parameter.h.
|
inline |
Returns the total number of elements in the Tensor (product of the sizes in all dimensions).
Definition at line 164 of file parameter.h.
|
inline |
Returns the tensor shape in all dimensions. This is {rows, columns} for matrices.
Definition at line 161 of file parameter.h.
|
inline |
Return the type of the parameter values, one of the scalar, tensor, or command types from ParameterValue::ParameterType. Value assignments are subject to type compatibility checks.
Definition at line 120 of file parameter.h.
|
inline |
Return the current UID
Definition at line 108 of file parameter.h.
|
inline |
Return the reference unit for the values of the Parameter as a string (e.g. "cm", "µs" etc.)
Definition at line 118 of file parameter.h.
|
inline |
Returns true iff the Parameter has a defined current value
Definition at line 445 of file parameter.h.
|
inline |
Returns true iff the Parameter has a defined default value
Definition at line 454 of file parameter.h.
|
inline |
Returns true iff the Parameter has an increment (granularity) set, false otherwise
Definition at line 467 of file parameter.h.
|
inline |
Returns true for an enum-style Parameter (i.e. a list of valid options has been set), false otherwise.
Definition at line 441 of file parameter.h.
|
inline |
Returns true iff the Parameter has a limited range set, false otherwise
Definition at line 463 of file parameter.h.
std::string visiontransfer::param::Parameter::interpolateCommandLine | ( | const ParameterValue & | newVal | ) |
Perform a substition of %-initiated placeholders with correctly quoted parameter [meta-]data (for compiling shell commandlines).
Definition at line 58 of file parameter.cpp.
|
inline |
Returns true iff the value type of the Parameter is COMMAND (a special string type that corresponds to single-shot actions such as buttons)
Definition at line 156 of file parameter.h.
|
inline |
Returns true iff the value type of the Parameter is scalar, i.e. neither TENSOR nor COMMAND
Definition at line 154 of file parameter.h.
|
inline |
Returns true iff the value type of the Parameter is TENSOR
Definition at line 152 of file parameter.h.
|
inline |
Returns whether the specified value is acceptable for the current Parameter (if it is constrained by range or enum list)
Definition at line 281 of file parameter.h.
|
inline |
Sets the visibility / access mode for the external API bridge
Definition at line 128 of file parameter.h.
|
inline |
Sets the visibility / access mode for the configuration web interface
Definition at line 126 of file parameter.h.
|
inline |
Sets a Parameter to be a tensor, specifying the shape at the same time
Definition at line 273 of file parameter.h.
|
inline |
Sets the finer-grained category name within a module
Definition at line 254 of file parameter.h.
|
inline |
Sets or overwrites the current value of the Parameter. Type compatibility is enforced and std::runtime_error is thrown for violations.
Definition at line 348 of file parameter.h.
Copies over the current value from the specified Parameter into the present one
Definition at line 135 of file parameter.cpp.
Parameter & visiontransfer::param::Parameter::setCurrentFromDefault | ( | ) |
Copies over the current value from the default value, if specified
Definition at line 167 of file parameter.cpp.
|
inline |
Sets an OpenCV Mat object of arbitrary base type from a Tensor-type Parameter, which must be two-dimensional.
Definition at line 234 of file parameter.h.
|
inline |
Sets an OpenCV Size object from a Tensor-type Parameter, which must be of shape {2}.
Definition at line 203 of file parameter.h.
|
inline |
Sets the default value for the Parameter (Caveat: for scalars only)
Definition at line 312 of file parameter.h.
|
inline |
Sets the parameter description (explanatory comment string)
Definition at line 256 of file parameter.h.
|
inline |
Sets the parameter governor, a script or D-Bus name that controls setting the parameter
Definition at line 142 of file parameter.h.
|
inline |
Sets the uniform increment (granularity) for the Parameter (only checked for numerical scalars)
Definition at line 339 of file parameter.h.
|
inline |
Sets the interaction UI hint (invisible / inactive / active)
Definition at line 132 of file parameter.h.
|
inline |
Sets the oninit action (see getInvokeGovernorOnInit).
Definition at line 146 of file parameter.h.
|
inline |
Sets the runtime-modified flag. This is controlled by the device; changing it has no effect in client-side code.
Definition at line 136 of file parameter.h.
|
inline |
Sets the overarching module name (abstract categorization for GUI etc.)
Definition at line 252 of file parameter.h.
|
inline |
Sets the human-readable name
Definition at line 250 of file parameter.h.
|
inline |
Specifies a vector of possible values and a vector of description strings, making the present Parameter an enum-style option list. Use zero-length arguments to remove an enum restriction.
Definition at line 360 of file parameter.h.
|
inline |
Specifies an initializer_list of possible values and an initializer_list of description strings, making the present Parameter an enum-style option list
Definition at line 374 of file parameter.h.
|
inline |
Sets the valid value range for the Parameter (only checked for numerical scalars)
Definition at line 320 of file parameter.h.
|
inline |
Sets the tensor data from a flat representation
Definition at line 175 of file parameter.h.
|
inline |
Sets the fallback tensor data
Definition at line 180 of file parameter.h.
|
inline |
Sets a Tensor-type (or still undefined) Parameter from an OpenCV Mat object, yielding a two-dimensional tensor of identical shape
Definition at line 210 of file parameter.h.
|
inline |
Sets a Tensor-type (or still undefined) Parameter from an OpenCV Size object, yielding a tensor of shape {2}
Definition at line 186 of file parameter.h.
|
inline |
Sets the type of the parameter values, one of the scalar, tensor, or command types from ParameterValue::ParameterType. Value assignments are subject to type compatibility checks.
Definition at line 260 of file parameter.h.
|
inline |
Sets the reference unit for the values of the Parameter as a string (e.g. "cm", "µs" etc.)
Definition at line 258 of file parameter.h.
|
inline |
Unsets the valid value range for the Parameter; i.e. removes min and max bounds
Definition at line 330 of file parameter.h.