https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add a printing operator for mln::complex_psite.
* mln/core/complex_psite.hh
(operator<<(std::ostream&, const complex_psite<D, P>&)):
New operator.
* tests/core/complex_image.cc: ...here.
mln/core/complex_psite.hh | 19 +++++++++++++++++++
tests/core/complex_image.cc | 1 +
2 files changed, 20 insertions(+)
Index: mln/core/complex_psite.hh
--- mln/core/complex_psite.hh (revision 2143)
+++ mln/core/complex_psite.hh (working copy)
@@ -127,6 +127,16 @@
/// \}
+ /* FIXME: This hand-made delegation is painful. We should rely on
+ the general mechanism provided by Point_Site. But then again, we
+ need to refine/adjust the interface of Point_Site w.r.t. the
+ mandatory conversions to points. */
+ template <unsigned D, typename P>
+ inline
+ std::ostream&
+ operator<<(std::ostream& ostr, const complex_psite<D, P>& p);
+
+
# ifndef MLN_INCLUDE_ONLY
@@ -254,6 +264,15 @@
return lhs.face() < rhs.face();
}
+
+ template <unsigned D, typename P>
+ inline
+ std::ostream&
+ operator<<(std::ostream& ostr, const complex_psite<D, P>& p)
+ {
+ return ostr << "(dim = " << p.n() << ", id =
" << p.face_id() << ')';
+ }
+
# endif // ! MLN_INCLUDE_ONLY
Index: tests/core/complex_image.cc
--- tests/core/complex_image.cc (revision 2143)
+++ tests/core/complex_image.cc (working copy)
@@ -147,6 +147,7 @@
any_face_handle<D> af(e0_);
// An associated psite.
complex_psite<D, point2d> cs(af);
+ std::cout << cs << std::endl;
/*--------------------.