Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

priority_queue.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <platform.h>
#include <earthworm.h>
#include <earthworm_complex_funcs.h>
#include <priority_queue.h>

Go to the source code of this file.

Defines

#define EW_PRI_SHIFT_DOWN   -1
#define EW_PRI_SHIFT_NONE   0
#define EW_PRI_SHIFT_UP   1

Functions

int init_pri_queue (PRI_QUEUE *p_queue, unsigned long p_max_items, unsigned long p_max_item_size)
void release_pri_queue (PRI_QUEUE *p_queue)
int getNumOfElementsInQueue (PRI_QUEUE *p_queue)
int add_item (PRI_QUEUE *p_queue, EW_PRIORITY p_priority, MSG_LOGO p_logo, long p_size, PRI_DATA p_data)
int peek_next_item (PRI_QUEUE *p_queue, MSG_LOGO *p_logoptr, EW_PRIORITY *p_priptr)
int pop_next_item (PRI_QUEUE *p_queue, MSG_LOGO *p_logoptr, long *p_sizeptr, PRI_DATA p_data)


Define Documentation

#define EW_PRI_SHIFT_DOWN   -1
 

Definition at line 40 of file priority_queue.c.

Referenced by add_item().

#define EW_PRI_SHIFT_NONE   0
 

Definition at line 41 of file priority_queue.c.

Referenced by add_item().

#define EW_PRI_SHIFT_UP   1
 

Definition at line 42 of file priority_queue.c.

Referenced by add_item().


Function Documentation

int add_item PRI_QUEUE   p_queue,
EW_PRIORITY    p_priority,
MSG_LOGO    p_logo,
long    p_size,
PRI_DATA    p_data
 

Definition at line 219 of file priority_queue.c.

References PRI_QUEUE_ENTRY::data, EW_PRI_RETBADPRI, EW_PRI_RETDROP, EW_PRI_RETNORMAL, EW_PRI_RETREJECT, EW_PRI_SHIFT_DOWN, EW_PRI_SHIFT_NONE, EW_PRI_SHIFT_UP, EW_PRIORITY, EW_PRIORITY_COUNT, EW_PRIORITY_DEF, EW_PRIORITY_MAX, EW_PRIORITY_MIN, PRI_QUEUE::insert_indices, MSG_LOGO::instid, PRI_QUEUE::itemmaxsize, PRI_QUEUE::itemsused, PRI_QUEUE_ENTRY::length, PRI_QUEUE::lock, logit(), PRI_QUEUE_ENTRY::logo, MSG_LOGO::mod, PRI_QUEUE_ENTRY::pri, PRI_QUEUE::queuesize, ReleaseSpecificMutex(), RequestSpecificMutex(), PRI_QUEUE::sorted, and MSG_LOGO::type.

int getNumOfElementsInQueue PRI_QUEUE   p_queue
 

Definition at line 207 of file priority_queue.c.

References PRI_QUEUE::itemsused.

int init_pri_queue PRI_QUEUE   p_queue,
unsigned long    p_max_items,
unsigned long    p_max_item_size
 

Definition at line 48 of file priority_queue.c.

References CreateSpecificMutex(), PRI_QUEUE::data, PRI_QUEUE_ENTRY::data, PRI_QUEUE::entries, EW_PRI_RETMALLOC, EW_PRI_RETNORMAL, EW_PRI_RETPARAM, EW_PRI_RETQNULL, EW_PRIORITY_COUNT, EW_PRIORITY_NONE, PRI_QUEUE::insert_indices, PRI_QUEUE::itemmaxsize, PRI_QUEUE::itemsused, PRI_QUEUE_ENTRY::length, PRI_QUEUE::lock, logit(), PRI_QUEUE_ENTRY::pri, PRI_QUEUE::queuesize, release_pri_queue(), and PRI_QUEUE::sorted.

int peek_next_item PRI_QUEUE   p_queue,
MSG_LOGO   p_logoptr,
EW_PRIORITY   p_priptr
 

Definition at line 489 of file priority_queue.c.

References EW_PRI_NOITEM, EW_PRI_RETNORMAL, EW_PRIORITY_NONE, MSG_LOGO::instid, PRI_QUEUE::lock, PRI_QUEUE_ENTRY::logo, MSG_LOGO::mod, PRI_QUEUE_ENTRY::pri, PRI_QUEUE::queuesize, ReleaseSpecificMutex(), RequestSpecificMutex(), PRI_QUEUE::sorted, and MSG_LOGO::type.

int pop_next_item PRI_QUEUE   p_queue,
MSG_LOGO   p_logoptr,
long *    p_sizeptr,
PRI_DATA    p_data
 

Definition at line 541 of file priority_queue.c.

References PRI_QUEUE_ENTRY::data, EW_PRI_NOITEM, EW_PRI_RETNORMAL, EW_PRIORITY_COUNT, EW_PRIORITY_NONE, PRI_QUEUE::insert_indices, MSG_LOGO::instid, PRI_QUEUE::itemsused, PRI_QUEUE_ENTRY::length, PRI_QUEUE::lock, logit(), PRI_QUEUE_ENTRY::logo, MSG_LOGO::mod, PRI_QUEUE_ENTRY::pri, PRI_QUEUE::queuesize, ReleaseSpecificMutex(), RequestSpecificMutex(), PRI_QUEUE::sorted, and MSG_LOGO::type.

void release_pri_queue PRI_QUEUE   p_queue
 

Definition at line 178 of file priority_queue.c.

References CloseSpecificMutex(), PRI_QUEUE::data, PRI_QUEUE::entries, PRI_QUEUE::itemsused, PRI_QUEUE::lock, PRI_QUEUE::queuesize, and PRI_QUEUE::sorted.

Referenced by init_pri_queue().


Generated on Tue May 6 09:16:18 2003 for Earthworm Libs by doxygen1.3-rc3