SimGrid: Direct access to fifo elements

SimGrid 3.10 Versatile Simulation of Distributed Systems

- Home page
- Online documentation
- Dev's Corner

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Macros | Functions
Direct access to fifo elements
Fifo: generic workqueue

## Macros
#define | xbt_fifo_foreach(f, i, n, type)
| List iterator asserts and stuff.

## Functions
xbt_fifo_item_t | xbt_fifo_new_item (void)
void | xbt_fifo_set_item_content (xbt_fifo_item_t, void *)
void * | xbt_fifo_get_item_content (xbt_fifo_item_t)
void | xbt_fifo_free_item (xbt_fifo_item_t)
void | xbt_fifo_push_item (xbt_fifo_t, xbt_fifo_item_t)
xbt_fifo_item_t | xbt_fifo_pop_item (xbt_fifo_t)
void | xbt_fifo_unshift_item (xbt_fifo_t, xbt_fifo_item_t)
xbt_fifo_item_t | xbt_fifo_shift_item (xbt_fifo_t)
int | xbt_fifo_remove (xbt_fifo_t, void *)
int | xbt_fifo_remove_all (xbt_fifo_t, void *)
void | xbt_fifo_remove_item (xbt_fifo_t, xbt_fifo_item_t)
xbt_fifo_item_t | xbt_fifo_get_first_item (xbt_fifo_t l)
xbt_fifo_item_t | xbt_fifo_get_last_item (xbt_fifo_t l)
xbt_fifo_item_t | xbt_fifo_get_next_item (xbt_fifo_item_t i)
xbt_fifo_item_t | xbt_fifo_get_prev_item (xbt_fifo_item_t i)

## Detailed Description

## Macro Definition Documentation

#define xbt_fifo_foreach | ( |  | f,
|  |  | i,
|  |  | n,
|  |  | type
| ) |  |

List iterator asserts and stuff.

Parameters

  f | a list (xbt_fifo_t)
  i | a bucket (xbt_fifo_item_t)
  type | a type
  n | an object of type type.

Iterates over the whole list.

## Function Documentation

xbt_fifo_item_t xbt_fifo_new_item | ( | void |  | ) |

Constructor

Returns
  a new bucket

void xbt_fifo_set_item_content | ( | xbt_fifo_item_t | i,
|  | void * | v
| ) |  |

Parameters

  i | a bucket
  v | an object

stores v in i.

void* xbt_fifo_get_item_content | ( | xbt_fifo_item_t | i | ) |

Parameters

  i | a bucket

Returns
  the object stored i.

void xbt_fifo_free_item | ( | xbt_fifo_item_t | b | ) |

Destructor

Parameters

  b | poor victim

Free the bucket but does not modifies the object (if any) that was stored in it.

void xbt_fifo_push_item | ( | xbt_fifo_t | l,
|  | xbt_fifo_item_t | new
| ) |  |

Push a bucket

Parameters

  l | list
  new | bucket

Hook up this bucket at the tail of the list

xbt_fifo_item_t xbt_fifo_pop_item | ( | xbt_fifo_t | l | ) |

Pop bucket

Parameters

  l |

Returns
  the bucket that was at the tail of the list.

Returns NULL if the list was empty.

void xbt_fifo_unshift_item | ( | xbt_fifo_t | l,
|  | xbt_fifo_item_t | new
| ) |  |

Push a bucket

Parameters

  l | list
  new | bucket

Hook up this bucket at the head of the list

xbt_fifo_item_t xbt_fifo_shift_item | ( | xbt_fifo_t | l | ) |

Shift bucket

Parameters

  l |

Returns
  the bucket that was at the head of the list.

Returns NULL if the list was empty.

int xbt_fifo_remove | ( | xbt_fifo_t | l,
|  | void * | t
| ) |  |

Parameters

  l |
  t | an objet

removes the first occurence of t from l.

Warning
  it will not remove duplicates

Returns
  1 if an item was removed and 0 otherwise.

int xbt_fifo_remove_all | ( | xbt_fifo_t | l,
|  | void * | t
| ) |  |

Parameters

  l |
  t | an objet

removes all occurences of t from l.

Returns
  1 if an item was removed and 0 otherwise.

void xbt_fifo_remove_item | ( | xbt_fifo_t | l,
|  | xbt_fifo_item_t | current
| ) |  |

Parameters

  l | a list
  current | a bucket

removes a bucket current from the list l. This function implicitely assumes (and doesn't check!) that this item belongs to this list...

xbt_fifo_item_t xbt_fifo_get_first_item | ( | xbt_fifo_t | l | ) |

Parameters

  l | a list

Returns
  the head of l.

Returns NULL if the list is empty.

xbt_fifo_item_t xbt_fifo_get_last_item | ( | xbt_fifo_t | l | ) |

Parameters

  l | a list

Returns
  the tail of l.

Returns NULL if the list is empty.

xbt_fifo_item_t xbt_fifo_get_next_item | ( | xbt_fifo_item_t | i | ) |

Parameters

  i | a bucket

Returns
  the bucket that comes next

Returns NULL if i is the tail of the list.

xbt_fifo_item_t xbt_fifo_get_prev_item | ( | xbt_fifo_item_t | i | ) |

Parameters

  i | a bucket

Returns
  the bucket that is just before i.

Returns NULL if i is the head of the list.