ftp.nice.ch/pub/next/tools/hack/MachOViewer.NIHS.bs.tar.gz#/MachOViewer/Source/Queue.h

This is Queue.h in view mode; [Download] [Up]

#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.3 94/05/23 20:33:04 ediger Exp Locker: ediger $
/*	$Log:	Queue.h,v $
 * Revision 1.3  94/05/23  20:33:04  ediger
 * better comments
 * 
 * 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 */

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.