RLib  5.7
RLib - an opensource, lightweight and multi-platform framework for cpp programming
System::Collections::BitArray Class Reference

A vector of bits. Use this to store bits efficiently, without having to do bit shifting yourself More...

Classes

struct  Indexer
 

Public Member Functions

 BitArray (intptr_t length)
 Allocates space to hold length bit values. All of the values in the bit array are set to false. More...
 
 BitArray (intptr_t length, bool defaultValue)
 Allocates space to hold length bit values. All of the values in the bit array are set to defaultValue. More...
 
 BitArray (const unsigned char bytes[], intptr_t bytes_length)
 Allocates space to hold the bit values in bytes. bytes[0] represents bits 0 - 7, bytes[1] represents bits 8 - 15, etc.The LSB of each byte represents the lowest index value; bytes[0] & 1 represents bit 0, bytes[0] & 2 represents bit 1, bytes[0] & 4 represents bit 2, etc. More...
 
 BitArray (const bool values[], intptr_t values_length)
 Allocates space to hold the bit values in bytes. values[0] represents bits 0, values[1] represents bits 1, etc. More...
 
 BitArray (const int values[], intptr_t values_length)
 Allocates space to hold the bit values in values. values[0] represents bits 0 - 31, values[1] represents bits 32 - 63, etc.The LSB of each integer represents the lowest index value; values[0] & 1 represents bit 0, values[0] & 2 represents bit 1, values[0] & 4 represents bit 2, etc. More...
 
 BitArray (const BitArray &bits)
 Allocates a new BitArray with the same length and bit values as bits. More...
 
 BitArray (const BitArray &&bits)
 
BitArrayoperator= (const BitArray &bits)
 
BitArrayoperator= (const BitArray &&bits)
 
BitArrayoperator&= (const BitArray *value)
 
BitArrayoperator|= (const BitArray *value)
 
BitArrayoperator^= (const BitArray *value)
 
BitArrayoperator~ ()
 
BitArrayAnd (const BitArray *value)
 Returns a reference to the current instance ANDed with value. More...
 
BitArrayOr (const BitArray *value)
 Returns a reference to the current instance ORed with value. More...
 
BitArrayXor (const BitArray *value)
 Returns a reference to the current instance XORed with value. More...
 
BitArrayNot ()
 Inverts all the bit values. On/true bit values are converted to off / false.Off / false bit values are turned on / true.The current instance is updated and returned. More...
 
bool Get (intptr_t index) const
 Returns the bit value at position index. More...
 
void Set (intptr_t index, bool value)
 Sets the bit value at position index to value. More...
 
void SetAll (bool value)
 Sets all the bit values to value. More...
 
intptr_t GetLength () const
 Gets the number of elements in the BitArray. More...
 
void SetLength (intptr_t length)
 Sets the number of elements in the BitArray. More...
 
 RLIB_PROPERTY_GET_SET (intptr_t Length, GetLength, SetLength)
 Gets or sets the number of elements in the BitArray. More...
 
Indexer operator[] (intptr_t index)
 
bool operator[] (intptr_t index) const
 

Detailed Description

A vector of bits. Use this to store bits efficiently, without having to do bit shifting yourself

Constructor & Destructor Documentation

BitArray::BitArray ( intptr_t  length)

Allocates space to hold length bit values. All of the values in the bit array are set to false.

BitArray::BitArray ( intptr_t  length,
bool  defaultValue 
)

Allocates space to hold length bit values. All of the values in the bit array are set to defaultValue.

BitArray::BitArray ( const unsigned char  bytes[],
intptr_t  bytes_length 
)

Allocates space to hold the bit values in bytes. bytes[0] represents bits 0 - 7, bytes[1] represents bits 8 - 15, etc.The LSB of each byte represents the lowest index value; bytes[0] & 1 represents bit 0, bytes[0] & 2 represents bit 1, bytes[0] & 4 represents bit 2, etc.

BitArray::BitArray ( const bool  values[],
intptr_t  values_length 
)

Allocates space to hold the bit values in bytes. values[0] represents bits 0, values[1] represents bits 1, etc.

BitArray::BitArray ( const int  values[],
intptr_t  values_length 
)

Allocates space to hold the bit values in values. values[0] represents bits 0 - 31, values[1] represents bits 32 - 63, etc.The LSB of each integer represents the lowest index value; values[0] & 1 represents bit 0, values[0] & 2 represents bit 1, values[0] & 4 represents bit 2, etc.

BitArray::BitArray ( const BitArray bits)

Allocates a new BitArray with the same length and bit values as bits.

Member Function Documentation

BitArray & BitArray::And ( const BitArray value)

Returns a reference to the current instance ANDed with value.

bool BitArray::Get ( intptr_t  index) const

Returns the bit value at position index.

intptr_t BitArray::GetLength ( ) const

Gets the number of elements in the BitArray.

BitArray & BitArray::Not ( )

Inverts all the bit values. On/true bit values are converted to off / false.Off / false bit values are turned on / true.The current instance is updated and returned.

BitArray & BitArray::Or ( const BitArray value)

Returns a reference to the current instance ORed with value.

System::Collections::BitArray::RLIB_PROPERTY_GET_SET ( intptr_t  Length,
GetLength  ,
SetLength   
)

Gets or sets the number of elements in the BitArray.

void BitArray::Set ( intptr_t  index,
bool  value 
)

Sets the bit value at position index to value.

void BitArray::SetAll ( bool  value)

Sets all the bit values to value.

void BitArray::SetLength ( intptr_t  length)

Sets the number of elements in the BitArray.

BitArray & BitArray::Xor ( const BitArray value)

Returns a reference to the current instance XORed with value.


The documentation for this class was generated from the following files: