2136: Simplify the wrappings of mln::neighb2d and mln::window2d.

https://svn.lrde.epita.fr/svn/oln/trunk/swilena Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr> Simplify the wrappings of mln::neighb2d and mln::window2d. * neighb2d.i, window2d.i: Wrap the classes directly, instead of using simplified, inlined declarations. * box2d.i: Aesthetic changes. box2d.i | 12 +++----- neighb2d.i | 91 +++++++------------------------------------------------------ window2d.i | 77 +++++++-------------------------------------------- 3 files changed, 27 insertions(+), 153 deletions(-) Index: window2d.i --- window2d.i (revision 2135) +++ window2d.i (working copy) @@ -37,75 +37,20 @@ #include "mln/core/window2d.hh" %} -// FIXME: Move mln::window to its own file. +%include "mln/core/macros.hh" %include "mln/core/concept/window.hh" - -// FIXME: Wrap mln::window by hand, for Milena macros disturb swig. -// Annotate the original source code instead? -namespace mln -{ - template <typename D> - class window : public Window< window<D> >, - public internal::dpoints_base_<D, window<D> > - { - typedef internal::dpoints_base_<D, window<D> > super_; - public: - - /*! \brief Point_Iterator type to browse the points of a generic window - * w.r.t. the ordering of delta-points. - */ - typedef dpoints_fwd_piter<D> fwd_qiter; - - /*! \brief Point_Iterator type to browse the points of a generic window - * w.r.t. the reverse ordering of delta-points. - */ - typedef dpoints_bkd_piter<D> bkd_qiter; - - - /*! \brief Constructor without argument. - * - * The constructed window is empty. - */ - window(); - - - /*! \brief Test if the window is symmetric. - */ - bool is_symmetric() const; - - /// Insert a delta-point \p dp. - window<D>& insert(const D& dp); - -// FIXME: Swig tries to wrap everything by default; prevent it from wrapping -// invalid methods (1D and 3D ctors for a point2d). - /// \{ Insertion of a delta-point with different numbers of - /// arguments (coordinates) w.r.t. the dimension. -// window<D>& insert(const mln_coord(D)& dind); // For 1D. - -// FIXME: The macro mln_coord disturbs swig. -// window<D>& insert(const mln_coord(D)& drow, -// const mln_coord(D)& dcol); // For 2D. - window<D>& insert(const typename D::coord& drow, - const typename D::coord& dcol); // For 2D. - -// window<D>& insert(const mln_coord(D)& dsli, -// const mln_coord(D)& drow, -// const mln_coord(D)& dcol); // For 3D. -// /// \} - - /// Apply a central symmetry to the target window. - window<D>& sym(); - - protected: - -// FIXME: The macro used here disturbs swig. -// box_<mln_point(D)> b_; - box_<typename D::point> b_; - }; - -} // end of namespace mln +%include "mln/core/window.hh" %include "mln/core/window2d.hh" +// Swig tries to wrap everything by default; prevent it from wrapping +// invalid methods (1D and 3D insertions for a window2d). +%ignore mln::window< mln::dpoint_<mln::grid::square, int > >:: +insert(const typename mln::dpoint_<mln::grid::square, int>::coord&); +%ignore mln::window< mln::dpoint_<mln::grid::square, int > >:: +insert(const typename mln::dpoint_<mln::grid::square, int>::coord&, + const typename mln::dpoint_<mln::grid::square, int>::coord&, + const typename mln::dpoint_<mln::grid::square, int>::coord&); + %template(window2d) mln::window< mln::dpoint_<mln::grid::square, int > >; Index: box2d.i --- box2d.i (revision 2135) +++ box2d.i (working copy) @@ -45,13 +45,11 @@ // invalid methods (1D and 3D ctors for a box2d). /* FIXME: Can't we simplify these directives, i.e. use `point2d' and `int' directly? */ -%ignore mln::box_< mln::point_<mln::grid::square, int> >::box_( - typename mln::point_<mln::grid::square, int>::coord -); -%ignore mln::box_< mln::point_<mln::grid::square, int> >::box_( +%ignore mln::box_< mln::point_<mln::grid::square, int> >:: +box_(typename mln::point_<mln::grid::square, int>::coord); +%ignore mln::box_< mln::point_<mln::grid::square, int> >:: +box_(typename mln::point_<mln::grid::square, int>::coord, typename mln::point_<mln::grid::square, int>::coord, - typename mln::point_<mln::grid::square, int>::coord, - typename mln::point_<mln::grid::square, int>::coord -); + typename mln::point_<mln::grid::square, int>::coord); %template(box2d) mln::box_< mln::point_<mln::grid::square, int> >; Index: neighb2d.i --- neighb2d.i (revision 2135) +++ neighb2d.i (working copy) @@ -37,89 +37,20 @@ #include "mln/core/neighb2d.hh" %} -// FIXME: Move mln::neighb_ to its own file. +%include "mln/core/macros.hh" %include "mln/core/concept/neighborhood.hh" - -// FIXME: Wrap mln::neighb by hand, for Milena macros disturb swig. -// Annotate the original source code instead? -namespace mln -{ - - // fwd decls - template <typename D> class dpoints_fwd_piter; - template <typename D> class dpoints_bkd_piter; - - - /*! \brief Generic neighborhood class. - * - * This neighborhood of window is just like a set of delta-points. - * The parameter is \c D, type of delta-point. - */ - template <typename D> - struct neighb_ : public Neighborhood< neighb_<D> >, - public internal::dpoints_base_<D, neighb_<D> > - { - /// Dpoint associated type. - typedef D dpoint; - -// FIXME: The macro mln_point disturbs swig. -// /// Point associated type. -// typedef mln_point(D) point; - typedef typename D::point point; - - /*! \brief Point_Iterator type to browse the points of a generic - * neighborhood w.r.t. the ordering of delta-points. - */ - typedef dpoints_fwd_piter<D> fwd_niter; - - /*! \brief Point_Iterator type to browse the points of a generic - * neighborhood w.r.t. the reverse ordering of delta-points. - */ - typedef dpoints_bkd_piter<D> bkd_niter; - - /*! \brief Same as fwd_niter. - */ - typedef fwd_niter niter; - - /*! \brief Constructor without argument. - * - * The constructed neighborhood is empty. You have to use insert() - * to proceed to the neighborhood definition. - */ - neighb_(); - - /*! \brief Insert a delta-point \p dp in the neighborhood - * definition. - * - * \param[in] dp The delta-point to insert. - * - * This method also insert the symmetrical delta-point, - \p dp, - * in the neighborhood definition; thus the client has not to - * ensure the symmetry property; that is automatic. - */ - neighb_<D>& insert(const D& dp); - -// FIXME: Swig tries to wrap everything by default; prevent it from wrapping -// invalid methods (1D and 3D ctors for a point2d). - /// \{ Insertion of a delta-point with different numbers of - /// arguments (coordinates) w.r.t. the dimension. -// neighb_<D>& insert(const mln_coord(D)& dind); // For 1D. - -// FIXME: The macro mln_coord disturbs swig. -// neighb_<D>& insert(const mln_coord(D)& drow, -// const mln_coord(D)& dcol); // For 2D. - neighb_<D>& insert(const typename D::coord& drow, - const typename D::coord& dcol); // For 2D. - -// neighb_<D>& insert(const mln_coord(D)& dsli, -// const mln_coord(D)& drow, -// const mln_coord(D)& dcol); // For 3D. - /// \} - }; - -} // end of namespace mln +%include "mln/core/neighb.hh" %include "mln/core/neighb2d.hh" +// Swig tries to wrap everything by default; prevent it from wrapping +// invalid methods (1D and 3D insertions for a neighb2d). +%ignore mln::neighb_< mln::dpoint_<mln::grid::square, int > >:: +insert(const typename mln::dpoint_<mln::grid::square, int>::coord&); +%ignore mln::neighb_< mln::dpoint_<mln::grid::square, int > >:: +insert(const typename mln::dpoint_<mln::grid::square, int>::coord&, + const typename mln::dpoint_<mln::grid::square, int>::coord&, + const typename mln::dpoint_<mln::grid::square, int>::coord&); + %template(neighb2d) mln::neighb_< mln::dpoint_<mln::grid::square, int > >;
participants (1)
-
Roland Levillain