Polaris: ComplexExpr.h Source File

ComplexExpr.h

Go to the documentation of this file.
00001 ///
00002 #ifndef _COMPLEX_EXPR_H
00003 #define _COMPLEX_EXPR_H
00004 ///
00005 /// \class ComplexExpr 
00006 /// \brief An expression representing a complex constant
00007 /// \defgroup Polaris
00008 /// \ingroup Polaris
00009 ///  Expression
00010 /// \see Expression/ComplexExpr.h
00011 /// \see Expression/ComplexExpr.h
00012 /// \see Expression/Expression.cc
00013 ///
00014 /// \endcode
00015 /// \section Description Description
00016 /// A ComplexExpr is the operator that forms a complex number
00017 /// out of a real part and an imaginary part, expressed in Fortran
00018 /// as "( expr , expr )".
00019 ///
00020 #ifdef POLARIS_GNU_PRAGMAS
00021 #pragma interface
00022 #endif
00023 ///
00024 #ifndef _BINARY_EXPR_H
00025 #include "BinaryExpr.h"
00026 #endif
00027 ///
00028 class ComplexExpr : public BinaryExpr {
00029     friend class          ExprTable;
00030 
00031  public:
00032     inline ComplexExpr(Expression * real_exp, Expression * imaginary_exp);
00033     inline ComplexExpr(const ComplexExpr & e);
00034     virtual ~ComplexExpr();
00035 
00036     virtual ComplexExpr & operator = (const ComplexExpr &);
00037 
00038     inline const Expression & real_part() const;
00039     inline Expression & real_part();
00040     inline void    real_part(Expression *e);
00041     ///< Access the real part of the expression.
00042 
00043     inline const Expression & imaginary_part() const;
00044     inline Expression & imaginary_part();
00045     inline void    imaginary_part(Expression *);
00046     ///< Access the real part of the expression.
00047 
00048     virtual Expression *clone() const;
00049     virtual int     structures_OK() const;
00050     virtual void    convert(BinRep & exprSet, Symtab & symtab);
00051     virtual void    print_debug(ostream & o, Boolean debug) const;
00052     ///< See Expression.h.
00053  
00054     virtual int     exchange_expr( VDL & vdl );
00055     ///< Create a node in the "expression" member and return the index.
00056 
00057  protected:
00058     inline ComplexExpr();
00059 };
00060 
00061 
00062 ///< inline implementations
00063 
00064 inline
00065 ComplexExpr::ComplexExpr()
00066 : BinaryExpr(COMPLEX_OP, make_type(COMPLEX_TYPE)) 
00067 {
00068     ///< nothing to do
00069 }
00070 
00071 inline
00072 ComplexExpr::ComplexExpr(Expression * real_exp, Expression * imaginary_exp)
00073 : BinaryExpr(COMPLEX_OP, make_type(COMPLEX_TYPE), real_exp, imaginary_exp) 
00074 {
00075     ///< nothing to do
00076 }
00077 
00078 inline
00079 ComplexExpr::ComplexExpr(const ComplexExpr & e)
00080 : BinaryExpr(e) 
00081 {
00082     ///< nothing to do
00083 }
00084 
00085 inline const Expression & 
00086 ComplexExpr::real_part() const 
00087 {
00088     return _left_guarded();
00089 }
00090 
00091 inline Expression & 
00092 ComplexExpr::real_part() 
00093 {
00094     return _left_guarded();
00095 }
00096 
00097 inline void
00098 ComplexExpr::real_part(Expression * e) 
00099 {
00100     _left(e);
00101 }
00102 
00103 inline const Expression & 
00104 ComplexExpr::imaginary_part() const 
00105 {
00106     return _right_guarded();
00107 }
00108 
00109 inline Expression & 
00110 ComplexExpr::imaginary_part() 
00111 {
00112     return _right_guarded();
00113 }
00114 
00115 inline void
00116 ComplexExpr::imaginary_part(Expression * e) 
00117 {
00118     _right(e);
00119 }
00120 
00121 #endif
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:05:42 2005