Nemo  2.3.56
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
74 {
75 _word = bs.getword_atPos( pos );
76 _bitpos = pos % BITS_PER_WORD;
77 }
#define BITS_PER_WORD
Definition: bitstring.h:41
_ul * _word
Definition: bitstring.h:66
size_t _bitpos
Definition: bitstring.h:67
_ul * getword_atPos(size_t pos)
Definition: bitstring.h:136

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

◆ ~reference()

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

Member Function Documentation

◆ flip()

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

References _bitpos, _word, and BITS_PER_WORD.

◆ operator bool()

bitstring::reference::operator bool ( ) const
inline
108 { 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
84 {
85 if (x)
86 *_word |= ( 1UL << ( _bitpos % BITS_PER_WORD ) );
87 else
88 *_word &= ~( 1UL << ( _bitpos % BITS_PER_WORD ) );
89 return *this;
90 }

References _bitpos, _word, and BITS_PER_WORD.

◆ operator=() [2/2]

reference & bitstring::reference::operator= ( const reference j)
inline
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 }

References _bitpos, _word, and BITS_PER_WORD.

◆ operator~()

bool bitstring::reference::operator~ ( ) const
inline
104 { 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.3.56 by  doxygen 1.9.0 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR