|
openDAQ
Open data acquisition platform
|
Used by openDAQ properties to validate whether a value fits the value restrictions of the Property. More...
Inherits ObjectPtr< IValidator >.
Used by openDAQ properties to validate whether a value fits the value restrictions of the Property.
Whenever a value is set to on a Property object, if the corresponding Property has a validator configured, the value will be validated, throwing a validation error, if the value is not compliant with the validation restrictions. For example, a validator can check the written value for lower-than, greater-than, equality, or other number relations.
The validation conditions are configured with an evaluation string when the validator is constructed. The string constructs an Eval value that replaces any instance of the keyword "value" or "val" with the value being set. The result of the Eval value evaluation is the output of the validate function call. For example, validators created with the string "value == 5" would reject any value that is not equal to 5.
Public Member Functions | |
| void | validate (const daq::BaseObjectPtr &propObj, const daq::BaseObjectPtr &value) const |
Checks whether value adheres to the validity conditions of the validator. More... | |
| daq::StringPtr | getEval () const |
| Gets the string expression used when creating the validator. More... | |
|
inline |
Gets the string expression used when creating the validator.
|
inline |
Checks whether value adheres to the validity conditions of the validator.
| propObj | Optional property object parameter required if the validation depends on other properties of the Property object. |
| value | The value to be checked for whether it is valid or not. |
| ValidateFailedException | if value is invalid. |
| OPENDAQ_SUCCESS | if value is valid. |