00001
00002
00003 #ifndef formula_h
00004 #define formula_h
00005
00006 #include <vector>
00007
00008 #include <Visitor.h>
00009
00010
00011
00012
00013
00014 using Loki::BaseVisitor;
00015
00017 class Formula : public Loki::BaseVisitable<>
00018 {
00019 public:
00020 virtual ~Formula() {};
00021
00022 public:
00024 static std::vector<Formula*> vec(Formula* f1 = 0, Formula* f2 = 0, Formula* f3 = 0, Formula* f4 = 0, Formula* f5 = 0, Formula* f6 = 0);
00025 };
00026
00027 #define FORMULA_0(Type) \
00028 struct Type: public Formula \
00029 { \
00030 DEFINE_VISITABLE(); \
00031 };
00032
00033 #define FORMULA_1(Type, Component1) \
00034 struct Type: public Formula \
00035 { \
00036 typedef Component1 V1type; \
00037 Component1 v1; \
00038 \
00039 DEFINE_VISITABLE(); \
00040 \
00041 explicit Type (Component1 c1) \
00042 : v1 (c1) \
00043 {} \
00044 };
00045
00046 #define FORMULA_2(Type, Component1, Component2) \
00047 struct Type: \
00048 public Formula \
00049 { \
00050 typedef Component1 V1type; \
00051 typedef Component2 V2type; \
00052 Component1 v1; \
00053 Component2 v2; \
00054 \
00055 DEFINE_VISITABLE(); \
00056 \
00057 Type (Component1 c1, Component2 c2) \
00058 : v1 (c1), v2 (c2) \
00059 {} \
00060 };
00061
00063
00064 FORMULA_0 (True);
00065 FORMULA_0 (False);
00066 FORMULA_1 (Not, Formula*);
00067 FORMULA_1 (And, std::vector<Formula*>);
00068 FORMULA_1 (Or, std::vector<Formula*>);
00069 FORMULA_2 (Implies, Formula*, Formula*);
00070 FORMULA_2 (Iff, Formula*, Formula*);
00071
00075 typedef TYPELIST_7(True, False, Not, And, Or, Implies, Iff)
00076 Formula_tl;
00077
00078 #endif // formula_h