https://svn.lrde.epita.fr/svn/oln/prototypes/proto-1.0
ChangeLog | 28 ++++++++++++++++++++++++++++
oln/core/2d/array2d.hh | 2 --
oln/core/2d/dpoint2d.hh | 4 ++++
oln/core/2d/point2d.hh | 4 ++++
oln/core/2d/size2d.hh | 5 +++++
oln/core/abstract/image.hh | 1 -
oln/core/abstract/qiter.hh | 1 +
oln/core/any/dpoint.hh | 2 +-
oln/core/any/point.hh | 2 +-
oln/io/read_image.hh | 6 +++---
oln/io/read_image_2d_pnm.hh | 39 +++++++++++++--------------------------
oln/io/write_image.hh | 3 ++-
oln/io/write_image_2d_pnm.hh | 2 +-
oln/makefile.src | 1 -
14 files changed, 63 insertions(+), 37 deletions(-)
Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Repair the I/O routines.
* oln/io/read_image_2d_pnm.hh: Use output_ instead of image_.
(output): Remove method.
(read): Use the semantics of real image operator: return a
read_image_2d_raw instead of an image.
* oln/io/read_image.hh: Adjust.
* oln/io/write_image_2d_pnm.hh (impl_run): Rename as...
(run): ...this.
* oln/core/2d/array2d.hh: Do not set exact_ptr, since this class
not longer inherits from mlc::any__best_speed, but from mlc::any.
Please G++ and clean up.
* oln/core/abstract/qiter.hh (set_default_props): Add template <>
qualifier.
* oln/core/any/point.hh (operator<<): Do not name the second
argument.
* oln/core/any/dpoint.hh (operator<<): Likewise.
* oln/core/2d/point2d.hh (super_type): New typedef.
Explicitely call the super type ctor in ctors.
* oln/core/2d/dpoint2d.hh Likewise.
* oln/core/2d/size2d.hh: Likewise.
* oln/makefile.src (OLN_DEP): Remove core/2d/fwd_qiter2d.hh.
Index: olena/oln/core/abstract/image.hh
--- olena/oln/core/abstract/image.hh (revision 137)
+++ olena/oln/core/abstract/image.hh (working copy)
@@ -167,7 +167,6 @@
{
/// typedefs
-
typedef oln_type_of(E, size) size_type;
typedef oln_type_of(E, value) value_type;
typedef oln_type_of(E, point) point_type;
Index: olena/oln/core/abstract/qiter.hh
--- olena/oln/core/abstract/qiter.hh (revision 137)
+++ olena/oln/core/abstract/qiter.hh (working copy)
@@ -54,6 +54,7 @@
/// Default properties of any type in category::qiter.
+ template <>
struct set_default_props < category::qiter >
{
typedef mlc::undefined_type window_type;
Index: olena/oln/core/2d/dpoint2d.hh
--- olena/oln/core/2d/dpoint2d.hh (revision 137)
+++ olena/oln/core/2d/dpoint2d.hh (working copy)
@@ -47,17 +47,21 @@
struct dpoint2d : public abstract::dpoint < dpoint2d >
{
+ typedef abstract::dpoint< dpoint2d > super_type;
+
dpoint2d()
{
}
dpoint2d(coord_t row_, coord_t col_) :
+ super_type(),
row_(row_),
col_(col_)
{
}
dpoint2d(const dpoint2d& rhs) :
+ super_type(),
row_(rhs.row_),
col_(rhs.col_)
{
Index: olena/oln/core/2d/array2d.hh
--- olena/oln/core/2d/array2d.hh (revision 137)
+++ olena/oln/core/2d/array2d.hh (working copy)
@@ -79,7 +79,6 @@
array_(0),
size_()
{
- this->exact_ptr = this;
invariant_();
}
@@ -93,7 +92,6 @@
array_(0),
size_()
{
- this->exact_ptr = this;
this->resize(s);
}
Index: olena/oln/core/2d/point2d.hh
--- olena/oln/core/2d/point2d.hh (revision 137)
+++ olena/oln/core/2d/point2d.hh (working copy)
@@ -59,18 +59,22 @@
struct point2d : public abstract::point< point2d >
{
+ typedef abstract::point< point2d > super_type;
+
point2d()
{
// no initialization here so that row_ and col_ are 'undef'
}
point2d(coord_t row_, coord_t col_) :
+ super_type(),
row_(row_),
col_(col_)
{
}
point2d(const point2d& rhs) :
+ super_type(),
row_(rhs.row_),
col_(rhs.col_)
{
Index: olena/oln/core/2d/size2d.hh
--- olena/oln/core/2d/size2d.hh (revision 137)
+++ olena/oln/core/2d/size2d.hh (working copy)
@@ -46,24 +46,29 @@
struct size2d : public abstract::size< size2d >
{
+ typedef abstract::size< size2d > super_type;
+
size2d()
{
// no initialization here so that members are 'undef'
}
size2d(coord_t nrows_, coord_t ncols_) :
+ super_type(),
nrows_(nrows_),
ncols_(ncols_),
border_(2) // FIXME: 2!
{}
size2d(coord_t nrows_, coord_t ncols_, coord_t border_) :
+ super_type(),
nrows_(nrows_),
ncols_(ncols_),
border_(border_)
{}
size2d(const size2d& rhs) :
+ super_type(),
nrows_(rhs.nrows_),
ncols_(rhs.ncols_),
border_(rhs.border_)
Index: olena/oln/core/any/point.hh
--- olena/oln/core/any/point.hh (revision 137)
+++ olena/oln/core/any/point.hh (working copy)
@@ -81,7 +81,7 @@
} // end of namespace oln
-std::ostream& operator<<(std::ostream& ostr, const oln::any_point& p)
+std::ostream& operator<<(std::ostream& ostr, const oln::any_point&)
{
return ostr << "any";
}
Index: olena/oln/core/any/dpoint.hh
--- olena/oln/core/any/dpoint.hh (revision 137)
+++ olena/oln/core/any/dpoint.hh (working copy)
@@ -77,7 +77,7 @@
} // end of namespace oln
-std::ostream& operator<<(std::ostream& ostr, const oln::any_dpoint&
dp)
+std::ostream& operator<<(std::ostream& ostr, const oln::any_dpoint&)
{
return ostr << "any";
}
Index: olena/oln/makefile.src
--- olena/oln/makefile.src (revision 137)
+++ olena/oln/makefile.src (working copy)
@@ -33,7 +33,6 @@
core/2d/dpoint2d.hh \
core/2d/fwd_niter2d.hh \
core/2d/fwd_piter2d.hh \
- core/2d/fwd_qiter2d.hh \
core/2d/image2d.hh \
core/2d/neighborhood2d.hh \
core/2d/point2d.hh \
Index: olena/oln/io/write_image_2d_pnm.hh
--- olena/oln/io/write_image_2d_pnm.hh (revision 137)
+++ olena/oln/io/write_image_2d_pnm.hh (working copy)
@@ -70,7 +70,7 @@
bin_v = 0;
}
- void impl_run()
+ void run()
{
point2d p;
value_type c;
Index: olena/oln/io/read_image_2d_pnm.hh
--- olena/oln/io/read_image_2d_pnm.hh (revision 137)
+++ olena/oln/io/read_image_2d_pnm.hh (working copy)
@@ -68,36 +68,25 @@
namespace impl {
template <typename I>
- struct read_image_2d_raw : public oln::abstract::image_operator<I,
read_image_2d_raw<I> >
+ struct read_image_2d_raw :
+ public oln::abstract::image_operator<I, read_image_2d_raw<I> >
{
-
- typedef oln::abstract::image_operator<I, read_image_2d_raw<I> > super_type;
+ typedef oln::abstract::image_operator<I, read_image_2d_raw<I> >
+ super_type;
typedef oln_type_of(I, value) value_type;
- // commented below cause 'image_' is inherited
-// mlc::box<I> image_;
-
std::istream& istr_;
internal::pnm_info& info_;
char v;
int offset;
- read_image_2d_raw(I& image,
- std::istream &istr,
+ read_image_2d_raw(std::istream &istr,
internal::pnm_info &info) :
- super_type(image),
+ super_type(),
istr_(istr),
info_(info),
offset(-1)
{
- this->image_ = image;
- }
-
-
- read_image_2d_raw<I>& output(I& output)
- {
- output = this->image_;
- return *this;
}
template <typename E>
@@ -110,7 +99,8 @@
template <typename E>
void precond(ntg::vect_value<E>& c)
{
- precondition(ntg_max_val(ntg_comp_type(value_type)) <= info_.max_val);
+ precondition(ntg_max_val(ntg_comp_type(value_type)) <=
+ info_.max_val);
precondition(info_.type == "P6");
precondition(ntg_nb_comp(value_type) == 3);
}
@@ -134,7 +124,7 @@
read_value_type(c);
tmp[p] = c;
}
- this->image_ = tmp;
+ this->output = tmp;
}
//FIXME: Should work with builtin types.
@@ -175,16 +165,13 @@
}
};
-
-
template <typename I>
- void read(abstract::image2d<I>& ima,
- std::istream& istr,
- internal::pnm_info info)
+ read_image_2d_raw<I>
+ read(std::istream& istr, internal::pnm_info info)
{
- read_image_2d_raw<I> tmp(ima.exact(), istr, info);
+ read_image_2d_raw<I> tmp(istr, info);
tmp.run();
- tmp.output(ima.exact());
+ return tmp;
}
}
Index: olena/oln/io/write_image.hh
--- olena/oln/io/write_image.hh (revision 137)
+++ olena/oln/io/write_image.hh (working copy)
@@ -89,7 +89,8 @@
void write(const abstract::image<I>& ima, const std::string& name)
{
std::string ext;
- oln_type_of(I, value) t;
+ // FIXME: Unused?
+ // oln_type_of(I, value) t;
ext = internal::utils::extension(name);
Index: olena/oln/io/read_image.hh
--- olena/oln/io/read_image.hh (revision 137)
+++ olena/oln/io/read_image.hh (working copy)
@@ -76,17 +76,17 @@
if (internal::read_pnm_header(istr, info))
if ((ext == "ppm" || ext == "pnm") && info.type ==
"P6")
- impl::read(ima.exact(), istr, info);
+ ima.exact() = impl::read<I>(istr, info);
else if ((ext == "ppm" || ext == "pnm") && info.type ==
"P3")
std::cerr << "error: read_image_2d_ppm_ascii not implemented"
<< std::endl;
else if ((ext == "pbm" || ext == "pnm") && info.type ==
"P4")
- impl::read(ima.exact(), istr, info);
+ ima.exact() = impl::read<I>(istr, info);
else if ((ext == "pbm" || ext == "pnm") && info.type ==
"P1")
std::cerr << "error: read_image_2d_ppm_ascii not implemented"
<< std::endl;
else if ((ext == "pgm" || ext == "pnm") && info.type ==
"P5")
- impl::read(ima.exact(), istr, info);
+ ima.exact() = impl::read<I>(istr, info);
else if ((ext == "pgm" || ext == "pnm") && info.type ==
"P2")
std::cerr << "error: read_image_2d_ppm_ascii not implemented"
<< std::endl;