Polaris: GSAPathExpr.h Source File

GSAPathExpr.h

Go to the documentation of this file.
00001 ///
00002 #ifndef _GSA_PATH_EXPR_H
00003 #define _GSA_PATH_EXPR_H
00004 ///
00005 /// \class GSAPathExpr 
00006 /// \brief Path expressions for building GSA
00007 /// \defgroup Polaris
00008 /// \ingroup Polaris
00009 ///  C++ VDL
00010 /// \see GSAPathExpr.h
00011 /// \see GSAPathExpr.cc
00012 ///
00013 #ifdef POLARIS_GNU_PRAGMAS
00014 #pragma interface
00015 #endif
00016 ///
00017 #include "ClassNames.h"
00018 #include "Statement/Statement.h"
00019 #include "Collection/Map.h"
00020 #include "Listable.h"
00021 ///
00022 #include "GSAPathMap.h"
00023 ///
00024 class GSAPathExpr : public Map<Statement, GSAPathMap>{
00025     friend ostream & operator << (ostream & o, const GSAPathExpr &);
00026 
00027  public:
00028 
00029     Statement * head;
00030     Statement * tail;
00031     Expression * expr;
00032 
00033     GSAPathExpr(){ 
00034     #ifdef CLASS_INSTANCE_REGISTRY
00035     register_instance(GSA_PATH_EXPR, sizeof(GSAPathExpr), this);
00036     #endif
00037 
00038       expr = NULL;
00039       head = tail = NULL; }
00040 
00041     ~GSAPathExpr(){
00042     #ifdef CLASS_INSTANCE_REGISTRY
00043     unregister_instance(GSA_PATH_EXPR, this);
00044     #endif
00045 
00046        if (expr) delete expr; }
00047 
00048     GSAPathExpr(Statement &h, Statement &t){
00049     #ifdef CLASS_INSTANCE_REGISTRY
00050     register_instance(GSA_PATH_EXPR, sizeof(GSAPathExpr), this);
00051     #endif
00052 
00053         expr = NULL;
00054     head = &h;
00055     tail = &t;
00056     GSAPathMap *p = new GSAPathMap(1);
00057     p->children[0] = &t;
00058     ins(h, p);
00059     ins(t, new GSAPathMap(t.succ().entries()));
00060     }
00061 
00062     GSAPathExpr(Statement &h, Statement &t, int b) {
00063     #ifdef CLASS_INSTANCE_REGISTRY
00064     register_instance(GSA_PATH_EXPR, sizeof(GSAPathExpr), this);
00065     #endif
00066 
00067         expr = NULL;
00068         head = &h;
00069         tail = &t;
00070         GSAPathMap *p  = new GSAPathMap(h.succ().entries());
00071         p->children[b] = &t;
00072     ins(h, p);
00073     ins(t, new GSAPathMap(t.succ().entries()));
00074     }
00075 
00076     void fill_expr();
00077     void fill_expr(Expression *);
00078 
00079     void add_edge(Statement &h, Statement &t, int b);
00080 
00081     ///< Union assign another GSAPathExpr with the same head and tail
00082     GSAPathExpr & operator |= (const GSAPathExpr &a);
00083  
00084     ///< Concatenate assign another GSAPathExpr
00085     GSAPathExpr & operator *= (const GSAPathExpr &a);
00086 
00087     ///< Pre concatenate assign another GSAPathExpr
00088     GSAPathExpr & operator /= (const GSAPathExpr &a);
00089 
00090     ///< Cloning method
00091     GSAPathExpr * clone() const;
00092     
00093     virtual Listable *listable_clone() const;
00094     virtual int      structures_OK() const;
00095     virtual void     print(ostream & o ) const;
00096 
00097 };
00098 
00099 #endif
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:05:54 2005