SimGrid  3.11
Versatile Simulation of Distributed Systems
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

Macros

#define xbt_dynar_foreach(_dynar, _cursor, _data)
 Iterates over the whole dynar. More...
 

Functions

void xbt_dynar_cursor_rm (xbt_dynar_t dynar, unsigned int *const cursor)
 Removes and free the entry pointed by the cursor. More...
 

Detailed Description

Cursors are used to iterate over the structure. Never add elements to the DynArr during the traversal. To remove elements, use the xbt_dynar_cursor_rm() function.

Do not call these function directly, but only within the xbt_dynar_foreach macro.

Macro Definition Documentation

#define xbt_dynar_foreach (   _dynar,
  _cursor,
  _data 
)

Iterates over the whole dynar.

Parameters
_dynarwhat to iterate over
_cursoran integer used as cursor
_data

Here is an example of usage:

unsigned int cpt;
string *str;
xbt_dynar_foreach (dyn,cpt,str) {
printf("Seen %s\n",str);
}

Note that underneath, that's a simple for loop with no real black magic involved. It's perfectly safe to interrupt a foreach with a break or a return statement.

Function Documentation

void xbt_dynar_cursor_rm ( xbt_dynar_t  dynar,
unsigned int *const  cursor 
)

Removes and free the entry pointed by the cursor.

This function can be used while traversing without problem.