checkDuplicate.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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/move.h"
5 #include "osl/ptype.h"
6 #include "osl/hash/hashKey.h"
7 #include "osl/stl/vector.h"
8 #include "osl/stl/hash_map.h"
9 #include "osl/pathEncoding.h"
10
11 #include <deque>
12
13 namespace osl
14 {
15 namespace record
16 {
20 class CheckDuplicate
21 {
22 typedef hash_map<HashKey, vector<PathEncoding> > keymap_t;
24 keymap_t keys;
26 size_t regist_counter;
28 size_t duplicated_hash_counter;
30 size_t duplicated_moves_counter;
31
32 public:
33 static std::pair<HashKey,PathEncoding> getLastState(const vector<Move>& moves);
34
38 enum DUPLICATE_RESULT
39 {
40 NO_DUPLICATE = 0,
41 HASH_DUPLICATE = 1,
42 MOVES_DUPLICATE = 2
43 };
44
48 CheckDuplicate()
49 : regist_counter(0),
50 duplicated_hash_counter(0),
51 duplicated_moves_counter(0)
52 {}
53
63 DUPLICATE_RESULT regist(const vector<Move>& moves);
64
68 void print(std::ostream& out) const;
69
73 size_t getRegists() const
74 { return regist_counter; }
75
80 size_t getDuplicatedHash() const
81 { return duplicated_hash_counter; }
82
86 size_t getDuplicatedMoves() const
87 { return duplicated_moves_counter; }
88
89 private:
99 DUPLICATE_RESULT regist(const HashKey& key,
100 const PathEncoding& moves);
101 };
102
103 } // namespace record
104 } // namespace osl
105
106
107 #endif /* _OSL_RECORD_CHECK_DUPLICATE_H */
108
109 // ;;; Local Variables:
110 // ;;; mode:c++
111 // ;;; c-basic-offset:2
112 // ;;; End: