Skip to main content

ascending

Short summary

This method sorts the data structure. This can take many cycles and should be called until the CNM_ReturnTypes.ExecutionState is no longer BUSY. Uses the passed comparator or compareTo of the contained objects if no comparator is passed.

Return: ABORTED: While sort was pending,execute had a falling edge, BUSY: Sort is in progress ERROR: Sort was not able to finish (p.e. List changed) call sort(false) to reset IDLE: Currently no sort in progress SUCCESS: Sorting was finished

Parameters

NameTypeCommentKind
comparatorCNM_AbstractObject.IComparatorOptional: the comparator that should be used for the sort. Must not be changed while sort is in processinput
executeBOOLcontrol bit to start or abort the sorting, needs to be active until the ExecutionState is SUCCESSinput

Code

Declaration

METHOD ascending :CNM_ReturnTypes.SingleExecutionState
VAR_INPUT
(*control bit to start or abort the sorting, needs to be active until the ExecutionState is SUCCESS*)
execute :BOOL;
END_VAR
VAR_INPUT
(*Optional: the comparator that should be used for the sort. Must not be changed while sort is in process*)
comparator :CNM_AbstractObject.IComparator := 0;
END_VAR