• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

solve.hh

00001 // Copyright (C) 2006, 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
00002 //
00003 // This file is part of Olena.
00004 //
00005 // Olena is free software: you can redistribute it and/or modify it under
00006 // the terms of the GNU General Public License as published by the Free
00007 // Software Foundation, version 2 of the License.
00008 //
00009 // Olena is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Olena.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 // As a special exception, you may use this file as part of a free
00018 // software project without restriction.  Specifically, if other files
00019 // instantiate templates or use macros or inline functions from this
00020 // file, or you compile this file and link it with other files to produce
00021 // an executable, this file does not by itself cause the resulting
00022 // executable to be covered by the GNU General Public License.  This
00023 // exception does not however invalidate any other reasons why the
00024 // executable file might be covered by the GNU General Public License.
00025 
00026 #ifndef MLN_TRAIT_SOLVE_HH
00027 # define MLN_TRAIT_SOLVE_HH
00028 
00037 # include <mln/core/category.hh>
00038 # include <mln/metal/equal.hh>
00039 # include <mln/metal/if.hh>
00040 # include <mln/metal/ret.hh>
00041 
00042 
00043 // FIXME: Just for the record (use it...)
00044 
00045 #  ifndef MLN_DEBUG_TRAITS 
00046 #  endif // ! MLN_DEBUG_TRAITS
00047 
00048 
00049 # define mln_trait_unary(Name, T)  typename mln::trait::solve_unary< Name, T >::ret
00050 # define mln_trait_unary_(Name, T)          mln::trait::solve_unary< Name, T >::ret
00051 
00052 # define mln_trait_binary(Name, T1, T2)  typename mln::trait::solve_binary< Name, T1, T2 >::ret
00053 # define mln_trait_binary_(Name, T1, T2)          mln::trait::solve_binary< Name, T1, T2 >::ret
00054 
00055 
00056 
00057 namespace mln
00058 {
00059 
00060   namespace trait
00061   {
00062 
00064     struct not_found {};
00065 
00067     struct undefined {};
00068 
00070     struct multiply_defined {};
00071 
00072 
00073 
00074     // Unary case.
00075 
00076 
00077     template < template <class> class Name,
00078                typename T >
00079     struct set_precise_unary_
00080     {
00081       typedef undefined ret;
00082     };
00083 
00084 
00085     template < template <class> class Name,
00086                template <class> class Category_T, typename T >
00087     struct set_unary_
00088     {
00089       typedef undefined ret;
00090     };
00091 
00092     template < template <class> class Name,
00093                typename T >
00094     struct set_unary_< Name, Unknown, T > // Blocker; top of inheritance.
00095     {
00096       typedef not_found ret;
00097     };
00098 
00099 
00100 
00101 
00102     // Binary case.
00103 
00104 
00105     template < template <class, class> class Name,
00106                typename L,
00107                typename R >
00108     struct set_precise_binary_
00109     {
00110       typedef undefined ret;
00111     };
00112 
00113     
00114     template < template <class, class> class Name,
00115                template <class> class Category_L, typename L,
00116                template <class> class Category_R, typename R >
00117     struct set_binary_
00118     {
00119       typedef undefined ret;
00120     };
00121 
00122     template < template <class, class> class Name,
00123                typename L,
00124                template <class> class Category_R, typename R >
00125     struct set_binary_< Name, Unknown, L, Category_R, R > // Left blocker.
00126     {
00127       typedef not_found ret;
00128     };
00129 
00130     template < template <class, class> class Name,
00131                template <class> class Category_L, typename L,
00132                typename R >
00133     struct set_binary_< Name, Category_L, L, Unknown, R > // Right blocker.
00134     {
00135       typedef not_found ret;
00136     };
00137 
00138     template < template <class, class> class Name,
00139                typename L,
00140                typename R >
00141     struct set_binary_< Name, Unknown, L, Unknown, R > // Blocker.
00142     {
00143       typedef not_found ret;
00144     };
00145 
00146 
00147   } // end of namespace mln::trait
00148 
00149 } // end of namespace mln
00150 
00151 
00152 # include <mln/trait/solve_unary.hh>
00153 # include <mln/trait/solve_binary.hh>
00154 
00155 
00156 #endif // ! MLN_TRAIT_SOLVE_HH

Generated on Tue Oct 4 2011 15:24:28 for Milena (Olena) by  doxygen 1.7.1