00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
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, 
00085                               const W& win)
00086       {
00087         return win.delta();
00088       }
00089 
00090     } 
00091 
00092 
00093     
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   } 
00121 
00122 } 
00123 
00124 
00125 #endif // ! MLN_GEOM_DELTA_HH