Tag2Exp.h

Go to the documentation of this file.
00001 /*
00002  * Expression Template Matrix Library
00003  *
00004  * Copyright (C) 2004 - 2006 Ricky Lung <mtlung@users.sourceforge.net>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 
00030 #ifdef _MSC_VER
00031 #   pragma once
00032 #endif  // _MSC_VER
00033 
00034 #ifndef _EXMAT_TAG2BINEXP_H
00035 #define _EXMAT_TAG2BINEXP_H
00036 
00037 namespace exmat {
00038 
00039 
00041 #if (HAVE_TT_PARAMETER)
00042 
00043 template<class Exp, class NewRep, class newExtraParam> struct RefillUnaExp;
00044 template<template<class> class Exp, class Rep, class NewRep, class newExtraParam>
00045 struct RefillUnaExp< Exp<Rep>, NewRep, newExtraParam> {
00046     typedef typename Exp<NewRep>::const_view_type RET;
00047 };
00048 template<template<class,class> class Exp, class Rep, class ExtraParam, class NewRep, class newExtraParam>
00049 struct RefillUnaExp< Exp<Rep,ExtraParam>, NewRep, newExtraParam> {
00050     typedef typename Exp<NewRep, newExtraParam>::const_view_type RET;
00051 };
00052 
00053 template<class Exp, class newL, class newR> struct RefillBinExp;
00054 template<template<class,class,class> class Exp, class L, class R, class SpecTag, class newL, class newR>
00055 struct RefillBinExp< Exp<L,R,SpecTag>, newL, newR> {
00056     typedef Exp<newL, newR, SpecTag> RET;
00057 };
00058 
00059 #else
00060 
00061 // Forward declaration of constant views
00062 template<class Rep> class ConstTransView;
00063 template<class Rep> class ConstReverseVecView;
00064 template<class Rep> class ConstRowView;
00065 template<class Rep> class ConstColView;
00066 template<class Rep, class ExtraTParam> class StaticConstSubVecView;
00067 template<class Rep> class DynConstSubVecView;
00068 template<class Rep, class ExtraTParam> class StaticConstSubMatView;
00069 template<class Rep> class DynConstSubMatView;
00070 template<class Rep1, class Rep2> class ConstHMergeView;
00071 template<class Rep, class ExtraTParam> class StaticConstMinorView;
00072 template<class Rep> class DynConstMinorView;
00073 template<class Rep> class ConstCofactorsView;
00074 
00076 template<class ExpTag, class Rep, class ExtraTParam>
00077 struct Tag2UnaExp {
00078 protected:
00079     template<class ExpTag> struct selector {
00080     };
00081     // Transpose view
00082     template<> struct selector<TransposeViewTag> {
00083         typedef ConstTransView<Rep> RET;
00084     };
00085     // Reverse vector view
00086     template<> struct selector<ReverseVecViewTag> {
00087         typedef ConstReverseVecView<Rep> RET;
00088     };
00089     // Row view
00090     template<> struct selector<RowViewTag> {
00091         typedef ConstRowView<Rep> RET;
00092     };
00093     // Column view
00094     template<> struct selector<ColViewTag> {
00095         typedef ConstColView<Rep> RET;
00096     };
00097     // Sub vector view
00098     template<> struct selector<StaticSubVecViewTag> {
00099         typedef StaticConstSubVecView<Rep, ExtraTParam> RET;
00100     };
00101     template<> struct selector<DynSubVecViewTag> {
00102         typedef DynConstSubVecView<Rep> RET;
00103     };
00104     // Sub matrix view
00105     template<> struct selector<StaticSubMatViewTag> {
00106         typedef StaticConstSubMatView<Rep, ExtraTParam> RET;
00107     };
00108     template<> struct selector<DynSubMatViewTag> {
00109         typedef DynConstSubMatView<Rep> RET;
00110     };
00111     // Minor view
00112     template<> struct selector<StaticMinorViewTag> {
00113         typedef StaticConstMinorView<Rep, ExtraTParam> RET;
00114     };
00115     template<> struct selector<DynMinorViewTag> {
00116         typedef DynConstMinorView<Rep> RET;
00117     };
00118     // Cofactors view
00119     template<> struct selector<CofactorsViewTag> {
00120         typedef ConstCofactorsView<Rep> RET;
00121     };
00122 public:
00123     typedef selector<ExpTag>::RET RET;
00124 };
00125 
00126 template<class ExpTag, class L, class R>
00127 struct Tag2BinExp {
00128 protected:
00129     template<class ExpTag> struct selector {
00130     };
00131     template<> struct selector<AddExpTag> {
00132         typedef AddExp<L, R> RET;
00133     };
00134     template<> struct selector<SubExpTag> {
00135         typedef SubExp<L, R> RET;
00136     };
00137     template<> struct selector<MulExpTag> {
00138         typedef MulExp<L, R> RET;
00139     };
00140     template<> struct selector<ScalarMulExpTag> {
00141         typedef ScalarMulExp<L, R> RET;
00142     };
00143     template<> struct selector<ScalarDivExpTag> {
00144         typedef ScalarDivExp<L, R> RET;
00145     };
00146     template<> struct selector<HMergeViewTag> {
00147         typedef ConstHMergeView<L, R> RET;
00148     };
00149 public:
00150     typedef selector<ExpTag>::RET RET;
00151 };
00152 
00153 #endif  // HAVE_TT_PARAMETER
00154 
00155 }   // namespace exmat
00156 
00157 #endif  // _EXMAT_TAG2BINEXP_H

Generated on Sat May 6 23:12:03 2006 for Exmat by  doxygen 1.4.6-NO