CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes | Friends
BitArray< N >::refToBit Class Reference

#include <BitArray.h>

Public Member Functions

refToBitflip ()
 
 operator int () const
 
refToBitoperator= (const int val)
 
refToBitoperator= (const refToBit &rtb)
 
int operator~ () const
 
 refToBit ()
 
 refToBit (BitArray &b, int pos)
 
 ~refToBit ()
 

Private Attributes

int _pos
 
unsigned * _word
 

Friends

class BitArray
 

Detailed Description

template<int N>
class BitArray< N >::refToBit

Definition at line 37 of file BitArray.h.

Constructor & Destructor Documentation

template<int N>
BitArray< N >::refToBit::refToBit ( )
inline

Definition at line 43 of file BitArray.h.

43 {}
template<int N>
BitArray< N >::refToBit::refToBit ( BitArray b,
int  pos 
)
inline

Definition at line 44 of file BitArray.h.

References BitArray< N >::refToBit::_pos, BitArray< N >::refToBit::_word, BitArray< N >::getPosInWord(), and BitArray< N >::getWord().

44  {
45  _word = &b.getWord(pos);
47  }
unsigned * _word
Definition: BitArray.h:78
unsigned & getWord(const int pos)
Definition: BitArray.h:138
static int getPosInWord(const int pos)
Definition: BitArray.h:148
template<int N>
BitArray< N >::refToBit::~refToBit ( )
inline

Definition at line 48 of file BitArray.h.

48 {}

Member Function Documentation

template<int N>
refToBit& BitArray< N >::refToBit::flip ( )
inline

Definition at line 72 of file BitArray.h.

References BitArray< N >::refToBit::_pos, BitArray< N >::refToBit::_word, and BitArray< N >::getPosMask().

72  {
74  return *this;
75  }
unsigned * _word
Definition: BitArray.h:78
static unsigned getPosMask(const int pos)
Definition: BitArray.h:154
template<int N>
BitArray< N >::refToBit::operator int ( ) const
inline

Definition at line 70 of file BitArray.h.

References BitArray< N >::refToBit::_pos, BitArray< N >::refToBit::_word, and BitArray< N >::getPosMask().

70 { return ((*_word)&getPosMask(_pos))!=0; }
unsigned * _word
Definition: BitArray.h:78
static unsigned getPosMask(const int pos)
Definition: BitArray.h:154
template<int N>
refToBit& BitArray< N >::refToBit::operator= ( const int  val)
inline

Definition at line 50 of file BitArray.h.

References BitArray< N >::refToBit::_pos, BitArray< N >::refToBit::_word, and BitArray< N >::getPosMask().

50  {
51  if(val) {
52  *_word |= getPosMask(_pos);
53  } else {
54  *_word &= ~(getPosMask(_pos));
55  }
56  return *this;
57  }
unsigned * _word
Definition: BitArray.h:78
static unsigned getPosMask(const int pos)
Definition: BitArray.h:154
template<int N>
refToBit& BitArray< N >::refToBit::operator= ( const refToBit rtb)
inline

Definition at line 59 of file BitArray.h.

References BitArray< N >::refToBit::_pos, BitArray< N >::refToBit::_word, and BitArray< N >::getPosMask().

59  {
60  if( (*(rtb._word) & getPosMask(rtb._pos)) ) {
61  *_word |= getPosMask(_pos);
62  } else {
63  *_word &= ~getPosMask(_pos);
64  }
65  return *this;
66  }
unsigned * _word
Definition: BitArray.h:78
static unsigned getPosMask(const int pos)
Definition: BitArray.h:154
template<int N>
int BitArray< N >::refToBit::operator~ ( ) const
inline

Definition at line 68 of file BitArray.h.

References BitArray< N >::refToBit::_pos, BitArray< N >::refToBit::_word, and BitArray< N >::getPosMask().

68 { return ((*_word)&getPosMask(_pos))==0; }
unsigned * _word
Definition: BitArray.h:78
static unsigned getPosMask(const int pos)
Definition: BitArray.h:154

Friends And Related Function Documentation

template<int N>
friend class BitArray
friend

Definition at line 38 of file BitArray.h.

Member Data Documentation

template<int N>
int BitArray< N >::refToBit::_pos
private
template<int N>
unsigned* BitArray< N >::refToBit::_word
private