libvisiontransfer
10.0.0
|
#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 |
template<typename T > | |
T | enforceIncrement (T t) |
template<typename T > | |
Parameter & | setDefault (T t) |
template<typename T > | |
Parameter & | setRange (T mn, T mx) |
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) |
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 47 of file parameter.h.
|
inline |
Generate a new Parameter for manual filling
Definition at line 68 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 30 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 418 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 420 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 422 of file parameter.h.
T visiontransfer::param::Parameter::enforceIncrement | ( | T | t | ) |
Returns value with any increment applied (starting at minimum, if specified)
|
inline |
Return the visibility / access mode for the external API bridge
Definition at line 88 of file parameter.h.
|
inline |
Return the visibility / access mode for the configuration web interface
Definition at line 86 of file parameter.h.
|
inline |
Return the finer-grained category name within a module
Definition at line 78 of file parameter.h.
|
inline |
Returns the current value for the Parameter. Not supported for tensors (use getTensorData() instead).
Definition at line 353 of file parameter.h.
|
inline |
Returns the ParameterValue representing the Parameters current or default value
Definition at line 340 of file parameter.h.
|
inline |
Returns the default value for the Parameter. Not supported for tensors.
Definition at line 369 of file parameter.h.
|
inline |
Return the parameter description (explanatory comment string)
Definition at line 80 of file parameter.h.
|
inline |
Return the governor string, i.e. the specific script cmdline or the controlling D-Bus name
Definition at line 104 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 102 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 384 of file parameter.h.
|
inline |
Gets the interaction UI hint (invisible / inactive / active)
Definition at line 94 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 108 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 98 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 379 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 374 of file parameter.h.
|
inline |
Return the overarching module name (abstract categorization for GUI etc.)
Definition at line 76 of file parameter.h.
|
inline |
Return the current human-readable name
Definition at line 74 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 336 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 328 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 238 of file parameter.cpp.
std::vector< double > & visiontransfer::param::Parameter::getTensorDataReference | ( | ) |
Returns a reference to the tensor data (CAUTION)
Definition at line 226 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 258 of file parameter.cpp.
std::vector< double > & visiontransfer::param::Parameter::getTensorDefaultDataReference | ( | ) |
Returns a reference to the tensor default data (CAUTION)
Definition at line 250 of file parameter.cpp.
|
inline |
Returns the tensor dimension, i.e. 1 for vectors, 2 for matrices etc.
Definition at line 122 of file parameter.h.
|
inline |
Returns the total number of elements in the Tensor (product of the sizes in all dimensions).
Definition at line 128 of file parameter.h.
|
inline |
Returns the tensor shape in all dimensions. This is {rows, columns} for matrices.
Definition at line 125 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 84 of file parameter.h.
|
inline |
Return the current UID
Definition at line 72 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 82 of file parameter.h.
|
inline |
Returns true iff the Parameter has a defined current value
Definition at line 392 of file parameter.h.
|
inline |
Returns true iff the Parameter has a defined default value
Definition at line 401 of file parameter.h.
|
inline |
Returns true iff the Parameter has an increment (granularity) set, false otherwise
Definition at line 414 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 388 of file parameter.h.
|
inline |
Returns true iff the Parameter has a limited range set, false otherwise
Definition at line 410 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 34 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 120 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 118 of file parameter.h.
|
inline |
Returns true iff the value type of the Parameter is TENSOR
Definition at line 116 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 245 of file parameter.h.
|
inline |
Sets the visibility / access mode for the external API bridge
Definition at line 92 of file parameter.h.
|
inline |
Sets the visibility / access mode for the configuration web interface
Definition at line 90 of file parameter.h.
|
inline |
Sets a Parameter to be a tensor, specifying the shape at the same time
Definition at line 237 of file parameter.h.
|
inline |
Sets the finer-grained category name within a module
Definition at line 218 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 297 of file parameter.h.
Copies over the current value from the specified Parameter into the present one
Definition at line 111 of file parameter.cpp.
Parameter & visiontransfer::param::Parameter::setCurrentFromDefault | ( | ) |
Copies over the current value from the default value, if specified
Definition at line 146 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 198 of file parameter.h.
|
inline |
Sets an OpenCV Size object from a Tensor-type Parameter, which must be of shape {2}.
Definition at line 167 of file parameter.h.
|
inline |
Sets the default value for the Parameter (Caveat: for scalars only)
Definition at line 272 of file parameter.h.
|
inline |
Sets the parameter description (explanatory comment string)
Definition at line 220 of file parameter.h.
|
inline |
Sets the parameter governor, a script or D-Bus name that controls setting the parameter
Definition at line 106 of file parameter.h.
|
inline |
Sets the uniform increment (granularity) for the Parameter (only checked for numerical scalars)
Definition at line 290 of file parameter.h.
|
inline |
Sets the interaction UI hint (invisible / inactive / active)
Definition at line 96 of file parameter.h.
|
inline |
Sets the oninit action (see getInvokeGovernorOnInit).
Definition at line 110 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 100 of file parameter.h.
|
inline |
Sets the overarching module name (abstract categorization for GUI etc.)
Definition at line 216 of file parameter.h.
|
inline |
Sets the human-readable name
Definition at line 214 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
Definition at line 310 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 321 of file parameter.h.
|
inline |
Sets the valid value range for the Parameter (only checked for numerical scalars)
Definition at line 281 of file parameter.h.
|
inline |
Sets the tensor data from a flat representation
Definition at line 139 of file parameter.h.
|
inline |
Sets the fallback tensor data
Definition at line 144 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 174 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 150 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 224 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 222 of file parameter.h.