GLib.Queue¶
Fields¶
| Name | Type | Access | Description | 
|---|---|---|---|
| head | [ object] | r/w | a pointer to the first element of the queue | 
| length | int | r/w | the number of elements in the queue | 
| tail | [ object] | r/w | a pointer to the last element of the queue | 
Methods¶
| clear() | |
| clear_full(free_func) | |
| free() | |
| free_full(free_func) | |
| get_length() | |
| index(data) | |
| init() | |
| is_empty() | |
| peek_head() | |
| peek_nth(n) | |
| peek_tail() | |
| pop_head() | |
| pop_nth(n) | |
| pop_tail() | |
| push_head(data) | |
| push_nth(data, n) | |
| push_tail(data) | |
| remove(data) | |
| remove_all(data) | |
| reverse() | 
Details¶
- 
class GLib.Queue¶
- Contains the public fields of a Queue. - 
clear()[source]¶
- Removes all the elements in self. If queue elements contain dynamically-allocated memory, they should be freed first. - New in version 2.14. 
 - 
clear_full(free_func)[source]¶
- Parameters: - free_func ( - GLib.DestroyNotifyor- None) – the function to be called to free memory allocated- Convenience method, which frees all the memory used by a - GLib.Queue, and calls the provided free_func on each item in the- GLib.Queue.- New in version 2.60. 
 - 
free()[source]¶
- Frees the memory allocated for the - GLib.Queue. Only call this function if self was created with g_queue_new(). If queue elements contain dynamically-allocated memory, they should be freed first.- If queue elements contain dynamically-allocated memory, you should either use - GLib.Queue.free_full() or free them manually first.
 - 
free_full(free_func)[source]¶
- Parameters: - free_func ( - GLib.DestroyNotify) – the function to be called to free each element’s data- Convenience method, which frees all the memory used by a - GLib.Queue, and calls the specified destroy function on every element’s data.- free_func should not modify the queue (eg, by removing the freed element from it). - New in version 2.32. 
 - 
get_length()[source]¶
- Returns: - the number of items in self - Return type: - int- Returns the number of items in self. - New in version 2.4. 
 - 
index(data)[source]¶
- Parameters: - data ( - objector- None) – the data to find- Returns: - the position of the first element in self which contains data, or -1 if no element in self contains data - Return type: - int- Returns the position of the first element in self which contains data. - New in version 2.4. 
 - 
init()[source]¶
- A statically-allocated - GLib.Queuemust be initialized with this function before it can be used. Alternatively you can initialize it with #G_QUEUE_INIT. It is not necessary to initialize queues created with g_queue_new().- New in version 2.14. 
 - 
is_empty()[source]¶
- Returns: - Trueif the queue is empty- Return type: - bool- Returns - Trueif the queue is empty.
 - 
peek_head()[source]¶
- Returns: - the data of the first element in the queue, or - Noneif the queue is empty- Return type: - objector- None- Returns the first element of the queue. 
 - 
peek_nth(n)[source]¶
- Parameters: - n ( - int) – the position of the element- Returns: - the data for the n’th element of self, or - Noneif n is off the end of self- Return type: - objector- None- Returns the n’th element of self. - New in version 2.4. 
 - 
peek_tail()[source]¶
- Returns: - the data of the last element in the queue, or - Noneif the queue is empty- Return type: - objector- None- Returns the last element of the queue. 
 - 
pop_head()[source]¶
- Returns: - the data of the first element in the queue, or - Noneif the queue is empty- Return type: - objector- None- Removes the first element of the queue and returns its data. 
 - 
pop_nth(n)[source]¶
- Parameters: - n ( - int) – the position of the element- Returns: - the element’s data, or - Noneif n is off the end of self- Return type: - objector- None- Removes the n’th element of self and returns its data. - New in version 2.4. 
 - 
pop_tail()[source]¶
- Returns: - the data of the last element in the queue, or - Noneif the queue is empty- Return type: - objector- None- Removes the last element of the queue and returns its data. 
 - 
push_head(data)[source]¶
- Parameters: - data ( - objector- None) – the data for the new element.- Adds a new element at the head of the queue. 
 - 
push_nth(data, n)[source]¶
- Parameters: - Inserts a new element into self at the given position. - New in version 2.4. 
 - 
push_tail(data)[source]¶
- Parameters: - data ( - objector- None) – the data for the new element- Adds a new element at the tail of the queue. 
 - 
remove(data)[source]¶
- Parameters: - data ( - objector- None) – the data to remove- Returns: - Trueif data was found and removed from self- Return type: - bool- Removes the first element in self that contains data. - New in version 2.4. 
 
-