OpenMD 3.1
Molecular Dynamics in the Open
|
OpenMDBitSet is a wrapper class of std::vector<bool> to act as a growable std::bitset. More...
#include "OpenMDBitSet.hpp"
Public Member Functions | |
OpenMDBitSet (size_t nbits) | |
int | countBits () |
Returns the number of bits set to true in this OpenMDBitSet. | |
void | flip (size_t bitIndex) |
Sets the bit at the specified index to to the complement of its current value. | |
void | flip (size_t fromIndex, size_t toIndex) |
Sets each bit from the specified fromIndex(inclusive) to the specified toIndex(exclusive) to the complement of its current value. | |
void | flip () |
Sets each bit to the complement of its current value. | |
bool | get (size_t bitIndex) |
Returns the value of the bit with the specified index. | |
OpenMDBitSet | get (size_t fromIndex, size_t toIndex) |
Returns a new OpenMDBitSet composed of bits from this OpenMDBitSet from fromIndex(inclusive) to toIndex(exclusive). | |
bool | any () |
Returns true if any bits are set to true. | |
bool | none () |
Returns true if no bits are set to true. | |
int | firstOffBit () const |
int | nextOffBit (int fromIndex) const |
Returns the index of the first bit that is set to false that occurs on or after the specified starting index. | |
int | nthOffBit (unsigned long int n) const |
Returns the index of the n^th bit that is set to false. | |
int | firstOnBit () const |
int | nextOnBit (int fromIndex) const |
Returns the index of the first bit that is set to true that occurs on or after the specified starting index. | |
int | nthOnBit (unsigned long int n) const |
Returns the index of the n^th bit that is set to true. | |
void | andOperator (const OpenMDBitSet &bs) |
Performs a logical AND of this target bit set with the argument bit set. | |
void | orOperator (const OpenMDBitSet &bs) |
Performs a logical OR of this bit set with the bit set argument. | |
void | xorOperator (const OpenMDBitSet &bs) |
Performs a logical XOR of this bit set with the bit set argument. | |
void | setBitOn (size_t bitIndex) |
void | setBitOff (size_t bitIndex) |
void | setRangeOn (size_t fromIndex, size_t toIndex) |
void | setRangeOff (size_t fromIndex, size_t toIndex) |
void | clearAll () |
Sets all of the bits in this OpenMDBitSet to false. | |
void | setAll () |
size_t | size () const |
Returns the number of bits of space actually in use by this OpenMDBitSet to represent bit values. | |
void | resize (size_t nbits) |
Changes the size of OpenMDBitSet. | |
OpenMDBitSet & | operator&= (const OpenMDBitSet &bs) |
OpenMDBitSet & | operator|= (const OpenMDBitSet &bs) |
OpenMDBitSet & | operator^= (const OpenMDBitSet &bs) |
OpenMDBitSet & | operator-= (const OpenMDBitSet &bs) |
OpenMDBitSet | parallelReduce () |
bool | operator[] (int bitIndex) const |
Friends | |
OpenMDBitSet | operator| (const OpenMDBitSet &bs1, const OpenMDBitSet &bs2) |
OpenMDBitSet | operator& (const OpenMDBitSet &bs1, const OpenMDBitSet &bs2) |
OpenMDBitSet | operator^ (const OpenMDBitSet &bs1, const OpenMDBitSet &bs2) |
OpenMDBitSet | operator- (const OpenMDBitSet &bs1, const OpenMDBitSet &bs2) |
bool | operator== (const OpenMDBitSet &bs1, const OpenMDBitSet &bs2) |
std::ostream & | operator<< (std::ostream &os, const OpenMDBitSet &bs) |
OpenMDBitSet is a wrapper class of std::vector<bool> to act as a growable std::bitset.
Definition at line 58 of file OpenMDBitSet.hpp.
|
inline |
Definition at line 61 of file OpenMDBitSet.hpp.
|
inline |
Definition at line 63 of file OpenMDBitSet.hpp.
void OpenMD::OpenMDBitSet::andOperator | ( | const OpenMDBitSet & | bs | ) |
Performs a logical AND of this target bit set with the argument bit set.
Definition at line 141 of file OpenMDBitSet.cpp.
References size().
|
inline |
Returns true if any bits are set to true.
Definition at line 87 of file OpenMDBitSet.hpp.
References none().
|
inline |
Sets all of the bits in this OpenMDBitSet to false.
Definition at line 133 of file OpenMDBitSet.hpp.
References size().
int OpenMD::OpenMDBitSet::countBits | ( | ) |
Returns the number of bits set to true in this OpenMDBitSet.
Definition at line 59 of file OpenMDBitSet.cpp.
|
inline |
Definition at line 92 of file OpenMDBitSet.hpp.
|
inline |
Definition at line 101 of file OpenMDBitSet.hpp.
|
inline |
Sets each bit to the complement of its current value.
Definition at line 77 of file OpenMDBitSet.hpp.
References flip(), and size().
Referenced by flip().
|
inline |
Sets the bit at the specified index to to the complement of its current value.
Definition at line 70 of file OpenMDBitSet.hpp.
void OpenMD::OpenMDBitSet::flip | ( | size_t | fromIndex, |
size_t | toIndex ) |
Sets each bit from the specified fromIndex(inclusive) to the specified toIndex(exclusive) to the complement of its current value.
Definition at line 63 of file OpenMDBitSet.cpp.
References size().
|
inline |
Returns the value of the bit with the specified index.
Definition at line 80 of file OpenMDBitSet.hpp.
OpenMDBitSet OpenMD::OpenMDBitSet::get | ( | size_t | fromIndex, |
size_t | toIndex ) |
Returns a new OpenMDBitSet composed of bits from this OpenMDBitSet from fromIndex(inclusive) to toIndex(exclusive).
Definition at line 73 of file OpenMDBitSet.cpp.
References size().
int OpenMD::OpenMDBitSet::nextOffBit | ( | int | fromIndex | ) | const |
Returns the index of the first bit that is set to false that occurs on or after the specified starting index.
Definition at line 91 of file OpenMDBitSet.cpp.
References size().
Referenced by nthOffBit().
int OpenMD::OpenMDBitSet::nextOnBit | ( | int | fromIndex | ) | const |
Returns the index of the first bit that is set to true that occurs on or after the specified starting index.
Definition at line 116 of file OpenMDBitSet.cpp.
References size().
Referenced by nthOnBit().
bool OpenMD::OpenMDBitSet::none | ( | ) |
Returns true if no bits are set to true.
Definition at line 85 of file OpenMDBitSet.cpp.
Referenced by any().
int OpenMD::OpenMDBitSet::nthOffBit | ( | unsigned long int | n | ) | const |
Returns the index of the n^th bit that is set to false.
Definition at line 106 of file OpenMDBitSet.cpp.
References nextOffBit().
int OpenMD::OpenMDBitSet::nthOnBit | ( | unsigned long int | n | ) | const |
Returns the index of the n^th bit that is set to true.
Definition at line 131 of file OpenMDBitSet.cpp.
References nextOnBit().
|
inline |
Definition at line 144 of file OpenMDBitSet.hpp.
|
inline |
Definition at line 156 of file OpenMDBitSet.hpp.
|
inline |
Definition at line 164 of file OpenMDBitSet.hpp.
|
inline |
Definition at line 152 of file OpenMDBitSet.hpp.
|
inline |
Definition at line 148 of file OpenMDBitSet.hpp.
void OpenMD::OpenMDBitSet::orOperator | ( | const OpenMDBitSet & | bs | ) |
Performs a logical OR of this bit set with the bit set argument.
Definition at line 148 of file OpenMDBitSet.cpp.
References size().
OpenMDBitSet OpenMD::OpenMDBitSet::parallelReduce | ( | ) |
Definition at line 215 of file OpenMDBitSet.cpp.
void OpenMD::OpenMDBitSet::resize | ( | size_t | nbits | ) |
Changes the size of OpenMDBitSet.
Definition at line 169 of file OpenMDBitSet.cpp.
References size().
|
inline |
Definition at line 135 of file OpenMDBitSet.hpp.
|
inline |
Definition at line 122 of file OpenMDBitSet.hpp.
|
inline |
Definition at line 120 of file OpenMDBitSet.hpp.
|
inline |
Definition at line 128 of file OpenMDBitSet.hpp.
|
inline |
Definition at line 124 of file OpenMDBitSet.hpp.
|
inline |
Returns the number of bits of space actually in use by this OpenMDBitSet to represent bit values.
Definition at line 139 of file OpenMDBitSet.hpp.
Referenced by andOperator(), clearAll(), flip(), flip(), get(), nextOffBit(), nextOnBit(), orOperator(), resize(), and xorOperator().
void OpenMD::OpenMDBitSet::xorOperator | ( | const OpenMDBitSet & | bs | ) |
Performs a logical XOR of this bit set with the bit set argument.
Definition at line 154 of file OpenMDBitSet.cpp.
References size().
|
friend |
Definition at line 185 of file OpenMDBitSet.cpp.
|
friend |
Definition at line 201 of file OpenMDBitSet.cpp.
|
friend |
Definition at line 248 of file OpenMDBitSet.cpp.
|
friend |
Definition at line 209 of file OpenMDBitSet.cpp.
|
friend |
Definition at line 193 of file OpenMDBitSet.cpp.
|
friend |
Definition at line 177 of file OpenMDBitSet.cpp.