2436: Add pretty-printing operators for face handles.
* mln/topo/face.hh (operator<<(std::ostream&, const face<D>)) * mln/topo/n_face.hh (operator<<(std::ostream&, const n_face<N, D>)): New operators. --- milena/ChangeLog | 8 ++++++++ milena/mln/topo/face.hh | 15 +++++++++++++++ milena/mln/topo/n_face.hh | 15 +++++++++++++++ 3 files changed, 38 insertions(+), 0 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index f0cf69b..f912670 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,13 @@ 2008-09-30 Roland Levillain <roland@lrde.epita.fr> + Add pretty-printing operators for face handles. + + * mln/topo/face.hh (operator<<(std::ostream&, const face<D>)) + * mln/topo/n_face.hh (operator<<(std::ostream&, const n_face<N, D>)): + New operators. + +2008-09-30 Roland Levillain <roland@lrde.epita.fr> + * mln/topo/complex.hh: Add some more documentation. 2008-09-30 Roland Levillain <roland@lrde.epita.fr> diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh index b2d82b1..0d32c33 100644 --- a/milena/mln/topo/face.hh +++ b/milena/mln/topo/face.hh @@ -135,6 +135,12 @@ namespace mln /// \} + /// Print an mln::topo::face. + template <unsigned D> + std::ostream& + operator<<(std::ostream& ostr, const face<D>& f); + + # ifndef MLN_INCLUDE_ONLY @@ -269,6 +275,15 @@ namespace mln return lhs.face().id() < rhs.face().id(); } + + template <unsigned D> + inline + std::ostream& + operator<<(std::ostream& ostr, const face<D>& f) + { + return ostr << "(dim = " << f.n() << ", id = " << f.face_id() << ')'; + } + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::topo diff --git a/milena/mln/topo/n_face.hh b/milena/mln/topo/n_face.hh index 8d9664b..bb4e926 100644 --- a/milena/mln/topo/n_face.hh +++ b/milena/mln/topo/n_face.hh @@ -130,6 +130,12 @@ namespace mln /// \} + /// Print an mln::topo::n_face. + template <unsigned N, unsigned D> + std::ostream& + operator<<(std::ostream& ostr, const n_face<N, D>& f); + + # ifndef MLN_INCLUDE_ONLY @@ -247,6 +253,15 @@ namespace mln return lhs.face().id() < rhs.face().id(); } + + template <unsigned N, unsigned D> + inline + std::ostream& + operator<<(std::ostream& ostr, const n_face<N, D>& f) + { + return ostr << "(dim = " << f.n() << ", id = " << f.face_id() << ')'; + } + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::topo -- 1.6.0.1
participants (1)
-
Roland Levillain