00001 /* twinTable.h 00002 */ 00003 #ifndef _TWIN_HASHTABLE_H 00004 #define _TWIN_HASHTABLE_H 00005 00006 #include "osl/checkmate/twinEntry.h" 00007 #include <boost/scoped_ptr.hpp> 00008 00009 namespace osl 00010 { 00011 class PathEncoding; 00012 00013 namespace checkmate 00014 { 00015 class CheckMoveListProvider; 00020 class TwinTable 00021 { 00022 class Table; 00023 boost::scoped_ptr<Table> table; 00024 public: 00025 TwinTable(); 00026 ~TwinTable(); 00027 00028 void addTwin(const TwinEntry&); 00029 void clearTwins(); 00030 00031 const TwinEntry *findTwin(const PathEncoding&) const; 00032 TwinAgeEntry& allocateTwin(const PathEncoding&); 00033 size_t size() const; 00034 }; 00035 00036 class TwinTableHolder : private TwinTable 00037 { 00038 boost::scoped_ptr<CheckMoveListProvider> list_provider; 00039 protected: 00040 ~TwinTableHolder(); 00041 public: 00042 TwinTableHolder(); 00043 using TwinTable::addTwin; 00044 using TwinTable::clearTwins; 00045 using TwinTable::findTwin; 00046 using TwinTable::size; 00047 using TwinTable::allocateTwin; 00048 00049 const TwinTable& getTwinTable() const { return *this; } 00050 void addLoopDetection(const PathEncoding& path, const CheckMove& move, 00051 const CheckHashRecord *loopTo) 00052 { 00053 addTwin(TwinEntry(path, move, loopTo)); 00054 } 00055 void addLoopDetection(const PathEncoding& path, const CheckHashRecord *loopTo=0) 00056 { 00057 addTwin(TwinEntry(path, CheckMove(), loopTo)); 00058 } 00059 CheckMoveListProvider& listProvider() { return *list_provider; } 00060 void clear(); 00061 }; 00062 00063 00064 } // namespace checkmate 00065 } // namespace osl 00066 00067 #endif /* _TWIN_HASHTABLE_H_ */ 00068 // ;;; Local Variables: 00069 // ;;; mode:c++ 00070 // ;;; c-basic-offset:2 00071 // ;;; End: