Index: ChangeLog from Damien Thivolle damien@lrde.epita.fr
* ChangeLog: Previous changes not commited due to a vcs error. * oln/fancy/print.hh: Previous changes not commited due to a vcs error. * oln/fancy/iota.hh: Previous changes not commited due to a vcs error. * oln/makefile.src: Notify new files. * oln/core/props.hh: Sanity fixes. * oln/core/macros.hh: Likewise. * oln/core/abstract/piter.hh: Likewise. * oln/core/abstract/point.hh: Likewise. * oln/core/abstract/size.hh: Likewise. * oln/core/abstract/morpher.hh: New. abstract::morpher implementation. * oln/core/abstract/dpoint.hh: Sanity fixes. * oln/core/1d/dpoint1d.hh: Likewise. * oln/core/1d/fwd_piter1d.hh: Likewise. * oln/core/1d/point1d.hh: Likewise. * oln/core/2d/dpoint2d.hh: Likewise. * oln/core/2d/image2d.hh: Likewise. * oln/core/2d/point2d.hh: Likewise. * oln/core/3d/point3d.hh: Likewise. * oln/core/id_morpher.hh: New. Identity morpher implementation. * oln/core/cats.hh: Sanity fixes.
ChangeLog | 14 ++++++++ oln/core/1d/dpoint1d.hh | 21 +++++++++--- oln/core/1d/fwd_piter1d.hh | 6 +-- oln/core/1d/point1d.hh | 4 +- oln/core/2d/dpoint2d.hh | 21 +++++++++--- oln/core/2d/image2d.hh | 16 +++++---- oln/core/2d/point2d.hh | 3 + oln/core/3d/point3d.hh | 13 +++++++ oln/core/abstract/dpoint.hh | 6 +-- oln/core/abstract/morpher.hh | 71 +++++++++++++++++++++++++++++++++++++++++++ oln/core/abstract/piter.hh | 6 +-- oln/core/abstract/point.hh | 8 ++-- oln/core/abstract/size.hh | 6 +-- oln/core/cats.hh | 6 +-- oln/core/id_morpher.hh | 67 ++++++++++++++++++++++++++++++++++++++++ oln/core/macros.hh | 1 oln/core/props.hh | 6 +-- oln/fancy/iota.hh | 1 oln/fancy/print.hh | 43 ++++++++++++++------------ oln/makefile.src | 14 +++++++- 20 files changed, 268 insertions(+), 65 deletions(-)
Index: ChangeLog --- ChangeLog (revision 35) +++ ChangeLog (working copy) @@ -1,3 +1,17 @@ +2005-02-18 Damien Thivolle damien@lrde.epita.fr + + * oln/fancy/print.hh: Sanity fixes. + * oln/fancy/iota.hh: Likewise. + * oln/makefile.src: Likewise. + * oln/core/macros.hh: Likewise. + * oln/core/abstract/image_with_data.hh: Likewise. + * oln/core/1d/dpoint1d.hh: Likewise. + * oln/core/1d/point1d.hh: Likewise. + * oln/core/2d/dpoint2d.hh: Likewise. + * oln/core/2d/image2d.hh: Likewise. + * oln/core/2d/point2d.hh: Likewise. + * oln/core/3d/point3d.hh: Likewise. + 2005-02-08 Thierry GERAUD theo@tegucigalpa.lrde.epita.fr
* oln/core/value_box.hh (value_box): Set cpy ctors public. Index: oln/fancy/print.hh --- oln/fancy/print.hh (revision 35) +++ oln/fancy/print.hh (working copy) @@ -36,6 +36,9 @@ # include <ntg/real/int_u8.hh> // FIXME: no coupling like that!
# include <oln/core/abstract/image_dimension.hh> +# include <oln/core/1d/point1d.hh> +# include <oln/core/2d/point2d.hh> +# include <oln/core/coord.hh>
namespace oln {
@@ -106,8 +109,8 @@ ostr << internal::pp<oln_value_type(E)>(input[point1d(index)]) << ' '; } ostr << std::endl; - } - + } + template <typename E> void print(const abstract::image2d<E>& input, std::ostream& ostr) { @@ -120,24 +123,26 @@ } }
- template <typename E> - void print(const abstract::image3d<E>& input, std::ostream& ostr) - { - // FIXME: lacks cleaning - for (coord_t slice = 0; slice < input.size().nslices(); ++slice) - { - for (coord_t row = 0; row < input.size().nrows(); ++row) - { - for (coord_t col = 0; col < input.size().ncols(); ++col) - ostr << internal::pp<oln_value_type(E)>(input[point3d(slice,row,col)]) - << ' '; - ostr << ", "; - } - ostr << std::endl; - } - } - + // FIXME: remove comments when dpoint3d are available.
+// template <typename E> +// void print(const abstract::image3d<E>& input, std::ostream& ostr) +// { +// // FIXME: lacks cleaning +// for (coord_t slice = 0; slice < input.size().nslices(); ++slice) +// { +// for (coord_t row = 0; row < input.size().nrows(); ++row) +// { +// for (coord_t col = 0; col < input.size().ncols(); ++col) +// ostr << internal::pp<oln_value_type(E)>(input[point3d(slice,row,col)]) +// << ' '; +// ostr << ", "; +// } +// ostr << std::endl; +// } +// } + + } // end of namespace impl
Index: oln/fancy/iota.hh --- oln/fancy/iota.hh (revision 35) +++ oln/fancy/iota.hh (working copy) @@ -30,6 +30,7 @@
# include <oln/core/macros.hh> # include <oln/core/abstract/image.hh> +# include <oln/core/abstract/piter.hh>
namespace oln {
Index: oln/makefile.src --- oln/makefile.src (revision 35) +++ oln/makefile.src (working copy) @@ -4,6 +4,12 @@ ##
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 \ @@ -23,12 +29,18 @@ core/abstract/image_with_data.hh \ core/abstract/images.hh \ core/abstract/internal/image_impl.hh \ + core/abstract/morpher.hh \ core/abstract/piter.hh \ core/abstract/point.hh \ core/abstract/size.hh \ core/cats.hh \ core/coord.hh \ core/macros.hh \ + core/id_morpher.hh \ core/props.hh \ core/tags.hh \ - core/value_box.hh + core/value_box.hh \ + fancy/iota.hh \ + fancy/print.hh + + Index: oln/core/props.hh --- oln/core/props.hh (revision 35) +++ oln/core/props.hh (working copy) @@ -25,8 +25,8 @@ // reasons why the executable file might be covered by the GNU General // Public License.
-#ifndef PROTO_OLN_CORE_PROPS_HH -# define PROTO_OLN_CORE_PROPS_HH +#ifndef OLENA_CORE_PROPS_HH +# define OLENA_CORE_PROPS_HH
# include <mlc/types.hh>
@@ -74,4 +74,4 @@ } // end of namespace oln
-#endif // ndef PROTO_OLN_CORE_PROPS_HH +#endif // ! OLENA_CORE_PROPS_HH Index: oln/core/macros.hh --- oln/core/macros.hh (revision 35) +++ oln/core/macros.hh (working copy) @@ -57,7 +57,6 @@ # define oln_point_type(T) typename oln::props<oln_category_type(T),T>::point_type # define oln_dpoint_type(T) typename oln::props<oln_category_type(T),T>::dpoint_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 Index: oln/core/abstract/piter.hh --- oln/core/abstract/piter.hh (revision 35) +++ oln/core/abstract/piter.hh (working copy) @@ -25,8 +25,8 @@ // reasons why the executable file might be covered by the GNU General // Public License.
-#ifndef PROTO_OLN_CORE_ABSTRACT_PITER_HH -# define PROTO_OLN_CORE_ABSTRACT_PITER_HH +#ifndef OLENA_CORE_ABSTRACT_PITER_HH +# define OLENA_CORE_ABSTRACT_PITER_HH
# include <mlc/any.hh> # include <mlc/types.hh> @@ -116,4 +116,4 @@ }
-#endif // ndef PROTO_OLN_CORE_ABSTRACT_PITER_HH +#endif // ! OLENA_CORE_ABSTRACT_PITER_HH Index: oln/core/abstract/point.hh --- oln/core/abstract/point.hh (revision 35) +++ oln/core/abstract/point.hh (working copy) @@ -25,8 +25,8 @@ // reasons why the executable file might be covered by the GNU General // Public License.
-#ifndef PROTO_OLN_CORE_ABSTRACT_POINT_HH -# define PROTO_OLN_CORE_ABSTRACT_POINT_HH +#ifndef OLENA_CORE_ABSTRACT_POINT_HH +# define OLENA_CORE_ABSTRACT_POINT_HH
# include <mlc/any.hh>
@@ -57,8 +57,8 @@ { typedef mlc::undefined_type dpoint_type; }; -
+ /*! \namespace oln::abstract ** \brief oln::abstract namespace. */ @@ -119,4 +119,4 @@
-#endif // ! PROTO_OLN_CORE_ABSTRACT_POINT_HH +#endif // ! OLENA_CORE_ABSTRACT_POINT_HH Index: oln/core/abstract/size.hh --- oln/core/abstract/size.hh (revision 35) +++ oln/core/abstract/size.hh (working copy) @@ -25,8 +25,8 @@ // reasons why the executable file might be covered by the GNU General // Public License.
-#ifndef PROTO_OLN_CORE_ABSTRACT_SIZE_HH -# define PROTO_OLN_CORE_ABSTRACT_SIZE_HH +#ifndef OLENA_CORE_ABSTRACT_SIZE_HH +# define OLENA_CORE_ABSTRACT_SIZE_HH
# include <mlc/any.hh>
@@ -64,4 +64,4 @@ } // end of namespace oln
-#endif // ndef PROTO_OLN_CORE_ABSTRACT_SIZE_HH +#endif // ! OLENA_CORE_ABSTRACT_SIZE_HH Index: oln/core/abstract/morpher.hh --- oln/core/abstract/morpher.hh (revision 0) +++ oln/core/abstract/morpher.hh (revision 0) @@ -0,0 +1,71 @@ +// Copyright (C) 2005 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLENA_CORE_ABSTRACT_MORPHER_HH +# define OLENA_CORE_ABSTRACT_MORPHER_HH + +# include <mlc/box.hh> + +# include <oln/core/tags.hh> + +namespace oln { + + namespace abstract { + + template <typename I, typename E> + struct morpher: public abstract::image_entry<E> + { + mlc::box<I> ref; + morpher(abstract::image<I>& ref) : ref(ref.exact()) {} + morpher(const morpher& rhs) : ref(rhs.ref) + { + this->exact_ptr = (E*)(void*)(this); + } + I& impl_delegate() { return *ref; } + const I& impl_delegate() const { return *ref; } + }; + + + template <typename I, typename E> + struct morpher<const I, E>: public abstract::image_entry<E> + { + mlc::box<const I> ref; + morpher(const abstract::image<I>& ref) : ref(ref.exact()) {} + morpher(const morpher& rhs) : ref(rhs.ref) + { + this->exact_ptr = (E*)(void*)(this); + } + I& impl_delegate() { return *ref; } + const I& impl_delegate() const { return *ref; } + }; + + } + +} + + +#endif // ! OLENA_CORE_ABSTRACT_MORPHER_HH Index: oln/core/abstract/dpoint.hh --- oln/core/abstract/dpoint.hh (revision 35) +++ oln/core/abstract/dpoint.hh (working copy) @@ -25,8 +25,8 @@ // reasons why the executable file might be covered by the GNU General // Public License.
-#ifndef PROTO_OLN_CORE_ABSTRACT_DPOINT_HH -# define PROTO_OLN_CORE_ABSTRACT_DPOINT_HH +#ifndef OLENA_CORE_ABSTRACT_DPOINT_HH +# define OLENA_CORE_ABSTRACT_DPOINT_HH
# include <mlc/any.hh>
@@ -76,4 +76,4 @@
-#endif // ! PROTO_OLN_CORE_ABSTRACT_DPOINT_HH +#endif // ! OLENA_CORE_ABSTRACT_DPOINT_HH Index: oln/core/1d/dpoint1d.hh --- oln/core/1d/dpoint1d.hh (revision 35) +++ oln/core/1d/dpoint1d.hh (working copy) @@ -31,7 +31,6 @@ # include <ostream>
# include <oln/core/coord.hh> -# include <oln/core/1d/point1d.hh>
// FIXME: there's an assumption here: we do not need inheritance for // dpoints. so abstract::dpoint does not exist... @@ -43,6 +42,8 @@
namespace oln {
+ struct point1d; + struct dpoint1d { dpoint1d() @@ -83,11 +84,7 @@ return tmp; }
- const point1d operator+(const point1d& rhs) const - { - point1d tmp(this->index() + rhs.index()); - return tmp; - } + const point1d operator+(const point1d& rhs) const;
const dpoint1d operator-() const { @@ -110,5 +107,17 @@ return ostr << '(' << dp.index() << ')'; }
+# include <oln/core/1d/point1d.hh>
+namespace oln { + + const point1d dpoint1d::operator+(const point1d& rhs) const + { + point1d tmp(this->index() + rhs.index()); + return tmp; + } + +} + + #endif // ! OLENA_CORE_1D_DPOINT1D_HH Index: oln/core/1d/fwd_piter1d.hh --- oln/core/1d/fwd_piter1d.hh (revision 35) +++ oln/core/1d/fwd_piter1d.hh (working copy) @@ -25,8 +25,8 @@ // reasons why the executable file might be covered by the GNU General // Public License.
-#ifndef PROTO_OLN_CORE_1D_FWD_PITER1D_HH -# define PROTO_OLN_CORE_1D_FWD_PITER1D_HH +#ifndef OLENA_CORE_1D_FWD_PITER1D_HH +# define OLENA_CORE_1D_FWD_PITER1D_HH
# include <mlc/contract.hh>
@@ -98,4 +98,4 @@ }
-#endif // ndef PROTO_OLN_CORE_1D_FWD_PITER1D_HH +#endif // ! OLENA_CORE_1D_FWD_PITER1D_HH Index: oln/core/1d/point1d.hh --- oln/core/1d/point1d.hh (revision 35) +++ oln/core/1d/point1d.hh (working copy) @@ -48,7 +48,7 @@ struct category_type< point1d > { typedef cat::point ret; };
template <> - struct props < cat::point, point1d > + struct props < cat::point, point1d > : default_props< cat::point > { typedef dpoint1d dpoint_type; }; @@ -95,7 +95,7 @@ }
protected: - + coord_t index_; };
Index: oln/core/2d/dpoint2d.hh --- oln/core/2d/dpoint2d.hh (revision 35) +++ oln/core/2d/dpoint2d.hh (working copy) @@ -31,7 +31,6 @@ # include <iostream>
# include <oln/core/coord.hh> -# include <oln/core/2d/point2d.hh>
// FIXME: there's an assumption here: we do not need inheritance for // dpoints. so abstract::dpoint does not exist... @@ -40,6 +39,8 @@
namespace oln {
+ struct point2d; + struct dpoint2d { dpoint2d() @@ -83,11 +84,7 @@ return tmp; }
- const point2d operator+(const point2d& rhs) const - { - point2d tmp(this->row() + rhs.row(), this->col() + rhs.col()); - return tmp; - } + const point2d operator+(const point2d& rhs) const;
const dpoint2d operator-() const { @@ -113,5 +110,17 @@ return ostr << '(' << dp.row() << ',' << dp.col() << ')'; }
+# include <oln/core/2d/point2d.hh>
+namespace oln { + + const point2d dpoint2d::operator+(const point2d& rhs) const + { + point2d tmp(this->row() + rhs.row(), this->col() + rhs.col()); + return tmp; + } + +} + + #endif // ! OLENA_CORE_2D_DPOINT2D_HH Index: oln/core/2d/image2d.hh --- oln/core/2d/image2d.hh (revision 35) +++ oln/core/2d/image2d.hh (working copy) @@ -33,6 +33,7 @@ # include <oln/core/abstract/image_with_data.hh> # include <oln/core/2d/array2d.hh> # include <oln/core/2d/fwd_piter2d.hh> +# include <oln/io/read_image.hh>
/*! \namespace oln ** \brief oln namespace. @@ -125,13 +126,14 @@ this->exact_ptr = this; }
-// image2d& operator=(image2d& rhs) -// { -// if (&rhs == this) -// return *this; -// super_type::operator=(rhs); -// return *this; -// }; + image2d& operator=(image2d& rhs) + { + if (&rhs == this) + return *this; + std::cout << "shallow copy" << std::endl; + super_type::operator=(rhs); + return *this; + };
// template <typename I> // image2d& operator=(const I& rhs) Index: oln/core/2d/point2d.hh --- oln/core/2d/point2d.hh (revision 35) +++ oln/core/2d/point2d.hh (working copy) @@ -35,6 +35,7 @@ # include <oln/core/cats.hh> # include <oln/core/props.hh>
+ // FIXME: doc!
namespace oln { @@ -46,7 +47,7 @@ struct category_type< point2d > { typedef cat::point ret; };
template <> - struct props < cat::point, point2d > + struct props < cat::point, point2d > : default_props< cat::point > { typedef dpoint2d dpoint_type; }; Index: oln/core/3d/point3d.hh --- oln/core/3d/point3d.hh (revision 35) +++ oln/core/3d/point3d.hh (working copy) @@ -35,6 +35,19 @@
namespace oln {
+ struct dpoint3d; // FIXME: not implemented!! + struct point3d; + + template <> + struct category_type< point3d > { typedef cat::point ret; }; + + template <> + struct props < cat::point, point3d > : default_props< cat::point > + { + typedef dpoint3d dpoint_type; + }; + + struct point3d : public abstract::point< point3d > { point3d() : Index: oln/core/id_morpher.hh --- oln/core/id_morpher.hh (revision 0) +++ oln/core/id_morpher.hh (revision 0) @@ -0,0 +1,67 @@ +// Copyright (C) 2005 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLENA_CORE_ID_MORPHER_HH +# define OLENA_CORE_ID_MORPHER_HH + +# include <oln/core/abstract/morpher.hh> +# include <oln/core/cats.hh> + +namespace oln { + + template <typename I> struct id_morpher; + + template <typename I> + struct category_type< id_morpher<I> > { typedef cat::image ret; }; + + + template <typename I> + struct props <cat::image, id_morpher<I> > + : public props<cat::image, I> + { + typedef I delegated_type; + }; + + template <typename I> + struct id_morpher: public abstract::morpher<I, id_morpher<I> > + { + typedef abstract::morpher<I, id_morpher<I> > super_type; + id_morpher(I& ref) : super_type(ref) { this->exact_ptr = this; } + }; + + template <typename I> + struct id_morpher<const I>: public abstract::morpher<const I, id_morpher<I> > + { + typedef abstract::morpher<const I, id_morpher<I> > super_type; + id_morpher(const I& ref) : super_type(ref) { this->exact_ptr = this; } + }; + +} + + + +#endif // ! OLENA_CORE_ID_MORPHER_HH Index: oln/core/cats.hh --- oln/core/cats.hh (revision 35) +++ oln/core/cats.hh (working copy) @@ -25,8 +25,8 @@ // reasons why the executable file might be covered by the GNU General // Public License.
-#ifndef PROTO_OLN_CORE_CATS_HH -# define PROTO_OLN_CORE_CATS_HH +#ifndef OLENA_CORE_CATS_HH +# define OLENA_CORE_CATS_HH
# include <mlc/types.hh>
@@ -76,4 +76,4 @@
-#endif // ! PROTO_OLN_CORE_CATS_HH +#endif // ! OLENA_CORE_CATS_HH