00001 #ifndef PROGRAM_H 00002 #define PROGRAM_H 00003 00004 #include "ast.h" 00005 #include "import.h" 00006 #include "behavior.h" 00007 #include "message.h" 00008 #include "process.h" 00009 00010 class Program : public Ast { 00011 private: 00012 Import *import; 00013 Behavior *behavior; 00014 Message *message; 00015 Process *process; 00016 00017 public: 00018 Program(SrcPosition *position, Import *import, Behavior *behavior, Message *message, Process *process) 00019 : Ast(position), import(import), behavior(behavior), message(message), process(process) {} 00020 00021 Program(const Program& program) : Ast(program.position) { 00022 *(this) = program; 00023 } 00024 00025 virtual ~Program() { 00026 delete this->import; 00027 delete this->behavior; 00028 delete this->message; 00029 delete this->process; 00030 } 00031 00032 Import *getImport() { 00033 return this->import; 00034 } 00035 00036 Behavior *getBehavior() { 00037 return this->behavior; 00038 } 00039 00040 Message *getMessage() { 00041 return this->message; 00042 } 00043 00044 Process *getProcess() { 00045 return this->process; 00046 } 00047 00048 virtual Ast& operator = (const Ast& ast); 00049 virtual bool operator == (const Ast& ast) const; 00050 00051 virtual VisitorReturn *visit(Visitor& visitor) { 00052 return visitor.visitProgram(this); 00053 } 00054 00055 virtual Ast& clone() const { 00056 return *(new Program(new SrcPosition(*(this->position)), 00057 this->import ? dynamic_cast<Import*>(&(this->import->clone())) : 0, 00058 this->behavior ? dynamic_cast<Behavior*>(&(this->behavior->clone())) : 0, 00059 this->message ? dynamic_cast<Message*>(&(this->message->clone())) : 0, 00060 this->process ? dynamic_cast<Process*>(&(this->process->clone())) : 0)); 00061 } 00062 }; 00063 00064 #endif