OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
OpenMD::OpenMDBitSet Class Reference

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.
 
OpenMDBitSetoperator&= (const OpenMDBitSet &bs)
 
OpenMDBitSetoperator|= (const OpenMDBitSet &bs)
 
OpenMDBitSetoperator^= (const OpenMDBitSet &bs)
 
OpenMDBitSetoperator-= (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 &, const OpenMDBitSet &bs)
 

Detailed Description

OpenMDBitSet is a wrapper class of std::vector<bool> to act as a growable std::bitset.

Definition at line 58 of file OpenMDBitSet.hpp.

Constructor & Destructor Documentation

◆ OpenMDBitSet() [1/2]

OpenMD::OpenMDBitSet::OpenMDBitSet ( )
inline

Definition at line 61 of file OpenMDBitSet.hpp.

◆ OpenMDBitSet() [2/2]

OpenMD::OpenMDBitSet::OpenMDBitSet ( size_t nbits)
inline

Definition at line 63 of file OpenMDBitSet.hpp.

Member Function Documentation

◆ andOperator()

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().

◆ any()

bool OpenMD::OpenMDBitSet::any ( )
inline

Returns true if any bits are set to true.

Definition at line 87 of file OpenMDBitSet.hpp.

References none().

◆ clearAll()

void OpenMD::OpenMDBitSet::clearAll ( )
inline

Sets all of the bits in this OpenMDBitSet to false.

Definition at line 133 of file OpenMDBitSet.hpp.

References size().

◆ countBits()

int OpenMD::OpenMDBitSet::countBits ( )

Returns the number of bits set to true in this OpenMDBitSet.


Definition at line 59 of file OpenMDBitSet.cpp.

◆ firstOffBit()

int OpenMD::OpenMDBitSet::firstOffBit ( ) const
inline

Definition at line 92 of file OpenMDBitSet.hpp.

◆ firstOnBit()

int OpenMD::OpenMDBitSet::firstOnBit ( ) const
inline

Definition at line 101 of file OpenMDBitSet.hpp.

◆ flip() [1/3]

void OpenMD::OpenMDBitSet::flip ( )
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().

◆ flip() [2/3]

void OpenMD::OpenMDBitSet::flip ( size_t bitIndex)
inline

Sets the bit at the specified index to to the complement of its current value.

Definition at line 70 of file OpenMDBitSet.hpp.

◆ flip() [3/3]

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().

◆ get() [1/2]

bool OpenMD::OpenMDBitSet::get ( size_t bitIndex)
inline

Returns the value of the bit with the specified index.

Definition at line 80 of file OpenMDBitSet.hpp.

◆ get() [2/2]

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().

◆ nextOffBit()

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().

◆ nextOnBit()

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().

◆ none()

bool OpenMD::OpenMDBitSet::none ( )

Returns true if no bits are set to true.

Definition at line 85 of file OpenMDBitSet.cpp.

Referenced by any().

◆ nthOffBit()

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().

◆ nthOnBit()

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().

◆ operator&=()

OpenMDBitSet & OpenMD::OpenMDBitSet::operator&= ( const OpenMDBitSet & bs)
inline

Definition at line 144 of file OpenMDBitSet.hpp.

◆ operator-=()

OpenMDBitSet & OpenMD::OpenMDBitSet::operator-= ( const OpenMDBitSet & bs)
inline

Definition at line 156 of file OpenMDBitSet.hpp.

◆ operator[]()

bool OpenMD::OpenMDBitSet::operator[] ( int bitIndex) const
inline

Definition at line 164 of file OpenMDBitSet.hpp.

◆ operator^=()

OpenMDBitSet & OpenMD::OpenMDBitSet::operator^= ( const OpenMDBitSet & bs)
inline

Definition at line 152 of file OpenMDBitSet.hpp.

◆ operator|=()

OpenMDBitSet & OpenMD::OpenMDBitSet::operator|= ( const OpenMDBitSet & bs)
inline

Definition at line 148 of file OpenMDBitSet.hpp.

◆ orOperator()

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().

◆ parallelReduce()

OpenMDBitSet OpenMD::OpenMDBitSet::parallelReduce ( )

Definition at line 215 of file OpenMDBitSet.cpp.

◆ resize()

void OpenMD::OpenMDBitSet::resize ( size_t nbits)

Changes the size of OpenMDBitSet.

Definition at line 169 of file OpenMDBitSet.cpp.

References size().

◆ setAll()

void OpenMD::OpenMDBitSet::setAll ( )
inline

Definition at line 135 of file OpenMDBitSet.hpp.

◆ setBitOff()

void OpenMD::OpenMDBitSet::setBitOff ( size_t bitIndex)
inline

Definition at line 122 of file OpenMDBitSet.hpp.

◆ setBitOn()

void OpenMD::OpenMDBitSet::setBitOn ( size_t bitIndex)
inline

Definition at line 120 of file OpenMDBitSet.hpp.

◆ setRangeOff()

void OpenMD::OpenMDBitSet::setRangeOff ( size_t fromIndex,
size_t toIndex )
inline

Definition at line 128 of file OpenMDBitSet.hpp.

◆ setRangeOn()

void OpenMD::OpenMDBitSet::setRangeOn ( size_t fromIndex,
size_t toIndex )
inline

Definition at line 124 of file OpenMDBitSet.hpp.

◆ size()

size_t OpenMD::OpenMDBitSet::size ( ) const
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().

◆ 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().

Friends And Related Symbol Documentation

◆ operator&

OpenMDBitSet operator& ( const OpenMDBitSet & bs1,
const OpenMDBitSet & bs2 )
friend

Definition at line 185 of file OpenMDBitSet.cpp.

◆ operator-

OpenMDBitSet operator- ( const OpenMDBitSet & bs1,
const OpenMDBitSet & bs2 )
friend

Definition at line 201 of file OpenMDBitSet.cpp.

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const OpenMDBitSet & bs )
friend

Definition at line 248 of file OpenMDBitSet.cpp.

◆ operator==

bool operator== ( const OpenMDBitSet & bs1,
const OpenMDBitSet & bs2 )
friend

Definition at line 209 of file OpenMDBitSet.cpp.

◆ operator^

OpenMDBitSet operator^ ( const OpenMDBitSet & bs1,
const OpenMDBitSet & bs2 )
friend

Definition at line 193 of file OpenMDBitSet.cpp.

◆ operator|

OpenMDBitSet operator| ( const OpenMDBitSet & bs1,
const OpenMDBitSet & bs2 )
friend

Definition at line 177 of file OpenMDBitSet.cpp.


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