parallel
Short summary
Method to perform a given action on all objects inside the collection.
All objects are invoked with the applier until all are done.
If at any point the applier returns an error the foreach stops and returns an error.
Action to perform needs to implement :ref:IApplier.
*Attention: This method is single cycle, what means the call waits for all appliers to finish. Therefore none of the appliers should wait for anything (Events/IO/...)
Example:
You have a list of numbers: 1 2 3 and a ConcreteIncrementApplier that can take a number and increment it.
Calling list.forEach(ConcreteIncrementApplier) will increment all numbers in the list, becoming: 2 3 4.
Return: SUCCESS: Alle appliers returned with SUCCESS
ERROR: The applier returned error for at least one object, or any other error occured
- Return type: CNM_ReturnTypes.SingleExecutionResult
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| applier | IApplier | the applier (action) to be used on all obejcts in the collection | input |
Code
Declaration
METHOD parallel :CNM_ReturnTypes.SingleExecutionResult
VAR_INPUT
(*the applier (action) to be used on all obejcts in the collection*)
applier :IApplier;
END_VAR