
* mln/core/image/complex_image.hh (complex_image<D, P, V>::operator()(const faces_psite<N, D, P>) const) (complex_image<D, P, V>::operator()(const faces_psite<N, D, P>)): New operators. --- milena/ChangeLog | 9 +++++++ milena/mln/core/image/complex_image.hh | 37 +++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index afbf257..413bbb6 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,14 @@ 2008-09-24 Roland Levillain <roland@lrde.epita.fr> + Have mln::complex_image be accessible via faces_psites. + + * mln/core/image/complex_image.hh + (complex_image<D, P, V>::operator()(const faces_psite<N, D, P>) const) + (complex_image<D, P, V>::operator()(const faces_psite<N, D, P>)): + New operators. + +2008-09-24 Roland Levillain <roland@lrde.epita.fr> + Complete iterators on faces. * mln/core/faces_iter.hh diff --git a/milena/mln/core/image/complex_image.hh b/milena/mln/core/image/complex_image.hh index 6dbc522..0512d0f 100644 --- a/milena/mln/core/image/complex_image.hh +++ b/milena/mln/core/image/complex_image.hh @@ -143,12 +143,18 @@ namespace mln void init_(const p_complex<D, P>& pc, const metal::vec< D + 1, std::vector<V> >& values); - /// Read-only access of pixel value at point site \p p. + /// Read-only access of face value at point site \p p. rvalue operator()(const complex_psite<D, P>& p) const; - - /// Read-write access of pixel value at point site \p p. + /// Read-write access of face value at point site \p p. lvalue operator()(const complex_psite<D, P>& p); + /// Read-only access of face value at point site \p p. + template <unsigned N> + rvalue operator()(const faces_psite<N, D, P>& p) const; + /// Read-write access of face value at point site \p p. + template <unsigned N> + lvalue operator()(const faces_psite<N, D, P>& p); + /// Accessors. /// \{ /// Return the domain of psites od the image. @@ -193,8 +199,7 @@ namespace mln template <unsigned D, typename P, typename V> inline data< complex_image<D, P, V> >::data(const p_complex<D, P>& pc, - const metal::vec< D + 1, - std::vector<V> >& values) + const metal::vec< D + 1, std::vector<V> >& values) : values_(values), pc_(pc) { @@ -272,6 +277,28 @@ namespace mln } template <unsigned D, typename P, typename V> + template <unsigned N> + inline + typename complex_image<D, P, V>::rvalue + complex_image<D, P, V>::operator()(const faces_psite<N, D, P>& p) const + { + /* FIXME: We should ensure data_->pc_ has P, but it is not + trivial: a daces_psite has no idea what a p_complex is. */ + return this->data_->values_[p.n()][p.face_id()]; + } + + template <unsigned D, typename P, typename V> + template <unsigned N> + inline + typename complex_image<D, P, V>::lvalue + complex_image<D, P, V>::operator()(const faces_psite<N, D, P>& p) + { + /* FIXME: We should ensure data_->pc_ has P, but it is not + trivial: a daces_psite has no idea what a p_complex is. */ + return this->data_->values_[p.n()][p.face_id()]; + } + + template <unsigned D, typename P, typename V> inline const metal::vec< D + 1, std::vector<V> >& complex_image<D, P, V>::face_values() const -- 1.6.0.1