Nemo  2.3.46
bitstring::reference Class Reference

#include <bitstring.h>

+ Collaboration diagram for bitstring::reference:

Public Member Functions

 reference (bitstring &bs, size_t pos)
 
 ~reference ()
 
referenceoperator= (bool x)
 
referenceoperator= (const reference &j)
 
bool operator~ () const
 
 operator bool () const
 
referenceflip ()
 

Private Member Functions

 reference ()
 

Private Attributes

_ul_word
 
size_t _bitpos
 

Friends

class bitstring
 

Constructor & Destructor Documentation

bitstring::reference::reference ( )
private
bitstring::reference::reference ( bitstring bs,
size_t  pos 
)
inline

References BITS_PER_WORD, and bitstring::getword_atPos().

74  {
75  _word = bs.getword_atPos( pos );
76  _bitpos = pos % BITS_PER_WORD;
77  }
#define BITS_PER_WORD
Definition: bitstring.h:41
_ul * getword_atPos(size_t pos)
Definition: bitstring.h:136
_ul * _word
Definition: bitstring.h:66
size_t _bitpos
Definition: bitstring.h:67
bitstring::reference::~reference ( )
inline
80  { }

Member Function Documentation

reference& bitstring::reference::flip ( )
inline

References BITS_PER_WORD.

112  {
113  *_word ^= ( 1UL << ( _bitpos % BITS_PER_WORD ) );
114  return *this;
115  }
#define BITS_PER_WORD
Definition: bitstring.h:41
_ul * _word
Definition: bitstring.h:66
size_t _bitpos
Definition: bitstring.h:67
bitstring::reference::operator bool ( ) const
inline

References BITS_PER_WORD.

108  { return (*(_word) & ( 1UL << ( _bitpos % BITS_PER_WORD ) ) ) != 0; }
#define BITS_PER_WORD
Definition: bitstring.h:41
_ul * _word
Definition: bitstring.h:66
size_t _bitpos
Definition: bitstring.h:67
reference& bitstring::reference::operator= ( bool  x)
inline

References BITS_PER_WORD.

84  {
85  if (x)
86  *_word |= ( 1UL << ( _bitpos % BITS_PER_WORD ) );
87  else
88  *_word &= ~( 1UL << ( _bitpos % BITS_PER_WORD ) );
89  return *this;
90  }
#define BITS_PER_WORD
Definition: bitstring.h:41
_ul * _word
Definition: bitstring.h:66
size_t _bitpos
Definition: bitstring.h:67
reference& bitstring::reference::operator= ( const reference j)
inline

References _bitpos, _word, and BITS_PER_WORD.

94  {
95  if ((*(j._word) & ( 1UL << ( j._bitpos % BITS_PER_WORD ) ) ))
96  *_word |= ( 1UL << ( _bitpos % BITS_PER_WORD ) );
97  else
98  *_word &= ~( 1UL << ( _bitpos % BITS_PER_WORD ) );
99  return *this;
100  }
#define BITS_PER_WORD
Definition: bitstring.h:41
_ul * _word
Definition: bitstring.h:66
size_t _bitpos
Definition: bitstring.h:67
bool bitstring::reference::operator~ ( ) const
inline

References BITS_PER_WORD.

104  { return (*(_word) & ( 1UL << ( _bitpos % BITS_PER_WORD ) ) ) == 0; }
#define BITS_PER_WORD
Definition: bitstring.h:41
_ul * _word
Definition: bitstring.h:66
size_t _bitpos
Definition: bitstring.h:67

Friends And Related Function Documentation

friend class bitstring
friend

Member Data Documentation

size_t bitstring::reference::_bitpos
private

Referenced by operator=().

_ul* bitstring::reference::_word
private

Referenced by operator=().


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

Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR