00001 /* pieceMask64.h 00002 */ 00003 #ifndef PIECEMASK64_H 00004 #define PIECEMASK64_H 00005 00006 #include "osl/misc/mask.h" 00007 00008 namespace osl 00009 { 00010 namespace container 00011 { 00012 class PieceMask64 00013 { 00014 protected: 00015 misc::Mask64 mask; 00016 public: 00017 static int numToIndex(int) { return 0; } 00018 static int numToOffset(int num) { return num; } 00019 PieceMask64() { resetAll(); } 00020 explicit PieceMask64(misc::Mask64 const& m) : mask(m) {} 00021 protected: 00022 misc::Mask64& mutableMask(int) { return mask; } 00023 public: 00024 const misc::Mask64& getMask(int) const { return mask; } 00025 void resetAll() 00026 { 00027 mask=misc::Mask64::makeDirect(0uLL); 00028 } 00029 void setAll() 00030 { 00031 mask=misc::Mask64::makeDirect(0xffffffffffuLL); 00032 } 00033 PieceMask64& operator^=(const PieceMask64& o) 00034 { 00035 mask ^= o.mask; 00036 return *this; 00037 } 00038 PieceMask64& operator&=(const PieceMask64& o) 00039 { 00040 mask &= o.mask; 00041 return *this; 00042 } 00043 PieceMask64& operator|=(const PieceMask64& o) 00044 { 00045 mask |= o.mask; 00046 return *this; 00047 } 00048 PieceMask64& operator-=(const PieceMask64& o) 00049 { 00050 mask -= o.mask; 00051 return *this; 00052 } 00053 PieceMask64& operator+=(const PieceMask64& o) 00054 { 00055 mask += o.mask; 00056 return *this; 00057 } 00058 bool none() const { return mask.none(); } 00059 bool hasMultipleBit() const 00060 { 00061 if (none()) 00062 return false; 00063 return mask.hasMultipleBit(); 00064 } 00069 int countBit2() const 00070 { 00071 if (none()) 00072 return 0; 00073 return mask.countBit2(); 00074 } 00075 int countBit() const 00076 { 00077 return mask.countBit(); 00078 } 00079 int takeOneBit() 00080 { 00081 assert(!none()); 00082 return mask.takeOneBit(); 00083 } 00084 }; 00085 } // namespace container 00086 using container::PieceMask64; 00087 } // namespace osl 00088 00089 00090 #endif /* PIECEMASK64_H */ 00091 // ;;; Local Variables: 00092 // ;;; mode:c++ 00093 // ;;; c-basic-offset:2 00094 // ;;; End: