DOCI-Exact  1.0
Permutation.h
Go to the documentation of this file.
1 #ifndef PERMUTATION_H
2 #define PERMUTATION_H
3 
4 // use unsigned long by default
5 #if not defined(USELONG) && not defined(USELONGLONG)
6 #define USELONG
7 #endif
8 
9 #if defined(USELONG) && defined(USELONGLONG)
10 #error "You really have to choose between unsigned long and unsigned long long!"
11 #endif
12 
13 #if defined(USELONG)
14 typedef unsigned long mybitset;
16 #elif defined(USELONGLONG)
17 typedef unsigned long long mybitset;
19 #endif
20 
21 
22 
28 namespace doci {
29 
41 {
42  public:
43  Permutation(unsigned int);
44 
45  virtual mybitset next();
46 
47  virtual mybitset get() const;
48 
49  virtual void reset();
50 
51  static unsigned long long CalcCombinations(unsigned int, unsigned int);
52 
53  static unsigned long long gcd(unsigned long long, unsigned long long);
54 
55  static unsigned int getMax();
56 
57  private:
58 
60  mybitset current;
61 
63  unsigned int n;
64 };
65 
66 }
67 
68 #endif /* PERMUTATION_H */
69 
70 /* vim: set ts=3 sw=3 expandtab :*/
Permutation(unsigned int)
Definition: Permutation.cpp:14
virtual mybitset next()
Definition: Permutation.cpp:30
static unsigned long long CalcCombinations(unsigned int, unsigned int)
Definition: Permutation.cpp:78
static unsigned long long gcd(unsigned long long, unsigned long long)
virtual void reset()
Definition: Permutation.cpp:66
static unsigned int getMax()