00001 #ifndef SIMPLE_MESSAGE_H 00002 #define SIMPLE_MESSAGE_H 00003 00004 #include "message.h" 00005 #include "identifier.h" 00006 #include "fielddeclaration.h" 00007 00008 class SimpleMessage : public Message { 00009 private: 00010 Identifier *identifier; 00011 FieldDeclaration *fieldDeclaration; 00012 Identifier *handlerIn; 00013 Identifier *handlerOut; 00014 bool external; 00015 00016 public: 00017 SimpleMessage(SrcPosition *position, Identifier *identifier, FieldDeclaration *fieldDeclaration, 00018 Identifier *handlerIn, Identifier *handlerOut, bool external) 00019 : Message(position), identifier(identifier), fieldDeclaration(fieldDeclaration), 00020 handlerIn(handlerIn), handlerOut(handlerOut), external(external) {} 00021 00022 SimpleMessage(const SimpleMessage& simpleMessage) : Message(simpleMessage.position) { 00023 *(this) = simpleMessage; 00024 } 00025 00026 virtual ~SimpleMessage() { 00027 delete this->identifier; 00028 delete this->fieldDeclaration; 00029 delete this->handlerIn; 00030 delete this->handlerOut; 00031 } 00032 00033 Identifier *getIdentifier() { 00034 return this->identifier; 00035 } 00036 00037 FieldDeclaration *getFieldDeclaration() { 00038 return this->fieldDeclaration; 00039 } 00040 00041 Identifier *getHandlerIn() { 00042 return this->handlerIn; 00043 } 00044 00045 Identifier *getHandlerOut() { 00046 return this->handlerOut; 00047 } 00048 00049 bool isExternal() const { 00050 return this->external; 00051 } 00052 00053 virtual Ast& operator = (const Ast& ast); 00054 virtual bool operator == (const Ast& ast) const; 00055 00056 virtual VisitorReturn *visit(Visitor& visitor) { 00057 return visitor.visitSimpleMessage(this); 00058 } 00059 00060 virtual Ast& clone() const { 00061 return *(new SimpleMessage(new SrcPosition(*(this->position)), 00062 this->identifier ? dynamic_cast<Identifier*>(&(this->identifier->clone())) : 0, 00063 this->fieldDeclaration ? dynamic_cast<FieldDeclaration*>(&(this->fieldDeclaration->clone())) : 0, 00064 this->handlerIn ? dynamic_cast<Identifier*>(&(this->handlerIn->clone())) : 0, 00065 this->handlerOut ? dynamic_cast<Identifier*>(&(this->handlerOut->clone())) : 0, 00066 this->external)); 00067 } 00068 }; 00069 00070 #endif