https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix missing trait in win diff.
* mln/win/diff.hh (trait): Fix missing.
(operator-): Move the body into...
(diff): ...these new routines.
(operator-): Call diff.
diff.hh | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 79 insertions(+), 11 deletions(-)
Index: mln/win/diff.hh
--- mln/win/diff.hh (revision 3989)
+++ mln/win/diff.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Milena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,11 +29,11 @@
#ifndef MLN_WIN_DIFF_HH
# define MLN_WIN_DIFF_HH
-/*! \file mln/win/diff.hh
- *
- * \brief Set difference between a couple of windows or neighborhoods.
- */
+/// \file mln/win/diff.hh
+///
+/// \brief Set difference between a couple of windows or neighborhoods.
+# include <mln/trait/op/minus.hh>
# include <mln/core/window.hh>
# include <mln/core/neighb.hh>
@@ -41,24 +42,72 @@
namespace mln
{
- /// Set difference between a couple of windows \p win1 and \p win2.
+ namespace win
+ {
+
+ /// \brief Set difference between a couple of windows \p win1 and \p
+ /// win2.
+ //
template <typename W1, typename W2>
mln_regular(W1)
- operator-(const Window<W1>& win1, const Window<W2>& win2);
+ diff(const Window<W1>& win1, const Window<W2>& win2);
+
+
+ /// \brief Set difference between a couple of neighborhoods \p nbh1
+ /// and \p nbh2.
+ //
+ template <typename N1, typename N2>
+ neighb<mln_deduce(N1, window, regular)>
+ diff(const Neighborhood<N1>& nbh1, const Neighborhood<N2>&
nbh2);
+ } // end of namespace mln::win
+
+
+ /// \brief Set difference between a couple of windows \p win1 and \p
+ /// win2. It just calls mln::win::diff.
+ ///
+ //
+ template <typename W1, typename W2>
+ mln_regular(W1)
+ operator-(const Window<W1>& win1, const Window<W2>& win2);
- /// Set difference between a couple of neighborhoods \p nbh1 and \p nbh2.
+ /// \brief Set difference between a couple of neighborhoods \p nbh1
+ /// and \p nbh2. It just calls mln::win::diff.
+ //
template <typename N1, typename N2>
neighb<mln_deduce(N1, window, regular)>
operator-(const Neighborhood<N1>& nbh1, const Neighborhood<N2>&
nbh2);
+ namespace trait
+ {
+
+ template <typename W1, typename W2>
+ struct set_binary_< op::minus, mln::Window, W1, mln::Window, W2 >
+ {
+ typedef mln_regular(W1) ret;
+ };
+
+
+ template <typename N1, typename N2>
+ struct set_binary_< op::minus, mln::Neighborhood, N1, mln::Neighborhood, N2 >
+ {
+ typedef mln::neighb<mln_deduce(N1, window, regular)> ret;
+ };
+
+ } // end of namespace mln::trait
+
+
+
# ifndef MLN_INCLUDE_ONLY
+ namespace win
+ {
+
template <typename W1, typename W2>
inline
mln_regular(W1)
- operator-(const Window<W1>& win1_, const Window<W2>& win2_)
+ diff(const Window<W1>& win1_, const Window<W2>& win2_)
{
trace::entering("win::diff");
@@ -81,10 +130,9 @@
return tmp;
}
-
template <typename N1, typename N2>
neighb<mln_deduce(N1, window, regular)>
- operator-(const Neighborhood<N1>& nbh1, const Neighborhood<N2>&
nbh2)
+ diff(const Neighborhood<N1>& nbh1, const Neighborhood<N2>& nbh2)
{
typedef mln_deduce(N1, window, regular) W1;
W1 win = diff(exact(nbh1).win(), exact(nbh2).win());
@@ -92,6 +140,26 @@
return tmp;
}
+ } // end of namespace mln::win
+
+
+ // Operators.
+
+ template <typename W1, typename W2>
+ inline
+ mln_regular(W1)
+ operator-(const Window<W1>& win1, const Window<W2>& win2)
+ {
+ return win::diff(win1, win2);
+ }
+
+ template <typename N1, typename N2>
+ neighb<mln_deduce(N1, window, regular)>
+ operator-(const Neighborhood<N1>& nbh1, const Neighborhood<N2>&
nbh2)
+ {
+ return win::diff(nbh1, nbh2);
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln