CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Attributes | Friends
BitArray< N > Class Template Reference

#include <BitArray.h>

Classes

class  refToBit
 

Public Member Functions

int any ()
 
void assign (const int p, const int n, const int val)
 
void assign (const int p, const int n, const BitArray< N > &val)
 
void assign (const int p, const int n, const char *str)
 
 BitArray ()
 
 BitArray (const BitArray< N > &br)
 
 BitArray (const char *str)
 
 BitArray (const char *str, const int p, const int n)
 
 BitArray (const unsigned i)
 
BitArray< 8 > byte (const int i) const
 
void cleanUnused ()
 
int count () const
 
unsigned dataWord (const int i) const
 
unsigned & dataWord (const int i)
 
int element (const int pos) const
 
BitArray< N > & flip ()
 
unsigned & getWord (const int pos)
 
unsigned getWord (const int pos) const
 
unsigned lastWordMask () const
 
int nBits () const
 
int none ()
 
int nWords () const
 
void one ()
 
bool operator!= (const BitArray< N > &a) const
 
BitArray< Noperator& (const BitArray< N > &a)
 
BitArray< N > & operator&= (const BitArray< N > &a)
 
BitArray< Noperator+ (const BitArray< N > &a)
 
BitArray< N > & operator++ (int)
 
BitArray< N > & operator+= (const BitArray< N > &a)
 
BitArray< Noperator- (const BitArray< N > &a)
 
BitArray< N > & operator-= (const BitArray< N > &a)
 
bool operator< (const BitArray< N > &a) const
 
BitArray< Noperator<< (const int n)
 
BitArray< N > & operator<<= (const int n)
 
bool operator<= (const BitArray< N > &a) const
 
BitArray< N > & operator= (const BitArray< N > &a)
 
BitArray< N > & operator= (const unsigned i)
 
BitArray< N > & operator= (const char *str)
 
bool operator== (const BitArray< N > &a) const
 
bool operator> (const BitArray< N > &a) const
 
bool operator>= (const BitArray< N > &a) const
 
BitArray< Noperator>> (const int n)
 
BitArray< N > & operator>>= (const int n)
 
refToBit operator[] (const int pos)
 
int operator[] (const int pos) const
 
BitArray< Noperator^ (const BitArray< N > &a)
 
BitArray< N > & operator^= (const BitArray< N > &a)
 
BitArray< Noperator| (const BitArray< N > &a)
 
BitArray< N > & operator|= (const BitArray< N > &a)
 
BitArray< Noperator~ () const
 
std::ostream & print (std::ostream &o=std::cout) const
 
unsigned read (const int p, const int n) const
 
void reset ()
 
void reset (const int i)
 
void set (const int i)
 
void set (const int i, const int val)
 
void set (const int i, const char *str)
 
int size () const
 
int test (const int i) const
 
BitArray< NtwoComplement () const
 
BitArray< N > & twoComplement ()
 
void unset (const int i)
 
int unusedBits () const
 
void zero ()
 

Static Public Member Functions

static int getPosInWord (const int pos)
 
static unsigned getPosMask (const int pos)
 

Private Attributes

unsigned _data [N/32+1]
 

Friends

class refToBit
 

Detailed Description

template<int N>
class BitArray< N >

Definition at line 30 of file BitArray.h.

Constructor & Destructor Documentation

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

Definition at line 83 of file BitArray.h.

83 {this->zero();}
void zero()
Definition: BitArray.h:216
template<int N>
BitArray< N >::BitArray ( const BitArray< N > &  br)
inline

Definition at line 85 of file BitArray.h.

85  {
86  for (int i=0;i<this->nWords();i++) {
87  _data[i] = br._data[i];
88  }
89  this->cleanUnused();
90  }
unsigned _data[N/32+1]
Definition: BitArray.h:519
void cleanUnused()
Definition: BitArray.h:170
int nWords() const
Definition: BitArray.h:125
template<int N>
BitArray< N >::BitArray ( const char *  str)
inline

Definition at line 91 of file BitArray.h.

91  {
92  this->zero();
93  this->assign(0,this->nBits(),str);
94  this->cleanUnused();
95  }
void zero()
Definition: BitArray.h:216
int nBits() const
Definition: BitArray.h:121
void cleanUnused()
Definition: BitArray.h:170
void assign(const int p, const int n, const int val)
Definition: BitArray.h:239
#define str(s)
template<int N>
BitArray< N >::BitArray ( const char *  str,
const int  p,
const int  n 
)
inline

Definition at line 96 of file BitArray.h.

96  {
97  this->zero();
98  this->assign(p, n, str);
99  }
void zero()
Definition: BitArray.h:216
void assign(const int p, const int n, const int val)
Definition: BitArray.h:239
#define str(s)
template<int N>
BitArray< N >::BitArray ( const unsigned  i)
inline

Definition at line 100 of file BitArray.h.

100  {
101  this->zero();
102  _data[0] = i; // the nBit least sign. bits are considered
103  this->cleanUnused();
104  }
void zero()
Definition: BitArray.h:216
unsigned _data[N/32+1]
Definition: BitArray.h:519
void cleanUnused()
Definition: BitArray.h:170

Member Function Documentation

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

Definition at line 184 of file BitArray.h.

Referenced by DTTSTheta::runDTTSTheta().

184  {
185  int nw = this->nWords();
186  int ub = unusedBits();
187  if(this->dataWord(nw-1)<<ub!=0)return 1;
188  if(nw>1){
189  for (int iw=0;iw<nw-1;iw++){
190  if(this->dataWord(iw)!=0) return 1;
191  }
192  }
193  return 0;
194  }
int unusedBits() const
Definition: BitArray.h:159
unsigned dataWord(const int i) const
Definition: BitArray.h:128
int nWords() const
Definition: BitArray.h:125
template<int N>
void BitArray< N >::assign ( const int  p,
const int  n,
const int  val 
)
inline

Definition at line 239 of file BitArray.h.

Referenced by BitArray< 9 >::BitArray(), DTSectCollPhCand::clearBits(), DTTSCand::clearBits(), DTTSCand::clearBitsBkmod(), DTSectCollPhCand::clearBitsSectColl(), DTTracoChip::insideAngWindow(), BitArray< 9 >::set(), DTSectCollPhCand::setBitsSectColl(), DTTSCand::setBitsTsm(), and DTTSCand::setBitsTss().

239  {
240  assert(p>=0 && p+n<=this->nBits());
241  // only the n least significant bits of val are considered
242  for(int i=0; i<n;i++){
243  if(val>>i&1) {
244  this->set(p+i);
245  } else {
246  this->unset(p+i);
247  }
248  }
249  }
int nBits() const
Definition: BitArray.h:121
void unset(const int i)
Definition: BitArray.h:231
template<int N>
void BitArray< N >::assign ( const int  p,
const int  n,
const BitArray< N > &  val 
)
inline

Definition at line 250 of file BitArray.h.

250  {
251  assert(p>=0 && p+n<=this->nBits());
252  // only the n least significant bits of val are considered
253  for(int i=0; i<n;i++){
254  if(val.element(i)) {
255  this->set(p+i);
256  } else {
257  this->unset(p+i);
258  }
259  }
260  }
int nBits() const
Definition: BitArray.h:121
void unset(const int i)
Definition: BitArray.h:231
int element(const int pos) const
Definition: BitArray.h:210
template<int N>
void BitArray< N >::assign ( const int  p,
const int  n,
const char *  str 
)
inline

Definition at line 261 of file BitArray.h.

261  {
262  assert(p>=0 && p+n<=this->nBits());
263  // only the n least significant bits of val are considered
264  for(int i=0; i<n;i++){
265  assert(str[i]=='1'||str[i]=='0');
266  if(str[i]=='1') {
267  this->set(p+n-i-1); // reading a string from left to right
268  } else { // --> most significative bit is the one
269  this->unset(p+n-i-1); // with lower string index
270  }
271  }
272  }
int nBits() const
Definition: BitArray.h:121
void unset(const int i)
Definition: BitArray.h:231
#define str(s)
template<int N>
BitArray<8> BitArray< N >::byte ( const int  i) const
inline

Definition at line 287 of file BitArray.h.

Referenced by DTTSTheta::runDTTSTheta().

287  {
289  if(i>=0&&i<4*this->nWords()){
290  unsigned k=(_data[i/4]>>8*(i%4))&0xff;
291  out=k;
292  }
293  return out;
294  }
unsigned _data[N/32+1]
Definition: BitArray.h:519
int k[5][pyjets_maxn]
int nWords() const
Definition: BitArray.h:125
template<int N>
void BitArray< N >::cleanUnused ( )
inline

Definition at line 170 of file BitArray.h.

Referenced by BitArray< 9 >::BitArray(), and BitArray< 9 >::operator=().

170  {
171  _data[this->nWords()-1] &= (this->lastWordMask());
172  }
unsigned lastWordMask() const
Definition: BitArray.h:165
unsigned _data[N/32+1]
Definition: BitArray.h:519
int nWords() const
Definition: BitArray.h:125
template<int N>
int BitArray< N >::count ( void  ) const
inline

Definition at line 175 of file BitArray.h.

175  {
176  int n=0;
177  for(int i=0;i<this->nBits();i++) {
178  if(this->element(i))n++;
179  }
180  return n;
181  }
int nBits() const
Definition: BitArray.h:121
int element(const int pos) const
Definition: BitArray.h:210
template<int N>
unsigned BitArray< N >::dataWord ( const int  i) const
inline
template<int N>
unsigned& BitArray< N >::dataWord ( const int  i)
inline

Definition at line 132 of file BitArray.h.

132  {
133  assert(i>=0 && i<this->nWords());
134  return _data[i];
135  }
unsigned _data[N/32+1]
Definition: BitArray.h:519
int nWords() const
Definition: BitArray.h:125
template<int N>
int BitArray< N >::element ( const int  pos) const
inline
template<int N>
BitArray<N>& BitArray< N >::flip ( )
inline

Definition at line 406 of file BitArray.h.

Referenced by BitArray< 9 >::operator~().

406  {
407  for(int i=0;i<this->nWords();i++) {
408  _data[i] = ~_data[i];
409  }
410  return *this;
411  }
unsigned _data[N/32+1]
Definition: BitArray.h:519
int nWords() const
Definition: BitArray.h:125
template<int N>
static int BitArray< N >::getPosInWord ( const int  pos)
inlinestatic

Definition at line 148 of file BitArray.h.

Referenced by BitArray< 9 >::getPosMask(), and BitArray< N >::refToBit::refToBit().

148  {
149  // assert(pos>=0&& pos<this->nBits());
150  return pos%32;
151  }
template<int N>
static unsigned BitArray< N >::getPosMask ( const int  pos)
inlinestatic
template<int N>
unsigned& BitArray< N >::getWord ( const int  pos)
inline

Definition at line 138 of file BitArray.h.

Referenced by BitArray< 9 >::element(), BitArray< N >::refToBit::refToBit(), BitArray< 9 >::set(), and BitArray< 9 >::unset().

138  {
139  assert(pos>=0&& pos<this->nBits());
140  return _data[pos/32];
141  }
int nBits() const
Definition: BitArray.h:121
unsigned _data[N/32+1]
Definition: BitArray.h:519
template<int N>
unsigned BitArray< N >::getWord ( const int  pos) const
inline

Definition at line 142 of file BitArray.h.

142  {
143  assert(pos>=0&& pos<this->nBits());
144  return _data[pos/32];
145  }
int nBits() const
Definition: BitArray.h:121
unsigned _data[N/32+1]
Definition: BitArray.h:519
template<int N>
unsigned BitArray< N >::lastWordMask ( ) const
inline

Definition at line 165 of file BitArray.h.

Referenced by BitArray< 9 >::cleanUnused().

165  {
166  return static_cast<unsigned>(0xffffffff)>>(this->unusedBits());
167  }
int unusedBits() const
Definition: BitArray.h:159
template<int N>
int BitArray< N >::nBits ( ) const
inline
template<int N>
int BitArray< N >::none ( )
inline

Definition at line 197 of file BitArray.h.

197  {
198  int nw = this->nWords();
199  int ub = unusedBits();
200  if(this->dataWord(nw-1)<<ub!=0xffffffff)return 1;
201  if(nw>1){
202  for (int iw=0;iw<nw-1;iw++){
203  if(this->dataWord(iw)!=0xffffffff) return 1;
204  }
205  }
206  return 0;
207  }
int unusedBits() const
Definition: BitArray.h:159
unsigned dataWord(const int i) const
Definition: BitArray.h:128
int nWords() const
Definition: BitArray.h:125
template<int N>
int BitArray< N >::nWords ( ) const
inline
template<int N>
void BitArray< N >::one ( )
inline

Definition at line 223 of file BitArray.h.

Referenced by DTSectCollPhCand::clear(), DTTSCand::clear(), DTSectCollPhCand::DTSectCollPhCand(), DTTSCand::DTTSCand(), runEdmFileComparison.EdmObject::label(), and DTConfigTSPhi::setDefaults().

223  {
224  for (int i=0;i<this->nWords();i++) {
225  _data[i] = 0xffffffff; // set to 1
226  }
227  }
unsigned _data[N/32+1]
Definition: BitArray.h:519
int nWords() const
Definition: BitArray.h:125
template<int N>
bool BitArray< N >::operator!= ( const BitArray< N > &  a) const
inline

Definition at line 394 of file BitArray.h.

394 { return !(a==*this); }
template<int N>
BitArray<N> BitArray< N >::operator& ( const BitArray< N > &  a)
inline

Definition at line 425 of file BitArray.h.

425 {return BitArray<N> (*this)&=a; }
double a
Definition: hdecay.h:121
template<int N>
BitArray<N>& BitArray< N >::operator&= ( const BitArray< N > &  a)
inline

Definition at line 417 of file BitArray.h.

417  {
418  for(int i = 0;i<this->nWords();i++) {
419  this->dataWord(i) &= a.dataWord(i);
420  }
421  return *this;
422  }
unsigned dataWord(const int i) const
Definition: BitArray.h:128
int nWords() const
Definition: BitArray.h:125
template<int N>
BitArray<N> BitArray< N >::operator+ ( const BitArray< N > &  a)
inline

Definition at line 489 of file BitArray.h.

489 {return BitArray<N> (*this)+=a; }
double a
Definition: hdecay.h:121
template<int N>
BitArray<N>& BitArray< N >::operator++ ( int  )
inline

Definition at line 492 of file BitArray.h.

492  {
493  int i = 0;
494  while(i<this->nBits()&&this->element(i)==1) { this->unset(i); i++; }
495  if(i<this->nBits())this->set(i);
496  return *this;
497  }
int nBits() const
Definition: BitArray.h:121
void unset(const int i)
Definition: BitArray.h:231
int element(const int pos) const
Definition: BitArray.h:210
template<int N>
BitArray<N>& BitArray< N >::operator+= ( const BitArray< N > &  a)
inline

Definition at line 476 of file BitArray.h.

476  {
477  int rep=0;
478  int sum=0;
479  for(int i=0;i<this->nBits();i++) {
480  sum=this->element(i)^rep;
481  rep=this->element(i)&rep;
482  this->set(i,sum^a.element(i));
483  rep|=(sum&a.element(i));
484  }
485  return *this;
486  }
int nBits() const
Definition: BitArray.h:121
rep
Definition: cuy.py:1189
int element(const int pos) const
Definition: BitArray.h:210
template<int N>
BitArray<N> BitArray< N >::operator- ( const BitArray< N > &  a)
inline

Definition at line 515 of file BitArray.h.

515 {return BitArray<N> (*this)-=a; }
double a
Definition: hdecay.h:121
template<int N>
BitArray<N>& BitArray< N >::operator-= ( const BitArray< N > &  a)
inline

Definition at line 510 of file BitArray.h.

510  {
511  return *this+=a.twoComplement();
512  }
BitArray< N > twoComplement() const
Definition: BitArray.h:500
template<int N>
bool BitArray< N >::operator< ( const BitArray< N > &  a) const
inline

Definition at line 371 of file BitArray.h.

371  {
372  int nw = this->nWords();
373  int ub = this->unusedBits();
374  unsigned aaa = this->dataWord(nw-1)<<ub; // ignore unused bits
375  unsigned bbb = a.dataWord(nw-1)<<ub; // in both operands
376  if (aaa<bbb) {
377  return true;
378  } else if (aaa>bbb) {
379  return false;
380  }
381  if(nw>1){
382  for (int iw=nw-2;iw>=0;iw--){
383  if (this->dataWord(iw)<a.dataWord(iw)) {
384  return true;
385  } else if (this->dataWord(iw)>a.dataWord(iw)) {
386  return false;
387  }
388  }
389  }
390  return false;
391  }
int unusedBits() const
Definition: BitArray.h:159
unsigned dataWord(const int i) const
Definition: BitArray.h:128
int nWords() const
Definition: BitArray.h:125
template<int N>
BitArray<N> BitArray< N >::operator<< ( const int  n)
inline

Definition at line 460 of file BitArray.h.

460 { return BitArray<N> (*this)<<=n; }
template<int N>
BitArray<N>& BitArray< N >::operator<<= ( const int  n)
inline

Definition at line 450 of file BitArray.h.

450  {
451  assert(n>=0&&n<this->nBits());
452  if(n==0)return *this;
453  int i=0;
454  for(i=this->nBits()-1;i>=n;i--) this->set(i,this->element(i-n));
455  for(i=n-1;i>=0;i--) this->unset(i);
456  return *this;
457  }
int nBits() const
Definition: BitArray.h:121
void unset(const int i)
Definition: BitArray.h:231
int element(const int pos) const
Definition: BitArray.h:210
template<int N>
bool BitArray< N >::operator<= ( const BitArray< N > &  a) const
inline

Definition at line 403 of file BitArray.h.

403 { return !(*this>a); }
double a
Definition: hdecay.h:121
template<int N>
BitArray<N>& BitArray< N >::operator= ( const BitArray< N > &  a)
inline

Definition at line 296 of file BitArray.h.

296  {
297  if(this != &a) {
298  for (int i=0;i<this->nWords();i++) {
299  _data[i] = a._data[i];
300  }
301  }
302  this->cleanUnused();
303  return *this;
304  }
unsigned _data[N/32+1]
Definition: BitArray.h:519
void cleanUnused()
Definition: BitArray.h:170
int nWords() const
Definition: BitArray.h:125
template<int N>
BitArray<N>& BitArray< N >::operator= ( const unsigned  i)
inline

Definition at line 307 of file BitArray.h.

307  {
308  this->zero();
309  _data[0] = i; // the nBit least sign. bits are considered
310  this->cleanUnused();
311  return *this;
312  }
void zero()
Definition: BitArray.h:216
unsigned _data[N/32+1]
Definition: BitArray.h:519
void cleanUnused()
Definition: BitArray.h:170
template<int N>
BitArray<N>& BitArray< N >::operator= ( const char *  str)
inline

Definition at line 328 of file BitArray.h.

328  {
329  this->zero();
330  for(int i=0; i<this->nBits();i++){
331  assert(str[i]=='1'||str[i]=='0');
332  if(str[i]=='1') {
333  this->set(this->nBits()-i-1); // reading a string from left to right
334  } else if(str[i]=='0') { // --> most significative bit is the one
335  this->unset(this->nBits()-i-1); // with lower string index
336  } else {
337  break; // exit when find a char which is not 0 or 1
338  }
339  }
340  this->cleanUnused();
341  return *this;
342  }
void zero()
Definition: BitArray.h:216
int nBits() const
Definition: BitArray.h:121
void cleanUnused()
Definition: BitArray.h:170
void unset(const int i)
Definition: BitArray.h:231
#define str(s)
template<int N>
bool BitArray< N >::operator== ( const BitArray< N > &  a) const
inline

Definition at line 357 of file BitArray.h.

357  {
358  int nw = this->nWords();
359  int ub = this->unusedBits();
360  if(this->dataWord(nw-1)<<ub!= // check last word
361  a.dataWord(nw-1)<<ub)return false;
362  if(nw>1){
363  for (int iw=0;iw<nw-1;iw++){
364  if(this->dataWord(iw)!=a.dataWord(iw)) return false;
365  }
366  }
367  return true;
368  }
int unusedBits() const
Definition: BitArray.h:159
unsigned dataWord(const int i) const
Definition: BitArray.h:128
int nWords() const
Definition: BitArray.h:125
template<int N>
bool BitArray< N >::operator> ( const BitArray< N > &  a) const
inline

Definition at line 400 of file BitArray.h.

400 { return !(*this<a||*this==a); }
double a
Definition: hdecay.h:121
template<int N>
bool BitArray< N >::operator>= ( const BitArray< N > &  a) const
inline

Definition at line 397 of file BitArray.h.

397 { return !(*this<a); }
double a
Definition: hdecay.h:121
template<int N>
BitArray<N> BitArray< N >::operator>> ( const int  n)
inline

Definition at line 473 of file BitArray.h.

473 { return BitArray<N> (*this)>>=n; }
template<int N>
BitArray<N>& BitArray< N >::operator>>= ( const int  n)
inline

Definition at line 463 of file BitArray.h.

463  {
464  assert(n>=0&&n<this->nBits());
465  if(n==0)return *this;
466  int i=0;
467  for(i=0;i<this->nBits()-n;i++) this->set(i,this->element(i+n));
468  for(i=this->nBits()-n;i<this->nBits();i++) this->unset(i);
469  return *this;
470  }
int nBits() const
Definition: BitArray.h:121
void unset(const int i)
Definition: BitArray.h:231
int element(const int pos) const
Definition: BitArray.h:210
template<int N>
refToBit BitArray< N >::operator[] ( const int  pos)
inline

Definition at line 353 of file BitArray.h.

353 { return refToBit(*this,pos); }
friend class refToBit
Definition: BitArray.h:33
template<int N>
int BitArray< N >::operator[] ( const int  pos) const
inline

Definition at line 354 of file BitArray.h.

354 { return element(pos); }
int element(const int pos) const
Definition: BitArray.h:210
template<int N>
BitArray<N> BitArray< N >::operator^ ( const BitArray< N > &  a)
inline

Definition at line 447 of file BitArray.h.

447 {return BitArray<N> (*this)^=a; }
double a
Definition: hdecay.h:121
template<int N>
BitArray<N>& BitArray< N >::operator^= ( const BitArray< N > &  a)
inline

Definition at line 439 of file BitArray.h.

439  {
440  for(int i = 0;i<this->nWords();i++) {
441  this->dataWord(i) ^= a.dataWord(i);
442  }
443  return *this;
444  }
unsigned dataWord(const int i) const
Definition: BitArray.h:128
int nWords() const
Definition: BitArray.h:125
template<int N>
BitArray<N> BitArray< N >::operator| ( const BitArray< N > &  a)
inline

Definition at line 436 of file BitArray.h.

436 {return BitArray<N> (*this)|=a;}
double a
Definition: hdecay.h:121
template<int N>
BitArray<N>& BitArray< N >::operator|= ( const BitArray< N > &  a)
inline

Definition at line 428 of file BitArray.h.

428  {
429  for(int i = 0;i<this->nWords();i++) {
430  this->dataWord(i) |= a.dataWord(i);
431  }
432  return *this;
433  }
unsigned dataWord(const int i) const
Definition: BitArray.h:128
int nWords() const
Definition: BitArray.h:125
template<int N>
BitArray<N> BitArray< N >::operator~ ( ) const
inline

Definition at line 414 of file BitArray.h.

414 { return BitArray<N> (*this).flip(); }
BitArray< N > & flip()
Definition: BitArray.h:406
template<int N>
std::ostream& BitArray< N >::print ( std::ostream &  o = std::cout) const
inline

Definition at line 345 of file BitArray.h.

Referenced by DTBtiChip::keepTrig(), DTBtiChip::keepTrigPatt(), DTSectCollPhCand::print(), DTTSCand::print(), and DTConfigTSPhi::print().

345  {
346  for(int i = this->nBits()-1; i>=0; i--){
347  o << this->element(i);
348  }
349  return o;
350  }
int nBits() const
Definition: BitArray.h:121
int element(const int pos) const
Definition: BitArray.h:210
template<int N>
unsigned BitArray< N >::read ( const int  p,
const int  n 
) const
inline

Definition at line 275 of file BitArray.h.

Referenced by edmIntegrityCheck.PublishToFileSystem::get(), and DTTracoChip::insideAngWindow().

275  {
276  assert(p>=0 && p+n<=this->nBits());
277  assert(n<=32); // the output must fit in a 32 bit word
278  // only the n least significant bits of val are considered
279  unsigned out=0x0;
280  for(int i=0; i<n;i++){
281  if(this->test(p+i)) out |= 1<<i;
282  }
283  return out;
284  }
int test(const int i) const
Definition: BitArray.h:213
int nBits() const
Definition: BitArray.h:121
template<int N>
void BitArray< N >::reset ( void  )
inline

Definition at line 221 of file BitArray.h.

Referenced by DTBtiChip::keepTrigPatt().

221 { zero(); }
void zero()
Definition: BitArray.h:216
template<int N>
void BitArray< N >::reset ( const int  i)
inline

Definition at line 232 of file BitArray.h.

232 { this->unset(i); }
void unset(const int i)
Definition: BitArray.h:231
template<int N>
void BitArray< N >::set ( const int  i)
inline
template<int N>
void BitArray< N >::set ( const int  i,
const int  val 
)
inline

Definition at line 235 of file BitArray.h.

235 { this->assign(i,1,val); }
void assign(const int p, const int n, const int val)
Definition: BitArray.h:239
template<int N>
void BitArray< N >::set ( const int  i,
const char *  str 
)
inline

Definition at line 236 of file BitArray.h.

236 { this->assign(i,1,str); }
void assign(const int p, const int n, const int val)
Definition: BitArray.h:239
#define str(s)
template<int N>
int BitArray< N >::size ( void  ) const
inline

Definition at line 122 of file BitArray.h.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

122 { return this->nBits(); }
int nBits() const
Definition: BitArray.h:121
template<int N>
int BitArray< N >::test ( const int  i) const
inline

Definition at line 213 of file BitArray.h.

Referenced by BitArray< 9 >::read(), edmIntegrityCheck.IntegrityCheck::report(), and edmIntegrityCheck.IntegrityCheck::structured().

213 { return element(i); }
int element(const int pos) const
Definition: BitArray.h:210
template<int N>
BitArray<N> BitArray< N >::twoComplement ( ) const
inline

Definition at line 500 of file BitArray.h.

Referenced by DTTracoChip::insideAngWindow(), and BitArray< 9 >::operator-=().

500 { return BitArray<N> (~*this)++; }
template<int N>
BitArray<N>& BitArray< N >::twoComplement ( )
inline

Definition at line 503 of file BitArray.h.

503  {
504  (*this).flip();
505  (*this)++;
506  return *this;
507  }
template<int N>
void BitArray< N >::unset ( const int  i)
inline
template<int N>
int BitArray< N >::unusedBits ( ) const
inline

Definition at line 159 of file BitArray.h.

Referenced by BitArray< 9 >::any(), BitArray< 9 >::lastWordMask(), BitArray< 9 >::none(), BitArray< 9 >::operator<(), and BitArray< 9 >::operator==().

159  {
160  if(this->nBits()==0)return 32;
161  return 31-((this->nBits()-1)%32);
162  }
int nBits() const
Definition: BitArray.h:121
template<int N>
void BitArray< N >::zero ( )
inline

Definition at line 216 of file BitArray.h.

Referenced by BitArray< 9 >::BitArray(), DTTracoChip::clear(), DTTracoChip::DTTracoChip(), DTTSTheta::DTTSTheta(), DTTSTheta::localClear(), BitArray< 9 >::operator=(), and BitArray< 9 >::reset().

216  {
217  for (int i=0;i<this->nWords();i++) {
218  _data[i] = 0x0; // set to 0
219  }
220  }
unsigned _data[N/32+1]
Definition: BitArray.h:519
int nWords() const
Definition: BitArray.h:125

Friends And Related Function Documentation

template<int N>
friend class refToBit
friend

Definition at line 33 of file BitArray.h.

Member Data Documentation

template<int N>
unsigned BitArray< N >::_data[N/32+1]
private