Nemo  2.4.0b
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
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

◆ reference() [1/2]

bitstring::reference::reference ( )
private

◆ reference() [2/2]

bitstring::reference::reference ( bitstring bs,
size_t  pos 
)
inline
75  {
76  _word = bs.getword_atPos( pos );
77  _bitpos = pos % BITS_PER_WORD;
78  }
#define BITS_PER_WORD
Definition: bitstring.h:41
_ul * _word
Definition: bitstring.h:67
size_t _bitpos
Definition: bitstring.h:68
_ul * getword_atPos(size_t pos) const
Definition: bitstring.h:152

References _bitpos, _word, BITS_PER_WORD, and bitstring::getword_atPos().

◆ ~reference()

bitstring::reference::~reference ( )
inline
81  { }

Member Function Documentation

◆ flip()

reference& bitstring::reference::flip ( )
inline
113  {
114  *_word ^= ( 1UL << ( _bitpos % BITS_PER_WORD ) );
115  return *this;
116  }

References _bitpos, _word, and BITS_PER_WORD.

◆ operator bool()

bitstring::reference::operator bool ( ) const
inline
109  { return (*(_word) & ( 1UL << ( _bitpos % BITS_PER_WORD ) ) ) != 0; }

References _bitpos, _word, and BITS_PER_WORD.

◆ operator=() [1/2]

reference& bitstring::reference::operator= ( bool  x)
inline
85  {
86  if (x)
87  *_word |= ( 1UL << ( _bitpos % BITS_PER_WORD ) );
88  else
89  *_word &= ~( 1UL << ( _bitpos % BITS_PER_WORD ) );
90  return *this;
91  }

References _bitpos, _word, and BITS_PER_WORD.

◆ operator=() [2/2]

reference& bitstring::reference::operator= ( const reference j)
inline
95  {
96  if ((*(j._word) & ( 1UL << ( j._bitpos % BITS_PER_WORD ) ) ))
97  *_word |= ( 1UL << ( _bitpos % BITS_PER_WORD ) );
98  else
99  *_word &= ~( 1UL << ( _bitpos % BITS_PER_WORD ) );
100  return *this;
101  }

References _bitpos, _word, and BITS_PER_WORD.

◆ operator~()

bool bitstring::reference::operator~ ( ) const
inline
105  { return (*(_word) & ( 1UL << ( _bitpos % BITS_PER_WORD ) ) ) == 0; }

References _bitpos, _word, and BITS_PER_WORD.

Friends And Related Function Documentation

◆ bitstring

friend class bitstring
friend

Member Data Documentation

◆ _bitpos

size_t bitstring::reference::_bitpos
private

◆ _word

_ul* bitstring::reference::_word
private

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

Generated for Nemo v2.4.0b by  doxygen 1.9.1 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR