#import <ObjectiveLib/Vector.h>
Inheritance diagram for OLBoolVector:
Public Member Functions | |
(void) | - assign:filledWith: |
Assign a value to the vector. | |
(void) | - assignAt:value: |
Assign val to the position at index. | |
(void) | - assignFrom:to: |
Assign a range of objects to the vector. | |
(BOOL) | - at: |
Return the bit at index. | |
(BOOL) | - back |
Return the last value in the vector. | |
(OLBitIterator *) | - begin |
Return an iterator pointing to the beginning of the sequence. | |
(unsigned) | - capacity |
Return the current capacity of the vector. | |
(void) | - clear |
Remove all elements. | |
(int) | - compare: |
Compare this vector to another object. | |
(id) | - copy |
Make a copy of this vector. | |
(BOOL) | - empty |
Test whether the vector is empty. | |
(OLBitIterator *) | - end |
Return an iterator pointing to one position beyond the end of the sequence. | |
(OLBitIterator *) | - erase: |
Remove the element designated by where. | |
(OLBitIterator *) | - eraseFrom:to: |
Remove a range of elements. | |
(BOOL) | - front |
Return the first object in the vector. | |
(void) | - insertAt:count:filledWith: |
Insert a number of values into the vector. | |
(void) | - insertAt:from:to: |
Insert a range of values into the vector. | |
(OLBitIterator *) | - insertAt:value: |
Insert a value into the vector. | |
(BOOL) | - isEqual: |
Return whether this vector is equal to another one. | |
(unsigned) | - maxSize |
Return the maxiumum number of elements that can be stored in a vector. | |
(void) | - popBack |
Remove the last element in the vector. | |
(void) | - pushBack: |
Insert value at the end of the sequence. | |
(OLReverseRandomIterator *) | - rbegin |
Return a reverse iterator pointing to the end of the sequence. | |
(OLReverseRandomIterator *) | - rend |
Return a reverse iterator pointing to the beginning of the sequence. | |
(void) | - reserve: |
Reserve storage. | |
(void) | - resize:filledWith: |
Resize the vector to newsize. | |
(unsigned) | - size |
Return the number of elements in the vector. | |
(void) | - swap: |
Swap this vector with another one. | |
(void) | - writeSelfToStream: |
Write the object to a stream. | |
Initializers and Deallocators | |
(id) | - free |
Finalize the vector and deallocate any allocated memory. | |
(id) | - init |
Initialize the vector. | |
(id) | - initFrom:to: |
Initialize the vector. | |
(id) | - initWithBoolVector: |
Initialize the vector. | |
(id) | - initWithCapacity: |
Initialize the vector. | |
(id) | - initWithObjectInStream: |
Initialize the object. | |
(id) | - initWithSize:filledWithBool: |
Initialize the vector. | |
Static Public Member Functions | |
(id) | + boolVector |
Create and return a new vector. | |
(id) | + boolVectorFrom:to: |
Create and return a new vector. | |
(id) | + boolVectorWithBoolVector: |
Create and return a new vector. | |
(id) | + boolVectorWithCapacity: |
Create and return a new vector. | |
(id) | + boolVectorWithSize:filledWithBool: |
Create and return a new vector. | |
Protected Attributes | |
OLBitIteratorBase | begin |
The beginning of the sequence. | |
OLBitIteratorBase | end |
The end of the sequence. | |
uint32_t * | endOfCapacity |
The end of allocated storage. |
The underlying array serves as the data structure for a collection of YES or NO values. The interface is exactly the same as the interface of OLVector, but the data structures used are designed only to store bits.
- (void) assign: | (unsigned) | count | ||
filledWith: | (BOOL) | value | ||
Assign a value to the vector.
The current contents of the vector are removed, and the vector is filled with count elements of value.
count | the number of elements to assign | |
value | the boolean value to insert |
- (void) assignAt: | (unsigned) | index | ||
value: | (BOOL) | val | ||
Assign val to the position at index.
The bit at position index is replaced with val.
index | the index to which to assign | |
val | the boolean value to assign |
- (void) assignFrom: | (OLForwardIterator *) | first | ||
to: | (OLForwardIterator *) | last | ||
Assign a range of objects to the vector.
The current contents of the vector are removed, and all elements in the range [first, last)
are inserted into the vector.
[first, last)
must all respond to the message boolValue
.first | the first in the range of objects to assign | |
last | one beyond the last in the range of objects to assign |
- (BOOL) at: | (unsigned) | index |
Return the bit at index.
YES or NO will be returned depending on whether the bit at index is set.
index | the index of the object to look up |
- (BOOL) back |
Return the last value in the vector.
- (OLBitIterator*) begin |
Return an iterator pointing to the beginning of the sequence.
+ (id) boolVector |
Create and return a new vector.
+ (id) boolVectorFrom: | (OLForwardIterator *) | first | ||
to: | (OLForwardIterator *) | last | ||
Create and return a new vector.
The vector is initialized with the contents of the range [first, last)
.
[first, last)
must all respond to the message boolValue
.first | the first in the range of elements to insert | |
last | one beyond the last in the range of elements to insert |
+ (id) boolVectorWithBoolVector: | (OLBoolVector *) | right |
Create and return a new vector.
The vector is initialized with the contents of right.
right | the bool vector that should be copied into the new one |
+ (id) boolVectorWithCapacity: | (unsigned) | capacity |
Create and return a new vector.
The initial capacity will be no less than capacity.
capacity | the minimum capacity of the new vector |
+ (id) boolVectorWithSize: | (unsigned) | size | ||
filledWithBool: | (BOOL) | value | ||
Create and return a new vector.
The new vector will have a size of size, and each element will be set to value.
size | the size of the new vector | |
value | the value with which to fill the new vector |
- (unsigned) capacity |
Return the current capacity of the vector.
The capacity represents the maximum number of elements that the vector can hold before allocation of new memory will be required.
- (void) clear |
Remove all elements.
- (int) compare: | (id) | other |
Compare this vector to another object.
If the other object is of type OLVector the two vectors are lexicographically compared.
other | the object with which to compare this one |
- (id) copy |
Make a copy of this vector.
- (BOOL) empty |
Test whether the vector is empty.
- (OLBitIterator*) end |
Return an iterator pointing to one position beyond the end of the sequence.
- (OLBitIterator*) erase: | (OLBitIterator *) | where |
Remove the element designated by where.
where | an iterator designating the element to remove |
- (OLBitIterator*) eraseFrom: | (OLBitIterator *) | first | ||
to: | (OLBitIterator *) | last | ||
Remove a range of elements.
All elements in the range [first, last)
will be removed from the vector.
first | the first in the range of elements to remove | |
last | one position beyond the last in the range of elements to remove |
- (id) free |
Finalize the vector and deallocate any allocated memory.
- (BOOL) front |
Return the first object in the vector.
A reference to the object is returned, though the vector still owns the object in question.
- (id) init |
Initialize the vector.
The vector is empty and the capacity is initially zero.
- (id) initFrom: | (OLForwardIterator *) | first | ||
to: | (OLForwardIterator *) | last | ||
Initialize the vector.
The vector inserts all elements referred to in the range [first, last)
.
[first, last)
must all respond to the message boolValue
.first | the first in the range of elements to insert | |
last | one beyond the last in the range of elements to insert |
- (id) initWithBoolVector: | (OLBoolVector *) | bvector |
Initialize the vector.
All of the elements of bvector are copied into the current vector.
bvector | the vector to copy |
- (id) initWithCapacity: | (unsigned) | capacity |
Initialize the vector.
The initial capacity is set to no less than capacity.
capacity | the minimum initial capacity of the vector |
- (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) initWithSize: | (unsigned) | size | ||
filledWithBool: | (BOOL) | value | ||
Initialize the vector.
The initial size of the vector will be size, and value will be copied into the vector size times.
size | the number of elements to insert | |
value | the boolean value to insert |
- (void) insertAt: | (OLBitIterator *) | where | ||
count: | (unsigned) | num | ||
filledWith: | (BOOL) | value | ||
Insert a number of values into the vector.
num values of value will be inserted just before the position referred to by where. Thus, it is valid to use an iterator returned by end as an argument.
where | the position at which to insert the objects | |
num | the number of objects to insert | |
value | the object to be copied into the vector |
- (void) insertAt: | (OLBitIterator *) | where | ||
from: | (OLForwardIterator *) | first | ||
to: | (OLForwardIterator *) | last | ||
Insert a range of values into the vector.
All objects in the range [first, last)
are inserted just before the position referred to by where. Thus, it is valid to use an iterator returned by end as an argument.
[first, last)
must all respond to the message boolValue
.where | the position at which to insert the objects | |
first | the first in the range of objects to insert | |
last | one position beyond the last in the range of objects to insert |
- (OLBitIterator*) insertAt: | (OLBitIterator *) | where | ||
value: | (BOOL) | val | ||
Insert a value into the vector.
val will be inserted just before the position referred to by where. Thus, it is valid to use an iterator returned by end as an argument.
where | the position at which to insert object | |
val | the value to insert |
- (BOOL) isEqual: | (id) | object |
Return whether this vector is equal to another one.
Two vectors are considered equal if they both contain the same number of elements and each element is equal to the corresponding element in the other vector.
object | the object to test |
- (unsigned) maxSize |
Return the maxiumum number of elements that can be stored in a vector.
This limit is theoretical, meaning that there is no guarantee that you can insert this many elements into any given vector. The memory conditions of the run-time system play an important role.
- (void) popBack |
Remove the last element in the vector.
- (void) pushBack: | (BOOL) | value |
Insert value at the end of the sequence.
value | the value to insert |
- (OLReverseRandomIterator*) rbegin |
Return a reverse iterator pointing to the end of the sequence.
Advancing the returned iterator will move backwards through the sequence to the point indicated by the iterator returned by rend.
- (OLReverseRandomIterator*) rend |
Return a reverse iterator pointing to the beginning of the sequence.
This iterator indicates one position beyond the last position that may be referenced by a reverse iterator.
- (void) reserve: | (unsigned) | count |
Reserve storage.
If count is less than the current capacity of the vector, then this message does nothing. If count is greater than the current capacity, then at least count - capacity
elements of storage will be added to the container. This may invalidate iterators that are currently active. This operation will not affect the size, or number of elements actually stored, only the capacity.
count | the total number of desired spaces in the vector |
- (void) resize: | (unsigned) | newsize | ||
filledWith: | (BOOL) | value | ||
Resize the vector to newsize.
If newsize is smaller than the current size, then the sequence will be truncated. If newsize is larger than the current size, then value will be inserted at the end of the vector as many times as necessary to fill the new size.
newsize | the new size of the vector | |
value | the value with which to fill new elements, if necessary |
- (unsigned) size |
Return the number of elements in the vector.
- (void) swap: | (OLBoolVector *) | right |
Swap this vector with another one.
All elements in right will be placed into this vector, and all elements in this vector will be placed in right.
right | the vector with which to swap this one |
- (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 >.
- (OLBitIteratorBase) begin [protected] |
The beginning of the sequence.
- (OLBitIteratorBase) end [protected] |
The end of the sequence.
- (uint32_t*) endOfCapacity [protected] |
The end of allocated storage.
|