GstVecDeque
GstVecDeque is an object that provides standard double-ended queue (deque) functionality based on an array instead of linked lists. This reduces the overhead caused by memory management by a large factor.
GstVecDeque
Since : 1.26
Methods
gst_vec_deque_clear
gst_vec_deque_clear (GstVecDeque * array)
Clears queue array and frees all memory associated to it.
Parameters:
array
–
a GstVecDeque object
Since : 1.26
gst_vec_deque_drop_element
gpointer gst_vec_deque_drop_element (GstVecDeque * array, gsize idx)
Drops the queue element at position idx from queue array.
the dropped element
Since : 1.26
gst_vec_deque_drop_struct
gboolean gst_vec_deque_drop_struct (GstVecDeque * array, gsize idx, gpointer p_struct)
Drops the queue element at position idx from queue array and copies the data of the element or structure that was removed into p_struct if p_struct is set (not NULL).
Parameters:
array
–
a GstVecDeque object
idx
–
index to drop
p_struct
–
address into which to store the data of the dropped structure, or NULL
TRUE on success, or FALSE on error
Since : 1.26
gst_vec_deque_find
gsize gst_vec_deque_find (GstVecDeque * array, GCompareFunc func, gpointer data)
Finds an element in the queue array, either by comparing every element with func or by looking up data if no compare function func is provided, and returning the index of the found element.
Parameters:
array
–
a GstVecDeque object
func
(
[nullable])
–
comparison function, or NULL to find data by value
data
–
data for comparison function
Index of the found element or -1 if nothing was found.
Since : 1.26
gst_vec_deque_free
gst_vec_deque_free (GstVecDeque * array)
Frees queue array and all memory associated to it.
Parameters:
array
–
a GstVecDeque object
Since : 1.26
gst_vec_deque_get_length
gsize gst_vec_deque_get_length (GstVecDeque * array)
Returns the length of the queue array
Parameters:
array
–
a GstVecDeque object
the length of the queue array.
Since : 1.26
gst_vec_deque_is_empty
gboolean gst_vec_deque_is_empty (GstVecDeque * array)
Checks if the queue array is empty.
Parameters:
array
–
a GstVecDeque object
TRUE if the queue array is empty
Since : 1.26
gst_vec_deque_peek_head
gpointer gst_vec_deque_peek_head (GstVecDeque * array)
Returns the head of the queue array and does not remove it from the queue.
Parameters:
array
–
a GstVecDeque object
The head of the queue
Since : 1.26
gst_vec_deque_peek_head_struct
gpointer gst_vec_deque_peek_head_struct (GstVecDeque * array)
Returns the head of the queue array without removing it from the queue.
Parameters:
array
–
a GstVecDeque object
pointer to element or struct, or NULL if array was empty. The data pointed to by the returned pointer stays valid only as long as the queue array is not modified further!
Since : 1.26
gst_vec_deque_peek_nth
gpointer gst_vec_deque_peek_nth (GstVecDeque * array, gsize idx)
Returns the item at idx in array, but does not remove it from the queue.
Parameters:
array
–
idx
–
The item, or NULL if idx was out of bounds
Since : 1.26
gst_vec_deque_peek_nth_struct
gpointer gst_vec_deque_peek_nth_struct (GstVecDeque * array, gsize idx)
Returns the item at idx in array, but does not remove it from the queue.
Parameters:
array
–
idx
–
The item, or NULL if idx was out of bounds
Since : 1.26
gst_vec_deque_peek_tail
gpointer gst_vec_deque_peek_tail (GstVecDeque * array)
Returns the tail of the queue array, but does not remove it from the queue.
Parameters:
array
–
a GstVecDeque object
The tail of the queue
Since : 1.26
gst_vec_deque_peek_tail_struct
gpointer gst_vec_deque_peek_tail_struct (GstVecDeque * array)
Returns the tail of the queue array, but does not remove it from the queue.
Parameters:
array
–
a GstVecDeque object
The tail of the queue
Since : 1.26
gst_vec_deque_pop_head
gpointer gst_vec_deque_pop_head (GstVecDeque * array)
Returns and head of the queue array and removes it from the queue.
Parameters:
array
–
a GstVecDeque object
The head of the queue
Since : 1.26
gst_vec_deque_pop_head_struct
gpointer gst_vec_deque_pop_head_struct (GstVecDeque * array)
Returns the head of the queue array and removes it from the queue.
Parameters:
array
–
a GstVecDeque object
pointer to element or struct, or NULL if array was empty. The data pointed to by the returned pointer stays valid only as long as the queue array is not modified further!
Since : 1.26
gst_vec_deque_pop_tail
gpointer gst_vec_deque_pop_tail (GstVecDeque * array)
Returns the tail of the queue array and removes it from the queue.
Parameters:
array
–
a GstVecDeque object
The tail of the queue
Since : 1.26
gst_vec_deque_pop_tail_struct
gpointer gst_vec_deque_pop_tail_struct (GstVecDeque * array)
Returns the tail of the queue array and removes it from the queue.
Parameters:
array
–
a GstVecDeque object
The tail of the queue
Since : 1.26
gst_vec_deque_push_sorted
gst_vec_deque_push_sorted (GstVecDeque * array, gpointer data, GCompareDataFunc func, gpointer user_data)
Pushes data to the queue array, finding the correct position by comparing data with each array element using func.
This has a time complexity of O(n), so depending on the size of the queue and expected access patterns, a different data structure might be better.
Assumes that the array is already sorted. If it is not, make sure to call gst_vec_deque_sort first.
Parameters:
array
–
a GstVecDeque object
data
–
object to push
func
–
comparison function
user_data
(
[nullable])
–
data for comparison function
Since : 1.26
gst_vec_deque_push_sorted_struct
gst_vec_deque_push_sorted_struct (GstVecDeque * array, gpointer p_struct, GCompareDataFunc func, gpointer user_data)
Pushes the element at address p_struct into the queue array (copying the contents of a structure of the struct_size specified when creating the queue into the array), finding the correct position by comparing the element at p_struct with each element in the array using func.
This has a time complexity of O(n), so depending on the size of the queue and expected access patterns, a different data structure might be better.
Assumes that the array is already sorted. If it is not, make sure to call gst_vec_deque_sort first.
Parameters:
array
–
a GstVecDeque object
p_struct
–
address of element or structure to push into the queue
func
–
comparison function
user_data
(
[nullable])
–
data for comparison function
Since : 1.26
gst_vec_deque_push_tail
gst_vec_deque_push_tail (GstVecDeque * array, gpointer data)
Pushes data to the tail of the queue array.
Since : 1.26
gst_vec_deque_push_tail_struct
gst_vec_deque_push_tail_struct (GstVecDeque * array, gpointer p_struct)
Parameters:
array
–
p_struct
–
Gst.VecDeque.prototype.push_tail_struct
function Gst.VecDeque.prototype.push_tail_struct(p_struct: Object): {
// javascript wrapper for 'gst_vec_deque_push_tail_struct'
}
Parameters:
Gst.VecDeque.push_tail_struct
def Gst.VecDeque.push_tail_struct (self, p_struct):
#python wrapper for 'gst_vec_deque_push_tail_struct'
Parameters:
gst_vec_deque_set_clear_func
gst_vec_deque_set_clear_func (GstVecDeque * array, GDestroyNotify clear_func)
Sets a function to clear an element of array.
The clear_func will be called when an element in the array data segment is removed and when the array is freed and data segment is deallocated as well. clear_func will be passed a pointer to the element to clear, rather than the element itself.
Note that in contrast with other uses of GDestroyNotify functions, clear_func is expected to clear the contents of the array element it is given, but not free the element itself.
Since : 1.26
gst_vec_deque_sort
gst_vec_deque_sort (GstVecDeque * array, GCompareDataFunc compare_func, gpointer user_data)
Sorts the queue array by comparing elements against each other using the provided compare_func.
Parameters:
array
–
a GstVecDeque object
compare_func
–
comparison function
user_data
(
[nullable])
–
data for comparison function
Since : 1.26
Functions
gst_vec_deque_new
GstVecDeque * gst_vec_deque_new (gsize initial_size)
Allocates a new GstVecDeque object with an initial queue size of initial_size.
Parameters:
initial_size
–
Initial size of the new queue
a new GstVecDeque object
Since : 1.26
gst_vec_deque_new_for_struct
GstVecDeque * gst_vec_deque_new_for_struct (gsize struct_size, gsize initial_size)
Allocates a new GstVecDeque object for elements (e.g. structures) of size struct_size, with an initial queue size of initial_size.
Parameters:
struct_size
–
Size of each element (e.g. structure) in the array
initial_size
–
Initial size of the new queue
a new GstVecDeque object
Since : 1.26
The results of the search are