ivl 679
ivl/details/core/lvalue.hpp
00001 /* This file is part of the ivl C++ library <http://image.ntua.gr/ivl>.
00002    A C++ template library extending syntax towards mathematical notation.
00003 
00004    Copyright (C) 2012 Yannis Avrithis <iavr@image.ntua.gr>
00005    Copyright (C) 2012 Kimon Kontosis <kimonas@image.ntua.gr>
00006 
00007    ivl is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU Lesser General Public License 
00009    version 3 as published by the Free Software Foundation.
00010 
00011    Alternatively, you can redistribute it and/or modify it under the terms 
00012    of the GNU General Public License version 2 as published by the Free 
00013    Software Foundation.
00014 
00015    ivl is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00018    See the GNU General Public License for more details.
00019 
00020    You should have received a copy of the GNU General Public License 
00021    and a copy of the GNU Lesser General Public License along 
00022    with ivl. If not, see <http://www.gnu.org/licenses/>. */
00023 
00024 #ifndef IVL_CORE_DETAILS_LVALUE_HPP
00025 #define IVL_CORE_DETAILS_LVALUE_HPP
00026 
00027 //to be removed
00028 #if 0
00029 
00030 namespace ivl
00031 {
00032 
00033 namespace lvalue_details
00034 {
00035 template<typename T0>
00036 class lvalue1 {
00037 private:
00038         T0 &t0;
00039 
00040 public:
00041         lvalue1(T0& arg0): t0(arg0){};
00042 
00043         template <class F> void operator=(const rvalue_base<F>& f)
00044         { f.derived().output(t0); };
00045 };
00046 
00047 
00048 template<typename T0, typename T1>
00049 class lvalue2 {
00050 private:
00051         T0 &t0;
00052         T1 &t1;
00053 
00054 public:
00055         lvalue2(T0& arg0, T1& arg1): t0(arg0), t1(arg1) {};
00056 
00057         template <class F> void operator=(const rvalue_base<F>& f)
00058         { f.derived().output(t0, t1); };
00059 };
00060 
00061 
00062 template<typename T0, typename T1, typename T2>
00063 class lvalue3 {
00064 private:
00065         T0 &t0;
00066         T1 &t1;
00067         T2 &t2;
00068 
00069 public:
00070         lvalue3(T0& arg0, T1& arg1, T2& arg2): t0(arg0), t1(arg1), t2(arg2) {};
00071 
00072         template <class F> void operator=(const rvalue_base<F>& f)
00073         { f.derived().output(t0, t1, t2); };
00074 };
00075 
00076 
00077 template<typename T0, typename T1, typename T2, typename T3>
00078 class lvalue4 {
00079 private:
00080         T0 &t0;
00081         T1 &t1;
00082         T2 &t2;
00083         T3 &t3;
00084 
00085 public:
00086         lvalue4(T0& arg0, T1& arg1, T2& arg2, T3& arg3):
00087       t0(arg0), t1(arg1), t2(arg2), t3(arg3) {};
00088 
00089         template <class F> void operator=(const rvalue_base<F>& f)
00090         { f.derived().output(t0, t1, t2, t3); };
00091 };
00092 
00093 template<typename T0, typename T1, typename T2, typename T3, typename T4>
00094 class lvalue5 {
00095 private:
00096         T0 &t0;
00097         T1 &t1;
00098         T2 &t2;
00099         T3 &t3;
00100         T4 &t4;
00101 
00102 public:
00103         lvalue5(T0& arg0, T1& arg1, T2& arg2, T3& arg3, T4& arg4):
00104       t0(arg0), t1(arg1), t2(arg2), t3(arg3), t4(arg4) {};
00105 
00106         template <class F> void operator=(const rvalue_base<F>& f)
00107         { f.derived().output(t0, t1, t2, t3, t4); };
00108 };
00109 
00110 template<typename T0, typename T1, typename T2, typename T3, typename T4,
00111                                                                 typename T5>
00112 class lvalue6 {
00113 private:
00114         T0 &t0;
00115         T1 &t1;
00116         T2 &t2;
00117         T3 &t3;
00118         T4 &t4;
00119         T5 &t5;
00120 
00121 public:
00122         lvalue6(T0& arg0, T1& arg1, T2& arg2, T3& arg3, T4& arg4, T5& arg5):
00123       t0(arg0), t1(arg1), t2(arg2), t3(arg3), t4(arg4), t5(arg5) {};
00124 
00125         template <class F> void operator=(const rvalue_base<F>& f)
00126         { f.derived().output(t0, t1, t2, t3, t4, t5); };
00127 };
00128 
00129 template<typename T0, typename T1, typename T2, typename T3, typename T4,
00130                                                 typename T5, typename T6>
00131 class lvalue7 {
00132 private:
00133         T0 &t0;
00134         T1 &t1;
00135         T2 &t2;
00136         T3 &t3;
00137         T4 &t4;
00138         T5 &t5;
00139         T6 &t6;
00140 
00141 public:
00142         lvalue7(T0& arg0, T1& arg1, T2& arg2, T3& arg3, T4& arg4, T5& arg5,
00143                 T6& arg6):
00144         t0(arg0), t1(arg1), t2(arg2), t3(arg3), t4(arg4), t5(arg5), t6(arg6){};
00145 
00146         template <class F> void operator=(const rvalue_base<F>& f)
00147         { f.derived().output(t0, t1, t2, t3, t4, t5, t6); };
00148 };
00149 
00150 template<typename T0, typename T1, typename T2, typename T3, typename T4,
00151                                         typename T5, typename T6, typename T7>
00152 class lvalue8 {
00153 private:
00154         T0 &t0;
00155         T1 &t1;
00156         T2 &t2;
00157         T3 &t3;
00158         T4 &t4;
00159         T5 &t5;
00160         T6 &t6;
00161         T7 &t7;
00162 
00163 public:
00164         lvalue8(T0& arg0, T1& arg1, T2& arg2, T3& arg3, T4& arg4, T5& arg5,
00165                 T6& arg6, T7& arg7):
00166         t0(arg0), t1(arg1), t2(arg2), t3(arg3), t4(arg4), t5(arg5),
00167                 t6(arg6), t7(arg7) {};
00168 
00169         template <class F> void operator=(const rvalue_base<F>& f)
00170         { f.derived().output(t0, t1, t2, t3, t4, t5, t6, t7); };
00171 };
00172 
00173 template<typename T0, typename T1, typename T2, typename T3, typename T4,
00174                         typename T5, typename T6, typename T7, typename T8>
00175 class lvalue9 {
00176 private:
00177         T0 &t0;
00178         T1 &t1;
00179         T2 &t2;
00180         T3 &t3;
00181         T4 &t4;
00182         T5 &t5;
00183         T6 &t6;
00184         T7 &t7;
00185         T8 &t8;
00186 
00187 public:
00188         lvalue9(T0& arg0, T1& arg1, T2& arg2, T3& arg3, T4& arg4, T5& arg5,
00189                 T6& arg6, T7 &arg7, T8 &arg8):
00190         t0(arg0), t1(arg1), t2(arg2), t3(arg3), t4(arg4), t5(arg5), t6(arg6),
00191                 t7(arg7), t8(arg8) {};
00192 
00193         template <class F> void operator=(const rvalue_base<F>& f)
00194         { f.derived().output(t0, t1, t2, t3, t4, t5, t6, t7, t8); };
00195 };
00196 
00197 template<typename T0, typename T1, typename T2, typename T3, typename T4,
00198         typename T5, typename T6, typename T7, typename T8, typename T9>
00199 class lvalue10 {
00200 private:
00201         T0 &t0;
00202         T1 &t1;
00203         T2 &t2;
00204         T3 &t3;
00205         T4 &t4;
00206         T5 &t5;
00207         T6 &t6;
00208         T7 &t7;
00209         T8 &t8;
00210         T9 &t9;
00211 
00212 public:
00213         lvalue10(T0& arg0, T1& arg1, T2& arg2, T3& arg3, T4& arg4, T5& arg5,
00214                 T6& arg6, T7 &arg7, T8 &arg8, T9 &arg9):
00215         t0(arg0), t1(arg1), t2(arg2), t3(arg3), t4(arg4), t5(arg5), t6(arg6),
00216                 t7(arg7), t8(arg8), t9(arg9) {};
00217 
00218         template <class F> void operator=(const rvalue_base<F>& f)
00219         { f.derived().output(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9); };
00220 };
00221 
00222 } /*namespace lvalue_details*/
00223 
00224 template <class T0>
00225 inline
00226 lvalue_details::lvalue1<T0> lvalue(T0& t0)
00227 {
00228         return lvalue_details::lvalue1<T0>(t0);
00229 }
00230 
00231 template <class T0, class T1>
00232 inline
00233 lvalue_details::lvalue2<T0, T1> lvalue(T0& t0, T1& t1)
00234 {
00235         return lvalue_details::lvalue2<T0, T1>(t0, t1);
00236 }
00237 
00238 template <class T0, class T1, class T2>
00239 inline
00240 lvalue_details::lvalue3<T0, T1, T2> lvalue(T0& t0, T1& t1, T2& t2)
00241 {
00242         return lvalue_details::lvalue3<T0, T1, T2>(t0, t1, t2);
00243 }
00244 
00245 template <class T0, class T1, class T2, class T3>
00246 inline
00247 lvalue_details::lvalue4<T0, T1, T2, T3> lvalue(T0& t0, T1& t1, T2& t2, T3& t3)
00248 {
00249         return lvalue_details::lvalue4<T0, T1, T2, T3>(t0, t1, t2, t3);
00250 }
00251 
00252 template <class T0, class T1, class T2, class T3, class T4>
00253 inline
00254 lvalue_details::lvalue5<T0, T1, T2, T3, T4> lvalue(T0& t0, T1& t1, T2& t2,
00255                                                    T3& t3, T4& t4)
00256 {
00257         return lvalue_details::lvalue5<T0, T1, T2, T3, T4>(t0, t1, t2, t3, t4);
00258 }
00259 
00260 template <class T0, class T1, class T2, class T3, class T4, class T5>
00261 inline
00262 lvalue_details::lvalue6<T0, T1, T2, T3, T4, T5> lvalue(T0& t0, T1& t1, T2& t2,
00263                                                        T3& t3, T4& t4, T5& t5)
00264 {
00265         return lvalue_details::lvalue6<T0, T1, T2, T3, T4, T5>(t0, t1, t2, t3,
00266                 t4, t5);
00267 }
00268 
00269 template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
00270 inline
00271 lvalue_details::lvalue7<T0, T1, T2, T3, T4, T5, T6> lvalue(T0& t0, T1& t1,
00272                                                            T2& t2, T3& t3,
00273                                                            T4& t4, T5& t5, T6& t6)
00274 {
00275         return lvalue_details::lvalue7<T0, T1, T2, T3, T4, T5, T6>(t0, t1, t2,
00276                 t3, t4, t5, t6);
00277 }
00278 
00279 template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
00280 class T7>
00281 inline
00282 lvalue_details::lvalue8<T0, T1, T2, T3, T4, T5, T6, T7> lvalue(T0& t0, T1& t1,
00283                                                                T2& t2, T3& t3,
00284                                                                T4& t4, T5& t5,
00285                                                                T6& t6, T7& t7)
00286 {
00287         return lvalue_details::lvalue8<T0, T1, T2, T3, T4, T5, T6, T7>(t0, t1,
00288                 t2, t3, t4, t5, t6, t7);
00289 }
00290 
00291 template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
00292 class T7, class T8>
00293 inline
00294 lvalue_details::lvalue9<T0, T1, T2, T3, T4, T5, T6, T7, T8> lvalue(T0& t0,
00295                 T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8)
00296 {
00297         return lvalue_details::lvalue9<T0, T1, T2, T3, T4, T5, T6, T7, T8>(t0,
00298                 t1, t2, t3, t4, t5, t6, t7, t8);
00299 }
00300 
00301 template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
00302 class T7, class T8, class T9>
00303 inline
00304 lvalue_details::lvalue10<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> lvalue(T0& t0,
00305         T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8, T9& t9)
00306 {
00307         return lvalue_details::lvalue10<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
00308                 t0, t1, t2, t3, t4, t5, t6, t7, t8, t9);
00309 }
00310 
00311 } /*namespace ivl*/
00312 
00313 #endif
00314 
00315 
00316 #endif // IVL_CORE_DETAILS_LVALUE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations