typedef DLListElement DequeElement; typedef DLList Deque; The Deque data structure represents a double ended queue (deque, for short ) and it is a front-end to the DLList data structure. |
| Deque* deque_create(destroyfunc*
destroy, comparefunc* cmp) description: creates a new, empty deque. The destroy parameter is a pointer to a user-defined destroyfunc. This function will be used by deque_destroy to free dynamically allocated data. If the data to be inserted in the queue should not be freed, destroy should be set to NULL. The cmp parameter is a pointer to a user-defined comparefunc. This function will be used by the deque_element_is_member function to compare the deque elements. If deque_element_is_member won't be necessary, cmp should be set to NULL. return value: a pointer to a new Deque data structure, or NULL if the allocation fails. since: YACLib 1.1 int deque_push_front(Deque* queue, const void* data) description: pushes an element onto the front of the deque specified by deque. The new element will store a pointer to data. return value: 0 if the element could be pushed, -1 otherwise. since: YACLib 1.1 int deque_push_end(Deque* queue, const void* data) description: pushes an element onto the end of the deque specified by deque. The new element will store a pointer to data. return value: 0 if the element could be pushed, -1 otherwise. since: YACLib 1.1 int deque_pop_front(Deque* queue, void** data) description: pops an element off the front of the deque specified by deque. Upon return, data points to the data stored in the element that was popped. return value: 0 if the element could be popped, -1 otherwise. int deque_pop_end(Deque* queue, void** data) description: pops an element off the end of the deque specified by deque. Upon return, data points to the data stored in the element that was popped. return value: 0 if the element could be popped, -1 otherwise. since: YACLib 1.1 void deque_pop_all(Deque* queue, void** data) description: pops all elements off the deque specified by deque. return value: none. since: YACLib 1.1 int deque_element_is_member(const Deque* deque, const void* data) description: searches for an element matching data in the deque specified by deque. return value: 1 if an element matching data was found, 0 othrewise. since: YACLib 1.1 void deque_destroy(Deque* deque) description: destroys the deque specified by deque. It will remove all the elements from the deque and call the destroyfunc function passed to deque_create for each element as it is removed from the deque, provided destroy wasn't set to NULL. return value: none. since: YACLib 1.1 DequeElement* deque_first(const Deque* deque) description: macro that evaluates to the first element of the deque specified by deque. return value: the first element of deque. since: YACLib 1.1 DequeElement* deque_last(const Deque* deque) description: macro that evaluates to the last element of the deque specified by deque. return value: the last element of deque. since: YACLib 1.1 int deque_size(const Deque* deque) description: macro that evaluates to the number of elements in the deque specified by deque. return value: the number of elements in deque. since: YACLib 1.1 DequeElement* deque_element_next(const DequeElement* element) description: macro that evaluates to the next pointer of the deque element specified by element. return value: the next pointer of element. since: YACLib 1.1 DequeElement* deque_element_prev(const DequeElement* element) description: macro that evaluates to the prev pointer of the deque element specified by element. return value: the prev pointer of element. since: YACLib 1.1 void* deque_element_data(const DequeElement* element) description: macro that evaluates to the data pointer of the deque element specified by element. return value: the data pointer of element. since: YACLib 1.1 |