00001
00002
00003 #ifndef _CHECK_TREETRAVERSER_H
00004 #define _CHECK_TREETRAVERSER_H
00005
00006 #include "osl/checkmate/analyzer/treeWriter.h"
00007 #include "osl/checkmate/analyzer/recordSet.h"
00008 #include "osl/checkmate/checkStack.h"
00009 namespace osl
00010 {
00011 class PathEncoding;
00012 namespace hash
00013 {
00014 class HashKey;
00015 }
00016 namespace checkmate
00017 {
00018 class CheckHashRecord;
00019 class CheckMoveList;
00020 class TwinList;
00021 struct CorruptCheckTable;
00022 namespace analyzer
00023 {
00024 class TreeWriter;
00025 class TreeTraverser
00026 {
00027 protected:
00028 TreeWriter& writer;
00029 RecordSet visited;
00030 CheckStack analyzerStack;
00031 RecordSet leaves;
00032 const TwinTable& table;
00036 public:
00037 TreeTraverser(TreeWriter&, const TwinTable&);
00038
00039 const RecordSet& getVisited() const { return visited; }
00040 const RecordSet& getLeaveSet() const { return leaves; }
00041 unsigned int getLeaves() const { return leaves.size(); }
00042
00043 void traverseOrNode(Move last_move, const CheckHashRecord *record,
00044 const HashKey& key, const PathEncoding& path);
00045 void traverseAndNode(Move, const CheckHashRecord *record,
00046 const HashKey& key, const PathEncoding& path);
00047
00048 bool findLoopToStackByTwins(const TwinList& l) const;
00049 bool findLoopToStackByStack(const TwinList& l) const;
00050 bool findLoopToStack(const TwinList& l) const;
00051 protected:
00052 virtual ~TreeTraverser();
00053 virtual void orNode(Move m, const CheckHashRecord *record, const HashKey& key,
00054 const PathEncoding& path)=0;
00055 virtual void andNode(Move, const CheckHashRecord *record, const HashKey& key,
00056 const PathEncoding& path)=0;
00057 };
00058 }
00059 }
00060 }
00061
00062
00063 #endif
00064
00065
00066
00067