SimGrid
Functions
Data description with Callback Persistant State: Simple push/pop mechanism
Data description

Functions

void gras_cbps_i_push (gras_cbps_t ps, int val)
 Push a new integer value into the cbps.
int gras_cbps_i_pop (gras_cbps_t ps)
 Pop the lastly pushed integer value from the cbps.
int gras_datadesc_cb_pop (gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data)
 Generic cb returning the lastly pushed value.
void gras_datadesc_cb_push_int (gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data)
 Cb to push an integer. Must be attached to the field you want to push.
void gras_datadesc_cb_push_uint (gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data)
 Cb to push an unsigned integer. Must be attached to the field you want to push.
void gras_datadesc_cb_push_lint (gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data)
 Cb to push an long integer. Must be attached to the field you want to push.
void gras_datadesc_cb_push_ulint (gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data)
 Cb to push an unsigned long integer. Must be attached to the field you want to push.
void gras_datadesc_cb_push_int_mult (gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data)
 Cb to push an integer as multiplier. Must be attached to the field you want to push.
void gras_datadesc_cb_push_uint_mult (gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data)
 Cb to push an unsigned integer as multiplier. Must be attached to the field you want to push.
void gras_datadesc_cb_push_lint_mult (gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data)
 Cb to push an long integer as multiplier. Must be attached to the field you want to push.
void gras_datadesc_cb_push_ulint_mult (gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data)
 Cb to push an unsigned long integer as multiplier. Must be attached to the field you want to push.

Detailed Description

Sometimes, one of the callbacks need to leave information for the next ones. If this is a simple integer (such as an array size), you can use the functions described here. If not, you'll have to play with the complete cbps interface.

Here is an example:

struct s_array {
  int length;
  int *data;
}
[...]
my_type=gras_datadesc_struct("s_array");
gras_datadesc_struct_append(my_type,"length", gras_datadesc_by_name("int"));
gras_datadesc_cb_field_send (my_type, "length", gras_datadesc_cb_push_int);

gras_datadesc_struct_append(my_type,"data",
                            gras_datadesc_array_dyn ("s_array::data",gras_datadesc_by_name("int"), gras_datadesc_cb_pop));
gras_datadesc_struct_close(my_type);

The *_mult versions are intended for multi-dimensional arrays: They multiply their value to the previously pushed one (by another field callback) and push the result of the multiplication back. An example of use follows. Please note that the first field needs a regular push callback, not a multiplier one. Think of it as a stacked calculator (man dc(1)).

struct s_matrix {
  int row;
  int col;
  int *data;
}
[...]
my_type=gras_datadesc_struct("s_matrix");
gras_datadesc_struct_append(my_type,"row", gras_datadesc_by_name("int"));
gras_datadesc_cb_field_send (my_type, "length", gras_datadesc_cb_push_int);
gras_datadesc_struct_append(my_type,"col", gras_datadesc_by_name("int"));
gras_datadesc_cb_field_send (my_type, "length", gras_datadesc_cb_push_int_mult);

gras_datadesc_struct_append(my_type,"data",
                            gras_datadesc_array_dyn ("s_matrix::data",gras_datadesc_by_name("int"), gras_datadesc_cb_pop));
gras_datadesc_struct_close(my_type);

Function Documentation

int gras_datadesc_cb_pop ( gras_datadesc_type_t  ignored,
gras_cbps_t  vars,
void *  data 
)

Generic cb returning the lastly pushed value.

Used by gras_datadesc_ref_pop_arr


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