00001 00014 #ifndef LocSubSet_H 00015 #define LocSubSet_H 00016 00017 #include "Location.hpp" 00018 00019 namespace OA { 00020 00027 class LocSubSet : public Location { 00028 public: 00029 LocSubSet(OA_ptr<Location> baseLoc); 00030 LocSubSet(OA_ptr<Location> baseLoc, bool full); 00031 00033 LocSubSet(LocSubSet &other) : mLoc(other.mLoc), mFull(other.mFull) {} 00034 00035 virtual ~LocSubSet() { } 00036 00037 virtual void acceptVisitor(LocationVisitor& pVisitor); 00038 00039 //***************************************************************** 00040 // Location subclass type methods 00041 //***************************************************************** 00042 bool isaSubSet() { return true; } 00043 00044 //***************************************************************** 00045 // LocSubSet subclass type methods 00046 //***************************************************************** 00049 bool isSubClassOfLocSubSet() { return isaIdxSubSet() 00050 || isaFieldSubSet(); } 00051 00052 virtual bool isaIdxSubSet() { return false; } 00053 virtual bool isaFieldSubSet() { return false; } 00054 00055 //***************************************************************** 00056 // Info methods 00057 //***************************************************************** 00059 OA_ptr<Location> getBaseLoc() { return mLoc; } 00060 00061 OA_ptr<Location> getLoc() { return mLoc; } 00062 00064 virtual bool isFull() { return mFull; } 00065 00066 bool isLocal() { assert(!mLoc.ptrEqual(NULL)); return mLoc->isLocal(); } 00067 00068 bool isUnique() { assert(!mLoc.ptrEqual(NULL)); return mLoc->isUnique(); } 00069 // FIXME: does this make sense for a subset? 00070 00071 //***************************************************************** 00072 // Relationship methods 00073 //***************************************************************** 00074 virtual bool operator<(Location & other); 00075 virtual bool operator==(Location& other); 00076 virtual bool mayOverlap(Location& other); 00077 00078 virtual bool mustOverlap(Location& other); 00079 00080 virtual bool subSetOf(Location& other); 00081 00082 // ***************************************************************** 00083 // Debugging 00084 // ***************************************************************** 00085 void dump(std::ostream& os); 00086 void dump(std::ostream& os, OA_ptr<IRHandlesIRInterface> pIR); 00087 00088 std::string toString(OA_ptr<IRHandlesIRInterface> pIR); 00089 00090 //***************************************************************** 00091 // Annotation Interface 00092 //***************************************************************** 00093 void output(IRHandlesIRInterface& ir); 00094 00095 virtual int getOrder() { return sOrder; } 00096 00097 protected: 00098 00099 OA_ptr<Location> mLoc; 00100 00101 private: 00102 bool mFull; 00103 00105 void composeWithBaseLoc(OA_ptr<Location> baseLoc); 00106 00107 static const int sOrder = 600; 00108 }; 00109 00110 } // end namespace 00111 00112 #endif
1.6.1