Nemo  2.2.0
Public Member Functions | Private Member Functions | Private Attributes | Friends
bitstring::reference Class Reference

#include <bitstring.h>

List of all members.

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

Detailed Description

Definition at line 57 of file bitstring.h.


Constructor & Destructor Documentation

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

Definition at line 68 of file bitstring.h.

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

        {
      _word = bs.getword_atPos( pos );
      _bitpos = pos % BITS_PER_WORD;
        }
bitstring::reference::~reference ( ) [inline]

Definition at line 74 of file bitstring.h.

        { }

Member Function Documentation

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

Definition at line 106 of file bitstring.h.

References _bitpos, _word, and BITS_PER_WORD.

        {
      *_word ^= ( 1UL << ( _bitpos % BITS_PER_WORD ) );
      return *this;
        }
bitstring::reference::operator bool ( ) const [inline]

Definition at line 102 of file bitstring.h.

References _bitpos, _word, and BITS_PER_WORD.

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

Definition at line 78 of file bitstring.h.

References _bitpos, _word, and BITS_PER_WORD.

        {
      if (x)
        *_word |= ( 1UL << ( _bitpos % BITS_PER_WORD ) );
      else
        *_word &= ~( 1UL << ( _bitpos % BITS_PER_WORD ) );
      return *this;
        }
reference& bitstring::reference::operator= ( const reference j) [inline]

Definition at line 88 of file bitstring.h.

References _bitpos, _word, and BITS_PER_WORD.

        {
      if ((*(j._word) & ( 1UL << ( j._bitpos % BITS_PER_WORD ) ) ))
        *_word |= ( 1UL << ( _bitpos % BITS_PER_WORD ) );
      else
        *_word &= ~( 1UL << ( _bitpos % BITS_PER_WORD ) );
      return *this;
        }
bool bitstring::reference::operator~ ( ) const [inline]

Definition at line 98 of file bitstring.h.

References _bitpos, _word, and BITS_PER_WORD.

        { return (*(_word) & ( 1UL << ( _bitpos % BITS_PER_WORD ) ) ) == 0; }

Friends And Related Function Documentation

friend class bitstring [friend]

Definition at line 59 of file bitstring.h.


Member Data Documentation

Definition at line 62 of file bitstring.h.

Referenced by flip(), operator bool(), operator=(), operator~(), and reference().

Definition at line 61 of file bitstring.h.

Referenced by flip(), operator bool(), operator=(), operator~(), and reference().


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

Generated for Nemo v2.2.0 by  doxygen 1.7.5.1 -- Nemo is hosted by  SourceForge.net Logo