SimGrid
Functions
Dynar as a regular array
Dynar: generic dynamic array

Functions

void xbt_dynar_get_cpy (const xbt_dynar_t dynar, const unsigned long idx, void *const dst)
 Retrieve a copy of the Nth element of a dynar.
void xbt_dynar_set (xbt_dynar_t dynar, const int idx, const void *src)
 Set the Nth element of a dynar (expanded if needed). Previous value at this position is NOT freed.
void xbt_dynar_replace (xbt_dynar_t dynar, const unsigned long idx, const void *object)
 Set the Nth element of a dynar (expanded if needed). Previous value is freed.
void xbt_dynar_insert_at (xbt_dynar_t const dynar, const int idx, const void *src)
 Set the Nth dynar's element, expanding the dynar and sliding the previous values to the right.
void xbt_dynar_remove_at (xbt_dynar_t const dynar, const int idx, void *const dst)
 Remove the Nth dynar's element, sliding the previous values to the left.
unsigned int xbt_dynar_search (xbt_dynar_t const dynar, void *elem)
 Returns the position of the element in the dynar.
int xbt_dynar_member (xbt_dynar_t const dynar, void *elem)
 Returns a boolean indicating whether the element is part of the dynar.
void xbt_dynar_sort (xbt_dynar_t const dynar, int_f_cpvoid_cpvoid_t compar_fn)
 Sorts a dynar according to the function compar_fn

Function Documentation

void xbt_dynar_get_cpy ( const xbt_dynar_t  dynar,
const unsigned long  idx,
void *const  dst 
)

Retrieve a copy of the Nth element of a dynar.

Parameters:
dynarinformation dealer
idxindex of the slot we want to retrieve
[out]dstwhere to put the result to.
void xbt_dynar_set ( xbt_dynar_t  dynar,
const int  idx,
const void *const  src 
)

Set the Nth element of a dynar (expanded if needed). Previous value at this position is NOT freed.

Parameters:
dynarinformation dealer
idxindex of the slot we want to modify
srcWhat will be feeded to the dynar

If you want to free the previous content, use xbt_dynar_replace().

void xbt_dynar_replace ( xbt_dynar_t  dynar,
const unsigned long  idx,
const void *const  object 
)

Set the Nth element of a dynar (expanded if needed). Previous value is freed.

Parameters:
dynar
idx
objectSet the Nth element of a dynar, expanding the dynar if needed, AND DO free the previous value at this position. If you don't want to free the previous content, use xbt_dynar_set().
void xbt_dynar_insert_at ( xbt_dynar_t const  dynar,
const int  idx,
const void *const  src 
)

Set the Nth dynar's element, expanding the dynar and sliding the previous values to the right.

Set the Nth element of a dynar, expanding the dynar if needed, and moving the previously existing value and all subsequent ones to one position right in the dynar.

void xbt_dynar_remove_at ( xbt_dynar_t const  dynar,
const int  idx,
void *const  object 
)

Remove the Nth dynar's element, sliding the previous values to the left.

Get the Nth element of a dynar, removing it from the dynar and moving all subsequent values to one position left in the dynar.

If the object argument of this function is a non-null pointer, the removed element is copied to this address. If not, the element is freed using the free_f function passed at dynar creation.

unsigned int xbt_dynar_search ( xbt_dynar_t const  dynar,
void *const  elem 
)

Returns the position of the element in the dynar.

Raises not_found_error if not found.

void xbt_dynar_sort ( xbt_dynar_t  dynar,
int_f_cpvoid_cpvoid_t  compar_fn 
)

Sorts a dynar according to the function compar_fn

Parameters:
dynarthe dynar to sort
compar_fncomparison function of type (int (compar_fn*) (void*) (void*)).

Remark: if the elements stored in the dynar are structures, the compar_fn function has to retrieve the field to sort first.


Back to the main Simgrid Documentation page The version of Simgrid documented here is v3.6.1.
Documentation of other versions can be found in their respective archive files (directory doc/html).
Generated for SimGridAPI by doxygen