CMS 3D CMS Logo

Flag.h
Go to the documentation of this file.
1 #ifndef DQM_HcalCommon_Flag_h
2 #define DQM_HcalCommon_Flag_h
3 
5 
6 namespace hcaldqm {
7  namespace flag {
8  //
9  // State Definition. In the increasing order of worsiness.
10  // States(as flags) can be added
11  // s1 + s2 = max(s1,s2) - that allows to set the worse of the 2
12  //
13  enum State {
14  fNONE = 0, // No State - can't have... not used....
15  fNCDAQ = 1, // not @cDAQ
16  fNA = 2, // Not Applicable
17  fGOOD = 3, // GOOD
18  fPROBLEMATIC = 4, // problem
19  fBAD = 5, // bad
20  fRESERVED = 6, // reserved
21  nState = 7
22  };
23 
24  struct Flag {
25  Flag() : _name("SOMEFLAG"), _state(fNA) {}
27  Flag(Flag const &f) : _name(f._name), _state(f._state) {}
28 
29  //
30  // add 2 flags
31  //
32  Flag operator+(Flag const &f) {
33  return Flag(_name != f._name ? "SOMEFLAG" : _name, (State)(std::max(_state, f._state)));
34  }
35 
36  //
37  // add 2 flags and save
38  //
39  Flag &operator+=(Flag const &f) {
40  _state = (State)(std::max(_state, f._state));
41  return *this;
42  }
43 
44  //
45  // compare 2 flags
46  //
47  bool operator==(Flag const &f) { return (_state == f._state && _name == f._name); }
48 
49  //
50  // Assignment
51  //
52  Flag &operator=(Flag const &f) {
53  _name = f._name;
54  _state = f._state;
55  return *this;
56  }
57 
58  // reset the state to NA
59  void reset() { _state = fNA; }
60 
63  };
64  } // namespace flag
65 } // namespace hcaldqm
66 
67 #endif
hcaldqm::flag::Flag
Definition: Flag.h:24
hcaldqm::flag::Flag::_state
State _state
Definition: Flag.h:62
hcaldqm::flag::State
State
Definition: Flag.h:13
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
hcaldqm::flag::Flag::operator+=
Flag & operator+=(Flag const &f)
Definition: Flag.h:39
hcaldqm::flag::nState
Definition: Flag.h:21
hcaldqm::flag::fGOOD
Definition: Flag.h:17
hcaldqm
Definition: Constants.h:8
hcaldqm::flag::fNONE
Definition: Flag.h:14
hcaldqm::flag::Flag::Flag
Flag(Flag const &f)
Definition: Flag.h:27
hcaldqm::flag::fBAD
Definition: Flag.h:19
HcalCommonHeaders.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
hcaldqm::flag::Flag::operator+
Flag operator+(Flag const &f)
Definition: Flag.h:32
hcaldqm::flag::Flag::Flag
Flag()
Definition: Flag.h:25
hcaldqm::flag::fNA
Definition: Flag.h:16
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
hcaldqm::flag::Flag::reset
void reset()
Definition: Flag.h:59
hcaldqm::flag::Flag::operator=
Flag & operator=(Flag const &f)
Definition: Flag.h:52
hcaldqm::flag::fRESERVED
Definition: Flag.h:20
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
hcaldqm::flag::fPROBLEMATIC
Definition: Flag.h:18
hcaldqm::flag::Flag::Flag
Flag(std::string const &name, State s=fNA)
Definition: Flag.h:26
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
hcaldqm::flag::fNCDAQ
Definition: Flag.h:15
hcaldqm::flag::Flag::_name
std::string _name
Definition: Flag.h:61
hcaldqm::flag::Flag::operator==
bool operator==(Flag const &f)
Definition: Flag.h:47
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:117