
Index: ChangeLog from Damien Thivolle <damien@lrde.epita.fr> * oln/makefile.src: Add new files to distribution and remove old one. * oln/core/macros.hh: Add oln_iter_type macro. * oln/core/abstract/piter.hh: Fix compilation errors. * oln/core/2d/image2d.hh: Fix incorrect file inclusion. * oln/core/2d/fwd_piter2d.hh: Fix compilation errors. core/2d/fwd_piter2d.hh | 25 ++++++++++++++----------- core/2d/image2d.hh | 3 ++- core/abstract/piter.hh | 24 +++++++++++++++++------- core/macros.hh | 2 ++ makefile.src | 11 ++--------- 5 files changed, 37 insertions(+), 28 deletions(-) Index: oln/makefile.src --- oln/makefile.src (revision 19) +++ oln/makefile.src (working copy) @@ -4,19 +4,13 @@ ## OLN_DEP = \ - basics.hh \ - basics1d.hh \ - basics2d.hh \ - basics3d.hh \ - config/pconf.hh \ - config/system.hh \ core/1d/array1d.hh \ core/1d/image1d.hh \ core/1d/point1d.hh \ core/1d/size1d.hh \ core/2d/array2d.hh \ core/2d/image2d.hh \ - core/2d/iter2d.hh \ + core/2d/fwd_piter2d.hh \ core/2d/point2d.hh \ core/2d/size2d.hh \ core/3d/array3d.hh \ @@ -26,11 +20,10 @@ core/abstract/data_storage.hh \ core/abstract/image.hh \ core/abstract/image_constness.hh \ - core/abstract/image_dimension.hh \ core/abstract/image_with_data.hh \ core/abstract/images.hh \ core/abstract/internal/image_impl.hh \ - core/abstract/iter.hh \ + core/abstract/piter.hh \ core/abstract/point.hh \ core/abstract/size.hh \ core/cats.hh \ Index: oln/core/macros.hh --- oln/core/macros.hh (revision 19) +++ oln/core/macros.hh (working copy) @@ -30,6 +30,8 @@ # define oln_point_type(T) typename oln::props<oln_category_type(T),T>::point_type # define oln_value_type(T) typename oln::props<oln_category_type(T),T>::value_type +# define oln_iter_type(T) typename oln::props<oln_category_type(T),T>::iter_type + # define oln_value_storage_type(T) typename oln::props<oln_category_type(T),T>::value_storage_type # define oln_value_container_type(T) typename oln::props<oln_category_type(T),T>::value_container_type Index: oln/core/abstract/piter.hh --- oln/core/abstract/piter.hh (revision 19) +++ oln/core/abstract/piter.hh (working copy) @@ -8,11 +8,22 @@ # include <oln/core/abstract/point.hh> # include <oln/core/cats.hh> # include <oln/core/props.hh> +# include <oln/core/macros.hh> namespace oln { + namespace abstract { + template <typename E> struct piter; + + } + + + template <typename E> + struct category_type<abstract::piter<E> > { typedef cat::piter ret; }; + + template <> struct default_props < cat::piter > { @@ -24,9 +35,12 @@ namespace abstract { template <typename E> - struct piter : public mlc::any__best_memory<E> + struct piter : public mlc::any__best_speed<E> { - + typedef piter<E> self_type; + typedef oln_point_type(E) point_type; + typedef oln_size_type(E) size_type; + void start() { this->exact().impl_start(); @@ -34,7 +48,7 @@ void next() { - precondition(this->is_ok()); + precondition(this->is_ok()); this->exact().impl_next(); } @@ -57,10 +71,6 @@ protected: - typedef piter<E> self_type; - typedef oln_point_type(self_type) point_type; - typedef oln_size_type(self_type) size_type; - piter(const size_type& s) : s_(s), p_() Index: oln/core/2d/image2d.hh --- oln/core/2d/image2d.hh (revision 19) +++ oln/core/2d/image2d.hh (working copy) @@ -5,6 +5,7 @@ # include <oln/core/abstract/image_with_data.hh> # include <oln/core/2d/array2d.hh> +# include <oln/core/2d/fwd_piter2d.hh> /*! \namespace oln ** \brief oln namespace. @@ -16,7 +17,7 @@ template <typename T> class image2d; // category decl - template <typename T> + template <typename T> struct category_type< image2d<T> > { typedef cat::image ret; }; Index: oln/core/2d/fwd_piter2d.hh --- oln/core/2d/fwd_piter2d.hh (revision 19) +++ oln/core/2d/fwd_piter2d.hh (working copy) @@ -1,9 +1,9 @@ -#ifndef PROTO_OLN_CORE_2D_FWD_ITER2D_HH -# define PROTO_OLN_CORE_2D_FWD_ITER2D_HH +#ifndef PROTO_OLN_CORE_2D_FWD_PITER2D_HH +# define PROTO_OLN_CORE_2D_FWD_PITER2D_HH # include <mlc/contract.hh> -# include <oln/core/abstract/iter.hh> +# include <oln/core/abstract/piter.hh> # include <oln/core/2d/point2d.hh> # include <oln/core/2d/size2d.hh> # include <oln/core/props.hh> @@ -11,25 +11,28 @@ namespace oln { - struct fwd_iter2d; + struct fwd_piter2d; + template <> struct category_type<fwd_piter2d> { typedef cat::piter ret; }; + template <> - struct props < cat::piter, fwd_iter2d > + struct props < cat::piter, fwd_piter2d > : public default_props<cat::piter> { typedef point2d point_type; typedef size2d size_type; }; - struct fwd_iter2d : public abstract::piter<fwd_iter2d> + struct fwd_piter2d : public abstract::piter< fwd_piter2d > { - typedef abstract::iter<fwd_iter2d> super_type; + typedef abstract::piter<fwd_piter2d> super_type; - friend class abstract::iter<fwd_iter2d>; + friend class abstract::piter<fwd_piter2d>; - fwd_iter2d(const size2d& size) : + fwd_piter2d(const size2d& size) : super_type(size) { + this->exact_ptr = this; } void impl_start() @@ -43,7 +46,7 @@ return this->p_.row() < this->s_.nrows(); } - void impl_next() const + void impl_next() { ++this->p_.col(); if (this->p_.col() != this->s_.ncols()) @@ -62,4 +65,4 @@ } -#endif // ndef PROTO_OLN_CORE_2D_FWD_ITER2D_HH +#endif // ndef PROTO_OLN_CORE_2D_FWD_PITER2D_HH