00001 #ifndef _OSL_RECORD_CHECK_DUPLICATE_H 00002 #define _OSL_RECORD_CHECK_DUPLICATE_H 00003 00004 #include "osl/move.h" 00005 #include "osl/ptype.h" 00006 #include "osl/hash/hashKey.h" 00007 #include "osl/stl/vector.h" 00008 #include "osl/stl/hash_map.h" 00009 #include "osl/pathEncoding.h" 00010 00011 #include <deque> 00012 00013 namespace osl 00014 { 00015 namespace record 00016 { 00020 class CheckDuplicate 00021 { 00022 typedef hash_map<HashKey, vector<PathEncoding> > keymap_t; 00024 keymap_t keys; 00026 size_t regist_counter; 00028 size_t duplicated_hash_counter; 00030 size_t duplicated_moves_counter; 00031 00032 public: 00033 static std::pair<HashKey,PathEncoding> getLastState(const vector<Move>& moves); 00034 00038 enum DUPLICATE_RESULT 00039 { 00040 NO_DUPLICATE = 0, 00041 HASH_DUPLICATE = 1, 00042 MOVES_DUPLICATE = 2 00043 }; 00044 00048 CheckDuplicate() 00049 : regist_counter(0), 00050 duplicated_hash_counter(0), 00051 duplicated_moves_counter(0) 00052 {} 00053 00063 DUPLICATE_RESULT regist(const vector<Move>& moves); 00064 00068 void print(std::ostream& out) const; 00069 00073 size_t getRegists() const 00074 { return regist_counter; } 00075 00080 size_t getDuplicatedHash() const 00081 { return duplicated_hash_counter; } 00082 00086 size_t getDuplicatedMoves() const 00087 { return duplicated_moves_counter; } 00088 00089 private: 00099 DUPLICATE_RESULT regist(const HashKey& key, 00100 const PathEncoding& moves); 00101 }; 00102 00103 } // namespace record 00104 } // namespace osl 00105 00106 00107 #endif /* _OSL_RECORD_CHECK_DUPLICATE_H */ 00108 00109 // ;;; Local Variables: 00110 // ;;; mode:c++ 00111 // ;;; c-basic-offset:2 00112 // ;;; End: