ivl 679
ivl/details/core/types/elem_functions.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_TYPES_ELEMENT_FUNCTIONS_HPP
00025 #define IVL_CORE_DETAILS_TYPES_ELEMENT_FUNCTIONS_HPP
00026 
00027 #if 0
00028 namespace ivl {
00029 
00030 namespace data {
00031 
00032 //forward declarations
00033 template <template<typename, typename> class F, class A1>
00034 struct use_elem_func_unary_set;
00035 template <template<typename, typename, typename> class F, class A1, class S2>
00036 struct use_elem_func_scalar_r_set;
00037 template <template<typename, typename, typename> class F, class S1, class A2>
00038 struct use_elem_func_scalar_l_set;
00039 template <template<typename, typename, typename> class F, class A1, class A2>
00040 struct use_elem_func_binary_set;
00041 
00042 } /*namespace data*/
00043 
00044 namespace types {
00045 
00046 
00047 template <class T, template <typename, typename> class F, class A1, class DERIVED_CLASS>
00048 class elem_func_unary_info { };
00049 
00050 template <class T, template <typename, typename> class F,
00051         class I1, class X1, class Z1, class DERIVED_CLASS>
00052 class elem_func_unary_info<T, F, array<I1, X1, Z1>, DERIVED_CLASS>
00053 {
00054         typedef I1 elem1_type;
00055 
00056         typedef array <I1, X1, Z1> in1_type;
00057         typedef typename in1_type::derived_type in1_derived;
00058         typedef typename to_type<T, in1_derived>::type out_class;
00059 
00060         typedef typename in1_derived::created_data_class_set created_data_class_set;
00061 
00062         typedef typename change_data_class_set <data::use_elem_func_unary_set<F, in1_type>,
00063                 out_class>::type base_class_basic;
00064 
00065         typedef typename change_derived_class <DERIVED_CLASS, base_class_basic>::type base_class;
00066 };
00067 
00068 
00069 template <class T, template <typename, typename, typename> class F, class A1, class S2, class DERIVED_CLASS>
00070 class elem_func_scalar_r_info { };
00071 
00072 template <class T, template <typename, typename, typename> class F,
00073         class I1, class X1, class Z1, class S2, class DERIVED_CLASS>
00074 class elem_func_scalar_r_info<T, F, array<I1, X1, Z1>, S2, DERIVED_CLASS>
00075 {
00076         typedef I1 elem1_type;
00077         typedef S2 elem2_type;
00078 
00079         typedef array <I1, X1, Z1> in1_type;
00080         typedef typename in1_type::derived_type in1_derived;
00081 
00082         typedef typename to_type<T, in1_derived>::type out_class;
00083 
00084         typedef typename in1_derived::created_data_class_set created_data_class_set;
00085 
00086         typedef typename change_data_class_set <data::use_elem_func_scalar_r_set<F, in1_type, elem2_type>,
00087                 out_class>::type base_class_basic;
00088 
00089         typedef typename change_derived_class <DERIVED_CLASS, base_class_basic>::type base_class;
00090 };
00091 
00092 
00093 template <class T, template <typename, typename, typename> class F, class S1, class A2, class DERIVED_CLASS>
00094 class elem_func_scalar_l_info { };
00095 
00096 template <class T, template <typename, typename, typename> class F,
00097         class S1, class I2, class X2, class Z2, class DERIVED_CLASS>
00098 class elem_func_scalar_l_info<T, F, S1, array<I2, X2, Z2>, DERIVED_CLASS>
00099 {
00100         typedef S1 elem1_type;
00101         typedef I2 elem2_type;
00102 
00103         typedef array <I2, X2, Z2> in2_type;
00104         typedef typename in2_type::derived_type in2_derived;
00105 
00106         typedef typename to_type<T, in2_derived>::type out_class;
00107 
00108         typedef typename in2_derived::created_data_class_set created_data_class_set;
00109 
00110         typedef typename change_data_class_set <data::use_elem_func_scalar_l_set<F, elem1_type, in2_type>,
00111                 out_class>::type base_class_basic;
00112 
00113         typedef typename change_derived_class <DERIVED_CLASS, base_class_basic>::type base_class;
00114 };
00115 
00116 
00117 template <class T, template <typename, typename, typename> class F, class A1, class A2, class DERIVED_CLASS>
00118 class elem_func_binary_info { };
00119 
00120 template <class T, template <typename, typename, typename> class F,
00121         class I1, class X1, class Z1, class I2, class X2, class Z2, class DERIVED_CLASS>
00122 class elem_func_binary_info<T, F, array<I1, X1, Z1>, array<I2, X2, Z2>, DERIVED_CLASS>
00123 {
00124         typedef I1 elem1_type;
00125         typedef I2 elem2_type;
00126 
00127         typedef array <I1, X1, Z1> in1_type;
00128         typedef typename in1_type::derived_type in1_derived;
00129         typedef array <I2, X2, Z2> in2_type;
00130         typedef typename in2_type::derived_type in2_derived;
00131         typedef typename to_type<T, in1_derived>::type in1_canonical;
00132         typedef typename to_type<T, in2_derived>::type in2_canonical;
00133 
00134         typedef typename t_if<is_base_eq<in1_canonical, in2_canonical>,
00135                                                 in2_canonical, in1_canonical>::type out_class;
00136 
00137         typedef typename in1_derived::created_data_class_set created_data_class_set;
00138 
00139         typedef typename change_data_class_set <data::use_elem_func_binary_set<F, in1_type, in2_type>,
00140                 out_class>::type base_class_basic;
00141 
00142         typedef typename change_derived_class <DERIVED_CLASS, base_class_basic>::type base_class;
00143 };
00144 
00145 
00146 } /* namespace types */
00147 
00148 } /* namespace ivl */
00149 #endif
00150 
00151 #endif // IVL_CORE_DETAILS_TYPES_ELEMENT_FUNCTIONS_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations