00001 #include <typeinfo> 00002 #include "simplemessage.h" 00003 using namespace std; 00004 00005 Ast& SimpleMessage::operator = (const Ast& ast) { 00006 const SimpleMessage& simpleMessage = dynamic_cast<const SimpleMessage&>(ast); 00007 00008 Message::operator=(ast); 00009 this->identifier = this->identifier ? dynamic_cast<Identifier*>(&(simpleMessage.identifier->clone())) : 0; 00010 this->fieldDeclaration = this->fieldDeclaration ? dynamic_cast<FieldDeclaration*>(&(simpleMessage.fieldDeclaration->clone())) : 0; 00011 this->handlerIn = this->handlerIn ? dynamic_cast<Identifier*>(&(simpleMessage.handlerIn->clone())) : 0; 00012 this->handlerOut = this->handlerOut ? dynamic_cast<Identifier*>(&(simpleMessage.handlerOut->clone())) : 0; 00013 this->external = simpleMessage.external; 00014 00015 return *(this); 00016 } 00017 00018 bool SimpleMessage::operator == (const Ast& ast) const { 00019 bool result = false; 00020 const SimpleMessage& simpleMessage = dynamic_cast<const SimpleMessage&>(ast); 00021 00022 if (typeid(ast) != typeid(SimpleMessage)) 00023 return false; 00024 00025 if (this->identifier && this->fieldDeclaration && this->handlerIn && this->handlerOut) 00026 result = (*(this->identifier) == *(simpleMessage.identifier) && 00027 *(this->fieldDeclaration) == *(simpleMessage.fieldDeclaration)) && 00028 *(this->handlerIn) == *(simpleMessage.handlerIn) && 00029 *(this->handlerOut) == *(simpleMessage.handlerOut) && 00030 this->external == simpleMessage.external; 00031 00032 return result && Message::operator==(ast); 00033 } 00034