00001 //ExprDFSet.hpp 00002 00003 #ifndef ExprDFSet_H 00004 #define ExprDFSet_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/ExprTree/ExprTree.hpp> 00014 #include <OpenAnalysis/Location/Locations.hpp> 00015 #include <OpenAnalysis/Location/LocationVisitor.hpp> 00016 #include <OpenAnalysis/DataFlow/CalleeToCallerVisitor.hpp> 00017 #include <OpenAnalysis/ExprTree/EvalToMemRefVisitor.hpp> 00018 #include <OpenAnalysis/ExprTree/MemRefsVisitor.hpp> 00019 #include <OpenAnalysis/ExprTree/ExprTreeSetIterator.hpp> 00020 00021 namespace OA { 00022 namespace DataFlow { 00023 00024 //class ExprTreeIterator; 00025 00026 class ExprDFSet : public virtual DataFlowSet { 00027 public: 00028 ExprDFSet(); 00029 ExprDFSet(const ExprDFSet &other); 00030 ~ExprDFSet() {} 00031 00032 00033 OA_ptr<DataFlowSet> clone(); 00034 00035 bool operator ==(DataFlowSet &other) const; 00036 00037 bool operator !=(DataFlowSet &other) const; 00038 00039 bool operator <(DataFlowSet &other) const; 00040 00041 bool operator =(DataFlowSet &other) const; 00042 00043 ExprDFSet& setUnion(DataFlowSet &other); 00044 00045 ExprDFSet& setIntersect(DataFlowSet &other); 00046 00047 ExprDFSet& setDifference(ExprDFSet &other); 00048 00049 void dump(std::ostream &os); 00050 00051 void dump(std::ostream &os, OA_ptr<IRHandlesIRInterface> ir); 00052 00053 void insert(OA_ptr<ExprTree> h); 00054 void remove(OA_ptr<ExprTree> h); 00055 00057 bool empty(); 00058 00060 00061 bool hasExprTree(OA_ptr<ExprTree> h); 00062 00063 protected: 00064 00065 OA_ptr<ExprTreeSet> mSetPtr; 00066 00067 friend class ExprDFSetIterator; 00068 00069 }; 00070 00071 class ExprDFSetIterator : public ExprTreeSetIterator { 00072 public: 00073 ExprDFSetIterator(ExprDFSet& pDFSet) 00074 : ExprTreeSetIterator(pDFSet.mSetPtr) { } 00075 ~ExprDFSetIterator() { } 00076 }; 00077 00079 /*class ExprTreeSetIterator { 00080 public: 00081 00082 ExprTreeSetIterator (OA_ptr<ExprDFSet> DFSet) : mDFSet(DFSet) 00083 { hIter = mDFSet->mSet.begin(); } 00084 ~ExprSetTreeIterator () {} 00085 00086 void operator ++ () { if (hIter != mDFSet->mSet.end()) hIter++; } 00087 void operator++(int) { ++*this; } // postfix 00088 00090 bool isValid() const { return (hIter != mDFSet->mSet.end()); } 00091 00093 OA_ptr<ExprTree> current() const { return (*hIter); } 00094 00095 private: 00096 OA_ptr<ExprDFSet> mDFSet; 00097 std::set<OA_ptr<ExprTree> >::iterator hIter; 00098 };*/ 00099 00100 00101 00102 } // end of DataFlow namespace 00103 } // end of OA namespace 00104 00105 #endif
1.6.1