Back to Aurora Vision Library website

You are here: Start » Function Reference » All Functions » Conditional Processing » ChooseByCase

ChooseByCase


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
Module: FoundationLite

Returns one of the input objects depending on the specified case index.

Syntax

void avl::ChooseByCase
(
	const Type& inObjectIfCase0,
	const Type& inObjectIfCase1,
	const Type& inObjectIfCase2,
	const Type& inObjectIfCase3,
	const Type& inObjectIfCase4,
	const Type& inObjectIfCase5,
	const Type& inObjectIfCase6,
	const Type& inObjectIfCase7,
	int inCaseIndex,
	Type& outObject
)

Parameters

Name Type Range Default Description
Input value inObjectIfCase0 const Type& Object to be chosen for the case 0
Input value inObjectIfCase1 const Type& Object to be chosen for the case 1
Input value inObjectIfCase2 const Type& Object to be chosen for the case 2
Input value inObjectIfCase3 const Type& Object to be chosen for the case 3
Input value inObjectIfCase4 const Type& Object to be chosen for the case 4
Input value inObjectIfCase5 const Type& Object to be chosen for the case 5
Input value inObjectIfCase6 const Type& Object to be chosen for the case 6
Input value inObjectIfCase7 const Type& Object to be chosen for the case 7
Input value inCaseIndex int 0 - 7 Determines which object will be chosen
Output value outObject Type& Chosen object

Hints

  • Also consider the ternary operator ?: in Formula Blocks.
  • This filter creates a full copy of one of the input objects. Thus, if you need the highest possible speed, use this filter only with primitive types. An alternative is to use Variant Step macrofilters which are fast and elegant.

Examples

inObjectIfCase0 = "Alice"
inObjectIfCase1 = "Bob"
inObjectIfCase2 = "Mike"
inObjectIfCase3 = "Katherine"
inObjectIfCase4 = "John"
inObjectIfCase5 = "Thomas"
inObjectIfCase6 = "Patricia"
inObjectIfCase7 = "Frank"
inCaseIndex = 2
outObject = "Mike"

Errors

List of possible exceptions:

Error type Description
DomainError Case index out of range in ChooseByCase.

See Also

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