AccessVariable.hh

Go to the documentation of this file.
00001 #ifndef ACCESSVARIABLE_HH
00002 #define ACCESSVARIABLE_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/ObjectBase.hh"
00017 #include "tyvis/ArrayInfo.hh"
00018 #include "tyvis/Types.hh"
00019 #include <string.h>
00020 #include <iostream>
00021 
00022 using std::cout;
00023 
00024 class AccessVariable : public ObjectBase {
00025 public:
00026   AccessVariable( const TypeInfo &initTypeInfo );
00027 
00028   AccessVariable( const TypeInfo &initTypeInfo,
00029                   const string &initName );
00030 
00031   AccessVariable( const AccessVariable & );
00032 
00033   static const string &getAccessVariableType(){
00034     static const string accessVariableType = "AccessVariable";
00035     return accessVariableType;
00036   }
00037 
00038   const string &getDataType() const {
00039     return getAccessVariableType();
00040   }
00041 
00042   void serialize( SerializedInstance * ) const {
00043     abort();
00044   }
00045 
00046   AccessVariable &operator=(const AccessVariable & );
00047   AccessVariable &operator=( const string &newVal );
00048 
00049   void print( ostream &os ) const;
00050   int size() const { return val.size(); }
00051   void advance( int amount ){ curPos += amount; }
00052 
00053   int getIntValue() const { abort(); return 0; }
00054   LONG getInt64Value() const { abort(); return 0; }
00055   double getDoubleValue() const { abort(); return 0; }
00056 
00057   void setVal( const string &newVal ){
00058     curPos = 0;
00059     val = newVal;
00060   }
00061   
00062   const string &getVal(){
00063     return val;
00064   }
00065 
00066   bool operator==( const RValue &compareTo ) const {
00067     return ( dynamic_cast<const AccessVariable &>( compareTo ).curPos == curPos &&
00068              dynamic_cast<const AccessVariable &>( compareTo ).val == val );
00069   }
00070 
00071   bool operator!=( const RValue &compareTo ) const {
00072     return !( dynamic_cast<const AccessVariable &>( compareTo ).curPos == curPos &&
00073               dynamic_cast<const AccessVariable &>( compareTo ).val == val );
00074   }
00075 
00076   bool operator>( const RValue &compareTo ) const{
00077     return val > dynamic_cast<const AccessVariable &>( compareTo ).val;
00078   }
00079 
00080   bool operator>=( const RValue &compareTo ) const {
00081     return val >= dynamic_cast<const AccessVariable &>( compareTo ).val;
00082   }
00083 
00084   bool operator<( const RValue &compareTo ) const {
00085     return val < dynamic_cast<const AccessVariable &>( compareTo ).val;
00086   }
00087 
00088   bool operator<=( const RValue &compareTo ) const {
00089     return val <= dynamic_cast<const AccessVariable &>( compareTo ).val;
00090   }
00091 
00092   inline void printstr(ostream& os) {
00093     os << val;
00094   }
00095   
00100   bool eatwhite(){
00101     for( int i = curPos; i < size(); i++ ){
00102       while( val[i] == ' ' || val[i] == '\t' ){
00103         curPos++;
00104       }
00105     }
00106     return curPos < size();
00107   }
00108 
00109   void append( const string &toAppend ){
00110     val += toAppend;
00111   }
00112 
00113   void reset();
00114 
00115   const RValue &readVal() const;
00116   void updateVal( const RValue &newValue );
00117   RValue &operator=(const RValue &);
00118   RValue *clone() const;
00119 
00120 private:
00121   int curPos; // pointer into val indicating, e.g., the current read position
00122   string val;
00123 };
00124 
00125 #endif

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