Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Reorganize and fix oln/core/3d/.
* oln/core/3d/aliases.hh (oln::fwd_piter3d, oln::bkd_piter3d): Fix
their definitions.
* oln/core/3d/neighb3d.hh (c6, c18, c26)
(c4_slice, c8_slice, c4_row, c8_row, c4_col, c8_col): Rename as...
(mk_c6, mk_c18, mk_c26, mk_c4_slice, mk_c8_slice)
(mk_c4_row, mk_c8_row, mk_c4_col, mk_c8_col): ...these.
(c6, c18, c26, c4_slice, c8_slice, c4_row, c8_row)
(c4_col, c8_col): New objects.
* oln/core/3d/array3d.hh, oln/core/3d/dpoint3d.hh,
* oln/core/3d/image3d.hh, oln/core/3d/neighb3d.hh,
* oln/core/3d/point3d.hh: Separate the interface of the methods
and functions from their implementation.
* oln/core/3d/image3d.hh (oln::vtypes< image3d<T> >): Set
topo_type to topo3d.
(bbox_<point3d>): Move explicit instantiation...
* oln/basics3d.hh: ...here
(oln/core/fwd_piter.hh): Include it.
* oln/core/3d/image3d.hh: Move the definition of the virtual types
fwd_piter and bkd_piter of oln::image3d...
* oln/core/fwd_piter.hh: ...here.
* oln/core/abstract/image/hybrid/classical.hh
(oln::abstract:classical_3d_image): New.
(oln::case_<image_hybrid_hierarchy_wrt_classical, E, 3>): Rename
as...
(oln::case_<image_hybrid_hierarchy_wrt_classical, E, 4>): ...this.
(oln::case_<image_hybrid_hierarchy_wrt_classical, E, 3>): New.
Handle 3D case.
basics3d.hh | 4 -
core/3d/aliases.hh | 4 -
core/3d/array3d.hh | 81 ++++++++++++++++++++++----------
core/3d/dpoint3d.hh | 57 ++++++++++++++++------
core/3d/image3d.hh | 66 ++++++++++++++++++++------
core/3d/neighb3d.hh | 65 +++++++++++++++++++++----
core/3d/point3d.hh | 58 ++++++++++++++++------
core/abstract/image/hybrid/classical.hh | 31 +++++++++++-
core/abstract/point.hh | 1
core/fwd_piter.hh | 15 +++++
10 files changed, 297 insertions(+), 85 deletions(-)
Index: oln/core/fwd_piter.hh
--- oln/core/fwd_piter.hh (revision 626)
+++ oln/core/fwd_piter.hh (working copy)
@@ -144,10 +144,21 @@
typedef bkd_piter2d ret;
};
+
+ // image3d<T>
+
+ template <typename T> class image3d;
+
+ template <typename T>
+ struct single_vtype< image3d<T>, typedef_::fwd_piter_type >
+ {
+ typedef fwd_piter3d ret;
+ };
+
template <typename T>
- struct single_vtype< image2d<T>, typedef_::fwd_qiter_type >
+ struct single_vtype< image3d<T>, typedef_::bkd_piter_type >
{
- typedef fwd_qiter2d ret;
+ typedef bkd_piter3d ret;
};
Index: oln/core/abstract/image/hybrid/classical.hh
--- oln/core/abstract/image/hybrid/classical.hh (revision 626)
+++ oln/core/abstract/image/hybrid/classical.hh (working copy)
@@ -33,6 +33,7 @@
# include <oln/core/abstract/image/dimension/1d.hh>
# include <oln/core/abstract/image/dimension/2d.hh>
+# include <oln/core/abstract/image/dimension/3d.hh>
# include <oln/core/abstract/image/bbox/hierarchy.hh>
# include <oln/core/abstract/image/accessibility/hierarchy.hh>
@@ -70,6 +71,15 @@
classical_2d_image();
};
+ template <typename E>
+ struct classical_3d_image
+ : public virtual abstract::classical_image<E>,
+ public virtual abstract::image3d<E>
+ {
+ protected:
+ classical_3d_image();
+ };
+
# ifndef OLN_INCLUDE_ONLY
@@ -88,6 +98,11 @@
{
}
+ template <typename E>
+ classical_3d_image<E>::classical_3d_image()
+ {
+ }
+
# endif
} // end of namespace oln::abstract
@@ -96,6 +111,7 @@
// Fwd. decl.
class grid1d;
class grid2d;
+ class grid3d;
/// 1D case.
@@ -124,9 +140,22 @@
};
- /// General case.
+ /// 3D case.
template <typename E>
struct case_< image_hybrid_hierarchy_wrt_classical, E, 3 > :
+ where_< mlc::and_list_< mlc::eq_< oln_type_of(E, grid), oln::grid3d >,
+ mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ >,
+ mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found >
+ >
+ >
+ {
+ typedef abstract::classical_3d_image<E> ret;
+ };
+
+
+ /// General case.
+ template <typename E>
+ struct case_< image_hybrid_hierarchy_wrt_classical, E, 4 > :
where_< mlc::and_< mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ >,
mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found >
>
Index: oln/core/abstract/point.hh
--- oln/core/abstract/point.hh (revision 626)
+++ oln/core/abstract/point.hh (working copy)
@@ -33,6 +33,7 @@
# include <oln/core/traits_id.hh>
# include <oln/core/abstract/dpoint.hh>
+# include <xtd/vec.hh>
Index: oln/core/3d/aliases.hh
--- oln/core/3d/aliases.hh (revision 626)
+++ oln/core/3d/aliases.hh (working copy)
@@ -55,8 +55,8 @@
typedef bbox_<point3d> bbox3d;
typedef topo_lbbox_<point3d> topo3d;
- typedef fwd_piter_bbox_<topo3d> fwd_piter3d;
- typedef bkd_piter_bbox_<topo3d> bkd_piter3d;
+ typedef fwd_piter_bbox_<point3d> fwd_piter3d;
+ typedef bkd_piter_bbox_<point3d> bkd_piter3d;
typedef point3d_<float> point3df;
typedef dpoint3d_<float> dpoint3df;
Index: oln/core/3d/neighb3d.hh
--- oln/core/3d/neighb3d.hh (revision 626)
+++ oln/core/3d/neighb3d.hh (working copy)
@@ -36,8 +36,23 @@
namespace oln
{
+ namespace internal
+ {
+
+ neighb3d mk_c6();
+ neighb3d mk_c18();
+ neighb3d mk_c26();
+ neighb3d mk_c4_slice();
+ neighb3d mk_c8_slice();
+ neighb3d mk_c4_row();
+ neighb3d mk_c8_row();
+ neighb3d mk_c4_col();
+ neighb3d mk_c8_col();
+
+
+# ifndef OLN_INCLUDE_ONLY
- neighb3d c6()
+ neighb3d mk_c6()
{
static bool flower = true;
static neighb3d the_;
@@ -53,7 +68,7 @@
}
- neighb3d c18()
+ neighb3d mk_c18()
{
static bool flower = true;
static neighb3d the_;
@@ -75,7 +90,7 @@
}
- neighb3d c26()
+ neighb3d mk_c26()
{
static bool flower = true;
static neighb3d the_;
@@ -101,7 +116,7 @@
}
- neighb3d c4_slice()
+ neighb3d mk_c4_slice()
{
static bool flower = true;
static neighb3d the_;
@@ -116,7 +131,7 @@
}
- neighb3d c8_slice()
+ neighb3d mk_c8_slice()
{
static bool flower = true;
static neighb3d the_;
@@ -133,7 +148,7 @@
}
- neighb3d c4_row()
+ neighb3d mk_c4_row()
{
static bool flower = true;
static neighb3d the_;
@@ -148,7 +163,7 @@
}
- neighb3d c8_row()
+ neighb3d mk_c8_row()
{
static bool flower = true;
static neighb3d the_;
@@ -165,7 +180,7 @@
}
- neighb3d c4_col()
+ neighb3d mk_c4_col()
{
static bool flower = true;
static neighb3d the_;
@@ -180,7 +195,7 @@
}
- neighb3d c8_col()
+ neighb3d mk_c8_col()
{
static bool flower = true;
static neighb3d the_;
@@ -196,9 +211,39 @@
return the_;
}
+# endif
-} // end of namespace oln
+ } // end of namespace oln::internal
+
+
+ extern const neighb3d c6;
+ extern const neighb3d c18;
+ extern const neighb3d c26;
+ extern const neighb3d c4_slice;
+ extern const neighb3d c8_slice;
+ extern const neighb3d c4_row;
+ extern const neighb3d c8_row;
+ extern const neighb3d c4_col;
+ extern const neighb3d c8_col;
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ const neighb3d c6 = internal::mk_c6();
+ const neighb3d c18 = internal::mk_c18();
+ const neighb3d c26 = internal::mk_c26();
+
+ const neighb3d c4_slice = internal::mk_c4_slice();
+ const neighb3d c8_slice = internal::mk_c8_slice();
+ const neighb3d c4_row = internal::mk_c4_row();
+ const neighb3d c8_row = internal::mk_c8_row();
+ const neighb3d c4_col = internal::mk_c4_col();
+ const neighb3d c8_col = internal::mk_c8_col();
+
+# endif
+
+} // end of namespace oln
#endif // ! OLN_CORE_3D_NEIGHB3D_HH
Index: oln/core/3d/dpoint3d.hh
--- oln/core/3d/dpoint3d.hh (revision 626)
+++ oln/core/3d/dpoint3d.hh (working copy)
@@ -70,38 +70,67 @@
{
typedef dpoint3d_<C> self_t;
typedef stc_get_super(dpoint3d_<C>) super_t;
- typedef oln_type_of(self_t, coord) coord_t;
using super_t::v_;
public:
/// Ctor.
- dpoint3d_()
+ dpoint3d_();
+
+ /// Ctor.
+ dpoint3d_(const xtd::vec<3,C>& v);
+
+ /// Ctor.
+ dpoint3d_(C slice, C row, C col);
+
+ C slice() const;
+ C& slice();
+
+ C row() const;
+ C& row();
+
+ C col() const;
+ C& col();
+ };
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename C>
+ dpoint3d_<C>::dpoint3d_()
{
}
- /// Ctor.
- dpoint3d_(const xtd::vec<3,coord_t>& v)
+ template <typename C>
+ dpoint3d_<C>::dpoint3d_(const xtd::vec<3,C>& v)
: super_t(v)
{
}
- /// Ctor.
- dpoint3d_(coord_t slice, coord_t row, coord_t col)
+ template <typename C>
+ dpoint3d_<C>::dpoint3d_(C slice, C row, C col)
: super_t(xtd::mk_vec(slice, row, col))
{
}
- coord_t slice() const { return v_[0]; }
- coord_t& slice() { return v_[0]; }
+ template <typename C>
+ C dpoint3d_<C>::slice() const { return v_[0]; }
+ template <typename C>
+ C& dpoint3d_<C>::slice() { return v_[0]; }
+
+ template <typename C>
+ C dpoint3d_<C>::row() const { return v_[1]; }
+ template <typename C>
+ C& dpoint3d_<C>::row() { return v_[1]; }
+
+ template <typename C>
+ C dpoint3d_<C>::col() const { return v_[2]; }
+ template <typename C>
+ C& dpoint3d_<C>::col() { return v_[2]; }
- coord_t row() const { return v_[1]; }
- coord_t& row() { return v_[1]; }
-
- coord_t col() const { return v_[2]; }
- coord_t& col() { return v_[2]; }
- };
+# endif
} // end of namespace oln
Index: oln/core/3d/array3d.hh
--- oln/core/3d/array3d.hh (revision 626)
+++ oln/core/3d/array3d.hh (working copy)
@@ -44,8 +44,42 @@
/// Ctor.
array3d(coord_t imin, coord_t jmin, coord_t kmin,
- coord_t imax, coord_t jmax, coord_t kmax) :
- imin_(imin), jmin_(jmin), kmin_(kmin),
+ coord_t imax, coord_t jmax, coord_t kmax);
+ /// Ctor.
+ array3d(coord_t ilen, coord_t jlen, coord_t klen);
+
+ /// Dtor.
+ ~array3d();
+
+ value_t operator()(coord_t i, coord_t j, coord_t k) const;
+ value_t& operator()(coord_t i, coord_t j, coord_t k);
+
+ bool has(coord_t i, coord_t j, coord_t k) const;
+
+ size_t memsize() const;
+
+ protected:
+
+ coord_t imin_, jmin_, kmin_, imax_, jmax_, kmax_;
+ coord_t ilen_, jlen_, klen_;
+ value_t* buffer_;
+ value_t** array_2nd_dim_;
+ value_t*** array_1st_dim_;
+
+ private:
+
+ void allocate_();
+ void deallocate_();
+ };
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename value_t, typename coord_t>
+ array3d<value_t, coord_t>::array3d(coord_t imin, coord_t jmin, coord_t kmin,
+ coord_t imax, coord_t jmax, coord_t kmax)
+ : imin_(imin), jmin_(jmin), kmin_(kmin),
imax_(imax), jmax_(jmax), kmax_(kmax)
{
precondition(imax >= imin and jmax >= jmin and kmax >= kmin);
@@ -55,9 +89,9 @@
allocate_();
}
- /// Ctor.
- array3d(coord_t ilen, coord_t jlen, coord_t klen) :
- imin_(0), jmin_(0), kmin_(0),
+ template <typename value_t, typename coord_t>
+ array3d<value_t, coord_t>::array3d(coord_t ilen, coord_t jlen, coord_t klen)
+ : imin_(0), jmin_(0), kmin_(0),
ilen_(ilen), jlen_(jlen), klen_(klen)
{
precondition(ilen > 0 and jlen > 0 and klen > 0);
@@ -67,25 +101,30 @@
allocate_();
}
- /// Dtor.
- ~array3d()
+ template <typename value_t, typename coord_t>
+ array3d<value_t, coord_t>::~array3d()
{
deallocate_();
}
- value_t operator()(coord_t i, coord_t j, coord_t k) const
+ template <typename value_t, typename coord_t>
+ value_t
+ array3d<value_t, coord_t>::operator()(coord_t i, coord_t j, coord_t k) const
{
precondition(has(i, j, k));
return array_1st_dim_[i][j][k];
}
- value_t& operator()(coord_t i, coord_t j, coord_t k)
+ template <typename value_t, typename coord_t>
+ value_t&
+ array3d<value_t, coord_t>::operator()(coord_t i, coord_t j, coord_t k)
{
precondition(has(i, j, k));
return array_1st_dim_[i][j][k];
}
- bool has(coord_t i, coord_t j, coord_t k) const
+ template <typename value_t, typename coord_t>
+ bool array3d<value_t, coord_t>::has(coord_t i, coord_t j, coord_t k) const
{
return
i >= imin_ and i <= imax_ and
@@ -93,7 +132,8 @@
k >= kmin_ and k <= kmax_;
}
- size_t memsize() const
+ template <typename value_t, typename coord_t>
+ size_t array3d<value_t, coord_t>::memsize() const
{
return
// buffer_
@@ -106,17 +146,8 @@
size_t(ilen_) * sizeof(value_t*);
}
- protected:
-
- coord_t imin_, jmin_, kmin_, imax_, jmax_, kmax_;
- coord_t ilen_, jlen_, klen_;
- value_t* buffer_;
- value_t** array_2nd_dim_;
- value_t*** array_1st_dim_;
-
- private:
-
- void allocate_()
+ template <typename value_t, typename coord_t>
+ void array3d<value_t, coord_t>::allocate_()
{
buffer_ = new value_t[size_t(ilen_) * size_t(jlen_) * size_t(klen_)];
array_2nd_dim_ = new value_t*[size_t(ilen_) * size_t(jlen_)];
@@ -135,7 +166,8 @@
array_1st_dim_ -= imin_;
}
- void deallocate_()
+ template <typename value_t, typename coord_t>
+ void array3d<value_t, coord_t>::deallocate_()
{
precondition(buffer_ != 0 and
array_2nd_dim_ != 0 and
@@ -148,7 +180,8 @@
delete[] array_1st_dim_;
array_1st_dim_ = 0; // safety
}
- };
+
+# endif
} // end of namespace oln
Index: oln/core/3d/image3d.hh
--- oln/core/3d/image3d.hh (revision 626)
+++ oln/core/3d/image3d.hh (working copy)
@@ -53,15 +53,11 @@
template <typename T>
struct vtypes< image3d<T> >
{
- // FIXME: or `typedef topo3d topo_type;' ?
- typedef topo_lbbox_<point3d> topo_type;
+ typedef topo3d topo_type;
typedef grid3d grid_type;
typedef point3d point_type;
- typedef fwd_piter_bbox_<topo_type> fwd_piter_type;
- typedef bkd_piter_bbox_<topo_type> bkd_piter_type;
-
typedef T value_type;
typedef T lvalue_type;
typedef mlc::true_ is_mutable_type;
@@ -90,7 +86,32 @@
/// Ctor using sizes.
image3d(unsigned nslices, unsigned nrows, unsigned ncols,
- unsigned border = 2)
+ unsigned border = 2);
+
+ /// Ctor using an existing topology.
+ image3d(const topo3d& topo);
+
+ const topo3d& impl_topo() const;
+
+ T impl_op_read(const point3d& p) const;
+ T& impl_op_readwrite(const point3d& p);
+
+ T* adr_at(int slice, int row, int col);
+ const T* adr_at(int slice, int row, int col) const;
+
+ private:
+
+ topo3d topo_;
+ internal::tracked_ptr<array_t> data_;
+ };
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename T>
+ image3d<T>::image3d(unsigned nslices, unsigned nrows, unsigned ncols,
+ unsigned border)
: topo_(bbox3d(point3d(0, 0, 0 ),
point3d(nslices - 1, nrows - 1, ncols - 1)),
border),
@@ -103,8 +124,8 @@
{
}
- /// Ctor using an existing topology.
- image3d(const topo3d& topo)
+ template <typename T>
+ image3d<T>::image3d(const topo3d& topo)
: topo_(topo),
data_(new array_t(topo.bbox().pmin().slice(),
topo.bbox().pmin().row(),
@@ -115,30 +136,45 @@
{
}
- const topo3d& impl_topo() const
+ template <typename T>
+ const topo3d& image3d<T>::impl_topo() const
{
return topo_;
}
- T impl_op_read(const point3d& p) const
+ template <typename T>
+ T image3d<T>::impl_op_read(const point3d& p) const
{
precondition(data_ != 0);
precondition(topo_.has_large(p));
return data_->operator()(p.slice(), p.row(), p.col());
}
- T& impl_op_readwrite(const point3d& p)
+ template <typename T>
+ T& image3d<T>::impl_op_readwrite(const point3d& p)
{
precondition(data_ != 0);
precondition(topo_.has_large(p));
return data_->operator()(p.slice(), p.row(), p.col());
}
- private:
+ template <typename T>
+ T* image3d<T>::adr_at(int slice, int row, int col)
+ {
+ precondition(data_ != 0);
+ precondition(data_->has(slice, row, col));
+ return &(data_->operator()(slice, row, col));
+ }
- topo3d topo_;
- internal::tracked_ptr<array_t> data_;
- };
+ template <typename T>
+ const T* image3d<T>::adr_at(int slice, int row, int col) const
+ {
+ precondition(data_ != 0);
+ precondition(data_->has(slice, row, col));
+ return &(data_->operator()(slice, row, col));
+ }
+
+# endif
} // end of namespace oln
Index: oln/core/3d/point3d.hh
--- oln/core/3d/point3d.hh (revision 626)
+++ oln/core/3d/point3d.hh (working copy)
@@ -78,39 +78,67 @@
{
typedef point3d_<C> self_t;
typedef stc_get_super(point3d_<C>) super_t;
- typedef oln_type_of(self_t, coord) coord_t;
using super_t::v_;
public:
/// Ctor.
- point3d_()
+ point3d_();
+
+ /// Ctor.
+ point3d_(C slice, C row, C col);
+
+ /// Ctor.
+ point3d_(const xtd::vec<3,C>& v);
+
+ C slice() const;
+ C& slice();
+
+ C row() const;
+ C& row();
+
+ C col() const;
+ C& col();
+ };
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename C>
+ point3d_<C>::point3d_()
{
}
- /// Ctor.
- point3d_(coord_t slice, coord_t row, coord_t col)
+ template <typename C>
+ point3d_<C>::point3d_(C slice, C row, C col)
: super_t (xtd::mk_vec(slice, row, col))
{
}
- /// Ctor.
- point3d_(const xtd::vec<3,coord_t>& v)
+ template <typename C>
+ point3d_<C>::point3d_(const xtd::vec<3,C>& v)
: super_t(v)
{
}
- coord_t slice() const { return v_[0]; }
- coord_t& slice() { return v_[0]; }
-
- coord_t row() const { return v_[1]; }
- coord_t& row() { return v_[1]; }
-
- coord_t col() const { return v_[2]; }
- coord_t& col() { return v_[2]; }
- };
+ template <typename C>
+ C point3d_<C>::slice() const { return v_[0]; }
+ template <typename C>
+ C& point3d_<C>::slice() { return v_[0]; }
+
+ template <typename C>
+ C point3d_<C>::row() const { return v_[1]; }
+ template <typename C>
+ C& point3d_<C>::row() { return v_[1]; }
+
+ template <typename C>
+ C point3d_<C>::col() const { return v_[2]; }
+ template <typename C>
+ C& point3d_<C>::col() { return v_[2]; }
+# endif
} // end of namespace oln
Index: oln/basics3d.hh
--- oln/basics3d.hh (revision 626)
+++ oln/basics3d.hh (working copy)
@@ -35,7 +35,6 @@
# include <oln/core/3d/grid3d.hh>
# include <oln/core/3d/point3d.hh>
-
# include <oln/core/3d/dpoint3d.hh>
# include <oln/core/gen/bbox.hh>
@@ -43,7 +42,6 @@
# include <oln/core/3d/bbox3d.hh>
# include <oln/core/gen/fwd_piter_bbox.hh>
-
# include <oln/core/gen/bkd_piter_bbox.hh>
# include <oln/core/gen/neighb.hh>
@@ -51,6 +49,8 @@
# include <oln/core/3d/image3d.hh>
+# include <oln/core/fwd_piter.hh>
+
# include <oln/core/spe/slice.hh>
# include <oln/core/spe/row.hh>
# include <oln/core/spe/col.hh>
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix explicit instantiations of oln::bbox_.
* oln/basics1d.hh (bbox_<point1d>): Move explicit
instantiation...
* oln/core/1d/bbox1d.hh: ...here (new file).
* oln/core/1d/image1d.hh: Include it.
* oln/basics2d.hh (bbox_<point2d>): Move explicit
instantiation...
* oln/core/2d/bbox2d.hh: ...here (new file).
* oln/core/2d/image2d.hh: Include it.
* oln/core/3d/bbox3d.hh: New file.
* oln/basics3d.hh, oln/core/3d/image3d.hh: Include it.
* oln/Makefile.am (nobase_oln_HEADERS): Add core/1d/bbox1d.hh,
core/2d/bbox2d.hh and core/3d/bbox3d.hh.
* oln/core/2d/array2d.hh: Aesthetic changes.
Makefile.am | 3 +++
basics1d.hh | 7 +------
basics2d.hh | 7 +------
basics3d.hh | 2 +-
core/1d/bbox1d.hh | 45 +++++++++++++++++++++++++++++++++++++++++++++
core/1d/image1d.hh | 5 +++--
core/2d/bbox2d.hh | 46 ++++++++++++++++++++++++++++++++++++++++++++++
core/2d/image2d.hh | 5 +++--
core/3d/bbox3d.hh | 46 ++++++++++++++++++++++++++++++++++++++++++++++
core/3d/image3d.hh | 13 ++++++-------
10 files changed, 155 insertions(+), 24 deletions(-)
Index: oln/basics1d.hh
--- oln/basics1d.hh (revision 625)
+++ oln/basics1d.hh (working copy)
@@ -38,13 +38,8 @@
# include <oln/core/1d/dpoint1d.hh>
# include <oln/core/gen/bbox.hh>
-// FIXME: Inexplicably, this explicit instantiation is required to
-// have topo_lbbox_<point1d> work. See if we can get rid of it.
-namespace oln {
- template class bbox_<point1d>;
-}
-
# include <oln/core/gen/topo_lbbox.hh>
+# include <oln/core/1d/bbox1d.hh>
# include <oln/core/gen/fwd_piter_bbox.hh>
# include <oln/core/gen/bkd_piter_bbox.hh>
Index: oln/core/1d/bbox1d.hh
--- oln/core/1d/bbox1d.hh (revision 0)
+++ oln/core/1d/bbox1d.hh (revision 0)
@@ -0,0 +1,45 @@
+// Copyright (C) 2006 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, 51 Franklin Street, Fifth Floor,
+// 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 OLN_CORE_1D_BBOX1D_HH
+# define OLN_CORE_1D_BBOX1D_HH
+
+# include <oln/core/1d/aliases.hh>
+# include <oln/core/1d/point1d.hh>
+# include <oln/core/gen/bbox.hh>
+
+namespace oln
+{
+
+ // FIXME: Inexplicably, this explicit instantiation is required to
+ // have topo_lbbox_<point1d> work. See if we can get rid of it.
+ template class bbox_<point1d>;
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_1D_BBOX1D_HH
Index: oln/core/1d/image1d.hh
--- oln/core/1d/image1d.hh (revision 625)
+++ oln/core/1d/image1d.hh (working copy)
@@ -30,10 +30,11 @@
# define OLN_CORE_1D_IMAGE1D_HH
# include <oln/core/image_entry.hh>
-# include <oln/core/1d/array1d.hh>
-# include <oln/core/1d/point1d.hh>
# include <oln/core/gen/topo_lbbox.hh>
# include <oln/core/internal/tracked_ptr.hh>
+# include <oln/core/1d/array1d.hh>
+# include <oln/core/1d/point1d.hh>
+# include <oln/core/1d/bbox1d.hh>
// For topo1d.
# include <oln/core/1d/aliases.hh>
// For fwd_piter and bkd_piter virtual types.
Index: oln/basics2d.hh
--- oln/basics2d.hh (revision 625)
+++ oln/basics2d.hh (working copy)
@@ -38,13 +38,8 @@
# include <oln/core/2d/dpoint2d.hh>
# include <oln/core/gen/bbox.hh>
-// FIXME: Inexplicably, this explicit instantiation is required to
-// have topo_lbbox_<point2d> work. See if we can get rid of it.
-namespace oln {
- template class bbox_<point2d>;
-}
-
# include <oln/core/gen/topo_lbbox.hh>
+# include <oln/core/2d/bbox2d.hh>
# include <oln/core/gen/fwd_piter_bbox.hh>
# include <oln/core/gen/bkd_piter_bbox.hh>
Index: oln/core/2d/bbox2d.hh
--- oln/core/2d/bbox2d.hh (revision 0)
+++ oln/core/2d/bbox2d.hh (revision 0)
@@ -0,0 +1,46 @@
+// Copyright (C) 2006 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, 51 Franklin Street, Fifth Floor,
+// 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 OLN_CORE_2D_BBOX2D_HH
+# define OLN_CORE_2D_BBOX2D_HH
+
+# include <oln/core/2d/aliases.hh>
+# include <oln/core/2d/point2d.hh>
+# include <oln/core/gen/bbox.hh>
+
+namespace oln
+{
+
+ typedef bbox_<point2d> bbox2d;
+ // FIXME: Inexplicably, this explicit instantiation is required to
+ // have topo_lbbox_<point2d> work. See if we can get rid of it.
+ template class bbox_<point2d>;
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_2D_BBOX2D_HH
Index: oln/core/2d/image2d.hh
--- oln/core/2d/image2d.hh (revision 625)
+++ oln/core/2d/image2d.hh (working copy)
@@ -30,10 +30,11 @@
# define OLN_CORE_2D_IMAGE2D_HH
# include <oln/core/image_entry.hh>
-# include <oln/core/2d/array2d.hh>
-# include <oln/core/2d/point2d.hh>
# include <oln/core/gen/topo_lbbox.hh>
# include <oln/core/internal/tracked_ptr.hh>
+# include <oln/core/2d/array2d.hh>
+# include <oln/core/2d/point2d.hh>
+# include <oln/core/2d/bbox2d.hh>
// For topo2d.
# include <oln/core/2d/aliases.hh>
// For fwd_piter and bkd_piter virtual types.
Index: oln/core/3d/bbox3d.hh
--- oln/core/3d/bbox3d.hh (revision 0)
+++ oln/core/3d/bbox3d.hh (revision 0)
@@ -0,0 +1,46 @@
+// Copyright (C) 2006 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, 51 Franklin Street, Fifth Floor,
+// 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 OLN_CORE_3D_BBOX3D_HH
+# define OLN_CORE_3D_BBOX3D_HH
+
+# include <oln/core/3d/aliases.hh>
+# include <oln/core/3d/point3d.hh>
+# include <oln/core/gen/bbox.hh>
+
+namespace oln
+{
+
+ typedef bbox_<point3d> bbox3d;
+ // FIXME: Inexplicably, this explicit instantiation is required to
+ // have topo_lbbox_<point3d> work. See if we can get rid of it.
+ template class bbox_<point3d>;
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_3D_BBOX3D_HH
Index: oln/basics3d.hh
--- oln/basics3d.hh (revision 625)
+++ oln/basics3d.hh (working copy)
@@ -39,8 +39,8 @@
# include <oln/core/3d/dpoint3d.hh>
# include <oln/core/gen/bbox.hh>
-
# include <oln/core/gen/topo_lbbox.hh>
+# include <oln/core/3d/bbox3d.hh>
# include <oln/core/gen/fwd_piter_bbox.hh>
Index: oln/core/3d/image3d.hh
--- oln/core/3d/image3d.hh (revision 625)
+++ oln/core/3d/image3d.hh (working copy)
@@ -30,22 +30,21 @@
# define OLN_CORE_3D_IMAGE3D_HH
# include <oln/core/image_entry.hh>
-# include <oln/core/3d/array3d.hh>
-# include <oln/core/3d/point3d.hh>
# include <oln/core/gen/topo_lbbox.hh>
# include <oln/core/internal/tracked_ptr.hh>
+# include <oln/core/3d/array3d.hh>
+# include <oln/core/3d/point3d.hh>
+# include <oln/core/3d/bbox3d.hh>
// For topo3d.
# include <oln/core/3d/aliases.hh>
+// For fwd_piter and bkd_piter virtual types.
+// FIXME: Really necessary?
+# include <oln/core/fwd_piter.hh>
namespace oln
{
- // FIXME: Inexplicably, this explicit instantiation is required to
- // have topo_lbbox_<point3d> work. See if we can get rid of it.
- template class bbox_<point3d>;
-
-
// Forward declaration.
template <typename T> class image3d;
Index: oln/Makefile.am
--- oln/Makefile.am (revision 625)
+++ oln/Makefile.am (working copy)
@@ -7,6 +7,7 @@
\
core/1d/aliases.hh \
core/1d/array1d.hh \
+ core/1d/bbox1d.hh \
core/1d/dpoint1d.hh \
core/1d/grid1d.hh \
core/1d/image1d.hh \
@@ -15,6 +16,7 @@
\
core/2d/aliases.hh \
core/2d/array2d.hh \
+ core/2d/bbox2d.hh \
core/2d/dpoint2d.hh \
core/2d/grid2d.hh \
core/2d/image2d.hh \
@@ -23,6 +25,7 @@
\
core/3d/aliases.hh \
core/3d/array3d.hh \
+ core/3d/bbox3d.hh \
core/3d/dpoint3d.hh \
core/3d/grid3d.hh \
core/3d/image3d.hh \
Index: oln/core/2d/array2d.hh
1
0
Index: ChangeLog
===================================================================
--- ChangeLog (révision 624)
+++ ChangeLog (révision 625)
@@ -31,7 +31,7 @@
of oln::image1d...
* oln/core/fwd_piter.hh: ...here.
* oln/core/abstract/image/hybrid/classical.hh
- (oln::abstract:classical_1d_image)
+ (oln::abstract:classical_1d_image): New.
(oln::case_<image_hybrid_hierarchy_wrt_classical, E, 1>)
(oln::case_<image_hybrid_hierarchy_wrt_classical, E, 2>): Rename
as...
@@ -65,7 +65,7 @@
2006-10-11 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add new facilities to access to components such as row, col, etc.
-
+
* oln/core/spe/row.hh: New.
* oln/core/spe/col.hh: New.
* oln/core/spe/slice.hh: New.
@@ -95,7 +95,7 @@
2006-10-11 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
New facilities related to windows and q-iterators.
-
+
* tests/window2d.cc: New.
* tests/Makefile.am (window2d_SOURCES): New.
* oln/debug/print.hh (format): New.
@@ -115,11 +115,11 @@
(include): Update.
* oln/basics2d.hh (include): Add window.hh and fwd_qiter_win.hh.
* oln/Makefile.am (nobase_oln_HEADERS): Update.
-
+
2006-10-11 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add some tools related to morphers over image value.
-
+
* oln/core/abstract/value.hh: New.
* oln/morpher/thru_fun.hh: New.
* oln/morpher/internal/image_value_morpher.hh: New.
@@ -230,7 +230,7 @@
2006-10-10 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add i/o read for pbm and pgm formats.
-
+
* tests/io_pnm.cc: New.
* tests/Makefile.am (check_PROGRAMS): Update.
* oln/io: New directory.
@@ -262,7 +262,7 @@
2006-10-09 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Change stc_virtual_typedef into oln_virtual_typedef.
-
+
* oln/core/macros.hh (oln_virtual_typedef): New macro.
It replaces stc_virtual_typedef.
* oln/core/abstract/image.hh: Update.
@@ -362,7 +362,7 @@
Decouple iterators from image topology; update neighborhood tools
and start to add window tools.
-
+
* oln/core/automatic/topology_having_subset.hh: New.
* oln/core/abstract/topology_having_subset.hh: New.
* oln/core/gen/fwd_niter_neighb.hh: New.
@@ -525,7 +525,7 @@
2006-10-02 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add isubset image morpher and subsequent tools.
-
+
* oln/core/gen/piter_isubset.hh: New.
* oln/core/gen/topo_add_isubset.hh: New.
* oln/morpher/add_isubset.hh: New.
@@ -534,7 +534,7 @@
* oln/core/automatic/image_being_random_accessible.hh
(set_impl): Remove; cause error-prone.
* oln/core/abstract/image/type/hierarchy.hh
- (where_): Rely on xtd_is_binary instead of an hard-coded test.
+ (where_): Rely on xtd_is_binary instead of an hard-coded test.
(include): Update.
* oln/core/gen/fwd_piter_bbox.hh (topo_type): new.
(topo_): Change ref into plain type so it is more secure.
@@ -626,18 +626,18 @@
2006-09-27 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add oln debug print and a "classical" image abstraction.
-
+
* oln/debug/print.hh: New.
* oln/core/abstract/image/hybrid/classical.hh: New.
* oln/core/abstract/image/hierarchies.hh
(image_hybrid_hierarchy_wrt_classical): New.
(include): Update.
* oln/Makefile.am (nobase_oln_HEADERS): Update.
-
+
2006-09-27 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Update grid classes and add static checks for image vtypes.
-
+
* oln/core/abstract/fwd_decls.hh: New.
* tests/image_entry.cc: Update.
* oln/core/abstract/image.hh (include): Add fwd_decls.
@@ -661,7 +661,7 @@
2006-09-27 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Adjust guards to directory names.
-
+
* oln/automatic/topology_having_bbox.hh: Adjust guard to directory
name.
* oln/automatic/image.hh: Likewise.
@@ -751,7 +751,7 @@
2006-09-27 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add array2d and tracked_ptr.
-
+
* oln/core/2d/array2d.hh: New.
This file also provides the tracked_ptr class which should be
moved later in a more appropriate file.
@@ -779,7 +779,7 @@
2006-09-26 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add mapimage type and update.
-
+
* oln/core/gen/mapimage.hh: New.
* oln/automatic/image_being_random_accessible.hh: New.
* oln/core/abstract/topology_having_bbox.hh
@@ -800,11 +800,11 @@
(pmin, pmax): New.
* oln/core/gen/topo_bbox.hh (impl_bbox): New.
* oln/Makefile.am (nobase_oln_HEADERS): Update.
-
+
2006-09-26 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add some abstract image sub-hierarchies.
-
+
* oln/automatic/image_being_mutable.hh: New.
* oln/core/abstract/image/mutability/hierarchy.hh: New.
* oln/core/abstract/image/accessibility/hierarchy.hh: New.
@@ -816,7 +816,7 @@
(image_hierarchy_wrt_bbox): New.
(image_hierarchy_wrt_accessibility): New.
(image_hierarchy_wrt_mutability): New.
- (include): Update.
+ (include): Update.
* oln/core/abstract/image/neighborhood/hierarchy.hh (decl): New.
(~image_having_neighborhood): New.
@@ -836,7 +836,7 @@
2006-09-26 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Dispatch image abstract classes into subdirs and files.
-
+
* oln/core/abstract/image/type: New directory.
* oln/core/abstract/image/dimension: New directory.
* oln/core/abstract/image/neighborhood: New directory.
1
0
12 Oct '06
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Move explicit instantiation of bbox_<point2d> to basics2d.hh.
* oln/core/2d/image2d.hh (oln::vtypes< image2d<T> >): Set
topo_type to topo2d.
* oln/core/2d/image2d.hh (bbox_<point2d>): Move explicit
instantiation...
* oln/basics2d.hh: ...here
basics2d.hh | 5 +++++
core/2d/image2d.hh | 15 +++++----------
2 files changed, 10 insertions(+), 10 deletions(-)
Index: oln/core/2d/image2d.hh
--- oln/core/2d/image2d.hh (revision 623)
+++ oln/core/2d/image2d.hh (working copy)
@@ -36,16 +36,14 @@
# include <oln/core/internal/tracked_ptr.hh>
// For topo2d.
# include <oln/core/2d/aliases.hh>
+// For fwd_piter and bkd_piter virtual types.
+// FIXME: Really necessary?
+# include <oln/core/fwd_piter.hh>
namespace oln
{
- // FIXME: Inexplicably, this explicit instantiation is required to
- // have topo_lbbox_<point2d> work. See if we can get rid of it.
- template class bbox_<point2d>;
-
-
// Forward declaration.
template <typename T> class image2d;
@@ -54,8 +52,7 @@
template <typename T>
struct vtypes< image2d<T> >
{
- // FIXME: or `typedef topo2d topo_type;' ?
- typedef topo_lbbox_<point2d> topo_type;
+ typedef topo2d topo_type;
typedef grid2d grid_type;
typedef point2d point_type;
@@ -95,7 +92,6 @@
const topo2d& impl_topo() const;
T impl_op_read(const point2d& p) const;
-
T& impl_op_readwrite(const point2d& p);
T* adr_at(int row, int col);
@@ -109,7 +105,6 @@
-
# ifndef OLN_INCLUDE_ONLY
template <typename T>
@@ -122,7 +117,6 @@
{
}
- /// Ctor using an existing topology.
template <typename T>
image2d<T>::image2d(const topo2d& topo)
: topo_(topo),
@@ -173,6 +167,7 @@
# endif
+
} // end of namespace oln
Index: oln/basics2d.hh
--- oln/basics2d.hh (revision 623)
+++ oln/basics2d.hh (working copy)
@@ -38,6 +38,11 @@
# include <oln/core/2d/dpoint2d.hh>
# include <oln/core/gen/bbox.hh>
+// FIXME: Inexplicably, this explicit instantiation is required to
+// have topo_lbbox_<point2d> work. See if we can get rid of it.
+namespace oln {
+ template class bbox_<point2d>;
+}
# include <oln/core/gen/topo_lbbox.hh>
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Reorganize and fix oln/core/1d/.
* oln/core/1d/aliases.hh (oln::fwd_piter1d, oln::bkd_piter1d): Fix
their definitions.
* oln/core/1d/neighb1d.hh (oln::c2): Rename as...
(oln::mk_c2): ...this.
(c2): New object.
* oln/core/1d/array1d.hh, oln/core/1d/dpoint1d.hh,
* oln/core/1d/image1d.hh, oln/core/1d/neighb1d.hh,
* oln/core/1d/point1d.hh: Separate the interface of the methods
and functions from their implementation.
* oln/core/1d/image1d.hh (oln::vtypes< image1d<T> >): Set
topo_type to topo1d.
(bbox_<point1d>): Move explicit instantiation...
* oln/basics1d.hh: ...here
(oln/core/fwd_piter.hh): Include it.
* oln/core/1d/image1d.hh:
Move the definition of the virtual types fwd_piter and bkd_piter
of oln::image1d...
* oln/core/fwd_piter.hh: ...here.
* oln/core/abstract/image/hybrid/classical.hh
(oln::abstract:classical_1d_image)
(oln::case_<image_hybrid_hierarchy_wrt_classical, E, 1>)
(oln::case_<image_hybrid_hierarchy_wrt_classical, E, 2>): Rename
as...
(oln::case_<image_hybrid_hierarchy_wrt_classical, E, 2>)
(oln::case_<image_hybrid_hierarchy_wrt_classical, E, 3>):
...these.
(oln::case_<image_hybrid_hierarchy_wrt_classical, E, 1>): New.
Handle 1D case.
basics1d.hh | 9 +++-
core/1d/aliases.hh | 5 --
core/1d/array1d.hh | 70 ++++++++++++++++++++++---------
core/1d/dpoint1d.hh | 37 ++++++++++++----
core/1d/image1d.hh | 72 +++++++++++++++++++++++---------
core/1d/neighb1d.hh | 26 +++++++++++
core/1d/point1d.hh | 44 +++++++++++++++----
core/abstract/image/hybrid/classical.hh | 33 +++++++++++++-
core/fwd_piter.hh | 17 +++++++
9 files changed, 249 insertions(+), 64 deletions(-)
Index: oln/core/1d/aliases.hh
--- oln/core/1d/aliases.hh (revision 622)
+++ oln/core/1d/aliases.hh (working copy)
@@ -55,14 +55,13 @@
typedef bbox_<point1d> bbox1d;
typedef topo_lbbox_<point1d> topo1d;
- typedef fwd_piter_bbox_<topo1d> fwd_piter1d;
- typedef bkd_piter_bbox_<topo1d> bkd_piter1d;
+ typedef fwd_piter_bbox_<point1d> fwd_piter1d;
+ typedef bkd_piter_bbox_<point1d> bkd_piter1d;
typedef point1d_<float> point1df;
typedef dpoint1d_<float> dpoint1df;
/// \}
-
} // end of namespace oln
Index: oln/core/1d/neighb1d.hh
--- oln/core/1d/neighb1d.hh (revision 622)
+++ oln/core/1d/neighb1d.hh (working copy)
@@ -36,7 +36,15 @@
namespace oln
{
- neighb1d c2()
+ namespace internal
+ {
+
+ neighb1d mk_c2();
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ neighb1d mk_c2()
{
static bool flower = true;
static neighb1d the_;
@@ -48,6 +56,22 @@
return the_;
}
+# endif
+
+
+ } // end of namespace oln::internal
+
+
+ extern const neighb1d c2;
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ const neighb1d c2 = internal::mk_c2();
+
+# endif
+
+
} // end of namespace oln
Index: oln/core/1d/array1d.hh
--- oln/core/1d/array1d.hh (revision 622)
+++ oln/core/1d/array1d.hh (working copy)
@@ -43,7 +43,38 @@
public:
/// Ctor.
- array1d(coord_t min, coord_t max) :
+ array1d(coord_t min, coord_t max);
+ /// Ctor.
+ array1d(coord_t len);
+
+ /// Dtor.
+ ~array1d();
+
+ value_t operator()(coord_t i) const;
+ value_t& operator()(coord_t i);
+
+ bool has(coord_t i) const;
+
+ size_t memsize() const;
+
+ protected:
+
+ coord_t min_, max_;
+ coord_t len_;
+ value_t* buffer_;
+
+ private:
+
+ void allocate_();
+ void deallocate_();
+ };
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename value_t, typename coord_t>
+ array1d<value_t, coord_t>::array1d(coord_t min, coord_t max) :
min_(min), max_(max)
{
precondition(max >= min);
@@ -51,8 +82,8 @@
allocate_();
}
- /// Ctor.
- array1d(coord_t len) :
+ template <typename value_t, typename coord_t>
+ array1d<value_t, coord_t>::array1d(coord_t len) :
min_(0), len_(len)
{
precondition(len > 0);
@@ -60,55 +91,54 @@
allocate_();
}
- /// Dtor.
- ~array1d()
+ template <typename value_t, typename coord_t>
+ array1d<value_t, coord_t>::~array1d()
{
deallocate_();
}
- value_t operator()(coord_t i) const
+ template <typename value_t, typename coord_t>
+ value_t array1d<value_t, coord_t>::operator()(coord_t i) const
{
precondition(has(i));
return buffer_[i - min_];
}
- value_t& operator()(coord_t i)
+ template <typename value_t, typename coord_t>
+ value_t& array1d<value_t, coord_t>::operator()(coord_t i)
{
precondition(has(i));
return buffer_[i - min_];
}
- bool has(coord_t i) const
+ template <typename value_t, typename coord_t>
+ bool array1d<value_t, coord_t>::has(coord_t i) const
{
return
i >= min_ and i <= max_;
}
- size_t memsize() const
+ template <typename value_t, typename coord_t>
+ size_t array1d<value_t, coord_t>::memsize() const
{
return size_t(len_) * sizeof(value_t);
}
- protected:
-
- coord_t min_, max_;
- coord_t len_;
- value_t* buffer_;
-
- private:
-
- void allocate_()
+ template <typename value_t, typename coord_t>
+ void array1d<value_t, coord_t>::allocate_()
{
buffer_ = new value_t[size_t(len_)];
}
- void deallocate_()
+ template <typename value_t, typename coord_t>
+ void array1d<value_t, coord_t>::deallocate_()
{
precondition(buffer_ != 0);
delete[] buffer_;
buffer_ = 0; // safety
}
- };
+
+# endif
} // end of namespace oln
Index: oln/core/1d/dpoint1d.hh
--- oln/core/1d/dpoint1d.hh (revision 622)
+++ oln/core/1d/dpoint1d.hh (working copy)
@@ -68,36 +68,57 @@
{
typedef dpoint1d_<C> self_t;
typedef stc_get_super(dpoint1d_<C>) super_t;
- typedef oln_type_of(self_t, coord) coord_t;
using super_t::v_;
public:
/// Ctor.
- dpoint1d_()
+ dpoint1d_();
+
+ /// Ctor.
+ dpoint1d_(const xtd::vec<1,C>& v);
+
+ /// Ctor.
+ dpoint1d_(C index);
+
+ C index() const;
+ C& index();
+ };
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename C>
+ dpoint1d_<C>::dpoint1d_()
{
}
/// Ctor.
- dpoint1d_(const xtd::vec<1,coord_t>& v)
+ template <typename C>
+ dpoint1d_<C>::dpoint1d_(const xtd::vec<1,C>& v)
: super_t(v)
{
}
/// Ctor.
- dpoint1d_(coord_t index)
+ template <typename C>
+ dpoint1d_<C>::dpoint1d_(C index)
: super_t(xtd::mk_vec(index))
{
}
- coord_t index() const { return v_[0]; }
- coord_t& index() { return v_[0]; }
- };
+ template <typename C>
+ C dpoint1d_<C>::index() const { return v_[0]; }
+ template <typename C>
+ C& dpoint1d_<C>::index() { return v_[0]; }
+
+# endif
-} // end of namespace oln
+} // end of namespace oln
#endif // ! OLN_CORE_1D_DPOINT1D_HH
Index: oln/core/1d/image1d.hh
--- oln/core/1d/image1d.hh (revision 622)
+++ oln/core/1d/image1d.hh (working copy)
@@ -36,16 +36,14 @@
# include <oln/core/internal/tracked_ptr.hh>
// For topo1d.
# include <oln/core/1d/aliases.hh>
+// For fwd_piter and bkd_piter virtual types.
+// FIXME: Really necessary?
+# include <oln/core/fwd_piter.hh>
namespace oln
{
- // FIXME: Inexplicably, this explicit instantiation is required to
- // have topo_lbbox_<point1d> work. See if we can get rid of it.
- template class bbox_<point1d>;
-
-
// Forward declaration.
template <typename T> class image1d;
@@ -54,14 +52,11 @@
template <typename T>
struct vtypes< image1d<T> >
{
- typedef topo_lbbox_<point1d> topo_type;
+ typedef topo1d topo_type;
typedef grid1d grid_type;
typedef point1d point_type;
- typedef fwd_piter_bbox_<topo_type> fwd_piter_type;
- typedef bkd_piter_bbox_<topo_type> bkd_piter_type;
-
typedef T value_type;
typedef T lvalue_type;
typedef mlc::true_ is_mutable_type;
@@ -89,45 +84,84 @@
public:
/// Ctor using sizes.
- image1d(unsigned nindices, unsigned border = 2)
+ image1d(unsigned nindices, unsigned border = 2);
+
+ /// Ctor using an existing topology.
+ image1d(const topo1d& topo);
+
+ const topo1d& impl_topo() const;
+
+ T impl_op_read(const point1d& p) const;
+ T& impl_op_readwrite(const point1d& p);
+
+ T* adr_at(int index);
+ const T* adr_at(int index) const;
+
+ private:
+
+ topo1d topo_;
+ internal::tracked_ptr<array_t> data_;
+ };
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename T>
+ image1d<T>::image1d(unsigned nindices, unsigned border)
: topo_(bbox1d(point1d(0), point1d(nindices - 1)), border),
data_(new array_t(0 - border,
nindices - 1 + border))
{
}
- /// Ctor using an existing topology.
- image1d(const topo1d& topo)
+ template <typename T>
+ image1d<T>::image1d(const topo1d& topo)
: topo_(topo),
data_(new array_t(topo.bbox().pmin().index(),
topo.bbox().pmax().index()))
{
}
- const topo1d& impl_topo() const
+ template <typename T>
+ const topo1d& image1d<T>::impl_topo() const
{
return topo_;
}
- T impl_op_read(const point1d& p) const
+ template <typename T>
+ T image1d<T>::impl_op_read(const point1d& p) const
{
precondition(data_ != 0);
precondition(topo_.has_large(p));
return data_->operator()(p.index());
}
- T& impl_op_readwrite(const point1d& p)
+ template <typename T>
+ T& image1d<T>::impl_op_readwrite(const point1d& p)
{
precondition(data_ != 0);
precondition(topo_.has_large(p));
return data_->operator()(p.index());
}
- private:
+ template <typename T>
+ T* image1d<T>::adr_at(int index)
+ {
+ precondition(data_ != 0);
+ precondition(data_->has(index));
+ return &(data_->operator()(index));
+ }
- topo1d topo_;
- internal::tracked_ptr<array_t> data_;
- };
+ template <typename T>
+ const T* image1d<T>::adr_at(int index) const
+ {
+ precondition(data_ != 0);
+ precondition(data_->has(index));
+ return &(data_->operator()(index));
+ }
+
+# endif
} // end of namespace oln
Index: oln/core/1d/point1d.hh
--- oln/core/1d/point1d.hh (revision 622)
+++ oln/core/1d/point1d.hh (working copy)
@@ -76,32 +76,58 @@
{
typedef point1d_<C> self_t;
typedef stc_get_super(point1d_<C>) super_t;
- typedef oln_type_of(self_t, coord) coord_t;
using super_t::v_;
public:
/// Ctor.
- point1d_()
+ point1d_();
+
+ /// Ctor.
+ point1d_(C index);
+
+ /// Ctor.
+ point1d_(const xtd::vec<1,C>& v);
+
+ /// Dtor.
+ ~point1d_()
{
}
- /// Ctor.
- point1d_(coord_t index)
+ C index() const;
+ C& index();
+ };
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+
+ template <typename C>
+ point1d_<C>::point1d_()
+ {
+ }
+
+ template <typename C>
+ point1d_<C>::point1d_(C index)
: super_t (xtd::mk_vec(index))
{
}
- /// Ctor.
- point1d_(const xtd::vec<1,coord_t>& v)
+ template <typename C>
+ point1d_<C>::point1d_(const xtd::vec<1,C>& v)
: super_t(v)
{
}
- coord_t index() const { return v_[0]; }
- coord_t& index() { return v_[0]; }
- };
+ template <typename C>
+ C point1d_<C>::index() const { return v_[0]; }
+
+ template <typename C>
+ C& point1d_<C>::index() { return v_[0]; }
+
+# endif
} // end of namespace oln
Index: oln/basics1d.hh
--- oln/basics1d.hh (revision 622)
+++ oln/basics1d.hh (working copy)
@@ -35,15 +35,18 @@
# include <oln/core/1d/grid1d.hh>
# include <oln/core/1d/point1d.hh>
-
# include <oln/core/1d/dpoint1d.hh>
# include <oln/core/gen/bbox.hh>
+// FIXME: Inexplicably, this explicit instantiation is required to
+// have topo_lbbox_<point1d> work. See if we can get rid of it.
+namespace oln {
+ template class bbox_<point1d>;
+}
# include <oln/core/gen/topo_lbbox.hh>
# include <oln/core/gen/fwd_piter_bbox.hh>
-
# include <oln/core/gen/bkd_piter_bbox.hh>
# include <oln/core/gen/neighb.hh>
@@ -51,5 +54,7 @@
# include <oln/core/1d/image1d.hh>
+# include <oln/core/fwd_piter.hh>
+
#endif // ! OLN_BASICS1D_HH
Index: oln/core/fwd_piter.hh
--- oln/core/fwd_piter.hh (revision 622)
+++ oln/core/fwd_piter.hh (working copy)
@@ -111,6 +111,23 @@
};
+ // image1d<T>
+
+ template <typename T> class image1d;
+
+ template <typename T>
+ struct single_vtype< image1d<T>, typedef_::fwd_piter_type >
+ {
+ typedef fwd_piter1d ret;
+ };
+
+ template <typename T>
+ struct single_vtype< image1d<T>, typedef_::bkd_piter_type >
+ {
+ typedef bkd_piter1d ret;
+ };
+
+
// image2d<T>
template <typename T> class image2d;
Index: oln/core/abstract/image/hybrid/classical.hh
--- oln/core/abstract/image/hybrid/classical.hh (revision 622)
+++ oln/core/abstract/image/hybrid/classical.hh (working copy)
@@ -31,6 +31,7 @@
# include <oln/core/abstract/image.hh>
# include <oln/core/abstract/image/hierarchies.hh>
+# include <oln/core/abstract/image/dimension/1d.hh>
# include <oln/core/abstract/image/dimension/2d.hh>
# include <oln/core/abstract/image/bbox/hierarchy.hh>
# include <oln/core/abstract/image/accessibility/hierarchy.hh>
@@ -52,6 +53,15 @@
};
template <typename E>
+ struct classical_1d_image
+ : public virtual abstract::classical_image<E>,
+ public virtual abstract::image1d<E>
+ {
+ protected:
+ classical_1d_image();
+ };
+
+ template <typename E>
struct classical_2d_image
: public virtual abstract::classical_image<E>,
public virtual abstract::image2d<E>
@@ -69,6 +79,11 @@
}
template <typename E>
+ classical_1d_image<E>::classical_1d_image()
+ {
+ }
+
+ template <typename E>
classical_2d_image<E>::classical_2d_image()
{
}
@@ -79,12 +94,26 @@
// Fwd. decl.
+ class grid1d;
class grid2d;
- /// 2-D case.
+ /// 1D case.
template <typename E>
struct case_< image_hybrid_hierarchy_wrt_classical, E, 1 > :
+ where_< mlc::and_list_< mlc::eq_< oln_type_of(E, grid), oln::grid1d >,
+ mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ >,
+ mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found >
+ >
+ >
+ {
+ typedef abstract::classical_1d_image<E> ret;
+ };
+
+
+ /// 2D case.
+ template <typename E>
+ struct case_< image_hybrid_hierarchy_wrt_classical, E, 2 > :
where_< mlc::and_list_< mlc::eq_< oln_type_of(E, grid), oln::grid2d >,
mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ >,
mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found >
@@ -97,7 +126,7 @@
/// General case.
template <typename E>
- struct case_< image_hybrid_hierarchy_wrt_classical, E, 2 > :
+ struct case_< image_hybrid_hierarchy_wrt_classical, E, 3 > :
where_< mlc::and_< mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ >,
mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found >
>
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
* oln/core/abstract/image/dimension/1d.hh
* oln/core/abstract/image/dimension/2d.hh
* oln/core/abstract/image/dimension/3d.hh
* oln/core/abstract/image/dimension/hierarchy.hh
* oln/core/1d/grid1d.hh, oln/core/2d/grid2d.hh,
* oln/core/3d/grid3d.hh, oln/core/2d/array2d.hh,
* oln/core/2d/dpoint2d.hh, oln/core/2d/point2d.hh,
* tests/image1d.cc, tests/image2d.cc, tests/image3d.cc,
* tests/image_entry.cc, tests/io_pnm.cc, tests/Makefile.am:
Aesthetic changes.
oln/core/1d/grid1d.hh | 2 +-
oln/core/2d/array2d.hh | 9 +--------
oln/core/2d/dpoint2d.hh | 1 +
oln/core/2d/grid2d.hh | 2 +-
oln/core/2d/point2d.hh | 5 -----
oln/core/3d/grid3d.hh | 2 +-
oln/core/abstract/image/dimension/1d.hh | 2 +-
oln/core/abstract/image/dimension/2d.hh | 2 +-
oln/core/abstract/image/dimension/3d.hh | 2 +-
oln/core/abstract/image/dimension/hierarchy.hh | 6 +++---
tests/Makefile.am | 4 +++-
tests/image1d.cc | 6 +++---
tests/image2d.cc | 6 +++---
tests/image3d.cc | 6 +++---
tests/image_entry.cc | 2 +-
tests/io_pnm.cc | 1 -
16 files changed, 24 insertions(+), 34 deletions(-)
Index: oln/core/abstract/image/dimension/1d.hh
--- oln/core/abstract/image/dimension/1d.hh (revision 621)
+++ oln/core/abstract/image/dimension/1d.hh (working copy)
@@ -37,7 +37,7 @@
namespace abstract
{
- /// Class of 1-D images.
+ /// Class of 1D images.
template <typename E>
struct image1d :
public virtual image<E>,
Index: oln/core/abstract/image/dimension/2d.hh
--- oln/core/abstract/image/dimension/2d.hh (revision 621)
+++ oln/core/abstract/image/dimension/2d.hh (working copy)
@@ -37,7 +37,7 @@
namespace abstract
{
- /// Class of 2-D images.
+ /// Class of 2D images.
template <typename E>
struct image2d :
public virtual image<E>,
Index: oln/core/abstract/image/dimension/3d.hh
--- oln/core/abstract/image/dimension/3d.hh (revision 621)
+++ oln/core/abstract/image/dimension/3d.hh (working copy)
@@ -37,7 +37,7 @@
namespace abstract
{
- /// Class of 3-D images.
+ /// Class of 3D images.
template <typename E>
struct image3d :
public virtual image<E>,
Index: oln/core/abstract/image/dimension/hierarchy.hh
--- oln/core/abstract/image/dimension/hierarchy.hh (revision 621)
+++ oln/core/abstract/image/dimension/hierarchy.hh (working copy)
@@ -91,7 +91,7 @@
class grid2d;
class grid3d;
- /// 1-D case.
+ /// 1D case.
template <typename E>
struct case_< image_hierarchy_wrt_dimension, E, 1 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid1d > >
@@ -99,7 +99,7 @@
typedef abstract::image1d<E> ret;
};
- /// 2-D case.
+ /// 2D case.
template <typename E>
struct case_< image_hierarchy_wrt_dimension, E, 2 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid2d > >
@@ -107,7 +107,7 @@
typedef abstract::image2d<E> ret;
};
- /// 3-D case.
+ /// 3D case.
template <typename E>
struct case_< image_hierarchy_wrt_dimension, E, 3 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid3d > >
Index: oln/core/1d/grid1d.hh
--- oln/core/1d/grid1d.hh (revision 621)
+++ oln/core/1d/grid1d.hh (working copy)
@@ -48,7 +48,7 @@
typedef mlc::uint_<1> dimvalue_type;
};
- /// A 1-dimension grid.
+ /// A 1D grid.
struct grid1d : public stc_get_supers(grid1d)
{
protected:
Index: oln/core/2d/grid2d.hh
--- oln/core/2d/grid2d.hh (revision 621)
+++ oln/core/2d/grid2d.hh (working copy)
@@ -48,7 +48,7 @@
typedef mlc::uint_<2> dimvalue_type;
};
- /// A 2-dimension rectangular grid.
+ /// A 2D rectangular grid.
struct grid2d : public stc_get_supers(grid2d)
{
protected:
Index: oln/core/3d/grid3d.hh
--- oln/core/3d/grid3d.hh (revision 621)
+++ oln/core/3d/grid3d.hh (working copy)
@@ -47,7 +47,7 @@
typedef mlc::uint_<3> dimvalue_type;
};
- /// A 3-dimension cubic grid.
+ /// A 3D cubic grid.
struct grid3d : public stc_get_supers(grid3d)
{
protected:
Index: oln/core/2d/array2d.hh
--- oln/core/2d/array2d.hh (revision 621)
+++ oln/core/2d/array2d.hh (working copy)
@@ -43,9 +43,7 @@
public:
/// Ctor.
- array2d(coord_t imin, coord_t jmin,
- coord_t imax, coord_t jmax);
-
+ array2d(coord_t imin, coord_t jmin, coord_t imax, coord_t jmax);
/// Ctor.
array2d(coord_t ilen, coord_t jlen);
@@ -53,7 +51,6 @@
~array2d();
value_t operator()(coord_t i, coord_t j) const;
-
value_t& operator()(coord_t i, coord_t j);
bool has(coord_t i, coord_t j) const;
@@ -70,13 +67,11 @@
private:
void allocate_();
-
void deallocate_();
};
-
# ifndef OLN_INCLUDE_ONLY
template <typename value_t, typename coord_t>
@@ -94,7 +89,6 @@
}
template <typename value_t, typename coord_t>
- /// Ctor.
array2d<value_t, coord_t>::array2d(coord_t ilen, coord_t jlen) :
imin_(0),
jmin_(0),
@@ -108,7 +102,6 @@
}
template <typename value_t, typename coord_t>
- /// Dtor.
array2d<value_t, coord_t>::~array2d()
{
deallocate_();
Index: oln/core/2d/dpoint2d.hh
--- oln/core/2d/dpoint2d.hh (revision 621)
+++ oln/core/2d/dpoint2d.hh (working copy)
@@ -91,6 +91,7 @@
};
+
# ifndef OLN_INCLUDE_ONLY
template <typename C>
Index: oln/core/2d/point2d.hh
--- oln/core/2d/point2d.hh (revision 621)
+++ oln/core/2d/point2d.hh (working copy)
@@ -124,11 +124,6 @@
{
}
-// template <typename C>
-// point2d_<C>::~point2d_()
-// {
-// }
-
template <typename C>
C point2d_<C>::row() const { return v_[0]; }
Index: tests/image1d.cc
--- tests/image1d.cc (revision 621)
+++ tests/image1d.cc (working copy)
@@ -36,18 +36,18 @@
int
main()
{
- // Fill a 1-d image using its iterator.
+ // Fill a 1D image using its iterator.
oln::image1d<char> ima1(3);
oln_type_of_(oln::image1d<char>, piter) p1(ima1.topo());
for_all(p1)
ima1(p1) = 1;
- // Fill a 1-d image using a classic loop.
+ // Fill a 1D image using a classic loop.
oln::image1d<int> ima2(ima1.topo());
for (unsigned i = 0; i < 3; ++i)
ima2(oln::point1d(i)) = 2;
- // Fill a 1-d image using the routine oln::level::fill.
+ // Fill a 1D image using the routine oln::level::fill.
oln::image1d<long> ima3(ima1.topo());
oln::level::fill(ima3, 3);
Index: tests/image2d.cc
--- tests/image2d.cc (revision 621)
+++ tests/image2d.cc (working copy)
@@ -36,19 +36,19 @@
int
main()
{
- // Fill a 2-d image using its iterator.
+ // Fill a 2D image using its iterator.
oln::image2d<char> ima1(3, 3);
oln_type_of_(oln::image2d<char>, piter) p1(ima1.topo());
for_all(p1)
ima1(p1) = 1;
- // Fill a 2-d image using a classic loop.
+ // Fill a 2D image using a classic loop.
oln::image2d<int> ima2(ima1.topo());
for (unsigned i = 0; i < 3; ++i)
for (unsigned j = 0; j < 3; ++j)
ima2(oln::point2d(i, j)) = 2;
- // Fill a 2-d image using the routine oln::level::fill.
+ // Fill a 2D image using the routine oln::level::fill.
oln::image2d<long> ima3(ima1.topo());
oln::level::fill(ima3, 3);
Index: tests/image3d.cc
--- tests/image3d.cc (revision 621)
+++ tests/image3d.cc (working copy)
@@ -36,20 +36,20 @@
int
main()
{
- // Fill a 3-d image using its iterator.
+ // Fill a 3D image using its iterator.
oln::image3d<char> ima1(3, 3, 3);
oln_type_of_(oln::image3d<char>, piter) p1(ima1.topo());
for_all(p1)
ima1(p1) = 1;
- // Fill a 3-d image using a classic loop.
+ // Fill a 3D image using a classic loop.
oln::image3d<int> ima2(ima1.topo());
for (unsigned i = 0; i < 3; ++i)
for (unsigned j = 0; j < 3; ++j)
for (unsigned k = 0; k < 3; ++k)
ima2(oln::point3d(i, j, k)) = 2;
- // Fill a 3-d image using the routine oln::level::fill.
+ // Fill a 3D image using the routine oln::level::fill.
oln::image3d<long> ima3(ima1.topo());
oln::level::fill(ima3, 3);
Index: tests/image_entry.cc
--- tests/image_entry.cc (revision 621)
+++ tests/image_entry.cc (working copy)
@@ -72,7 +72,7 @@
namespace my
{
- // A very simple 1-D image.
+ // A very simple 1D image.
class image : public oln::get_super_types<my::image>::ret
{
public:
Index: tests/io_pnm.cc
--- tests/io_pnm.cc (revision 621)
+++ tests/io_pnm.cc (working copy)
@@ -34,7 +34,6 @@
int
main()
{
- // Fill a 2-d image using its iterator.
oln::image2d<bool> ima = oln::io::load_pbm("../img/chien.pbm");
oln::image2d<unsigned char> ima2 = oln::io::load_pgm("../img/lena32.pgm");
}
Index: tests/Makefile.am
--- tests/Makefile.am (revision 621)
+++ tests/Makefile.am (working copy)
@@ -46,6 +46,9 @@
npoints_SOURCES = npoints.cc
window2d_SOURCES = window2d.cc
+# I/O.
+io_pnm_SOURCES = io_pnm.cc
+
# Morphers.
identity_morpher_SOURCES = identity_morpher.cc
add_neighborhood_morpher_SOURCES = add_neighborhood_morpher.cc
@@ -53,7 +56,6 @@
# Algorithms.
fill_SOURCES = fill.cc
-io_pnm_SOURCES = io_pnm.cc
TESTS = $(check_PROGRAMS)
1
0
12 Oct '06
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add static assertions to oln::topo_bbox_ and oln::topo_lbbox_.
* oln/core/gen/topo_bbox.hh (oln::topo_bbox_<point>)
* oln/core/gen/topo_lbbox.hh (oln::topo_lbbox_<point>): Ensure
parameter point is an oln::abstract::point.
topo_bbox.hh | 4 +++-
topo_lbbox.hh | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
Index: oln/core/gen/topo_bbox.hh
--- oln/core/gen/topo_bbox.hh (revision 620)
+++ oln/core/gen/topo_bbox.hh (working copy)
@@ -60,7 +60,9 @@
/// Bounding box topology based on a point class.
template <typename point>
- class topo_bbox_ : public topology_entry< topo_bbox_<point> >
+ class topo_bbox_ :
+ public topology_entry< topo_bbox_<point> >,
+ private mlc::assert_< mlc_is_a(point, abstract::point) >
{
typedef topo_bbox_<point> self_t;
typedef topology_entry<self_t> super_t;
Index: oln/core/gen/topo_lbbox.hh
--- oln/core/gen/topo_lbbox.hh (revision 620)
+++ oln/core/gen/topo_lbbox.hh (working copy)
@@ -62,7 +62,9 @@
/// Bounding box topology based on a point class.
template <typename point>
- class topo_lbbox_ : public topology_entry< topo_lbbox_<point> >
+ class topo_lbbox_ :
+ public topology_entry< topo_lbbox_<point> >,
+ private mlc::assert_< mlc_is_a(point, abstract::point) >
{
typedef bbox_<point> bbox_t;
1
0
11 Oct '06
2006-10-11 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add new facilities to access to components such as row, col, etc.
* oln/core/spe/row.hh: New.
* oln/core/spe/col.hh: New.
* oln/core/spe/slice.hh: New.
* oln/debug/print.hh (print): Use min_row, etc.
(include): Update.
* oln/core/typedefs.hh (index_comp_type): New.
(row_comp_type, col_comp_type, slice_comp_type): New.
(vec_type): New.
* oln/core/abstract/iterator_on_points.hh (coord_type): New.
* oln/core/abstract/point.hh (vec_type): New.
(vec): New.
* oln/core/1d/dpoint1d.hh (index_comp_type): New.
* oln/core/1d/point1d.hh (index_comp_type): New.
* oln/core/2d/dpoint2d.hh (row_comp_type, col_comp_type): New.
* oln/core/2d/point2d.hh (row_comp_type, col_comp_type): New.
* oln/core/3d/dpoint3d.hh
(slice_comp_type, row_comp_type, col_comp_type): New.
* oln/core/3d/point3d.hh
(slice_comp_type, row_comp_type, col_comp_type): New.
* oln/core/internal/point_nd.hh (vec_t): New.
(vec): Rename as...
(impl_vec): this.
* oln/basics2d.hh (include): Update.
* oln/basics3d.hh (include): Update.
* oln/Makefile.am (nobase_oln_HEADERS): Update.
Index: oln/debug/print.hh
===================================================================
--- oln/debug/print.hh (revision 619)
+++ oln/debug/print.hh (working copy)
@@ -32,6 +32,8 @@
# include <oln/core/abstract/image.hh>
# include <oln/core/abstract/image/hybrid/classical.hh>
# include <oln/core/abstract/iterator.hh>
+# include <oln/core/spe/row.hh>
+# include <oln/core/spe/col.hh>
# include <oln/core/2d/point2d.hh>
@@ -50,6 +52,7 @@
template <typename I>
void println(const abstract::image<I>& input, std::ostream& ostr = std::cout);
+
# ifndef OLN_INCLUDE_ONLY
namespace impl
@@ -82,9 +85,9 @@
void print(const abstract::classical_2d_image<I>& input,
std::ostream& ostr)
{
- for (int row = input.pmin().row(); row <= input.pmax().row(); ++row)
+ for (int row = min_row(input); row <= max_row(input); ++row)
{
- for (int col = input.pmin().col(); col <= input.pmax().col(); ++col)
+ for (int col = min_col(input); col <= max_col(input); ++col)
{
point2d p(row, col);
if (input.has(p))
Index: oln/core/typedefs.hh
===================================================================
--- oln/core/typedefs.hh (revision 619)
+++ oln/core/typedefs.hh (working copy)
@@ -74,7 +74,12 @@
mlc_decl_typedef(grid_type);
+ mlc_decl_typedef(index_comp_type);
+ mlc_decl_typedef(row_comp_type);
+ mlc_decl_typedef(col_comp_type);
+ mlc_decl_typedef(slice_comp_type);
+
/*------------.
| Iterators. |
`------------*/
@@ -182,6 +187,7 @@
`-----------------*/
mlc_decl_typedef(dim_type);
+ mlc_decl_typedef(vec_type);
/*------------------------------------.
Index: oln/core/spe/row.hh
===================================================================
--- oln/core/spe/row.hh (revision 0)
+++ oln/core/spe/row.hh (revision 0)
@@ -0,0 +1,155 @@
+// Copyright (C) 2006 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, 51 Franklin Street, Fifth Floor,
+// 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 OLN_CORE_SPE_ROW_HH
+# define OLN_CORE_SPE_ROW_HH
+
+# include <mlc/value.hh>
+# include <oln/core/abstract/point.hh>
+# include <oln/core/abstract/dpoint.hh>
+# include <oln/core/abstract/point_set.hh>
+# include <oln/core/abstract/image.hh>
+# include <oln/core/abstract/iterator_on_points.hh>
+
+
+namespace oln
+{
+
+ template <typename P>
+ oln_coord(P) row(const abstract::point<P>& p);
+
+ template <typename P>
+ oln_coord(P)& row(abstract::point<P>& p);
+
+
+ template <typename D>
+ oln_coord(D) row(const abstract::dpoint<D>& dp);
+
+ template <typename D>
+ oln_coord(D)& row(abstract::dpoint<D>& dp);
+
+
+ template <typename It>
+ oln_coord(It) row(const abstract::iterator_on_points<It>& it);
+
+
+ template <typename Ps>
+ oln_coord(Ps) min_row(const abstract::point_set_having_bbox<Ps>& ps);
+
+ template <typename Ps>
+ oln_coord(Ps) max_row(const abstract::point_set_having_bbox<Ps>& ps);
+
+
+ template <typename I>
+ oln_coord(I) min_row(const abstract::image_having_bbox<I>& ima);
+
+ template <typename I>
+ oln_coord(I) max_row(const abstract::image_having_bbox<I>& ima);
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ // From point.
+
+ template <typename P>
+ oln_coord(P) row(const abstract::point<P>& p)
+ {
+ typedef oln_type_of(P, row_comp) comp_t;
+ return p.vec()[mlc_value(comp_t)];
+ }
+
+ template <typename P>
+ oln_coord(P)& row(abstract::point<P>& p)
+ {
+ typedef oln_type_of(P, row_comp) comp_t;
+ return p.vec()[mlc_value(comp_t)];
+ }
+
+ // From dpoint.
+
+ template <typename D>
+ oln_coord(D) row(const abstract::dpoint<D>& p)
+ {
+ typedef oln_type_of(D, row_comp) comp_t;
+ return p.vec()[mlc_value(comp_t)];
+ }
+
+ template <typename D>
+ oln_coord(D)& row(abstract::dpoint<D>& p)
+ {
+ typedef oln_type_of(D, row_comp) comp_t;
+ return p.vec()[mlc_value(comp_t)];
+ }
+
+ // From iterator.
+
+ template <typename P>
+ oln_coord(P) row(const abstract::iterator_on_points<P>& it)
+ {
+ typedef oln_deduce_type_of(P, point, row_comp) comp_t;
+ return it.to_point().vec()[mlc_value(comp_t)];
+ }
+
+ // From point set.
+
+ template <typename Ps>
+ oln_coord(Ps) min_row(const abstract::point_set_having_bbox<Ps>& ps)
+ {
+ typedef oln_deduce_type_of(Ps, point, row_comp) comp_t;
+ return ps.pmin().vec()[mlc_value(comp_t)];
+ }
+
+ template <typename Ps>
+ oln_coord(Ps) max_row(const abstract::point_set_having_bbox<Ps>& ps)
+ {
+ typedef oln_deduce_type_of(Ps, point, row_comp) comp_t;
+ return ps.pmax().vec()[mlc_value(comp_t)];
+ }
+
+ // From image.
+
+ template <typename I>
+ oln_coord(I) min_row(const abstract::image_having_bbox<I>& ps)
+ {
+ typedef oln_deduce_type_of(I, point, row_comp) comp_t;
+ return ps.pmin().vec()[mlc_value(comp_t)];
+ }
+
+ template <typename I>
+ oln_coord(I) max_row(const abstract::image_having_bbox<I>& ps)
+ {
+ typedef oln_deduce_type_of(I, point, row_comp) comp_t;
+ return ps.pmax().vec()[mlc_value(comp_t)];
+ }
+
+# endif
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_SPE_ROW_HH
Index: oln/core/spe/col.hh
===================================================================
--- oln/core/spe/col.hh (revision 0)
+++ oln/core/spe/col.hh (revision 0)
@@ -0,0 +1,155 @@
+// Copyright (C) 2006 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, 51 Franklin Street, Fifth Floor,
+// 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 OLN_CORE_SPE_COL_HH
+# define OLN_CORE_SPE_COL_HH
+
+# include <mlc/value.hh>
+# include <oln/core/abstract/point.hh>
+# include <oln/core/abstract/dpoint.hh>
+# include <oln/core/abstract/point_set.hh>
+# include <oln/core/abstract/image.hh>
+# include <oln/core/abstract/iterator_on_points.hh>
+
+
+namespace oln
+{
+
+ template <typename P>
+ oln_coord(P) col(const abstract::point<P>& p);
+
+ template <typename P>
+ oln_coord(P)& col(abstract::point<P>& p);
+
+
+ template <typename D>
+ oln_coord(D) col(const abstract::dpoint<D>& dp);
+
+ template <typename D>
+ oln_coord(D)& col(abstract::dpoint<D>& dp);
+
+
+ template <typename It>
+ oln_coord(It) col(const abstract::iterator_on_points<It>& it);
+
+
+ template <typename Ps>
+ oln_coord(Ps) min_col(const abstract::point_set_having_bbox<Ps>& ps);
+
+ template <typename Ps>
+ oln_coord(Ps) max_col(const abstract::point_set_having_bbox<Ps>& ps);
+
+
+ template <typename I>
+ oln_coord(I) min_col(const abstract::image_having_bbox<I>& ima);
+
+ template <typename I>
+ oln_coord(I) max_col(const abstract::image_having_bbox<I>& ima);
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ // From point.
+
+ template <typename P>
+ oln_coord(P) col(const abstract::point<P>& p)
+ {
+ typedef oln_type_of(P, col_comp) comp_t;
+ return p.vec()[mlc_value(comp_t)];
+ }
+
+ template <typename P>
+ oln_coord(P)& col(abstract::point<P>& p)
+ {
+ typedef oln_type_of(P, col_comp) comp_t;
+ return p.vec()[mlc_value(comp_t)];
+ }
+
+ // From dpoint.
+
+ template <typename D>
+ oln_coord(D) col(const abstract::dpoint<D>& p)
+ {
+ typedef oln_type_of(D, col_comp) comp_t;
+ return p.vec()[mlc_value(comp_t)];
+ }
+
+ template <typename D>
+ oln_coord(D)& col(abstract::dpoint<D>& p)
+ {
+ typedef oln_type_of(D, col_comp) comp_t;
+ return p.vec()[mlc_value(comp_t)];
+ }
+
+ // From iterator.
+
+ template <typename P>
+ oln_coord(P) col(const abstract::iterator_on_points<P>& it)
+ {
+ typedef oln_deduce_type_of(P, point, col_comp) comp_t;
+ return it.to_point().vec()[mlc_value(comp_t)];
+ }
+
+ // From point set.
+
+ template <typename Ps>
+ oln_coord(Ps) min_col(const abstract::point_set_having_bbox<Ps>& ps)
+ {
+ typedef oln_deduce_type_of(Ps, point, col_comp) comp_t;
+ return ps.pmin().vec()[mlc_value(comp_t)];
+ }
+
+ template <typename Ps>
+ oln_coord(Ps) max_col(const abstract::point_set_having_bbox<Ps>& ps)
+ {
+ typedef oln_deduce_type_of(Ps, point, col_comp) comp_t;
+ return ps.pmax().vec()[mlc_value(comp_t)];
+ }
+
+ // From image.
+
+ template <typename I>
+ oln_coord(I) min_col(const abstract::image_having_bbox<I>& ps)
+ {
+ typedef oln_deduce_type_of(I, point, col_comp) comp_t;
+ return ps.pmin().vec()[mlc_value(comp_t)];
+ }
+
+ template <typename I>
+ oln_coord(I) max_col(const abstract::image_having_bbox<I>& ps)
+ {
+ typedef oln_deduce_type_of(I, point, col_comp) comp_t;
+ return ps.pmax().vec()[mlc_value(comp_t)];
+ }
+
+# endif
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_SPE_COL_HH
Index: oln/core/spe/slice.hh
===================================================================
--- oln/core/spe/slice.hh (revision 0)
+++ oln/core/spe/slice.hh (revision 0)
@@ -0,0 +1,155 @@
+// Copyright (C) 2006 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, 51 Franklin Street, Fifth Floor,
+// 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 OLN_CORE_SPE_SLICE_HH
+# define OLN_CORE_SPE_SLICE_HH
+
+# include <mlc/value.hh>
+# include <oln/core/abstract/point.hh>
+# include <oln/core/abstract/dpoint.hh>
+# include <oln/core/abstract/point_set.hh>
+# include <oln/core/abstract/image.hh>
+# include <oln/core/abstract/iterator_on_points.hh>
+
+
+namespace oln
+{
+
+ template <typename P>
+ oln_coord(P) slice(const abstract::point<P>& p);
+
+ template <typename P>
+ oln_coord(P)& slice(abstract::point<P>& p);
+
+
+ template <typename D>
+ oln_coord(D) slice(const abstract::dpoint<D>& dp);
+
+ template <typename D>
+ oln_coord(D)& slice(abstract::dpoint<D>& dp);
+
+
+ template <typename It>
+ oln_coord(It) slice(const abstract::iterator_on_points<It>& it);
+
+
+ template <typename Ps>
+ oln_coord(Ps) min_slice(const abstract::point_set_having_bbox<Ps>& ps);
+
+ template <typename Ps>
+ oln_coord(Ps) max_slice(const abstract::point_set_having_bbox<Ps>& ps);
+
+
+ template <typename I>
+ oln_coord(I) min_slice(const abstract::image_having_bbox<I>& ima);
+
+ template <typename I>
+ oln_coord(I) max_slice(const abstract::image_having_bbox<I>& ima);
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ // From point.
+
+ template <typename P>
+ oln_coord(P) slice(const abstract::point<P>& p)
+ {
+ typedef oln_type_of(P, slice_comp) comp_t;
+ return p.vec()[mlc_value(comp_t)];
+ }
+
+ template <typename P>
+ oln_coord(P)& slice(abstract::point<P>& p)
+ {
+ typedef oln_type_of(P, slice_comp) comp_t;
+ return p.vec()[mlc_value(comp_t)];
+ }
+
+ // From dpoint.
+
+ template <typename D>
+ oln_coord(D) slice(const abstract::dpoint<D>& p)
+ {
+ typedef oln_type_of(D, slice_comp) comp_t;
+ return p.vec()[mlc_value(comp_t)];
+ }
+
+ template <typename D>
+ oln_coord(D)& slice(abstract::dpoint<D>& p)
+ {
+ typedef oln_type_of(D, slice_comp) comp_t;
+ return p.vec()[mlc_value(comp_t)];
+ }
+
+ // From iterator.
+
+ template <typename P>
+ oln_coord(P) slice(const abstract::iterator_on_points<P>& it)
+ {
+ typedef oln_deduce_type_of(P, point, slice_comp) comp_t;
+ return it.to_point().vec()[mlc_value(comp_t)];
+ }
+
+ // From point set.
+
+ template <typename Ps>
+ oln_coord(Ps) min_slice(const abstract::point_set_having_bbox<Ps>& ps)
+ {
+ typedef oln_deduce_type_of(Ps, point, slice_comp) comp_t;
+ return ps.pmin().vec()[mlc_value(comp_t)];
+ }
+
+ template <typename Ps>
+ oln_coord(Ps) max_slice(const abstract::point_set_having_bbox<Ps>& ps)
+ {
+ typedef oln_deduce_type_of(Ps, point, slice_comp) comp_t;
+ return ps.pmax().vec()[mlc_value(comp_t)];
+ }
+
+ // From image.
+
+ template <typename I>
+ oln_coord(I) min_slice(const abstract::image_having_bbox<I>& ps)
+ {
+ typedef oln_deduce_type_of(I, point, slice_comp) comp_t;
+ return ps.pmin().vec()[mlc_value(comp_t)];
+ }
+
+ template <typename I>
+ oln_coord(I) max_slice(const abstract::image_having_bbox<I>& ps)
+ {
+ typedef oln_deduce_type_of(I, point, slice_comp) comp_t;
+ return ps.pmax().vec()[mlc_value(comp_t)];
+ }
+
+# endif
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_SPE_SLICE_HH
Index: oln/core/abstract/iterator_on_points.hh
===================================================================
--- oln/core/abstract/iterator_on_points.hh (revision 619)
+++ oln/core/abstract/iterator_on_points.hh (working copy)
@@ -56,7 +56,14 @@
typedef mlc::undefined point_type;
};
+ template <typename E>
+ struct single_vtype< abstract::iterator_on_points<E>, typedef_::coord_type >
+ {
+ typedef oln_type_of(E, point) point_t;
+ typedef oln_type_of(point_t, coord) ret;
+ };
+
namespace abstract
{
Index: oln/core/abstract/point.hh
===================================================================
--- oln/core/abstract/point.hh (revision 619)
+++ oln/core/abstract/point.hh (working copy)
@@ -60,9 +60,18 @@
typedef mlc::undefined dpoint_type;
typedef mlc::undefined coord_type;
typedef mlc::undefined dim_type;
+ typedef mlc::undefined vec_type;
};
+ template <typename E>
+ struct single_vtype< abstract::point<E>, typedef_::vec_type >
+ {
+ typedef oln_type_of(E, coord) coord_t;
+ typedef oln_type_of(E, dim) dim_t;
+ typedef xtd::vec<mlc_value(dim_t), coord_t> ret;
+ };
+
namespace abstract
{
@@ -72,6 +81,7 @@
public oln::type
{
typedef oln_type_of(E, dpoint) dpoint_t;
+ typedef oln_type_of(E, vec) vec_t;
public:
@@ -197,6 +207,10 @@
/// \}
+ const vec_t& vec() const;
+ vec_t& vec();
+
+
~point()
{
// FIXME: See code below.
@@ -388,8 +402,23 @@
}
template <typename E>
+ const typename point<E>::vec_t&
+ point<E>::vec() const
+ {
+ return this->exact().impl_vec();
+ }
+
+ template <typename E>
+ typename point<E>::vec_t&
+ point<E>::vec()
+ {
+ return this->exact().impl_vec();
+ }
+
+ template <typename E>
point<E>::point()
- {}
+ {
+ }
// template <typename E>
// point<E>::~point()
Index: oln/core/1d/dpoint1d.hh
===================================================================
--- oln/core/1d/dpoint1d.hh (revision 619)
+++ oln/core/1d/dpoint1d.hh (working copy)
@@ -56,6 +56,8 @@
typedef point1d point_type;
typedef C coord_type;
typedef mlc::uint_<1> dim_type;
+
+ typedef mlc::uint_<0> index_comp_type;
};
Index: oln/core/1d/point1d.hh
===================================================================
--- oln/core/1d/point1d.hh (revision 619)
+++ oln/core/1d/point1d.hh (working copy)
@@ -65,6 +65,8 @@
typedef dpoint1d dpoint_type;
typedef C coord_type;
typedef mlc::uint_<1> dim_type;
+
+ typedef mlc::uint_<0> index_comp_type;
};
Index: oln/core/2d/dpoint2d.hh
===================================================================
--- oln/core/2d/dpoint2d.hh (revision 619)
+++ oln/core/2d/dpoint2d.hh (working copy)
@@ -56,6 +56,9 @@
typedef point2d point_type;
typedef C coord_type;
typedef mlc::uint_<2> dim_type;
+
+ typedef mlc::uint_<0> row_comp_type;
+ typedef mlc::uint_<1> col_comp_type;
};
Index: oln/core/2d/point2d.hh
===================================================================
--- oln/core/2d/point2d.hh (revision 619)
+++ oln/core/2d/point2d.hh (working copy)
@@ -65,6 +65,9 @@
typedef dpoint2d dpoint_type;
typedef C coord_type;
typedef mlc::uint_<2> dim_type;
+
+ typedef mlc::uint_<0> row_comp_type;
+ typedef mlc::uint_<1> col_comp_type;
};
Index: oln/core/3d/dpoint3d.hh
===================================================================
--- oln/core/3d/dpoint3d.hh (revision 619)
+++ oln/core/3d/dpoint3d.hh (working copy)
@@ -56,6 +56,10 @@
typedef point3d point_type;
typedef C coord_type;
typedef mlc::uint_<3> dim_type;
+
+ typedef mlc::uint_<0> slice_comp_type;
+ typedef mlc::uint_<1> row_comp_type;
+ typedef mlc::uint_<2> col_comp_type;
};
Index: oln/core/3d/point3d.hh
===================================================================
--- oln/core/3d/point3d.hh (revision 619)
+++ oln/core/3d/point3d.hh (working copy)
@@ -65,6 +65,10 @@
typedef dpoint3d dpoint_type;
typedef C coord_type;
typedef mlc::uint_<3> dim_type;
+
+ typedef mlc::uint_<0> slice_comp_type;
+ typedef mlc::uint_<1> row_comp_type;
+ typedef mlc::uint_<2> col_comp_type;
};
Index: oln/core/internal/point_nd.hh
===================================================================
--- oln/core/internal/point_nd.hh (revision 619)
+++ oln/core/internal/point_nd.hh (working copy)
@@ -74,12 +74,11 @@
typedef oln_type_of(E, dim) dim;
typedef oln_type_of(E, coord) coord_t;
typedef oln_type_of(E, dpoint) dpoint_t;
+ typedef oln_type_of(E, vec) vec_t;
-
public:
enum { n = mlc_value(dim) };
- typedef xtd::vec<n,coord_t> vec_t;
coord_t operator[](unsigned i) const;
coord_t& operator[](unsigned i);
@@ -98,7 +97,8 @@
dpoint_t impl_minus(const self_t& rhs) const;
- const vec_t& vec() const;
+ const vec_t& impl_vec() const;
+ vec_t& impl_vec();
protected:
@@ -185,12 +185,19 @@
template <typename E>
const typename point_nd<E>::vec_t&
- point_nd<E>::vec() const
+ point_nd<E>::impl_vec() const
{
return v_;
}
template <typename E>
+ typename point_nd<E>::vec_t&
+ point_nd<E>::impl_vec()
+ {
+ return v_;
+ }
+
+ template <typename E>
point_nd<E>::point_nd()
{}
Index: oln/basics2d.hh
===================================================================
--- oln/basics2d.hh (revision 619)
+++ oln/basics2d.hh (working copy)
@@ -54,5 +54,8 @@
# include <oln/core/fwd_piter.hh>
+# include <oln/core/spe/row.hh>
+# include <oln/core/spe/col.hh>
+
#endif // ! OLN_BASICS2D_HH
Index: oln/Makefile.am
===================================================================
--- oln/Makefile.am (revision 619)
+++ oln/Makefile.am (working copy)
@@ -114,6 +114,10 @@
core/gen/topo_lbbox.hh \
core/gen/window.hh \
\
+ core/spe/col.hh \
+ core/spe/row.hh \
+ core/spe/slice.hh \
+ \
core/internal/bbox_bkd_piter.hh \
core/internal/bbox_fwd_piter.hh \
core/internal/dpoint_nd.hh \
Index: oln/basics3d.hh
===================================================================
--- oln/basics3d.hh (revision 619)
+++ oln/basics3d.hh (working copy)
@@ -51,5 +51,9 @@
# include <oln/core/3d/image3d.hh>
+# include <oln/core/spe/slice.hh>
+# include <oln/core/spe/row.hh>
+# include <oln/core/spe/col.hh>
+
#endif // ! OLN_BASICS3D_HH
1
0
2006-10-11 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
New facilities related to windows and q-iterators.
* tests/window2d.cc: New.
* tests/Makefile.am (window2d_SOURCES): New.
* oln/debug/print.hh (format): New.
(print): Update; use format to correctly print 'unsigned char'.
* oln/level/fill.hh: Separate header and implementation.
(fill): Use shortcut.
* oln/core/typedefs.hh: New shortcuts oln_something(T) for
oln_type_of(T, something).
* oln/core/fwd_piter.hh (fwd_qiter_type): New.
* oln/core/abstract/window.hh: New.
* oln/core/2d/aliases.hh (window2d, fwd_qiter2d): New.
* oln/core/gen/fwd_qiter_win.hh (include): Add abstract::window.hh.
(fwd_qiter_win_): Update ctor signature.
* oln/core/gen/window.hh (grid_type): New.
(window_): Add inheritance from abstract::window.
(impl_is_valid): New.
(include): Update.
* oln/basics2d.hh (include): Add window.hh and fwd_qiter_win.hh.
* oln/Makefile.am (nobase_oln_HEADERS): Update.
Index: tests/window2d.cc
===================================================================
--- tests/window2d.cc (revision 0)
+++ tests/window2d.cc (revision 0)
@@ -0,0 +1,41 @@
+#include <oln/basics2d.hh>
+#include <oln/debug/print.hh>
+#include <oln/io/pnm.hh>
+#include <oln/morpher/add_neighborhood.hh>
+
+
+namespace test
+{
+
+ template <typename I, typename W>
+ void run(const oln::abstract::image<I>& ima,
+ const oln::abstract::window<W>& win)
+ {
+ oln_piter(I) p(ima.topo());
+ oln_qiter(I) q(p, win);
+ for_all(p)
+ {
+ std::cout << unsigned(ima(p)) << ": ";
+ for_all(q)
+ std::cout << unsigned(ima(q)) << " ";
+ std::cout << std::endl;
+ }
+ }
+
+}
+
+
+int main()
+{
+ using namespace oln;
+
+ image2d<unsigned char> ima = io::load_pgm("../img/lena32.pgm");
+ debug::println(ima);
+
+ window2d win;
+ win
+ .add(dpoint2d(-1, 0))
+ .add(dpoint2d(-2, 0));
+
+ test::run(ima, win);
+}
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am (revision 618)
+++ tests/Makefile.am (working copy)
@@ -26,6 +26,7 @@
image2d \
image3d \
npoints \
+ window2d \
\
identity_morpher \
add_neighborhood_morpher \
@@ -43,6 +44,7 @@
image2d_SOURCES = image2d.cc
image3d_SOURCES = image3d.cc
npoints_SOURCES = npoints.cc
+window2d_SOURCES = window2d.cc
# Morphers.
identity_morpher_SOURCES = identity_morpher.cc
Index: oln/debug/print.hh
===================================================================
--- oln/debug/print.hh (revision 618)
+++ oln/debug/print.hh (working copy)
@@ -44,24 +44,36 @@
/// Fwd decl.
template <typename I>
- void print(const abstract::image<I>& input, std::ostream& ostr);
+ void print(const abstract::image<I>& input, std::ostream& ostr = std::cout);
/// Fwd decl.
template <typename I>
- void println(const abstract::image<I>& input, std::ostream& ostr);
+ void println(const abstract::image<I>& input, std::ostream& ostr = std::cout);
# ifndef OLN_INCLUDE_ONLY
namespace impl
{
+ template <typename T>
+ const T& format(const T& value)
+ {
+ return value;
+ }
+
+ unsigned format(const unsigned char& value)
+ {
+ return value;
+ }
+
+
/// Generic version.
template <typename I>
void print(const abstract::image<I>& input, std::ostream& ostr)
{
oln_type_of(I, fwd_piter) p(input.topo());
for_all(p)
- ostr << p.to_point() << ':' << ima(p) << ' ';
+ ostr << p.to_point() << ':' << format(input(p)) << ' ';
}
@@ -76,7 +88,7 @@
{
point2d p(row, col);
if (input.has(p))
- ostr << input(p);
+ ostr << format(input(p));
else
ostr << '-';
ostr << ' ';
Index: oln/level/fill.hh
===================================================================
--- oln/level/fill.hh (revision 618)
+++ oln/level/fill.hh (working copy)
@@ -53,6 +53,8 @@
void fill(abstract::image<I>& input, const oln_type_of(I, value)& val);
+# ifndef OLN_INCLUDE_ONLY
+
namespace impl
{
@@ -71,7 +73,7 @@
/// Facade.
template <typename I>
- void fill(abstract::image<I>& input, const oln_type_of(I, value)& val)
+ void fill(abstract::image<I>& input, const oln_value(I)& val)
{
// Precondition.
mlc::assert_<
@@ -82,6 +84,8 @@
impl::fill(input.exact(), val);
}
+# endif
+
} // end of namespace oln::level
} // end of namespace oln
Index: oln/core/typedefs.hh
===================================================================
--- oln/core/typedefs.hh (revision 618)
+++ oln/core/typedefs.hh (working copy)
@@ -200,6 +200,63 @@
} // end of namespace oln
+
+/// \{
+/// Shortcuts formed such as "oln_something(T) means oln_type_of(T, something)".
+
+# define oln_coord(T) oln_type_of(T, coord)
+# define oln_coord_(T) oln_type_of_(T, coord)
+
+# define oln_grid(T) oln_type_of(T, grid)
+# define oln_grid_(T) oln_type_of_(T, grid)
+
+# define oln_point(T) oln_type_of(T, point)
+# define oln_point_(T) oln_type_of_(T, point)
+
+# define oln_dpoint(T) oln_type_of(T, dpoint)
+# define oln_dpoint_(T) oln_type_of_(T, dpoint)
+
+# define oln_value(T) oln_type_of(T, value)
+# define oln_value_(T) oln_type_of_(T, value)
+
+# define oln_rvalue(T) oln_type_of(T, rvalue)
+# define oln_rvalue_(T) oln_type_of_(T, rvalue)
+
+# define oln_lvalue(T) oln_type_of(T, lvalue)
+# define oln_lvalue_(T) oln_type_of_(T, lvalue)
+
+# define oln_fwd_piter(T) oln_type_of(T, fwd_piter)
+# define oln_fwd_piter_(T) oln_type_of_(T, fwd_piter)
+
+# define oln_bkd_piter(T) oln_type_of(T, bkd_piter)
+# define oln_bkd_piter_(T) oln_type_of_(T, bkd_piter)
+
+# define oln_fwd_qiter(T) oln_type_of(T, fwd_qiter)
+# define oln_fwd_qiter_(T) oln_type_of_(T, fwd_qiter)
+
+# define oln_bkd_qiter(T) oln_type_of(T, bkd_qiter)
+# define oln_bkd_qiter_(T) oln_type_of_(T, bkd_qiter)
+
+# define oln_fwd_niter(T) oln_type_of(T, fwd_niter)
+# define oln_fwd_niter_(T) oln_type_of_(T, fwd_niter)
+
+# define oln_bkd_niter(T) oln_type_of(T, bkd_niter)
+# define oln_bkd_niter_(T) oln_type_of_(T, bkd_niter)
+
+# define oln_piter(T) oln_type_of(T, fwd_piter)
+# define oln_piter_(T) oln_type_of_(T, fwd_piter)
+
+# define oln_qiter(T) oln_type_of(T, fwd_qiter)
+# define oln_qiter_(T) oln_type_of_(T, fwd_qiter)
+
+# define oln_niter(T) oln_type_of(T, fwd_niter)
+# define oln_niter_(T) oln_type_of_(T, fwd_niter)
+
+/// \}
+
+
+
+
# include <oln/core/abstract/entry.hh>
Index: oln/core/fwd_piter.hh
===================================================================
--- oln/core/fwd_piter.hh (revision 618)
+++ oln/core/fwd_piter.hh (working copy)
@@ -127,7 +127,13 @@
typedef bkd_piter2d ret;
};
+ template <typename T>
+ struct single_vtype< image2d<T>, typedef_::fwd_qiter_type >
+ {
+ typedef fwd_qiter2d ret;
+ };
+
} // end of namespace oln
Index: oln/core/abstract/window.hh
===================================================================
--- oln/core/abstract/window.hh (revision 0)
+++ oln/core/abstract/window.hh (revision 0)
@@ -0,0 +1,98 @@
+// Copyright (C) 2006 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, 51 Franklin Street, Fifth Floor,
+// 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 OLN_CORE_ABSTRACT_WINDOW_HH
+# define OLN_CORE_ABSTRACT_WINDOW_HH
+
+# include <oln/core/typedefs.hh>
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+
+ /// Abstract window class.
+ template <typename E>
+ class window : public virtual stc::any__simple<E>,
+ public virtual oln::type
+ {
+ public:
+
+ bool is_valid() const;
+
+ struct decl
+ {
+ oln_virtual_typedef(grid);
+
+ decl();
+ };
+
+ protected:
+
+ window();
+ ~window();
+
+ }; // end of class oln::abstract::window<E>
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename E>
+ bool window<E>::is_valid() const
+ {
+ return this->exact().impl_is_valid();
+ }
+
+ template <typename E>
+ window<E>::window()
+ {
+ }
+
+ template <typename E>
+ window<E>::~window()
+ {
+ decl();
+ }
+
+ template <typename E>
+ window<E>::decl::decl()
+ {
+ }
+
+# endif
+
+
+ } // end of namespace oln::abstract
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_ABSTRACT_WINDOW_HH
Index: oln/core/2d/aliases.hh
===================================================================
--- oln/core/2d/aliases.hh (revision 618)
+++ oln/core/2d/aliases.hh (working copy)
@@ -38,10 +38,12 @@
template <typename C> class point2d_;
template <typename C> class dpoint2d_;
template <typename D> class neighb_;
+ template <typename D> class window_;
template <typename P> class bbox_;
template <typename P> class topo_lbbox_;
template <typename P> class fwd_piter_bbox_;
template <typename P> class bkd_piter_bbox_;
+ template <typename P> class fwd_qiter_win_;
class grid2d;
/// \}
@@ -52,12 +54,16 @@
typedef dpoint2d_<int> dpoint2d;
typedef neighb_<dpoint2d> neighb2d;
+ typedef window_<dpoint2d> window2d;
typedef bbox_<point2d> bbox2d;
typedef topo_lbbox_<point2d> topo2d;
+
typedef fwd_piter_bbox_<point2d> fwd_piter2d;
typedef bkd_piter_bbox_<point2d> bkd_piter2d;
+ typedef fwd_qiter_win_<point2d> fwd_qiter2d;
+
typedef point2d_<float> point2df;
typedef dpoint2d_<float> dpoint2df;
/// \}
Index: oln/core/gen/fwd_qiter_win.hh
===================================================================
--- oln/core/gen/fwd_qiter_win.hh (revision 618)
+++ oln/core/gen/fwd_qiter_win.hh (working copy)
@@ -29,6 +29,7 @@
# define OLN_CORE_GEN_FWD_QITER_WIN_HH
# include <oln/core/abstract/iterator_on_points.hh>
+# include <oln/core/abstract/window.hh>
# include <oln/core/gen/window.hh>
@@ -70,12 +71,13 @@
public:
- template <typename P, typename D>
+ template <typename P, typename W>
fwd_qiter_win_(const abstract::iterator_on_points<P>& it,
- const window_<D>& win);
- template <typename P, typename D>
+ const abstract::window<W>& win);
+
+ template <typename P, typename W>
fwd_qiter_win_(const abstract::point<P>& p,
- const window_<D>& win);
+ const abstract::window<W>& win);
void impl_start();
@@ -103,22 +105,22 @@
# ifndef OLN_INCLUDE_ONLY
template <typename point_t>
- template <typename P, typename D>
+ template <typename P, typename W>
fwd_qiter_win_<point_t>::fwd_qiter_win_(const abstract::iterator_on_points<P>& it,
- const window_<D>& win)
+ const abstract::window<W>& win)
: p_ref_(it.point_adr()),
- win_(win)
+ win_(win.exact())
{
precondition(win_.card() > 0);
i_ = -1;
}
template <typename point_t>
- template <typename P, typename D>
+ template <typename P, typename W>
fwd_qiter_win_<point_t>::fwd_qiter_win_(const abstract::point<P>& p,
- const window_<D>& win)
+ const abstract::window<W>& win)
: p_ref_(&(p.exact())),
- win_(win)
+ win_(win.exact())
{
precondition(win_.card() > 0);
i_ = -1;
Index: oln/core/gen/window.hh
===================================================================
--- oln/core/gen/window.hh (revision 618)
+++ oln/core/gen/window.hh (working copy)
@@ -33,14 +33,27 @@
# include <vector>
# include <mlc/assert.hh>
# include <oln/core/abstract/dpoint.hh>
+# include <oln/core/abstract/window.hh>
namespace oln
{
+ // Fwd decl.
+ template <typename dpoint> class window_;
+
+
+ template <typename dpoint>
+ struct vtypes< window_<dpoint> >
+ {
+ typedef oln_type_of(dpoint, grid) grid_type;
+ };
+
+
/// Abstract forward dpoint iterator class.
template <typename dpoint>
- class window_ : private mlc::assert_< mlc_is_a(dpoint, abstract::dpoint) >
+ class window_ : public abstract::window< window_<dpoint> >,
+ private mlc::assert_< mlc_is_a(dpoint, abstract::dpoint) >
{
typedef window_<dpoint> self_t;
@@ -51,11 +64,13 @@
window_<dpoint>& add(const dpoint& dp);
template <typename D>
- window_<dpoint>& add(const abstract::dpoint<D>& dp);
+ window_<dpoint>& add(const abstract::dpoint<D>& dp);
+ dpoint dp(unsigned i) const;
+
unsigned card() const;
- dpoint dp(unsigned i) const;
+ bool impl_is_valid() const;
protected:
@@ -107,6 +122,13 @@
}
template <typename dpoint>
+ bool
+ window_<dpoint>::impl_is_valid() const
+ {
+ return v_.size() != 0;
+ }
+
+ template <typename dpoint>
void
window_<dpoint>::update_()
{
Index: oln/basics2d.hh
===================================================================
--- oln/basics2d.hh (revision 618)
+++ oln/basics2d.hh (working copy)
@@ -44,6 +44,9 @@
# include <oln/core/gen/fwd_piter_bbox.hh>
# include <oln/core/gen/bkd_piter_bbox.hh>
+# include <oln/core/gen/window.hh>
+# include <oln/core/gen/fwd_qiter_win.hh>
+
# include <oln/core/gen/neighb.hh>
# include <oln/core/2d/neighb2d.hh>
Index: oln/Makefile.am
===================================================================
--- oln/Makefile.am (revision 618)
+++ oln/Makefile.am (working copy)
@@ -85,6 +85,7 @@
core/abstract/point_set.hh \
core/abstract/topology.hh \
core/abstract/value.hh \
+ core/abstract/window.hh \
\
core/automatic/image.hh \
core/automatic/image_being_mutable.hh \
1
0
2006-10-11 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add some tools related to morphers over image value.
* oln/core/abstract/value.hh: New.
* oln/morpher/thru_fun.hh: New.
* oln/morpher/internal/image_value_morpher.hh: New.
* oln/color: New.
* oln/color/rgb.hh: New.
* tests/Makefile.am (check_PROGRAMS): Reorganize.
(io_pnm_SOURCES): New.
* oln/core/abstract/grid.hh (grid): Add inheritance from oln::type.
* oln/Makefile.am (nobase_oln_HEADERS): Update.
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am (revision 617)
+++ tests/Makefile.am (working copy)
@@ -25,14 +25,14 @@
image1d \
image2d \
image3d \
- io_pnm \
npoints \
\
identity_morpher \
add_neighborhood_morpher \
morphers \
\
- fill
+ fill \
+ io_pnm
# Images and auxiliary structures.
dpoint2d_SOURCES = dpoint2d.cc
@@ -51,6 +51,7 @@
# Algorithms.
fill_SOURCES = fill.cc
+io_pnm_SOURCES = io_pnm.cc
TESTS = $(check_PROGRAMS)
Index: oln/core/abstract/grid.hh
===================================================================
--- oln/core/abstract/grid.hh (revision 617)
+++ oln/core/abstract/grid.hh (working copy)
@@ -28,6 +28,7 @@
#ifndef OLN_CORE_ABSTRACT_GRID_HH
# define OLN_CORE_ABSTRACT_GRID_HH
+# include <oln/core/type.hh>
# include <oln/core/typedefs.hh>
@@ -49,7 +50,8 @@
namespace abstract {
template <typename E>
- struct grid : public virtual stc::any__simple<E>
+ struct grid : public virtual stc::any__simple<E>,
+ public oln::type
{
protected:
grid();
Index: oln/core/abstract/value.hh
===================================================================
--- oln/core/abstract/value.hh (revision 0)
+++ oln/core/abstract/value.hh (revision 0)
@@ -0,0 +1,58 @@
+// Copyright (C) 2005, 2006 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, 51 Franklin Street, Fifth Floor,
+// 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 OLN_CORE_ABSTRACT_VALUE_HH
+# define OLN_CORE_ABSTRACT_VALUE_HH
+
+# include <oln/core/type.hh>
+
+
+namespace oln {
+
+ namespace abstract {
+
+ struct value : public oln::type
+ {
+ protected:
+ value();
+ };
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ value::value()
+ {
+ }
+
+# endif
+
+ } // end of namespace oln::abstract
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_ABSTRACT_VALUE_HH
Index: oln/Makefile.am
===================================================================
--- oln/Makefile.am (revision 617)
+++ oln/Makefile.am (working copy)
@@ -3,6 +3,8 @@
olndir = $(includedir)/oln
nobase_oln_HEADERS = \
\
+ color/rgb.hh \
+ \
core/1d/aliases.hh \
core/1d/array1d.hh \
core/1d/dpoint1d.hh \
@@ -82,6 +84,7 @@
core/abstract/point.hh \
core/abstract/point_set.hh \
core/abstract/topology.hh \
+ core/abstract/value.hh \
\
core/automatic/image.hh \
core/automatic/image_being_mutable.hh \
@@ -135,10 +138,12 @@
level/fill.hh \
\
morpher/internal/image_extension.hh \
+ morpher/internal/image_value_morpher.hh \
\
morpher/add_neighborhood.hh \
morpher/identity.hh \
morpher/tags.hh \
+ morpher/thru_fun.hh \
\
basics1d.hh \
basics2d.hh \
Index: oln/morpher/thru_fun.hh
===================================================================
--- oln/morpher/thru_fun.hh (revision 0)
+++ oln/morpher/thru_fun.hh (revision 0)
@@ -0,0 +1,157 @@
+// Copyright (C) 2006 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, 51 Franklin Street, Fifth Floor,
+// 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 OLN_MORPHER_THRU_FUN
+# define OLN_MORPHER_THRU_FUN
+
+# include <xtd/abstract/open_nary_fun.hh>
+# include <xtd/res.hh>
+# include <oln/morpher/internal/image_value_morpher.hh>
+
+
+
+namespace oln
+{
+
+ namespace morpher
+ {
+ // Forward declaration.
+ template <typename Image, typename Fun> struct thru_fun;
+
+ } // end of namespace oln::morpher
+
+
+ /// Super type.
+ template <typename Image, typename Fun>
+ struct set_super_type< morpher::thru_fun<Image, Fun> >
+ {
+ typedef morpher::thru_fun<Image, Fun> self_t;
+ typedef morpher::internal::image_value_morpher<Image, self_t> ret;
+ };
+
+
+ template <typename Image, typename Fun>
+ struct vtypes< morpher::thru_fun<Image, Fun> >
+ {
+ private:
+ typedef oln_type_of(Image, rvalue) old_value_type;
+ public:
+ typedef xtd_res_1(Fun, old_value_type) value_type;
+ typedef mlc::false_ is_mutable_type;
+ };
+
+
+ template <typename Image, typename Fun>
+ struct single_vtype< morpher::thru_fun<Image, Fun>, typedef_::rvalue_type >
+ {
+ typedef morpher::thru_fun<Image, Fun> self_t;
+ typedef oln_type_of(self_t, value) ret;
+ };
+
+
+
+ namespace morpher
+ {
+
+ /// 'Image thru Function' morpher.
+ template <typename Image, typename Fun>
+ class thru_fun : public internal::image_value_morpher< Image,
+ thru_fun<Image, Fun> >
+ {
+ private:
+
+ typedef thru_fun<Image, Fun> self_t;
+ typedef internal::image_value_morpher<Image, self_t> super_t;
+
+ typedef oln_type_of(self_t, psite) psite_t;
+ typedef oln_type_of(self_t, rvalue) rvalue_t;
+
+ public:
+
+ thru_fun(const Image& image, const Fun& fun);
+
+ rvalue_t impl_op_read(const psite_t& p) const;
+
+ protected:
+
+ Fun fun_;
+ };
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename Image, typename Fun>
+ thru_fun<Image, Fun>::thru_fun(const Image& image, const Fun& fun) :
+ super_t(image),
+ fun_(fun)
+ {
+ }
+
+ template <typename Image, typename Fun>
+ typename thru_fun<Image, Fun>::rvalue_t
+ thru_fun<Image, Fun>::impl_op_read(const typename thru_fun<Image, Fun>::psite_t& p) const
+ {
+ return fun_(this->image_(p));
+ }
+
+# endif
+
+ } // end of namespace oln::morpher
+
+
+} // end of namespace oln
+
+
+
+
+namespace xtd
+{
+
+ // open_nary_fun_<1, Fun>::operator()(const A& a) const
+ // where A is an oln::abstract::image<I>
+
+ template <typename Fun, typename A>
+ struct case_ < tag::fun_operator_1, mlc::pair_<Fun, A>, 2 >
+ : where_< mlc_is_a(A, oln::abstract::image) >
+ {
+ typedef stc_to_exact(A) I;
+ typedef oln::morpher::thru_fun<I, Fun> res;
+
+ static res impl(const Fun& fun, // target
+ const oln::abstract::image<I>& ima)
+ {
+ res tmp(ima.exact(), fun);
+ return tmp;
+ }
+ };
+
+} // end of namespace xtd
+
+
+
+
+#endif // ! OLN_MORPHER_THRU_FUN
Index: oln/morpher/internal/image_value_morpher.hh
===================================================================
--- oln/morpher/internal/image_value_morpher.hh (revision 0)
+++ oln/morpher/internal/image_value_morpher.hh (revision 0)
@@ -0,0 +1,137 @@
+// Copyright (C) 2006 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, 51 Franklin Street, Fifth Floor,
+// 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 OLN_MORPHER_INTERNAL_IMAGE_VALUE_MORPHER_HH
+# define OLN_MORPHER_INTERNAL_IMAGE_VALUE_MORPHER_HH
+
+# include <oln/core/image_entry.hh>
+# include <oln/morpher/tags.hh>
+
+
+namespace oln
+{
+ namespace morpher
+ {
+ namespace internal
+ {
+
+ // Forward declaration.
+ template <typename Image, typename Exact>
+ class image_value_morpher;
+
+ } // end of namespace oln::morpher::internal
+
+ } // end of namespace oln::morpher
+
+
+ /// Create an ``uplink'' from
+ /// oln::morpher::internal::image_value_morpher to the morphed \a Image,
+ /// so as to get all its virtual types.
+ template <typename Image, typename Exact>
+ struct
+ set_pseudosuper_type< morpher::internal::image_value_morpher<Image, Exact> >
+ {
+ typedef Image ret;
+ };
+
+
+ template <typename Image, typename Exact>
+ struct vtypes< morpher::internal::image_value_morpher<Image, Exact> >
+ {
+ // Morpher type.
+ typedef oln::morpher::tag::identity morpher_type; // FIXME: Wrong!
+
+ typedef mlc::undefined value_type;
+ };
+
+ template <typename Image, typename Exact>
+ struct single_vtype< morpher::internal::image_value_morpher<Image, Exact>,
+ typedef_::rvalue_type >
+ {
+ typedef mlc::undefined ret;
+ };
+
+ template <typename Image, typename Exact>
+ struct single_vtype< morpher::internal::image_value_morpher<Image, Exact>,
+ typedef_::lvalue_type >
+ {
+ typedef mlc::undefined ret;
+ };
+
+
+ namespace morpher
+ {
+ namespace internal
+ {
+
+ template <typename Image, typename Exact>
+ class image_value_morpher : public oln::image_entry<Exact>
+ {
+ public:
+
+ // FIXME: Handle the constness.
+ image_value_morpher(const Image& image);
+ const Image& delegate() const;
+ Image& delegate();
+
+ protected:
+ Image image_;
+ };
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename Image, typename Exact>
+ image_value_morpher<Image, Exact>::image_value_morpher(const Image& image) :
+ image_(image)
+ {
+ }
+
+ template <typename Image, typename Exact>
+ const Image&
+ image_value_morpher<Image, Exact>::delegate() const
+ {
+ return image_;
+ }
+
+ template <typename Image, typename Exact>
+ Image&
+ image_value_morpher<Image, Exact>::delegate()
+ {
+ return image_;
+ }
+
+# endif
+
+ } // end of namespace oln::morpher::internal
+
+ } // end of namespace oln::morpher
+
+} // end of namespace oln
+
+#endif // ! OLN_MORPHER_INTERNAL_IMAGE_VALUE_MORPHER_HH
Index: oln/color/rgb.hh
===================================================================
--- oln/color/rgb.hh (revision 0)
+++ oln/color/rgb.hh (revision 0)
@@ -0,0 +1,185 @@
+// Copyright (C) 2006 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, 51 Franklin Street, Fifth Floor,
+// 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 OLN_CORE_COLOR_RGB_HH
+# define OLN_CORE_COLOR_RGB_HH
+
+# include <xtd/vec.hh>
+# include <oln/core/abstract/value.hh>
+
+
+namespace oln
+{
+
+ namespace color
+ {
+
+
+ /// General RGB class.
+ template <typename T>
+ class rgb_ : public oln::abstract::value
+ {
+ public:
+
+ /// Ctor.
+ rgb_();
+
+ /// Ctor.
+ rgb_(const T& r, const T& g, const T& b);
+
+ /// Cpy ctor.
+ template <typename U>
+ rgb_(const rgb_<U>& rhs);
+
+ /// Op=.
+ template <typename U>
+ rgb_<T>& operator=(const rgb_<U>& rhs);
+
+ T red() const;
+ T& red();
+ typedef T red_type;
+
+ T green() const;
+ T& green();
+ typedef T green_type;
+
+ T blue() const;
+ T& blue();
+ typedef T blue_type;
+
+ const xtd::vec<3,T>& to_vec() const;
+ xtd::vec<3,T>& to_vec();
+
+ protected:
+ xtd::vec<3,T> val_;
+ };
+
+ typedef rgb_<unsigned char> rgb8;
+
+ template <unsigned n, typename T>
+ std::ostream& operator<<(std::ostream& ostr, const rgb_<T>& c);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+
+ template <typename T>
+ rgb_<T>::rgb_()
+ {
+ }
+
+ template <typename T>
+ rgb_<T>::rgb_(const T& r, const T& g, const T& b)
+ {
+ val_[0] = r;
+ val_[1] = g;
+ val_[2] = b;
+ }
+
+ template <typename T>
+ template <typename U>
+ rgb_<T>::rgb_(const rgb_<U>& rhs)
+ {
+ val_[0] = rhs.red();
+ val_[1] = rhs.green();
+ val_[2] = rhs.blue();
+ }
+
+ template <typename T>
+ template <typename U>
+ rgb_<T>& rgb_<T>::operator=(const rgb_<U>& rhs)
+ {
+ val_[0] = rhs.red();
+ val_[1] = rhs.green();
+ val_[2] = rhs.blue();
+ return *this;
+ }
+
+ template <typename T>
+ T rgb_<T>::red() const
+ {
+ return val_[0];
+ }
+
+ template <typename T>
+ T& rgb_<T>::red()
+ {
+ return val_[0];
+ }
+
+ template <typename T>
+ T rgb_<T>::green() const
+ {
+ return val_[1];
+ }
+
+ template <typename T>
+ T& rgb_<T>::green()
+ {
+ return val_[1];
+ }
+
+ template <typename T>
+ T rgb_<T>::blue() const
+ {
+ return val_[2];
+ }
+
+ template <typename T>
+ T& rgb_<T>::blue()
+ {
+ return val_[2];
+ }
+
+ template <typename T>
+ const xtd::vec<3,T>& rgb_<T>::to_vec() const
+ {
+ return val_;
+ }
+
+ template <typename T>
+ xtd::vec<3,T>& rgb_<T>::to_vec()
+ {
+ return val_;
+ }
+
+
+ template <typename T>
+ std::ostream& operator<<(std::ostream& ostr, const rgb_<T>& c)
+ {
+ return ostr << c.to_vec();
+ }
+
+# endif
+
+
+ } // end of namespace oln::color
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_COLOR_RGB_HH
1
0