Index: ChangeLog
from Damien Thivolle <damien(a)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.
core/1d/dpoint1d.hh | 21 +++++++++++++++------
core/1d/point1d.hh | 4 ++--
core/2d/dpoint2d.hh | 21 +++++++++++++++------
core/2d/image2d.hh | 16 +++++++++-------
core/2d/point2d.hh | 3 ++-
core/3d/point3d.hh | 13 +++++++++++++
core/macros.hh | 1 -
fancy/iota.hh | 1 +
fancy/print.hh | 43 ++++++++++++++++++++++++-------------------
makefile.src | 12 +++++++++++-
10 files changed, 92 insertions(+), 43 deletions(-)
Index: oln/fancy/print.hh
--- oln/fancy/print.hh (revision 34)
+++ 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 34)
+++ 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 34)
+++ 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 \
@@ -31,4 +37,8 @@
core/macros.hh \
core/props.hh \
core/tags.hh \
- core/value_box.hh
+ core/value_box.hh \
+ fancy/iota.hh \
+ fancy/print.hh
+
+
Index: oln/core/macros.hh
--- oln/core/macros.hh (revision 34)
+++ 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/1d/dpoint1d.hh
--- oln/core/1d/dpoint1d.hh (revision 34)
+++ 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/point1d.hh
--- oln/core/1d/point1d.hh (revision 34)
+++ 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 34)
+++ 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 34)
+++ 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 34)
+++ 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 34)
+++ 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() :