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

box_impl.hh

00001 // Copyright (C) 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_CORE_INTERNAL_BOX_IMPL_HH
00027 # define MLN_CORE_INTERNAL_BOX_IMPL_HH
00028 
00035 # include <mln/core/internal/force_exact.hh>
00036 
00037 
00038 namespace mln
00039 {
00040 
00041   namespace internal
00042   {
00043 
00044     // box_impl
00045 
00050     template <unsigned n, typename C, typename E>
00051     struct box_impl_;
00052 
00053     template <typename C, typename E> // FIXME: Add an extra param to replace 'unsigned'.
00054     struct box_impl_<3, C, E>
00055     {
00057       unsigned nslis() const;
00058 
00060       C min_sli() const;
00061 
00063       C max_sli() const;
00064 
00066       unsigned nrows() const;
00067 
00069       C min_row() const;
00070 
00072       C max_row() const;
00073 
00075       unsigned ncols() const;
00076 
00078       C min_col() const;
00079 
00081       C max_col() const;
00082     };
00083 
00084     template <typename C, typename E> // FIXME: Add an extra param to replace 'unsigned'.
00085     struct box_impl_<2, C, E>
00086     {
00088       unsigned nrows() const;
00089 
00091       C min_row() const;
00092 
00094       C max_row() const;
00095 
00097       unsigned ncols() const;
00098 
00100       C min_col() const;
00101 
00103       C max_col() const;
00104     };
00105 
00106     template <typename C, typename E> // FIXME: Add an extra param to replace 'unsigned'.
00107     struct box_impl_<1, C, E>
00108     {
00110       unsigned ninds() const;
00111 
00113       C min_ind() const;
00114 
00116       C max_ind() const;
00117     };
00118 
00119 
00120 # ifndef MLN_INCLUDE_ONLY
00121 
00122     // box_impl
00123 
00124     // 3
00125 
00126     template <typename C, typename E>
00127     inline
00128     unsigned box_impl_<3, C, E>::nslis() const
00129     {
00130       return internal::force_exact<E>(*this).bbox().len(0);
00131     }
00132 
00133     template <typename C, typename E>
00134     inline
00135     C box_impl_<3, C, E>::min_sli() const
00136     {
00137       return internal::force_exact<E>(*this).bbox().pmin()[0];
00138     }
00139 
00140     template <typename C, typename E>
00141     inline
00142     C box_impl_<3, C, E>::max_sli() const
00143     {
00144       return internal::force_exact<E>(*this).bbox().pmax()[0];
00145     }
00146 
00147     template <typename C, typename E>
00148     inline
00149     unsigned box_impl_<3, C, E>::nrows() const
00150     {
00151       return internal::force_exact<E>(*this).bbox().len(1);
00152     }
00153 
00154     template <typename C, typename E>
00155     inline
00156     C box_impl_<3, C, E>::min_row() const
00157     {
00158       return internal::force_exact<E>(*this).bbox().pmin()[1];
00159     }
00160 
00161     template <typename C, typename E>
00162     inline
00163     C box_impl_<3, C, E>::max_row() const
00164     {
00165       return internal::force_exact<E>(*this).bbox().pmax()[1];
00166     }
00167 
00168     template <typename C, typename E>
00169     inline
00170     unsigned box_impl_<3, C, E>::ncols() const
00171     {
00172       return internal::force_exact<E>(*this).bbox().len(2);
00173     }
00174 
00175     template <typename C, typename E>
00176     inline
00177     C box_impl_<3, C, E>::min_col() const
00178     {
00179       return internal::force_exact<E>(*this).bbox().pmin()[2];
00180     }
00181 
00182     template <typename C, typename E>
00183     inline
00184     C box_impl_<3, C, E>::max_col() const
00185     {
00186       return internal::force_exact<E>(*this).bbox().pmax()[2];
00187     }
00188 
00189 
00190     // 2
00191 
00192     template <typename C, typename E>
00193     inline
00194     unsigned box_impl_<2, C, E>::nrows() const
00195     {
00196       return internal::force_exact<E>(*this).bbox().len(0);
00197     }
00198 
00199     template <typename C, typename E>
00200     inline
00201     C box_impl_<2, C, E>::min_row() const
00202     {
00203       return internal::force_exact<E>(*this).bbox().pmin()[0];
00204     }
00205 
00206     template <typename C, typename E>
00207     inline
00208     C box_impl_<2, C, E>::max_row() const
00209     {
00210       return internal::force_exact<E>(*this).bbox().pmax()[0];
00211     }
00212 
00213     template <typename C, typename E>
00214     inline
00215     unsigned box_impl_<2, C, E>::ncols() const
00216     {
00217       return internal::force_exact<E>(*this).bbox().len(1);
00218     }
00219 
00220     template <typename C, typename E>
00221     inline
00222     C box_impl_<2, C, E>::min_col() const
00223     {
00224       return internal::force_exact<E>(*this).bbox().pmin()[1];
00225     }
00226 
00227     template <typename C, typename E>
00228     inline
00229     C box_impl_<2, C, E>::max_col() const
00230     {
00231       return internal::force_exact<E>(*this).bbox().pmax()[1];
00232     }
00233 
00234     // 1
00235 
00236     template <typename C, typename E>
00237     inline
00238     unsigned box_impl_<1, C, E>::ninds() const
00239     {
00240       return internal::force_exact<E>(*this).bbox().len(0);
00241     }
00242 
00243     template <typename C, typename E>
00244     inline
00245     C box_impl_<1, C, E>::min_ind() const
00246     {
00247       return internal::force_exact<E>(*this).bbox().pmin()[0];
00248     }
00249 
00250     template <typename C, typename E>
00251     inline
00252     C box_impl_<1, C, E>::max_ind() const
00253     {
00254       return internal::force_exact<E>(*this).bbox().pmax()[0];
00255     }
00256 
00257 # endif // ! MLN_INCLUDE_ONLY
00258 
00259   } // end of namespace mln::internal
00260 
00261 } // end of namespace mln
00262 
00263 
00264 #endif // ! MLN_CORE_INTERNAL_BOX_IMPL_HH

Generated on Thu Sep 8 2011 18:31:33 for Milena (Olena) by  doxygen 1.7.1