[ repeat icon ]

Iterators

Iterators enables the direct expression of the repeated application of the same process body. It specifies the control flow so that the output of the previous instance of the process can be the input of the next one.

Repetition

The iterator is not an abstract process but rather a constructor of the Transmorpher language. It cannot be refined. The iterator can take several input and output channels and a channels attribute which allows users to specify the data flow within the iterator: output is copied to the channels channels so that it can be compared with the next output.

The repeat element introduces the use of an iteration in a process body. Its structure is the following:

<repeat id="id" in="channels" test="channels" out="channels"> {<with-param>}* {<iterator>}* process-body </repeat>

The bibliography example does not use iterators, so here is a simple example.

<process name='myotherprocess' in='channel1,channel2' out='channel3'> <repeat in='channel1' channels='channel4' out='channel3'> <apply-process id='p1' name='myprocess' in='channel4' out='channel4'> </repeat> </process>

Iterators

The iterator element introduces the use of a variable which will be iterated over a particular structure. It must contain a name, a type and a number of other parameters that will specify its behavior.

<iterator name="name" type="name"> {<with-param>}* </iterator>

For instance,

<repeat id="rep" in="i" out="o"> <iterator type="int" name="j"> <with-param name="from">7</with-param> <with-param name="incr">-1</with-param> <with-param name="to">0</with-param> </iterator> process-body </repeat> repeats 8 times the process body.

Iterated flows

Because, the iterators runs the same process several times, it is necessary to know what happens with the flows in the channels. The channels within an iterator are special channels (called feedback) which allows the otput to be reused as input. For instance,

<repeat id="rep" in="i" out="o"> <apply-external type="int" in="i" out="o"/> </repeat> specifies that there is only one feedback.

Saturation

Next chapter: Queries


Feel free to comment to transmorpher-dev@fluxmedia.fr, Last modified: Tue May 29 14:16:53 CEST 2001
$Id: iter.html,v 1.2 2001/10/10 07:29:23 jerome Exp $