SimGrid  3.14.159
Versatile Simulation of Distributed Systems

Detailed Description

Those functions do not retrieve the content, but only their address.

Functions

voidxbt_dynar_set_at_ptr (const xbt_dynar_t dynar, const unsigned long idx)
 
voidxbt_dynar_get_ptr (const xbt_dynar_t dynar, const unsigned long idx)
 Retrieve a pointer to the Nth element of a dynar. More...
 
voidxbt_dynar_insert_at_ptr (xbt_dynar_t const dynar, const int idx)
 Make room for a new element, and return a pointer to it. More...
 
voidxbt_dynar_push_ptr (xbt_dynar_t const dynar)
 Make room at the end of the dynar for a new element, and return a pointer to it. More...
 
voidxbt_dynar_pop_ptr (xbt_dynar_t const dynar)
 Mark the last dynar's element as unused and return a pointer to it. More...
 

Function Documentation

§ xbt_dynar_set_at_ptr()

void* xbt_dynar_set_at_ptr ( const xbt_dynar_t  dynar,
const unsigned long  idx 
)

§ xbt_dynar_get_ptr()

void* xbt_dynar_get_ptr ( const xbt_dynar_t  dynar,
const unsigned long  idx 
)

Retrieve a pointer to the Nth element of a dynar.

Parameters
dynarinformation dealer
idxindex of the slot we want to retrieve
Returns
the idx-th element of dynar.
Warning
The returned value is the actual content of the dynar. Make a copy before fooling with it.
Examples:
examples/msg/actions-comm/actions-comm.c.

§ xbt_dynar_insert_at_ptr()

void* xbt_dynar_insert_at_ptr ( xbt_dynar_t const  dynar,
const int  idx 
)

Make room for a new element, and return a pointer to it.

You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what xbt_dynar_insert_at_as() does.

§ xbt_dynar_push_ptr()

void* xbt_dynar_push_ptr ( xbt_dynar_t const  dynar)

Make room at the end of the dynar for a new element, and return a pointer to it.

You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what xbt_dynar_push_as() does.

§ xbt_dynar_pop_ptr()

void* xbt_dynar_pop_ptr ( xbt_dynar_t const  dynar)

Mark the last dynar's element as unused and return a pointer to it.

You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what xbt_dynar_pop_as() does.