LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LCFlagImpl.cc
Go to the documentation of this file.
1 #include "IMPL/LCFlagImpl.h"
2 
3 
4 using namespace EVENT ;
5 
6 namespace IMPL {
7 
8  LCFlagImpl::LCFlagImpl() : _flag(0) {}
9 
10  LCFlagImpl::LCFlagImpl(int flag) : _flag( flag ) {}
11 
12 
13  bool LCFlagImpl::bitSet(int bit) const { return (_flag & (1<< bit) ) ? true : false ; }
14 
15  int LCFlagImpl::getFlag() const { return _flag ; }
16 
17 
18  void LCFlagImpl::setBit(int bit) {
19 
20  if( 0<=bit && bit<=31 && !bitSet( bit) ){
21 
22  _flag = _flag | ( 1 << bit ) ;
23 
24  }
25  }
26 
27 
28  void LCFlagImpl::unsetBit(int bit){
29 
30  if( 0<=bit && bit<=31 && bitSet( bit) ){
31 
32  _flag = _flag & ~( 1 << bit ) ;
33 
34  }
35  }
36 
37 } // namespace
LCFlagImpl()
Constructor initializing flag with 0.
Definition: LCFlagImpl.cc:8
virtual bool bitSet(int index) const
Returns true if bit at given index is set.
Definition: LCFlagImpl.cc:13
virtual void unsetBit(int bit)
Sets bit to 0.
Definition: LCFlagImpl.cc:28
virtual int getFlag() const
Returns the flag word.
Definition: LCFlagImpl.cc:15
virtual void setBit(int bit)
Sets bit to 1.
Definition: LCFlagImpl.cc:18