
--- ChangeLog | 22 ++++++++++++++++++++ milena/mln/accu/bbox.hh | 1 - milena/mln/accu/histo.hh | 1 - milena/mln/accu/max.hh | 7 ++--- milena/mln/accu/max_h.hh | 7 ++--- milena/mln/accu/mean.hh | 1 - milena/mln/accu/median_alt.hh | 6 ++-- milena/mln/accu/median_h.hh | 7 ++--- milena/mln/accu/min_h.hh | 7 ++--- milena/mln/accu/nil.hh | 1 - milena/mln/accu/p.hh | 8 ++---- milena/mln/accu/rank.hh | 7 ++--- milena/mln/accu/rank_bool.hh | 1 - milena/mln/accu/rank_high_quant.hh | 7 ++--- milena/mln/accu/sum.hh | 7 ++--- milena/mln/accu/tuple.hh | 10 ++++---- milena/mln/accu/v.hh | 39 ++++++++++++++++++++++------------- 17 files changed, 78 insertions(+), 61 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2bf6a2a..3652625 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2008-14-07 Guillaume Lazzara <z@lrde.epita.fr> + + Update accus to make them work with the new q_result typedef. + * milena/mln/accu/bbox.hh, + * milena/mln/accu/histo.hh, + * milena/mln/accu/max.hh, + * milena/mln/accu/max_h.hh, + * milena/mln/accu/mean.hh, + * milena/mln/accu/median_alt.hh, + * milena/mln/accu/median_h.hh, + * milena/mln/accu/min_h.hh, + * milena/mln/accu/nil.hh, + * milena/mln/accu/p.hh, + * milena/mln/accu/rank.hh, + * milena/mln/accu/rank_bool.hh, + * milena/mln/accu/rank_high_quant.hh, + * milena/mln/accu/sum.hh, + * milena/mln/accu/tuple.hh, + * milena/mln/accu/v.hh: + Remove "result" typedef. + Pass the qualified type as parameter to internal::base<>. + 2008-13-07 Guillaume Lazzara <z@lrde.epita.fr> * milena/sandbox/scribo/remove_tables.cc: diff --git a/milena/mln/accu/bbox.hh b/milena/mln/accu/bbox.hh index b9e8259..ce143a4 100644 --- a/milena/mln/accu/bbox.hh +++ b/milena/mln/accu/bbox.hh @@ -53,7 +53,6 @@ namespace mln struct bbox : public mln::accu::internal::base< const box<P>& , bbox<P> > { typedef P argument; - typedef const box<P>& result; bbox(); diff --git a/milena/mln/accu/histo.hh b/milena/mln/accu/histo.hh index 564879d..ddf3aec 100644 --- a/milena/mln/accu/histo.hh +++ b/milena/mln/accu/histo.hh @@ -62,7 +62,6 @@ namespace mln histo(); typedef V argument; - typedef const std::vector<std::size_t>& result; /// Manipulators. /// \{ diff --git a/milena/mln/accu/max.hh b/milena/mln/accu/max.hh index 7419a56..fe6a2de 100644 --- a/milena/mln/accu/max.hh +++ b/milena/mln/accu/max.hh @@ -51,10 +51,9 @@ namespace mln * 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< const T& , max_<T> > { typedef T argument; - typedef T result; max_(); @@ -67,7 +66,7 @@ namespace mln /// \} /// Get the value of the accumulator. - T to_result() const; + const T& to_result() const; /// Check whether this accu is able to return a result. /// Always true here. @@ -144,7 +143,7 @@ namespace mln template <typename T> inline - T + const T& max_<T>::to_result() const { return t_; diff --git a/milena/mln/accu/max_h.hh b/milena/mln/accu/max_h.hh index b5e19d2..6d861df 100644 --- a/milena/mln/accu/max_h.hh +++ b/milena/mln/accu/max_h.hh @@ -49,10 +49,9 @@ namespace mln * type \c V. */ template <typename V> - struct max_h : public mln::accu::internal::base< V, max_h<V> > + struct max_h : public mln::accu::internal::base< const V&, max_h<V> > { typedef V argument; - typedef argument result; max_h(); @@ -68,7 +67,7 @@ namespace mln unsigned card() const { return h_.sum(); } /// Get the value of the accumulator. - argument to_result() const; + const argument& to_result() const; const accu::histo<V>& histo() const; @@ -248,7 +247,7 @@ namespace mln template <typename V> inline - typename max_h<V>::argument + const typename max_h<V>::argument& max_h<V>::to_result() const { if (! valid_) diff --git a/milena/mln/accu/mean.hh b/milena/mln/accu/mean.hh index afff048..09fa92c 100644 --- a/milena/mln/accu/mean.hh +++ b/milena/mln/accu/mean.hh @@ -61,7 +61,6 @@ namespace mln struct mean_ : public mln::accu::internal::base< M , mean_<T,S,M> > { typedef T argument; - typedef M result; mean_(); diff --git a/milena/mln/accu/median_alt.hh b/milena/mln/accu/median_alt.hh index 2c84e10..d22206b 100644 --- a/milena/mln/accu/median_alt.hh +++ b/milena/mln/accu/median_alt.hh @@ -48,7 +48,7 @@ namespace mln * 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< const mln_value(S)&, median_alt<S> > { typedef mln_value(S) argument; @@ -62,7 +62,7 @@ namespace mln /// \} /// Get the value of the accumulator. - argument to_result() const; + const argument& to_result() const; /// Check whether this accu is able to return a result. /// Always true here. @@ -230,7 +230,7 @@ namespace mln template <typename S> inline - typename median_alt<S>::argument + const typename median_alt<S>::argument& median_alt<S>::to_result() const { return t_; diff --git a/milena/mln/accu/median_h.hh b/milena/mln/accu/median_h.hh index 32b5b3b..de863f9 100644 --- a/milena/mln/accu/median_h.hh +++ b/milena/mln/accu/median_h.hh @@ -49,10 +49,9 @@ namespace mln * set with type \c V. */ template <typename V> - struct median_h : public mln::accu::internal::base< V, median_h<V> > + struct median_h : public mln::accu::internal::base< const V&, median_h<V> > { typedef V argument; - typedef argument result; median_h(); @@ -67,7 +66,7 @@ namespace mln unsigned card() const { return h_.sum(); } /// Get the value of the accumulator. - argument to_result() const; + const argument& to_result() const; const accu::histo<V>& histo() const; @@ -233,7 +232,7 @@ namespace mln template <typename V> inline - typename median_h<V>::argument + const typename median_h<V>::argument& median_h<V>::to_result() const { if (! valid_) diff --git a/milena/mln/accu/min_h.hh b/milena/mln/accu/min_h.hh index 8c9d5fa..df4e5cc 100644 --- a/milena/mln/accu/min_h.hh +++ b/milena/mln/accu/min_h.hh @@ -50,10 +50,9 @@ namespace mln * set with type \c V. */ template <typename V> - struct min_h : public mln::accu::internal::base< V , min_h<V> > + struct min_h : public mln::accu::internal::base< const V& , min_h<V> > { typedef V argument; - typedef argument result; min_h(); @@ -69,7 +68,7 @@ namespace mln unsigned card() const { return h_.sum(); } /// Get the value of the accumulator. - result to_result() const; + const argument& to_result() const; const accu::histo<V>& histo() const; @@ -249,7 +248,7 @@ namespace mln template <typename V> inline - typename min_h<V>::argument + const typename min_h<V>::argument& min_h<V>::to_result() const { if (! valid_) diff --git a/milena/mln/accu/nil.hh b/milena/mln/accu/nil.hh index 5cd7791..cc93ff3 100644 --- a/milena/mln/accu/nil.hh +++ b/milena/mln/accu/nil.hh @@ -54,7 +54,6 @@ namespace mln struct nil_ : public mln::accu::internal::base< util::ignore , nil_<T> > { typedef util::eat argument; - typedef util::ignore result; nil_(); diff --git a/milena/mln/accu/p.hh b/milena/mln/accu/p.hh index ce4d16c..53bc001 100644 --- a/milena/mln/accu/p.hh +++ b/milena/mln/accu/p.hh @@ -52,11 +52,9 @@ namespace mln * 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< const mln_result(A)& , p_<A> > { typedef mln_argument(A) argument; - typedef mln_result(A) result; - p_(); p_(const A& a); @@ -70,7 +68,7 @@ namespace mln /// \} /// Get the value of the accumulator. - result to_result() const; + const mln_result(A)& to_result() const; /// Check whether this accu is able to return a result. /// Always true here. @@ -146,7 +144,7 @@ namespace mln template <typename A> inline - typename p_<A>::result + const mln_result(A)& p_<A>::to_result() const { return a_.to_result(); diff --git a/milena/mln/accu/rank.hh b/milena/mln/accu/rank.hh index 69f668c..005d934 100644 --- a/milena/mln/accu/rank.hh +++ b/milena/mln/accu/rank.hh @@ -53,10 +53,9 @@ namespace mln * 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< const T&, rank_<T> > { typedef T argument; - typedef T result; typedef mln::value::set<T> S; rank_(unsigned k, unsigned n); @@ -72,7 +71,7 @@ namespace mln unsigned card() const { return h_.sum(); } /// Get the value of the accumulator. - T to_result() const; + const T& to_result() const; /// Check whether this accu is able to return a result. /// Always true here. @@ -266,7 +265,7 @@ namespace mln template <typename T> inline - T + const T& rank_<T>::to_result() const { if (! valid_) diff --git a/milena/mln/accu/rank_bool.hh b/milena/mln/accu/rank_bool.hh index 2ea878f..a60ff7e 100644 --- a/milena/mln/accu/rank_bool.hh +++ b/milena/mln/accu/rank_bool.hh @@ -56,7 +56,6 @@ namespace mln struct rank_<bool> : public mln::accu::internal::base< bool, rank_<bool> > { typedef bool argument; - typedef bool result; rank_(unsigned k, unsigned n); diff --git a/milena/mln/accu/rank_high_quant.hh b/milena/mln/accu/rank_high_quant.hh index 151c6e5..95c56ec 100644 --- a/milena/mln/accu/rank_high_quant.hh +++ b/milena/mln/accu/rank_high_quant.hh @@ -52,10 +52,9 @@ namespace mln * 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< const T&, rank_<T> > { typedef T argument; - typedef T result; rank_(unsigned k, unsigned n); @@ -69,7 +68,7 @@ namespace mln /// \} /// Get the value of the accumulator. - T to_result() const; + const T& to_result() const; /// Check whether this accu is able to return a result. /// Always true here. @@ -154,7 +153,7 @@ namespace mln template <typename T> inline - T + const T& rank_<T>::to_result() const { const_cast<rank_<T>&>(*this).sort(); diff --git a/milena/mln/accu/sum.hh b/milena/mln/accu/sum.hh index 2c0569a..484def9 100644 --- a/milena/mln/accu/sum.hh +++ b/milena/mln/accu/sum.hh @@ -57,10 +57,9 @@ namespace mln * \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< const S&, sum_<T,S> > { typedef T argument; - typedef S result; sum_(); @@ -72,7 +71,7 @@ namespace mln /// \} /// Get the value of the accumulator. - S to_result() const; + const S& to_result() const; /// Check whether this accu is able to return a result. /// Always true here. @@ -137,7 +136,7 @@ namespace mln template <typename T, typename S> inline - S + const S& sum_<T,S>::to_result() const { return s_; diff --git a/milena/mln/accu/tuple.hh b/milena/mln/accu/tuple.hh index d1cb1d1..00300e2 100644 --- a/milena/mln/accu/tuple.hh +++ b/milena/mln/accu/tuple.hh @@ -72,11 +72,11 @@ namespace mln */ 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; - typedef boost::tuple< BOOST_PP_REPEAT(10, RESULT_ACCU, Le Ricard ya que ca de vrai !)> result; + typedef boost::tuple< BOOST_PP_REPEAT(10, RESULT_ACCU, Le Ricard ya que ca de vrai !)> res; typedef boost::tuple< BOOST_PP_ENUM_PARAMS(10, T)> intern; typedef tuple_<A, n, BOOST_PP_ENUM_PARAMS(10, T)> self; @@ -91,7 +91,7 @@ namespace mln /// \} /// Get the value of the accumulator. - result to_result() const; + res to_result() const; /// Check whether this accu is able to return a result. /// Always true here. @@ -225,10 +225,10 @@ namespace mln template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)> inline - typename tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::result + typename tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::res tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::to_result() const { - result tmp; + res tmp; internal::tuple_helper<n, self>::to_result(this->a_, tmp); return tmp; } diff --git a/milena/mln/accu/v.hh b/milena/mln/accu/v.hh index 53676f1..af00fe2 100644 --- a/milena/mln/accu/v.hh +++ b/milena/mln/accu/v.hh @@ -49,10 +49,9 @@ namespace mln /// 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< const mln_result(A)& , val_<A> > { typedef mln_argument(A) argument; - typedef mln_result(A) result; val_(); val_(const A& a); @@ -63,22 +62,14 @@ namespace mln void take_as_init(const argument& t); void take(const argument& t); void take(const val_<A>& other); - /// \} - template <typename I> - void take_as_init(const util::pix<I>& pix) - { - a_.take_as_init(pix.v()); // FIXME: Generalize with "value(pix)". - } - + void take_as_init(const util::pix<I>& pix); template <typename I> - void take(const util::pix<I>& pix) - { - a_.take(pix.v()); - } + void take(const util::pix<I>& pix); + /// \} /// Get the value of the accumulator. - result to_result() const; + const mln_result(A)& to_result() const; /// Check whether this accu is able to return a result. /// Always true here. @@ -157,8 +148,26 @@ namespace mln } template <typename A> + template <typename I> + inline + void + val_<A>::take_as_init(const util::pix<I>& pix) + { + a_.take_as_init(pix.v()); // FIXME: Generalize with "value(pix)". + } + + template <typename A> + template <typename I> + inline + void + val_<A>::take(const util::pix<I>& pix) + { + a_.take(pix.v()); + } + + template <typename A> inline - typename val_<A>::result + const mln_result(A)& val_<A>::to_result() const { return a_.to_result(); -- 1.5.6.5