Deque.h

00001 //
00002 // $Id: Deque.h,v 1.32 2007/03/06 20:42:19 will_mason Exp $
00003 //
00004 // vi: set ft=objc:
00005 
00006 /*
00007  * ObjectiveLib - a library of containers and algorithms for Objective-C
00008  *
00009  * Copyright (c) 2004-2007
00010  * Will Mason
00011  *
00012  * Portions:
00013  *
00014  * Copyright (c) 1994
00015  * Hewlett-Packard Company
00016  *
00017  * Copyright (c) 1996,1997
00018  * Silicon Graphics Computer Systems, Inc.
00019  *
00020  * Copyright (c) 1997
00021  * Moscow Center for SPARC Technology
00022  *
00023  * Copyright (c) 1999 
00024  * Boris Fomitchev
00025  *
00026  * This library is free software; you can redistribute it and/or
00027  * modify it under the terms of the GNU Lesser General Public
00028  * License as published by the Free Software Foundation; either
00029  * version 2.1 of the License, or (at your option) any later version.
00030  *
00031  * This library is distributed in the hope that it will be useful,
00032  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00033  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00034  * Lesser General Public License for more details.
00035  *
00036  * You should have received a copy of the GNU Lesser General Public
00037  * License along with this library; if not, write to the Free Software
00038  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00039  *
00040  * You may contact the author at will_mason@users.sourceforge.net.
00041  */
00042 
00043 #if !defined(DEQUE_OL_GUARD)
00044 #define DEQUE_OL_GUARD
00045 
00046 #include <ObjectiveLib/Iterator.h>
00047 
00058 @interface OLDequeIterator : OLRandomAccessIterator
00059 {
00060 @protected
00064     id*     current;
00065 
00069     id*     first;
00070 
00074     id*     last;
00075 
00079     id**    node;
00080 }
00081 
00082 - (id) advance;
00083 - (id) advanceBy: (int)count;
00084 - (id) assign: (id)object;
00085 #if defined(OL_NO_OPENSTEP)
00086 - (id) copy;
00087 #else
00088 - (id) copyWithZone: (NSZone*)zone;
00089 #endif
00090 - (id) dereference;
00091 - (int) difference: (OLRandomAccessIterator*)other;
00092 - (BOOL) isEqual: (id)object;
00093 - (id) reverse;
00094 
00095 @end
00096 
00110 @interface OLDeque :
00111 #if defined(OL_NO_OPENSTEP)
00112     Object <OLBackInserter, OLFrontInserter, OLInserter, OLStreamable>
00113 #else
00114     NSObject  <OLBackInserter, OLFrontInserter, OLInserter, OLStreamable, NSCopying, NSCoding>
00115 #endif
00116 {
00117 @protected
00121     OLDequeIterator*    start;
00122 
00126     OLDequeIterator*    finish;
00127 
00131     id**                map;
00132 
00136     unsigned            mapSize;
00137 }
00138 
00147 + (id) deque;
00148 
00160 + (id) dequeFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00161 
00172 + (id) dequeWithDeque: (OLDeque*)right;
00173 
00185 + (id) dequeWithSize: (unsigned)size filledWith: (id)value;
00186 
00190 /* @{ */
00196 - (id) init;
00197 
00206 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00207 
00208 #if !defined(OL_NO_OPENSTEP)
00209 
00219 - (id) initWithCoder: (NSCoder*)decoder;
00220 #endif
00221 
00228 - (id) initWithDeque: (OLDeque*)deque;
00229 
00230 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00231 
00240 - (id) initWithSize: (unsigned)count filledWith: (id)value;
00241 
00245 #if defined(OL_NO_OPENSTEP)
00246 - (id) free;
00247 #else
00248 - (void) dealloc;
00249 #endif
00250 /* @} */
00251 
00259 - (void) assign: (unsigned)count filledWith: (id)value;
00260 
00272 - (void) assignAt: (unsigned)index value: (id)object;
00273 
00282 - (void) assignFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00283 
00295 - (id) at: (unsigned)index;
00296 
00305 - (id) back;
00306 
00315 - (OLDequeIterator*) begin;
00316 
00320 - (void) clear;
00321 
00331 - (int) compare: (id)other;
00332 
00333 #if defined(OL_NO_OPENSTEP)
00334 
00339 - (id) copy;
00340 #else
00341 
00347 - (id) copyWithZone: (NSZone*)zone;
00348 #endif
00349 
00355 - (BOOL) empty;
00356 
00357 #if !defined(OL_NO_OPENSTEP)
00358 
00364 - (void) encodeWithCoder: (NSCoder*)encoder;
00365 #endif
00366 
00375 - (OLDequeIterator*) end;
00376 
00388 - (OLDequeIterator*) erase: (OLDequeIterator*)where;
00389 
00404 - (OLDequeIterator*) eraseFrom: (OLDequeIterator*)first to: (OLDequeIterator*)last;
00405 
00414 - (id) front;
00415 
00427 - (void) insertAt: (OLDequeIterator*)where count: (unsigned)num filledWith: (id)value;
00428 
00438 - (void) insertAt: (OLDequeIterator*)where from: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00439 
00454 - (OLDequeIterator*) insertAt: (OLDequeIterator*)where value: (id)object;
00455 
00464 - (BOOL) isEqual: (id)object;
00465 
00474 - (unsigned) maxSize;
00475 
00482 - (void) popBack;
00483 
00490 - (void) popFront;
00491 
00497 - (void) pushBack: (id)object;
00498 
00504 - (void) pushFront: (id)object;
00505 
00516 - (OLReverseRandomIterator*) rbegin;
00517 
00528 - (OLReverseRandomIterator*) rend;
00529 
00539 - (void) resize: (unsigned)newsize filledWith: (id)value;
00540 
00546 - (unsigned) size;
00547 
00554 - (void) swap: (OLDeque*)right;
00555 
00556 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00557 
00558 @end
00559 
00560 #endif

ObjectiveLibGenerated Sun Apr 22 15:17:58 2007, © 2004-2007 Will Mason
SourceForge.net Logo