| Polaris: ArrayBounds.h Source File | ||
|
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members
ArrayBounds.hGo to the documentation of this file.00001 #ifndef _ARRAY_BOUNDS_H 00002 #define _ARRAY_BOUNDS_H 00003 /// 00004 /// 00005 /// file ArrayBounds.h 00006 /// 00007 /// 00008 /// \class ArrayBounds 00009 /// \brief a struct to hold a lower and upper bound 00010 /// \defgroup Polaris 00011 /// \ingroup Polaris 00012 /// C++ VDL 00013 /// \see ArrayBounds.h 00014 /// \see ArrayBounds.h 00015 /// \see ArrayBounds.cc 00016 /// 00017 /// \endcode 00018 /// \section Description Description 00019 /// ArrayBounds is a simple structure for holding a lower and upper bound 00020 /// 00021 /// for a single dimension of an array. Either or both of the lower and 00022 /// upper bound expression pointers may be 0, indicating that this place 00023 /// is not specified in the program (i.e. unspecified or given as "*") 00024 /// 00025 #ifdef POLARIS_GNU_PRAGMAS 00026 #pragma interface 00027 #endif 00028 /// 00029 #include "ClassNames.h" 00030 #include <stream.h> 00031 #include "String.h" 00032 #include "BinRep.h" 00033 #include "Listable.h" 00034 #include "Collection/List.h" 00035 #include "Expression/Expression.h" 00036 /// 00037 class ExprTable; 00038 00039 const int LOWER_BOUND = 0; 00040 const int UPPER_BOUND = 1; 00041 00042 class ArrayBounds : public Listable { 00043 friend ostream & operator << (ostream & o, const ArrayBounds & bounds); 00044 00045 private: 00046 List<Expression> _expr_list; 00047 00048 public: 00049 ArrayBounds(); 00050 ///< Constructor -- initializes upper and lower bounds to none 00051 00052 ArrayBounds(const BinRep & binstr, ExprTable & exprs); 00053 ///< Constructor -- from binstr and expression table 00054 00055 ArrayBounds(const ArrayBounds & other); 00056 00057 ArrayBounds(Expression * lower, Expression * upper); 00058 00059 ArrayBounds & operator = (const ArrayBounds & other); 00060 00061 virtual ~ArrayBounds(); 00062 00063 List<Expression> & arg_list(); 00064 ///< return a list of the expressions. 00065 00066 int lower_exists() const; 00067 00068 const Expression & lower_guarded() const; 00069 Expression & lower_guarded(); 00070 00071 const Expression * lower_ref() const; 00072 Expression * lower_ref(); 00073 ///< Return pointer to lower bound Expression (0 = none) 00074 00075 void lower(Expression * expr); 00076 ///< Set lower bound expression to expr, which must be heap allocated 00077 ///< and must not be aliased (but MAY be 0 for none) 00078 00079 int upper_exists() const; 00080 00081 const Expression & upper_guarded() const; 00082 Expression & upper_guarded(); 00083 00084 const Expression * upper_ref() const; 00085 Expression * upper_ref(); 00086 ///< Return pointer to upper bound Expression (0 = none) 00087 00088 void upper(Expression * expr); 00089 ///< Set upper bound expression to expr, which must be heap allocated 00090 ///< and must not be aliased (but MAY be 0 for none). 00091 00092 virtual ArrayBounds *clone() const; 00093 virtual Listable * listable_clone() const; 00094 ///< Return a newly-allocated copy of this object 00095 00096 virtual void print(ostream & o) const; 00097 ///< print onto stream 00098 00099 virtual int structures_OK() const; 00100 ///< Check the structure of the data for errors or inconsistency 00101 ///< Return 0 and print error message if problems found, otherwise 00102 ///< return 1 without message. 00103 }; 00104 00105 #endif |
||
|