pieceMask64.h
Go to the documentation of this file.
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
00076 #ifdef __GNUC__
00077         __attribute__ ((pure))
00078 #endif
00079     countBit() const 
00080     {
00081       return mask.countBit();
00082     }
00083     int takeOneBit()
00084     {
00085       assert(!none());
00086       return mask.takeOneBit();
00087     }
00088   };
00089 } // namespace container
00090   using container::PieceMask64;
00091 } // namespace osl
00092 
00093 
00094 #endif /* PIECEMASK64_H */
00095 // ;;; Local Variables:
00096 // ;;; mode:c++
00097 // ;;; c-basic-offset:2
00098 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines