Back to Adaptive Vision Library website

You are here: Start » Function Reference » Conditional Processing » ChooseByRange

ChooseByRange


This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.

Returns one of the three input objects depending on whether the associated input value falls below, in or above the specified range.

Syntax

void avl::ChooseByRange
(
	const Type& inObjectIfLower,
	const Type& inObjectIfInRange,
	const Type& inObjectIfHigher,
	float inValue,
	atl::Optional<float> inMinimum,
	atl::Optional<float> inMaximum,
	Type& outObject
)

Parameters

Name Type Default Description
inObjectIfLower const Type& Object to be chosen when the value is below the range
inObjectIfInRange const Type& Object to be chosen when the value is in the range
inObjectIfHigher const Type& Object to be chosen when the value is above the range
inValue float Value which is compared against the range
inMinimum Optional<float> NIL Lower end of the range
inMaximum Optional<float> NIL Upper end of the range
outObject Type& Chosen object

Description

The filter accepts three objects of the T type (decided on filter creation), and passes exactly one of them onto outObject output. The object to pass is selected depending on whether the inValue fits the (inMin, inMax) range.

  • If inValue is smaller than inMin, inObjectIfLower is selected.
  • If inValue fits closed range (inMin, inMax), inObjectIfInRange is selected.
  • If inValue is larger than inMax, inObjectIfHigher is selected.

In the special case of inMin being greater than inMax, first matching condition is applied, which means that if inValue is higher than inMax and lower than inMin, inObjectIfLower is selected.

Examples

inObjectIfLower = "Mike"
inObjectIfInRange = "Bill"
inObjectIfHigher = "Alice"
inValue = 10.0
inMin = 0.0
inMax = 10.0
outObject = "Bill"
inObjectIfLower = "Mike"
inObjectIfInRange = "Bill"
inObjectIfHigher = "Alice"
inValue = 10.1
inMin = 0.0
inMax = 10.0
outObject = "Alice"

Errors

Error type Description
DomainError Incorrect (NaN) float value on inValue input in ChooseByRange.

See Also