Polaris: SharedBounds.h Source File

SharedBounds.h

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