00001
00002
00003 #ifndef formula_visitor_h
00004 #define formula_visitor_h
00005
00006 #include "formula.h"
00007
00008 #include <HierarchyGenerators.h>
00009
00010
00011
00012
00013
00014
00015 template <typename T, typename Ret = void>
00016 class Formula_visitor_tag : public Loki::Visitor<T,Ret>
00017 {
00018 public:
00019 typedef Ret Returntype;
00020 virtual Returntype visit(T&) = 0;
00021 private:
00022
00023
00024
00025 virtual Returntype Visit(T& t)
00026 { return visit (t); }
00027 };
00028
00032 class Formula_visitor :
00033 public Loki::BaseVisitor,
00034 public Loki::GenScatterHierarchy<Formula_tl, Formula_visitor_tag>
00035 {
00036
00037 public:
00038
00039
00040
00041
00044 void visit_formula(Formula& f);
00045
00048 void recurse(std::vector<Formula*> v);
00049 };
00050
00054 class Formula_basic_visitor : public Formula_visitor
00055 {
00056
00057 public:
00058
00059
00060
00061
00065 virtual void default_action(Formula&, std::vector<Formula*> v);
00066
00067 virtual void visit(True& f);
00068
00069 virtual void visit(False& f);
00070
00071 virtual void visit(Not& f);
00072
00073 virtual void visit(And& f);
00074
00075 virtual void visit(Or& f);
00076
00077 virtual void visit(Implies& f);
00078
00079 virtual void visit(Iff& f);
00080 };
00081
00082 #endif // formula_visitor_h