Defines | Functions

SWAG functions
[Swag: O(1) set datatype]

Defines

#define xbt_swag_offset(var, field)
 Offset computation.

Functions

xbt_swag_t xbt_swag_new (size_t offset)
void xbt_swag_free (xbt_swag_t swag)
void xbt_swag_insert (void *obj, xbt_swag_t swag)
void xbt_swag_insert_at_head (void *obj, xbt_swag_t swag)
void xbt_swag_insert_at_tail (void *obj, xbt_swag_t swag)
void * xbt_swag_remove (void *obj, xbt_swag_t swag)
void * xbt_swag_extract (xbt_swag_t swag)
int xbt_swag_size (xbt_swag_t swag)

Define Documentation

#define xbt_swag_offset (   var,
  field 
)

Offset computation.

  • var a variable of type struct something
  • field a field of struct something
    Returns:
    the offset of field in struct something.
    It is very similar to offsetof except that is done at runtime and that you have to declare a variable. Why defining such a macro then ? Because it is portable...

Function Documentation

xbt_swag_t xbt_swag_new ( size_t  offset  ) 

Creates a new swag.

Parameters:
offset where the hookup is located in the structure
See also:
xbt_swag_offset

Usage : xbt_swag_new(&obj.setA-&obj);

void xbt_swag_free ( xbt_swag_t  swag  ) 
Parameters:
swag poor victim

kilkil a swag but not it's content. If you do not understand why xbt_swag_free should not free its content, don't use swags.

void xbt_swag_insert ( void *  obj,
xbt_swag_t  swag 
)
Parameters:
obj the objet to insert in the swag
swag a swag

insert obj in swag

void xbt_swag_insert_at_head ( void *  obj,
xbt_swag_t  swag 
)
Parameters:
obj the objet to insert in the swag
swag a swag

insert (at the head... you probably had a very good reason to do that, I hope you know what you're doing) obj in swag

void xbt_swag_insert_at_tail ( void *  obj,
xbt_swag_t  swag 
)
Parameters:
obj the objet to insert in the swag
swag a swag

insert (at the tail... you probably had a very good reason to do that, I hope you know what you're doing) obj in swag

void* xbt_swag_remove ( void *  obj,
xbt_swag_t  swag 
)
Parameters:
obj the objet to remove from the swag
swag a swag
Returns:
obj if it was in the swag and NULL otherwise

removes obj from swag

void* xbt_swag_extract ( xbt_swag_t  swag  ) 
Parameters:
swag a swag
Returns:
an object from the swag
int xbt_swag_size ( xbt_swag_t  swag  ) 
Parameters:
swag a swag
Returns:
the number of objects in swag


Back to the main Simgrid Documentation page Generated for SimGridAPI by doxygen