00001 #ifndef wali_wpds_WITNESS_RULE_GUARD 00002 #define wali_wpds_WITNESS_RULE_GUARD 1 00003 00004 /*! 00005 * @author Nicholas Kidd 00006 */ 00007 00008 #include "wali/Common.hpp" 00009 #include "wali/Printable.hpp" 00010 #include "wali/Key.hpp" 00011 #include "wali/witness/Witness.hpp" 00012 #include "wali/wpds/Rule.hpp" 00013 00014 namespace wali 00015 { 00016 using wpds::Rule; 00017 using wpds::rule_t; 00018 00019 namespace witness 00020 { 00021 struct RuleStub : public Printable 00022 { 00023 RuleStub( const Rule& r ); 00024 00025 Key from_state(); 00026 00027 Key from_stack(); 00028 00029 Key to_state(); 00030 00031 Key to_stack1(); 00032 00033 Key to_stack2(); 00034 00035 sem_elem_t weight(); 00036 00037 std::ostream& print( std::ostream& o ) const; 00038 00039 Key fs,fstk,ts,tstk1,tstk2; 00040 sem_elem_t se; 00041 }; 00042 00043 /*! 00044 * @class WitnessRule 00045 * 00046 * This class bears witness to the fact that a rule was created with 00047 * the supplied weight. 00048 */ 00049 class WitnessRule : public Witness 00050 { 00051 public: 00052 /*! 00053 * @brief constructor creates a RuleStub from a 00054 * wali::wpds::Rule. 00055 * 00056 * @see Witness 00057 * @see Rule 00058 */ 00059 WitnessRule( const Rule& r ); 00060 00061 //! Destructor does nothing. 00062 ~WitnessRule(); 00063 00064 //! Override Witness::accept 00065 virtual void accept( Visitor& v, bool visitOnce=false ); 00066 00067 //! Overrides Witness::prettyPrint 00068 virtual std::ostream& prettyPrint( std::ostream& o,size_t depth ) const; 00069 00070 RuleStub& getRuleStub(); 00071 00072 protected: 00073 RuleStub stub; 00074 }; 00075 00076 } // namespace witness 00077 00078 } // namespace wali 00079 00080 #endif // wali_wpds_WITNESS_RULE_GUARD 00081