controlw.h
Go to the documentation of this file.
1 
7 
8 
9 #ifndef CONTROL_WORD_LIB
10 #define CONTROL_WORD_LIB 0
11 
15 {
16 protected:
17  int cw; // the control word
18 public:
19  ControlWord() : cw(0) {} // do nothing
20  ControlWord(int i) : cw(i) {} // load an integer
21 
22  // select specific bits (for testing at least one set)
24  { return ControlWord(cw & i.cw); }
25  void operator*=(ControlWord i) { cw &= i.cw; }
26 
27  // set bits
29  { return ControlWord(cw | i.cw); }
30  void operator+=(ControlWord i) { cw |= i.cw; }
31 
32  // reset bits
34  { return ControlWord(cw - (cw & i.cw)); }
35  void operator-=(ControlWord i) { cw -= (cw & i.cw); }
36 
37  // check if all of selected bits set or reset
38  bool operator>=(ControlWord i) const { return (cw & i.cw) == i.cw; }
39  bool operator<=(ControlWord i) const { return (cw & i.cw) == cw; }
40 
41  // flip selected bits
43  { return ControlWord(cw ^ i.cw); }
44  ControlWord operator~() const { return ControlWord(~cw); }
45 
46  // convert to integer
47  int operator+() const { return cw; }
48  int operator!() const { return cw==0; }
50 };
51 
52 
53 #endif
54 
56 
void operator+=(ControlWord i)
Definition: controlw.h:30
ControlWord operator*(ControlWord i) const
Definition: controlw.h:23
ControlWord()
Definition: controlw.h:19
ControlWord operator-(ControlWord i) const
Definition: controlw.h:33
void operator*=(ControlWord i)
Definition: controlw.h:25
ControlWord operator^(ControlWord i) const
Definition: controlw.h:42
ControlWord operator+(ControlWord i) const
Definition: controlw.h:28
bool operator<=(ControlWord i) const
Definition: controlw.h:39
#define FREE_CHECK(Class)
Definition: myexcept.h:328
bool operator>=(ControlWord i) const
Definition: controlw.h:38
void operator-=(ControlWord i)
Definition: controlw.h:35
ControlWord(int i)
Definition: controlw.h:20
int operator+() const
Definition: controlw.h:47
ControlWord operator~() const
Definition: controlw.h:44
int operator!() const
Definition: controlw.h:48


kni
Author(s): Martin Günther
autogenerated on Fri Jan 3 2020 04:01:16