2414: Rename mln::topo::any_face_handle as mln::topo::face.

* mln/topo/face.hh (mln::topo::any_face_handle<D>): Rename as... (mln::topo::face<D>): ...this. Adjust. * mln/topo/complex.hh, * mln/topo/complex_iter.hh, * mln/topo/complex_faces_iter.hh, * tests/topo/complex.cc: Adjust. * mln/core/site_set/p_complex.hh: Update documentation. * mln/core/site_set/complex_psite.hh, * tests/core/image/complex_image.cc: Adjust. --- milena/ChangeLog | 18 ++++++ milena/mln/core/site_set/complex_psite.hh | 10 ++-- milena/mln/core/site_set/p_complex.hh | 15 +++--- milena/mln/topo/complex.hh | 2 +- milena/mln/topo/complex_faces_iter.hh | 12 ++-- milena/mln/topo/complex_iter.hh | 12 ++-- milena/mln/topo/face.hh | 81 +++++++++++++++-------------- milena/tests/core/image/complex_image.cc | 2 +- milena/tests/topo/complex.cc | 6 +- 9 files changed, 89 insertions(+), 69 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index dfdd15b..ded9680 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,23 @@ 2008-09-26 Roland Levillain <roland@lrde.epita.fr> + Rename mln::topo::any_face_handle as mln::topo::face. + + * mln/topo/face.hh (mln::topo::any_face_handle<D>): Rename as... + (mln::topo::face<D>): ...this. + Adjust. + * mln/topo/complex.hh, + * mln/topo/complex_iter.hh, + * mln/topo/complex_faces_iter.hh, + * tests/topo/complex.cc: + Adjust. + + * mln/core/site_set/p_complex.hh: Update documentation. + * mln/core/site_set/complex_psite.hh, + * tests/core/image/complex_image.cc: + Adjust. + +2008-09-26 Roland Levillain <roland@lrde.epita.fr> + Rename mln::topo::face_handle as mln::topo::n_face. * mln/topo/face.hh (mln::topo::face_handle<N, D>): Rename as... diff --git a/milena/mln/core/site_set/complex_psite.hh b/milena/mln/core/site_set/complex_psite.hh index 71dd84e..02ab19e 100644 --- a/milena/mln/core/site_set/complex_psite.hh +++ b/milena/mln/core/site_set/complex_psite.hh @@ -73,7 +73,7 @@ namespace mln complex_psite(); /// \pre pc.cplx() == face.cplx(). complex_psite(const p_complex<D, P>& pc, - const topo::any_face_handle<D>& face); + const topo::face<D>& face); complex_psite(const p_complex<D, P>& pc, unsigned n, unsigned face_id); /// \} @@ -107,7 +107,7 @@ namespace mln /// Face handle manipulators. /// \{ /// Return the face handle of this point site. - topo::any_face_handle<D> face() const; + topo::face<D> face() const; /// Return the dimension of the face of this psite. unsigned n() const; @@ -142,7 +142,7 @@ namespace mln /// The mln::p_faces this point site belongs to. const target* pc_; /// The handle of the face this psite is pointing towards. - topo::any_face_handle<D> face_; + topo::face<D> face_; /// \} }; @@ -209,7 +209,7 @@ namespace mln template <unsigned D, typename P> inline complex_psite<D, P>::complex_psite(const p_complex<D, P>& pc, - const topo::any_face_handle<D>& face) + const topo::face<D>& face) : pc_(&pc), face_(face) { @@ -289,7 +289,7 @@ namespace mln template <unsigned D, typename P> inline - topo::any_face_handle<D> + topo::face<D> complex_psite<D, P>::face() const { return face_; diff --git a/milena/mln/core/site_set/p_complex.hh b/milena/mln/core/site_set/p_complex.hh index 206cd34..a747b69 100644 --- a/milena/mln/core/site_set/p_complex.hh +++ b/milena/mln/core/site_set/p_complex.hh @@ -167,18 +167,17 @@ namespace mln private: /// The complex on which this pset is built. /* FIXME: Get rid of this `mutable' qualifier. This is needed for - compatiblity reasons with any_face_handle (see - p_complex_piter). + compatiblity reasons with topo::face (see p_complex_piter). We should either - - have an additional version of any_face_handle holding a - const (not mutable) complex; + - have an additional version of topo::face holding a const (not + mutable) complex; - - have face_handle and any_face_handle do not hold a reference - on a complex, leading to a design of complexes similar to - graphs, where vertex and edge handles (named `id's) are not - tied to a specific graph. */ + - have face_handle and topo::face do not hold a reference on a + complex, leading to a design of complexes similar to graphs, + where vertex and edge handles (named `id's) are not tied to a + specific graph. */ mutable topo::complex<D> cplx_; }; diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh index 021e788..de6fb90 100644 --- a/milena/mln/topo/complex.hh +++ b/milena/mln/topo/complex.hh @@ -153,7 +153,7 @@ namespace mln /// Accessors. /// \{ template <unsigned N, unsigned D_> friend class n_face; - template <unsigned D_> friend class any_face_handle; + template <unsigned D_> friend class face; template <unsigned N> face_data<N, D>& face_data_(unsigned face_id); diff --git a/milena/mln/topo/complex_faces_iter.hh b/milena/mln/topo/complex_faces_iter.hh index 05713da..990d8d4 100644 --- a/milena/mln/topo/complex_faces_iter.hh +++ b/milena/mln/topo/complex_faces_iter.hh @@ -55,12 +55,12 @@ namespace mln /// \arg \p D The dimension of the complex this iterator belongs to. template <unsigned N, unsigned D> class complex_faces_fwd_iter_ - : public internal::complex_iter_base_< any_face_handle<D>, + : public internal::complex_iter_base_< face<D>, complex_faces_fwd_iter_<N, D> > { public: /// Type of associated face. - typedef any_face_handle<D> face; + typedef face<D> face; private: typedef complex_faces_fwd_iter_<N, D> self_; @@ -101,12 +101,12 @@ namespace mln /// \arg \p D The dimension of the complex this iterator belongs to. template <unsigned N, unsigned D> class complex_faces_bkd_iter_ - : public internal::complex_iter_base_< any_face_handle<D>, + : public internal::complex_iter_base_< face<D>, complex_faces_bkd_iter_<N, D> > { public: /// Type of associated face. - typedef any_face_handle<D> face; + typedef face<D> face; private: typedef complex_faces_bkd_iter_<N, D> self_; @@ -183,7 +183,7 @@ namespace mln { unsigned face_id = face_.face_id(); if (face_id + 1 < face_.cplx().template nfaces<N>()) - /* FIXME: Provide accessor any_face_handle::face_id() + /* FIXME: Provide accessor face::face_id() returning a mutable reference? This way, we could just write @@ -242,7 +242,7 @@ namespace mln { unsigned face_id = face_.face_id(); if (face_id > 0) - /* FIXME: Provide accessor any_face_handle::face_id() + /* FIXME: Provide accessor face::face_id() returning a mutable reference? This way, we could just write diff --git a/milena/mln/topo/complex_iter.hh b/milena/mln/topo/complex_iter.hh index b30ca00..a752892 100644 --- a/milena/mln/topo/complex_iter.hh +++ b/milena/mln/topo/complex_iter.hh @@ -55,12 +55,12 @@ namespace mln /// \arg \p D The dimension of the complex this iterator belongs to. template <unsigned D> class complex_fwd_iter_ - : public internal::complex_iter_base_< any_face_handle<D>, + : public internal::complex_iter_base_< face<D>, complex_fwd_iter_<D> > { public: /// Type of associated face. - typedef any_face_handle<D> face; + typedef face<D> face; private: typedef complex_fwd_iter_<D> self_; @@ -100,12 +100,12 @@ namespace mln /// \arg \p D The dimension of the complex this iterator belongs to. template <unsigned D> class complex_bkd_iter_ - : public internal::complex_iter_base_< any_face_handle<D>, + : public internal::complex_iter_base_< face<D>, complex_bkd_iter_<D> > { public: /// Type of associated face. - typedef any_face_handle<D> face; + typedef face<D> face; private: typedef complex_bkd_iter_<D> self_; @@ -179,7 +179,7 @@ namespace mln unsigned face_id = face_.face_id(); if (face_id + 1 < face_.cplx().nfaces(n)) - /* FIXME: Provide accessor any_face_handle::face_id() returning + /* FIXME: Provide accessor face::face_id() returning a mutable reference? This way, we could just write ++face_.face_id(); @@ -243,7 +243,7 @@ namespace mln unsigned face_id = face_.face_id(); if (face_id > 0) - /* FIXME: Provide accessor any_face_handle::face_id() returning + /* FIXME: Provide accessor face::face_id() returning a mutable reference? This way, we could just write ++face_.face_id(); diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh index 4aab366..85c2fef 100644 --- a/milena/mln/topo/face.hh +++ b/milena/mln/topo/face.hh @@ -39,13 +39,10 @@ /* FIXME: Suggestions: - - rename `face' as `face_data', and move it into complex.hh or its - own file; - - rename `face_handle' as `face', and move it to its own file; - - rename `any_face_handle' as `any_face', and move it to its own file. + Rename faces_set as n_faces_set. - Anyway, whatever the decision, splitting `face', `face_handle' and - `any_face_handle' seems to be sound. + Split `face', `face_handle' and `any_face_handle' code into several + files. `face_data' is somehow an implementation detail: it should be hidden, either by moving it to mln/topo/complex.cc or into its own @@ -146,7 +143,10 @@ namespace mln | n-Face. | `---------*/ - // \p N-face handle in a complex. + /// \brief \p N-face handle in a complex. + /// + /// Contrary to an mln::topo::face, the dimension of an + /// mln::topo::n_face is fixed. template <unsigned N, unsigned D> struct n_face { @@ -266,30 +266,33 @@ namespace mln /// \} - /*----------------------. - | ``Any-face'' handle. | - `----------------------*/ + /*-------. + | Face. | + `-------*/ - // Face handle in a complex, where the dimension is dynamic. + /// \brief Face handle in a complex; the face dimension is dynamic. + /// + /// Contrary to an mln::topo::n_face, the dimension of an + /// mln::topo::face is not fixed. template <unsigned D> - struct any_face_handle + struct face { // The type of the complex this handle points to. typedef complex<D> complex_type; /// Build a non-initialized face handle. - any_face_handle(); + face(); /// Build a face handle from \a complex and \a face_id. - any_face_handle(complex<D>& complex, unsigned n, unsigned face_id); + face(complex<D>& complex, unsigned n, unsigned face_id); - /// Build a face handle from a face_handle. + /// Build a face handle from an mln::topo::n_face. template <unsigned N> - any_face_handle(const n_face<N, D>& f); + face(const n_face<N, D>& f); /// Copy and assignment. /// \{ - any_face_handle(const any_face_handle<D>& rhs); - any_face_handle<D>& operator=(const any_face_handle<D>& rhs); + face(const face<D>& rhs); + face<D>& operator=(const face<D>& rhs); /// \} /// Is this handle valid? @@ -323,7 +326,7 @@ namespace mln private: /// \brief The complex the face belongs to. /// - /// A const any_face_handle can be used to modify a complex. + /// A const face can be used to modify a complex. mutable complex<D>* cplx_; /// The dimension of the face. // FIXME: Rename as `dim_'? @@ -334,7 +337,7 @@ namespace mln }; - /// Comparison of two instances of mln::topo::any_face_handle. + /// Comparison of two instances of mln::topo::face. /// \{ /// \brief Is \a lhs equal to \a rhs? /// @@ -342,7 +345,7 @@ namespace mln /// mln::topo::complex. template <unsigned D> bool - operator==(const any_face_handle<D>& lhs, const any_face_handle<D>& rhs); + operator==(const face<D>& lhs, const face<D>& rhs); /// \brief Is \a lhs ``less'' than \a rhs? /// @@ -353,7 +356,7 @@ namespace mln /// \pre Arguments \a lhs and \a rhs must have the same dimension. template <unsigned D> bool - operator< (const any_face_handle<D>& lhs, const any_face_handle<D>& rhs); + operator< (const face<D>& lhs, const face<D>& rhs); /// \} @@ -578,7 +581,7 @@ namespace mln template <unsigned D> inline - any_face_handle<D>::any_face_handle() + face<D>::face() : cplx_(0), n_(std::numeric_limits<unsigned>::max()), face_id_(std::numeric_limits<unsigned>::max()) @@ -587,7 +590,7 @@ namespace mln template <unsigned D> inline - any_face_handle<D>::any_face_handle(complex<D>& c, unsigned n, + face<D>::face(complex<D>& c, unsigned n, unsigned face_id) : cplx_(&c), n_(n), face_id_(face_id) { @@ -598,7 +601,7 @@ namespace mln template <unsigned D> template <unsigned N> inline - any_face_handle<D>::any_face_handle(const n_face<N, D>& f) + face<D>::face(const n_face<N, D>& f) : cplx_(&f.cplx()), n_(N), face_id_(f.face_id()) { // Ensure N is compatible with D. @@ -608,15 +611,15 @@ namespace mln template <unsigned D> inline - any_face_handle<D>::any_face_handle(const any_face_handle<D>& rhs) + face<D>::face(const face<D>& rhs) : cplx_(rhs.cplx_), n_(rhs.n_), face_id_(rhs.face_id_) { } template <unsigned D> inline - any_face_handle<D>& - any_face_handle<D>::operator=(const any_face_handle<D>& rhs) + face<D>& + face<D>::operator=(const face<D>& rhs) { if (&rhs != this) { @@ -630,7 +633,7 @@ namespace mln template <unsigned D> inline bool - any_face_handle<D>::is_valid() const + face<D>::is_valid() const { return cplx_ != 0 && n_ <= D && face_id_ < cplx_->nfaces(n_); } @@ -638,7 +641,7 @@ namespace mln template <unsigned D> inline void - any_face_handle<D>::invalidate() + face<D>::invalidate() { set_n(std::numeric_limits<unsigned>::max()); set_face_id(std::numeric_limits<unsigned>::max()); @@ -647,7 +650,7 @@ namespace mln template <unsigned D> inline complex<D>& - any_face_handle<D>::cplx() const + face<D>::cplx() const { mln_precondition(cplx_); return *cplx_; @@ -656,7 +659,7 @@ namespace mln template <unsigned D> inline unsigned - any_face_handle<D>::n() const + face<D>::n() const { return n_; } @@ -664,7 +667,7 @@ namespace mln template <unsigned D> inline unsigned - any_face_handle<D>::face_id() const + face<D>::face_id() const { return face_id_; } @@ -672,7 +675,7 @@ namespace mln template <unsigned D> inline void - any_face_handle<D>::set_cplx(complex<D>& cplx) + face<D>::set_cplx(complex<D>& cplx) { cplx_ = &cplx; } @@ -680,7 +683,7 @@ namespace mln template <unsigned D> inline void - any_face_handle<D>::set_n(unsigned n) + face<D>::set_n(unsigned n) { n_ = n; } @@ -688,7 +691,7 @@ namespace mln template <unsigned D> inline void - any_face_handle<D>::set_face_id(unsigned face_id) + face<D>::set_face_id(unsigned face_id) { face_id_ = face_id; } @@ -697,7 +700,7 @@ namespace mln template <unsigned N> inline face_data<N, D>& - any_face_handle<D>::face_data() const + face<D>::face_data() const { mln_precondition(n_ == N); mln_precondition(is_valid()); @@ -708,7 +711,7 @@ namespace mln template <unsigned D> inline bool - operator==(const any_face_handle<D>& lhs, const any_face_handle<D>& rhs) + operator==(const face<D>& lhs, const face<D>& rhs) { // Ensure LHS and RHS belong to the same complex. mln_precondition(&lhs.face.cplx() == &rhs.face.cplx()); @@ -721,7 +724,7 @@ namespace mln template <unsigned D> inline bool - operator< (const any_face_handle<D>& lhs, const any_face_handle<D>& rhs) + operator< (const face<D>& lhs, const face<D>& rhs) { // Ensure LHS and RHS belong to the same complex. mln_precondition(&lhs.face.cplx() == &rhs.face.cplx()); diff --git a/milena/tests/core/image/complex_image.cc b/milena/tests/core/image/complex_image.cc index b8e4c8a..148041d 100644 --- a/milena/tests/core/image/complex_image.cc +++ b/milena/tests/core/image/complex_image.cc @@ -91,7 +91,7 @@ int main() // A pset. p_complex<D, point2d> pc(c); - topo::any_face_handle<D> af(e0); + topo::face<D> af(e0); // An associated psite. complex_psite<D, point2d> cs(pc, af); diff --git a/milena/tests/topo/complex.cc b/milena/tests/topo/complex.cc index e10721f..ebe734a 100644 --- a/milena/tests/topo/complex.cc +++ b/milena/tests/topo/complex.cc @@ -110,7 +110,7 @@ int main() const topo::face_data<1, D>& face1 = e0.face_data(); // Any-face handle. - topo::any_face_handle<D> af(e0); + topo::face<D> af(e0); // Get the face data from (``dynamic'') face handle AF. const topo::face_data<1, D>& face2 = af.face_data<1>(); @@ -150,7 +150,7 @@ int main() test_faces_iter<2>(c); /* Using complex_faces_{fwd,bkd}_iter_<N, D>, which are proxies to - any_face_handles<N>. */ + faces<N>. */ test_complex_faces_iter<0>(c); test_complex_faces_iter<1>(c); test_complex_faces_iter<2>(c); @@ -278,7 +278,7 @@ int main() faces_fwd_iter_<N, D> Iterators on N-faces, N being faces_fwd_iter_<N, D> static, acting as proxies of - any_face_handle<N, D>'s. + face<D>'s. ----------------------------------------------------------------- */ } -- 1.6.0.1
participants (1)
-
Roland Levillain