URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-04 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Rename typedef value by argument in accumulators.
* mln/accu/bbox.hh,
* mln/accu/count.hh,
* mln/accu/histo.hh,
* mln/accu/internal/base.hh,
* mln/accu/max.hh,
* mln/accu/max_h.hh,
* mln/accu/mean.hh,
* mln/accu/median.hh,
* mln/accu/median_alt.hh,
* mln/accu/min.hh,
* mln/accu/min_h.hh,
* mln/accu/nil.hh,
* mln/accu/p.hh,
* mln/accu/pair.hh,
* mln/accu/sum.hh,
* mln/accu/v.hh,
* mln/core/concept/accumulator.hh,
* mln/core/concept/doc/accumulator.hh,
* mln/core/grids.hh,
* mln/core/macros.hh: (typedef value) Rename as...
(typedef argument) ... this.
---
accu/bbox.hh | 2 -
accu/count.hh | 6 ++--
accu/histo.hh | 22 ++++++++--------
accu/max.hh | 26 ++++++++++----------
accu/max_h.hh | 52 ++++++++++++++++++++--------------------
accu/mean.hh | 10 +++----
accu/median.hh | 42 ++++++++++++++++----------------
accu/median_alt.hh | 50 +++++++++++++++++++-------------------
accu/min.hh | 26 ++++++++++----------
accu/min_h.hh | 52 ++++++++++++++++++++--------------------
accu/nil.hh | 10 +++----
accu/p.hh | 14 +++++-----
accu/pair.hh | 20 +++++++--------
accu/sum.hh | 8 +++---
accu/v.hh | 14 +++++-----
core/concept/accumulator.hh | 16 ++++++------
core/concept/doc/accumulator.hh | 8 +++---
core/grids.hh | 6 ++++
core/macros.hh | 4 +++
19 files changed, 199 insertions(+), 189 deletions(-)
Index: trunk/milena/mln/core/macros.hh
===================================================================
--- trunk/milena/mln/core/macros.hh (revision 1245)
+++ trunk/milena/mln/core/macros.hh (revision 1246)
@@ -161,6 +161,10 @@
# define mln_value(T) typename T::value
# define mln_value_(T) T::value
+/// Shortcut to access the argument type associated to T.
+# define mln_argument(T) typename T::argument
+# define mln_argument_(T) T::argument
+
/// Shortcut to test if the values of an image with type \c I are lowly quantifized.
# define mln_is_value_lowq(I) mln_is_lowq( mln_value(I) )
Index: trunk/milena/mln/core/concept/doc/accumulator.hh
===================================================================
--- trunk/milena/mln/core/concept/doc/accumulator.hh (revision 1245)
+++ trunk/milena/mln/core/concept/doc/accumulator.hh (revision 1246)
@@ -41,8 +41,8 @@
template <typename E>
struct Accumulator
{
- /// The value type of elements to accumulate.
- typedef void value;
+ /// The argument type of elements to accumulate.
+ typedef void argument;
/// The value type to return.
typedef void result_;
@@ -50,8 +50,8 @@
/// Initialize the accumulator.
void init();
- /// Take into account a value \p v (an element).
- void take(const value& v);
+ /// Take into account a argument \p x (an element).
+ void take(const argument& x);
/// Take into account another accumulator \p other.
void take(const E& other);
Index: trunk/milena/mln/core/concept/accumulator.hh
===================================================================
--- trunk/milena/mln/core/concept/accumulator.hh (revision 1245)
+++ trunk/milena/mln/core/concept/accumulator.hh (revision 1246)
@@ -65,10 +65,10 @@
typedef Accumulator<void> category;
/*
- typedef value;
+ typedef argument;
typedef result;
void init();
- void take(const value& v);
+ void take(const argument& x);
void take(const E& other);
result to_result() const;
operator result_() const;
@@ -76,7 +76,7 @@
// Default impl.
template <typename T>
- void take_as_init(const T& t); // 't' is either value or E.
+ void take_as_init(const T& t); // 't' is either argument or E.
protected:
Accumulator();
@@ -89,25 +89,25 @@
template <typename E>
Accumulator<E>::Accumulator()
{
- typedef mln_value(E) value;
+ typedef mln_argument(E) argument;
typedef mln_result(E) result;
void (E::*m1)() = & E::init;
m1 = 0;
- void (E::*m2)(const value&) = & E::take;
+ void (E::*m2)(const argument&) = & E::take;
m2 = 0;
void (E::*m3)(const E&) = & E::take;
m3 = 0;
result (E::*m4)() const = & E::to_result;
m4 = 0;
- result (E::*m5)() const = & E::operator result;
- m5 = 0;
+// result (E::*m5)() const = & E::operator result;
+// m5 = 0;
}
template <typename E>
template <typename T>
void
- Accumulator<E>::take_as_init(const T& t) // either value or E
+ Accumulator<E>::take_as_init(const T& t) // either argument or E
{
exact(this)->init();
exact(this)->take(t);
Index: trunk/milena/mln/core/grids.hh
===================================================================
--- trunk/milena/mln/core/grids.hh (revision 1245)
+++ trunk/milena/mln/core/grids.hh (revision 1246)
@@ -57,6 +57,12 @@
enum { dim = 2 };
};
+ struct hexa : public Regular_Grid< hexa >
+ {
+ typedef metal::false_ aligned;
+ enum { dim = 2 };
+ };
+
struct cube : public Regular_Grid< cube >
{
typedef metal::true_ aligned;
Index: trunk/milena/mln/accu/nil.hh
===================================================================
--- trunk/milena/mln/accu/nil.hh (revision 1245)
+++ trunk/milena/mln/accu/nil.hh (revision 1246)
@@ -52,14 +52,14 @@
template <typename T>
struct nil_ : public mln::accu::internal::base_< util::ignore , nil_<T>
>
{
- typedef util::eat value;
+ typedef util::eat argument;
typedef util::ignore result;
nil_();
void init();
- void take_as_init(const value&);
- void take(const value&);
+ void take_as_init(const argument&);
+ void take(const argument&);
void take(const nil_<T>&);
util::ignore to_result() const;
@@ -93,13 +93,13 @@
template <typename T>
void
- nil_<T>::take(const value&)
+ nil_<T>::take(const argument&)
{
}
template <typename T>
void
- nil_<T>::take_as_init(const value&)
+ nil_<T>::take_as_init(const argument&)
{
}
Index: trunk/milena/mln/accu/min.hh
===================================================================
--- trunk/milena/mln/accu/min.hh (revision 1245)
+++ trunk/milena/mln/accu/min.hh (revision 1246)
@@ -53,21 +53,21 @@
template <typename V>
struct min_ : public mln::accu::internal::base_< V, min_<V> >
{
- typedef V value;
+ typedef V argument;
typedef V result;
min_();
void init();
- void take_as_init(const value& v);
- void take(const value& v);
+ void take_as_init(const argument& x);
+ void take(const argument& x);
void take(const min_<V>& other);
V to_result() const;
protected:
- V v_;
+ V x_;
};
@@ -97,35 +97,35 @@
void
min_<V>::init()
{
- v_ = mln_max(V);
+ x_ = mln_max(V);
}
template <typename V>
- void min_<V>::take_as_init(const value& v)
+ void min_<V>::take_as_init(const argument& x)
{
- v_ = v;
+ x_ = x;
}
template <typename V>
- void min_<V>::take(const value& v)
+ void min_<V>::take(const argument& x)
{
- if (v < v_)
- v_ = v;
+ if (x < x_)
+ x_ = x;
}
template <typename V>
void
min_<V>::take(const min_<V>& other)
{
- if (other.v_ < v_)
- v_ = other.v_;
+ if (other.x_ < x_)
+ x_ = other.x_;
}
template <typename V>
V
min_<V>::to_result() const
{
- return v_;
+ return x_;
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/accu/max.hh
===================================================================
--- trunk/milena/mln/accu/max.hh (revision 1245)
+++ trunk/milena/mln/accu/max.hh (revision 1246)
@@ -52,21 +52,21 @@
template <typename V>
struct max_ : public mln::accu::internal::base_< V , max_<V> >
{
- typedef V value;
+ typedef V argument;
typedef V result;
max_();
void init();
- void take_as_init(const value& v);
- void take(const value& v);
+ void take_as_init(const argument& x);
+ void take(const argument& x);
void take(const max_<V>& other);
V to_result() const;
protected:
- V v_;
+ V x_;
};
@@ -97,37 +97,37 @@
void
max_<V>::init()
{
- v_ = mln_min(V);
+ x_ = mln_min(V);
}
template <typename V>
void
- max_<V>::take_as_init(const value& v)
+ max_<V>::take_as_init(const argument& x)
{
- v_ = v;
+ x_ = x;
}
template <typename V>
void
- max_<V>::take(const value& v)
+ max_<V>::take(const argument& x)
{
- if (v > v_)
- v_ = v;
+ if (x > x_)
+ x_ = x;
}
template <typename V>
void
max_<V>::take(const max_<V>& other)
{
- if (other.v_ > v_)
- v_ = other.v_;
+ if (other.x_ > x_)
+ x_ = other.x_;
}
template <typename V>
V
max_<V>::to_result() const
{
- return v_;
+ return x_;
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/accu/histo.hh
===================================================================
--- trunk/milena/mln/accu/histo.hh (revision 1245)
+++ trunk/milena/mln/accu/histo.hh (revision 1246)
@@ -58,15 +58,15 @@
histo(const Value_Set<S>& s);
histo();
- typedef mln_value(S) value;
+ typedef mln_value(S) argument;
typedef const std::vector<std::size_t>& result;
- void take(const value& v);
+ void take(const argument& x);
void take(const histo<S>& other);
- void untake(const value& v);
+ void untake(const argument& x);
void init();
- std::size_t operator()(const value& v) const;
+ std::size_t operator()(const argument& x) const;
std::size_t operator[](std::size_t i) const;
std::size_t nvalues() const;
std::size_t sum() const;
@@ -110,9 +110,9 @@
template <typename S>
void
- histo<S>::take(const value& v)
+ histo<S>::take(const argument& x)
{
- ++h_[s_.index_of(v)];
+ ++h_[s_.index_of(x)];
++sum_;
}
@@ -127,11 +127,11 @@
template <typename S>
void
- histo<S>::untake(const value& v)
+ histo<S>::untake(const argument& x)
{
- mln_precondition(h_[s_.index_of(v)] > 0);
+ mln_precondition(h_[s_.index_of(x)] > 0);
mln_precondition(sum_ > 0);
- --h_[s_.index_of(v)];
+ --h_[s_.index_of(x)];
--sum_;
}
@@ -145,9 +145,9 @@
template <typename S>
std::size_t
- histo<S>::operator()(const value& v) const
+ histo<S>::operator()(const argument& x) const
{
- return h_[s_.index_of(v)];
+ return h_[s_.index_of(x)];
}
template <typename S>
Index: trunk/milena/mln/accu/count.hh
===================================================================
--- trunk/milena/mln/accu/count.hh (revision 1245)
+++ trunk/milena/mln/accu/count.hh (revision 1246)
@@ -49,13 +49,13 @@
template <typename V>
struct count_ : public mln::accu::internal::base_< std::size_t , count_<V>
>
{
- typedef V value;
+ typedef V argument;
typedef std::size_t result; // FIXME: Up in Accumulator.
count_();
void init();
- void take(const value&);
+ void take(const argument&);
void take(const count_<V>& other);
std::size_t to_result() const;
@@ -95,7 +95,7 @@
template <typename V>
void
- count_<V>::take(const value&)
+ count_<V>::take(const argument&)
{
++count__;
}
Index: trunk/milena/mln/accu/bbox.hh
===================================================================
--- trunk/milena/mln/accu/bbox.hh (revision 1245)
+++ trunk/milena/mln/accu/bbox.hh (revision 1246)
@@ -51,7 +51,7 @@
template <typename P>
struct bbox : public mln::accu::internal::base_< const box_<P>& ,
bbox<P> >
{
- typedef P value;
+ typedef P argument;
typedef const box_<P>& result;
bbox();
Index: trunk/milena/mln/accu/min_h.hh
===================================================================
--- trunk/milena/mln/accu/min_h.hh (revision 1245)
+++ trunk/milena/mln/accu/min_h.hh (revision 1246)
@@ -50,21 +50,21 @@
template <typename S>
struct min_h : public mln::accu::internal::base_< mln_value(S) , min_h<S>
>
{
- typedef mln_value(S) value;
- typedef value result;
+ typedef mln_value(S) argument;
+ typedef argument result;
min_h(const Value_Set<S>& s);
min_h();
void init();
- void take(const value& v);
- void take_as_init(const value& v);
+ void take(const argument& x);
+ void take_as_init(const argument& x);
void take(const min_h<S>& other);
- void untake(const value& v);
+ void untake(const argument& x);
unsigned card() const { return h_.sum(); }
- value to_result() const;
+ result to_result() const;
const accu::histo<S>& histo() const;
@@ -76,7 +76,7 @@
mutable std::size_t sum_;
mutable bool valid_;
mutable std::size_t i_; // the min index
- mutable value v_; // the min value
+ mutable argument x_; // the min value
// Auxiliary methods
void update_() const;
@@ -105,15 +105,15 @@
template <typename S>
void
- min_h<S>::take(const value& v)
+ min_h<S>::take(const argument& x)
{
- h_.take(v);
+ h_.take(x);
if (h_.sum() == 1)
{
- this->take_as_init(v);
+ this->take_as_init(x);
return;
}
- if (v < v_)
+ if (x < x_)
{
++sum_;
valid_ = false;
@@ -134,23 +134,23 @@
template <typename S>
void
- min_h<S>::untake(const value& v)
+ min_h<S>::untake(const argument& x)
{
- mln_precondition(h_(v) != 0);
- h_.untake(v);
+ mln_precondition(h_(x) != 0);
+ h_.untake(x);
if (h_.sum() == 0)
{
init();
return;
}
- if (v < v_)
+ if (x < x_)
{
mln_invariant(sum_ >= 1);
--sum_;
valid_ = false;
}
else
- if (v == v_ && h_[i_] == 0)
+ if (x == x_ && h_[i_] == 0)
valid_ = false;
}
@@ -177,7 +177,7 @@
sum_ -= h_[i_];
}
while (sum_ != 0);
- v_ = s_[i_];
+ x_ = s_[i_];
}
template <typename S>
@@ -187,7 +187,7 @@
do
++i_;
while (h_[i_] == 0);
- v_ = s_[i_];
+ x_ = s_[i_];
}
template <typename S>
@@ -196,29 +196,29 @@
{
h_.init();
sum_ = 0;
- i_ = mln_max(value);
- v_ = s_[i_];
+ i_ = mln_max(argument);
+ x_ = s_[i_];
valid_ = true;
}
template <typename S>
void
- min_h<S>::take_as_init(const value& v)
+ min_h<S>::take_as_init(const argument& x)
{
- h_.take(v);
+ h_.take(x);
sum_ = 0;
- i_ = s_.index_of(v);
- v_ = v;
+ i_ = s_.index_of(x);
+ x_ = x;
valid_ = true;
}
template <typename S>
- typename min_h<S>::value
+ typename min_h<S>::argument
min_h<S>::to_result() const
{
if (! valid_)
update_();
- return v_;
+ return x_;
}
template <typename S>
Index: trunk/milena/mln/accu/pair.hh
===================================================================
--- trunk/milena/mln/accu/pair.hh (revision 1245)
+++ trunk/milena/mln/accu/pair.hh (revision 1246)
@@ -55,10 +55,10 @@
*
* \todo Check that, when V is not provided, A1 and A2 have the same value.
*/
- template <typename A1, typename A2, typename V = mln_value(A1)>
+ template <typename A1, typename A2, typename V = 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,V>
>
{
- typedef V value;
+ typedef V argument;
typedef mlc_unqualif(mln_result(A1)) result_1;
typedef mlc_unqualif(mln_result(A2)) result_2;
@@ -68,8 +68,8 @@
pair_(const A1& a1, const A2& a2);
void init();
- void take_as_init(const value& v);
- void take(const value& v);
+ void take_as_init(const argument& x);
+ void take(const argument& x);
void take(const pair_<A1,A2,V>& other);
result to_result() const;
@@ -115,18 +115,18 @@
template <typename A1, typename A2, typename V>
void
- pair_<A1,A2,V>::take_as_init(const value& v)
+ pair_<A1,A2,V>::take_as_init(const argument& x)
{
- a1_.take_as_init(v);
- a2_.take_as_init(v);
+ a1_.take_as_init(x);
+ a2_.take_as_init(x);
}
template <typename A1, typename A2, typename V>
void
- pair_<A1,A2,V>::take(const value& v)
+ pair_<A1,A2,V>::take(const argument& x)
{
- a1_.take(v);
- a2_.take(v);
+ a1_.take(x);
+ a2_.take(x);
}
template <typename A1, typename A2, typename V>
Index: trunk/milena/mln/accu/max_h.hh
===================================================================
--- trunk/milena/mln/accu/max_h.hh (revision 1245)
+++ trunk/milena/mln/accu/max_h.hh (revision 1246)
@@ -50,21 +50,21 @@
template <typename S>
struct max_h : public mln::accu::internal::base_< mln_value(S) , max_h<S>
>
{
- typedef mln_value(S) value;
- typedef value result;
+ typedef mln_value(S) argument;
+ typedef argument result;
max_h(const Value_Set<S>& s);
max_h();
void init();
- void take(const value& v);
- void take_as_init(const value& v);
+ void take(const argument& x);
+ void take_as_init(const argument& x);
void take(const max_h<S>& other);
- void untake(const value& v);
+ void untake(const argument& x);
unsigned card() const { return h_.sum(); }
- value to_result() const;
+ argument to_result() const;
const accu::histo<S>& histo() const;
@@ -76,7 +76,7 @@
mutable std::size_t sum_;
mutable bool valid_;
mutable std::size_t i_; // the max index
- mutable value v_; // the max value
+ mutable argument x_; // the max argument
// Auxiliary methods
void update_() const;
@@ -105,15 +105,15 @@
template <typename S>
void
- max_h<S>::take(const value& v)
+ max_h<S>::take(const argument& x)
{
- h_.take(v);
+ h_.take(x);
if (h_.sum() == 1)
{
- this->take_as_init(v);
+ this->take_as_init(x);
return;
}
- if (v > v_)
+ if (x > x_)
{
++sum_;
valid_ = false;
@@ -134,23 +134,23 @@
template <typename S>
void
- max_h<S>::untake(const value& v)
+ max_h<S>::untake(const argument& x)
{
- mln_precondition(h_(v) != 0);
- h_.untake(v);
+ mln_precondition(h_(x) != 0);
+ h_.untake(x);
if (h_.sum() == 0)
{
init();
return;
}
- if (v > v_)
+ if (x > x_)
{
mln_invariant(sum_ >= 1);
--sum_;
valid_ = false;
}
else
- if (v == v_ && h_[i_] == 0)
+ if (x == x_ && h_[i_] == 0)
valid_ = false;
}
@@ -173,7 +173,7 @@
do
--i_;
while (h_[i_] == 0);
- v_ = s_[i_];
+ x_ = s_[i_];
}
template <typename S>
@@ -186,7 +186,7 @@
if (h_[i_] != 0)
sum_ -= h_[i_];
} while (sum_ != 0);
- v_ = s_[i_];
+ x_ = s_[i_];
}
template <typename S>
@@ -195,29 +195,29 @@
{
h_.init();
sum_ = 0;
- i_ = mln_min(value);
- v_ = s_[i_];
+ i_ = mln_min(argument);
+ x_ = s_[i_];
valid_ = true;
}
template <typename S>
void
- max_h<S>::take_as_init(const value& v)
+ max_h<S>::take_as_init(const argument& x)
{
- h_.take(v);
+ h_.take(x);
sum_ = 0;
- i_ = s_.index_of(v);
- v_ = v;
+ i_ = s_.index_of(x);
+ x_ = x;
valid_ = true;
}
template <typename S>
- typename max_h<S>::value
+ typename max_h<S>::argument
max_h<S>::to_result() const
{
if (! valid_)
update_();
- return v_;
+ return x_;
}
template <typename S>
Index: trunk/milena/mln/accu/median.hh
===================================================================
--- trunk/milena/mln/accu/median.hh (revision 1245)
+++ trunk/milena/mln/accu/median.hh (revision 1246)
@@ -50,20 +50,20 @@
template <typename S>
struct median : public mln::accu::internal::base_< mln_value(S), median<S>
>
{
- typedef mln_value(S) value;
- typedef value result;
+ typedef mln_value(S) argument;
+ typedef argument result;
median(const Value_Set<S>& s);
median();
void init();
- void take(const value& v);
+ void take(const argument& x);
void take(const median<S>& other);
- void untake(const value& v);
+ void untake(const argument& x);
unsigned card() const { return h_.sum(); }
- value to_result() const;
+ argument to_result() const;
const accu::histo<S>& histo() const;
@@ -76,7 +76,7 @@
mutable bool valid_;
mutable std::size_t i_; // the median index
- mutable value v_; // the median value
+ mutable argument x_; // the median value
// Auxiliary methods
void update_() const;
@@ -105,13 +105,13 @@
template <typename S>
void
- median<S>::take(const value& v)
+ median<S>::take(const argument& x)
{
- h_.take(v);
+ h_.take(x);
- if (v < v_)
+ if (x < x_)
++sum_minus_;
- else if (v > v_)
+ else if (x > x_)
++sum_plus_;
if (valid_)
@@ -139,14 +139,14 @@
template <typename S>
void
- median<S>::untake(const value& v)
+ median<S>::untake(const argument& x)
{
- mln_precondition(h_(v) != 0);
- h_.untake(v);
+ mln_precondition(h_(x) != 0);
+ h_.untake(x);
- if (v < v_)
+ if (x < x_)
--sum_minus_;
- else if (v > v_)
+ else if (x > x_)
--sum_plus_;
if (valid_)
@@ -191,7 +191,7 @@
sum_minus_ -= h_[i_];
}
while (2 * sum_minus_ > h_.sum());
- v_ = s_[i_];
+ x_ = s_[i_];
}
template <typename S>
@@ -207,7 +207,7 @@
sum_plus_ -= h_[i_];
}
while (2 * sum_plus_ > h_.sum());
- v_ = s_[i_];
+ x_ = s_[i_];
}
template <typename S>
@@ -217,18 +217,18 @@
h_.init();
sum_minus_ = 0;
sum_plus_ = 0;
- i_ = (mln_max(value) - mln_min(value)) / 2;
- v_ = s_[i_];
+ i_ = (mln_max(argument) - mln_min(argument)) / 2;
+ x_ = s_[i_];
valid_ = true;
}
template <typename S>
- typename median<S>::value
+ typename median<S>::argument
median<S>::to_result() const
{
if (! valid_)
update_();
- return v_;
+ return x_;
}
template <typename S>
Index: trunk/milena/mln/accu/median_alt.hh
===================================================================
--- trunk/milena/mln/accu/median_alt.hh (revision 1245)
+++ trunk/milena/mln/accu/median_alt.hh (revision 1246)
@@ -50,21 +50,21 @@
template <typename S>
struct median_alt : : public mln::accu::internal::base_< mln_value(S),
median_alt<S> >
{
- typedef mln_value(S) value;
+ typedef mln_value(S) argument;
median_alt(const Value_Set<S>& s);
- void take(const value& v);
- void untake(const value& v);
+ void take(const argument& x);
+ void untake(const argument& x);
void init();
- value to_result() const;
+ argument to_result() const;
// FIXME: remove
void debug__() const
{
std::cout << " i = " << i_
- << " v = " << v_
+ << " x = " << x_
<< " s = " << sum_minus_ << " ; " <<
h_[i_] << " ; " << sum_plus_ << " = " <<
h_.sum()
<< std::endl;
}
@@ -77,7 +77,7 @@
std::size_t sum_minus_, sum_plus_;
std::size_t i_; // the median index
- value v_; // the median value
+ argument x_; // the median argument
// Auxiliary methods
void go_minus_();
@@ -109,24 +109,24 @@
template <typename S>
void
- median_alt<S>::take(const value& v)
+ median_alt<S>::take(const argument& x)
{
// update h_
- h_.take(v);
+ h_.take(x);
// particular case:
// current state was initialization
if (h_[i_] == 0)
{
// std::cout << "init!" << std::endl;
- i_ = s_.index_of(v);
- v_ = v;
+ i_ = s_.index_of(x);
+ x_ = x;
return;
}
// particular case:
// the median does not change
- if (v == v_)
+ if (x == x_)
{
// std::cout << "no change!" << std::endl;
return;
@@ -134,14 +134,14 @@
// general case:
- if (v < v_)
+ if (x < x_)
{
++sum_minus_;
if (2 * sum_minus_ > h_.sum())
go_minus_();
}
else
- // v > v_
+ // x > x_
{
++sum_plus_;
if (2 * sum_plus_ > h_.sum())
@@ -152,12 +152,12 @@
template <typename S>
void
- median_alt<S>::untake(const value& v)
+ median_alt<S>::untake(const argument& x)
{
- mln_precondition(h_(v) != 0);
+ mln_precondition(h_(x) != 0);
// update h_
- h_.untake(v);
+ h_.untake(x);
// particular case:
// the only value has been removed
@@ -168,20 +168,20 @@
}
// general case:
- if (v < v_)
+ if (x < x_)
{
--sum_minus_;
if (2 * sum_plus_ > h_.sum())
go_plus_();
}
- else if (v > v_)
+ else if (x > x_)
{
--sum_plus_;
if (2 * sum_minus_ > h_.sum())
go_minus_();
}
else
- // v == v_
+ // x == x_
{
if (h_[i_] == 0)
{
@@ -216,7 +216,7 @@
sum_minus_ -= h_[i_];
}
while (2 * sum_minus_ > h_.sum());
- v_ = s_[i_];
+ x_ = s_[i_];
}
@@ -233,7 +233,7 @@
sum_plus_ -= h_[i_];
}
while (2 * sum_plus_ > h_.sum());
- v_ = s_[i_];
+ x_ = s_[i_];
}
@@ -244,15 +244,15 @@
h_.init();
sum_minus_ = 0;
sum_plus_ = 0;
- i_ = (mln_max(value) - mln_min(value)) / 2;
- v_ = s_[i_];
+ i_ = (mln_max(argument) - mln_min(argument)) / 2;
+ x_ = s_[i_];
}
template <typename S>
- typename median_alt<S>::value
+ typename median_alt<S>::argument
median_alt<S>::to_result() const
{
- return v_;
+ return x_;
}
template <typename S>
Index: trunk/milena/mln/accu/p.hh
===================================================================
--- trunk/milena/mln/accu/p.hh (revision 1245)
+++ trunk/milena/mln/accu/p.hh (revision 1246)
@@ -53,7 +53,7 @@
template <typename A>
struct p_ : public mln::accu::internal::base_< mln_result(A) , p_<A> >
{
- typedef mln_value(A) value;
+ typedef mln_value(A) argument;
typedef mln_result(A) result;
@@ -61,8 +61,8 @@
p_(const A& a);
void init();
- void take_as_init(const value& v);
- void take(const value& v);
+ void take_as_init(const argument& x);
+ void take(const argument& x);
void take(const p_<A>& other);
result to_result() const;
@@ -109,16 +109,16 @@
template <typename A>
void
- p_<A>::take_as_init(const value& v)
+ p_<A>::take_as_init(const argument& x)
{
- a_.take_as_init(v.p()); // FIXME: Generalize with "psite(v)".
+ a_.take_as_init(x.p()); // FIXME: Generalize with "psite(x)".
}
template <typename A>
void
- p_<A>::take(const value& v)
+ p_<A>::take(const argument& x)
{
- a_.take(v.p());
+ a_.take(x.p());
}
template <typename A>
Index: trunk/milena/mln/accu/sum.hh
===================================================================
--- trunk/milena/mln/accu/sum.hh (revision 1245)
+++ trunk/milena/mln/accu/sum.hh (revision 1246)
@@ -57,13 +57,13 @@
template <typename V, typename S = mln_sum(V)>
struct sum_ : public mln::accu::internal::base_< S, sum_<V,S> >
{
- typedef V value;
+ typedef V argument;
typedef S result;
sum_();
void init();
- void take(const value& v);
+ void take(const argument& x);
void take(const sum_<V,S>& other);
S to_result() const;
@@ -106,9 +106,9 @@
}
template <typename V, typename S>
- void sum_<V,S>::take(const value& v)
+ void sum_<V,S>::take(const argument& x)
{
- s_ += v;
+ s_ += x;
}
template <typename V, typename S>
Index: trunk/milena/mln/accu/v.hh
===================================================================
--- trunk/milena/mln/accu/v.hh (revision 1245)
+++ trunk/milena/mln/accu/v.hh (revision 1246)
@@ -50,15 +50,15 @@
template <typename A>
struct val_ : public mln::accu::internal::base_< mln_result(A) , val_<A>
>
{
- typedef mln_value(A) value;
+ typedef mln_argument(A) argument;
typedef mln_result(A) result;
val_();
val_(const A& a);
void init();
- void take_as_init(const value& v);
- void take(const value& v);
+ void take_as_init(const argument& x);
+ void take(const argument& x);
void take(const val_<A>& other);
template <typename I>
@@ -118,16 +118,16 @@
template <typename A>
void
- val_<A>::take_as_init(const value& v)
+ val_<A>::take_as_init(const argument& x)
{
- a_.take_as_init(v);
+ a_.take_as_init(x);
}
template <typename A>
void
- val_<A>::take(const value& v)
+ val_<A>::take(const argument& x)
{
- a_.take(v);
+ a_.take(x);
}
template <typename A>
Index: trunk/milena/mln/accu/internal/base.hh
===================================================================
Index: trunk/milena/mln/accu/mean.hh
===================================================================
--- trunk/milena/mln/accu/mean.hh (revision 1245)
+++ trunk/milena/mln/accu/mean.hh (revision 1246)
@@ -60,13 +60,13 @@
typename M = S>
struct mean_ : public mln::accu::internal::base_< M , mean_<V,S,M> >
{
- typedef V value;
+ typedef V argument;
typedef M result;
mean_();
void init();
- void take(const value& v);
+ void take(const argument& x);
void take(const mean_<V,S,M>& other);
M to_result() const;
@@ -114,10 +114,10 @@
}
template <typename V, typename S, typename M>
- void mean_<V,S,M>::take(const value& v)
+ void mean_<V,S,M>::take(const argument& x)
{
- count_.take(v);
- sum_.take(v);
+ count_.take(x);
+ sum_.take(x);
}
template <typename V, typename S, typename M>