#import <ObjectiveLib/BitSet.h>
Inheritance diagram for OLBitSet:
Public Member Functions  
(BOOL)   any 
Test whether any bits are set.  
(OLBitSet *)   bitSetFlipped 
Return a flipped copy of this bit set.  
(OLBitSet *)   bitSetShiftedLeft: 
Return a leftshifted copy of this bit set.  
(OLBitSet *)   bitSetShiftedRight: 
Return a rightshifted copy of this bit set.  
(id)   copy 
Make a copy of this bit set.  
(unsigned)   count 
Return the number of bits set.  
(void)   flip 
Flip all the bits.  
(void)   flip: 
Flip a bit.  
(BOOL)   isEqual: 
Return whether this bit set is equal to another one.  
(void)   logicalAnd: 
Perform a logical "and" operation.  
(void)   logicalOr: 
Perform a logical "or" operation.  
(void)   logicalXor: 
Perform a logical "xor" operation.  
(BOOL)   none 
Test whether no bit is set.  
(void)   reset 
Set every bit to zero.  
(void)   reset: 
Set a bit to zero.  
(void)   set 
Set every bit to one.  
(void)   set: 
Set a bit to one.  
(void)   shiftLeft: 
Shift the bits to the left.  
(void)   shiftRight: 
Shift the bits to the right.  
(unsigned)   size 
Return the number of bits in this set.  
(BOOL)   test: 
Test a bit.  
(char *)   toString 
Return a string describing this bit set.  
(void)   writeSelfToStream: 
Write the object to a stream.  
Initializers and Deallocators  
(id)   free 
Finalize the bit set and deallocate any allocated memory.  
(id)   initWithBitSet: 
Initialize the bit set.  
(id)   initWithObjectInStream: 
Initialize the object.  
(id)   initWithSetSize: 
Initialize the bit set.  
(id)   initWithString:position:count: 
Initialize the bit set.  
(id)   initWithValue: 
Initialize the bit set.  
Static Public Member Functions  
(id)  + bitSetWithBitSet: 
Create and return a new bit set.  
(id)  + bitSetWithSetSize: 
Create and return a new bit set.  
(id)  + bitSetWithString:position:count: 
Create and return a new bit set.  
(id)  + bitSetWithValue: 
Create and return a new bit set.  
Protected Attributes  
unsigned  numberOfBits 
The number of bits.  
unsigned  numberOfWords 
The number of words in the allocated range.  
uint32_t *  words 
The allocated memory for the bit set. 
A bit set is a collection of bits the size of which cannot be changed. Operations typical for bits are provided, which include flipping, testing and performing logical operations on them. A bit set is very similar to a boolean vector except that it does not pretend to be a true container. It does not provide iterators, and therefore cannot be used with generic algorithms.
 (BOOL) any 
Test whether any bits are set.
 (OLBitSet*) bitSetFlipped 
Return a flipped copy of this bit set.
A bit set is created with the same size as this one, and all bits are the opposite of the corresponding bits in this bit set.
 (OLBitSet*) bitSetShiftedLeft:  (unsigned)  count 
Return a leftshifted copy of this bit set.
A bit set is created with the same size as this one, and the bits are set as if all the bits in this set had been shifted to the left by count. The count most significant bits in the returned set will be set to zero.
count  the number of bits to shift to the left 
 (OLBitSet*) bitSetShiftedRight:  (unsigned)  count 
Return a rightshifted copy of this bit set.
A bit set is created with the same size as this one, and the bits are set as if all the bits in this set had been shifted to the right by count. The count least significant bits in the returned set will be set to zero.
count  the number of bits to shift to the right 
+ (id) bitSetWithBitSet:  (OLBitSet *)  bitSet 
Create and return a new bit set.
The new bit set is initialized with the contents of bitSet.
bitSet  the bit set with which to initialize the new one 
+ (id) bitSetWithSetSize:  (unsigned)  bits 
Create and return a new bit set.
The new bit is allocated to contain bits bits, and initially all bits are set to zero.
bits  the number of bits that the new set should be able to address 
+ (id) bitSetWithString:  (const char *)  str  
position:  (unsigned)  pos  
count:  (unsigned)  count  
Create and return a new bit set.
The new bit set is initialized with the contents of str. Working from left to right starting at the position pos in the string, each character is checked. For every index in the bit set starting at zero, if the string's character is '1', then the bit at that index is set, otherwise it remains unset. For example, the string "0101" will produce a bit set of size four where the second and fourth indexes are set and first and third are unset.
str  the string with which to initialize the new bit set  
pos  the position in the string from which to start processing  
count  the number of positions in the string that will be considered 
+ (id) bitSetWithValue:  (uint32_t)  val 
Create and return a new bit set.
The new bit set is initialized using a uint32_t
value. That is, the size of the bit set will be 32 bits and all the bits set in val will be set in the bit set.
val  the uint32_t with which to initialize the bit set 
 (id) copy 
Make a copy of this bit set.
 (unsigned) count 
Return the number of bits set.
Any bit in the bit set is that is not zero is added to the total count which is returned.
 (void) flip 
Flip all the bits.
The bit set is tranformed into a bit set that is the logical opposite of this one. All bits that were zero will be one and vice versa.
 (void) flip:  (unsigned)  pos 
Flip a bit.
The bit at index pos is flipped. That is, if it was one it will be zero and vice versa.
pos  the bit position to flip 
 (id) free 
Finalize the bit set and deallocate any allocated memory.
 (id) initWithBitSet:  (OLBitSet *)  bitSet 
Initialize the bit set.
All of the bits are copied from bitSet.
bitSet  the bit set with which to initialize this one 
 (id) initWithObjectInStream:  (OLObjectInStream *)  stream 
Initialize the object.
Each instance variable is read from stream and all other initialization is performed.
stream  the stream from which to read 
Reimplemented from < OLStreamable >.
 (id) initWithSetSize:  (unsigned)  bits 
Initialize the bit set.
Enough memory is allocated to account for bits bits, and initially all bits are set to zero.
bits  the number of bits that this set should be able to address 
 (id) initWithString:  (const char *)  str  
position:  (unsigned)  pos  
count:  (unsigned)  count  
Initialize the bit set.
A special string is used to initialize the bit set. Working from left to right starting at the position pos in the string, each character is checked. For every index in the bit set starting at zero, if the string's character is '1', then the bit at that index is set, otherwise it remains unset. For example, the string "0101" will produce a bit set of size four where the second and fourth indexes are set and first and third are unset.
str  the string with which to initialize the bit set  
pos  the position in the string from which to start processing  
count  the number of positions in the string that will be considered 
 (id) initWithValue:  (uint32_t)  val 
Initialize the bit set.
The bit set is initialized using a uint32_t
value. That is, the size of the bit set will be the size of a uint32_t
(that's 32 bits, if you're a little slow), and all the bits set in val will be set in the bit set.
val  the uint32_t with which to initialize the bit set 
 (BOOL) isEqual:  (id)  object 
Return whether this bit set is equal to another one.
The bit sets are considered equal if they have the same size and if they share the same set bits.
object  the object to test 
 (void) logicalAnd:  (OLBitSet *)  right 
Perform a logical "and" operation.
If bits in both sets are set at the same position, then the bit in this set will remain set, otherwise it will be unset. The two bit sets do not have to be the same size. The number of bits used in the operation is the smaller of the sizes of the two bit sets. All other bits are ignored.
right  the bit set with which to "and" this one 
 (void) logicalOr:  (OLBitSet *)  right 
Perform a logical "or" operation.
If either bit in both sets is set at the same position, then the bit in this set will be set, otherwise it will be unset. The two bit sets do not have to be the same size. The number of bits used in the operation is the smaller of the sizes of the two bit sets. All other bits are ignored.
right  the bit set with which to "and" this one 
 (void) logicalXor:  (OLBitSet *)  right 
Perform a logical "xor" operation.
If either bit in both sets is set at the same position but not both bits, then the bit in this set will be set, otherwise it will be unset. The two bit sets do not have to be the same size. The number of bits used in the operation is the smaller of the sizes of the two bit sets. All other bits are ignored.
right  the bit set with which to "and" this one 
 (BOOL) none 
Test whether no bit is set.
 (void) reset 
Set every bit to zero.
 (void) reset:  (unsigned)  pos 
Set a bit to zero.
The bit at index pos will be set to zero.
pos  the bit position to reset 
 (void) set 
Set every bit to one.
 (void) set:  (unsigned)  pos 
Set a bit to one.
The bit at index pos will be set to one.
pos  the bit position to set 
 (void) shiftLeft:  (unsigned)  count 
Shift the bits to the left.
The bits will be shifted to the left by count positions. The most significant count bits will be set to zero.
count  the number of positions by which to shift the bits 
 (void) shiftRight:  (unsigned)  count 
Shift the bits to the right.
The bits will be shifted to the right by count positions. The least significant count bits will be set to zero.
count  the number of positions by which to shift the bits 
 (unsigned) size 
Return the number of bits in this set.
 (BOOL) test:  (unsigned)  pos 
Test a bit.
The bit at index pos is tested.
pos  the bit position to reset 
 (char*) toString 
Return a string describing this bit set.
A nullterminated string is returned in which each character is set according to the corresponding bit in this bit set. If a bit in the bit set is one, then the string has the character '1', otherwise the string's character is '0'. The string returned can be used as an argument to the message initWithString:position:count: to create a copy of this bit set.
 (void) writeSelfToStream:  (OLObjectOutStream *)  stream 
Write the object to a stream.
All instance variables are written to stream.
stream  the stream to which to write. 
Reimplemented from < OLStreamable >.
 (unsigned) numberOfBits [protected] 
The number of bits.
 (unsigned) numberOfWords [protected] 
The number of words in the allocated range.
 (uint32_t*) words [protected] 
The allocated memory for the bit set.
