00001 /* 00002 * Copyright 2008, 2009 Alexandros Frantzis, Michael Iatrou 00003 * 00004 * This file is part of libbls. 00005 * 00006 * libbls is free software: you can redistribute it and/or modify it under the 00007 * terms of the GNU Lesser General Public License as published by the Free Software 00008 * Foundation, either version 3 of the License, or (at your option) any later 00009 * version. 00010 * 00011 * libbls is distributed in the hope that it will be useful, but WITHOUT ANY 00012 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00013 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00014 * details. 00015 * 00016 * You should have received a copy of the GNU General Public License along with 00017 * libbls. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 /** 00021 * @file priority_queue.h 00022 * 00023 * Priority queue API 00024 */ 00025 00026 #ifndef _BLESS_PRIORITY_QUEUE_H 00027 #define _BLESS_PRIORITY_QUEUE_H 00028 00029 #include <sys/types.h> 00030 00031 /** 00032 * @defgroup priority_queue Priority Queue 00033 * 00034 * A max-priority queue. 00035 * 00036 * @{ 00037 */ 00038 00039 /** 00040 * Opaque data type for a priority queue. 00041 */ 00042 typedef struct priority_queue priority_queue_t; 00043 00044 int priority_queue_new(priority_queue_t **pq, size_t size); 00045 00046 int priority_queue_free(priority_queue_t *pq); 00047 00048 int priority_queue_add(priority_queue_t *pq, void *data, int key, size_t *pos); 00049 00050 int priority_queue_remove_max(priority_queue_t *pq, void **data); 00051 00052 int priority_queue_change_key(priority_queue_t *pq, size_t pos, int key); 00053 00054 int priority_queue_get_size(priority_queue_t *pq, size_t *size); 00055 00056 /** @} */ 00057 00058 #endif