00001 #ifndef ENUMERATION_TYPE_INFO_HH
00002 #define ENUMERATION_TYPE_INFO_HH
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "tyvis/ScalarTypeInfo.hh"
00016 #include <vector>
00017 #include <string>
00018 using std::vector;
00019 using std::string;
00020
00021 class SubElementFactory;
00022 class IntegerTypeInfo;
00023
00024 class EnumerationTypeInfo : public ScalarTypeInfo {
00025 public:
00026 EnumerationTypeInfo();
00027 EnumerationTypeInfo( const vector<string> &imageMap );
00028 EnumerationTypeInfo( const IntegerTypeInfo &range,
00029 const vector<string> &imageMap );
00030 ~EnumerationTypeInfo();
00031 EnumerationTypeInfo( const EnumerationTypeInfo &that );
00032 const vector<string> &getImageMap() const;
00033
00034 bool operator==( const TypeInfo &that ) const;
00035 TypeInfo *clone() const;
00036
00041 int getIndex( const string &value ) const;
00042
00046 string getLiteral( int value ) const;
00047
00048 EnumerationTypeInfo& operator=(const EnumerationTypeInfo &ei);
00049 TypeInfo &operator=(const TypeInfo &ti) {
00050 return operator=( static_cast<const EnumerationTypeInfo &>(ti) );
00051 }
00052
00053
00054
00055 RValue *create( const SubElementFactory *parent ) const;
00056
00057 bool isCharacterType() const;
00058
00059 Value vhdlPlus( const RValue &, const RValue & ) const;
00060 Value vhdlMinus ( const RValue &, const RValue & ) const;
00061 Value vhdlMultiply( const RValue &, const RValue & ) const;
00062 Value vhdlDivide ( const RValue &, const RValue & ) const;
00063 Value vhdlMod ( const RValue &, const RValue & ) const;
00064 Value vhdlRem ( const RValue &, const RValue & ) const;
00065 Value vhdlPow ( const RValue &, const RValue & ) const;
00066 Value vhdlNot ( const RValue & ) const;
00067 Value vhdlXor ( const RValue &, const RValue & ) const;
00068 Value vhdlXnor ( const RValue &, const RValue & ) const;
00069
00075 Value val( const RValue &expression ) const;
00076 Value succ( const RValue &expression ) const;
00077 Value pred( const RValue &expression ) const;
00079
00080 using TypeInfo::value;
00081 virtual Value value( const string &initValue ) const;
00082
00083 protected:
00084
00085 private:
00086 const vector<string> *imageMap;
00087
00088 static int calcRight( int numElements );
00089 };
00090
00091 #endif