SWPDS.hpp

Go to the documentation of this file.
00001 #ifndef wali_wpds_fwpds_SWPDS_GUARD
00002 #define wali_wpds_fwpds_SWPDS_GUARD 1
00003 
00004 #include <map>
00005 #include "wali/Common.hpp"
00006 
00007 #include "wali/wpds/RuleFunctor.hpp"
00008 
00009 #include "wali/wpds/ewpds/EWPDS.hpp"
00010 
00011 #include "wali/wpds/fwpds/FWPDS.hpp"
00012 
00013 #include "wali/graph/GraphCommon.hpp"
00014 #include "wali/graph/InterGraph.hpp"
00015 #include "wali/graph/Graph.hpp"
00016 #include "wali/graph/SummaryGraph.hpp"
00017 
00018 namespace wali 
00019 {
00020 
00021   namespace wfa 
00022   {
00023     class WFA;
00024     class Trans;
00025   }
00026 
00027   namespace wpds 
00028   {
00029 
00030     namespace ewpds 
00031     {
00032       
00033       /*!
00034        * @class CopyCallRules
00035        * Inserts call rules into a EWPDS
00036        */
00037       class CopyCallRules : public RuleFunctor
00038       {
00039         EWPDS &pds;
00040         
00041       public:
00042         CopyCallRules( EWPDS &w );
00043         virtual ~CopyCallRules();
00044         
00045         virtual void operator()( rule_t & r );
00046       };
00047     } // namespace ewpds
00048 
00049     namespace fwpds 
00050     {
00051 
00052       class SWPDS : public FWPDS {
00053         public:
00054           /*!
00055            * For parsing XML FWPDSs.
00056            * @shadow wali::wpds::ewpds::EPDS::XMLTag
00057            */
00058           static const std::string XMLTag;
00059 
00060 
00061       public:
00062         SWPDS();
00063         SWPDS(ref_ptr<Wrapper> wrapper);
00064         virtual ~SWPDS();
00065 
00066         virtual void prestar( wfa::WFA const & input, wfa::WFA &output);
00067         virtual wfa::WFA prestar( wfa::WFA const & input) {
00068           return this->EWPDS::prestar(input);
00069         }
00070 
00071         virtual void poststar( wfa::WFA const & input, wfa::WFA &output);
00072         virtual wfa::WFA poststar( wfa::WFA const & input) {
00073           return this->EWPDS::poststar(input);
00074         }
00075 
00076         void nonSummaryPrestar( wfa::WFA &input, wfa::WFA &output);
00077         void nonSummaryPoststar( wfa::WFA &input, wfa::WFA &output);
00078 
00079         void addEntryPoint(Key e);
00080         void preprocess();
00081         bool reachable(Key k);
00082         bool multiple_proc(Key k);
00083 
00084       private:
00085         virtual bool make_rule(
00086             Config *f,
00087             Config *t,
00088             Key stk2,
00089         bool replace_weight,
00090             rule_t& r );
00091 
00092         ////////////////////////
00093         // Forwarding function to allow compilation with
00094         // -Woverloaded-virtual. See a couple comments in EWPDS.hpp for more.
00095         virtual bool make_rule(
00096             Config *f,
00097             Config *t,
00098             Key stk2,
00099 
00100             rule_t& r ) {
00101           return this->FWPDS::make_rule(f, t, stk2, r);
00102         }
00103 
00104       private:
00105         WpdsStackSymbols syms;
00106         bool preprocessed;
00107         EWPDS pre_pds;
00108         graph::SummaryGraph *sgr;
00109       }; // class SWPDS
00110 
00111     } // namespace fwpds
00112 
00113   } // namespace wpds
00114 
00115 } // namespace wali
00116 
00117 #endif // wali_wpds_fwpds_SWPDS_GUARD
00118