/*
 *  Copyright 2009 OpenSourceStewardshipFoundation.org
 *  Licensed under GNU General Public License version 2
 *
 * Author: hausers@cs.tu-berlin.de
 */

#ifndef _PRIORITY_QUEUE_H
#define _PRIORITY_QUEUE_H

#include <stdbool.h>
#include <stdio.h>

#include "VMS_impl/Services_Offered_by_VMS/Memory_Handling/vmalloc.h"

typedef struct _PrioQueueStruc PrioQueueStruc;
typedef struct _heapNode heapNode;

struct _heapNode {
	int key;
	void *val;
};

struct _PrioQueueStruc {
	int size;
	int maxSize;
	
	heapNode *data;
};

PrioQueueStruc* makePrioQ();
void* getFirstPrioQ (PrioQueueStruc *Q);
void* popPrioQ (PrioQueueStruc *Q);
bool insertPrioQ (void *val, int key, PrioQueueStruc *Q);
void freePrioQ (PrioQueueStruc *Q);
void removePrioQ (int key, PrioQueueStruc *Q);

#ifdef DEBUG
void printPrioQ (PrioQueueStruc *Q);
void swap (PrioQueueStruc *Q, int a, int b);
#endif


#endif

