StochHMM  v0.34
Flexible Hidden Markov Model C++ Library and Application
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes
StochHMM::dynamic_bitset::bit_ref Class Reference

#include <dynamic_bitset.h>

List of all members.

Public Member Functions

 bit_ref (uint32_t &v, size_t position)
bit_refoperator= (bool value)
bit_refoperator= (const bit_ref &rhs)
bit_refoperator|= (bool value)
bit_refoperator&= (bool value)
bit_refoperator^= (bool value)
bit_refflip ()
bit_refreset ()
bool operator~ () const
 operator bool () const

Private Attributes

uint32_t & val
size_t pos

Detailed Description

Definition at line 51 of file dynamic_bitset.h.


Constructor & Destructor Documentation

StochHMM::dynamic_bitset::bit_ref::bit_ref ( uint32_t &  v,
size_t  position 
)
inline

Definition at line 53 of file dynamic_bitset.h.

:val(v),pos(position){}

Member Function Documentation

dynamic_bitset::bit_ref & StochHMM::dynamic_bitset::bit_ref::flip ( )

Definition at line 1138 of file dynamic_bitset.cpp.

{
//Flip the bit
val^= (1 << pos);
return *this;
}
StochHMM::dynamic_bitset::bit_ref::operator bool ( ) const
inline

Definition at line 64 of file dynamic_bitset.h.

References pos, and val.

{ return (this->val >> pos) & 1;}
dynamic_bitset::bit_ref & StochHMM::dynamic_bitset::bit_ref::operator&= ( bool  value)

Definition at line 1123 of file dynamic_bitset.cpp.

{
//if value is false and val is true then clear val bit
if (!value && ((this->val >> pos) & 1)){
val &= ~(1 << pos);
}
//otherwise leave unchanged
return *this;
}
dynamic_bitset::bit_ref & StochHMM::dynamic_bitset::bit_ref::operator= ( bool  value)

Definition at line 1090 of file dynamic_bitset.cpp.

References pos, and val.

{
//if true then set the bit at position
if (value){
val |= (1<<pos);
}
//else clear the bit at the position
else{
val &= ~(1<< pos);
}
return *this;
}
dynamic_bitset::bit_ref & StochHMM::dynamic_bitset::bit_ref::operator= ( const bit_ref rhs)

Definition at line 1102 of file dynamic_bitset.cpp.

References val.

{
//if set in rhs then set in this position
if ((rhs.val >> pos) & 1){
val |= (1 << pos);
}
//else clear the bit at this position
else{
val &= ~(1 << pos);
}
return *this;
}
dynamic_bitset::bit_ref & StochHMM::dynamic_bitset::bit_ref::operator^= ( bool  value)

Definition at line 1132 of file dynamic_bitset.cpp.

{
//Flip the bit
val^= (1 << pos);
return *this;
}
dynamic_bitset::bit_ref & StochHMM::dynamic_bitset::bit_ref::operator|= ( bool  value)

Definition at line 1114 of file dynamic_bitset.cpp.

{
//if true then set bit
if (value){
val |= (1 << pos);
}
//Otherwise leave it alone
return *this;
}
bool StochHMM::dynamic_bitset::bit_ref::operator~ ( ) const

Definition at line 1150 of file dynamic_bitset.cpp.

{
return !((this->val >> pos) & 1);
}
dynamic_bitset::bit_ref & StochHMM::dynamic_bitset::bit_ref::reset ( )

Definition at line 1144 of file dynamic_bitset.cpp.

{
//Clear the bit
val &= ~(1 << pos);
return *this;
}

Member Data Documentation

size_t StochHMM::dynamic_bitset::bit_ref::pos
private

Definition at line 67 of file dynamic_bitset.h.

Referenced by operator bool(), and operator=().

uint32_t& StochHMM::dynamic_bitset::bit_ref::val
private

Definition at line 66 of file dynamic_bitset.h.

Referenced by operator bool(), and operator=().


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