00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #ifndef MLN_TRAIT_NEXT_SOLVE_UNARY_HH
00027 # define MLN_TRAIT_NEXT_SOLVE_UNARY_HH
00028 
00037 # include <mln/core/category.hh>
00038 # include <mln/core/routine/exact.hh>
00039 # include <mln/metal/equal.hh>
00040 # include <mln/metal/if.hh>
00041 # include <mln/metal/ret.hh>
00042 # include <mln/trait/next/solve.hh>
00043 
00044 
00045 
00046 
00047 #  ifndef MLN_DEBUG_TRAITS
00048 #  endif // ! MLN_DEBUG_TRAITS
00049 
00050 
00051 
00052 namespace mln
00053 {
00054 
00055   namespace trait
00056   {
00057 
00058     namespace next
00059     {
00060 
00061       namespace internal
00062       {
00063 
00064 
00065         template < typename Name,
00066                    typename Category,
00067                    typename T >
00068         struct trait_set_unary_;
00069 
00070         template < typename Name,
00071                    template <class> class Category, typename _,
00072                    typename T >
00073         struct trait_set_unary_< Name, Category<_>, T >
00074         {
00075           typedef typename mln::trait::next::set_unary_<Name, Category, T>::ret ret;
00076         };
00077 
00078 
00079         
00080         template < typename Name,
00081                    typename Category, typename T >
00082         struct get_unary_;
00083 
00084 
00085         template < typename user_ret, 
00086                    typename Name,
00087                    typename Category, typename T >
00088         struct helper_get_unary_
00089         {
00090           typedef user_ret ret;  
00091         };
00092 
00093 
00094         template < typename Name,
00095                    typename Category, typename T >
00096         struct helper_get_unary_<  not_found,
00097                                   Name, Category, T >
00098         {
00099           typedef not_found ret;  
00100         };
00101 
00102 
00103         template < typename Name,
00104                    typename Category, typename T >
00105         struct helper_get_unary_<  undefined,
00106                                   Name, Category, T >
00107         {
00108           typedef typename mln::internal::super_category_< Category, T >::ret Super_Category;
00109           typedef typename get_unary_<Name, Super_Category, T>::ret ret;   
00110         };
00111 
00112 
00113         template < typename Name,
00114                    typename Category, typename T >
00115         struct get_unary_
00116         {
00117           typedef typename trait_set_unary_<Name, Category, T>::ret user_ret;  
00118           typedef helper_get_unary_<user_ret, Name, Category, T> helper;       
00119           typedef mlc_ret(helper) ret;                                         
00120         };
00121 
00122 
00123         template < typename precise_ret,
00124                    typename Name,
00125                    typename Category, typename T >
00126         struct helper_choose_unary_wrt_ 
00127         {
00128           typedef precise_ret ret;                                 
00129         };
00130 
00131         template < typename Name,
00132                    typename Category, typename T >
00133         struct helper_choose_unary_wrt_<  undefined,
00134                                         Name, Category, T >
00135         {
00136           typedef typename get_unary_<Name, Category, T>::ret ret; 
00137                                                                   
00138         };
00139 
00140         template < typename Name,
00141                    typename Category, typename T >
00142         struct helper_solve_unary_
00143         {
00144           typedef typename set_precise_unary_<Name, T>::ret precise_ret;
00145           typedef helper_choose_unary_wrt_< precise_ret, 
00146                                             Name, Category, T> helper;
00147           typedef mlc_ret(helper) ret;
00148         };
00149 
00150       } 
00151 
00152 
00153       template < typename Name,
00154                 typename T_ >
00155       struct solve_unary
00156       {
00157         typedef mln_exact(T_) T;
00158         typedef typename mln::category<T>::ret Category;
00159         typedef internal::helper_solve_unary_< Name, Category, T > meta_code;
00160         typedef typename meta_code::ret ret;
00161       };
00162 
00163     } 
00164 
00165   } 
00166 
00167 } 
00168 
00169 
00170 #endif // ! MLN_TRAIT_NEXT_SOLVE_UNARY_HH