00001 //StmtDFSet.hpp 00002 00003 /*#ifndef StmtDFSet_H 00004 #define StmtDFSet_H 00005 00006 #include <iostream> 00007 #include <set> 00008 #include <algorithm> 00009 #include <iterator> 00010 00011 // abstract interface that this class implements 00012 #include <OpenAnalysis/DataFlow/DataFlowSet.hpp> 00013 #include <OpenAnalysis/Location/Locations.hpp> 00014 #include <OpenAnalysis/Location/LocationVisitor.hpp> 00015 #include <OpenAnalysis/DataFlow/CalleeToCallerVisitor.hpp> 00016 #include <OpenAnalysis/ExprTree/EvalToMemRefVisitor.hpp> 00017 #include <OpenAnalysis/ExprTree/MemRefsVisitor.hpp> 00018 00019 namespace OA { 00020 namespace DataFlow { 00021 00022 class StmtDFSet : public virtual DataFlowSet{ 00023 public: 00024 StmtDFSet(); 00025 StmtDFSet(const StmtDFSet &other); 00026 ~StmtDFSet() {} 00027 00028 00029 OA_ptr<DataFlowSet> clone(); 00030 00031 bool operator ==(DataFlowSet &other) const; 00032 00033 bool operator !=(DataFlowSet &other) const; 00034 00035 bool operator <(DataFlowSet &other) const; 00036 00037 StmtDFSet& setUnion(DataFlowSet &other); 00038 00039 StmtDFSet& setIntersect(StmtDFSet &other); 00040 00041 StmtDFSet& setDifference(DataFlowSet &other); 00042 00043 void dump(std::ostream &os); 00044 00045 void dump(std::ostream &os, OA_ptr<IRHandlesIRInterface> ir); 00046 00047 void insert(StmtHandle h); 00048 void remove(StmtHandle h); 00049 00051 bool empty(); 00052 00054 00055 bool handleInSet(StmtHandle h); 00056 00057 protected: 00058 00059 std::set<StmtHandle> mSet; 00060 00061 friend class StmtHandleIterator; 00062 00063 }; 00064 00066 class StmtHandleIterator { 00067 public: 00068 00069 StmtHandleIterator (OA_ptr<StmtDFSet> DFSet) : mDFSet(DFSet) 00070 { hIter = mDFSet->mSet.begin(); } 00071 ~StmtHandleIterator () {} 00072 00073 void operator ++ () { if (hIter != mDFSet->mSet.end()) hIter++; } 00074 void operator++(int) { ++*this; } // postfix 00075 00077 bool isValid() const { return (hIter != mDFSet->mSet.end()); } 00078 00080 StmtHandle current() const { return (*hIter); } 00081 00082 private: 00083 OA_ptr<StmtDFSet> mDFSet; 00084 std::set<StmtHandle>::iterator hIter; 00085 }; 00086 00087 00088 00089 00090 } // end of DataFlow namespace 00091 } // end of OA namespace 00092 00093 #endif*/ 00094
1.7.1