Iterator_Init

 

Prepare an iterator

 

 

Syntax

 

int  Iterator_Init(

          char iter_id,

          char * str,

          SliceO_Class * root=NULL

) ;

 

 

Parameters

 

iter_id

Index of the iterator you want to use.  There can only be one iterator open at the same time for each index. There are MAX_ITERATOR_ID id, but only ITERATOR_USER_1 and ITERATOR_USER_2 should be used in user functions.

 

str

Name of the function calling the iterator.  this string is used for debugging.

 

root

starting point of the iteration.  By default this is the root of the class tree, but you could start at any position in the tree and only that branch will be explored.

 

 

Return value

 

This function return 1 if the iterator was created, 0 otherwise..

 

 

Remarks

 

You must have a "Iterator_End" function for each opened iterator.  Failure to close the iterator will result in an error next time you try to open it.

 

 

Requirements

 

Header:

          sliceO_include.hpp

 

 

Library:

          sliceO_Structures.lib

 

 

Example

 

// --- start an iterator ---

if ( Iterator_Init( ITERATOR_USER_1, "Name of this function" ) ) {

 

          // --- now go through all the selected frames ---

          while( SliceO_Frame *frame = (SliceO_Frame *) Iterator_Class( ITERATOR_UESR_1, CLASS_TYPE_FRAME, Cur_Window, ITER_FLAG_SELECT ) ) {

 

                    // --- frame is now a pointer to one of the selected frames ---

                    ...

          }

 

           Iterator_End( ITERATOR_USER_1 ) ;

}

 

See also

 

Iterator_Init

Iterator_End