SimGrid  3.15
Versatile Simulation of Distributed Systems

Detailed Description

Typedefs

typedef struct xbt_dynar_sxbt_dynar_t
 Dynar data type (opaque type) More...
 

Functions

xbt_dynar_t xbt_dynar_new (const unsigned long elm_size, void_f_pvoid_t const free_f)
 Constructor. More...
 
void xbt_dynar_init (xbt_dynar_t dynar, const unsigned long elmsize, void_f_pvoid_t const free_f)
 Initialize a dynar structure that was not malloc'ed This can be useful to keep temporary dynars on the stack. More...
 
void xbt_dynar_free (xbt_dynar_t *dynar)
 Destructor. More...
 
void xbt_dynar_free_voidp (void *dynar)
 free a dynar passed as void* (handy to store dynar in dynars or dict) More...
 
void xbt_dynar_free_container (xbt_dynar_t *dynar)
 Destructor of the structure not touching to the content. More...
 
void xbt_dynar_free_data (xbt_dynar_t dynar)
 Destroy a dynar that was created with xbt_dynar_init. More...
 
void xbt_dynar_shrink (xbt_dynar_t dynar, int empty_slots)
 Shrink the dynar by removing empty slots at the end of the internal array. More...
 
void xbt_dynar_dump (xbt_dynar_t dynar)
 

Typedef Documentation

◆ xbt_dynar_t

typedef struct xbt_dynar_s* xbt_dynar_t

Dynar data type (opaque type)

Function Documentation

◆ xbt_dynar_new()

xbt_dynar_t xbt_dynar_new ( const unsigned long  elmsize,
void_f_pvoid_t const  free_f 
)

Constructor.

Parameters
elmsizesize of each element in the dynar
free_ffunction to call each time we want to get rid of an element (or nullptr if nothing to do).

Creates a new dynar. If a free_func is provided, the elements have to be pointer of pointer. That is to say that dynars can contain either base types (int, char, double, etc) or pointer of pointers (struct **).

Examples:
examples/msg/actions-comm/actions-comm.c, examples/msg/async-waitany/async-waitany.c, and examples/msg/trace-process-migration/trace-process-migration.c.

◆ xbt_dynar_init()

void xbt_dynar_init ( xbt_dynar_t  dynar,
const unsigned long  elmsize,
void_f_pvoid_t const  free_f 
)

Initialize a dynar structure that was not malloc'ed This can be useful to keep temporary dynars on the stack.

◆ xbt_dynar_free()

◆ xbt_dynar_free_voidp()

void xbt_dynar_free_voidp ( void dynar)

free a dynar passed as void* (handy to store dynar in dynars or dict)

◆ xbt_dynar_free_container()

void xbt_dynar_free_container ( xbt_dynar_t dynar)

Destructor of the structure not touching to the content.

Parameters
dynarpoor victim

kilkil a dynar BUT NOT its content. Ie, the array is freed, but the content is not touched (the free_f function is not used)

Examples:
examples/msg/actions-comm/actions-comm.c, and examples/msg/io-remote/io-remote.c.

◆ xbt_dynar_free_data()

void xbt_dynar_free_data ( xbt_dynar_t  dynar)

Destroy a dynar that was created with xbt_dynar_init.

◆ xbt_dynar_shrink()

void xbt_dynar_shrink ( xbt_dynar_t  dynar,
int  empty_slots_wanted 
)

Shrink the dynar by removing empty slots at the end of the internal array.

Parameters
dynara dynar
empty_slots_wantednumber of empty slots you want to keep at the end of the internal array for further insertions

Reduces the internal array size of the dynar to the number of elements plus empty_slots_wanted. After removing elements from the dynar, you can call this function to make the dynar use less memory. Set empty_slots_wanted to zero to reduce the dynar internal array as much as possible. Note that if empty_slots_wanted is greater than the array size, the internal array is expanded instead of shrunk.

◆ xbt_dynar_dump()

void xbt_dynar_dump ( xbt_dynar_t  dynar)