Debian Codegraph @

old-sample/legacy-checkmate/lib/dominanceTable.h

raw
1 /* dominanceTable.h
2 */
3 #ifndef _DOMINANCE_TABLE_H
4 #define _DOMINANCE_TABLE_H
5
6 #include "twinTable.h"
7 #include "visitedCounter.h"
8 #include "osl/player.h"
9 #include <boost/scoped_ptr.hpp>
10
11 namespace osl
12 {
13 namespace hash
14 {
15 class HashKey;
16 }
17 class PathEncoding;
18 class PieceStand;
19 namespace checkmate
20 {
21 class CheckHashRecord;
22 /**
23 * 詰将棋用のテーブル.
24 * ArrayCheckHashTable の簡易版
25 */
26 class DominanceTable : public TwinTableHolder, public VisitedCounter
27 {
28 class Table;
29 std::unique_ptr<Table> table;
30 const Player attacker;
31 std::unique_ptr<CheckHashRecord> rootNode;
32 public:
33 typedef hash::HashKey HashKey;
34
35 explicit DominanceTable(Player attacker);
36 ~DominanceTable();
37
38 CheckHashRecord *find(const HashKey& key);
39 CheckHashRecord *allocate(const HashKey& key,
40 const PieceStand& white_stand,
41 const PathEncoding& path);
42
43 void clear();
44 CheckHashRecord *root() { return rootNode.get(); }
45
46 const CheckHashRecord *find(const HashKey& key) const;
47 size_t size() const;
48 Player getAttacker() const { return attacker; }
49 void confirmNoVisitedRecords() const;
50 };
51
52 } // namespace checkmate
53 } // namespace osl
54
55 #endif /* _DOMINANCE_TABLE_H_ */
56 // ;;; Local Variables:
57 // ;;; mode:c++
58 // ;;; c-basic-offset:2
59 // ;;; End: