home *** CD-ROM | disk | FTP | other *** search
- head 1.3;
- branch ;
- access ;
- symbols ;
- locks ediger:1.3;
- comment @ * @;
-
-
- 1.3
- date 94.05.23.20.33.04; author ediger; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 94.05.15.18.55.28; author ediger; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 94.05.14.17.44.50; author ediger; state Exp;
- branches ;
- next ;
-
-
- desc
- @simple stack and/or queue object implemented via doubly linked lists
- @
-
-
- 1.3
- log
- @better comments
- @
- text
- @#ifndef _QUEUE_H
- #define _QUEUE_H
-
- //H+
- // A first-in, first-out queue, or last-in, first-out stack.
- //
- // Holds a series of (void *)pointers for generality, but may require
- // casting to get the push: method to compile clean.
- //
- // $Id: Queue.h,v 1.2 94/05/15 18:55:28 ediger Exp Locker: ediger $
- /* $Log: Queue.h,v $
- * Revision 1.2 94/05/15 18:55:28 ediger
- * remove a method namespace clash by changing -empty to -isEmpty.
- *
- * Revision 1.1 94/05/14 17:44:50 ediger
- * Initial revision
- *
- */
- //H-
-
- #import <objc/Object.h>
-
- // Here's the data structure for the implementation: a doubly-linked list.
- // Elaborate struct tag to avoid name-space collisions.
- struct qs_internal_node {
- struct qs_internal_node *prev;
- struct qs_internal_node *next;
- void *ptr;
- };
-
- // It's possible that the ptr member should be a union of all
- // inherent Obj-C datatypes. That would certainly ensure that
- // enough space is reserved for the stored data. Doing the class
- // with that data would require "typed" pushes and pops, wouldn't it?
- // At least to avoid casting the data on pushes or pops.
-
- @@interface Queue: Object
- {
- struct qs_internal_node *head;
- struct qs_internal_node *tail;
- }
-
- - init;
- - push:(void *)something; // put something on end of container
- -(void *)first; // FIFO access to container
- -(void *)pop; // LIFO access to container
- -(void *)head; // peek at what's at the head of container
- -(void *)tail; // peek at what's at the tail of container
- -(BOOL)isEmpty; // check if container has something in it.
- - free; // deallocate implementation of container
-
- @@end
-
- #endif /* _QUEUE_H */
- @
-
-
- 1.2
- log
- @remove a method namespace clash by changing -empty to -isEmpty.
- @
- text
- @d10 1
- a10 1
- // $Id: Queue.h,v 1.1 94/05/14 17:44:50 ediger Exp Locker: ediger $
- d12 3
- d23 2
- a24 2
- // here's the implementation: a doubly-linked list.
- // elaborate struct tag to avoid name-space collisions.
- d28 1
- a28 1
- void *ptr;
- d30 6
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d10 5
- a14 2
- // $Id$
- /* $Log$
- d38 3
- a40 3
- -(void *)head; // peek at what's on the head of container
- -(void *)tail; // peek at what's on the tail of container
- -(BOOL)empty; // check if container has something in it.
- @
-