Commons Library  1.7.0
Cargando...
Buscando...
Nada coincide
queue.h
Ir a la documentación de este archivo.
1/*
2 * Copyright (C) 2012 Sistemas Operativos - UTN FRBA. All rights reserved.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef QUEUE_H_
18#define QUEUE_H_
19
20 #include "list.h"
21
31 typedef struct {
33 } t_queue;
34
44
49
54 void queue_destroy_and_destroy_elements(t_queue*, void(*element_destroyer)(void*));
55
61 void queue_push(t_queue *, void *element);
62
69
76
81
85 void queue_clean_and_destroy_elements(t_queue *, void(*element_destroyer)(void*));
86
91
96
97#endif /*QUEUE_H_*/
#include <commons/collections/list.h>
t_queue * queue_create(void)
Crea una cola.
void queue_push(t_queue *, void *element)
Agrega un elemento al final de la cola.
void * queue_peek(t_queue *)
Devuelve el primer elemento de la cola sin extraerlo.
void * queue_pop(t_queue *)
quita el primer elemento de la cola
void queue_destroy(t_queue *)
Destruye una cola sin liberar los elementos que contiene.
int queue_size(t_queue *)
Devuelve la cantidad de elementos de la cola.
void queue_clean(t_queue *)
Quita todos los elementos de la cola sin liberarlos.
bool queue_is_empty(t_queue *)
Verifica si la cola esta vacía.
void queue_destroy_and_destroy_elements(t_queue *, void(*element_destroyer)(void *))
Destruye una cola, recibiendo como argumento el metodo encargado de liberar cada elemento de la cola.
void queue_clean_and_destroy_elements(t_queue *, void(*element_destroyer)(void *))
Quita y libera todos los elementos de la cola.
Estructura de una lista enlazada. Inicializar con list_create()
Definition list.h:32
Estructura que representa una cola. Inicializar con queue_create()
Definition queue.h:31
t_list * elements
Definition queue.h:32