00001 #ifndef Primitive_h
00002 #define Primitive_h
00003
00004 #define DBL_PREFIX "D_"
00005 #define INT_PREFIX "I_"
00006 #define BOOL_PREFIX "B_"
00007 #define CHR_PREFIX "C_"
00008 #define STR_PREFIX "S_"
00009
00010 namespace Tree {
00011
00012 class Tree;
00013 namespace Primitives {
00014
00015 enum terminal_type
00016 { Double, Int, Bool, Char, String };
00017
00018 class Primitive;
00019 typedef boost::shared_ptr<Primitive> PrimitiveP;
00020
00026 class Primitive
00027 {
00028 public:
00029 Primitive();
00030 virtual ~Primitive();
00031
00037 virtual void execute(void* result, Tree& tree) = 0;
00038 virtual bool initialize(StateP state);
00039 virtual void setValue(void* value);
00040 virtual void getValue(void* value);
00041 virtual PrimitiveP copyWithNode(PrimitiveP);
00042 virtual PrimitiveP assignToNode(PrimitiveP);
00043 void getNextArgument(void* result, Tree& tree);
00044 int getNumberOfArguments();
00045 void setName(std::string name);
00046 std::string getName();
00047 std::string getComplementName();
00048
00049 StateP state_;
00050
00051 protected:
00052 std::string name_;
00053 int nArguments_;
00054 std::string complementName_;
00055 };
00056
00057 }
00058 typedef boost::shared_ptr<Primitives::Primitive> PrimitiveP;
00059 }
00060
00061 #endif