Milena (Olena)
User documentation 2.0a Id
|
00001 // Copyright (C) 2007, 2008, 2009, 2010, 2011 EPITA Research and 00002 // Development Laboratory (LRDE) 00003 // 00004 // This file is part of Olena. 00005 // 00006 // Olena is free software: you can redistribute it and/or modify it under 00007 // the terms of the GNU General Public License as published by the Free 00008 // Software Foundation, version 2 of the License. 00009 // 00010 // Olena is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Olena. If not, see <http://www.gnu.org/licenses/>. 00017 // 00018 // As a special exception, you may use this file as part of a free 00019 // software project without restriction. Specifically, if other files 00020 // instantiate templates or use macros or inline functions from this 00021 // file, or you compile this file and link it with other files to produce 00022 // an executable, this file does not by itself cause the resulting 00023 // executable to be covered by the GNU General Public License. This 00024 // exception does not however invalidate any other reasons why the 00025 // executable file might be covered by the GNU General Public License. 00026 00027 #ifndef MLN_CORE_INTERNAL_BOX_IMPL_HH 00028 # define MLN_CORE_INTERNAL_BOX_IMPL_HH 00029 00036 # include <mln/core/internal/force_exact.hh> 00037 00038 00039 namespace mln 00040 { 00041 00042 // Forward declaration 00043 00044 namespace internal 00045 { 00046 00047 // box_impl 00048 00053 template <unsigned n, typename C, typename E> 00054 struct box_impl_; 00055 00056 template <typename C, typename E> // FIXME: Add an extra param to replace 'unsigned'. 00057 struct box_impl_<3, C, E> 00058 { 00060 unsigned nslis() const; 00061 00063 C min_sli() const; 00064 00066 C max_sli() const; 00067 00069 unsigned nrows() const; 00070 00072 C min_row() const; 00073 00075 C max_row() const; 00076 00078 unsigned ncols() const; 00079 00081 C min_col() const; 00082 00084 C max_col() const; 00085 00087 unsigned width() const; 00088 00090 unsigned height() const; 00091 00093 unsigned depth() const; 00094 }; 00095 00096 template <typename C, typename E> // FIXME: Add an extra param to replace 'unsigned'. 00097 struct box_impl_<2, C, E> 00098 { 00100 unsigned nrows() const; 00101 00103 C min_row() const; 00104 00106 C max_row() const; 00107 00109 unsigned ncols() const; 00110 00112 C min_col() const; 00113 00115 C max_col() const; 00116 00118 unsigned width() const; 00119 00121 unsigned height() const; 00122 00123 }; 00124 00125 template <typename C, typename E> // FIXME: Add an extra param to replace 'unsigned'. 00126 struct box_impl_<1, C, E> 00127 { 00129 unsigned ninds() const; 00130 00132 C min_ind() const; 00133 00135 C max_ind() const; 00136 }; 00137 00138 00139 # ifndef MLN_INCLUDE_ONLY 00140 00141 // box_impl 00142 00143 // 3 00144 00145 template <typename C, typename E> 00146 inline 00147 unsigned box_impl_<3, C, E>::nslis() const 00148 { 00149 return internal::force_exact<E>(*this).bbox().len(0); 00150 } 00151 00152 template <typename C, typename E> 00153 inline 00154 C box_impl_<3, C, E>::min_sli() const 00155 { 00156 return internal::force_exact<E>(*this).bbox().pmin()[0]; 00157 } 00158 00159 template <typename C, typename E> 00160 inline 00161 C box_impl_<3, C, E>::max_sli() const 00162 { 00163 return internal::force_exact<E>(*this).bbox().pmax()[0]; 00164 } 00165 00166 template <typename C, typename E> 00167 inline 00168 unsigned box_impl_<3, C, E>::nrows() const 00169 { 00170 return internal::force_exact<E>(*this).bbox().len(1); 00171 } 00172 00173 template <typename C, typename E> 00174 inline 00175 C box_impl_<3, C, E>::min_row() const 00176 { 00177 return internal::force_exact<E>(*this).bbox().pmin()[1]; 00178 } 00179 00180 template <typename C, typename E> 00181 inline 00182 C box_impl_<3, C, E>::max_row() const 00183 { 00184 return internal::force_exact<E>(*this).bbox().pmax()[1]; 00185 } 00186 00187 template <typename C, typename E> 00188 inline 00189 unsigned box_impl_<3, C, E>::ncols() const 00190 { 00191 return internal::force_exact<E>(*this).bbox().len(2); 00192 } 00193 00194 template <typename C, typename E> 00195 inline 00196 C box_impl_<3, C, E>::min_col() const 00197 { 00198 return internal::force_exact<E>(*this).bbox().pmin()[2]; 00199 } 00200 00201 template <typename C, typename E> 00202 inline 00203 C box_impl_<3, C, E>::max_col() const 00204 { 00205 return internal::force_exact<E>(*this).bbox().pmax()[2]; 00206 } 00207 00208 00209 template <typename C, typename E> 00210 inline 00211 unsigned box_impl_<3, C, E>::width() const 00212 { 00213 return internal::force_exact<E>(*this).bbox().len(2); 00214 } 00215 00216 template <typename C, typename E> 00217 inline 00218 unsigned box_impl_<3, C, E>::height() const 00219 { 00220 return internal::force_exact<E>(*this).bbox().len(1); 00221 } 00222 00223 template <typename C, typename E> 00224 inline 00225 unsigned box_impl_<3, C, E>::depth() const 00226 { 00227 return internal::force_exact<E>(*this).bbox().len(0); 00228 } 00229 00230 00231 // 2 00232 00233 template <typename C, typename E> 00234 inline 00235 unsigned box_impl_<2, C, E>::nrows() const 00236 { 00237 return internal::force_exact<E>(*this).bbox().len(0); 00238 } 00239 00240 template <typename C, typename E> 00241 inline 00242 C box_impl_<2, C, E>::min_row() const 00243 { 00244 return internal::force_exact<E>(*this).bbox().pmin()[0]; 00245 } 00246 00247 template <typename C, typename E> 00248 inline 00249 C box_impl_<2, C, E>::max_row() const 00250 { 00251 return internal::force_exact<E>(*this).bbox().pmax()[0]; 00252 } 00253 00254 template <typename C, typename E> 00255 inline 00256 unsigned box_impl_<2, C, E>::ncols() const 00257 { 00258 return internal::force_exact<E>(*this).bbox().len(1); 00259 } 00260 00261 template <typename C, typename E> 00262 inline 00263 C box_impl_<2, C, E>::min_col() const 00264 { 00265 return internal::force_exact<E>(*this).bbox().pmin()[1]; 00266 } 00267 00268 template <typename C, typename E> 00269 inline 00270 C box_impl_<2, C, E>::max_col() const 00271 { 00272 return internal::force_exact<E>(*this).bbox().pmax()[1]; 00273 } 00274 00275 template <typename C, typename E> 00276 inline 00277 unsigned box_impl_<2, C, E>::width() const 00278 { 00279 return internal::force_exact<E>(*this).bbox().len(1); 00280 } 00281 00282 template <typename C, typename E> 00283 inline 00284 unsigned box_impl_<2, C, E>::height() const 00285 { 00286 return internal::force_exact<E>(*this).bbox().len(0); 00287 } 00288 00289 // 1 00290 00291 template <typename C, typename E> 00292 inline 00293 unsigned box_impl_<1, C, E>::ninds() const 00294 { 00295 return internal::force_exact<E>(*this).bbox().len(0); 00296 } 00297 00298 template <typename C, typename E> 00299 inline 00300 C box_impl_<1, C, E>::min_ind() const 00301 { 00302 return internal::force_exact<E>(*this).bbox().pmin()[0]; 00303 } 00304 00305 template <typename C, typename E> 00306 inline 00307 C box_impl_<1, C, E>::max_ind() const 00308 { 00309 return internal::force_exact<E>(*this).bbox().pmax()[0]; 00310 } 00311 00312 # endif // ! MLN_INCLUDE_ONLY 00313 00314 } // end of namespace mln::internal 00315 00316 } // end of namespace mln 00317 00318 00319 #endif // ! MLN_CORE_INTERNAL_BOX_IMPL_HH