Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

type.h

Go to the documentation of this file.
00001 #ifndef TYPE_H
00002 #define TYPE_H
00003 
00004 #include "ast.h"
00005 
00006 class Type : public Ast {
00007         public:
00008                 enum types {INTEGER, BOOLEAN, RANGE, ADDRESS, CLIENTADDRESS,
00009                                         SERVERADDRESS, ARRAY, BEHAVIOR, TIMEOUT, MESSAGE, STRING,
00010                                         PROCESS};
00011                 
00012                 Type(SrcPosition *position, types typeCode_)
00013                                 : Ast(position), typeCode(typeCode_) {}
00014 
00015                 virtual ~Type() {
00016                 }
00017 
00018                 virtual Ast& operator = (const Ast& ast) {
00019                         const Type& type = dynamic_cast<const Type&>(ast);
00020                         Ast::operator=(ast);
00021                         this->typeCode = type.typeCode;
00022                         
00023                         return (*this);
00024                 }
00025                 virtual bool operator == (const Ast& ast) const {
00026                         const Type& type = dynamic_cast<const Type&>(ast);
00027                         return (this->typeCode == type.typeCode) && Ast::operator==(ast);
00028                 }
00029                 virtual VisitorReturn *visit(Visitor& visitor) {
00030                         return visitor.visitType(this);
00031                 }
00032                 
00033                 types getTypeCode() const {
00034                         return this->typeCode;
00035                 }
00036                 
00037                 virtual Ast& clone() const {
00038                         return *(new Type(new SrcPosition(*this->position), this->typeCode));
00039                 }
00040         
00041         protected:
00042                 types typeCode;
00043 };
00044 
00045 #endif

Generated on Mon Dec 1 17:00:23 2003 for Protomake by doxygen1.3