Milena (Olena)
User documentation 2.0a Id
|
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_GEOM_DELTA_HH 00027 # define MLN_GEOM_DELTA_HH 00028 00032 00033 00034 # include <mln/core/concept/window.hh> 00035 # include <mln/core/concept/weighted_window.hh> 00036 # include <mln/core/concept/neighborhood.hh> 00037 00038 00039 namespace mln 00040 { 00041 00042 namespace geom 00043 { 00044 00046 template <typename W> 00047 unsigned delta(const Window<W>& win); 00048 00050 template <typename W> 00051 unsigned delta(const Weighted_Window<W>& wwin); 00052 00054 template <typename N> 00055 unsigned delta(const Neighborhood<N>& nbh); 00056 00057 00058 00059 # ifndef MLN_INCLUDE_ONLY 00060 00061 namespace internal 00062 { 00063 00064 template <typename W> 00065 unsigned delta_dispatch(trait::window::support::any, 00066 trait::window::definition::any, 00067 const W& win) 00068 { 00069 (void) win; 00070 return 0; 00071 } 00072 00073 template <typename W> 00074 unsigned delta_dispatch(trait::window::support::regular, 00075 trait::window::definition::varying, 00076 const W& win) 00077 { 00078 (void) win; 00079 return 0; 00080 } 00081 00082 template <typename W> 00083 unsigned delta_dispatch(trait::window::support::regular, 00084 trait::window::definition::any, // So not varying. 00085 const W& win) 00086 { 00087 return win.delta(); 00088 } 00089 00090 } // end of namespace mln::geom::internal 00091 00092 00093 // Facades. 00094 00095 template <typename W> 00096 unsigned delta(const Window<W>& win) 00097 { 00098 mln_precondition(exact(win).is_valid()); 00099 return internal::delta_dispatch(mln_trait_window_support(W)(), 00100 mln_trait_window_definition(W)(), 00101 exact(win)); 00102 } 00103 00104 template <typename W> 00105 unsigned delta(const Weighted_Window<W>& wwin) 00106 { 00107 mln_precondition(exact(wwin).is_valid()); 00108 return delta(exact(wwin).win()); 00109 } 00110 00111 template <typename N> 00112 unsigned delta(const Neighborhood<N>& nbh) 00113 { 00114 mln_precondition(exact(nbh).is_valid()); 00115 return delta(exact(nbh).win()); 00116 } 00117 00118 # endif // ! MLN_INCLUDE_ONLY 00119 00120 } // end of namespace mln::geom 00121 00122 } // end of namespace mln 00123 00124 00125 #endif // ! MLN_GEOM_DELTA_HH