00001 /* dominanceTable.h 00002 */ 00003 #ifndef _DOMINANCE_TABLE_H 00004 #define _DOMINANCE_TABLE_H 00005 00006 #include "osl/checkmate/twinTable.h" 00007 #include "osl/checkmate/visitedCounter.h" 00008 #include "osl/player.h" 00009 #include <boost/scoped_ptr.hpp> 00010 00011 namespace osl 00012 { 00013 namespace hash 00014 { 00015 class HashKey; 00016 } 00017 class PathEncoding; 00018 class PieceStand; 00019 namespace checkmate 00020 { 00021 class CheckHashRecord; 00026 class DominanceTable : public TwinTableHolder, public VisitedCounter 00027 { 00028 class Table; 00029 boost::scoped_ptr<Table> table; 00030 const Player attacker; 00031 boost::scoped_ptr<CheckHashRecord> rootNode; 00032 public: 00033 typedef hash::HashKey HashKey; 00034 00035 explicit DominanceTable(Player attacker); 00036 ~DominanceTable(); 00037 00038 CheckHashRecord *find(const HashKey& key); 00039 CheckHashRecord *allocate(const HashKey& key, 00040 const PieceStand& white_stand, 00041 const PathEncoding& path); 00042 00043 void clear(); 00044 CheckHashRecord *root() { return rootNode.get(); } 00045 00046 const CheckHashRecord *find(const HashKey& key) const; 00047 size_t size() const; 00048 Player getAttacker() const { return attacker; } 00049 void confirmNoVisitedRecords() const; 00050 }; 00051 00052 } // namespace checkmate 00053 } // namespace osl 00054 00055 #endif /* _DOMINANCE_TABLE_H_ */ 00056 // ;;; Local Variables: 00057 // ;;; mode:c++ 00058 // ;;; c-basic-offset:2 00059 // ;;; End: