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

distance_functor.hh

00001 // Copyright (C) 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_TRANSFORM_INTERNAL_DISTANCE_FUNCTOR_HH
00027 # define MLN_TRANSFORM_INTERNAL_DISTANCE_FUNCTOR_HH
00028 
00034 
00035 # include <mln/core/macros.hh>
00036 
00037 
00038 
00039 namespace mln
00040 {
00041 
00042   namespace transform
00043   {
00044 
00045     namespace internal
00046     {
00047 
00048       template <typename I>
00049       struct distance_functor
00050       {
00051         typedef mln_value(I) V;
00052         typedef mln_site(I)  P;
00053 
00054         void init(const I&);
00055         bool inqueue_p_wrt_input_p(const V& input_p);
00056         void init_p(const P&);
00057         bool inqueue_p_wrt_input_n(const V& input_n);
00058         void process(const P&, const P&);
00059 
00060 
00061         void init_(const I&);
00062         bool inqueue_p_wrt_input_p_(const V& input_p);
00063         void init_p_(unsigned);
00064         bool inqueue_p_wrt_input_n_(const V& input_n);
00065         void process_(unsigned, unsigned);
00066       };
00067 
00068 
00069 # ifndef MLN_INCLUDE_ONLY
00070 
00071 
00072       // Generic implementation.
00073 
00074       template <typename I>
00075       inline
00076       void
00077       distance_functor<I>::init(const I&)
00078       {
00079       }
00080 
00081       template <typename I>
00082       inline
00083       bool
00084       distance_functor<I>::inqueue_p_wrt_input_p(const V& input_p)
00085       {
00086         return input_p == true;
00087       }
00088 
00089       template <typename I>
00090       inline
00091       void
00092       distance_functor<I>::init_p(const mln_site(I)&)
00093       {
00094       }
00095 
00096       template <typename I>
00097       inline
00098       bool
00099       distance_functor<I>::inqueue_p_wrt_input_n(const V& input_n)
00100       {
00101         return input_n == false;
00102       }
00103 
00104       template <typename I>
00105       inline
00106       void distance_functor<I>::process(const P&, const P&)
00107       {
00108       }
00109 
00110 
00111 
00112       // Fastest implementation.
00113 
00114       template <typename I>
00115       inline
00116       void
00117       distance_functor<I>::init_(const I&)
00118       {
00119       }
00120 
00121       template <typename I>
00122       inline
00123       bool
00124       distance_functor<I>::inqueue_p_wrt_input_p_(const V& input_p)
00125       {
00126         return input_p == true;
00127       }
00128 
00129       template <typename I>
00130       inline
00131       void
00132       distance_functor<I>::init_p_(unsigned)
00133       {
00134       }
00135 
00136       template <typename I>
00137       inline
00138       bool
00139       distance_functor<I>::inqueue_p_wrt_input_n_(const V& input_n)
00140       {
00141         return input_n == false;
00142       }
00143 
00144       template <typename I>
00145       inline
00146       void distance_functor<I>::process_(unsigned, unsigned)
00147       {
00148       }
00149 
00150 # endif // ! MLN_INCLUDE_ONLY
00151 
00152     } // end of namespace mln::transform::internal
00153 
00154   } // end of namespace mln::transform
00155 
00156 } // end of namespace mln
00157 
00158 
00159 #endif // ! MLN_TRANSFORM_INTERNAL_DISTANCE_FUNCTOR_HH

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