00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef CDATATYPE_H
00032 #define CDATATYPE_H
00033
00034 #include <list>
00035 #include "cobject.h"
00036
00037 class CNode;
00038
00042 enum VarDataType_t {
00043 eNO_VAR_TYPE = 0,
00044 eREAL,
00045 eSHORTREAL,
00046 eREALTIME,
00047 eREG,
00048 eTIME,
00049 eLOGIC,
00050 eINTEGER,
00051 eBIT,
00052 eINT,
00053 eBYTE,
00054 eSHORTINT,
00055 eLONGINT,
00056 eDEVENT,
00057 eSTRUCT,
00058 eUNION,
00059 eUNION_TAGGED,
00060 eENUM,
00061 eCLASS,
00062 ePROXY,
00063 };
00064 #if defined CDATATYPE_CC
00065
00068 const char* varDataTypeName[] = {
00069 "",
00070 "real",
00071 "shortreal",
00072 "realtime",
00073 "reg",
00074 "time",
00075 "logic",
00076 "integer",
00077 "bit",
00078 "int",
00079 "byte",
00080 "shortint",
00081 "longint",
00082 "event",
00083 "struct",
00084 "union",
00085 "union tagged",
00086 "enum",
00087 "class",
00088 "proxy",
00089 };
00090 #else // CDATATYPE_CC
00091 extern const char* varDataTypeName[];
00092 #endif // CDATATYPE_CC
00093
00097 enum NodeType_t {
00098 eU,
00099 eR,
00100 eS,
00101 eE,
00102 eB
00103 };
00104
00108 class CDataType : public CObject
00109 {
00110 public:
00111 private:
00112 int const_;
00113 VarDataType_t varDataType;
00114 int numberOfPackedDimensions;
00115 vector<CNode*> packedRange;
00116 public:
00120 CDataType( VarDataType_t t );
00124 CDataType( VarDataType_t t, list<CNode*> packedList );
00129 virtual CDataType* Clone( CObstack* heap ) = 0;
00134 virtual void SetVarDataType( VarDataType_t v ) { varDataType = v; }
00139 virtual VarDataType_t GetVarDataType() const { return varDataType; }
00145 virtual void SetConst( int v ) { const_ = v; }
00150 virtual int GetConst() const { return const_; }
00155 virtual int GetTwoState() const = 0;
00160 virtual int GetSigned() const = 0;
00165 virtual NodeType_t GetNodeType( void ) const = 0;
00173 virtual int IsBaseWidthConstant( void ) const = 0;
00181 virtual int IsBaseWidthVolatile( void ) const = 0;
00188 virtual int IsBaseWidthEvaluateable( void ) const = 0;
00193 virtual INT32 GetBaseWidth( void ) const = 0;
00198 virtual CNode* GetBaseWidthExp() const = 0;
00204 virtual int IsScalar() const;
00210 virtual int IsVector() const = 0;
00216 virtual int IsPacked() const = 0;
00223 virtual int IsPackedWidthConstant( void ) const;
00230 virtual int IsPackedWidthVolatile( void ) const;
00236 virtual int IsPackedWidthEvaluateable( void ) const;
00242 virtual CNode* GetPackedMsb() const;
00248 virtual CNode* GetPackedLsb() const;
00254 virtual CNode* GetPackedRange() const;
00259 virtual INT32 GetPackedWidth( void ) const;
00264 virtual CNode* GetPackedWidthExp() const;
00269 virtual int PackedWidthDirection( void ) const;
00274 virtual INT32 GetNumberOfPackedDimensions( void ) const
00275 { return numberOfPackedDimensions;}
00281 virtual CNode* GetPackedMsi( INT32 dim ) const;
00287 virtual CNode* GetPackedLsi( INT32 dim ) const;
00293 virtual CNode* GetPackedRange( INT32 dim ) const
00294 { return packedRange[dim]; }
00295
00296
00301 virtual void Dump( FILE* f ) const = 0;
00309 virtual void PreVisit1( int (*callback)(CNode*,void*), void* data );
00316 virtual void PostVisit1( void (*callback)(CNode*,void*), void* data );
00325 virtual void PostSubVisit1( CNode* (*callback)(CNode*, void*), void* data );
00326 protected:
00333 void Copy( CObstack* heap, const CDataType& o );
00334 private:
00335
00336
00337
00338 CDataType( const CDataType& o );
00339
00340 };
00341
00342 #endif // CDATATYPE_H
00343