effectedNumTable.h
Go to the documentation of this file.
#ifndef _EFFECTED_NUM_TABLE_H
#define _EFFECTED_NUM_TABLE_H
#include "osl/simpleState.h"
#include <iosfwd>
namespace osl
{
namespace effect
{
union Byte8 {
unsigned long long lv;
CArray<unsigned char,8> uc;
}
#ifdef __GNUC__
__attribute__((aligned(8)))
#endif
;
class EffectedNum
{
private:
Byte8 b8;
public:
EffectedNum() { clear(); }
void clear(){
#define E(n) ((static_cast<unsigned long long>(EMPTY_NUM)<<((n)*8)))
b8.lv= E(0)|E(1)|E(2)|E(3)|E(4)|E(5)|E(6)|E(7);
#undef E
}
int operator[](Direction d) const{
assert(0<=d && d<=7);
return b8.uc[d];
}
unsigned char& operator[](Direction d){
assert(0<=d && d<=7);
return b8.uc[d];
}
};
class EffectedNumTable
{
CArray<EffectedNum,40> contents
#ifdef __GNUC__
__attribute__((aligned(16)))
#endif
;
public:
EffectedNumTable() { clear(); }
EffectedNumTable(SimpleState const&);
const EffectedNum& operator[](int i) const {
return contents[i];
}
void clear();
EffectedNum& operator[](int i){
return contents[i];
}
};
bool operator==(const EffectedNumTable&,const EffectedNumTable&);
std::ostream& operator<<(std::ostream&,const EffectedNumTable&);
}
using effect::EffectedNumTable;
}
#endif // _EFFECTED_NUM_TABLE_H
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
osl::CArray
Definition container.h:20
osl::SimpleState
Definition simpleState.h:35
osl::effect::EffectedNumTable
Definition effectedNumTable.h:44
osl::effect::EffectedNumTable::operator[]
EffectedNum & operator[](int i)
Definition effectedNumTable.h:57
osl::effect::EffectedNumTable::EffectedNumTable
EffectedNumTable()
Definition effectedNumTable.h:51
osl::effect::EffectedNumTable::clear
void clear()
Definition effectedNumTable.cc:9
osl::effect::EffectedNumTable::contents
CArray< EffectedNum, 40 > contents
Definition effectedNumTable.h:49
osl::effect::EffectedNumTable::operator[]
const EffectedNum & operator[](int i) const
Definition effectedNumTable.h:53
osl::effect::EffectedNum
盤面上の駒が「黒から見た」方向に長い利きをつけられている時に， 利きをつけている駒の番号を得る たとえば，Uの時は下から上方向の長い利きがついているものとする． その方向の利きがついていない場合はEMP...
Definition effectedNumTable.h:24
osl::effect::EffectedNum::operator[]
unsigned char & operator[](Direction d)
Definition effectedNumTable.h:38
osl::effect::EffectedNum::b8
Byte8 b8
Definition effectedNumTable.h:26
osl::effect::EffectedNum::clear
void clear()
Definition effectedNumTable.h:29
osl::effect::EffectedNum::EffectedNum
EffectedNum()
Definition effectedNumTable.h:28
osl::effect::EffectedNum::operator[]
int operator[](Direction d) const
Definition effectedNumTable.h:34
E
#define E(n)
osl::effect
Definition effectedNumTable.h:8
osl::effect::operator<<
std::ostream & operator<<(std::ostream &, const EffectedNumTable &)
Definition effectedNumTable.cc:37
osl::effect::operator==
bool operator==(const EffectedNumTable &, const EffectedNumTable &)
Definition effectedNumTable.cc:47
osl
Definition additionalEffect.h:6
osl::Direction
Direction
Definition basic_type.h:310
osl::__attribute__
const PtypeO PTYPEO_EDGE __attribute__((unused))
simpleState.h
osl::effect::Byte8
Definition effectedNumTable.h:9
osl::effect::Byte8::uc
CArray< unsigned char, 8 > uc
Definition effectedNumTable.h:11
osl::effect::Byte8::lv
unsigned long long lv
Definition effectedNumTable.h:10