SimGrid 3.7.1
Scalable simulation of distributed systems
Functions
Data description with Callback Persistant State: Full featured interface
Data description

Functions

void xbt_cbps_v_pop (xbt_cbps_t ps, const char *name, xbt_datadesc_type_t *ddt, void **res)
 Retrieve an element from the PS, and remove it from the PS.
void xbt_cbps_v_push (xbt_cbps_t ps, const char *name, void *data, xbt_datadesc_type_t ddt)
 Declare a new element in the PS, and give it a value.
void xbt_cbps_v_set (xbt_cbps_t ps, const char *name, void *data, xbt_datadesc_type_t ddt)
 Change the value of an element in the PS.
void * xbt_cbps_v_get (xbt_cbps_t ps, const char *name, xbt_datadesc_type_t *ddt)
 Get the value of an element in the PS without modifying it.
void xbt_cbps_block_begin (xbt_cbps_t ps)
 Begins a new block.
void xbt_cbps_block_end (xbt_cbps_t ps)
 End the current block, and go back to the upper one.

Detailed Description

Sometimes, one of the callbacks need to leave information for the next ones. If the simple push/pop mechanism introduced in previous section isn't enough, you can always use this full featured one. The bad point is that it is quite badly documented...


Function Documentation

void xbt_cbps_v_pop ( xbt_cbps_t  ps,
const char *  name,
xbt_datadesc_type_t ddt,
void **  res 
)

Retrieve an element from the PS, and remove it from the PS.

If it's not present in the current block, it will fail (throwing not_found) and not search in upper blocks since this denotes a programmation error.

void xbt_cbps_v_push ( xbt_cbps_t  ps,
const char *  name,
void *  data,
xbt_datadesc_type_t  ddt 
)

Declare a new element in the PS, and give it a value.

If an element of that name already exists, it is masked by the one given here, and will be seeable again only after a pop to remove the value this push adds.

void xbt_cbps_v_set ( xbt_cbps_t  ps,
const char *  name,
void *  data,
xbt_datadesc_type_t  ddt 
)

Change the value of an element in the PS.

If it's not present in the current block, look in the upper ones. If it's not present in any of them, modify in the globals If not present there neither, the code may segfault (Oli?).

Once a reference to an element of that name is found somewhere in the PS, its value is changed.

void* xbt_cbps_v_get ( xbt_cbps_t  ps,
const char *  name,
xbt_datadesc_type_t ddt 
)

Get the value of an element in the PS without modifying it.

(note that you get the content of the data struct and not a copy to it) If it's not present in the current block, look in the upper ones. If it's not present in any of them, look in the globals If not present there neither, the code may segfault (Oli?).

void xbt_cbps_block_begin ( xbt_cbps_t  ps)

Begins a new block.

Blocks are usefull to remove a whole set of declarations you don't even know

E.g., they constitute an elegent solution to recursive data structures.

push/pop may be used in some cases for that, but if your recursive data struct contains other structs needing themselves callbacks, you have to use block_{begin,end} to do the trick.


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