00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #if !defined(VECTOR_OL_GUARD)
00044 #define VECTOR_OL_GUARD
00045
00046 #include <ObjectiveLib/Iterator.h>
00047 #if defined(OL_HAVE_INTTYPES_H)
00048 #include <inttypes.h>
00049 #else
00050 #include <stdint.h>
00051 #endif
00052
00066 @interface OLVector :
00067 #if defined(OL_NO_OPENSTEP)
00068 Object <OLBackInserter, OLInserter, OLStreamable>
00069 #else
00070 NSObject <OLBackInserter, OLInserter, OLStreamable, NSCopying, NSCoding>
00071 #endif
00072 {
00073 @protected
00077 id* begin;
00078
00082 id* end;
00083
00087 id* endOfCapacity;
00088 }
00089
00098 + (id) vector;
00099
00111 + (id) vectorFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00112
00123 + (id) vectorWithCapacity: (unsigned)capacity;
00124
00136 + (id) vectorWithSize: (unsigned)size filledWith: (id)value;
00137
00148 + (id) vectorWithVector: (OLVector*)right;
00149
00153
00160 - (id) init;
00161
00170 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00171
00178 - (id) initWithCapacity: (unsigned)capacity;
00179
00180 #if !defined(OL_NO_OPENSTEP)
00181
00191 - (id) initWithCoder: (NSCoder*)decoder;
00192 #endif
00193
00194 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00195
00204 - (id) initWithSize: (unsigned)size filledWith: (id)value;
00205
00213 - (id) initWithVector: (OLVector*)vector;
00214
00218 #if defined(OL_NO_OPENSTEP)
00219 - (id) free;
00220 #else
00221 - (void) dealloc;
00222 #endif
00223
00224
00232 - (void) assign: (unsigned)count filledWith: (id)value;
00233
00245 - (void) assignAt: (unsigned)index value: (id)object;
00246
00255 - (void) assignFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00256
00268 - (id) at: (unsigned)index;
00269
00278 - (id) back;
00279
00288 - (OLArrayIterator*) begin;
00289
00296 - (unsigned) capacity;
00297
00301 - (void) clear;
00302
00311 - (int) compare: (id)other;
00312
00313 #if defined(OL_NO_OPENSTEP)
00314
00319 - (id) copy;
00320 #else
00321
00327 - (id) copyWithZone: (NSZone*)zone;
00328 #endif
00329
00335 - (BOOL) empty;
00336
00337 #if !defined(OL_NO_OPENSTEP)
00338
00344 - (void) encodeWithCoder: (NSCoder*)encoder;
00345 #endif
00346
00355 - (OLArrayIterator*) end;
00356
00368 - (OLArrayIterator*) erase: (OLArrayIterator*)where;
00369
00384 - (OLArrayIterator*) eraseFrom: (OLArrayIterator*)first to: (OLArrayIterator*)last;
00385
00394 - (id) front;
00395
00407 - (void) insertAt: (OLArrayIterator*)where count: (unsigned)num filledWith: (id)value;
00408
00418 - (void) insertAt: (OLArrayIterator*)where from: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00419
00434 - (OLArrayIterator*) insertAt: (OLArrayIterator*)where value: (id)object;
00435
00444 - (BOOL) isEqual: (id)object;
00445
00454 - (unsigned) maxSize;
00455
00462 - (void) popBack;
00463
00469 - (void) pushBack: (id)object;
00470
00481 - (OLReverseRandomIterator*) rbegin;
00482
00493 - (OLReverseRandomIterator*) rend;
00494
00504 - (void) reserve: (unsigned)count;
00505
00515 - (void) resize: (unsigned)newsize filledWith: (id)value;
00516
00522 - (unsigned) size;
00523
00530 - (void) swap: (OLVector*)right;
00531
00532 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00533
00534 @end
00535
00545 typedef struct
00546 {
00550 uint32_t* chunk;
00551
00555 uint8_t offset;
00556 } OLBitIteratorBase;
00557
00569 @interface OLBitIterator : OLRandomAccessIterator
00570 {
00571 @protected
00575 OLBitIteratorBase base;
00576 }
00577
00578 - (id) advance;
00579 - (id) advanceBy: (int)count;
00580
00591 - (id) assign: (id)object;
00592 #if defined(OL_NO_OPENSTEP)
00593 - (id) copy;
00594 #else
00595 - (id) copyWithZone: (NSZone*)zone;
00596 #endif
00597
00606 - (id) dereference;
00607 - (int) difference: (OLRandomAccessIterator*)other;
00608 - (BOOL) isEqual: (id)object;
00609 - (id) reverse;
00610
00611 @end
00612
00626 @interface OLBoolVector :
00627 #if defined(OL_NO_OPENSTEP)
00628 Object <OLStreamable>
00629 #else
00630 NSObject <OLStreamable, NSCopying, NSCoding>
00631 #endif
00632 {
00633 @protected
00637 OLBitIteratorBase begin;
00638
00642 OLBitIteratorBase end;
00643
00647 uint32_t* endOfCapacity;
00648 }
00649
00658 + (id) boolVector;
00659
00674 + (id) boolVectorFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00675
00686 + (id) boolVectorWithBoolVector: (OLBoolVector*)right;
00687
00698 + (id) boolVectorWithCapacity: (unsigned)capacity;
00699
00711 + (id) boolVectorWithSize: (unsigned)size filledWithBool: (BOOL)value;
00712
00716
00723 - (id) init;
00724
00736 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00737
00745 - (id) initWithBoolVector: (OLBoolVector*)bvector;
00746
00753 - (id) initWithCapacity: (unsigned)capacity;
00754
00755 #if !defined(OL_NO_OPENSTEP)
00756
00765 - (id) initWithCoder: (NSCoder*)decoder;
00766 #endif
00767
00768 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00769
00778 - (id) initWithSize: (unsigned)size filledWithBool: (BOOL)value;
00779
00783 #if defined(OL_NO_OPENSTEP)
00784 - (id) free;
00785 #else
00786 - (void) dealloc;
00787 #endif
00788
00789
00797 - (void) assign: (unsigned)count filledWith: (BOOL)value;
00798
00810 - (void) assignAt: (unsigned)index value: (BOOL)val;
00811
00823 - (void) assignFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00824
00836 - (BOOL) at: (unsigned)index;
00837
00845 - (BOOL) back;
00846
00855 - (OLBitIterator*) begin;
00856
00863 - (unsigned) capacity;
00864
00868 - (void) clear;
00869
00878 - (int) compare: (id)other;
00879
00880 #if defined(OL_NO_OPENSTEP)
00881
00886 - (id) copy;
00887 #else
00888
00894 - (id) copyWithZone: (NSZone*)zone;
00895 #endif
00896
00902 - (BOOL) empty;
00903
00904 #if !defined(OL_NO_OPENSTEP)
00905
00911 - (void) encodeWithCoder: (NSCoder*)encoder;
00912 #endif
00913
00922 - (OLBitIterator*) end;
00923
00935 - (OLBitIterator*) erase: (OLBitIterator*)where;
00936
00951 - (OLBitIterator*) eraseFrom: (OLBitIterator*)first to: (OLBitIterator*)last;
00952
00961 - (BOOL) front;
00962
00974 - (void) insertAt: (OLBitIterator*)where count: (unsigned)num filledWith: (BOOL)value;
00975
00988 - (void) insertAt: (OLBitIterator*)where from: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00989
01004 - (OLBitIterator*) insertAt: (OLBitIterator*)where value: (BOOL)val;
01005
01014 - (BOOL) isEqual: (id)object;
01015
01024 - (unsigned) maxSize;
01025
01032 - (void) popBack;
01033
01039 - (void) pushBack: (BOOL)value;
01040
01051 - (OLReverseRandomIterator*) rbegin;
01052
01063 - (OLReverseRandomIterator*) rend;
01064
01074 - (void) reserve: (unsigned)count;
01075
01085 - (void) resize: (unsigned)newsize filledWith: (BOOL)value;
01086
01092 - (unsigned) size;
01093
01100 - (void) swap: (OLBoolVector*)right;
01101
01102 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
01103
01104 @end
01105
01106 #endif