00001 #ifndef wpds_ERULE_GUARD 00002 #define wpds_ERULE_GUARD 00003 00004 /** 00005 * @author Akash Lal 00006 * @author Nicholas Kidd 00007 */ 00008 00009 #include "wali/Common.hpp" 00010 #include "wali/MergeFn.hpp" 00011 #include "wali/wpds/Rule.hpp" 00012 00013 namespace wali 00014 { 00015 namespace wpds 00016 { 00017 class Config; 00018 00019 namespace ewpds 00020 { 00021 00022 class ERule; 00023 typedef ref_ptr<ERule> erule_t; 00024 00025 /** @class ERule 00026 * 00027 * @see Rule 00028 */ 00029 00030 class ERule : public Rule 00031 { 00032 00033 public: 00034 friend class EWPDS; 00035 00036 public: 00037 00038 /** 00039 * @brief constructor 00040 */ 00041 ERule( Config *f, Config *t, wali_key_t s2, sem_elem_t se, merge_fn_t fn = NULL ); 00042 00043 /** 00044 * @brief destructor 00045 */ 00046 ~ERule(); 00047 00048 /*! 00049 * @brief Make a copy of the rule 00050 */ 00051 virtual void copy(const rule_t r); 00052 00053 /** 00054 * @return Rule rhs second stack symbol or WALI_EPSILON if no such 00055 * stack sym 00056 */ 00057 merge_fn_t merge_fn() const { return mf; } 00058 00059 /** 00060 * @brief What do you think? 00061 */ 00062 void set_merge_fn( merge_fn_t _mf ) { mf = _mf; } 00063 00064 /** @return reference to the extended Weight */ 00065 sem_elem_t extended_weight() const; 00066 00067 /** 00068 * 00069 * @param o the std::ostream this is written to 00070 * @return std::ostream passed in 00071 * 00072 * @see Printable 00073 */ 00074 std::ostream & print( std::ostream &o ) const; 00075 00076 /** 00077 * marshall will write a ERule to a std::ostream. This writes 00078 * the rule in XML form. 00079 * 00080 * @return std::ostream the marshalled rule was written to. 00081 */ 00082 std::ostream & marshall( std::ostream & o ) const; 00083 00084 private: 00085 merge_fn_t mf; 00086 // AL: Removing extended_se from the class. The underlying rule weight is 00087 // sufficient, and we don't want to maintain redundant information 00088 //sem_elem_t extended_se; 00089 00090 }; // class ERule 00091 00092 } // end namespace ewpds 00093 00094 } // end namespace wpds 00095 00096 } // end namespace wali 00097 00098 #endif // wpds_ERULE_GUARD 00099