ETrans.hpp

Go to the documentation of this file.
00001 #ifndef wali_wpds_ewpds_ETRANS_GUARD
00002 #define wali_wpds_ewpds_ETRANS_GUARD 1
00003 
00004 /*!
00005  * @author Nicholas Kidd
00006  */
00007 
00008 #include "wali/MergeFn.hpp"
00009 #include "wali/wfa/ITrans.hpp"
00010 #include "wali/wfa/DecoratorTrans.hpp"
00011 #include "wali/wpds/ewpds/ERule.hpp"
00012 
00013 namespace wali {
00014 
00015   namespace wpds {
00016 
00017     namespace ewpds {
00018 
00019       class ETrans : public ::wali::wfa::DecoratorTrans 
00020       {
00021         public:
00022           ETrans(
00023               Key from, Key stack, Key to,
00024               sem_elem_t wAtCall,    //!< Weight on path to the call transition
00025               sem_elem_t wAfterCall, //!< For call rule R, wAtCall->extend(R->weight())
00026               erule_t erule          //!< The ERule
00027               );
00028 
00029           ETrans(
00030               ITrans* d,          //!< Trans that is being decorated
00031               sem_elem_t wAtCall, //!< Weight on path to the call transition
00032               erule_t erule       //!< The merge function
00033               );
00034 
00035           virtual ~ETrans();
00036 
00037           virtual std::ostream& print( std::ostream& o ) const;
00038 
00039           /*! @return the merge function of this ETrans */
00040           merge_fn_t getMergeFn() const;
00041 
00042           erule_t getERule() const;
00043           /*! @return A <b>deep</b> copy of this */
00044           virtual ITrans* copy() const;
00045           virtual ITrans* copy(Key f, Key s, Key t) const;
00046 
00047           /*!
00048            * Override to apply the merge function, i.e.,
00049            * 
00050            *   >>>   mf->apply_f(wAtCall,se)
00051            */
00052           virtual sem_elem_t poststar_eps_closure( sem_elem_t se );
00053 
00054           virtual TaggedWeight apply_post( TaggedWeight tw) const;
00055           virtual TaggedWeight apply_pre( TaggedWeight tw) const;
00056           virtual void applyWeightChanger(util::WeightChanger &wc);
00057 
00058           /*!
00059            * Override Trans::combineTrans to recover
00060            * the new value for wAtCall.
00061            *
00062            * Note: Trans* tp should <b>always</b> be an ETrans.
00063            */
00064           virtual void combineTrans( ITrans* tp );
00065 
00066           /*!
00067            * Getter and Setter for wAtCall (the weight of the 
00068            * corresponding call transition)
00069            */
00070           virtual sem_elem_t getWeightAtCall() const;
00071           void setWeightAtCall(sem_elem_t wt);
00072 
00073         protected:
00074           sem_elem_t wAtCall;
00075           erule_t erule;
00076 
00077       }; // class ETrans
00078 
00079     } // namespace ewpds
00080 
00081   } // namespace wpds
00082 
00083 } // namespace wali
00084 
00085 #endif  // wali_wpds_ewpds_ETRANS_GUARD
00086