Polaris: ExprSet.h Source File

ExprSet.h

Go to the documentation of this file.
00001 #ifndef _EXPR_SET_H
00002 #define _EXPR_SET_H
00003 ///
00004 /// file ExprSet.h
00005 ///
00006 /// \class ExprSet 
00007 /// \brief Set of expression objects.
00008 /// \defgroup Polaris
00009 /// \ingroup Polaris
00010 ///  Range
00011 /// \see ExprSet.h
00012 /// \see ExprSet.h
00013 /// \see ExprSet.cc
00014 ///
00015 /// \endcode
00016 /// \section Overview Overview
00017 /// An ExprSet object is a set of expression objects.  Expressions are
00018 /// stored by value, not by pointer.
00019 ///
00020 #include "../Listable.h"
00021 #include "../Collection/List.h"
00022 #include "../Collection/Iterator.h"
00023 #include "../Expression/Expression.h"
00024 ///
00025 class ExprSet : public Listable {
00026 public:
00027     ExprSet();
00028     ExprSet(const ExprSet &other);
00029     virtual ~ExprSet();
00030 
00031     ExprSet &operator = (const ExprSet &other);
00032 
00033     const Expression &ins(Expression *expr);
00034     ///< Insert the given expression into the set.  Ownership of the
00035     ///< expression is passed to this routine, which may delete it
00036     ///< if it is already in the set.  A reference to the representative
00037     ///< expression for the given expression is returned.  
00038 
00039     void del(Expression &expr);
00040     ///< Delete the given expression from the set.
00041 
00042     void clear();
00043     ///< Delete all expressions in the set.
00044 
00045     bool member(Expression &expr) const;
00046     ///< Return true if the given expression is in the set.
00047 
00048     const Expression *representative(const Expression &expr) const;
00049     ///< Return the expression in the set that equals the given
00050     ///< expression.  Returns NULL if no such expression exists.
00051 
00052     Iterator<Expression> iterator() const;
00053     ///< Return an iterator to all the expressions in the set.
00054 
00055     virtual void print(ostream & o) const;
00056     ///< Print out my expressions.
00057 
00058     virtual Listable *listable_clone(void) const;
00059     virtual int structures_OK() const;
00060     ///< Methods required by Listable
00061 
00062 private:
00063     List<Expression> _expr_set;
00064 
00065     const Expression *_representative(Expression &expr,
00066                                       Expression *& pred) const;
00067 };
00068 
00069 #endif
00070 
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:05:52 2005