00001 /* bookInMemory.h 00002 */ 00003 #ifndef OSL_BOOKINMEMORY_H 00004 #define OSL_BOOKINMEMORY_H 00005 #include "osl/hash/hashKey.h" 00006 #include "osl/container/moveVector.h" 00007 #include "osl/stl/hash_map.h" 00008 namespace osl 00009 { 00010 namespace record 00011 { 00012 namespace opening 00013 { 00014 class WeightedBook; 00015 class BookInMemory 00016 { 00017 typedef CArray<Move,8> moves_t; 00018 typedef hash_map<HashKey,moves_t> table_t; 00019 table_t table; 00020 public: 00021 void find(const HashKey& key, MoveVector& out) const; 00022 size_t size() const { return table.size(); } 00023 static const BookInMemory& instance(); 00024 private: 00025 BookInMemory(); 00026 ~BookInMemory(); 00027 void readAll(); 00028 int readRecursive(const HashKey& key, int index, WeightedBook& book, int, int); 00029 }; 00030 } 00031 } 00032 using record::opening::BookInMemory; 00033 } 00034 00035 #endif /* OSL_BOOKINMEMORY_H */ 00036 // ;;; Local Variables: 00037 // ;;; mode:c++ 00038 // ;;; c-basic-offset:2 00039 // ;;; End: