IMergeFn.hpp

Go to the documentation of this file.
00001 #ifndef wali_IMERGE_FN_GUARD
00002 #define wali_IMERGE_FN_GUARD 1
00003 
00004 /**
00005  * @author Akash Lal
00006  * @author Nicholas Kidd
00007  */
00008 
00009 #include "wali/Common.hpp"
00010 #include "wali/ref_ptr.hpp"
00011 #include "wali/SemElem.hpp"
00012 #include <iostream>
00013 
00014 
00015 namespace wali
00016 {
00017   class IMergeFn;
00018   typedef ref_ptr< IMergeFn > merge_fn_t;
00019 
00020   /**
00021    * Class IMergeFn defines the interface
00022    * that all merge functions must satisfy.
00023    */
00024   class IMergeFn : public Printable, public Countable
00025   {
00026     public:
00027       static const std::string XMLTag;
00028 
00029       IMergeFn();
00030 
00031       virtual ~IMergeFn();
00032 
00033       /**
00034        * Return the result of merging the weight [w1] from the 
00035        * caller with the weight [w2] that summarizes the callee.
00036        *
00037        * @return sem_elem_t summarizing the path from 
00038        *         call -> enter -> exit -> return
00039        */
00040       virtual sem_elem_t apply_f(sem_elem_t w1, sem_elem_t w2) = 0;
00041 
00042       /*  
00043        * Check to see if the two merge functions are equal. This is used to resolve the
00044        * case when multiple call rules with the rhs are inserted into an EWPDS. Insertion
00045        * of multiple such rules is only allowed when the merge functions on them are the same.
00046        * Note that this function can always returns false (in which case an exception will be thrown
00047        * when multiple call rules with the same rhs are inserted).
00048        */
00049       virtual bool equal(merge_fn_t mf) = 0;
00050       //virtual MergeFn *parse_element(const char *s, sem_elem_t sem) = 0;
00051 
00052   };
00053 
00054 } // namespacw wali
00055 
00056 #endif // wali_IMERGE_FN_GUARD
00057