$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
coord_impl.hh
1 // Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development
2 // 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_CORE_INTERNAL_COORD_IMPL_HH
28 # define MLN_CORE_INTERNAL_COORD_IMPL_HH
29 
35 # include <mln/core/internal/force_exact.hh>
36 
37 
38 namespace mln
39 {
40 
41  namespace internal
42  {
43 
44 
45  // coord_impl
46 
47 
50  template <unsigned n, typename C, typename E>
51  struct coord_impl_;
52 
54  template <typename C, typename E>
55  struct coord_impl_<1, C, E>
56  {
58  const C& ind() const;
59  };
60 
62  template <typename C, typename E>
63  struct coord_impl_<2, C, E>
64  {
66  const C&row() const;
68  const C&col() const;
69  };
70 
72  template <typename C, typename E>
73  struct coord_impl_<3, C, E>
74  {
76  const C&sli() const;
78  const C&row() const;
80  const C&col() const;
81  };
82 
83 
84  // mutable_coord_impl
85 
88  template <unsigned n, typename C, typename E>
89  struct mutable_coord_impl_;
90 
92  template <typename C, typename E>
93  struct mutable_coord_impl_<1, C, E>
94  {
96  const C& ind() const;
98  C& ind();
99  };
100 
102  template <typename C, typename E>
103  struct mutable_coord_impl_<2, C, E>
104  {
106  const C& row() const;
108  C& row();
110  const C& col() const;
112  C& col();
113  };
114 
116  template <typename C, typename E>
117  struct mutable_coord_impl_<3, C, E>
118  {
120  const C& sli() const;
122  C& sli();
124  const C& row() const;
126  C& row();
128  const C& col() const;
130  C& col();
131  };
132 
133 
134 # ifndef MLN_INCLUDE_ONLY
135 
136  // coord_impl
137 
138  // 1
139 
140  template <typename C, typename E>
141  inline
142  const C& coord_impl_<1, C, E>::ind() const
143  {
144  return internal::force_exact<E>(*this)[0];
145  }
146 
147  // 2
148 
149  template <typename C, typename E>
150  inline
151  const C& coord_impl_<2, C, E>::row() const
152  {
153  return internal::force_exact<E>(*this)[0];
154  }
155 
156  template <typename C, typename E>
157  inline
158  const C& coord_impl_<2, C, E>::col() const
159  {
160  return internal::force_exact<E>(*this)[1];
161  }
162 
163  // 3
164 
165  template <typename C, typename E>
166  inline
167  const C& coord_impl_<3, C, E>::sli() const
168  {
169  return internal::force_exact<E>(*this)[0];
170  }
171 
172  template <typename C, typename E>
173  inline
174  const C& coord_impl_<3, C, E>::row() const
175  {
176  return internal::force_exact<E>(*this)[1];
177  }
178 
179  template <typename C, typename E>
180  inline
181  const C& coord_impl_<3, C, E>::col() const
182  {
183  return internal::force_exact<E>(*this)[2];
184  }
185 
186 
187  // mutable_coord_impl
188 
189  // 1
190 
191  template <typename C, typename E>
192  inline
193  const C& mutable_coord_impl_<1, C, E>::ind() const
194  {
195  return internal::force_exact<E>(*this)[0];
196  }
197 
198  template <typename C, typename E>
199  inline
201  {
202  return internal::force_exact<E>(*this)[0];
203  }
204 
205  // 2
206 
207  template <typename C, typename E>
208  inline
209  const C& mutable_coord_impl_<2, C, E>::row() const
210  {
211  return internal::force_exact<E>(*this)[0];
212  }
213 
214  template <typename C, typename E>
215  inline
217  {
218  return internal::force_exact<E>(*this)[0];
219  }
220 
221  template <typename C, typename E>
222  inline
223  const C& mutable_coord_impl_<2, C, E>::col() const
224  {
225  return internal::force_exact<E>(*this)[1];
226  }
227 
228  template <typename C, typename E>
229  inline
231  {
232  return internal::force_exact<E>(*this)[1];
233  }
234 
235  // 3
236 
237  template <typename C, typename E>
238  inline
239  const C& mutable_coord_impl_<3, C, E>::sli() const
240  {
241  return internal::force_exact<E>(*this)[0];
242  }
243 
244  template <typename C, typename E>
245  inline
247  {
248  return internal::force_exact<E>(*this)[0];
249  }
250 
251  template <typename C, typename E>
252  inline
253  const C& mutable_coord_impl_<3, C, E>::row() const
254  {
255  return internal::force_exact<E>(*this)[1];
256  }
257 
258  template <typename C, typename E>
259  inline
261  {
262  return internal::force_exact<E>(*this)[1];
263  }
264 
265  template <typename C, typename E>
266  inline
267  const C& mutable_coord_impl_<3, C, E>::col() const
268  {
269  return internal::force_exact<E>(*this)[2];
270  }
271 
272  template <typename C, typename E>
273  inline
275  {
276  return internal::force_exact<E>(*this)[2];
277  }
278 
279 # endif // ! MLN_INCLUDE_ONLY
280 
281  } // end of namespace mln::internal
282 
283 } // end of namespace mln
284 
285 
286 #endif // ! MLN_CORE_INTERNAL_COORD_IMPL_HH