Back to Adaptive Vision Library website

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

ClassifyByPredicate


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

Separates the elements of the input array into two output arrays. The first output array contains all the elements for which the associated predicate is True.

Syntax

void avl::ClassifyByPredicate
(
	const atl::Array<Type>& inArray,
	const atl::Array<bool>& inPredicate,
	atl::Array<Type>& outAccepted,
	atl::Array<Type>& outRejected
)

Parameters

Name Type Default Description
inArray const Array<Type>& Elements to be classified
inPredicate const Array<bool>& Corresponding logical values determining the output array for each of the elements
outAccepted Array<Type>& Array of elements corresponding to 'true' values
outRejected Array<Type>& Array of elements corresponding to 'false' values

Hints

  • Before using this filter you need to have an array of objects (to be classified) and an array of boolean values that describe which elements of the first array fulfill some condition.
  • Connect the array of objects to the inArray input and connect the array of boolean values to the inPredicate input.
  • If you need the highest possible speed, also consider using a more simple filter SelectByPredicate.

Examples

inArray = {"Alice", "Bill", "Frank", "Patricia", "Thomas"}
inPredicate = {True,True,False,False,True}
outAccepted = {"Alice", "Bill", "Thomas"}
outRejected = {"Frank", "Patricia""}

Errors

List of possible exceptions:

Error type Description
DomainError Inconsistent array lengths on input in ClassifyByPredicate.

See Also

  • ClassifyByRange – Separates the elements of the input array into three output arrays, depending on whether the related values fall below, into or above the specified range.
  • SelectByPredicate – Selects the elements from the input array for which the associated predicate is True.