Back to Adaptive Vision Library website

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

ChooseByPredicate


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

Header:STD.h
Namespace:avl

Returns one of the two input objects depending on the specified condition.

Syntax

void avl::ChooseByPredicate
(
	const Type& inObjectIfTrue,
	const Type& inObjectIfFalse,
	bool inCondition,
	Type& outObject
)

Parameters

Name Type Default Description
inObjectIfTrue const Type& Object to be chosen if the condition is met
inObjectIfFalse const Type& Object to be chosen if the condition is NOT met
inCondition bool Determines which object is to be chosen
outObject Type& Chosen object

Hints

  • Also consider the ternary operator ?: in Formula Blocks.
  • Use this filter only with primitive types. Otherwise, to avoid excessive data creation and copying it may be better to use a Variant Step macrofilter.

Examples

inObjectIfTrue = "Mike"
inObjectIfFalse = "Bill"
inCondition = False
outObject = "Bill"

Remarks

This filter can be replaced with the following formula:

See Also

  • ChooseByCase – Returns one of the input objects depending on the specified case index.
  • ChooseByRange – Returns one of the three input objects depending on whether the associated input value falls below, in or above the specified range.