My Project
checkDuplicate.h
Go to the documentation of this file.
1#ifndef _OSL_RECORD_CHECK_DUPLICATE_H
2#define _OSL_RECORD_CHECK_DUPLICATE_H
3
4#include "osl/basic_type.h"
5#include "osl/hashKey.h"
6#include "osl/pathEncoding.h"
7
8#include <unordered_map>
9#include <deque>
10#include <vector>
11
12namespace osl
13{
14 namespace record
15 {
20 {
21 typedef std::unordered_map<HashKey, std::vector<PathEncoding>, std::hash<HashKey>> keymap_t;
30
31 public:
32 static std::pair<HashKey,PathEncoding> getLastState(const std::vector<Move>& moves);
33
43
52
62 DUPLICATE_RESULT regist(const std::vector<Move>& moves);
63
67 void print(std::ostream& out) const;
68
72 size_t getRegists() const
73 { return regist_counter; }
74
79 size_t getDuplicatedHash() const
80 { return duplicated_hash_counter; }
81
85 size_t getDuplicatedMoves() const
86 { return duplicated_moves_counter; }
87
88 private:
99 const PathEncoding& moves);
100 };
101
102 } // namespace record
103} // namespace osl
104
105
106#endif /* _OSL_RECORD_CHECK_DUPLICATE_H */
107
108// ;;; Local Variables:
109// ;;; mode:c++
110// ;;; c-basic-offset:2
111// ;;; End:
Container of moves to check duplicated games.
DUPLICATE_RESULT
Result type of checking duplicates.
size_t getRegists() const
Return a couter of registings (trials)
size_t getDuplicatedHash() const
Return a counter of duplicated ending states.
keymap_t keys
container of moves
size_t duplicated_hash_counter
counter for hash matches with different moves
static std::pair< HashKey, PathEncoding > getLastState(const std::vector< Move > &moves)
size_t duplicated_moves_counter
counter for exact matches of moves
size_t getDuplicatedMoves() const
Return a counter of duplicated moves.
DUPLICATE_RESULT regist(const std::vector< Move > &moves)
Insert a key if the key is new.
size_t regist_counter
couter for registing (trials)
std::unordered_map< HashKey, std::vector< PathEncoding >, std::hash< HashKey > > keymap_t
void print(std::ostream &out) const
Output the result.