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(BITSET_OL_GUARD)
00044 #define BITSET_OL_GUARD
00045
00046 #include <ObjectiveLib/ObjectBase.h>
00047 #if defined(OL_HAVE_INTTYPES_H)
00048 #include <inttypes.h>
00049 #else
00050 #include <stdint.h>
00051 #endif
00052
00067 @interface OLBitSet :
00068 #if defined(OL_NO_OPENSTEP)
00069 Object <OLStreamable>
00070 #else
00071 NSObject <OLStreamable, NSCopying, NSCoding>
00072 #endif
00073 {
00074 @protected
00078 uint32_t* words;
00079
00083 unsigned numberOfBits;
00084
00088 unsigned numberOfWords;
00089 }
00090
00101 + (id) bitSetWithBitSet: (OLBitSet*)bitSet;
00102
00113 + (id) bitSetWithSetSize: (unsigned)bits;
00114
00132 + (id) bitSetWithString: (const char*)str position: (unsigned)pos count: (unsigned)count;
00133
00145 + (id) bitSetWithValue: (uint32_t)val;
00146
00150
00157 - (id) initWithBitSet: (OLBitSet*)bitSet;
00158
00159 #if !defined(OL_NO_OPENSTEP)
00160
00169 - (id) initWithCoder: (NSCoder*)decoder;
00170 #endif
00171
00172 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00173
00181 - (id) initWithSetSize: (unsigned)bits;
00182
00196 - (id) initWithString: (const char*)str position: (unsigned)pos count: (unsigned)count;
00197
00207 - (id) initWithValue: (uint32_t)val;
00208
00212 #if defined(OL_NO_OPENSTEP)
00213 - (id) free;
00214 #else
00215 - (void) dealloc;
00216 #endif
00217
00218
00224 - (BOOL) any;
00225
00236 - (OLBitSet*) bitSetFlipped;
00237
00251 - (OLBitSet*) bitSetShiftedLeft: (unsigned)count;
00252
00266 - (OLBitSet*) bitSetShiftedRight: (unsigned)count;
00267
00268 #if defined(OL_NO_OPENSTEP)
00269
00274 - (id) copy;
00275 #else
00276
00282 - (id) copyWithZone: (NSZone*)zone;
00283 #endif
00284
00291 - (unsigned) count;
00292
00293 #if !defined(OL_NO_OPENSTEP)
00294
00300 - (void) encodeWithCoder: (NSCoder*)encoder;
00301 #endif
00302
00307 - (void) flip;
00308
00319 - (void) flip: (unsigned)pos;
00320
00328 - (BOOL) isEqual: (id)object;
00329
00339 - (void) logicalAnd: (OLBitSet*)right;
00340
00350 - (void) logicalOr: (OLBitSet*)right;
00351
00361 - (void) logicalXor: (OLBitSet*)right;
00362
00368 - (BOOL) none;
00369
00373 - (void) reset;
00374
00384 - (void) reset: (unsigned)pos;
00385
00389 - (void) set;
00390
00400 - (void) set: (unsigned)pos;
00401
00408 - (void) shiftLeft: (unsigned)count;
00409
00416 - (void) shiftRight: (unsigned)count;
00417
00423 - (unsigned) size;
00424
00434 - (BOOL) test: (unsigned)pos;
00435
00448 - (char*) toString;
00449
00450 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00451
00452 @end
00453
00454 #endif