Bristol Wearable Computing

[ Home | Plans | Meetings | Members | Search | Papers | Links | CyberWear | LocoSoft]


QUEUE.h

Queue's an infinite number of datatypes specified as TYPE

 

/* Queue.h
* Alistair Mann
* 3/8/98
*
* A general purpose Q ADT for data types
* specified as TYPE
*/

#ifndef QUEUE_H
#define QUEUE_H

/* choose your data type! */
typedef long TYPE;

/* pass one of these enumerators to displayQ to display the standard Q'd datatypes */
typedef enum { integer, flt, longfloat, longint } PrintTypes;

/* the Q data type */
typedef struct queue Queue;


/* creating and destroying Q's */
Queue *newQ( ); /* NULL on memory error */
void destroyQ(Queue *q);

/* adding and removing Q'd elements */
int addQ(Queue *q, TYPE new); /* 1 on success, 0 on failure */
TYPE *frontQ(Queue *q); /* return's pointer to malloc'd type NULL if no Q'd items */

/* is our Q empty? */
int isEmptyQ(Queue *q); /* Bool: 1 on yes, 0 on no */

/* display the Q'd elements */
/* if they are numbers */
void displayQ(Queue *q, PrintTypes type);

#endif


unicrest.gif (4191 bytes)

The material displayed is provided 'as is' and is subject to use restrictions.
For problems or questions regarding this web contact Cliff Randell.
Last updated: January 14, 2000.
logoep.gif (1404 bytes)
ęCopyright Hewlett-Packard 1997-2000.