BitVector

Engine/source/core/bitVector.h

Manage a vector of bits of arbitrary size.

More...

Size Management

bool

Return true if the bit vector is empty.

setSize(U32 sizeInBits)

Resizes the bit vector.

Returns the size in bits.

Returns the 32bit aligned size in bytes.

Returns the bits.

U8 *

Mutators

Note that bits are specified by index, unlike BitSet32.

set(U32 bit)

Set the specified bit.

set(U32 bit, bool on)

Set the specified bit on or off.

set()

Set all the bits.

clear(U32 bit)

Clear the specified bit.

Clear all the bits.

Does an OR operation between BitVectors.

bool
test(U32 bit)

Test that the specified bit is set.

bool

Test this vector's bits against all the corresponding bits in vector and return true if any of the bits that are set in vector are also set in this vector.

bool

Test this vector's bits against all the corresponding bits in vector and return true if all of the bits that are set in vector are also set in this vector.

bool

Return true if all bits are set.

bool

Return true if all bits are clear.

Protected Attributes

U8 *

The array of bytes that stores our bits.

The allocated size of the bit array.

The size of the vector in bits.

Protected Static Functions

Returns a size in bytes which is 32bit aligned and can hold all the requested bits.

Protected Functions

_resize(U32 sizeInBits, bool copyBits)

Internal function which resizes the bit array.

bool
_test(const BitVector & vector, bool all)

Public Functions

Default constructor which creates an bit vector with a bit size of zero.

Copy constructor.

BitVector(U32 sizeInBits)

Constructs a bit vector with the desired size.

Destructor.

Copy the content of another bit vector.

Copy the contents of another bit vector.

Detailed Description

Manage a vector of bits of arbitrary size.

Size Management

empty()

Return true if the bit vector is empty.

setSize(U32 sizeInBits)

Resizes the bit vector.

note:

The new bits in the vector are not cleared and contain random garbage bits.

getSize()

Returns the size in bits.

getByteSize()

Returns the 32bit aligned size in bytes.

getBits()

Returns the bits.

getBits()

Mutators

Note that bits are specified by index, unlike BitSet32.

set(U32 bit)

Set the specified bit.

set(U32 bit, bool on)

Set the specified bit on or off.

set()

Set all the bits.

clear(U32 bit)

Clear the specified bit.

clear()

Clear all the bits.

combineOR(const BitVector & other)

Does an OR operation between BitVectors.

test(U32 bit)

Test that the specified bit is set.

testAny(const BitVector & vector)

Test this vector's bits against all the corresponding bits in vector and return true if any of the bits that are set in vector are also set in this vector.

Parameters:

vector

Bit vector of the same size.

testAll(const BitVector & vector)

Test this vector's bits against all the corresponding bits in vector and return true if all of the bits that are set in vector are also set in this vector.

Parameters:

vector

Bit vector of the same size.

testAll()

Return true if all bits are set.

testAllClear()

Return true if all bits are clear.

Protected Attributes

U8 * mBits 

The array of bytes that stores our bits.

U32 mByteSize 

The allocated size of the bit array.

U32 mSize 

The size of the vector in bits.

Protected Static Functions

calcByteSize(const U32 numBits)

Returns a size in bytes which is 32bit aligned and can hold all the requested bits.

Protected Functions

_resize(U32 sizeInBits, bool copyBits)

Internal function which resizes the bit array.

_test(const BitVector & vector, bool all)

Public Functions

BitVector()

Default constructor which creates an bit vector with a bit size of zero.

BitVector(const BitVector & r)

Copy constructor.

BitVector(U32 sizeInBits)

Constructs a bit vector with the desired size.

note:

The resulting vector is not cleared.

~BitVector()

Destructor.

copy(const BitVector & from)

Copy the content of another bit vector.

operator=(const BitVector & r)

Copy the contents of another bit vector.