1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 double-ended queue data structure
7 <!-- ##### SECTION Long_Description ##### -->
9 The #GQueue structure and its associated functions provide a standard
10 queue data structure. Internally, #GQueue uses the same data structure as
11 #GList to store elements.
14 The data contained in each element can be either integer values, by using one
16 <link linkend="glib-Type-Conversion-Macros">Type Conversion Macros</link>,
17 or simply pointers to any type of data.
20 To create a new #GQueue, use g_queue_new().
23 To initialize a statically-allocated #GQueue, use #G_QUEUE_INIT or
27 To add elements, use g_queue_push_head(), g_queue_push_head_link(),
28 g_queue_push_tail() and g_queue_push_tail_link().
31 To remove elements, use g_queue_pop_head() and g_queue_pop_tail().
34 To free the entire queue, use g_queue_free().
37 <!-- ##### SECTION See_Also ##### -->
42 <!-- ##### SECTION Stability_Level ##### -->
45 <!-- ##### STRUCT GQueue ##### -->
47 Contains the public fields of a <link linkend="glib-queues">Queue</link>.
50 @head: a pointer to the first element of the queue.
51 @tail: a pointer to the last element of the queue.
52 @length: the number of elements in the queue.
54 <!-- ##### FUNCTION g_queue_new ##### -->
62 <!-- ##### FUNCTION g_queue_free ##### -->
70 <!-- ##### MACRO G_QUEUE_INIT ##### -->
72 A statically-allocated #GQueue must be initialized with this macro before it
73 can be used. This macro can be used to initialize a variable, but it cannot
74 be assigned to a variable. In that case you have to use g_queue_init().
79 GQueue my_queue = G_QUEUE_INIT;
86 <!-- ##### FUNCTION g_queue_init ##### -->
94 <!-- ##### FUNCTION g_queue_clear ##### -->
102 <!-- ##### FUNCTION g_queue_is_empty ##### -->
111 <!-- ##### FUNCTION g_queue_get_length ##### -->
120 <!-- ##### FUNCTION g_queue_reverse ##### -->
128 <!-- ##### FUNCTION g_queue_copy ##### -->
137 <!-- ##### FUNCTION g_queue_foreach ##### -->
147 <!-- ##### FUNCTION g_queue_find ##### -->
157 <!-- ##### FUNCTION g_queue_find_custom ##### -->
168 <!-- ##### FUNCTION g_queue_sort ##### -->
178 <!-- ##### FUNCTION g_queue_push_head ##### -->
187 <!-- ##### FUNCTION g_queue_push_tail ##### -->
196 <!-- ##### FUNCTION g_queue_push_nth ##### -->
206 <!-- ##### FUNCTION g_queue_pop_head ##### -->
215 <!-- ##### FUNCTION g_queue_pop_tail ##### -->
224 <!-- ##### FUNCTION g_queue_pop_nth ##### -->
234 <!-- ##### FUNCTION g_queue_peek_head ##### -->
243 <!-- ##### FUNCTION g_queue_peek_tail ##### -->
252 <!-- ##### FUNCTION g_queue_peek_nth ##### -->
262 <!-- ##### FUNCTION g_queue_index ##### -->
272 <!-- ##### FUNCTION g_queue_remove ##### -->
281 <!-- ##### FUNCTION g_queue_remove_all ##### -->
290 <!-- ##### FUNCTION g_queue_insert_before ##### -->
300 <!-- ##### FUNCTION g_queue_insert_after ##### -->
310 <!-- ##### FUNCTION g_queue_insert_sorted ##### -->
321 <!-- ##### FUNCTION g_queue_push_head_link ##### -->
330 <!-- ##### FUNCTION g_queue_push_tail_link ##### -->
339 <!-- ##### FUNCTION g_queue_push_nth_link ##### -->
349 <!-- ##### FUNCTION g_queue_pop_head_link ##### -->
358 <!-- ##### FUNCTION g_queue_pop_tail_link ##### -->
367 <!-- ##### FUNCTION g_queue_pop_nth_link ##### -->
377 <!-- ##### FUNCTION g_queue_peek_head_link ##### -->
386 <!-- ##### FUNCTION g_queue_peek_tail_link ##### -->
395 <!-- ##### FUNCTION g_queue_peek_nth_link ##### -->
405 <!-- ##### FUNCTION g_queue_link_index ##### -->
415 <!-- ##### FUNCTION g_queue_unlink ##### -->
424 <!-- ##### FUNCTION g_queue_delete_link ##### -->