/src/wrappers/glib/library/data_types/glib_trash_stacks.e

http://github.com/tybor/Liberty · Specman e · 70 lines · 7 code · 20 blank · 43 comment · 0 complexity · 1bc5637675c5998d1427c87f4e772c88 MD5 · raw file

  1. indexing
  2. copyright: "(C) 2005 Paolo Redaelli "
  3. license: "LGPL v2 or later"
  4. date: "$Date:$"
  5. revision: "$REvision:$"
  6. class GLIB_TRASH_STACKS
  7. -- Prev Up Home GLib Reference Manual Next
  8. -- Top | Description
  9. -- Trash Stacks
  10. -- Trash Stacks %G —%@ maintain a stack of unused allocated memory chunks.
  11. -- Synopsis
  12. -- #include <glib.h>
  13. -- GTrashStack;
  14. -- void g_trash_stack_push (GTrashStack **stack_p,
  15. -- gpointer data_p);
  16. -- gpointer g_trash_stack_pop (GTrashStack **stack_p);
  17. -- gpointer g_trash_stack_peek (GTrashStack **stack_p);
  18. -- guint g_trash_stack_height (GTrashStack **stack_p);
  19. -- Description
  20. -- A GTrashStack is an efficient way to keep a stack of unused allocated memory chunks. Each memory chunk is required to be large enough to hold a gpointer. This allows the stack to be maintained without any space overhead, since the stack pointers can be stored inside the memory chunks.
  21. -- There is no function to create a GTrashStack. A NULL GTrashStack* is a perfectly valid empty stack.
  22. -- Details
  23. -- GTrashStack
  24. -- typedef struct {
  25. -- GTrashStack *next;
  26. -- } GTrashStack;
  27. -- Each piece of memory that is pushed onto the stack is cast to a GTrashStack*.
  28. -- GTrashStack *next; pointer to the previous element of the stack, gets stored in the first sizeof (gpointer) bytes of the element.
  29. -- g_trash_stack_push ()
  30. -- void g_trash_stack_push (GTrashStack **stack_p,
  31. -- gpointer data_p);
  32. -- Pushes a piece of memory onto a GTrashStack.
  33. -- stack_p : a pointer to a GTrashStack.
  34. -- data_p : the piece of memory to push on the stack.
  35. -- g_trash_stack_pop ()
  36. -- gpointer g_trash_stack_pop (GTrashStack **stack_p);
  37. -- Pops a piece of memory off a GTrashStack.
  38. -- stack_p : a pointer to a GTrashStack.
  39. -- Returns : the element at the top of the stack.
  40. -- g_trash_stack_peek ()
  41. -- gpointer g_trash_stack_peek (GTrashStack **stack_p);
  42. -- Returns the element at the top of a GTrashStack.
  43. -- stack_p : a pointer to a GTrashStack.
  44. -- Returns : the element at the top of the stack.
  45. -- g_trash_stack_height ()
  46. -- guint g_trash_stack_height (GTrashStack **stack_p);
  47. -- Returns the height of a GTrashStack.
  48. -- stack_p : a pointer to a GTrashStack.
  49. -- Returns : the height of the stack.
  50. end