Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

domino.h

Go to the documentation of this file.
00001 
00025 #ifndef DMN_DOMINO_H
00026 #define DMN_DOMINO_H 1
00027 
00028 
00029 namespace dmn
00030 {
00034   const int invalid_half = -1;
00035 
00039   class HalfDomino
00040   {
00041   private:
00042     int half_;
00043 
00044   public:
00048     HalfDomino();
00049 
00055     HalfDomino(const int half);
00056 
00062     int half() const;
00063 
00069     bool is_valid() const;
00070 
00074     operator int() const;
00075 
00084     friend bool operator==(const HalfDomino& halfdomino1,
00085          const HalfDomino& halfdomino2);
00086 
00095     friend bool operator!=(const HalfDomino& halfdomino1,
00096          const HalfDomino& halfdomino2);
00097   };
00098 
00102   class Domino
00103   {
00104   private:
00105     HalfDomino half1_;
00106     HalfDomino half2_;
00107 
00108   public:
00112     Domino();
00113 
00120     Domino(const HalfDomino& half1, const HalfDomino& half2);
00121 
00127     HalfDomino half1() const;
00128 
00134     HalfDomino half2() const;
00135 
00142     bool is_double() const;
00143 
00149     bool has_half(const HalfDomino& half) const;
00150 
00156     void reverse();
00157 
00166     friend bool operator==(const Domino& domino1, const Domino& domino2);
00167 
00176     friend bool operator!=(const Domino& domino1, const Domino& domino2);
00177   };
00178 
00179   // Invalid values
00183   const HalfDomino HALFDOMINO_NULL(invalid_half);
00187   const Domino DOMINO_NULL(HALFDOMINO_NULL, HALFDOMINO_NULL);
00188 };
00189 
00190 
00191 #endif // DMN_DOMINO_H

Generated on Fri Dec 26 22:52:54 2003 for dmn by doxygen 1.3.4