$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
solve.hh
1 // Copyright (C) 2006, 2007, 2008, 2009, 2012 EPITA Research and
2 // Development Laboratory (LRDE)
3 //
4 // This file is part of Olena.
5 //
6 // Olena is free software: you can redistribute it and/or modify it under
7 // the terms of the GNU General Public License as published by the Free
8 // Software Foundation, version 2 of the License.
9 //
10 // Olena is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // As a special exception, you may use this file as part of a free
19 // software project without restriction. Specifically, if other files
20 // instantiate templates or use macros or inline functions from this
21 // file, or you compile this file and link it with other files to produce
22 // an executable, this file does not by itself cause the resulting
23 // executable to be covered by the GNU General Public License. This
24 // exception does not however invalidate any other reasons why the
25 // executable file might be covered by the GNU General Public License.
26 
27 #ifndef MLN_TRAIT_SOLVE_HH
28 # define MLN_TRAIT_SOLVE_HH
29 
38 # include <mln/core/category.hh>
39 # include <mln/metal/equal.hh>
40 # include <mln/metal/if.hh>
41 # include <mln/metal/ret.hh>
42 
43 
44 // FIXME: Just for the record (use it...)
45 
46 # ifndef MLN_DEBUG_TRAITS
47 # endif // ! MLN_DEBUG_TRAITS
48 
49 
50 # define mln_trait_unary(Name, T) typename mln::trait::solve_unary< Name, T >::ret
51 # define mln_trait_unary_(Name, T) mln::trait::solve_unary< Name, T >::ret
52 
53 # define mln_trait_binary(Name, T1, T2) typename mln::trait::solve_binary< Name, T1, T2 >::ret
54 # define mln_trait_binary_(Name, T1, T2) mln::trait::solve_binary< Name, T1, T2 >::ret
55 
56 
57 
58 namespace mln
59 {
60 
61  namespace trait
62  {
63 
68  struct not_found {};
69 
74  struct undefined {};
75 
80  struct multiply_defined {};
81 
82 
83 
84  // Unary case.
85 
86 
87  template < template <class> class Name,
88  typename T >
89  struct set_precise_unary_
90  {
91  typedef undefined ret;
92  };
93 
94 
95  template < template <class> class Name,
96  template <class> class Category_T, typename T >
97  struct set_unary_
98  {
99  typedef undefined ret;
100  };
101 
102  template < template <class> class Name,
103  typename T >
104  struct set_unary_< Name, Unknown, T > // Blocker; top of inheritance.
105  {
106  typedef not_found ret;
107  };
108 
109 
110 
111 
112  // Binary case.
113 
114 
115  template < template <class, class> class Name,
116  typename L,
117  typename R >
118  struct set_precise_binary_
119  {
120  typedef undefined ret;
121  };
122 
123 
124  template < template <class, class> class Name,
125  template <class> class Category_L, typename L,
126  template <class> class Category_R, typename R >
127  struct set_binary_
128  {
129  typedef undefined ret;
130  };
131 
132  template < template <class, class> class Name,
133  typename L,
134  template <class> class Category_R, typename R >
135  struct set_binary_< Name, Unknown, L, Category_R, R > // Left blocker.
136  {
137  typedef not_found ret;
138  };
139 
140  template < template <class, class> class Name,
141  template <class> class Category_L, typename L,
142  typename R >
143  struct set_binary_< Name, Category_L, L, Unknown, R > // Right blocker.
144  {
145  typedef not_found ret;
146  };
147 
148  template < template <class, class> class Name,
149  typename L,
150  typename R >
151  struct set_binary_< Name, Unknown, L, Unknown, R > // Blocker.
152  {
153  typedef not_found ret;
154  };
155 
156 
157  } // end of namespace mln::trait
158 
159 } // end of namespace mln
160 
161 
162 # include <mln/trait/solve_unary.hh>
163 # include <mln/trait/solve_binary.hh>
164 
165 
166 #endif // ! MLN_TRAIT_SOLVE_HH