00001 #ifndef RECEIVE_STATEMENT_H 00002 #define RECEIVE_STATEMENT_H 00003 00004 #include "simplestatement.h" 00005 #include "identifier.h" 00006 00007 class ReceiveStatement : public SimpleStatement { 00008 private: 00009 Identifier *msgId; 00010 Identifier *addrId; 00011 bool tcp; 00012 00013 public: 00014 ReceiveStatement(SrcPosition *position, Identifier *msgId, Identifier *addrId, bool tcp) 00015 : SimpleStatement(position), msgId(msgId), addrId(addrId), tcp(tcp) {} 00016 00017 ReceiveStatement(const ReceiveStatement& receiveStatement) : SimpleStatement(receiveStatement.position){ 00018 (*this) = receiveStatement; 00019 } 00020 00021 virtual ~ReceiveStatement() { 00022 delete this->msgId; 00023 delete this->addrId; 00024 } 00025 00026 Identifier *getMsgId() { 00027 return this->msgId; 00028 } 00029 00030 Identifier *getAddrId() { 00031 return this->addrId; 00032 } 00033 00034 bool isTcp() const { 00035 return this->tcp; 00036 } 00037 00038 virtual Ast& operator = (const Ast& ast); 00039 00040 virtual bool operator == (const Ast& ast) const; 00041 00042 virtual VisitorReturn *visit(Visitor& visitor) { 00043 return visitor.visitReceiveStatement(this); 00044 } 00045 00046 virtual Ast& clone() const { 00047 return *(new ReceiveStatement(new SrcPosition(*this->position), 00048 this->msgId ? dynamic_cast<Identifier*>(&(this->msgId->clone())): 0, 00049 this->addrId ? dynamic_cast<Identifier*>(&(this->addrId->clone())): 0, 00050 this->tcp)); 00051 } 00052 }; 00053 00054 #endif