
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena Index: ChangeLog from Ugo Jardonnet <ugo.jardonnet@lrde.epita.fr> Upgrade image1d + minor fixes ( _ removing ). * mln/core/dpoints_piter.hh: Remove underscore to site_iterator_base_. * mln/core/image/image1d.hh: Upgrade following image2d. * mln/core/macros.hh: Temporarily uncomment mln_(d)point. * mln/core/w_window.hh: Include dpoints_piter.hh. * mln/core/line_piter.hh: Remove underscore to site_iterator_base_. * mln/core/alias/dpoint1d.hh: Remove underscore to dpoint_. * mln/core/alias/box1d.hh: Remove underscore to box_. * mln/core/alias/point1d.hh: Cosmetic change. alias/box1d.hh | 2 - alias/dpoint1d.hh | 2 - alias/point1d.hh | 2 - dpoints_piter.hh | 4 +- image/image1d.hh | 82 ++++++++++++++++++++++++++++++++---------------------- line_piter.hh | 4 +- macros.hh | 20 ++++++------- w_window.hh | 2 - 8 files changed, 67 insertions(+), 51 deletions(-) Index: mln/core/dpoints_piter.hh --- mln/core/dpoints_piter.hh (revision 2202) +++ mln/core/dpoints_piter.hh (working copy) @@ -48,7 +48,7 @@ * The parameter \c D is the type of delta-points. */ template <typename D> - class dpoints_fwd_piter : public internal::site_iterator_base_< mln_point(D), dpoints_fwd_piter<D> > + class dpoints_fwd_piter : public internal::site_iterator_base< mln_point(D), dpoints_fwd_piter<D> > { public: @@ -106,7 +106,7 @@ * The parameter \c D is the type of delta-points. */ template <typename D> - class dpoints_bkd_piter : public internal::site_iterator_base_< mln_point(D), dpoints_bkd_piter<D> > + class dpoints_bkd_piter : public internal::site_iterator_base< mln_point(D), dpoints_bkd_piter<D> > { public: Index: mln/core/image/image1d.hh --- mln/core/image/image1d.hh (revision 2202) +++ mln/core/image/image1d.hh (working copy) @@ -88,17 +88,25 @@ template <typename T> struct image_< image1d<T> > : default_image_< T, image1d<T> > { + // misc typedef trait::image::category::primary category; - - typedef trait::image::access::random access; - typedef trait::image::space::one_d space; + typedef trait::image::speed::fastest speed; typedef trait::image::size::regular size; - typedef trait::image::support::aligned support; - typedef trait::image::border::stored border; - typedef trait::image::data::raw data; - typedef trait::image::io::read_write io; - typedef trait::image::speed::fastest speed; + // value + typedef trait::image::value_access::direct value_access; + typedef trait::image::value_storage::one_block value_storage; + typedef trait::image::value_browsing::site_wise_only value_browsing; + typedef trait::image::value_io::read_write value_io; + + // site / domain + typedef trait::image::localization::basic_grid localization; + typedef trait::image::dimension::one_d dimension; + + // extended domain + typedef trait::image::ext_domain::extendable ext_domain; + typedef trait::image::ext_value::multiple ext_value; + typedef trait::image::ext_io::read_write ext_io; }; } // end of namespace mln::trait @@ -115,16 +123,10 @@ struct image1d : public internal::image_primary< T, box1d, image1d<T> > { - // Warning: just to make effective types appear in Doxygen: - typedef box1d pset; - typedef point1d psite; - typedef point1d point; - typedef dpoint1d dpoint; - typedef mln_fwd_piter(box1d) fwd_piter; - typedef mln_bkd_piter(box1d) bkd_piter; - typedef line_piter_<point> line_piter; - // End of warning. + typedef internal::image_primary< T, mln::box1d, image1d<T> > super_; + /// Coordinate associated type. + typedef int coord; /// Value associated type. typedef T value; @@ -161,6 +163,9 @@ /// Give the definition domain. const box1d& domain() const; + /// Give the bounding box domain. + const box1d& bbox() const; + /// Give the border thickness. unsigned border() const; @@ -188,6 +193,9 @@ /// Fast Image method + // Give the index of a point. + using super_::index_of_point; + /// Give the offset corresponding to the delta-point \p dp. int offset(const dpoint1d& dp) const; @@ -201,7 +209,6 @@ T* buffer(); - /// Resize image border with new_border. void resize_(unsigned new_border); @@ -351,7 +358,16 @@ image1d<T>::domain() const { mln_precondition(this->has_data()); - return this->data_->b_; + return this->data->b_; + } + + template <typename T> + inline + const box1d& + image1d<T>::bbox() const + { + mln_precondition(this->has_data()); + return this->data->b_; } template <typename T> @@ -360,7 +376,7 @@ image1d<T>::border() const { mln_precondition(this->has_data()); - return this->data_->bdr_; + return this->data->bdr_; } template <typename T> @@ -369,7 +385,7 @@ image1d<T>::ncells() const { mln_precondition(this->has_data()); - return this->data_->vb_.npoints(); + return this->data->vb_.npoints(); } template <typename T> @@ -378,7 +394,7 @@ image1d<T>::has(const point1d& p) const { mln_precondition(this->has_data()); - return this->data_->vb_.has(p); + return this->data->vb_.has(p); } template <typename T> @@ -387,7 +403,7 @@ image1d<T>::operator()(const point1d& p) const { mln_precondition(this->has(p)); - return this->data_->array_[p.ind()]; + return this->data->array_[p.ind()]; } template <typename T> @@ -396,7 +412,7 @@ image1d<T>::operator()(const point1d& p) { mln_precondition(this->has(p)); - return this->data_->array_[p.ind()]; + return this->data->array_[p.ind()]; } template <typename T> @@ -405,7 +421,7 @@ image1d<T>::operator[](unsigned o) const { mln_precondition(o < ncells()); - return *(this->data_->buffer_ + o); + return *(this->data->buffer_ + o); } template <typename T> @@ -414,7 +430,7 @@ image1d<T>::operator[](unsigned o) { mln_precondition(o < ncells()); - return *(this->data_->buffer_ + o); + return *(this->data->buffer_ + o); } template <typename T> @@ -423,7 +439,7 @@ image1d<T>::at(int ind) const { mln_precondition(this->has(make::point1d(ind))); - return this->data_->array_[ind]; + return this->data->array_[ind]; } template <typename T> @@ -432,7 +448,7 @@ image1d<T>::at(int ind) { mln_precondition(this->has(make::point1d(ind))); - return this->data_->array_[ind]; + return this->data->array_[ind]; } template <typename T> @@ -441,7 +457,7 @@ image1d<T>::buffer() const { mln_precondition(this->has_data()); - return this->data_->buffer_; + return this->data->buffer_; } template <typename T> @@ -450,7 +466,7 @@ image1d<T>::buffer() { mln_precondition(this->has_data()); - return this->data_->buffer_; + return this->data->buffer_; } template <typename T> @@ -469,8 +485,8 @@ image1d<T>::point_at_offset(unsigned o) const { mln_precondition(o < ncells()); - point1d p = make::point1d(o + this->data_->vb_.min_ind()); - mln_postcondition(& this->operator()(p) == this->data_->buffer_ + o); + point1d p = make::point1d(o + this->data->vb_.min_ind()); + mln_postcondition(& this->operator()(p) == this->data->buffer_ + o); return p; } @@ -479,7 +495,7 @@ void image1d<T>::resize_(unsigned new_border) { - this->data_->reallocate_(new_border); + this->data->reallocate_(new_border); } # endif // ! MLN_INCLUDE_ONLY Index: mln/core/macros.hh --- mln/core/macros.hh (revision 2202) +++ mln/core/macros.hh (working copy) @@ -104,11 +104,11 @@ # define mln_delta_(T) T::delta /// \} -// /// Shortcuts to access the dpoint type associated to T. -// /// \{ -// # define mln_dpoint(T) typename T::dpoint -// # define mln_dpoint_(T) T::dpoint -// /// \} +/// Shortcuts to access the dpoint type associated to T. +/// \{ +# define mln_dpoint(T) typename T::dpoint +# define mln_dpoint_(T) T::dpoint +/// \} /// Shortcuts to access the dpsite type associated to T. /// \{ @@ -253,11 +253,11 @@ # define mln_psite_(T) T::psite /// \} -// /// Shortcuts to access the point type associated to T. -// /// \{ -// # define mln_point(T) typename T::point -// # define mln_point_(T) T::point -// /// \} +/// Shortcuts to access the point type associated to T. +/// \{ +# define mln_point(T) typename T::point +# define mln_point_(T) T::point +/// \} // q Index: mln/core/w_window.hh --- mln/core/w_window.hh (revision 2202) +++ mln/core/w_window.hh (working copy) @@ -37,7 +37,7 @@ # include <mln/core/window.hh> # include <mln/core/concept/weighted_window.hh> - +# include <mln/core/dpoints_piter.hh> namespace mln { Index: mln/core/line_piter.hh --- mln/core/line_piter.hh (revision 2202) +++ mln/core/line_piter.hh (working copy) @@ -47,10 +47,10 @@ */ template <typename P> class line_piter_ : - public internal::site_iterator_base_< P, line_piter_<P> > + public internal::site_iterator_base< P, line_piter_<P> > { typedef line_piter_<P> self_; - typedef internal::site_iterator_base_< P, self_ > super_; + typedef internal::site_iterator_base< P, self_ > super_; public: // Make definitions from super class available. Index: mln/core/alias/dpoint1d.hh --- mln/core/alias/dpoint1d.hh (revision 2202) +++ mln/core/alias/dpoint1d.hh (working copy) @@ -44,7 +44,7 @@ /*! \brief Type alias for a delta-point defined on the 1D square * grid with integer coordinates. */ - typedef dpoint_<mln::grid::tick, int> dpoint1d; + typedef dpoint<mln::grid::tick, int> dpoint1d; } // end of namespace mln Index: mln/core/alias/box1d.hh --- mln/core/alias/box1d.hh (revision 2202) +++ mln/core/alias/box1d.hh (working copy) @@ -46,7 +46,7 @@ * * \see mln::win::rectangle1d. */ - typedef box_<point1d> box1d; + typedef box<point1d> box1d; } // end of namespace mln Index: mln/core/alias/point1d.hh --- mln/core/alias/point1d.hh (revision 2202) +++ mln/core/alias/point1d.hh (working copy) @@ -43,7 +43,7 @@ /*! \brief Type alias for a point defined on the 1D square grid with * integer coordinates. */ - typedef point<mln::grid::tick, def::coord> point1d; + typedef point<grid::tick, def::coord> point1d; } // end of namespace mln