Commit 60d78956 authored by Matthieu Garrigues's avatar Matthieu Garrigues
Browse files

Change accumulators inheritance.


	* mln/accu/bbox.hh,
	* mln/accu/count.hh,
	* mln/accu/histo.hh,
	* mln/accu/max.hh,
	* mln/accu/max_h.hh,
	* mln/accu/mean.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: Update inheritances (from Accumulator to base_).

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@1237 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent dc9569a4
2007-10-04 Matthieu Garrigues <garrigues@lrde.epita.fr>
Change accumulators inheritance.
* mln/accu/bbox.hh,
* mln/accu/count.hh,
* mln/accu/histo.hh,
* mln/accu/max.hh,
* mln/accu/max_h.hh,
* mln/accu/mean.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: Update inheritances (from Accumulator to base_).
2007-10-04 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Introduce the notion of literals.
......
......@@ -33,7 +33,7 @@
* \brief Define an accumulator that computes a bbox.
*/
# include <mln/core/concept/accumulator.hh>
# include <mln/accu/internal/base.hh>
# include <mln/core/box.hh>
......@@ -49,7 +49,7 @@ namespace mln
* The parameter \c P is the type of points.
*/
template <typename P>
struct bbox : public Accumulator< bbox<P> >
struct bbox : public mln::accu::internal::base_< const box_<P>& , bbox<P> >
{
typedef P value;
typedef const box_<P>& result;
......
......@@ -33,6 +33,7 @@
* \brief Define an accumulator that counts.
*/
# include <mln/accu/internal/base.hh>
# include <mln/core/concept/meta_accumulator.hh>
......@@ -46,7 +47,7 @@ namespace mln
/*! Generic counter accumulator class.
*/
template <typename V>
struct count_ : public Accumulator< count_<V> >
struct count_ : public mln::accu::internal::base_< std::size_t , count_<V> >
{
typedef V value;
typedef std::size_t result; // FIXME: Up in Accumulator.
......
......@@ -39,7 +39,7 @@
# include <algorithm>
# include <mln/core/concept/value_set.hh>
# include <mln/core/concept/accumulator.hh>
# include <mln/accu/internal/base.hh>
# include <mln/value/set.hh>
......@@ -53,7 +53,7 @@ namespace mln
/*! Generic histogram class over a value set with type \c S.
*/
template <typename S>
struct histo : public Accumulator< histo<S> >
struct histo : public mln::accu::internal::base_< const std::vector<std::size_t>& , histo<S> >
{
histo(const Value_Set<S>& s);
histo();
......@@ -75,7 +75,7 @@ namespace mln
const std::vector<std::size_t>& to_result() const;
const S& vset() const;
protected:
const S& s_;
......@@ -157,7 +157,7 @@ namespace mln
mln_precondition(i < s_.nvalues());
return h_[i];
}
template <typename S>
std::size_t
histo<S>::nvalues() const
......@@ -185,7 +185,7 @@ namespace mln
{
return h_;
}
template <typename S>
const S&
histo<S>::vset() const
......
......@@ -50,7 +50,7 @@ namespace mln
* The parameter \c V is the type of values.
*/
template <typename V>
struct max_ : public Accumulator< max_<V> >
struct max_ : public mln::accu::internal::base_< V , max_<V> >
{
typedef V value;
typedef V result;
......@@ -63,7 +63,7 @@ namespace mln
void take(const max_<V>& other);
V to_result() const;
protected:
V v_;
......
......@@ -33,7 +33,7 @@
* \brief Define a generic max accumulator class based on histogram.
*/
# include <mln/core/concept/accumulator.hh>
# include <mln/accu/internal/base.hh>
# include <mln/accu/histo.hh>
......@@ -48,7 +48,7 @@ namespace mln
* type \c S.
*/
template <typename S>
struct max_h : public Accumulator< max_h<S> >
struct max_h : public mln::accu::internal::base_< mln_value(S) , max_h<S> >
{
typedef mln_value(S) value;
typedef value result;
......
......@@ -35,6 +35,7 @@
* \todo Use accu::pair just like in accu::min_max.
*/
# include <mln/accu/internal/base.hh>
# include <mln/accu/count.hh>
# include <mln/accu/sum.hh>
......@@ -57,7 +58,7 @@ namespace mln
template <typename V,
typename S = mln_sum(V),
typename M = S>
struct mean_ : public Accumulator< mean_<V,S,M> >
struct mean_ : public mln::accu::internal::base_< M , mean_<V,S,M> >
{
typedef V value;
typedef M result;
......
......@@ -33,6 +33,7 @@
* \brief Define an accumulator that computes a min.
*/
# include <mln/accu/internal/base.hh>
# include <mln/core/concept/meta_accumulator.hh>
# include <mln/value/props.hh>
# include <mln/util/pix.hh>
......@@ -50,7 +51,7 @@ namespace mln
* The parameter \c V is the type of values.
*/
template <typename V>
struct min_ : public Accumulator< min_<V> >
struct min_ : public mln::accu::internal::base_< V, min_<V> >
{
typedef V value;
typedef V result;
......@@ -63,7 +64,7 @@ namespace mln
void take(const min_<V>& other);
V to_result() const;
protected:
V v_;
......@@ -111,7 +112,7 @@ namespace mln
if (v < v_)
v_ = v;
}
template <typename V>
void
min_<V>::take(const min_<V>& other)
......
......@@ -33,7 +33,7 @@
* \brief Define a generic min accumulator class based on histogram.
*/
# include <mln/core/concept/accumulator.hh>
# include <mln/accu/internal/base.hh>
# include <mln/accu/histo.hh>
......@@ -48,7 +48,7 @@ namespace mln
* type \c S.
*/
template <typename S>
struct min_h : public Accumulator< min_h<S> >
struct min_h : public mln::accu::internal::base_< mln_value(S) , min_h<S> >
{
typedef mln_value(S) value;
typedef value result;
......@@ -153,7 +153,7 @@ namespace mln
if (v == v_ && h_[i_] == 0)
valid_ = false;
}
template <typename S>
void
min_h<S>::update_() const
......
......@@ -32,11 +32,12 @@
*
* \brief Define an accumulator that does nothing.
*
* \todo A macro to generate the meta version.
* \todo A macro to generate the meta version.
*/
# include <mln/core/concept/meta_accumulator.hh>
# include <mln/core/concept/accumulator.hh>
# include <mln/accu/internal/base.hh>
# include <mln/util/eat.hh>
# include <mln/util/ignore.hh>
......@@ -50,7 +51,7 @@ namespace mln
/*! Define an accumulator that does nothing.
*/
template <typename T>
struct nil_ : public Accumulator< nil_<T> >
struct nil_ : public mln::accu::internal::base_< util::ignore , nil_<T> >
{
typedef util::eat value;
typedef util::ignore result;
......
......@@ -35,6 +35,8 @@
# include <mln/core/concept/meta_accumulator.hh>
# include <mln/core/concept/accumulator.hh>
# include <mln/accu/internal/base.hh>
# include <mln/metal/is_a.hh>
......@@ -50,7 +52,7 @@ namespace mln
* The parameter \c V is the type of values.
*/
template <typename A>
struct p_ : public Accumulator< p_<A> >
struct p_ : public mln::accu::internal::base_< mln_result(A) , p_<A> >
{
typedef mln_value(A) value;
typedef mln_result(A) result;
......@@ -119,7 +121,7 @@ namespace mln
{
a_.take(v.p());
}
template <typename A>
void
p_<A>::take(const p_<A>& other)
......
......@@ -36,6 +36,8 @@
# include <utility>
# include <mln/core/concept/meta_accumulator.hh>
# include <mln/accu/internal/base.hh>
# include <mln/metal/is_a.hh>
# include <mln/metal/unqualif.hh>
......@@ -54,7 +56,7 @@ namespace mln
* \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)>
struct pair_ : public Accumulator< pair_<A1,A2,V> >
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;
......@@ -126,7 +128,7 @@ namespace mln
a1_.take(v);
a2_.take(v);
}
template <typename A1, typename A2, typename V>
void
pair_<A1,A2,V>::take(const pair_<A1,A2,V>& other)
......
......@@ -34,6 +34,8 @@
*/
# include <mln/core/concept/meta_accumulator.hh>
# include <mln/accu/internal/base.hh>
# include <mln/value/props.hh>
# include <mln/util/pix.hh>
# include <mln/literal/zero.hh>
......@@ -53,7 +55,7 @@ namespace mln
* \c S is the summation type (property) of \c V.
*/
template <typename V, typename S = mln_sum(V)>
struct sum_ : public Accumulator< sum_<V,S> >
struct sum_ : public mln::accu::internal::base_< S, sum_<V,S> >
{
typedef V value;
typedef S result;
......@@ -65,7 +67,7 @@ namespace mln
void take(const sum_<V,S>& other);
S to_result() const;
protected:
S s_;
......
......@@ -34,7 +34,7 @@
*/
# include <mln/core/concept/meta_accumulator.hh>
# include <mln/core/concept/accumulator.hh>
# include <mln/accu/internal/base.hh>
# include <mln/metal/is_a.hh>
......@@ -48,7 +48,7 @@ namespace mln
/*! Generic v of accumulators.
*/
template <typename A>
struct val_ : public Accumulator< val_<A> >
struct val_ : public mln::accu::internal::base_< mln_result(A) , val_<A> >
{
typedef mln_value(A) value;
typedef mln_result(A) result;
......@@ -129,7 +129,7 @@ namespace mln
{
a_.take(v);
}
template <typename A>
void
val_<A>::take(const val_<A>& other)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment