Class documentation of Concepts

Loading...
Searching...
No Matches
Zm.hh
Go to the documentation of this file.
1
6#ifndef Zm_h
7#define Zm_h
8
9#include "typedefs.hh"
10
11namespace concepts {
12 // ******************************************************************** Z2 **
13
16 class Z2 {
18 uchar i_;
19 public:
21 Z2() : i_(0) {}
23 Z2(uint i) : i_(i&1) {}
24
26 operator int() const { return i_; }
27
29 int operator=(int i) { return i_ = i & 1; }
31 int operator++() { return i_ ^= 1; }
33 Z2 succ() const { return i_ ^ 1; }
34 };
35
36 // ******************************************************************** Z3 **
37
40 class Z3 {
42 uchar i_;
43 public:
45 Z3() : i_(0) {}
47 Z3(uint i) : i_(i - 3 * (i / 3)) {}
48
50 operator int() const { return i_; }
51
53 int operator=(int i) { return i_ = i - 3 * (i / 3); }
55 int operator++() { return i_ = i_ == 2 ? 0 : i_ + 1; }
57 int operator--() { return i_ = i_ ? i_ - 1 : 2; }
59 Z3 succ() const { return i_ == 2 ? 0 : i_ + 1; }
61 Z3 pred() const { return i_ ? i_ - 1 : 2; }
62 };
63
64 // ******************************************************************** Z4 **
65
68 class Z4 {
70 uchar i_;
71 public:
73 Z4() : i_(0) {}
75 Z4(uint i) : i_(i & 3) {}
76
78 operator int() const { return i_; }
79
81 int operator=(int i) { return i_ = i & 3; }
83 int operator++() { ++i_; return i_ &= 3; }
85 int operator--() { --i_; return i_ &= 3; }
87 Z4 succ() const { return (i_ + 1) & 3; }
89 Z4 pred() const { return (i_ - 1) & 3; }
90 };
91
92} // namespace concepts
93
94#endif // Zm_h
int operator=(int i)
Assignment operator.
Definition Zm.hh:29
Z2 succ() const
Returns the successor.
Definition Zm.hh:33
Z2()
Default constructor. Initialises to 0.
Definition Zm.hh:21
int operator++()
Increment operator.
Definition Zm.hh:31
Z2(uint i)
Constructor.
Definition Zm.hh:23
Z3 succ() const
Returns the successor.
Definition Zm.hh:59
Z3(uint i)
Constructor.
Definition Zm.hh:47
Z3()
Default constructor. Initialises to 0.
Definition Zm.hh:45
int operator--()
Decrement operator.
Definition Zm.hh:57
int operator=(int i)
Assignment operator.
Definition Zm.hh:53
int operator++()
Increment operator.
Definition Zm.hh:55
Z3 pred() const
Returns the predecessor.
Definition Zm.hh:61
Z4 pred() const
Returns the predecessor.
Definition Zm.hh:89
Z4()
Default constructor. Initialises to 0.
Definition Zm.hh:73
int operator=(int i)
Assignment operator.
Definition Zm.hh:81
int operator--()
Decrement operator.
Definition Zm.hh:85
Z4 succ() const
Returns the successor.
Definition Zm.hh:87
Z4(uint i)
Constructor.
Definition Zm.hh:75
int operator++()
Increment operator.
Definition Zm.hh:83
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320
unsigned char uchar
Abbreviation for unsigned char.
Definition typedefs.hh:48