src/Index/SIndexAssign.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  *
00004  * The IPPL Framework
00005  * 
00006  *
00007  * Visit http://people.web.psi.ch/adelmann/ for more details
00008  *
00009  ***************************************************************************/
00010 
00011 #ifndef SINDEX_ASSIGN_H
00012 #define SINDEX_ASSIGN_H
00013 
00014 /***************************************************************************
00015  Special versions of assign which take SIndex objects on the left-hand side
00016  ***************************************************************************/
00017 
00018 // include files
00019 #include "PETE/IpplExpressions.h"
00020 
00021 // forward declarations
00022 template<unsigned Dim> class SIndex;
00023 
00024 // helper class used to determine if things are expressions or not
00025 template<bool IsExpr>  class SIExprTag { };
00026 
00027 
00029 
00030 // SIndex = Expression 
00031 template<unsigned Dim, class RHS, class OP, bool IsExpr>
00032 void
00033 assign(SIndex<Dim>&, RHS, OP, const NDIndex<Dim> &, SIExprTag<IsExpr>);
00034 
00035 
00037 
00038 // a macro for creating different assignment operators for SIndex objects
00039 #define SI_ASSIGNMENT_FUNCTIONS(FUNC,OP)                        \
00040                                                                 \
00041 template<unsigned Dim, class RHS>                               \
00042 inline void                                                     \
00043 FUNC(SIndex<Dim>& lhs, const PETE_Expr<RHS>& rhs)               \
00044 {                                                               \
00045   assign(lhs, rhs.PETE_unwrap().MakeExpression(), OP(),         \
00046          lhs.getFieldLayout().getDomain(), SIExprTag<false>()); \
00047 }                                                               \
00048                                                                 \
00049 template<unsigned Dim, class RHS>                               \
00050 inline void                                                     \
00051 FUNC(SIndex<Dim>& lhs, const PETE_Expr<RHS>& rhs,               \
00052      const NDIndex<Dim>& domain)                                \
00053 {                                                               \
00054   assign(lhs, rhs.PETE_unwrap().MakeExpression(), OP(),         \
00055          domain, SIExprTag<true>());                            \
00056 }
00057 
00058 #define SI_ASSIGNMENT_OPERATORS(FUNC,OP)                        \
00059                                                                 \
00060 template<unsigned Dim, class RHS>                               \
00061 inline void                                                     \
00062 FUNC(SIndex<Dim>& lhs, const PETE_Expr<RHS>& rhs)               \
00063 {                                                               \
00064   assign(lhs, rhs.PETE_unwrap().MakeExpression(), OP(),         \
00065          lhs.getFieldLayout().getDomain(), SIExprTag<false>()); \
00066 }
00067 
00068 
00069 
00070 // use the macro to create a number of different assign functions which
00071 // will in turn call the general  SIndex = expression  version of assign
00072 SI_ASSIGNMENT_FUNCTIONS(assign,OpAssign)
00073 SI_ASSIGNMENT_OPERATORS(operator<<,OpAssign)
00074 SI_ASSIGNMENT_OPERATORS(operator|=,OpBitwiseOrAssign)
00075 SI_ASSIGNMENT_OPERATORS(operator&=,OpBitwiseAndAssign)
00076 
00077 #include "Index/SIndexAssign.cpp"
00078 
00079 #endif // SINDEX_ASSIGN_H
00080 
00081 /***************************************************************************
00082  * $RCSfile: SIndexAssign.h,v $   $Author: adelmann $
00083  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:27 $
00084  * IPPL_VERSION_ID: $Id: SIndexAssign.h,v 1.1.1.1 2003/01/23 07:40:27 adelmann Exp $ 
00085  ***************************************************************************/

Generated on Mon Jan 16 13:23:49 2006 for IPPL by  doxygen 1.4.6