00001 //---------------------------------------------------------------------------- 00002 /** @file 00003 */ 00004 //---------------------------------------------------------------------------- 00005 00006 #ifndef HASHED_PATTERN_HPP 00007 #define HASHED_PATTERN_HPP 00008 00009 #include "Pattern.hpp" 00010 #include "RingGodel.hpp" 00011 00012 _BEGIN_BENZENE_NAMESPACE_ 00013 00014 //---------------------------------------------------------------------------- 00015 00016 /** Hashes patterns by ring godel; use for fast checking. 00017 00018 For each valid ring godel, a list of RotatedPatterns is 00019 pre-computed from the given PatternSet. This allows PatternBoard 00020 to check if a set of patterns matches a cell extremely quickly; 00021 especially if the patterns have a max extension of one, since in 00022 that case no checking is actually required! 00023 */ 00024 class HashedPatternSet 00025 { 00026 public: 00027 00028 /** Creates empty set of hashed patterns. */ 00029 HashedPatternSet(); 00030 00031 /** Destructor. */ 00032 ~HashedPatternSet(); 00033 00034 /** Hashes the given patterns. */ 00035 void hash(const PatternSet& patterns); 00036 00037 /** Returns list of rotated patterns for godel. */ 00038 const RotatedPatternList& ListForGodel(const RingGodel& godel) const; 00039 00040 private: 00041 00042 /** Will contain a RotatedPatternList for each of 00043 RingGodel::ValidGodels(). */ 00044 std::vector<RotatedPatternList> m_godel_list; 00045 }; 00046 00047 //---------------------------------------------------------------------------- 00048 00049 _END_BENZENE_NAMESPACE_ 00050 00051 #endif // HASHED_PATTERN_HPP