WitnessMerge.hpp

Go to the documentation of this file.
00001 #ifndef wali_witness_WITNESS_MERGE_GUARD
00002 #define wali_witness_WITNESS_MERGE_GUARD 1
00003 
00004 /*!
00005  * @author Nicholas Kidd
00006  */
00007 
00008 #include "wali/Common.hpp"
00009 #include "wali/witness/Witness.hpp"
00010 #include "wali/witness/WitnessMergeFn.hpp"
00011 
00012 namespace wali 
00013 {
00014   namespace witness 
00015   {
00016     class WitnessMerge : public Witness 
00017     {
00018       public:
00019         //! Constructor bears witness to a merge function being
00020         //! applied to left and right with result weight
00021         WitnessMerge(
00022             sem_elem_t weight, 
00023             witness_merge_fn_t witness_merge_fn,
00024             witness_t caller,
00025             witness_t rule,
00026             witness_t callee );
00027 
00028         virtual ~WitnessMerge();
00029 
00030         //! Override Witness::accept
00031         virtual void accept( Visitor& v, bool visitOnce=false );
00032 
00033         //! Override Witness::reset_marks
00034         virtual void reset_marks() const;
00035 
00036         //! Override Witness::pretty_print
00037         virtual std::ostream& prettyPrint( std::ostream& o, size_t depth ) const;
00038 
00039         witness_t caller() { return fCaller; }
00040 
00041         bool hasCaller() const { return fCaller.is_valid(); }
00042 
00043         witness_t rule() { return fRule; }
00044 
00045         bool hasRule() const { return fRule.is_valid(); }
00046 
00047         witness_t callee() { return fCallee; }
00048 
00049         bool hasCallee() const { return fCallee.is_valid(); }
00050 
00051       protected:
00052         witness_merge_fn_t witness_merge_fn; //!< the merge function used
00053         witness_t fCaller; //!< caller param to apply
00054         witness_t fRule;   //!< calling rule
00055         witness_t fCallee; //!< callee param to apply
00056 
00057     }; // class WitnessMerge
00058 
00059   } // namespace witness
00060 
00061 } // namespace wali
00062 
00063 #endif  // wali_witness_WITNESS_MERGE_GUARD
00064