AccessObject.hh

Go to the documentation of this file.
00001 #ifndef ACCESS_OBJECT_HH
00002 #define ACCESS_OBJECT_HH
00003 
00004 // Copyright (c) 1995-2005 The University of Cincinnati.
00005 // All rights reserved.
00006 
00007 // You may modify, distribute, and use the software contained in this
00008 // package under the terms of the "GNU LIBRARY GENERAL PUBLIC LICENSE"
00009 // version 2, June 1991. A copy of this license agreement can be found in
00010 // the file "LGPL", distributed with this archive.
00011 
00012 // Authors: Philip A. Wilsey    philip.wilsey@ieee.org
00013 //          Dale E. Martin      dmartin@cliftonlabs.com
00014 
00015 #include "tyvis/vhdl.hh"
00016 #include "tyvis/Value.hh"
00017 #include "tyvis/UniversalInteger.hh"
00018 #include "tyvis/ArrayInfo.hh"
00019 #include "tyvis/Types.hh"
00020 #include <string.h>
00021 #include <iostream>
00022 
00023 using std::cout;
00024 class AccessTypeInfo;
00025 
00026 class AccessObject : public LValue {
00027 public:
00028   AccessObject( const AccessTypeInfo &initTypeInfo );
00029   AccessObject( const AccessObject & );
00030   ~AccessObject();
00031 
00032   static const string &getAccessObjectType(){
00033     static const string accessObjectType = "AccessObject";
00034     return accessObjectType;
00035   }
00036 
00037   const string &getDataType() const {
00038     return getAccessObjectType();
00039   }
00040 
00041   void serialize( SerializedInstance * ) const {
00042     abort();
00043   }
00044 
00045   AccessObject &operator=(const AccessObject & );
00046   AccessObject &operator=( const string &newVal );
00047 
00048   void print( ostream &os ) const;
00049   virtual Value length( const RValue & = UniversalInteger(1) ) const { abort(); return UniversalInteger(0); }
00050   void advance( int amount ){ curPos += amount; }
00051 
00052   int getIntValue() const { abort(); return 0; }
00053   LONG getInt64Value() const { abort(); return 0; }
00054   double getDoubleValue() const { abort(); return 0; }
00055 
00056   void setVal( const string & ){ abort(); }
00057   
00058   const string &getVal(){
00059     abort();
00060   }
00061 
00062   bool operator==( const RValue &compareTo ) const {
00063     return ( dynamic_cast<const AccessObject &>( compareTo ).curPos == curPos &&
00064              dynamic_cast<const AccessObject &>( compareTo ).val == val );
00065   }
00066 
00067   bool operator!=( const RValue &compareTo ) const {
00068     return !( dynamic_cast<const AccessObject &>( compareTo ).curPos == curPos &&
00069               dynamic_cast<const AccessObject &>( compareTo ).val == val );
00070   }
00071 
00072   bool operator>( const RValue &compareTo ) const{
00073     return val > dynamic_cast<const AccessObject &>( compareTo ).val;
00074   }
00075 
00076   bool operator>=( const RValue &compareTo ) const {
00077     return val >= dynamic_cast<const AccessObject &>( compareTo ).val;
00078   }
00079 
00080   bool operator<( const RValue &compareTo ) const {
00081     return val < dynamic_cast<const AccessObject &>( compareTo ).val;
00082   }
00083 
00084   bool operator<=( const RValue &compareTo ) const {
00085     return val <= dynamic_cast<const AccessObject &>( compareTo ).val;
00086   }
00087 
00088   inline void printstr(ostream& os) {
00089     os << val;
00090   }
00091   
00096   bool eatwhite(){
00097     abort();
00098 //     for( int i = curPos; i < length()(); i++ ){
00099 //       while( val[i] == ' ' || val[i] == '\t' ){
00100 //      curPos++;
00101 //       }
00102 //     }
00103 //     return curPos < length()();
00104   }
00105 
00106   void append( const string & ){
00107     // val += toAppend;
00108     abort();
00109   }
00110 
00111   void reset();
00112 
00113   const RValue &readVal() const;
00114   RValue &readVal();
00115   void updateVal( const RValue &newValue );
00116   RValue &operator=(const RValue &);
00117   RValue *clone() const;
00118 
00119   string toString() const;
00120   bool isCompositeType() const;
00121   bool isScalarType() const;
00122   bool isPhysicalType() const;
00123   const RValue &operator[](int) const;
00124   RValue &operator[](int);
00125   const RValue &operator[](const RValue&) const;
00126   RValue &operator[](const RValue&);
00127   Value getSlice( const ScalarTypeInfo &sliceSpecifier ) const;
00128   RValue &getField(int) const;
00129   RValue &getField(int);
00130   const RValue& getField(const RValue&) const;
00131   RValue &getField(const RValue&);
00132   const string &getUnit() const;
00133   LONG getValue() const;
00134   int getUnits() const;
00135   const TypeInfo &getTypeInfo() const;
00136   const EnumerationLiteral &vhdlEqual(const RValue&) const;
00137   const EnumerationLiteral &vhdlNotEqual(const RValue&) const;
00138   const EnumerationLiteral &vhdlGreaterThan(const RValue&) const;
00139   const EnumerationLiteral &vhdlGreaterThanEqual(const RValue&) const;
00140   const EnumerationLiteral &vhdlLessThan(const RValue&) const;
00141   const EnumerationLiteral &vhdlLessThanEqual(const RValue&) const;
00142   Value vhdlConcatenate( const RValue & ) const;
00143 
00144   RValue &all();
00145   const RValue &all() const;
00146 
00147   Value vhdlPlus( const RValue & ) const;
00148   Value vhdlMinus( const RValue & ) const;
00149   Value vhdlMultiply( const RValue & ) const;
00150   Value vhdlDivide( const RValue & ) const;
00151   Value vhdlMod( const RValue & ) const;
00152   Value vhdlRem( const RValue & ) const;
00153   Value vhdlPow( const RValue & ) const;
00154 
00155   SignalNetinfo &addToFanOut( VHDLKernel * );
00156   //DRH
00157   SignalNetinfo &addChild( SignalNetinfo &, VHDLKernel * );
00158 private:
00159   const AccessTypeInfo *myTypeInfo;
00160   int curPos; // pointer into val indicating, e.g., the current read position
00161   RValue *val;
00162   void die() const;
00163 };
00164 
00165 #endif

Generated on Fri Mar 31 11:05:08 2006 for Tyvis by  doxygen 1.4.6