|
| BitSet () |
| Constructor: Assume all zeroes in set. More...
|
|
| BitSet (const BitSet &in_set) |
| Copy constructor from another BitSet. More...
|
|
| BitSet (Random &random, const double p1=0.5) |
| Constructor to generate a random BitSet. More...
|
|
| ~BitSet ()=default |
| Destructor. More...
|
|
BitSet & | operator= (const BitSet< NUM_BITS > &in_set) |
| Assignment operator. More...
|
|
void | Randomize (Random &random, const double p1=0.5) |
| Set all bits randomly, with a given probability of being a 1. More...
|
|
template<size_t NUM_BITS2> |
BitSet & | Import (const BitSet< NUM_BITS2 > &in_set) |
| Assign from a BitSet of a different size. More...
|
|
template<size_t NUM_BITS2> |
BitSet< NUM_BITS2 > | Export () const |
| Convert to a Bitset of a different size. More...
|
|
bool | operator== (const BitSet &in_set) const |
| Test if two BitSet objects are identical. More...
|
|
bool | operator< (const BitSet &in_set) const |
| Compare two BitSet objects, based on the associated binary value. More...
|
|
bool | operator<= (const BitSet &in_set) const |
| Compare two BitSet objects, based on the associated binary value. More...
|
|
bool | operator!= (const BitSet &in_set) const |
| Test if two BitSet objects are different. More...
|
|
bool | operator> (const BitSet &in_set) const |
| Compare two BitSet objects, based on the associated binary value. More...
|
|
bool | operator>= (const BitSet &in_set) const |
| Compare two BitSet objects, based on the associated binary value. More...
|
|
bool | Get (size_t index) const |
| Retrieve the bit as a specified index. More...
|
|
void | Set (size_t index, bool value) |
| Set the bit as a specified index. More...
|
|
BitSet & | Toggle () |
| Flip all bits in this BitSet. More...
|
|
BitSet & | Toggle (size_t index) |
| Flip a single bit. More...
|
|
BitSet & | Toggle (size_t start, size_t end) |
| Flips all the bits in a range [start, end) More...
|
|
uint8_t | GetByte (size_t index) const |
| Get the full byte starting from the bit at a specified index. More...
|
|
void | SetByte (size_t index, uint8_t value) |
| Set the full byte starting at the bit at the specified index. More...
|
|
uint32_t | GetUInt (size_t index) const |
| Get the 32-bit unsigned int; index in in 32-bit jumps (i.e., this is a field ID not bit id) More...
|
|
void | SetUInt (size_t index, uint32_t value) |
| Set the 32-bit unsigned int; index in in 32-bit jumps (i.e., this is a field ID not bit id) More...
|
|
uint32_t | GetUIntAtBit (size_t index) |
| Get the full 32-bit unsigned int starting from the bit at a specified index. More...
|
|
template<size_t OUT_BITS> |
uint32_t | GetValueAtBit (size_t index) |
| Get OUT_BITS bits starting from the bit at a specified index (max 32) More...
|
|
bool | Any () const |
| Return true if ANY bits in the BitSet are one, else return false. More...
|
|
bool | None () const |
| Return true if NO bits in the BitSet are one, else return false. More...
|
|
bool | All () const |
| Return true if ALL bits in the BitSet are one, else return false. More...
|
|
bool | operator[] (size_t index) const |
| Index into a const BitSet (i.e., cannot be set this way.) More...
|
|
BitProxy | operator[] (size_t index) |
| Index into a BitSet, returning a proxy that will allow bit assignment to work. More...
|
|
void | Clear () |
| Set all bits to zero. More...
|
|
void | SetAll () |
| Set all bits to one. More...
|
|
void | Print (std::ostream &out=std::cout) const |
| Print all bits to the provided output stream. More...
|
|
void | PrintArray (std::ostream &out=std::cout) const |
| Print all bits from smallest to largest, as if this were an array, not a bit representation. More...
|
|
void | PrintOneIDs (std::ostream &out=std::cout, char spacer=' ') const |
| Print the locations of all one bits, using the provided spacer (default is a single space) More...
|
|
size_t | CountOnes_Sparse () const |
| Count 1's by looping through once for each bit equal to 1. More...
|
|
size_t | CountOnes_Mixed () const |
| Count 1's in semi-parallel; fastest for even 0's & 1's. More...
|
|
size_t | CountOnes () const |
| Count the number of ones in the BitSet using bit tricks for a speedup. More...
|
|
int | FindBit () const |
| Return the index of the first one in the sequence; return -1 if no ones are available. More...
|
|
int | PopBit () |
| Return index of first one in sequence (or -1 if no ones); change this position to zero. More...
|
|
int | FindBit (const size_t start_pos) const |
| Return index of first one in sequence AFTER start_pos (or -1 if no ones) More...
|
|
emp::vector< size_t > | GetOnes () const |
| Return a vector indicating the posistions of all ones in the BitSet. More...
|
|
BitSet | NOT () const |
| Perform a Boolean NOT on this BitSet and return the result. More...
|
|
BitSet | AND (const BitSet &set2) const |
| Perform a Boolean AND with a second BitSet and return the result. More...
|
|
BitSet | OR (const BitSet &set2) const |
| Perform a Boolean OR with a second BitSet and return the result. More...
|
|
BitSet | NAND (const BitSet &set2) const |
| Perform a Boolean NAND with a second BitSet and return the result. More...
|
|
BitSet | NOR (const BitSet &set2) const |
| Perform a Boolean NOR with a second BitSet and return the result. More...
|
|
BitSet | XOR (const BitSet &set2) const |
| Perform a Boolean XOR with a second BitSet and return the result. More...
|
|
BitSet | EQU (const BitSet &set2) const |
| Perform a Boolean EQU with a second BitSet and return the result. More...
|
|
BitSet & | NOT_SELF () |
| Perform a Boolean NOT on this BitSet, store result here, and return this object. More...
|
|
BitSet & | AND_SELF (const BitSet &set2) |
| Perform a Boolean AND with a second BitSet, store result here, and return this object. More...
|
|
BitSet & | OR_SELF (const BitSet &set2) |
| Perform a Boolean OR with a second BitSet, store result here, and return this object. More...
|
|
BitSet & | NAND_SELF (const BitSet &set2) |
| Perform a Boolean NAND with a second BitSet, store result here, and return this object. More...
|
|
BitSet & | NOR_SELF (const BitSet &set2) |
| Perform a Boolean NOR with a second BitSet, store result here, and return this object. More...
|
|
BitSet & | XOR_SELF (const BitSet &set2) |
| Perform a Boolean XOR with a second BitSet, store result here, and return this object. More...
|
|
BitSet & | EQU_SELF (const BitSet &set2) |
| Perform a Boolean EQU with a second BitSet, store result here, and return this object. More...
|
|
BitSet | SHIFT (const int shift_size) const |
| Positive shifts go left and negative go right (0 does nothing); return result. More...
|
|
BitSet & | SHIFT_SELF (const int shift_size) |
| Positive shifts go left and negative go right; store result here, and return this object. More...
|
|
BitSet | operator~ () const |
| Operator bitwise NOT... More...
|
|
BitSet | operator& (const BitSet &ar2) const |
| Operator bitwise AND... More...
|
|
BitSet | operator| (const BitSet &ar2) const |
| Operator bitwise OR... More...
|
|
BitSet | operator^ (const BitSet &ar2) const |
| Operator bitwise XOR... More...
|
|
BitSet | operator<< (const size_t shift_size) const |
| Operator shift left... More...
|
|
BitSet | operator>> (const size_t shift_size) const |
| Operator shift right... More...
|
|
const BitSet & | operator&= (const BitSet &ar2) |
| Compound operator bitwise AND... More...
|
|
const BitSet & | operator|= (const BitSet &ar2) |
| Compound operator bitwise OR... More...
|
|
const BitSet & | operator^= (const BitSet &ar2) |
| Compound operator bitwise XOR... More...
|
|
const BitSet & | operator<<= (const size_t shift_size) |
| Compound operator shift left... More...
|
|
const BitSet & | operator>>= (const size_t shift_size) |
| Compound operator shift right... More...
|
|
bool | all () const |
| Function to allow drop-in replacement with std::bitset. More...
|
|
bool | any () const |
| Function to allow drop-in replacement with std::bitset. More...
|
|
bool | none () const |
| Function to allow drop-in replacement with std::bitset. More...
|
|
size_t | count () const |
| Function to allow drop-in replacement with std::bitset. More...
|
|
BitSet & | flip () |
| Function to allow drop-in replacement with std::bitset. More...
|
|
BitSet & | flip (size_t pos) |
| Function to allow drop-in replacement with std::bitset. More...
|
|
BitSet & | flip (size_t start, size_t end) |
| Function to allow drop-in replacement with std::bitset. More...
|
|
template<size_t NUM_BITS>
class emp::BitSet< NUM_BITS >
A fixed-sized (but arbitrarily large) array of bits, and optimizes operations on those bits to be as fast as possible.