CMS 3D CMS Logo

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 34 of file BitArray.h.

Constructor & Destructor Documentation

◆ refToBit() [1/2]

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

Definition at line 40 of file BitArray.h.

40 {}

◆ refToBit() [2/2]

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

Definition at line 41 of file BitArray.h.

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

41  {
42  _word = &b.getWord(pos);
44  }
unsigned * _word
Definition: BitArray.h:75
unsigned & getWord(const int pos)
Definition: BitArray.h:134
static int getPosInWord(const int pos)
Definition: BitArray.h:144

◆ ~refToBit()

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

Definition at line 45 of file BitArray.h.

45 {}

Member Function Documentation

◆ flip()

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

Definition at line 69 of file BitArray.h.

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

69  {
70  *_word ^= getPosMask(_pos);
71  return *this;
72  }
unsigned * _word
Definition: BitArray.h:75
static unsigned getPosMask(const int pos)
Definition: BitArray.h:150

◆ operator int()

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

Definition at line 67 of file BitArray.h.

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

67 { return ((*_word) & getPosMask(_pos)) != 0; }
unsigned * _word
Definition: BitArray.h:75
static unsigned getPosMask(const int pos)
Definition: BitArray.h:150

◆ operator=() [1/2]

template<int N>
refToBit& BitArray< N >::refToBit::operator= ( const int  val)
inline

Definition at line 47 of file BitArray.h.

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

47  {
48  if (val) {
49  *_word |= getPosMask(_pos);
50  } else {
51  *_word &= ~(getPosMask(_pos));
52  }
53  return *this;
54  }
unsigned * _word
Definition: BitArray.h:75
static unsigned getPosMask(const int pos)
Definition: BitArray.h:150

◆ operator=() [2/2]

template<int N>
refToBit& BitArray< N >::refToBit::operator= ( const refToBit rtb)
inline

Definition at line 56 of file BitArray.h.

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

56  {
57  if ((*(rtb._word) & getPosMask(rtb._pos))) {
58  *_word |= getPosMask(_pos);
59  } else {
60  *_word &= ~getPosMask(_pos);
61  }
62  return *this;
63  }
unsigned * _word
Definition: BitArray.h:75
static unsigned getPosMask(const int pos)
Definition: BitArray.h:150

◆ operator~()

template<int N>
int BitArray< N >::refToBit::operator~ ( ) const
inline

Definition at line 65 of file BitArray.h.

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

65 { return ((*_word) & getPosMask(_pos)) == 0; }
unsigned * _word
Definition: BitArray.h:75
static unsigned getPosMask(const int pos)
Definition: BitArray.h:150

Friends And Related Function Documentation

◆ BitArray

template<int N>
friend class BitArray
friend

Definition at line 35 of file BitArray.h.

Member Data Documentation

◆ _pos

template<int N>
int BitArray< N >::refToBit::_pos
private

◆ _word

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