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
September 2008
- 12 participants
- 359 discussions
cleanup-2008 2227: Adapt the accumulators histo, min_h, max_h to histo/data.
by Nicolas Ballas 12 Sep '08
by Nicolas Ballas 12 Sep '08
12 Sep '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Nicolas Ballas <ballas(a)lrde.epita.fr>
Adapt the accumulators histo, min_h, max_h to histo/data.
* tests/accu/max_h.cc,
* tests/accu/min_h.cc: Update.
* mln/histo/data.hh: Add a new method nvalues.
* mln/core/routine/ops.hh: delete trailing whitespace.
* mln/accu/nil.hh,
* mln/accu/min.hh,
* mln/accu/count_adjacent_vertices.hh,
* mln/accu/max.hh,
* mln/accu/count.hh,
* mln/accu/tuple.hh,
* mln/accu/bbox.hh,
* mln/accu/pair.hh,
* mln/accu/median.hh,
* mln/accu/median_alt.hh,
* mln/accu/p.hh,
* mln/accu/rank_high_quant.hh,
* mln/accu/sum.hh,
* mln/accu/v.hh,
* mln/accu/rank_bool.hh,
* mln/accu/volume.hh,
* mln/accu/height.hh,
* mln/accu/mean.hh,
* mln/accu/internal/base.hh: Rename base_ to base.
* mln/accu/max_h.hh,
* mln/accu/min_h.hh,
* mln/accu/histo.hh: Adapt to histo/data.
* mln/value/int_u.hh: Update.
mln/accu/bbox.hh | 2
mln/accu/count.hh | 2
mln/accu/count_adjacent_vertices.hh | 2
mln/accu/height.hh | 2
mln/accu/histo.hh | 117 ++++++++++++++++--------------------
mln/accu/internal/base.hh | 8 +-
mln/accu/max.hh | 2
mln/accu/max_h.hh | 78 ++++++++++--------------
mln/accu/mean.hh | 2
mln/accu/median.hh | 2
mln/accu/median_alt.hh | 2
mln/accu/min.hh | 2
mln/accu/min_h.hh | 79 ++++++++++--------------
mln/accu/nil.hh | 2
mln/accu/p.hh | 2
mln/accu/pair.hh | 2
mln/accu/rank_bool.hh | 2
mln/accu/rank_high_quant.hh | 2
mln/accu/sum.hh | 2
mln/accu/tuple.hh | 2
mln/accu/v.hh | 2
mln/accu/volume.hh | 2
mln/core/routine/ops.hh | 4 -
mln/histo/data.hh | 19 +++++
mln/value/int_u.hh | 4 -
tests/accu/max_h.cc | 2
tests/accu/min_h.cc | 4 -
27 files changed, 170 insertions(+), 181 deletions(-)
Index: tests/accu/max_h.cc
--- tests/accu/max_h.cc (revision 2226)
+++ tests/accu/max_h.cc (working copy)
@@ -39,7 +39,7 @@
using namespace mln;
using namespace mln::value;
- accu::max_h< set<int_u8> > a;
+ accu::max_h<int_u8> a;
a.take(1);
a.take(1);
Index: tests/accu/min_h.cc
--- tests/accu/min_h.cc (revision 2226)
+++ tests/accu/min_h.cc (working copy)
@@ -34,12 +34,14 @@
#include <mln/accu/min_h.hh>
+
+
int main()
{
using namespace mln;
using namespace mln::value;
- accu::min_h< set<int_u8> > a;
+ accu::min_h<int_u8> a;
a.take(42);
a.take(42);
Index: mln/histo/data.hh
--- mln/histo/data.hh (revision 2226)
+++ mln/histo/data.hh (working copy)
@@ -63,6 +63,9 @@
const std::vector<std::size_t>& vect() const;
const mln::value::set<T>& vset() const;
std::size_t operator[](unsigned i) const;
+ std::size_t& operator[](unsigned i);
+
+ std::size_t nvalues() const;
protected:
@@ -130,6 +133,15 @@
template <typename T>
inline
+ std::size_t&
+ data<T>::operator[](unsigned i)
+ {
+ mln_precondition(i < s_.nvalues());
+ return h_[i];
+ }
+
+ template <typename T>
+ inline
const std::vector<std::size_t>&
data<T>::vect() const
{
@@ -138,6 +150,13 @@
template <typename T>
inline
+ std::size_t data<T>::nvalues() const
+ {
+ return h_.size();
+ }
+
+ template <typename T>
+ inline
std::ostream& operator<<(std::ostream& ostr, const data<T>& h)
{
mln_viter(mln::value::set<T>) v(h.vset());
Index: mln/core/routine/ops.hh
--- mln/core/routine/ops.hh (revision 2226)
+++ mln/core/routine/ops.hh (working copy)
@@ -80,11 +80,9 @@
* \todo Complete those definitions (...) + Overload for const (?)
*/
+# include <mln/trait/op/all.hh>
# include <mln/core/concept/object.hh>
# include <mln/metal/converts_to.hh>
-# include <mln/trait/op/all.hh>
-
-
namespace mln
{
Index: mln/accu/nil.hh
--- mln/accu/nil.hh (revision 2226)
+++ mln/accu/nil.hh (working copy)
@@ -51,7 +51,7 @@
* \brief Define an accumulator that does nothing.
*/
template <typename T>
- struct nil_ : public mln::accu::internal::base_< util::ignore , nil_<T> >
+ struct nil_ : public mln::accu::internal::base< util::ignore , nil_<T> >
{
typedef util::eat argument;
typedef util::ignore result;
Index: mln/accu/min.hh
--- mln/accu/min.hh (revision 2226)
+++ mln/accu/min.hh (working copy)
@@ -51,7 +51,7 @@
* The parameter \c T is the type of values.
*/
template <typename T>
- struct min_ : public mln::accu::internal::base_< T, min_<T> >
+ struct min_ : public mln::accu::internal::base< T, min_<T> >
{
typedef T argument;
typedef T result;
Index: mln/accu/count_adjacent_vertices.hh
--- mln/accu/count_adjacent_vertices.hh (revision 2226)
+++ mln/accu/count_adjacent_vertices.hh (working copy)
@@ -54,7 +54,7 @@
/// mln::opening_area_on_vertices.
template <typename P, typename V>
struct count_adjacent_vertices_
- : public mln::accu::internal::base_< std::size_t,
+ : public mln::accu::internal::base< std::size_t,
count_adjacent_vertices_<P, V> >
{
typedef mln::util::pix< mln::line_graph_image<P, V> > argument;
Index: mln/accu/max.hh
--- mln/accu/max.hh (revision 2226)
+++ mln/accu/max.hh (working copy)
@@ -51,7 +51,7 @@
* The parameter \c T is the type of values.
*/
template <typename T>
- struct max_ : public mln::accu::internal::base_< T , max_<T> >
+ struct max_ : public mln::accu::internal::base< T , max_<T> >
{
typedef T argument;
typedef T result;
Index: mln/accu/histo.hh
--- mln/accu/histo.hh (revision 2226)
+++ mln/accu/histo.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -41,7 +41,7 @@
# include <mln/core/concept/value_set.hh>
# include <mln/accu/internal/base.hh>
# include <mln/value/set.hh>
-
+# include <mln/histo/data.hh>
namespace mln
{
@@ -51,19 +51,20 @@
/*!
- * \brief Generic histogram class over a value set with type \c S.
+ * \brief Generic histogram class over a value set with type \c V.
*/
- template <typename S>
- struct histo : public mln::accu::internal::base_< const std::vector<std::size_t>& , histo<S> >
+ template <typename V>
+ struct histo :
+ public mln::accu::internal::base<const std::vector<std::size_t>& ,
+ histo<V> >
{
- histo(const Value_Set<S>& s);
histo();
- typedef mln_value(S) argument;
+ typedef V argument;
typedef const std::vector<std::size_t>& result;
void take(const argument& t);
- void take(const histo<S>& other);
+ void take(const histo<V>& other);
void untake(const argument& t);
void init();
@@ -75,142 +76,130 @@
const std::vector<std::size_t>& vect() const;
const std::vector<std::size_t>& to_result() const;
- const S& vset() const;
+ const value::set<V>& vset() const;
protected:
- const S& s_;
- std::vector<std::size_t> h_;
+ mln::histo::data<V> h_;
std::size_t sum_;
};
- template <typename S>
- std::ostream& operator<<(std::ostream& ostr, const histo<S>& h);
+ template <typename V>
+ std::ostream& operator<<(std::ostream& ostr, const histo<V>& h);
# ifndef MLN_INCLUDE_ONLY
- template <typename S>
- inline
- histo<S>::histo(const Value_Set<S>& s)
- : s_(exact(s)),
- h_(s_.nvalues(), 0),
- sum_(0)
- {
- }
-
- template <typename S>
+ template <typename V>
inline
- histo<S>::histo()
- : s_(S::the()),
- h_(s_.nvalues(), 0),
+ histo<V>::histo()
+ : h_(),
sum_(0)
{
}
- template <typename S>
+ template <typename V>
inline
void
- histo<S>::take(const argument& t)
+ histo<V>::take(const argument& t)
{
- ++h_[s_.index_of(t)];
+ ++h_[h_.vset().index_of(t)];
++sum_;
}
- template <typename S>
+ template <typename V>
inline
void
- histo<S>::take(const histo<S>& other)
+ histo<V>::take(const histo<V>& other)
{
- for (unsigned i = 0; i < h_.size(); ++i)
+ for (unsigned i = 0; i < h_.nvalues(); ++i)
h_[i] += other.h_[i];
sum_ += other.sum_;
}
- template <typename S>
+ template <typename V>
inline
void
- histo<S>::untake(const argument& t)
+ histo<V>::untake(const argument& t)
{
- mln_precondition(h_[s_.index_of(t)] > 0);
+ mln_precondition(h_[h_.vset().index_of(t)] > 0);
mln_precondition(sum_ > 0);
- --h_[s_.index_of(t)];
+ --h_[h_.vset().index_of(t)];
--sum_;
}
- template <typename S>
+ template <typename V>
inline
void
- histo<S>::init()
+ histo<V>::init()
{
- std::fill(h_.begin(), h_.end(), 0);
- sum_ = 0;
+ h_.clear();
}
- template <typename S>
+ template <typename V>
inline
std::size_t
- histo<S>::operator()(const argument& t) const
+ histo<V>::operator()(const argument& t) const
{
- return h_[s_.index_of(t)];
+ return h_[h_.vset().index_of(t)];
}
- template <typename S>
+ template <typename V>
inline
std::size_t
- histo<S>::operator[](unsigned i) const
+ histo<V>::operator[](unsigned i) const
{
- mln_precondition(i < s_.nvalues());
+ mln_precondition(i < h_.vset().nvalues());
return h_[i];
}
- template <typename S>
+ template <typename V>
inline
unsigned
- histo<S>::nvalues() const
+ histo<V>::nvalues() const
{
- return s_.nvalues();
+ return h_.vset().nvalues();
}
- template <typename S>
+ template <typename V>
inline
std::size_t
- histo<S>::sum() const
+ histo<V>::sum() const
{
return sum_;
}
- template <typename S>
+ template <typename V>
inline
const std::vector<std::size_t>&
- histo<S>::vect() const
+ histo<V>::vect() const
{
- return h_;
+ return h_.vect();
}
- template <typename S>
+ template <typename V>
inline
const std::vector<std::size_t>&
- histo<S>::to_result() const
+ histo<V>::to_result() const
{
- return h_;
+ return this->vect();
}
- template <typename S>
+ template <typename V>
inline
- const S&
- histo<S>::vset() const
+ const value::set<V>&
+ histo<V>::vset() const
{
- return s_;
+ return h_.vset();
}
- template <typename S>
+ template <typename V>
inline
- std::ostream& operator<<(std::ostream& ostr, const histo<S>& h)
+ std::ostream& operator<<(std::ostream& ostr, const histo<V>& h)
{
- mln_viter(S) v(h.vset());
+ mln_viter(V) v(h.vset());
for_all(v)
if (h(v) != 0)
ostr << v << ':' << h(v) << ' ';
Index: mln/accu/count.hh
--- mln/accu/count.hh (revision 2226)
+++ mln/accu/count.hh (working copy)
@@ -43,7 +43,7 @@
/// \brief Generic counter accumulator class.
/// The parameter \a T is the type to be count.
template <typename T>
- struct count_ : public mln::accu::internal::base_< std::size_t , count_<T> >
+ struct count_ : public mln::accu::internal::base< std::size_t , count_<T> >
{
typedef T argument;
Index: mln/accu/tuple.hh
--- mln/accu/tuple.hh (revision 2226)
+++ mln/accu/tuple.hh (working copy)
@@ -72,7 +72,7 @@
*/
template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(10, typename T, boost::tuples::null_type)>
struct tuple_
- : public mln::accu::internal::base_< boost::tuple< BOOST_PP_REPEAT(10, RESULT_ACCU, Le Ricard ya que ca de vrai !) > , tuple_<A, n, BOOST_PP_ENUM_PARAMS(10, T)> >
+ : public mln::accu::internal::base< boost::tuple< BOOST_PP_REPEAT(10, RESULT_ACCU, Le Ricard ya que ca de vrai !) > , tuple_<A, n, BOOST_PP_ENUM_PARAMS(10, T)> >
{
typedef A argument;
Index: mln/accu/bbox.hh
--- mln/accu/bbox.hh (revision 2226)
+++ mln/accu/bbox.hh (working copy)
@@ -49,7 +49,7 @@
* The parameter \c P is the type of points.
*/
template <typename P>
- struct bbox : public mln::accu::internal::base_< const box<P>& , bbox<P> >
+ struct bbox : public mln::accu::internal::base< const box<P>& , bbox<P> >
{
typedef P argument;
typedef const box<P>& result;
Index: mln/accu/min_h.hh
--- mln/accu/min_h.hh (revision 2226)
+++ mln/accu/min_h.hh (working copy)
@@ -35,6 +35,7 @@
# include <mln/accu/internal/base.hh>
# include <mln/accu/histo.hh>
+# include <mln/value/set.hh>
namespace mln
@@ -45,33 +46,32 @@
/*! \brief Generic min function based on histogram over a value
- * set with type \c S.
+ * set with type \c V.
*/
- template <typename S>
- struct min_h : public mln::accu::internal::base_< mln_value(S) , min_h<S> >
+ template <typename V>
+ struct min_h : public mln::accu::internal::base< V , min_h<V> >
{
- typedef mln_value(S) argument;
+ typedef V argument;
typedef argument result;
- min_h(const Value_Set<S>& s);
min_h();
void init();
void take(const argument& t);
void take_as_init(const argument& t);
- void take(const min_h<S>& other);
+ void take(const min_h<V>& other);
void untake(const argument& t);
unsigned card() const { return h_.sum(); }
result to_result() const;
- const accu::histo<S>& histo() const;
+ const accu::histo<V>& histo() const;
protected:
- mutable accu::histo<S> h_;
- const S& s_; // derived from h_
+ mutable accu::histo<V> h_;
+ const value::set<V>& s_; // derived from h_
mutable std::size_t sum_;
mutable bool valid_;
@@ -87,28 +87,19 @@
# ifndef MLN_INCLUDE_ONLY
- template <typename S>
+ template <typename V>
inline
- min_h<S>::min_h(const Value_Set<S>& s)
- : h_(s),
- s_(h_.vset())
- {
- init();
- }
-
- template <typename S>
- inline
- min_h<S>::min_h()
+ min_h<V>::min_h()
: h_(),
s_(h_.vset())
{
init();
}
- template <typename S>
+ template <typename V>
inline
void
- min_h<S>::take(const argument& t)
+ min_h<V>::take(const argument& t)
{
h_.take(t);
if (h_.sum() == 1)
@@ -123,10 +114,10 @@
}
}
- template <typename S>
+ template <typename V>
inline
void
- min_h<S>::take(const min_h<S>& other)
+ min_h<V>::take(const min_h<V>& other)
{
// h_
h_.take(other.h_);
@@ -136,10 +127,10 @@
// FIXME: Optimize.
}
- template <typename S>
+ template <typename V>
inline
void
- min_h<S>::untake(const argument& t)
+ min_h<V>::untake(const argument& t)
{
mln_precondition(h_(t) != 0);
h_.untake(t);
@@ -159,10 +150,10 @@
valid_ = false;
}
- template <typename S>
+ template <typename V>
inline
void
- min_h<S>::update_() const
+ min_h<V>::update_() const
{
if (sum_ != 0)
go_minus_();
@@ -172,10 +163,10 @@
valid_ = true;
}
- template <typename S>
+ template <typename V>
inline
void
- min_h<S>::go_minus_() const
+ min_h<V>::go_minus_() const
{
do
{
@@ -187,10 +178,10 @@
t_ = s_[i_];
}
- template <typename S>
+ template <typename V>
inline
void
- min_h<S>::go_plus_() const
+ min_h<V>::go_plus_() const
{
do
++i_;
@@ -198,10 +189,10 @@
t_ = s_[i_];
}
- template <typename S>
+ template <typename V>
inline
void
- min_h<S>::init()
+ min_h<V>::init()
{
h_.init();
sum_ = 0;
@@ -210,10 +201,10 @@
valid_ = true;
}
- template <typename S>
+ template <typename V>
inline
void
- min_h<S>::take_as_init(const argument& t)
+ min_h<V>::take_as_init(const argument& t)
{
h_.take(t);
sum_ = 0;
@@ -222,27 +213,27 @@
valid_ = true;
}
- template <typename S>
+ template <typename V>
inline
- typename min_h<S>::argument
- min_h<S>::to_result() const
+ typename min_h<V>::argument
+ min_h<V>::to_result() const
{
if (! valid_)
update_();
return t_;
}
- template <typename S>
+ template <typename V>
inline
- const accu::histo<S>&
- min_h<S>::histo() const
+ const accu::histo<V>&
+ min_h<V>::histo() const
{
return h_;
}
- template <typename S>
+ template <typename V>
inline
- std::ostream& operator<<(std::ostream& ostr, const min_h<S>& m)
+ std::ostream& operator<<(std::ostream& ostr, const min_h<V>& m)
{
return ostr << m.to_result();
}
Index: mln/accu/pair.hh
--- mln/accu/pair.hh (revision 2226)
+++ mln/accu/pair.hh (working copy)
@@ -56,7 +56,7 @@
* \todo Check that, when T is not provided, A1 and A2 have the same value.
*/
template <typename A1, typename A2, typename T = mln_argument(A1)>
- struct pair_ : public mln::accu::internal::base_< std::pair< mlc_unqualif(mln_result(A1)) , mlc_unqualif(mln_result(A2)) > , pair_<A1,A2,T> >
+ struct pair_ : public mln::accu::internal::base< std::pair< mlc_unqualif(mln_result(A1)) , mlc_unqualif(mln_result(A2)) > , pair_<A1,A2,T> >
{
typedef T argument;
Index: mln/accu/max_h.hh
--- mln/accu/max_h.hh (revision 2226)
+++ mln/accu/max_h.hh (working copy)
@@ -45,33 +45,32 @@
/*! \brief Generic max function based on histogram over a value set with
- * type \c S.
+ * type \c V.
*/
- template <typename S>
- struct max_h : public mln::accu::internal::base_< mln_value(S) , max_h<S> >
+ template <typename V>
+ struct max_h : public mln::accu::internal::base< V, max_h<V> >
{
- typedef mln_value(S) argument;
+ typedef V argument;
typedef argument result;
- max_h(const Value_Set<S>& s);
max_h();
void init();
void take(const argument& t);
void take_as_init(const argument& t);
- void take(const max_h<S>& other);
+ void take(const max_h<V>& other);
void untake(const argument& t);
unsigned card() const { return h_.sum(); }
argument to_result() const;
- const accu::histo<S>& histo() const;
+ const accu::histo<V>& histo() const;
protected:
- mutable accu::histo<S> h_;
- const S& s_; // derived from h_
+ mutable accu::histo<V> h_;
+ const value::set<V>& s_; // derived from h_
mutable std::size_t sum_;
mutable bool valid_;
@@ -87,28 +86,19 @@
# ifndef MLN_INCLUDE_ONLY
- template <typename S>
+ template <typename V>
inline
- max_h<S>::max_h(const Value_Set<S>& s)
- : h_(s),
- s_(h_.vset())
- {
- init();
- }
-
- template <typename S>
- inline
- max_h<S>::max_h()
+ max_h<V>::max_h()
: h_(),
s_(h_.vset())
{
init();
}
- template <typename S>
+ template <typename V>
inline
void
- max_h<S>::take(const argument& t)
+ max_h<V>::take(const argument& t)
{
h_.take(t);
if (h_.sum() == 1)
@@ -123,10 +113,10 @@
}
}
- template <typename S>
+ template <typename V>
inline
void
- max_h<S>::take(const max_h<S>& other)
+ max_h<V>::take(const max_h<V>& other)
{
// h_
h_.take(other.h_);
@@ -136,10 +126,10 @@
// FIXME: Optimize.
}
- template <typename S>
+ template <typename V>
inline
void
- max_h<S>::untake(const argument& t)
+ max_h<V>::untake(const argument& t)
{
mln_precondition(h_(t) != 0);
h_.untake(t);
@@ -159,10 +149,10 @@
valid_ = false;
}
- template <typename S>
+ template <typename V>
inline
void
- max_h<S>::update_() const
+ max_h<V>::update_() const
{
if (sum_ != 0)
go_plus_();
@@ -172,10 +162,10 @@
valid_ = true;
}
- template <typename S>
+ template <typename V>
inline
void
- max_h<S>::go_minus_() const
+ max_h<V>::go_minus_() const
{
do
--i_;
@@ -183,10 +173,10 @@
t_ = s_[i_];
}
- template <typename S>
+ template <typename V>
inline
void
- max_h<S>::go_plus_() const
+ max_h<V>::go_plus_() const
{
do
{
@@ -197,10 +187,10 @@
t_ = s_[i_];
}
- template <typename S>
+ template <typename V>
inline
void
- max_h<S>::init()
+ max_h<V>::init()
{
h_.init();
sum_ = 0;
@@ -209,10 +199,10 @@
valid_ = true;
}
- template <typename S>
+ template <typename V>
inline
void
- max_h<S>::take_as_init(const argument& t)
+ max_h<V>::take_as_init(const argument& t)
{
h_.take(t);
sum_ = 0;
@@ -221,27 +211,27 @@
valid_ = true;
}
- template <typename S>
+ template <typename V>
inline
- typename max_h<S>::argument
- max_h<S>::to_result() const
+ typename max_h<V>::argument
+ max_h<V>::to_result() const
{
if (! valid_)
update_();
return t_;
}
- template <typename S>
+ template <typename V>
inline
- const accu::histo<S>&
- max_h<S>::histo() const
+ const accu::histo<V>&
+ max_h<V>::histo() const
{
return h_;
}
- template <typename S>
+ template <typename V>
inline
- std::ostream& operator<<(std::ostream& ostr, const max_h<S>& m)
+ std::ostream& operator<<(std::ostream& ostr, const max_h<V>& m)
{
return ostr << m.to_result();
}
Index: mln/accu/median.hh
--- mln/accu/median.hh (revision 2226)
+++ mln/accu/median.hh (working copy)
@@ -48,7 +48,7 @@
* set with type \c S.
*/
template <typename S>
- struct median : public mln::accu::internal::base_< mln_value(S), median<S> >
+ struct median : public mln::accu::internal::base< mln_value(S), median<S> >
{ // FIXME: Should median be named 'median_' like other accumulators ?
typedef mln_value(S) argument;
typedef argument result;
Index: mln/accu/median_alt.hh
--- mln/accu/median_alt.hh (revision 2226)
+++ mln/accu/median_alt.hh (working copy)
@@ -48,7 +48,7 @@
* value set with type \c S.
*/
template <typename S>
- struct median_alt : public mln::accu::internal::base_< mln_value(S), median_alt<S> >
+ struct median_alt : public mln::accu::internal::base< mln_value(S), median_alt<S> >
{
typedef mln_value(S) argument;
Index: mln/accu/p.hh
--- mln/accu/p.hh (revision 2226)
+++ mln/accu/p.hh (working copy)
@@ -52,7 +52,7 @@
* The parameter \c V is the type of values.
*/
template <typename A>
- struct p_ : public mln::accu::internal::base_< mln_result(A) , p_<A> >
+ struct p_ : public mln::accu::internal::base< mln_result(A) , p_<A> >
{
typedef mln_argument(A) argument;
typedef mln_result(A) result;
Index: mln/accu/rank_high_quant.hh
--- mln/accu/rank_high_quant.hh (revision 2226)
+++ mln/accu/rank_high_quant.hh (working copy)
@@ -52,7 +52,7 @@
* The parameter \c T is the type of values.
*/
template <typename T>
- struct rank_ : public mln::accu::internal::base_< T, rank_<T> >
+ struct rank_ : public mln::accu::internal::base< T, rank_<T> >
{
typedef T argument;
typedef T result;
Index: mln/accu/sum.hh
--- mln/accu/sum.hh (revision 2226)
+++ mln/accu/sum.hh (working copy)
@@ -57,7 +57,7 @@
* \c S is the summation type (property) of \c T.
*/
template <typename T, typename S = mln_sum(T)>
- struct sum_ : public mln::accu::internal::base_< S, sum_<T,S> >
+ struct sum_ : public mln::accu::internal::base< S, sum_<T,S> >
{
typedef T argument;
typedef S result;
Index: mln/accu/v.hh
--- mln/accu/v.hh (revision 2226)
+++ mln/accu/v.hh (working copy)
@@ -50,7 +50,7 @@
* \brief Generic val of accumulators.
*/
template <typename A>
- struct val_ : public mln::accu::internal::base_< mln_result(A) , val_<A> >
+ struct val_ : public mln::accu::internal::base< mln_result(A) , val_<A> >
{
typedef mln_argument(A) argument;
typedef mln_result(A) result;
Index: mln/accu/rank_bool.hh
--- mln/accu/rank_bool.hh (revision 2226)
+++ mln/accu/rank_bool.hh (working copy)
@@ -53,7 +53,7 @@
*
*/
template <>
- struct rank_<bool> : public mln::accu::internal::base_< bool, rank_<bool> >
+ struct rank_<bool> : public mln::accu::internal::base< bool, rank_<bool> >
{
typedef bool argument;
typedef bool result;
Index: mln/accu/volume.hh
--- mln/accu/volume.hh (revision 2226)
+++ mln/accu/volume.hh (working copy)
@@ -58,7 +58,7 @@
/// of pixels is built.
template <typename I>
struct volume_
- : public mln::accu::internal::base_< std::size_t , volume_<I> >
+ : public mln::accu::internal::base< std::size_t , volume_<I> >
{
/// \brief The accumulated data type.
///
Index: mln/accu/height.hh
--- mln/accu/height.hh (revision 2226)
+++ mln/accu/height.hh (working copy)
@@ -59,7 +59,7 @@
/// of pixels is built.
template <typename I>
struct height_
- : public mln::accu::internal::base_< std::size_t , height_<I> >
+ : public mln::accu::internal::base< std::size_t , height_<I> >
{
/// \brief The accumulated data type.
///
Index: mln/accu/internal/base.hh
--- mln/accu/internal/base.hh (revision 2226)
+++ mln/accu/internal/base.hh (working copy)
@@ -50,7 +50,7 @@
* Base class for implementation of accumulator classes.
*/
template <typename R, typename E>
- class base_ : public Accumulator<E>,
+ class base : public Accumulator<E>,
public mln::internal::proxy_impl< R, E >
{
public:
@@ -62,7 +62,7 @@
typedef R result;
protected:
- base_();
+ base();
};
@@ -70,14 +70,14 @@
template <typename R, typename E>
inline
- base_<R,E>::base_()
+ base<R,E>::base()
{
}
template <typename R, typename E>
inline
R
- base_<R,E>::subj_()
+ base<R,E>::subj_()
{
return exact(this)->to_result();
}
Index: mln/accu/mean.hh
--- mln/accu/mean.hh (revision 2226)
+++ mln/accu/mean.hh (working copy)
@@ -58,7 +58,7 @@
template <typename T,
typename S = mln_sum(T),
typename M = S>
- struct mean_ : public mln::accu::internal::base_< M , mean_<T,S,M> >
+ struct mean_ : public mln::accu::internal::base< M , mean_<T,S,M> >
{
typedef T argument;
typedef M result;
Index: mln/value/int_u.hh
--- mln/value/int_u.hh (revision 2226)
+++ mln/value/int_u.hh (working copy)
@@ -33,6 +33,8 @@
* \brief Define a generic class for unsigned integers.
*/
+# include <mln/trait/all.hh> // FIXME!
+
# include <mln/value/ops.hh>
# include <mln/metal/math/pow.hh>
@@ -40,8 +42,6 @@
# include <mln/value/internal/encoding.hh>
# include <mln/value/concept/integer.hh>
# include <mln/trait/value_.hh>
-# include <mln/trait/all.hh> // FIXME!
-# include <mln/trait/value_.hh>
# include <mln/debug/format.hh>
1
0
URL: https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
ChangeLog:
2008-09-12 Guillaume Lazzara <z(a)lrde.epita.fr>
Propagate few renamings.
* milena/mln/canvas/browsing/snake_fwd.hh,
* milena/mln/debug/println.spe.hh: Use def::coord instead of int.
* milena/mln/convert/to_image.hh: Rename mln_point to mln_site.
* milena/mln/geom/shift.hh:
Use convert::to instead of convert::to_dpoint().
* milena/mln/level/median.hh: Update the use of io property.
* milena/mln/pw/image.hh: Fix typo.
* milena/mln/win/line.hh: remove useless '_' in type name.
---
canvas/browsing/snake_fwd.hh | 4 ++--
convert/to_image.hh | 2 +-
debug/println.spe.hh | 6 +++---
geom/shift.hh | 3 ++-
level/median.hh | 2 +-
pw/image.hh | 2 +-
win/line.hh | 6 +++---
7 files changed, 13 insertions(+), 12 deletions(-)
Index: branches/cleanup-2008/milena/mln/debug/println.spe.hh
===================================================================
--- branches/cleanup-2008/milena/mln/debug/println.spe.hh (revision 2225)
+++ branches/cleanup-2008/milena/mln/debug/println.spe.hh (revision 2226)
@@ -158,9 +158,9 @@
println(const box3d& b, const I& input)
{
point3d p;
- int& sli = p.sli();
- int& row = p.row();
- int& col = p.col();
+ def::coord& sli = p.sli();
+ def::coord& row = p.row();
+ def::coord& col = p.col();
const int
max_row = b.max_row(),
max_sli = b.max_sli(),
Index: branches/cleanup-2008/milena/mln/level/median.hh
===================================================================
--- branches/cleanup-2008/milena/mln/level/median.hh (revision 2225)
+++ branches/cleanup-2008/milena/mln/level/median.hh (revision 2226)
@@ -303,7 +303,7 @@
{
trace::entering("level::median_dir");
- mlc_is(mln_trait_image_io(O), trait::image::io::write)::check();
+ mlc_is(mln_trait_image_value_io(O), trait::image::value_io::read_write)::check();
mlc_is(mln_trait_image_support(I), trait::image::support::aligned)::check();
mlc_converts_to(mln_value(I), mln_value(O))::check();
Index: branches/cleanup-2008/milena/mln/convert/to_image.hh
===================================================================
--- branches/cleanup-2008/milena/mln/convert/to_image.hh (revision 2225)
+++ branches/cleanup-2008/milena/mln/convert/to_image.hh (revision 2226)
@@ -64,7 +64,7 @@
template <typename T>
struct helper_dim_
{
- typedef mln_point(T) P;
+ typedef mln_site(T) P;
enum { value = P::dim };
};
Index: branches/cleanup-2008/milena/mln/pw/image.hh
===================================================================
--- branches/cleanup-2008/milena/mln/pw/image.hh (revision 2225)
+++ branches/cleanup-2008/milena/mln/pw/image.hh (revision 2226)
@@ -142,7 +142,7 @@
/// Give the definition domain.
const S& domain() const;
- /// Returns the function which compute a site value.
+ /// Return the function which computes a site value.
F function() const;
/// Read-only access of pixel value at point site \p p.
Index: branches/cleanup-2008/milena/mln/geom/shift.hh
===================================================================
--- branches/cleanup-2008/milena/mln/geom/shift.hh (revision 2225)
+++ branches/cleanup-2008/milena/mln/geom/shift.hh (revision 2226)
@@ -34,6 +34,7 @@
*/
# include <mln/core/window.hh>
+# include <mln/convert/to.hh>
@@ -60,7 +61,7 @@
window<mln_dpoint(W)> tmp;
mln_qiter(W) q(win, P::origin);
for_all(q)
- tmp.insert(convert::to_dpoint(q) + dp);
+ tmp.insert(convert::to(q) + dp);
return tmp;
}
Index: branches/cleanup-2008/milena/mln/win/line.hh
===================================================================
--- branches/cleanup-2008/milena/mln/win/line.hh (revision 2225)
+++ branches/cleanup-2008/milena/mln/win/line.hh (revision 2226)
@@ -58,16 +58,16 @@
*/
template <typename M, unsigned i, typename C>
struct line : public Window< line<M,i,C> >,
- public internal::dpoints_base_<dpoint_<M, C>, point_<M, C> >
+ public internal::dpoints_base_<dpoint<M, C>, point<M, C> >
{
/// Point associated type.
- typedef point_<M, int> point;
+ typedef point<M, int> point;
/// Psite associated type.
typedef point psite;
/// Dpoint associated type.
- typedef dpoint_<M, int> dpoint;
+ typedef dpoint<M, int> dpoint;
/// Site_Iterator type to browse a line forward
typedef dpoints_fwd_piter<dpoint> fwd_qiter;
Index: branches/cleanup-2008/milena/mln/canvas/browsing/snake_fwd.hh
===================================================================
--- branches/cleanup-2008/milena/mln/canvas/browsing/snake_fwd.hh (revision 2225)
+++ branches/cleanup-2008/milena/mln/canvas/browsing/snake_fwd.hh (revision 2226)
@@ -110,8 +110,8 @@
// p
f.p = f.input.bbox().pmin();
- int& row = f.p.row();
- int& col = f.p.col();
+ def::coord& row = f.p.row();
+ def::coord& col = f.p.col();
// initialization
trace::entering("canvas::browsing::snake_fwd::init");
1
0
12 Sep '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Propagate a few renamings to some test code.
* tests/core/site_set/p_queue_fast.cc,
* tests/core/site_set/p_priority_queue_fast.cc,
* tests/core/site_set/p_queue.cc,
* tests/core/site_set/p_priority_queue.cc,
* tests/core/site_set/p_runs.cc,
* tests/core/site_set/p_image2d.cc,
* tests/core/site_set/pset_array.cc,
* tests/core/site_set/pset_if.cc,
* tests/core/site_set/p_priority_queue_fast_with_array.cc,
* tests/core/site_set/p_set.cc,
* tests/core/other/neighb.cc,
* tests/core/other/pixter2d.cc,
* tests/core/other/pixter3d.cc,
* tests/core/image/complex_image.cc,
* tests/core/image/image3d.cc,
* tests/core/image/image_if.cc,
* tests/draw/line.cc,
* tests/level/median_fast.cc,
* tests/border/mirror_full.cc,
* tests/border/duplicate_full.cc,
* tests/border/fill_full.cc,
* tests/border/mirror.cc,
* tests/border/duplicate.cc,
* tests/border/fill.cc,
* tests/convert/to_p_set.cc,
* tests/convert/to_p_array.cc,
* tests/util/lemmings.cc,
* tests/labeling/level.cc (npoints): Update to...
(nsites): ...this.
(image::operator[]): Update to...
(image::element): ...this.
(mln_point): Update to...
(mln_site): ...this.
border/duplicate.cc | 52 +++++-----
border/duplicate_full.cc | 6 -
border/fill.cc | 4
border/fill_full.cc | 24 ++--
border/mirror.cc | 108 +++++++++++-----------
border/mirror_full.cc | 6 -
convert/to_p_array.cc | 4
convert/to_p_set.cc | 4
core/image/complex_image.cc | 2
core/image/image3d.cc | 6 -
core/image/image_if.cc | 2
core/other/neighb.cc | 2
core/other/pixter2d.cc | 4
core/other/pixter3d.cc | 4
core/site_set/p_image2d.cc | 6 -
core/site_set/p_priority_queue.cc | 12 +-
core/site_set/p_priority_queue_fast.cc | 12 +-
core/site_set/p_priority_queue_fast_with_array.cc | 18 +--
core/site_set/p_queue.cc | 8 -
core/site_set/p_queue_fast.cc | 8 -
core/site_set/p_runs.cc | 6 -
core/site_set/p_set.cc | 6 -
core/site_set/pset_array.cc | 4
core/site_set/pset_if.cc | 4
draw/line.cc | 2
labeling/level.cc | 2
level/median_fast.cc | 2
util/lemmings.cc | 20 ++--
28 files changed, 169 insertions(+), 169 deletions(-)
Index: tests/core/site_set/p_queue_fast.cc
--- tests/core/site_set/p_queue_fast.cc (revision 2224)
+++ tests/core/site_set/p_queue_fast.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -44,14 +44,14 @@
.push(make::point2d(6, 9))
.push(make::point2d(5, 1))
.push(make::point2d(4, 2));
- mln_assertion(q.npoints() == 3);
+ mln_assertion(q.nsites() == 3);
std::cout << q.bbox() << std::endl;
std::cout << q << std::endl;
q.pop();
- mln_assertion(q.npoints() == 2);
+ mln_assertion(q.nsites() == 2);
point2d p = q.front();
- mln_assertion(q.npoints() == 2);
+ mln_assertion(q.nsites() == 2);
mln_assertion(p == make::point2d(5, 1));
}
Index: tests/core/site_set/p_priority_queue_fast.cc
--- tests/core/site_set/p_priority_queue_fast.cc (revision 2224)
+++ tests/core/site_set/p_priority_queue_fast.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -44,7 +44,7 @@
mln_assertion (q.is_empty ());
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites() == 0);
q.push_force (p3);
q.push_force (p1, 3);
@@ -59,7 +59,7 @@
mln_assertion (q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 3);
+ mln_assertion (q.nsites() == 3);
mln_assertion (q.front () == p2);
q.pop ();
@@ -67,7 +67,7 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 2);
+ mln_assertion (q.nsites() == 2);
mln_assertion (q.front () == p1);
q.pop ();
@@ -75,14 +75,14 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 1);
+ mln_assertion (q.nsites() == 1);
mln_assertion (q.front () == p3);
q.pop ();
mln_assertion (!q.has (p1));
mln_assertion (!q.has (p2));
mln_assertion (!q.has (p3));
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites() == 0);
mln_assertion (q.is_empty ());
Index: tests/core/site_set/p_queue.cc
--- tests/core/site_set/p_queue.cc (revision 2224)
+++ tests/core/site_set/p_queue.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -44,14 +44,14 @@
.push(make::point2d(6, 9))
.push(make::point2d(5, 1))
.push(make::point2d(4, 2));
- mln_assertion(q.npoints() == 3);
+ mln_assertion(q.nsites() == 3);
std::cout << q.bbox() << std::endl;
std::cout << q << std::endl;
q.pop();
- mln_assertion(q.npoints() == 2);
+ mln_assertion(q.nsites() == 2);
point2d p = q.front();
- mln_assertion(q.npoints() == 2);
+ mln_assertion(q.nsites() == 2);
mln_assertion(p == make::point2d(5, 1));
}
Index: tests/core/site_set/p_priority_queue.cc
--- tests/core/site_set/p_priority_queue.cc (revision 2224)
+++ tests/core/site_set/p_priority_queue.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -44,7 +44,7 @@
mln_assertion (q.is_empty ());
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites() == 0);
q.push_force (p3);
q.push_force (p1, 3);
@@ -59,7 +59,7 @@
mln_assertion (q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 3);
+ mln_assertion (q.nsites() == 3);
mln_assertion (q.front () == p2);
q.pop ();
@@ -67,7 +67,7 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 2);
+ mln_assertion (q.nsites() == 2);
mln_assertion (q.front () == p1);
q.pop ();
@@ -75,14 +75,14 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 1);
+ mln_assertion (q.nsites() == 1);
mln_assertion (q.front () == p3);
q.pop ();
mln_assertion (!q.has (p1));
mln_assertion (!q.has (p2));
mln_assertion (!q.has (p3));
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites() == 0);
mln_assertion (q.is_empty ());
Index: tests/core/site_set/p_runs.cc
--- tests/core/site_set/p_runs.cc (revision 2224)
+++ tests/core/site_set/p_runs.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -61,10 +61,10 @@
p_runs_<point2d> ps2;
ps.insert(p_run<point2d>(p, 7));
- mln_assertion(ps.npoints() == 7);
+ mln_assertion(ps.nsites() == 7);
ps.insert(p_run<point2d>(q, 5));
- mln_assertion(ps.npoints() == 12);
+ mln_assertion(ps.nsites() == 12);
ps.insert(p_run<point2d>(r, 2));
Index: tests/core/site_set/p_image2d.cc
--- tests/core/site_set/p_image2d.cc (revision 2224)
+++ tests/core/site_set/p_image2d.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -43,7 +43,7 @@
.insert(make::point2d(4, 2))
.insert(make::point2d(4, 2))
.insert(make::point2d(5, 1));
- mln_assertion(ps.npoints() == 3);
+ mln_assertion(ps.nsites() == 3);
ps.remove(make::point2d(5, 1));
ps.remove(make::point2d(5, 1));
@@ -51,7 +51,7 @@
ps.remove(make::point2d(6, 9));
ps.remove(make::point2d(4, 2));
- mln_assertion(ps.npoints() == 0);
+ mln_assertion(ps.nsites() == 0);
mln_assertion(ps.is_empty());
std::cout << ps << std::endl;
Index: tests/core/site_set/pset_array.cc
--- tests/core/site_set/pset_array.cc (revision 2224)
+++ tests/core/site_set/pset_array.cc (working copy)
@@ -64,11 +64,11 @@
assert(array.npsets() == 0);
array.insert(pruns0);
assert(array.npsets() == 1);
- assert(array.npoints() == 2);
+ assert(array.nsites() == 2);
array.insert(pruns2);
assert(array.npsets() == 2);
- assert(array.npoints() == 7);
+ assert(array.nsites() == 7);
array.insert(pruns1);
Index: tests/core/site_set/pset_if.cc
--- tests/core/site_set/pset_if.cc (revision 2224)
+++ tests/core/site_set/pset_if.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -43,7 +43,7 @@
using namespace mln;
box2d box_8x8 = make::box2d(8, 8);
- mln_assertion((box_8x8 | fun::p2b::chess).npoints() == 32);
+ mln_assertion((box_8x8 | fun::p2b::chess).nsites() == 32);
{
p_set<point2d> s = convert::to_p_set(box_8x8 | fun::p2b::chess);
Index: tests/core/site_set/p_priority_queue_fast_with_array.cc
--- tests/core/site_set/p_priority_queue_fast_with_array.cc (revision 2224)
+++ tests/core/site_set/p_priority_queue_fast_with_array.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -43,19 +43,19 @@
point2d p3 (4, 2);
mln_assertion (q.is_empty ());
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites() == 0);
q.push_force (p3);
mln_assertion (!q.is_empty ());
- mln_assertion (q.npoints () == 1);
+ mln_assertion (q.nsites() == 1);
q.push_force (p1, 3);
mln_assertion (!q.is_empty ());
- mln_assertion (q.npoints () == 2);
+ mln_assertion (q.nsites() == 2);
q.push_force (p2, 5);
mln_assertion (!q.is_empty ());
- mln_assertion (q.npoints () == 3);
+ mln_assertion (q.nsites() == 3);
std::cout << q.bbox () << std::endl;
std::cout << q << std::endl;
@@ -66,7 +66,7 @@
mln_assertion (q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 3);
+ mln_assertion (q.nsites() == 3);
mln_assertion (q.front () == p2);
q.pop ();
@@ -74,7 +74,7 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 2);
+ mln_assertion (q.nsites() == 2);
mln_assertion (q.front () == p1);
q.pop ();
@@ -82,14 +82,14 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 1);
+ mln_assertion (q.nsites() == 1);
mln_assertion (q.front () == p3);
q.pop ();
mln_assertion (!q.has (p1));
mln_assertion (!q.has (p2));
mln_assertion (!q.has (p3));
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites() == 0);
mln_assertion (q.is_empty ());
Index: tests/core/site_set/p_set.cc
--- tests/core/site_set/p_set.cc (revision 2224)
+++ tests/core/site_set/p_set.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -47,7 +47,7 @@
.insert(make::point2d(4, 2))
.insert(make::point2d(4, 2))
.insert(make::point2d(5, 1));
- mln_assertion(ps.npoints() == 3);
+ mln_assertion(ps.nsites() == 3);
std::cout << ps.bbox() << std::endl;
std::copy(ps.vect().begin(), ps.vect().end(),
@@ -55,7 +55,7 @@
std::cout << std::endl;
ps.remove(make::point2d(4, 2));
- mln_assertion(ps.npoints() == 2);
+ mln_assertion(ps.nsites() == 2);
std::cout << ps.bbox() << std::endl;
std::copy(ps.vect().begin(), ps.vect().end(),
Index: tests/core/other/neighb.cc
--- tests/core/other/neighb.cc (revision 2224)
+++ tests/core/other/neighb.cc (working copy)
@@ -35,7 +35,7 @@
using namespace mln;
template <typename N>
-void test(const Neighborhood<N>& nbh, const mln_point(N)& p_ref,
+void test(const Neighborhood<N>& nbh, const mln_site(N)& p_ref,
unsigned size)
{
mln_niter(N) n(nbh, p_ref);
Index: tests/core/other/pixter2d.cc
--- tests/core/other/pixter2d.cc (revision 2224)
+++ tests/core/other/pixter2d.cc (working copy)
@@ -63,7 +63,7 @@
p.next();
++i;
}
- mln_assertion(i == b.npoints());
+ mln_assertion(i == b.nsites());
}
{
@@ -79,7 +79,7 @@
p.next();
++i;
}
- mln_assertion(i == b.npoints());
+ mln_assertion(i == b.nsites());
}
}
}
Index: tests/core/other/pixter3d.cc
--- tests/core/other/pixter3d.cc (revision 2224)
+++ tests/core/other/pixter3d.cc (working copy)
@@ -64,7 +64,7 @@
p.next();
++i;
}
- mln_assertion(i == b.npoints());
+ mln_assertion(i == b.nsites());
}
{
@@ -80,7 +80,7 @@
p.next();
++i;
}
- mln_assertion(i == b.npoints());
+ mln_assertion(i == b.nsites());
}
}
}
Index: tests/core/image/complex_image.cc
--- tests/core/image/complex_image.cc (revision 2224)
+++ tests/core/image/complex_image.cc (working copy)
@@ -136,7 +136,7 @@
typename mln::complex_image<D, P, V>::lvalue
mln::complex_image<D, P, V>::operator()(const mln::complex_psite<D, P>&)
[with unsigned int D = 2u,
- P = mln::point_<mln::grid::square, int>,
+ P = mln::point<mln::grid::square, int>,
V = mln::value::int_u<8u>]:
Assertion `this->data_->pc_.has(p)' failed.
Index: tests/core/image/image3d.cc
--- tests/core/image/image3d.cc (revision 2224)
+++ tests/core/image/image3d.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -45,8 +45,8 @@
image3d<int> f(nslis, nrows, ncols, border);
- mln_assertion(f.npoints() == geom::nslis(f) * geom::nrows(f) * geom::ncols(f));
- mln_assertion(f.ncells() == ((nrows + 2 * border)
+ mln_assertion(f.nsites() == geom::nslis(f) * geom::nrows(f) * geom::ncols(f));
+ mln_assertion(f.nelements() == ((nrows + 2 * border)
* (ncols + 2 * border)
* (nslis + 2 * border)));
}
Index: tests/core/image/image_if.cc
--- tests/core/image/image_if.cc (revision 2224)
+++ tests/core/image/image_if.cc (working copy)
@@ -44,7 +44,7 @@
I ima(8, 8);
// debug::println(ima | fun::p2b::chess);
// FIXME: is this line corret?
- ///mln_assertion((ima | fun::p2b::chess).npoints() == 32);
+ ///mln_assertion((ima | fun::p2b::chess).nsites() == 32);
{
typedef image_if<I, fun::p2b::chess_t> II;
Index: tests/draw/line.cc
--- tests/draw/line.cc (revision 2224)
+++ tests/draw/line.cc (working copy)
@@ -48,7 +48,7 @@
point2d b = make::point2d(0,0), e = make::point2d(6,9);
line2d l(b, e);
- mln_assertion(l.npoints() == 10);
+ mln_assertion(l.nsites() == 10);
image2d<bool> ima(10,10);
level::fill(ima, false);
Index: tests/level/median_fast.cc
--- tests/level/median_fast.cc (revision 2224)
+++ tests/level/median_fast.cc (working copy)
@@ -53,7 +53,7 @@
template <typename I, typename W>
void test(I& input, const W& win)
{
- mln_point(I) p;
+ mln_site(I) p;
p.row() = p.col() = 1;
{
Index: tests/border/mirror_full.cc
--- tests/border/mirror_full.cc (revision 2224)
+++ tests/border/mirror_full.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -51,7 +51,7 @@
border::mirror(ima);
for (int i = 0; i < c; ++i)
- mln_assertion(ima[i] == ref[i]);
+ mln_assertion(ima.element(i) == ref[i]);
}
template <typename T>
@@ -65,7 +65,7 @@
border::mirror(ima);
for (int i = 0; i < c * r; ++i)
- mln_assertion(ima[i] == ref[i]);
+ mln_assertion(ima.element(i) == ref[i]);
}
}
Index: tests/border/duplicate_full.cc
--- tests/border/duplicate_full.cc (revision 2224)
+++ tests/border/duplicate_full.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -50,7 +50,7 @@
border::duplicate(ima);
for (int i = 0; i < c; ++i)
- mln_assertion(ima[i] == ref[i]);
+ mln_assertion(ima.element(i) == ref[i]);
}
template <typename T>
@@ -64,7 +64,7 @@
border::duplicate(ima);
for (int i = 0; i < c * r; ++i)
- mln_assertion(ima[i] == ref[i]);
+ mln_assertion(ima.element(i) == ref[i]);
}
}
Index: tests/border/fill_full.cc
--- tests/border/fill_full.cc (revision 2224)
+++ tests/border/fill_full.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -58,13 +58,13 @@
unsigned i = 0;
for(i = 0; i < border; ++i)
- mln_assertion (ima[i] == value);
+ mln_assertion (ima.element(i) == value);
unsigned bo = border + row;
for(; i < bo; ++i)
- mln_assertion (ima[i] == v);
+ mln_assertion (ima.element(i) == v);
bo += border;
for(; i < bo; ++i)
- mln_assertion (ima[i] == value);
+ mln_assertion (ima.element(i) == value);
}
template <typename T>
@@ -83,18 +83,18 @@
unsigned ww = r * c;
for(i = 0; i < bo; ++i)
- mln_assertion (ima[i] == value);
+ mln_assertion (ima.element(i) == value);
bo += c * row;
for(; i < bo; ++i)
{
unsigned cur = i % c;
if (cur < border || cur >= u)
- mln_assertion (ima[i] == value);
+ mln_assertion (ima.element(i) == value);
else
- mln_assertion (ima[i] == v);
+ mln_assertion (ima.element(i) == v);
}
for(; i < ww; ++i)
- mln_assertion (ima[i] == value);
+ mln_assertion (ima.element(i) == value);
}
template <typename T>
@@ -113,18 +113,18 @@
unsigned ww = r * c;
for(i = 0; i < bo; ++i)
- mln_assertion (ima[i] == value);
+ mln_assertion (ima.element(i) == value);
bo += c * row;
for(; i < bo; ++i)
{
unsigned cur = i % c;
if (cur < border || cur >= u)
- mln_assertion (ima[i] == value);
+ mln_assertion (ima.element(i) == value);
else
- mln_assertion (ima[i] == v);
+ mln_assertion (ima.element(i) == v);
}
for(; i < ww; ++i)
- mln_assertion (ima[i] == value);
+ mln_assertion (ima.element(i) == value);
}
Index: tests/border/mirror.cc
--- tests/border/mirror.cc (revision 2224)
+++ tests/border/mirror.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -43,17 +43,17 @@
main (void)
{
{
- image1d<int> im(2, 3);
- debug::iota(im);
- border::mirror(im);
- mln_assertion(im[0] == 2);
- mln_assertion(im[1] == 2);
- mln_assertion(im[2] == 1);
- mln_assertion(im[3] == 1);
- mln_assertion(im[4] == 2);
- mln_assertion(im[5] == 2);
- mln_assertion(im[6] == 1);
- mln_assertion(im[7] == 1);
+ image1d<int> ima(2, 3);
+ debug::iota(ima);
+ border::mirror(ima);
+ mln_assertion(ima.element(0) == 2);
+ mln_assertion(ima.element(1) == 2);
+ mln_assertion(ima.element(2) == 1);
+ mln_assertion(ima.element(3) == 1);
+ mln_assertion(ima.element(4) == 2);
+ mln_assertion(ima.element(5) == 2);
+ mln_assertion(ima.element(6) == 1);
+ mln_assertion(ima.element(7) == 1);
}
@@ -62,47 +62,47 @@
debug::iota(ima);
border::mirror(ima);
- mln_assertion(ima[ 0] == 1);
- mln_assertion(ima[ 1] == 1);
- mln_assertion(ima[ 2] == 4);
- mln_assertion(ima[ 3] == 5);
- mln_assertion(ima[ 4] == 6);
- mln_assertion(ima[ 5] == 3);
- mln_assertion(ima[ 6] == 3);
- mln_assertion(ima[ 7] == 1);
- mln_assertion(ima[ 8] == 1);
- mln_assertion(ima[ 9] == 1);
- mln_assertion(ima[10] == 2);
- mln_assertion(ima[11] == 3);
- mln_assertion(ima[12] == 3);
- mln_assertion(ima[13] == 3);
- mln_assertion(ima[14] == 2);
- mln_assertion(ima[15] == 1);
- mln_assertion(ima[16] == 1);
- mln_assertion(ima[17] == 2);
- mln_assertion(ima[18] == 3);
- mln_assertion(ima[19] == 3);
- mln_assertion(ima[20] == 2);
- mln_assertion(ima[21] == 5);
- mln_assertion(ima[22] == 4);
- mln_assertion(ima[23] == 4);
- mln_assertion(ima[24] == 5);
- mln_assertion(ima[25] == 6);
- mln_assertion(ima[26] == 6);
- mln_assertion(ima[27] == 5);
- mln_assertion(ima[28] == 4);
- mln_assertion(ima[29] == 4);
- mln_assertion(ima[30] == 4);
- mln_assertion(ima[31] == 5);
- mln_assertion(ima[32] == 6);
- mln_assertion(ima[33] == 6);
- mln_assertion(ima[34] == 6);
- mln_assertion(ima[35] == 4);
- mln_assertion(ima[36] == 4);
- mln_assertion(ima[37] == 1);
- mln_assertion(ima[38] == 2);
- mln_assertion(ima[39] == 3);
- mln_assertion(ima[40] == 6);
- mln_assertion(ima[41] == 6);
+ mln_assertion(ima.element( 0) == 1);
+ mln_assertion(ima.element( 1) == 1);
+ mln_assertion(ima.element( 2) == 4);
+ mln_assertion(ima.element( 3) == 5);
+ mln_assertion(ima.element( 4) == 6);
+ mln_assertion(ima.element( 5) == 3);
+ mln_assertion(ima.element( 6) == 3);
+ mln_assertion(ima.element( 7) == 1);
+ mln_assertion(ima.element( 8) == 1);
+ mln_assertion(ima.element( 9) == 1);
+ mln_assertion(ima.element(10) == 2);
+ mln_assertion(ima.element(11) == 3);
+ mln_assertion(ima.element(12) == 3);
+ mln_assertion(ima.element(13) == 3);
+ mln_assertion(ima.element(14) == 2);
+ mln_assertion(ima.element(15) == 1);
+ mln_assertion(ima.element(16) == 1);
+ mln_assertion(ima.element(17) == 2);
+ mln_assertion(ima.element(18) == 3);
+ mln_assertion(ima.element(19) == 3);
+ mln_assertion(ima.element(20) == 2);
+ mln_assertion(ima.element(21) == 5);
+ mln_assertion(ima.element(22) == 4);
+ mln_assertion(ima.element(23) == 4);
+ mln_assertion(ima.element(24) == 5);
+ mln_assertion(ima.element(25) == 6);
+ mln_assertion(ima.element(26) == 6);
+ mln_assertion(ima.element(27) == 5);
+ mln_assertion(ima.element(28) == 4);
+ mln_assertion(ima.element(29) == 4);
+ mln_assertion(ima.element(30) == 4);
+ mln_assertion(ima.element(31) == 5);
+ mln_assertion(ima.element(32) == 6);
+ mln_assertion(ima.element(33) == 6);
+ mln_assertion(ima.element(34) == 6);
+ mln_assertion(ima.element(35) == 4);
+ mln_assertion(ima.element(36) == 4);
+ mln_assertion(ima.element(37) == 1);
+ mln_assertion(ima.element(38) == 2);
+ mln_assertion(ima.element(39) == 3);
+ mln_assertion(ima.element(40) == 6);
+ mln_assertion(ima.element(41) == 6);
}
Index: tests/border/duplicate.cc
--- tests/border/duplicate.cc (revision 2224)
+++ tests/border/duplicate.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -45,31 +45,31 @@
debug::iota (ima);
border::duplicate (ima);
- mln_assertion(ima[ 0] == 1);
- mln_assertion(ima[ 1] == 1);
- mln_assertion(ima[ 2] == 2);
- mln_assertion(ima[ 3] == 3);
- mln_assertion(ima[ 4] == 3);
- mln_assertion(ima[ 5] == 1);
- mln_assertion(ima[ 6] == 1);
- mln_assertion(ima[ 7] == 2);
- mln_assertion(ima[ 8] == 3);
- mln_assertion(ima[ 9] == 3);
- mln_assertion(ima[10] == 4);
- mln_assertion(ima[11] == 4);
- mln_assertion(ima[12] == 5);
- mln_assertion(ima[13] == 6);
- mln_assertion(ima[14] == 6);
- mln_assertion(ima[15] == 7);
- mln_assertion(ima[16] == 7);
- mln_assertion(ima[17] == 8);
- mln_assertion(ima[18] == 9);
- mln_assertion(ima[19] == 9);
- mln_assertion(ima[20] == 7);
- mln_assertion(ima[21] == 7);
- mln_assertion(ima[22] == 8);
- mln_assertion(ima[23] == 9);
- mln_assertion(ima[24] == 9);
+ mln_assertion(ima.element( 0) == 1);
+ mln_assertion(ima.element( 1) == 1);
+ mln_assertion(ima.element( 2) == 2);
+ mln_assertion(ima.element( 3) == 3);
+ mln_assertion(ima.element( 4) == 3);
+ mln_assertion(ima.element( 5) == 1);
+ mln_assertion(ima.element( 6) == 1);
+ mln_assertion(ima.element( 7) == 2);
+ mln_assertion(ima.element( 8) == 3);
+ mln_assertion(ima.element( 9) == 3);
+ mln_assertion(ima.element(10) == 4);
+ mln_assertion(ima.element(11) == 4);
+ mln_assertion(ima.element(12) == 5);
+ mln_assertion(ima.element(13) == 6);
+ mln_assertion(ima.element(14) == 6);
+ mln_assertion(ima.element(15) == 7);
+ mln_assertion(ima.element(16) == 7);
+ mln_assertion(ima.element(17) == 8);
+ mln_assertion(ima.element(18) == 9);
+ mln_assertion(ima.element(19) == 9);
+ mln_assertion(ima.element(20) == 7);
+ mln_assertion(ima.element(21) == 7);
+ mln_assertion(ima.element(22) == 8);
+ mln_assertion(ima.element(23) == 9);
+ mln_assertion(ima.element(24) == 9);
}
Index: tests/border/fill.cc
--- tests/border/fill.cc (revision 2224)
+++ tests/border/fill.cc (working copy)
@@ -48,11 +48,11 @@
border::fill (ima, 42);
for(int i = 0; i < ww; ++i)
if ((i / w < border) || (i / w > border + size))
- mln_assertion (ima[i] == 42u);
+ mln_assertion (ima.element(i) == 42u);
else
if ((i % w < border) &&
(border + size <= i % w))
- mln_assertion (ima[i] == 42u);
+ mln_assertion (ima.element(i) == 42u);
}
int
Index: tests/convert/to_p_set.cc
--- tests/convert/to_p_set.cc (revision 2224)
+++ tests/convert/to_p_set.cc (working copy)
@@ -46,8 +46,8 @@
void test(p_set<point2d> ref, p_set<point2d> cmp)
{
- mln_assertion(ref.npoints() == cmp.npoints());
- for (unsigned i = 0; i < ref.npoints(); ++i)
+ mln_assertion(ref.nsites() == cmp.nsites());
+ for (unsigned i = 0; i < ref.nsites(); ++i)
mln_assertion(ref[i] == cmp[i]);
}
Index: tests/convert/to_p_array.cc
--- tests/convert/to_p_array.cc (revision 2224)
+++ tests/convert/to_p_array.cc (working copy)
@@ -48,7 +48,7 @@
win::segment1d win1d(5);
vec1d v1(convert::to_p_array(win1d, p1));
- for (size_t i=0; i < v1.npoints(); i++)
+ for (size_t i=0; i < v1.nsites(); i++)
std::cout << (v1[i]);
std::cout << "\n";
@@ -58,7 +58,7 @@
win::rectangle2d win2d(3, 3);
vec2d v2(convert::to_p_array(win2d, p2));
- for (size_t i=0; i < v2.npoints(); i++)
+ for (size_t i=0; i < v2.nsites(); i++)
std::cout << (v2[i]);
}
Index: tests/util/lemmings.cc
--- tests/util/lemmings.cc (revision 2224)
+++ tests/util/lemmings.cc (working copy)
@@ -48,11 +48,11 @@
I ima = make::image2d<int>(vals);
- mln_point_(I) pt1(1, 0);
- mln_point_(I) pt2(0, 2);
- mln_point_(I) pt3(2, 3);
- mln_point_(I) pt4(3, 1);
- mln_point_(I) pt5(1, 1);
+ mln_site_(I) pt1(1, 0);
+ mln_site_(I) pt2(0, 2);
+ mln_site_(I) pt3(2, 3);
+ mln_site_(I) pt4(3, 1);
+ mln_site_(I) pt5(1, 1);
mln_value_(I) vl1 = ima(pt1);
mln_value_(I) vl2 = ima(pt2);
@@ -60,11 +60,11 @@
mln_value_(I) vl4 = ima(pt4);
mln_value_(I) vl5 = ima(pt5);
- mln_point_(I) ptl1 = util::lemmings(ima, pt1, right, vl1);
- mln_point_(I) ptl2 = util::lemmings(ima, pt2, down, vl2);
- mln_point_(I) ptl3 = util::lemmings(ima, pt3, left, vl3);
- mln_point_(I) ptl4 = util::lemmings(ima, pt4, up, vl4);
- mln_point_(I) ptl5 = util::lemmings(ima, pt5, up, vl5);
+ mln_site_(I) ptl1 = util::lemmings(ima, pt1, right, vl1);
+ mln_site_(I) ptl2 = util::lemmings(ima, pt2, down, vl2);
+ mln_site_(I) ptl3 = util::lemmings(ima, pt3, left, vl3);
+ mln_site_(I) ptl4 = util::lemmings(ima, pt4, up, vl4);
+ mln_site_(I) ptl5 = util::lemmings(ima, pt5, up, vl5);
mln_assertion(ptl1 == point2d(1, 2));
mln_assertion(ptl2 == point2d(2, 2));
Index: tests/labeling/level.cc
--- tests/labeling/level.cc (revision 2224)
+++ tests/labeling/level.cc (working copy)
@@ -63,5 +63,5 @@
accu::compute<accu::count>(labels | (pw::value(labels) != pw::cst(0u)));
npixels += npix;
}
- mln_assertion(npixels == lena.npoints());
+ mln_assertion(npixels == lena.nsites());
}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
ChangeLog:
2008-09-11 Guillaume Lazzara <z(a)lrde.epita.fr>
Fix most of Doxygen's warnings.
* milena/mln/core/image/flat_image.hh,
* milena/mln/core/internal/site_relative_iterator_base.hh,
* milena/mln/core/site_set/line2d.hh,
* milena/mln/core/site_set/p_if_piter.hh,
* milena/mln/core/site_set/p_priority.hh,
* milena/mln/trait/image/props.hh,
* milena/mln/util/internal/boost_graph_structure.hh,
* milena/mln/util/internal/graph_base.hh,
* milena/tests/algebra/h_vec.cc,
* milena/tests/binarization/threshold.cc,
* milena/tests/core/image/flat_image.cc,
* milena/tests/core/image/tr_image.cc,
* milena/tests/core/other/dpoints_pixter.cc,
* milena/tests/core/site_set/p_priority_queue.cc,
* milena/tests/core/site_set/p_priority_queue_fast.cc,
* milena/tests/core/site_set/p_priority_queue_fast_with_array.cc,
* milena/tests/core/site_set/pset_array.cc,
* milena/tests/core/site_set/pset_if.cc,
* milena/tests/level/sort_psites_full.cc,
* milena/tests/morpho/line_graph_image_wst.cc,
* milena/tests/morpho/meyer_wst.cc,
* milena/tests/morpho/meyer_wst_long.cc,
* milena/tests/test/positive.cc,
* milena/tests/value/builtin/builtin.cc:
Fix \file tag with the proper file name.
* milena/doc/Doxyfile.in: Add new macro expansions.
* milena/doc/Makefile.am: set EXCLUDE_SYMBOLS properly when
making the user doc.
---
doc/Doxyfile.in | 11 ++++++++++-
doc/Makefile.am | 5 ++++-
mln/core/image/flat_image.hh | 2 +-
mln/core/internal/site_relative_iterator_base.hh | 2 +-
mln/core/site_set/line2d.hh | 2 +-
mln/core/site_set/p_if_piter.hh | 2 +-
mln/core/site_set/p_priority.hh | 2 +-
mln/trait/image/props.hh | 4 ++++
mln/util/internal/boost_graph_structure.hh | 2 +-
mln/util/internal/graph_base.hh | 2 +-
tests/algebra/h_vec.cc | 2 +-
tests/binarization/threshold.cc | 2 +-
tests/core/image/flat_image.cc | 2 +-
tests/core/image/tr_image.cc | 2 +-
tests/core/other/dpoints_pixter.cc | 2 +-
tests/core/site_set/p_priority_queue.cc | 2 +-
tests/core/site_set/p_priority_queue_fast.cc | 2 +-
tests/core/site_set/p_priority_queue_fast_with_array.cc | 4 ++--
tests/core/site_set/pset_array.cc | 2 +-
tests/core/site_set/pset_if.cc | 2 +-
tests/level/sort_psites_full.cc | 2 +-
tests/morpho/line_graph_image_wst.cc | 2 +-
tests/morpho/meyer_wst.cc | 2 +-
tests/morpho/meyer_wst_long.cc | 2 +-
tests/test/positive.cc | 2 +-
tests/value/builtin/builtin.cc | 2 +-
26 files changed, 42 insertions(+), 26 deletions(-)
Index: branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue_fast.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue_fast.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue_fast.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/core/site_set/p_priority_fast.cc
+/*! \file tests/core/site_set/p_priority_queue_fast.cc
*
* \brief Tests on mln::p_priority_fast.
*/
Index: branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/core/site_set/p_priority.cc
+/*! \file tests/core/site_set/p_priority_queue.cc
*
* \brief Tests on mln::p_priority.
*/
Index: branches/cleanup-2008/milena/tests/core/site_set/pset_array.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/site_set/pset_array.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/core/site_set/pset_array.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file mln/core/pset_array.hh
+/*! \file tests/core/site_set/pset_array.cc
*
* \brief Tests for the pset array.
*/
Index: branches/cleanup-2008/milena/tests/core/site_set/pset_if.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/site_set/pset_if.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/core/site_set/pset_if.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/core/site_set/p_if.cc
+/*! \file tests/core/site_set/pset_if.cc
*
* \brief Tests on mln::p_if.
*/
Index: branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue_fast_with_array.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue_fast_with_array.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue_fast_with_array.cc (revision 2224)
@@ -25,13 +25,13 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/core/site_set/p_priority_fast_with_array.cc
+/*! \file tests/core/site_set/p_priority_queue_fast_with_array.cc
*
* \brief Tests on mln::p_priority_fast_with_array.
*/
#include <mln/core/alias/point2d.hh>
-#include <mln/core/p_priority_fast_with_array.hh>
+#include <mln/core/p_priority_queue_fast_with_array.hh>
int main ()
{
Index: branches/cleanup-2008/milena/tests/core/other/dpoints_pixter.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/other/dpoints_pixter.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/core/other/dpoints_pixter.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file tests/dpoints_pixter.cc
+/// \file tests/core/other/dpoints_pixter.cc
/// \brief Test on mln::dpoints_fwd_pixter and mln::dpoints_bkd_pixter.
#include <mln/core/image/image1d.hh>
Index: branches/cleanup-2008/milena/tests/core/image/tr_image.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/image/tr_image.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/core/image/tr_image.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/tr_image.cc
+/*! \file tests/core/image/tr_image.cc
*
* \brief Tests on mln::tr_image.
*/
Index: branches/cleanup-2008/milena/tests/core/image/flat_image.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/image/flat_image.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/core/image/flat_image.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/core/flat_image.cc
+/*! \file tests/core/image/flat_image.cc
*
* \brief Tests on mln::flat_image.
*/
Index: branches/cleanup-2008/milena/tests/level/sort_psites_full.cc
===================================================================
--- branches/cleanup-2008/milena/tests/level/sort_psites_full.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/level/sort_psites_full.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/level/sort_points_full.cc
+/*! \file tests/level/sort_psites_full.cc
*
* \brief Tests on mln::level::sort_points.
*/
Index: branches/cleanup-2008/milena/tests/value/builtin/builtin.cc
===================================================================
--- branches/cleanup-2008/milena/tests/value/builtin/builtin.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/value/builtin/builtin.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/value/builtin.cc
+/*! \file tests/value/builtin/builtin.cc
*
* \brief Tests on mln::trait::op with a builtin.
*/
Index: branches/cleanup-2008/milena/tests/test/positive.cc
===================================================================
--- branches/cleanup-2008/milena/tests/test/positive.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/test/positive.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/test/test_positive.cc
+/*! \file tests/test/positive.cc
*
* \brief Tests on mln::test::positive.
*/
Index: branches/cleanup-2008/milena/tests/binarization/threshold.cc
===================================================================
--- branches/cleanup-2008/milena/tests/binarization/threshold.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/binarization/threshold.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file tests/binarization/thresholding.cc
+/// \file tests/binarization/threshold.cc
/// \brief Test on mln::binarization::threshold.
#include <mln/core/image/image2d.hh>
Index: branches/cleanup-2008/milena/tests/algebra/h_vec.cc
===================================================================
--- branches/cleanup-2008/milena/tests/algebra/h_vec.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/algebra/h_vec.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/h_vec.cc
+/*! \file tests/algebra/h_vec.cc
*
* \brief Tests on mln::algebra::h_vec.
*/
Index: branches/cleanup-2008/milena/tests/morpho/meyer_wst_long.cc
===================================================================
--- branches/cleanup-2008/milena/tests/morpho/meyer_wst_long.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/morpho/meyer_wst_long.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file tests/morpho/extrema_components.cc
+/// \file tests/morpho/meyer_wst_long.cc
// /\brief Test on mln::morpho::extrema_components
#include <iostream>
Index: branches/cleanup-2008/milena/tests/morpho/line_graph_image_wst.cc
===================================================================
--- branches/cleanup-2008/milena/tests/morpho/line_graph_image_wst.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/morpho/line_graph_image_wst.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file tests/core/line_graph_image.cc
+/// \file tests/morpho/line_graph_image_wst.cc
/// \brief Tests on the Watershed Transform on a mln::line_graph_image.
#include <vector>
Index: branches/cleanup-2008/milena/tests/morpho/meyer_wst.cc
===================================================================
--- branches/cleanup-2008/milena/tests/morpho/meyer_wst.cc (revision 2223)
+++ branches/cleanup-2008/milena/tests/morpho/meyer_wst.cc (revision 2224)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file tests/morpho/extrema_components.cc
+/// \file tests/morpho/meyer_wst.cc
// /\brief Test on mln::morpho::extrema_components
#include <iostream>
Index: branches/cleanup-2008/milena/doc/Doxyfile.in
===================================================================
--- branches/cleanup-2008/milena/doc/Doxyfile.in (revision 2223)
+++ branches/cleanup-2008/milena/doc/Doxyfile.in (revision 2224)
@@ -82,6 +82,7 @@
EXCLUDE = @top_srcdir@/milena/sandbox
EXCLUDE_SYMLINKS = YES
EXCLUDE_PATTERNS = *spe.hh
+EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
@@ -210,7 +211,15 @@
"mln_mesh(T)=typename T::mesh" \
"mln_coord(T)=typename T::coord" \
"mln_point(T)=typename T::point" \
- "mln_dpoint(T)=typename T::dpoint"
+ "mln_dpoint(T)=typename T::dpoint" \
+ "mln_accu_with(A, T)=typename A::template with< T >::ret" \
+ "mln_trait_op_plus(L, R)=typename mln::trait::op::plus< L , R >::ret" \
+ "mln_trait_op_minus(L, R)=typename mln::trait::op::minus< L , R >::ret" \
+ "mln_trait_op_times(L, R)=typename mln::trait::op::times< L , R >::ret" \
+ "mln_trait_op_div(L, R)=typename mln::trait::op::div< L , R >::ret" \
+ "mln_trait_op_mod(L, R)=typename mln::trait::op::mod< L , R >::ret" \
+ "mln_trait_op_uminus(T)=typename mln::trait::op::uminus< T >::ret"
+
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
Index: branches/cleanup-2008/milena/doc/Makefile.am
===================================================================
--- branches/cleanup-2008/milena/doc/Makefile.am (revision 2223)
+++ branches/cleanup-2008/milena/doc/Makefile.am (revision 2224)
@@ -40,7 +40,10 @@
-e 's,HIDE_IN_BODY_DOCS = NO,HIDE_IN_BODY_DOCS = YES,g' \
-e 's,INTERNAL_DOCS = YES,INTERNAL_DOCS = NO,g' \
-e 's,GENERATE_TODOLIST = YES,GENERATE_TODOLIST = NO,g' \
- -e 's,PROJECT_NUMBER = \",PROJECT_NUMBER = \"User documentation ,g'
+ -e 's,PROJECT_NUMBER = \",PROJECT_NUMBER = \"User documentation ,g' \
+ -e 's,EXCLUDE_SYMBOLS =,EXCLUDE_SYMBOLS = mln::internal::*,g'
+
+
EXTRA_DIST = Doxyfile.in
Index: branches/cleanup-2008/milena/mln/trait/image/props.hh
===================================================================
--- branches/cleanup-2008/milena/mln/trait/image/props.hh (revision 2223)
+++ branches/cleanup-2008/milena/mln/trait/image/props.hh (revision 2224)
@@ -104,6 +104,8 @@
// \ |
// -- + -- cell_and_value_wise
+// * domain values
+
// value_io: /any/
// |
// + -- read_only
@@ -152,6 +154,8 @@
// |
// + -- extendable
+// * extension values
+
// ext_value: /any/
// |
// + -- irrelevant
Index: branches/cleanup-2008/milena/mln/core/site_set/p_priority.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/site_set/p_priority.hh (revision 2223)
+++ branches/cleanup-2008/milena/mln/core/site_set/p_priority.hh (revision 2224)
@@ -28,7 +28,7 @@
#ifndef MLN_CORE_P_PRIORITY_HH
# define MLN_CORE_P_PRIORITY_HH
-/*! \file mln/core/p_priority.hh
+/*! \file mln/core/site_set/p_priority.hh
*
* \brief Definition of a priority queue of sites.
*
Index: branches/cleanup-2008/milena/mln/core/site_set/line2d.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/site_set/line2d.hh (revision 2223)
+++ branches/cleanup-2008/milena/mln/core/site_set/line2d.hh (revision 2224)
@@ -28,7 +28,7 @@
#ifndef MLN_CORE_P_LINE2D_HH
# define MLN_CORE_P_LINE2D_HH
-/*! \file mln/core/p_line2d.hh
+/*! \file mln/core/site_set/line2d.hh
*
* \brief Definition of a 2D discrete line of points (based on
* p_array).
Index: branches/cleanup-2008/milena/mln/core/site_set/p_if_piter.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/site_set/p_if_piter.hh (revision 2223)
+++ branches/cleanup-2008/milena/mln/core/site_set/p_if_piter.hh (revision 2224)
@@ -28,7 +28,7 @@
#ifndef MLN_CORE_SITE_SET_P_IF_PITER_HH
# define MLN_CORE_SITE_SET_P_IF_PITER_HH
-/*! \file mln/core/p_if_piter.hh
+/*! \file mln/core/site_set/p_if_piter.hh
*
* \brief Definition of iterators on p_if<S,F>.
*/
Index: branches/cleanup-2008/milena/mln/core/image/flat_image.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/image/flat_image.hh (revision 2223)
+++ branches/cleanup-2008/milena/mln/core/image/flat_image.hh (revision 2224)
@@ -29,7 +29,7 @@
# define MLN_CORE_FLAT_IMAGE_HH
/*!
- * \file mln/core/flat_image.hh
+ * \file mln/core/image/flat_image.hh
*
* \brief Definition of a image with a signle value.
*
Index: branches/cleanup-2008/milena/mln/core/internal/site_relative_iterator_base.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/internal/site_relative_iterator_base.hh (revision 2223)
+++ branches/cleanup-2008/milena/mln/core/internal/site_relative_iterator_base.hh (revision 2224)
@@ -28,7 +28,7 @@
#ifndef MLN_CORE_SITE_RELATIVE_ITERATOR_BASE_HH
# define MLN_CORE_SITE_RELATIVE_ITERATOR_BASE_HH
-/*! \file mln/core/site_relative_iterator_base.hh
+/*! \file mln/core/internal/site_relative_iterator_base.hh
*
* \brief Definition of forward and backward mln::dpoint_ based
* iterators.
Index: branches/cleanup-2008/milena/mln/util/internal/boost_graph_structure.hh
===================================================================
--- branches/cleanup-2008/milena/mln/util/internal/boost_graph_structure.hh (revision 2223)
+++ branches/cleanup-2008/milena/mln/util/internal/boost_graph_structure.hh (revision 2224)
@@ -26,7 +26,7 @@
// Public License.
-/// \file mln/util/internal/boost_graph_struture.hh
+/// \file mln/util/internal/boost_graph_structure.hh
/// \brief Operations that interract with the boost_graph structure.
#ifndef MLN_UTIL_INTERNAL_BOOST_GRAPH_STRUCTURE_HH_
Index: branches/cleanup-2008/milena/mln/util/internal/graph_base.hh
===================================================================
--- branches/cleanup-2008/milena/mln/util/internal/graph_base.hh (revision 2223)
+++ branches/cleanup-2008/milena/mln/util/internal/graph_base.hh (revision 2224)
@@ -28,7 +28,7 @@
#ifndef MLN_UTIL_INTERNAL_GRAPH_BASE_HH
# define MLN_UTIL_INTERNAL_GRAPH_BASE_HH
-/// \file mln/util/internal/graph.hh
+/// \file mln/util/internal/graph_base.hh
/// \brief Factored implementation of undirected graphs.
# include <cstddef>
1
0
URL: https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
ChangeLog:
2008-09-11 Guillaume Lazzara <z(a)lrde.epita.fr>
Add missing init_() to pw::image.
* milena/mln/pw/image.hh: Add missing init_().
---
image.hh | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 47 insertions(+), 1 deletion(-)
Index: branches/cleanup-2008/milena/mln/pw/image.hh
===================================================================
--- branches/cleanup-2008/milena/mln/pw/image.hh (revision 2222)
+++ branches/cleanup-2008/milena/mln/pw/image.hh (revision 2223)
@@ -136,11 +136,15 @@
/// Constructor.
image(const Function_p2v<F>& f, const Site_Set<S>& ps);
- // No init_ method here since this image type is not "concrete".
+ /// Initialize an empty image.
+ void init_(const Function_p2v<F>& f, const Site_Set<S>& ps);
/// Give the definition domain.
const S& domain() const;
+ /// Returns the function which compute a site value.
+ F function() const;
+
/// Read-only access of pixel value at point site \p p.
mln_result(F) operator()(const mln_psite(S)& p) const;
@@ -150,10 +154,35 @@
} // end of namespace mln::pw
+ template <typename F, typename S>
+ void init_(tag::function_t, Function_p2v<F>& target,
+ const mln::pw::image<F,S>& model);
+
+ template <typename F, typename S, typename J>
+ void init_(tag::image_t, mln::pw::image<F,S>& target, const J& model);
# ifndef MLN_INCLUDE_ONLY
+ // init_
+
+ template <typename F, typename S>
+ void init_(tag::function_t, Function_p2v<F>& target,
+ const mln::pw::image<F,S>& model)
+ {
+ target = model.function();
+ }
+
+ template <typename F, typename S, typename J>
+ void init_(tag::image_t, mln::pw::image<F,S>& target, const J& model)
+ {
+ F f;
+ init_(tag::function, f, model);
+ S s;
+ init_(tag::domain, s, model);
+ target.init_(f, s);
+ }
+
// Operator.
template <typename F, typename S>
@@ -200,6 +229,14 @@
template <typename F, typename S>
inline
+ void
+ image<F,S>::init_(const Function_p2v<F>& f, const Site_Set<S>& ps)
+ {
+ this->data_ = new internal::data< image<F,S> >(exact(f), exact(ps));
+ }
+
+ template <typename F, typename S>
+ inline
const S&
image<F,S>::domain() const
{
@@ -208,6 +245,15 @@
template <typename F, typename S>
inline
+ F
+ image<F,S>:: function() const
+ {
+ return this->data_->f_;
+ }
+
+
+ template <typename F, typename S>
+ inline
mln_result(F)
image<F,S>::operator()(const mln_psite(S)& p) const
{
1
0
URL: https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
ChangeLog:
2008-09-11 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Clean morpho::erosion.
* mln/morpho/erosion.hh,
* mln/morpho/erosion.spe.hh: Clean the specialized versions
of erosion. The new versions have the same signature than the
facade. Add a new dispatch.
* mln/win/rectangle2d.hh: Update an old include
---
morpho/erosion.hh | 45 ++----
morpho/erosion.spe.hh | 325 ++++++++++++++------------------------------------
win/rectangle2d.hh | 2
3 files changed, 114 insertions(+), 258 deletions(-)
Index: branches/cleanup-2008/milena/mln/win/rectangle2d.hh
===================================================================
--- branches/cleanup-2008/milena/mln/win/rectangle2d.hh (revision 2221)
+++ branches/cleanup-2008/milena/mln/win/rectangle2d.hh (revision 2222)
@@ -35,7 +35,7 @@
* \todo Reactivate includes at EOF.
*/
-# include <mln/core/window.hh>
+# include <mln/core/alias/window2d.hh>
namespace mln
Index: branches/cleanup-2008/milena/mln/morpho/erosion.spe.hh
===================================================================
--- branches/cleanup-2008/milena/mln/morpho/erosion.spe.hh (revision 2221)
+++ branches/cleanup-2008/milena/mln/morpho/erosion.spe.hh (revision 2222)
@@ -40,31 +40,6 @@
*
* \brief Specialization for mln::morpho::erosion.
*
- * Dispatch of erosion(input, win, output):
- *
- * If win = rectangle
- * -> particular case
- * Else If win = octagon
- * -> particular case
- * Else
- * (If win is quite agglomerated (disjonction)
- * -> using incremental algorithm
- * Else
- * -> using conventional algorithm)
- * If input value kind = logical
- * -> If image is Fast
- * -> particular case on sets
- * Else
- * -> general case on sets
- * Else
- * If input value are high quantified
- * -> using conventional accumulator
- * Else
- * -> using histogram based accumulator
- * If image is Fast
- * -> particular case on functions
- * Else
- * -> general case on functions
*
*/
@@ -82,6 +57,27 @@
erosion(const Image<I>& input, const Window<W>& win);
+ namespace internal
+ {
+ template <typename I, typename W>
+ mln_concrete(I)
+ erosion_dispatch(const Image<I>& input, const Window<W>& win)
+ {
+ if (mlc_equal(mln_trait_image_kind(I)(),
+ trait::image::kind::logic)::value == true)
+ if (mlc_equal(mln_trait_image_speed(I)(),
+ trait::image::speed::fastest)::value == true)
+ impl::erosion_on_set_fastest(input, win);
+ else
+ impl::generic::erosion_on_set(input, win);
+ else
+ if (mlc_equal(mln_trait_image_speed(I)(),
+ trait::image::speed::fastest)::value == true)
+ impl::erosion_on_function_fastest(input, win);
+ else
+ impl::generic::erosion_on_function(input, win);
+ }
+
namespace impl
{
@@ -91,43 +87,27 @@
// Implementation is in mln/morpho/erosion.hh.
template <typename I, typename W>
mln_concrete(I)
- erosion_on_function_(const I& input, const W& win);
+ erosion_on_function(const Image<I>& input_, const Window<W>& win_);
// Fwd decl.
// Implementation is in mln/morpho/erosion.hh.
template <typename I, typename W>
mln_concrete(I)
- erosion_on_set_(const I& input, const W& win);
+ erosion_on_set(const Image<I>& input_, const Window<W>& win_);
}
-
template <typename I, typename W>
- inline
mln_concrete(I)
- erosion_iterative_(trait::image::kind::any,
- trait::image::speed::any,
- const I& input, const W& win)
+ erosion_on_function_fastest(const Image<I>& input_, const Window<W>& win_)
{
- return generic::erosion_on_function_(input, win);
- }
-
-
- template <typename I, typename W>
- inline
- mln_concrete(I)
- erosion_iterative_(trait::image::kind::any,
- trait::image::speed::fastest,
- const I& input, const W& win)
- {
- trace::entering("morpho::impl::erosion_iterative_(kind::any, speed::fastest)");
-
- border::adjust(input, win.delta());
+ trace::entering("morpho::impl::erosion_on_function_fastest");
typedef mln_concrete(I) O;
+ const I& input = exact(input_);
+ const W& win = exact(win_);
O output;
- initialize(output, input);
- mln_assertion(border::get(output) == border::get(input));
+ initialize(output, input);
border::fill(input, mln_max(mln_value(I)));
mln_pixter(const I) p(input);
@@ -141,230 +121,119 @@
min.take(q.val());
o.val() = min.to_result();
}
- trace::exiting("morpho::impl::erosion_iterative_(kind::any, speed::fastest)");
- return output;
- }
+ trace::exiting("morpho::impl::erosion_on_function_fastest");
- template <typename I, typename W>
- inline
- mln_concrete(I)
- erosion_iterative_(trait::image::kind::logic,
- trait::image::speed::any,
- const I& input, const W& win)
- {
- return generic::erosion_on_set_(input, win);
+ return output;
}
-
template <typename I, typename W>
- inline
mln_concrete(I)
- erosion_iterative_(trait::image::kind::logic,
- trait::image::speed::fastest,
- const I& input, const W& win)
+ erosion_on_set_fastest(const Image<I>& input_, const Window<W>& win_)
{
- trace::entering("morpho::impl::erosion_iterative_(kind::logic, speed::fastest)");
+ trace::entering("morpho::impl::erosion_on_set_fastest");
- border::adjust(input, win.delta());
- border::fill(input, true);
typedef mln_concrete(I) O;
+ const I& input = exact(input_);
+ const W& win = exact(win_);
O output;
- mln_pixter(const I) p(input);
- mln_qixter(const I, W) q(p, win);
-
- if (win.is_centered())
- {
- output = clone(input);
-
- mln_pixter(O) p_out(output);
- for_all_2(p, p_out)
- // Consider P only if its value is `true' (the erosion
- // is anti-extensive).
- if (p.val())
- for_all(q)
- if (! q.val())
- {
- // Assign `false' to the value of P_OUT as soon
- // as a `false' value is found in its vicinity.
- p_out.val() = false;
- break;
- }
- }
- else
- {
initialize(output, input);
- level::fill(output, input);
+ border::fill(input, true);
+ mln_pixter(const I) p(input);
mln_pixter(O) p_out(output);
for_all_2(p, p_out)
- for_all(q)
{
- // Stop as soon as a `false' value is found the
- // window.
- if (! q.val())
+ for_all(q)
+ if (q.val() == false)
break;
- // If a `false' value was not found, then Q is now
- // invalid (past the end of the window), and vice
- // versa. Use this information to assign P_OUT.
p_out.val() = ! q.is_valid();
}
- }
- trace::exiting("morpho::impl::erosion_iterative_(kind::logic, speed::fastest)");
+ trace::exiting("morpho::impl::erosion_on_set_fastest");
+
return output;
}
- // Facade.
template <typename I, typename W>
- inline
mln_concrete(I)
- erosion_iterative_(const I& input, const W& win)
+ erosion_on_set_centered(const Image<I>& input_, const Window<W>& win_)
{
- return erosion_iterative_(mln_trait_image_kind(I)(),
- mln_trait_image_speed(I)(),
- input, win);
- }
-
+ trace::entering("morpho::impl::erosion_on_set_centered");
+ typedef mln_concrete(I) O;
+ const I& input = exact(input_);
+ const W& win = exact(win_);
+ O output;
+ border::fill(input, true);
- // // Old code.
-
-
-
- // // Stage 5: dispatch w.r.t. fast property
- // // |
- // // V
-
- // template <typename I, typename W, typename O>
- // void erosion_set_wrt_fast(trait::image::speed::any, const I& input,
- // const W& win, O& output)
- // {
- // generic::erosion_on_set(input, win, output);
- // }
-
- // template <typename I, typename W, typename O>
- // void erosion_set_wrt_fast(trait::image::speed::fastest, const I& input,
- // const W& win, O& output)
- // {
- // impl::erosion_on_set_fast(input, win, output);
- // }
-
- // template <typename I, typename W, typename O, typename A>
- // void erosion_fun_wrt_fast(trait::image::speed::any, const I& input,
- // const W& win, O& output, A& min)
- // {
- // generic::erosion_on_function(input, win, output, min);
- // }
-
- // template <typename I, typename W, typename O, typename A>
- // void erosion_fun_wrt_fast(trait::image::speed::fastest, const I& input,
- // const W& win, O& output, A& min)
- // {
- // impl::erosion_on_function_fast(input, win, output, min);
- // }
-
- // // ^
- // // |
- // // end of stage 5 (dispatch w.r.t. fast property)
-
- // // Stage 4: dispatch w.r.t. data quantification
- // // |
- // // V
-
- // template <typename I, typename W, typename O>
- // void erosion_wrt_data(trait::image::quant::high, const I& input,
- // const W& win, O& output)
- // {
- // accu::min_<mln_value(I)> min;
- // impl::erosion_fun_wrt_fast(mln_trait_image_speed(I)(), input,
- // win, output, min);
- // }
-
- // template <typename I, typename W, typename O>
- // void erosion_wrt_data(trait::image::quant::low, const I& input,
- // const W& win, O& output)
- // {
- // accu::min_h<mln_vset(I)> min;
- // impl::erosion_fun_wrt_fast(mln_trait_image_speed(I)(), input,
- // win, output, min);
- // }
-
- // // ^
- // // |
- // // end of stage 4 (dispatch w.r.t. the data quantification)
-
- // // Stage 3: dispatch w.r.t. the value type
- // // |
- // // V
-
- // template <typename I, typename W, typename O>
- // void erosion_wrt_value(const I& input, const W& win, O& output)
- // {
- // if (mlc_is(mln_trait_image_kind(I), trait::image::kind::logic)::value)
- // impl::erosion_set_wrt_fast(mln_trait_image_speed(I)(), input,
- // win, output);
- // // |
- // // `--> call stage 5: dispatch w.r.t. fast property
- // else
- // impl::erosion_wrt_data(mln_trait_image_quant(I)(), input,
- // win, output);
- // // |
- // // `--> call stage 4: dispatch w.r.t. the data quantification
- // }
-
- // // ^
- // // |
- // // end of stage 3 (dispatch w.r.t. the value type)
-
-
-
- // // Stage 2: dispatch w.r.t. the window morphology
- // // |
- // // V
-
- // template <typename I, typename W, typename O>
- // void erosion_wrt_mor(const I& input, const W& win, O& output)
- // {
- // // FIXME : Choose the right algorithm between :
- // impl::erosion_wrt_value(input, win, output);
- // // and :
- // // impl::erosion_incr_wrt_value(input, win, output);
- // }
-
- // // ^
- // // |
- // // end of stage 2 (dispatch w.r.t. the window morphology)
+ output = clone(input);
+ mln_piter(I) p(input.domain());
+ mln_qiter(W) q(win, p);
+ for_all(p)
+ if (input(p) == true)
+ for_all(q) if (input.has(q))
+ if (input(q) == false)
+ {
+ output(p) = false;
+ break;
+ }
+ trace::exiting("morpho::impl::erosion_on_set_centered");
+ return output;
+ }
+ template <typename I, typename W>
+ mln_concrete(I)
+ erosion_on_set_centered_fastest(const Image<I>& input_, const Window<W>& win_)
+ {
+ trace::entering("morpho::impl::erosion_on_set_centered_fastest");
+ typedef mln_concrete(I) O;
+ const I& input = exact(input_);
+ const W& win = exact(win_);
+ O output;
+ border::fill(input, true);
- template <typename I, typename W>
- inline
- mln_concrete(I)
- erosion_(const I& input, const W& win)
+ output = clone(input);
+ mln_pixter(const I) p(input);
+ mln_qixter(const I, W) q(p, win);
+ mln_pixter(O) p_out(output);
+ for_all_2(p, p_out)
+ if (p.val() == true)
+ for_all(q)
+ if (q.val() == false)
{
- // FIXME
- return impl::erosion_iterative_(input, win);
+ p_out.val() = false;
+ break;
+ }
+ trace::exiting("morpho::impl::erosion_on_set_centered_fastest");
+
+ return output;
}
template <typename I>
inline
mln_concrete(I)
- erosion_(const I& input, const win::rectangle2d& win)
+ erosion_rectangle2d(const Image<I>& input_, const Window<W>& win_)
{
- trace::entering("morpho::impl::erosion_(win::rectangle2d)");
+ mlc_equal(W, win::rectangle2d)::check();
+
+ trace::entering("morpho::impl::erosion_rectangle2d");
+
+ const I& input = exact(input_);
+ const W& win = exact(win_);
mln_concrete(I) temp, output;
temp = morpho::erosion(input, win::hline2d(win.width()));
output = morpho::erosion(temp, win::vline2d(win.height()));
- trace::exiting("morpho::impl::erosion_(win::rectangle2d)");
+ trace::exiting("morpho::impl::erosion_rectangle2d");
return output;
}
@@ -372,9 +241,11 @@
template <typename I>
inline
mln_concrete(I)
- erosion_(const I& input, const win::octagon2d& win)
+ erosion_octagon2d(const I& input, const win::octagon2d& win)
{
- trace::entering("morpho::impl::erosion_(win::octagon2d)");
+ mlc_equal(W, win::octagon2d)::check();
+
+ trace::entering("morpho::impl::erosion_octagon2d");
const unsigned len = win.length() / 3 + 1;
mln_concrete(I) temp_1, temp_2, output;
@@ -387,8 +258,6 @@
return output;
}
-
-
} // end of namespace mln::morpho::impl
} // end of namespace mln::morpho
Index: branches/cleanup-2008/milena/mln/morpho/erosion.hh
===================================================================
--- branches/cleanup-2008/milena/mln/morpho/erosion.hh (revision 2221)
+++ branches/cleanup-2008/milena/mln/morpho/erosion.hh (revision 2222)
@@ -63,9 +63,12 @@
template <typename I, typename W>
inline
mln_concrete(I)
- erosion_on_function_(const I& input, const W& win)
+ erosion_on_function(const Image<I>& input_, const Window<W>& win_);
{
- trace::entering("morpho::impl::generic::erosion_on_function_");
+ trace::entering("morpho::impl::generic::erosion_on_function");
+
+ const I& input = exact(input_);
+ const W& win = exact(win_);
mln_concrete(I) output;
initialize(output, input);
@@ -76,12 +79,12 @@
for_all(p)
{
min.init();
- for_all(q) if (input.owns_(q))
+ for_all(q) if (input.has(q))
min.take(input(q));
output(p) = min;
}
- trace::exiting("morpho::impl::generic::erosion_on_function_");
+ trace::exiting("morpho::impl::generic::erosion_on_function");
return output;
}
@@ -90,41 +93,25 @@
template <typename I, typename W>
inline
mln_concrete(I)
- erosion_on_set_(const I& input, const W& win)
+ erosion_on_set(const Image<I>& input_, const Window<W>& win_);
{
- trace::entering("morpho::impl::generic::erosion_on_set_");
+ trace::entering("morpho::impl::generic::erosion_on_set");
+
+ const I& input = exact(input_);
+ const W& win = exact(win_);
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
mln_concrete(I) output;
-
- if (win.is_centered())
- {
- output = clone(input);
- for_all(p)
- if (input(p))
- for_all(q) if (input.owns_(q))
- if (! input(q))
- {
- output(p) = false;
- break;
- }
- }
- else
- {
- initialize(output, input);
for_all(p)
{
- for_all(q) if (input.owns_(q))
- if (! input(q))
+ for_all(q) if (input.has(q))
+ if (input(q) == false)
break;
- // If there was no break (so q is not valid) then
- // output(p) <- true; otherwise, output(p) <- false.
output(p) = ! q.is_valid();
}
- }
- trace::exiting("morpho::impl::generic::erosion_on_set_");
+ trace::exiting("morpho::impl::generic::erosion_on_set");
return output;
}
@@ -145,7 +132,7 @@
mln_precondition(exact(input).has_data());
mln_precondition(! exact(win).is_empty());
- mln_concrete(I) output = impl::erosion_(exact(input), exact(win));
+ mln_concrete(I) output = internal::erosion_dispatch(input, win);
if (exact(win).is_centered())
mln_postcondition(output <= input);
1
0
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add a window-to-neighborhood adapter.
* milena/mln/core/internal/window_base.hh
(is_neighbable_): New.
* milena/mln/core/neighb.hh: Revamp.
internal/window_base.hh | 12 ++++
neighb.hh | 116 ++++++++++++++++++++++++++++++------------------
2 files changed, 86 insertions(+), 42 deletions(-)
Index: milena/mln/core/internal/window_base.hh
--- milena/mln/core/internal/window_base.hh (revision 2220)
+++ milena/mln/core/internal/window_base.hh (working copy)
@@ -60,6 +60,10 @@
/// Site associated type.
typedef mln_site(D) site;
+ /// Test if this window can be a neighborhood.
+ // This method is used in the neighborhood window-adapter.
+ bool is_neighbable_() const;
+
protected:
window_base();
};
@@ -73,6 +77,14 @@
{
}
+ template <typename D, typename E>
+ inline
+ bool
+ window_base<D,E>::is_neighbable_() const
+ {
+ return exact(this)->is_symmetric() && ! exact(this)->is_centered();
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::internal
Index: milena/mln/core/neighb.hh
--- milena/mln/core/neighb.hh (revision 2220)
+++ milena/mln/core/neighb.hh (working copy)
@@ -30,75 +30,107 @@
/*! \file mln/core/neighb.hh
*
- * \brief Definition of the generic neighborhood class mln::neighb.
+ * \brief Definition of a window-to-neighborhood adapter.
*/
# include <mln/core/internal/neighborhood_base.hh>
-# include <mln/core/internal/basic_window_impl.hh>
-# include <mln/core/internal/neighborhood_impl_mixin.hh>
-# include <mln/core/window.hh>
-# include <mln/literal/zero.hh>
namespace mln
{
- /*! \brief Generic neighborhood class.
- *
- * This neighborhood of window is just like a set of delta-points.
- * The parameter is \c D, type of delta-point.
+ /*! \brief Adapter class from window to neighborhood.
*/
- template <typename D>
- struct neighb : internal::neighborhood_base< D, neighb<D> >,
- internal::neighborhood_impl_mixin< internal::basic_window_impl< D, neighb<D> >,
- neighb<D> >
+ template <typename W>
+ class neighb : public internal::neighborhood_base< mln_dpsite(W), neighb<D> >,
+ private mlc_is_a(W, Window)::check_t
{
- /*! \brief Constructor without argument.
- *
- * The constructed neighborhood is empty. You have to use insert()
- * to proceed to the neighborhood definition.
- */
+ public:
+
+ /// Forward site iterator associated type.
+ typedef mln_fwd_qiter(W) fwd_niter;
+
+ /// Backward site iterator associated type.
+ typedef mln_bkd_qiter(W) bkd_niter;
+
+ /// Site iterator associated type.
+ typedef mln_qiter(W) niter;
+
+
+ /// Constructor without argument.
neighb();
- // Overridden from internal::basic_window_impl so that it also
- // inserts \a -dp.
- neighb<D>& insert_(const D& dp);
-
- typedef mln::window<D> window;
-
- window to_window() const
- {
- window tmp(this->dps_);
- D zero = literal::zero;
- tmp.insert(zero);
- return tmp;
- }
+ /// Constructor from a window \p win.
+ neighb(const W& win);
+
+ /// Get the corresponding window.
+ const W& win() const;
+
+ private:
+ W win_;
};
+
+ namespace convert
+ {
+ namespace impl
+ {
+
+ template <typename W>
+ void
+ from_to_(const mln::neighb<W>& from, W& to);
+
+ } // end of namespace convert::impl
+
+ } // end of namespace convert
+
+
+
# ifndef MLN_INCLUDE_ONLY
- template <typename D>
+ template <typename W>
inline
- neighb<D>::neighb()
+ neighb<W>::neighb()
{
}
- template <typename D>
+ template <typename W>
inline
- neighb<D>&
- neighb<D>::insert_(const D& dp)
+ neighb<W>::neighb(const W& win)
{
- typedef neighb<D> self;
- typedef internal::basic_window_impl< D, neighb<D> > win_impl;
- typedef internal::neighborhood_impl_mixin< win_impl, neighb<D> > super_;
- this->super_::insert_( dp);
- this->super_::insert_(-dp);
- return *this;
+ mln_precondition(win.is_neighbable_());
+ win_ = win;
}
+ template <typename W>
+ inline
+ const W&
+ neighb<W>::win() const
+ {
+ return win_;
+ }
+
+
+ namespace convert
+ {
+ namespace impl
+ {
+
+ template <typename W>
+ void
+ from_to_(const mln::neighb<W>& from, W& to)
+ {
+ to = from.win();
+ }
+
+ } // end of namespace convert::impl
+
+ } // end of namespace convert
+
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
1
0
11 Sep '08
* mln/core/p_complex_piter.hh
(mln::p_complex_fwd_piter_<D, P>::iter)
(mln::p_complex_bkd_piter_<D, P>::iter):
New typedef.
(mln::p_complex_fwd_piter_<D, P>::face_)
(mln::p_complex_bkd_piter_<D, P>::face_):
Remove member.
(mln::p_complex_fwd_piter_<D, P>::iter_)
(mln::p_complex_bkd_piter_<D, P>::iter_):
New member.
(mln::p_complex_fwd_piter_<D, P>::p_complex_fwd_piter_)
(mln::p_complex_bkd_piter_<D, P>::p_complex_bkd_piter_):
Adjust ctors.
(mln::p_complex_fwd_piter_<D, P>::is_valid)
(mln::p_complex_fwd_piter_<D, P>::invalidate)
(mln::p_complex_fwd_piter_<D, P>::start)
(mln::p_complex_fwd_piter_<D, P>::next)
(mln::p_complex_fwd_piter_<D, P>::update):
Adjust.
(mln::p_complex_fwd_piter_<D, P>::invalid_unsigned_)
(mln::p_complex_bkd_piter_<D, P>::invalid_unsigned_):
Remove, useless.
---
milena/ChangeLog | 27 ++++++
milena/mln/core/p_complex_piter.hh | 157 ++++++++----------------------------
2 files changed, 61 insertions(+), 123 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index b40e272..cd60428 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,32 @@
2008-09-11 Roland Levillain <roland(a)lrde.epita.fr>
+ Factor iterators on p_complexes with iterator on complexes.
+
+ * mln/core/p_complex_piter.hh
+ (mln::p_complex_fwd_piter_<D, P>::iter)
+ (mln::p_complex_bkd_piter_<D, P>::iter):
+ New typedef.
+ (mln::p_complex_fwd_piter_<D, P>::face_)
+ (mln::p_complex_bkd_piter_<D, P>::face_):
+ Remove member.
+ (mln::p_complex_fwd_piter_<D, P>::iter_)
+ (mln::p_complex_bkd_piter_<D, P>::iter_):
+ New member.
+ (mln::p_complex_fwd_piter_<D, P>::p_complex_fwd_piter_)
+ (mln::p_complex_bkd_piter_<D, P>::p_complex_bkd_piter_):
+ Adjust ctors.
+ (mln::p_complex_fwd_piter_<D, P>::is_valid)
+ (mln::p_complex_fwd_piter_<D, P>::invalidate)
+ (mln::p_complex_fwd_piter_<D, P>::start)
+ (mln::p_complex_fwd_piter_<D, P>::next)
+ (mln::p_complex_fwd_piter_<D, P>::update):
+ Adjust.
+ (mln::p_complex_fwd_piter_<D, P>::invalid_unsigned_)
+ (mln::p_complex_bkd_piter_<D, P>::invalid_unsigned_):
+ Remove, useless.
+
+2008-09-11 Roland Levillain <roland(a)lrde.epita.fr>
+
Add default constructors to complexes on iterators.
* mln/core/complex_iter.hh
diff --git a/milena/mln/core/p_complex_piter.hh b/milena/mln/core/p_complex_piter.hh
index 98efc11..d9ce17a 100644
--- a/milena/mln/core/p_complex_piter.hh
+++ b/milena/mln/core/p_complex_piter.hh
@@ -21,7 +21,7 @@
// 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.
+// License.
// reasons why the executable file might be covered by the GNU General
// Public License.
@@ -36,6 +36,7 @@
# include <mln/core/internal/point_iterator_base.hh>
# include <mln/core/p_complex.hh>
# include <mln/core/complex_psite.hh>
+# include <mln/core/complex_iter.hh>
// Factor p_complex_fwd_piter_<D, P> and p_complex_bkd_piter_<D, P>.
@@ -60,6 +61,9 @@ namespace mln
typedef p_complex_fwd_piter_<D, P> self_;
typedef internal::point_iterator_base_< P, self_ > super_;
+ /// The type of the underlying complex iterator.
+ typedef complex_fwd_iter_<D> iter;
+
public:
// Make definitions from super class available.
// FIXME: Is it still meaningful for a complex?
@@ -107,27 +111,13 @@ namespace mln
/// \}
private:
- /// The face handle this iterator is pointing to.
- any_face_handle<D> face_;
+ /// The underlying complex iterator.
+ iter iter_;
/// The psite corresponding to this iterator.
psite psite_;
/// \brief The point associated to this psite.
// FIXME: Actually, this is a dummy value!
point p_;
-
- /// \brief An invalid value for both the dimension and the id of
- /// the face.
- ///
- /// Use a function instead of a static constant, since `static'
- /// variables needs to be compiled once, which requires a compiled
- /// library to avoid duplicate symbols, which is something that
- /// was not really planned in Milena. A function tagged `inlined'
- /// can appear multiple times in a program, and solves this
- /// problem. We rely on the compiler to inline this call.
- ///
- /// Of course, we could have used UINT_MAX, but it is not very
- /// C++.
- unsigned invalid_unsigned_() const;
};
@@ -153,6 +143,9 @@ namespace mln
typedef p_complex_bkd_piter_<D, P> self_;
typedef internal::point_iterator_base_< P, self_ > super_;
+ /// The type of the underlying complex iterator.
+ typedef complex_bkd_iter_<D> iter;
+
public:
// Make definitions from super class available.
// FIXME: Is it still meaningful for a complex?
@@ -200,27 +193,13 @@ namespace mln
/// \}
private:
- /// The face handle this iterator is pointing to.
- any_face_handle<D> face_;
+ /// The underlying complex iterator.
+ iter iter_;
/// The psite corresponding to this iterator.
psite psite_;
/// \brief The point associated to this psite.
// FIXME: Actually, this is a dummy value!
point p_;
-
- /// \brief An invalid value for both the dimension and the id of
- /// the face.
- ///
- /// Use a function instead of a static constant, since `static'
- /// variables needs to be compiled once, which requires a compiled
- /// library to avoid duplicate symbols, which is something that
- /// was not really planned in Milena. A function tagged `inlined'
- /// can appear multiple times in a program, and solves this
- /// problem. We rely on the compiler to inline this call.
- ///
- /// Of course, we could have used UINT_MAX, but it is not very
- /// C++.
- unsigned invalid_unsigned_() const;
};
@@ -248,15 +227,14 @@ namespace mln
: psite_(),
p_()
{
- face_.set_cplx(pc.cplx());
- // Invalidate face_.
- invalidate();
+ iter_.set_cplx(pc.cplx());
+ mln_postcondition(!is_valid());
}
template <unsigned D, typename P>
inline
p_complex_fwd_piter_<D, P>::p_complex_fwd_piter_(const p_complex_fwd_piter_<D, P>& rhs)
- : face_(rhs.face_),
+ : iter_(rhs.iter_),
psite_(rhs.psite_),
// Dummy value.
p_()
@@ -270,7 +248,7 @@ namespace mln
{
if (&rhs == this)
return *this;
- face_ = rhs.face_;
+ iter_ = rhs.iter_;
psite_ = rhs.psite_;
return *this;
}
@@ -289,7 +267,7 @@ namespace mln
bool
p_complex_fwd_piter_<D, P>::is_valid() const
{
- return face_.is_valid();
+ return iter_.is_valid();
}
template <unsigned D, typename P>
@@ -297,50 +275,24 @@ namespace mln
void
p_complex_fwd_piter_<D, P>::invalidate()
{
- face_.set_n(invalid_unsigned_());
- face_.set_face_id(invalid_unsigned_());
+ iter_.invalidate();
}
template <unsigned D, typename P>
inline
- void
+ void
p_complex_fwd_piter_<D, P>::start()
{
- face_.set_n(0u);
- face_.set_face_id(0u);
+ iter_.start();
update_();
}
template <unsigned D, typename P>
inline
- void
+ void
p_complex_fwd_piter_<D, P>::next_()
{
- if (is_valid())
- {
- unsigned n = face_.n();
- unsigned face_id = face_.face_id();
-
- if (face_id + 1 < face_.cplx().nfaces(n))
- /* FIXME: Provide accessor any_face_handle::n() returning
- a mutable reference? This way, we could just write
-
- ++face_.face_id();
-
- instead of the following. */
- face_.set_face_id(face_id + 1);
- else
- // Start to iterate on the faces of the next dimension if
- // possible.
- if (n <= D)
- {
- // FIXME: Same remark as above.
- face_.set_n(n + 1);
- face_.set_face_id(0u);
- }
- else
- invalidate();
- }
+ iter_.next_();
if (is_valid())
update_();
}
@@ -351,7 +303,7 @@ namespace mln
p_complex_fwd_piter_<D, P>::update_()
{
// Update psite_.
- psite_ = complex_psite<D, P>(face_);
+ psite_ = complex_psite<D, P>(iter_);
}
template <unsigned D, typename P>
@@ -390,13 +342,6 @@ namespace mln
return psite_;
}
- template <unsigned D, typename P>
- unsigned
- p_complex_fwd_piter_<D, P>::invalid_unsigned_() const
- {
- return std::numeric_limits<unsigned>::max();
- }
-
template <unsigned D, typename P>
inline
@@ -431,15 +376,14 @@ namespace mln
: psite_(),
p_()
{
- face_.set_cplx(pc.cplx());
- // Invalidate face_.
- invalidate();
+ iter_.set_cplx(pc.cplx());
+ mln_postcondition(!is_valid());
}
template <unsigned D, typename P>
inline
p_complex_bkd_piter_<D, P>::p_complex_bkd_piter_(const p_complex_bkd_piter_<D, P>& rhs)
- : face_(rhs.face_),
+ : iter_(rhs.iter_),
psite_(rhs.psite_),
// Dummy value.
p_()
@@ -453,7 +397,7 @@ namespace mln
{
if (&rhs == this)
return *this;
- face_ = rhs.face_;
+ iter_ = rhs.iter_;
psite_ = rhs.psite_;
return *this;
}
@@ -472,7 +416,7 @@ namespace mln
bool
p_complex_bkd_piter_<D, P>::is_valid() const
{
- return face_.is_valid();
+ return iter_.is_valid();
}
template <unsigned D, typename P>
@@ -480,50 +424,24 @@ namespace mln
void
p_complex_bkd_piter_<D, P>::invalidate()
{
- face_.set_n(invalid_unsigned_());
- face_.set_face_id(invalid_unsigned_());
+ iter_.invalidate();
}
template <unsigned D, typename P>
inline
- void
+ void
p_complex_bkd_piter_<D, P>::start()
{
- face_.set_n(D);
- face_.set_face_id(face_.cplx().template nfaces<D>() - 1);
+ iter_.start();
update_();
}
template <unsigned D, typename P>
inline
- void
+ void
p_complex_bkd_piter_<D, P>::next_()
{
- if (is_valid())
- {
- unsigned n = face_.n();
- unsigned face_id = face_.face_id();
-
- if (face_id > 0)
- /* FIXME: Provide accessor any_face_handle::n() returning
- a mutable reference? This way, we could just write
-
- ++face_.face_id();
-
- instead of the following. */
- face_.set_face_id(face_id - 1);
- else
- // Start to iterate on the faces of the previous dimension
- // if it exists.
- if (n > 0)
- {
- // FIXME: Same remark as above.
- face_.set_n(n - 1);
- face_.set_face_id(face_.cplx().nfaces(n - 1) - 1);
- }
- else
- invalidate();
- }
+ iter_.next_();
if (is_valid())
update_();
}
@@ -534,7 +452,7 @@ namespace mln
p_complex_bkd_piter_<D, P>::update_()
{
// Update psite_.
- psite_ = complex_psite<D, P>(face_);
+ psite_ = complex_psite<D, P>(iter_);
}
template <unsigned D, typename P>
@@ -573,13 +491,6 @@ namespace mln
return psite_;
}
- template <unsigned D, typename P>
- unsigned
- p_complex_bkd_piter_<D, P>::invalid_unsigned_() const
- {
- return std::numeric_limits<unsigned>::max();
- }
-
template <unsigned D, typename P>
inline
--
1.5.6.5
1
0
11 Sep '08
* mln/core/complex_iter.hh
(mln::complex_fwd_iter_<D>::complex_fwd_iter_)
(mln::complex_bkd_iter_<D>::complex_bkd_iter_):
New ctors.
---
milena/ChangeLog | 9 +++++++++
milena/mln/core/complex_iter.hh | 16 ++++++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 4033236..b40e272 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,14 @@
2008-09-11 Roland Levillain <roland(a)lrde.epita.fr>
+ Add default constructors to complexes on iterators.
+
+ * mln/core/complex_iter.hh
+ (mln::complex_fwd_iter_<D>::complex_fwd_iter_)
+ (mln::complex_bkd_iter_<D>::complex_bkd_iter_):
+ New ctors.
+
+2008-09-11 Roland Levillain <roland(a)lrde.epita.fr>
+
Use set_cplx() in ctors of complexes on iterators.
* mln/core/complex_iter.hh
diff --git a/milena/mln/core/complex_iter.hh b/milena/mln/core/complex_iter.hh
index b96d309..7588a32 100644
--- a/milena/mln/core/complex_iter.hh
+++ b/milena/mln/core/complex_iter.hh
@@ -62,6 +62,7 @@ namespace mln
/// Construction and assignment.
/// \{
+ complex_fwd_iter_();
/* FIXME: Keep this non-const? See a (big) comment about this in
milena/tests/complex_image.cc. */
complex_fwd_iter_(complex<D>& c);
@@ -139,6 +140,7 @@ namespace mln
/// Construction and assignment.
/// \{
+ complex_bkd_iter_();
/* FIXME: Keep this non-const? See a (big) comment about this in
milena/tests/complex_image.cc. */
complex_bkd_iter_(complex<D>& c);
@@ -210,6 +212,13 @@ namespace mln
template <unsigned D>
inline
+ complex_fwd_iter_<D>::complex_fwd_iter_()
+ {
+ invalidate();
+ }
+
+ template <unsigned D>
+ inline
complex_fwd_iter_<D>::complex_fwd_iter_(complex<D>& c)
{
set_cplx(c);
@@ -342,6 +351,13 @@ namespace mln
template <unsigned D>
inline
+ complex_bkd_iter_<D>::complex_bkd_iter_()
+ {
+ invalidate();
+ }
+
+ template <unsigned D>
+ inline
complex_bkd_iter_<D>::complex_bkd_iter_(complex<D>& c)
{
set_cplx(c);
--
1.5.6.5
1
0
---
milena/ChangeLog | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 3dcecf7..4033236 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -2,7 +2,7 @@
Use set_cplx() in ctors of complexes on iterators.
- * mln/core/complex_iter.hh (mln):
+ * mln/core/complex_iter.hh
(mln::complex_fwd_iter_<D>::complex_fwd_iter_(complex<D>))
(mln::complex_bkd_iter_<D>::complex_bkd_iter_(complex<D>)):
Do it.
--
1.5.6.5
1
0