bookInMemory.h
Go to the documentation of this file.
1 /* bookInMemory.h
2  */
3 #ifndef OSL_BOOKINMEMORY_H
4 #define OSL_BOOKINMEMORY_H
5 #include "osl/hashKey.h"
6 #include <unordered_map>
7 #include <string>
8 
9 namespace osl
10 {
11  namespace book
12  {
13  class WeightedBook;
15  {
17  typedef std::unordered_map<HashKey,moves_t,std::hash<HashKey>> table_t;
18  table_t table;
19  public:
20  ~BookInMemory();
21 
22  void find(const HashKey& key, MoveVector& out) const;
23  size_t size() const { return table.size(); }
24  static const BookInMemory& instance(const std::string& filename="");
25  private:
26  explicit BookInMemory(const std::string& filename);
27  void readAll(const std::string& filename);
28  int readRecursive(const HashKey& key, int index, WeightedBook& book, int, int);
29  };
30  }
31  using book::BookInMemory;
32 }
33 
34 #endif /* OSL_BOOKINMEMORY_H */
35 // ;;; Local Variables:
36 // ;;; mode:c++
37 // ;;; c-basic-offset:2
38 // ;;; End:
CArray< Move, 8 > moves_t
Definition: bookInMemory.h:16
void find(const HashKey &key, MoveVector &out) const
Definition: bookInMemory.cc:65
StateとWMoveを保持する.
Definition: openingBook.h:168
int readRecursive(const HashKey &key, int index, WeightedBook &book, int, int)
Definition: bookInMemory.cc:22
BookInMemory(const std::string &filename)
Definition: bookInMemory.cc:11
std::unordered_map< HashKey, moves_t, std::hash< HashKey > > table_t
Definition: bookInMemory.h:17
static const BookInMemory & instance(const std::string &filename="")
Definition: bookInMemory.cc:77
void readAll(const std::string &filename)
Definition: bookInMemory.cc:56
size_t size() const
Definition: bookInMemory.h:23