moveSignature.cc Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
moveSignature.cc
Go to the documentation of this file.
1 #include "osl/effect/moveSignature.h"
2 #include "osl/misc/loki.h"
3 #include <iostream>
4
5 namespace osl
6 {
7 namespace effect
8 {
9 std::ostream& operator<<(std::ostream& os,const MoveSignature signature){
10 os << "Signature[";
11 for(int i=7;i>=0;i--){
12 if((signature&(1<<i))!=0) os<< "1";
13 else os<< "0";
14 }
15 return os << "]";
16 }
17
18
19 template<Ptype T>
20 void MoveSignatureTable::setSignature(){
21 signatures[static_cast<int>(newPtypeO(BLACK,T)-PTYPEO_MIN)]=
22 SignatureTraits<T>::signature | getPlayerMask<BLACK>();
23 signatures[static_cast<int>(newPtypeO(WHITE,T)-PTYPEO_MIN)]=
24 SignatureTraits<T>::signature | getPlayerMask<WHITE>();
25 }
26
27 template<Ptype T>
28 void MoveSignatureTable::setSignatures(Int2Type<T>){
29 setSignature<T>();
30 setSignatures<static_cast<Ptype>(T+1)>(Int2Type<static_cast<Ptype>(T+1) >());
31 }
32
33 template<>
34 void MoveSignatureTable::setSignatures<ROOK>(Int2Type<ROOK>){
35 setSignature<ROOK>();
36 }
37
38 MoveSignatureTable::MoveSignatureTable(){
39 setSignatures<PPAWN>(Int2Type<PPAWN>());
40 signatures[PTYPEO_EMPTY-PTYPEO_MIN]=signature_EMPTY;
41 signatures[PTYPEO_EDGE-PTYPEO_MIN]=signature_EDGE;
42 }
43 } // namespace effect
44 } // namespace osl