effectedNumTable.h
Go to the documentation of this file.
00001 #ifndef _EFFECTED_NUM_TABLE_H
00002 #define _EFFECTED_NUM_TABLE_H
00003 #include "osl/state/simpleState.h"
00004 #include <iosfwd>
00005 namespace osl
00006 {
00007   namespace effect
00008   {
00009     union Byte8 {
00010       unsigned long long lv;
00011       CArray<unsigned char,8> uc;
00012     }
00013 #ifdef __GNUC__
00014     __attribute__((aligned(8)))
00015 #endif
00016       ;
00023     class EffectedNum
00024     {
00025     private:
00026       Byte8 b8;
00027     public:
00028       EffectedNum() { clear(); }
00029       void clear(){
00030 #define E(n) ((static_cast<unsigned long long>(EMPTY_NUM)<<((n)*8)))
00031         b8.lv= E(0)|E(1)|E(2)|E(3)|E(4)|E(5)|E(6)|E(7);
00032 #undef E
00033       }
00034       int operator[](Direction d) const{
00035         assert(0<=d && d<=7);
00036         return b8.uc[d];
00037       }
00038       unsigned char& operator[](Direction d){
00039         assert(0<=d && d<=7);
00040         return b8.uc[d];
00041       }
00042     };
00043     class EffectedNumTable
00044     {
00045       CArray<EffectedNum,40> contents
00046 #ifdef __GNUC__
00047       __attribute__((aligned(16)))
00048 #endif
00049         ;
00050     public:
00051       EffectedNumTable() { clear(); }
00052       EffectedNumTable(SimpleState const&);
00053       const EffectedNum& operator[](int i) const {
00054         return contents[i];
00055       }
00056       void clear();
00057       EffectedNum& operator[](int i){
00058         return contents[i];
00059       }
00060     };
00061     bool operator==(const EffectedNumTable&,const EffectedNumTable&);
00062     std::ostream& operator<<(std::ostream&,const EffectedNumTable&);
00063   }
00064   using effect::EffectedNumTable;
00065 }
00066 
00067 #endif // _EFFECTED_NUM_TABLE_H
00068 // ;;; Local Variables:
00069 // ;;; mode:c++
00070 // ;;; c-basic-offset:2
00071 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines