iterate
Short summary
This method delivers the next object from the collection and returns the current state of iteration.
Example: You have a list: 1 2 3 the first iterate call will return CNM_ReturnTypes.BUSY and object = 1 the second iterate call will return CNM_ReturnTypes.BUSY and object = 2 the third iterate call will return CNM_ReturnTypes.BUSY and object = 3 the forth iterate call will return CNM_ReturnTypes.SUCCESS and object = NULL
Attention: iterators MUST assign the currently returned 'object' to THIS^.current as well!
Return: SUCCESS: if last object from collection was already returned,
ABORTED: execute has a falling edge during iterate,
BUSY: When iterate had rising edge on execute and not all objects had been returned yet,
IDLE: iterate wasn't started yet,
ERROR: error occured during iteration
- Return type: CNM_ReturnTypes.SingleExecutionState
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| execute | BOOL | control bit to start or abort the iterate (see SingleExecutionState) | input |
| object | CNM_AbstractObject.IObject | the returned object of the iteration | output |
Code
Declaration
METHOD ABSTRACT iterate :CNM_ReturnTypes.SingleExecutionState
VAR_INPUT
(*control bit to start or abort the iterate (see SingleExecutionState)*)
execute :BOOL;
END_VAR
VAR_OUTPUT
(*the returned object of the iteration*)
object :CNM_AbstractObject.IObject;
END_VAR