2563: Remove the useless '_' postfix in all the accumulators.

--- ChangeLog | 49 +++++++++++++++++- milena/doc/examples/tuto_bis.cc | 8 ++-- milena/doc/tutorial/examples/accu.cc | 4 +- milena/mln/accu/bbox.hh | 2 +- milena/mln/accu/count.hh | 34 ++++++------ milena/mln/accu/count_adjacent_vertices.hh | 43 ++++++++------- milena/mln/accu/height.hh | 44 ++++++++-------- milena/mln/accu/histo.hh | 2 +- milena/mln/accu/max_h.hh | 4 +- milena/mln/accu/mean.hh | 26 +++++----- milena/mln/accu/median_alt.hh | 17 ++++++ milena/mln/accu/median_h.hh | 18 ++++++ milena/mln/accu/nil.hh | 22 ++++---- milena/mln/accu/p.hh | 46 +++++++++------- milena/mln/accu/rank.hh | 30 +++++----- milena/mln/accu/rank_bool.hh | 24 ++++---- milena/mln/accu/rank_high_quant.hh | 30 +++++----- milena/mln/accu/sum.hh | 22 ++++---- milena/mln/accu/tuple.hh | 62 +++++++++++----------- milena/mln/accu/v.hh | 30 +++++----- milena/mln/accu/volume.hh | 48 ++++++++-------- milena/mln/canvas/morpho/algebraic_union_find.hh | 4 +- milena/mln/estim/mean.hh | 2 +- milena/mln/estim/sum.hh | 2 +- milena/mln/make/voronoi.hh | 2 +- milena/mln/morpho/closing_area.hh | 2 +- milena/mln/morpho/closing_area_on_vertices.hh | 2 +- milena/mln/morpho/closing_height.hh | 2 +- milena/mln/morpho/closing_volume.hh | 2 +- milena/mln/morpho/erosion.spe.hh | 16 +++--- milena/mln/morpho/opening_area.hh | 2 +- milena/mln/morpho/opening_area_on_vertices.hh | 2 +- milena/mln/morpho/opening_height.hh | 2 +- milena/mln/morpho/opening_volume.hh | 2 +- milena/mln/morpho/rank_filter.hh | 2 +- milena/tests/accu/all_accus.cc | 16 +++--- milena/tests/accu/count.cc | 4 +- milena/tests/accu/nil.cc | 2 +- milena/tests/accu/pair.cc | 2 +- milena/tests/accu/rank.cc | 18 +++--- milena/tests/accu/tuple.cc | 4 +- milena/tests/labeling/compute.cc | 4 +- 42 files changed, 374 insertions(+), 285 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3652625..d1e291a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,51 @@ -2008-14-07 Guillaume Lazzara <z@lrde.epita.fr> +2008-15-07 Guillaume Lazzara <z@lrde.epita.fr> + + Remove the useless '_' postfix in all the accumulators. + * milena/doc/examples/tuto_bis.cc, + * milena/doc/tutorial/examples/accu.cc, + * milena/mln/accu/bbox.hh, + * milena/mln/accu/count.hh, + * milena/mln/accu/count_adjacent_vertices.hh, + * milena/mln/accu/height.hh, + * milena/mln/accu/histo.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/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, + * milena/mln/accu/volume.hh, + * milena/mln/canvas/morpho/algebraic_union_find.hh, + * milena/mln/estim/mean.hh, + * milena/mln/estim/sum.hh, + * milena/mln/make/voronoi.hh, + * milena/mln/morpho/closing_area.hh, + * milena/mln/morpho/closing_area_on_vertices.hh, + * milena/mln/morpho/closing_height.hh, + * milena/mln/morpho/closing_volume.hh, + * milena/mln/morpho/erosion.spe.hh, + * milena/mln/morpho/opening_area.hh, + * milena/mln/morpho/opening_area_on_vertices.hh, + * milena/mln/morpho/opening_height.hh, + * milena/mln/morpho/opening_volume.hh, + * milena/mln/morpho/rank_filter.hh, + * milena/tests/accu/all_accus.cc, + * milena/tests/accu/count.cc, + * milena/tests/accu/nil.cc, + * milena/tests/accu/pair.cc, + * milena/tests/accu/rank.cc, + * milena/tests/accu/tuple.cc, + * milena/tests/labeling/compute.cc: + Update. + + +2008-15-07 Guillaume Lazzara <z@lrde.epita.fr> Update accus to make them work with the new q_result typedef. * milena/mln/accu/bbox.hh, diff --git a/milena/doc/examples/tuto_bis.cc b/milena/doc/examples/tuto_bis.cc index 48a79d4..047ee86 100644 --- a/milena/doc/examples/tuto_bis.cc +++ b/milena/doc/examples/tuto_bis.cc @@ -50,7 +50,7 @@ namespace mln ima.at(nrows, c) = v; } } - + } // mln::border namespace accu @@ -63,7 +63,7 @@ namespace mln const Image<L>& label_, V& v) { - mlc_is_a(A_, Meta_Accumulator)::check(); + mlc_is_a(A_, Meta_Accumulator)::check(); trace::entering("accu::compute"); const I& input = exact(input_); @@ -94,7 +94,7 @@ namespace mln { mln_concrete(I) output; initialize(output, input); - accu::min_max_<mln_value(I)> mm; + accu::min_max<mln_value(I)> mm; mln_piter(I) p(input.domain()); mln_niter(N) n(nbh, p); @@ -117,7 +117,7 @@ namespace mln mln_concrete(I) output; initialize(output, input); - accu::max_<V> m; + accu::max<V> m; mln_piter(I) p(input.domain()); mln_niter(N) n(nbh, p); diff --git a/milena/doc/tutorial/examples/accu.cc b/milena/doc/tutorial/examples/accu.cc index 20fd6cb..a0c68bd 100644 --- a/milena/doc/tutorial/examples/accu.cc +++ b/milena/doc/tutorial/examples/accu.cc @@ -5,9 +5,9 @@ int main() { using namespace mln; - mlc_bool(accu::mean_<int>::proxy_level == 1)::check(); + mlc_bool(accu::mean<int>::proxy_level == 1)::check(); - accu::mean_<int> m; + accu::mean<int> m; m.take(100); m.take(2); mln_assertion(m == 51); diff --git a/milena/mln/accu/bbox.hh b/milena/mln/accu/bbox.hh index ce143a4..4066428 100644 --- a/milena/mln/accu/bbox.hh +++ b/milena/mln/accu/bbox.hh @@ -88,7 +88,7 @@ namespace mln template <typename T> struct with { - typedef mln::accu::bbox<T> ret; + typedef accu::bbox<T> ret; }; }; diff --git a/milena/mln/accu/count.hh b/milena/mln/accu/count.hh index c2c1f02..f13462c 100644 --- a/milena/mln/accu/count.hh +++ b/milena/mln/accu/count.hh @@ -43,17 +43,17 @@ namespace mln /// \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; - count_(); + count(); /// Manipulators. /// \{ void init(); void take(const argument&); - void take(const count_<T>& other); + void take(const count<T>& other); /// Force the value of the counter to \a c. void set_value(std::size_t c); @@ -68,7 +68,7 @@ namespace mln protected: /// The value of the counter. - std::size_t count__; + std::size_t count_; }; namespace meta @@ -80,7 +80,7 @@ namespace mln template <typename T> struct with { - typedef count_<T> ret; + typedef accu::count<T> ret; }; }; @@ -91,7 +91,7 @@ namespace mln template <typename T> inline - count_<T>::count_() + count<T>::count() { init(); } @@ -99,47 +99,47 @@ namespace mln template <typename T> inline void - count_<T>::init() + count<T>::init() { - count__ = 0; + count_ = 0; } template <typename T> inline void - count_<T>::take(const argument&) + count<T>::take(const argument&) { - ++count__; + ++count_; } template <typename T> inline void - count_<T>::take(const count_<T>& other) + count<T>::take(const count<T>& other) { - count__ += other.count__; + count_ += other.count_; } template <typename T> inline std::size_t - count_<T>::to_result() const + count<T>::to_result() const { - return count__; + return count_; } template <typename T> inline void - count_<T>::set_value(std::size_t c) + count<T>::set_value(std::size_t c) { - count__ = c; + count_ = c; } template <typename T> inline bool - count_<T>::is_valid() const + count<T>::is_valid() const { return true; } diff --git a/milena/mln/accu/count_adjacent_vertices.hh b/milena/mln/accu/count_adjacent_vertices.hh index 58e7921..a4b6b51 100644 --- a/milena/mln/accu/count_adjacent_vertices.hh +++ b/milena/mln/accu/count_adjacent_vertices.hh @@ -53,21 +53,21 @@ namespace mln /// This accumulator is used by mln::closing_area_on_vertices and /// mln::opening_area_on_vertices. template <typename P, typename V> - struct count_adjacent_vertices_ + struct count_adjacent_vertices : public mln::accu::internal::base< std::size_t, - count_adjacent_vertices_<P, V> > + count_adjacent_vertices<P, V> > { typedef mln::util::pix< mln::line_graph_image<P, V> > argument; - count_adjacent_vertices_(); + count_adjacent_vertices(); /// Manipulators. /// \{ void init(); void take(const argument& arg); - void take(const count_adjacent_vertices_<P, V>& other); + void take(const count_adjacent_vertices<P, V>& other); - /// Force the value of the counter to \a c. + /// Force the value of the counter to \a c. void set_value(std::size_t c); /// \} @@ -86,23 +86,28 @@ namespace mln }; - /// \brief Meta accumulator for count_adjacent_vertices. - struct count_adjacent_vertices - : public Meta_Accumulator< count_adjacent_vertices > + namespace meta { - template <typename P, typename V> - struct with + + /// \brief Meta accumulator for count_adjacent_vertices. + struct count_adjacent_vertices + : public Meta_Accumulator< count_adjacent_vertices > { - typedef count_adjacent_vertices_<P, V> ret; + template <typename P, typename V> + struct with + { + typedef accu::count_adjacent_vertices<P, V> ret; + }; }; - }; + + } // end of namespace mln::accu::meta # ifndef MLN_INCLUDE_ONLY template <typename P, typename V> inline - count_adjacent_vertices_<P, V>::count_adjacent_vertices_() + count_adjacent_vertices<P, V>::count_adjacent_vertices() { init(); } @@ -110,7 +115,7 @@ namespace mln template <typename P, typename V> inline void - count_adjacent_vertices_<P, V>::init() + count_adjacent_vertices<P, V>::init() { vertices_.clear(); update_(); @@ -119,7 +124,7 @@ namespace mln template <typename P, typename V> inline void - count_adjacent_vertices_<P, V>::take(const argument& arg) + count_adjacent_vertices<P, V>::take(const argument& arg) { vertices_.insert(arg.p().first_id()); vertices_.insert(arg.p().second_id()); @@ -129,7 +134,7 @@ namespace mln template <typename P, typename V> inline void - count_adjacent_vertices_<P, V>::take(const count_adjacent_vertices_<P, V>& other) + count_adjacent_vertices<P, V>::take(const count_adjacent_vertices<P, V>& other) { vertices_.insert (other.vertices_.begin(), other.vertices_.end()); update_(); @@ -138,7 +143,7 @@ namespace mln template <typename P, typename V> inline std::size_t - count_adjacent_vertices_<P, V>::to_result() const + count_adjacent_vertices<P, V>::to_result() const { return count__; } @@ -146,7 +151,7 @@ namespace mln template <typename P, typename V> inline void - count_adjacent_vertices_<P, V>::set_value(std::size_t c) + count_adjacent_vertices<P, V>::set_value(std::size_t c) { count__ = c; /// Reset the other member. @@ -156,7 +161,7 @@ namespace mln template <typename P, typename V> inline void - count_adjacent_vertices_<P, V>::update_() + count_adjacent_vertices<P, V>::update_() { count__ = vertices_.size(); } diff --git a/milena/mln/accu/height.hh b/milena/mln/accu/height.hh index 80dc28d..def9d5d 100644 --- a/milena/mln/accu/height.hh +++ b/milena/mln/accu/height.hh @@ -35,7 +35,7 @@ This accumulator uses an mln::util::pix (pixel) to update the height information of the component. - The class mln/accu/height_ is not a general-purpose accumulator; + The class mln/accu/height is not a general-purpose accumulator; it is used to implement height-based connected filters. \see mln::morpho::closing_height \see mln::morpho::opening_height */ @@ -58,8 +58,8 @@ namespace mln /// The parameter \p I is the image type on which the accumulator /// of pixels is built. template <typename I> - struct height_ - : public mln::accu::internal::base< std::size_t , height_<I> > + struct height + : public mln::accu::internal::base< std::size_t , height<I> > { /// \brief The accumulated data type. /// @@ -71,13 +71,13 @@ namespace mln /// The value type associated to the pixel type. typedef typename argument::value value; - height_(); + height(); /// Manipulators. /// \{ void init(); void take(const argument&); - void take(const height_<I>& other); + void take(const height<I>& other); /// Force the value of the counter to \a h. void set_value(std::size_t h); @@ -96,7 +96,7 @@ namespace mln /// The maximum level in the component. value max_level__; /// The height of the component. - std::size_t height__; + std::size_t height_; }; @@ -107,10 +107,10 @@ namespace mln struct height : public Meta_Accumulator< height > { template <typename I> - struct with - { - typedef height_<I> ret; - }; + struct with + { + typedef accu::height<I> ret; + }; }; } // end of namespace mln::accu::meta @@ -119,7 +119,7 @@ namespace mln template <typename I> inline - height_<I>::height_() + height<I>::height() { init(); } @@ -127,47 +127,47 @@ namespace mln template <typename I> inline void - height_<I>::init() + height<I>::init() { min_level__ = mln_max(value); max_level__ = mln_min(value); - height__ = 0; + height_ = 0; } template <typename I> inline void - height_<I>::take(const argument& t) + height<I>::take(const argument& t) { min_level__ = math::min(min_level__, t.v()); max_level__ = math::max(max_level__, t.v()); - height__ = max_level__ - min_level__; + height_ = max_level__ - min_level__; } template <typename I> inline void - height_<I>::take(const height_<I>& other) + height<I>::take(const height<I>& other) { min_level__ = math::min(min_level__, other.min_level__); max_level__ = math::max(max_level__, other.max_level__); - height__ = max_level__ - min_level__; + height_ = max_level__ - min_level__; } template <typename I> inline std::size_t - height_<I>::to_result() const + height<I>::to_result() const { - return height__; + return height_; } template <typename I> inline void - height_<I>::set_value(std::size_t h) + height<I>::set_value(std::size_t h) { - height__ = h; + height_ = h; // Reset the other members. min_level__ = mln_max(value); max_level__ = mln_min(value); @@ -176,7 +176,7 @@ namespace mln template <typename I> inline bool - height_<I>::is_valid() const + height<I>::is_valid() const { return true; } diff --git a/milena/mln/accu/histo.hh b/milena/mln/accu/histo.hh index ddf3aec..6a653fb 100644 --- a/milena/mln/accu/histo.hh +++ b/milena/mln/accu/histo.hh @@ -106,7 +106,7 @@ namespace mln template <typename V> struct with { - typedef mln::accu::histo<V> ret; + typedef accu::histo<V> ret; }; }; diff --git a/milena/mln/accu/max_h.hh b/milena/mln/accu/max_h.hh index 6d861df..edf16a0 100644 --- a/milena/mln/accu/max_h.hh +++ b/milena/mln/accu/max_h.hh @@ -101,9 +101,7 @@ namespace mln namespace meta { - /*! - * \brief Meta accumulator for max. - */ + /// Meta accumulator for max. struct max_h : public Meta_Accumulator< max_h > { template <typename T> diff --git a/milena/mln/accu/mean.hh b/milena/mln/accu/mean.hh index 09fa92c..855bd65 100644 --- a/milena/mln/accu/mean.hh +++ b/milena/mln/accu/mean.hh @@ -58,17 +58,17 @@ namespace mln 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; - mean_(); + mean(); /// Manipulators. /// \{ void init(); void take(const argument& t); - void take(const mean_<T,S,M>& other); + void take(const mean<T,S,M>& other); /// \} /// Get the value of the accumulator. @@ -80,14 +80,14 @@ namespace mln protected: - accu::count_<T> count_; - accu::sum_<T,S> sum_; + accu::count<T> count_; + accu::sum<T,S> sum_; }; template <typename I, typename S, typename M> - struct mean_< util::pix<I>, S,M >; + struct mean< util::pix<I>, S,M >; namespace meta @@ -101,7 +101,7 @@ namespace mln typename M = S > struct with { - typedef mean_<T,S,M> ret; + typedef accu::mean<T,S,M> ret; }; }; @@ -112,7 +112,7 @@ namespace mln template <typename T, typename S, typename M> inline - mean_<T,S,M>::mean_() + mean<T,S,M>::mean() { init(); } @@ -120,7 +120,7 @@ namespace mln template <typename T, typename S, typename M> inline void - mean_<T,S,M>::init() + mean<T,S,M>::init() { count_.init(); sum_.init(); @@ -128,7 +128,7 @@ namespace mln template <typename T, typename S, typename M> inline - void mean_<T,S,M>::take(const argument& t) + void mean<T,S,M>::take(const argument& t) { count_.take(t); sum_.take(t); @@ -137,7 +137,7 @@ namespace mln template <typename T, typename S, typename M> inline void - mean_<T,S,M>::take(const mean_<T,S,M>& other) + mean<T,S,M>::take(const mean<T,S,M>& other) { count_.take(other.count_); sum_.take(other.sum_); @@ -146,7 +146,7 @@ namespace mln template <typename T, typename S, typename M> inline M - mean_<T,S,M>::to_result() const + mean<T,S,M>::to_result() const { return sum_.to_result() / count_.to_result(); } @@ -154,7 +154,7 @@ namespace mln template <typename T, typename S, typename M> inline bool - mean_<T,S,M>::is_valid() const + mean<T,S,M>::is_valid() const { return count_.to_result() != 0; } diff --git a/milena/mln/accu/median_alt.hh b/milena/mln/accu/median_alt.hh index d22206b..7434d06 100644 --- a/milena/mln/accu/median_alt.hh +++ b/milena/mln/accu/median_alt.hh @@ -96,6 +96,23 @@ namespace mln }; + namespace meta + { + + /// Meta accumulator for median_alt. + + struct median_alt : public Meta_Accumulator< median_alt > + { + template <typename V> + struct with + { + typedef accu::median_alt<V> ret; + }; + }; + + } // end of namespace mln::accu::meta + + template <typename T> struct median_alt_on : public median_alt< value::set<T> > { diff --git a/milena/mln/accu/median_h.hh b/milena/mln/accu/median_h.hh index de863f9..c3a0520 100644 --- a/milena/mln/accu/median_h.hh +++ b/milena/mln/accu/median_h.hh @@ -92,6 +92,24 @@ namespace mln }; + namespace meta + { + + /// Meta accumulator for median_h. + + struct median_h : public Meta_Accumulator< median_h > + { + template <typename V> + struct with + { + typedef accu::median_h<V> ret; + }; + }; + + } // end of namespace mln::accu::meta + + + # ifndef MLN_INCLUDE_ONLY template <typename V> diff --git a/milena/mln/accu/nil.hh b/milena/mln/accu/nil.hh index cc93ff3..0887715 100644 --- a/milena/mln/accu/nil.hh +++ b/milena/mln/accu/nil.hh @@ -51,18 +51,18 @@ namespace mln * \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; - nil_(); + nil(); /// Manipulators. /// \{ void init(); void take_as_init(const argument&); void take(const argument&); - void take(const nil_<T>&); + void take(const nil<T>&); /// \} /// Get the value of the accumulator. @@ -84,7 +84,7 @@ namespace mln template <typename V> struct with { - typedef nil_<V> ret; + typedef accu::nil<V> ret; }; }; @@ -95,42 +95,42 @@ namespace mln template <typename T> inline - nil_<T>::nil_() + nil<T>::nil() { } template <typename T> inline void - nil_<T>::init() + nil<T>::init() { } template <typename T> inline void - nil_<T>::take(const argument&) + nil<T>::take(const argument&) { } template <typename T> inline void - nil_<T>::take_as_init(const argument&) + nil<T>::take_as_init(const argument&) { } template <typename T> inline void - nil_<T>::take(const nil_<T>&) + nil<T>::take(const nil<T>&) { } template <typename T> inline util::ignore - nil_<T>::to_result() const + nil<T>::to_result() const { return util::ignore(); } @@ -138,7 +138,7 @@ namespace mln template <typename T> inline bool - nil_<T>::is_valid() const + nil<T>::is_valid() const { return true; } diff --git a/milena/mln/accu/p.hh b/milena/mln/accu/p.hh index 53bc001..bcb36c2 100644 --- a/milena/mln/accu/p.hh +++ b/milena/mln/accu/p.hh @@ -52,19 +52,19 @@ namespace mln * The parameter \c V is the type of values. */ template <typename A> - struct p_ : public mln::accu::internal::base< const mln_result(A)& , p_<A> > + struct p : public mln::accu::internal::base< const mln_result(A)& , p<A> > { typedef mln_argument(A) argument; - p_(); - p_(const A& a); + p(); + p(const A& a); /// Manipulators. /// \{ void init(); void take_as_init(const argument& t); void take(const argument& t); - void take(const p_<A>& other); + void take(const p<A>& other); /// \} /// Get the value of the accumulator. @@ -79,32 +79,36 @@ namespace mln }; - /*! - * \brief Meta accumulator for p. - */ - template <typename mA> - struct p : public Meta_Accumulator< p<mA> > + namespace meta { - template <typename V> - struct with + + /// Meta accumulator for p. + + template <typename mA> + struct p : public Meta_Accumulator< p<mA> > { - typedef mln_accu_with(mA, mln_psite(V)) ret; + template <typename V> + struct with + { + typedef p<V> ret; + }; }; - }; + + } // end of namespace mln::accu::meta # ifndef MLN_INCLUDE_ONLY template <typename A> inline - p_<A>::p_() + p<A>::p() { init(); } template <typename A> inline - p_<A>::p_(const A& a) + p<A>::p(const A& a) : a_(a) { init(); @@ -113,7 +117,7 @@ namespace mln template <typename A> inline void - p_<A>::init() + p<A>::init() { a_.init(); } @@ -121,7 +125,7 @@ namespace mln template <typename A> inline void - p_<A>::take_as_init(const argument& t) + p<A>::take_as_init(const argument& t) { a_.take_as_init(t.p()); // FIXME: Generalize with "psite(t)". } @@ -129,7 +133,7 @@ namespace mln template <typename A> inline void - p_<A>::take(const argument& t) + p<A>::take(const argument& t) { a_.take(t.p()); } @@ -137,7 +141,7 @@ namespace mln template <typename A> inline void - p_<A>::take(const p_<A>& other) + p<A>::take(const p<A>& other) { a_.take(other.a_); } @@ -145,7 +149,7 @@ namespace mln template <typename A> inline const mln_result(A)& - p_<A>::to_result() const + p<A>::to_result() const { return a_.to_result(); } @@ -153,7 +157,7 @@ namespace mln template <typename A> inline bool - p_<A>::is_valid() const + p<A>::is_valid() const { return a_.is_valid(); } diff --git a/milena/mln/accu/rank.hh b/milena/mln/accu/rank.hh index 005d934..c29a56e 100644 --- a/milena/mln/accu/rank.hh +++ b/milena/mln/accu/rank.hh @@ -53,18 +53,18 @@ namespace mln * The parameter \c T is the type of values. */ template <typename T> - struct rank_ : public mln::accu::internal::base< const T&, rank_<T> > + struct rank : public mln::accu::internal::base< const T&, rank<T> > { typedef T argument; typedef mln::value::set<T> S; - rank_(unsigned k, unsigned n); + rank(unsigned k, unsigned n); /// Manipulators. /// \{ void init(); void take(const argument& t); - void take(const rank_<T>& other); + void take(const rank<T>& other); void untake(const argument& t); /// \} @@ -98,7 +98,7 @@ namespace mln }; - template <typename I> struct rank_< util::pix<I> >; + template <typename I> struct rank< util::pix<I> >; namespace meta @@ -111,7 +111,7 @@ namespace mln template <typename T> struct with { - typedef rank_<T> ret; + typedef accu::rank<T> ret; }; }; @@ -124,7 +124,7 @@ namespace mln template <typename T> inline - rank_<T>::rank_(unsigned k, unsigned n) + rank<T>::rank(unsigned k, unsigned n) : k_(k), n_(n), h_(), @@ -138,7 +138,7 @@ namespace mln template <typename T> inline - void rank_<T>::take(const argument& t) + void rank<T>::take(const argument& t) { h_.take(t); @@ -154,7 +154,7 @@ namespace mln template <typename T> inline void - rank_<T>::take(const rank_<T>& other) + rank<T>::take(const rank<T>& other) { // h_ h_.take(other.h_); @@ -175,7 +175,7 @@ namespace mln template <typename T> inline void - rank_<T>::untake(const argument& t) + rank<T>::untake(const argument& t) { mln_precondition(h_(t) != 0); h_.untake(t); @@ -192,7 +192,7 @@ namespace mln template <typename T> inline void - rank_<T>::update_() const + rank<T>::update_() const { valid_ = true; @@ -218,7 +218,7 @@ namespace mln template <typename T> inline void - rank_<T>::go_minus_() const + rank<T>::go_minus_() const { do { @@ -235,7 +235,7 @@ namespace mln template <typename T> inline void - rank_<T>::go_plus_() const + rank<T>::go_plus_() const { do { @@ -252,7 +252,7 @@ namespace mln template <typename T> inline void - rank_<T>::init() + rank<T>::init() { h_.init(); sum_minus_ = 0; @@ -266,7 +266,7 @@ namespace mln template <typename T> inline const T& - rank_<T>::to_result() const + rank<T>::to_result() const { if (! valid_) update_(); @@ -276,7 +276,7 @@ namespace mln template <typename T> inline bool - rank_<T>::is_valid() const + rank<T>::is_valid() const { return valid_; } diff --git a/milena/mln/accu/rank_bool.hh b/milena/mln/accu/rank_bool.hh index a60ff7e..879f0d1 100644 --- a/milena/mln/accu/rank_bool.hh +++ b/milena/mln/accu/rank_bool.hh @@ -28,7 +28,7 @@ #ifndef MLN_ACCU_RANK_BOOL_HH # define MLN_ACCU_RANK_BOOL_HH -/*! \file mln/accu/rank_bool.hh +/*! \file mln/accu/rankbool.hh * * \brief Define an rank accumulator. */ @@ -47,24 +47,24 @@ namespace mln { // Fwd declaration. - template <typename T> struct rank_; + template <typename T> struct rank; /*! \brief rank accumulator class for boolean. * */ 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; - rank_(unsigned k, unsigned n); + rank(unsigned k, unsigned n); /// Manipulators. /// \{ void init(); void take_as_init(const argument& t); void take(const argument& t); - void take(const rank_<bool>& other); + void take(const rank<bool>& other); /// \} /// Get the value of the accumulator. @@ -84,7 +84,7 @@ namespace mln # ifndef MLN_INCLUDE_ONLY inline - rank_<bool>::rank_(unsigned k, unsigned n) + rank<bool>::rank(unsigned k, unsigned n) : nfalse_(0), k_(k), n_(n) @@ -96,21 +96,21 @@ namespace mln inline void - rank_<bool>::init() + rank<bool>::init() { nfalse_ = 0; } inline - void rank_<bool>::take_as_init(const argument& t) + void rank<bool>::take_as_init(const argument& t) { nfalse_ += !t; } inline - void rank_<bool>::take(const argument& t) + void rank<bool>::take(const argument& t) { nfalse_ += !t; } @@ -118,7 +118,7 @@ namespace mln inline void - rank_<bool>::take(const rank_<bool>& other) + rank<bool>::take(const rank<bool>& other) { nfalse_ += other.nfalse_; } @@ -126,7 +126,7 @@ namespace mln inline bool - rank_<bool>::to_result() const + rank<bool>::to_result() const { mln_assertion(nfalse_ <= n_); return k_ >= nfalse_; @@ -134,7 +134,7 @@ namespace mln inline bool - rank_<bool>::is_valid() const + rank<bool>::is_valid() const { return nfalse_ <= n_; } diff --git a/milena/mln/accu/rank_high_quant.hh b/milena/mln/accu/rank_high_quant.hh index 95c56ec..b4d69a1 100644 --- a/milena/mln/accu/rank_high_quant.hh +++ b/milena/mln/accu/rank_high_quant.hh @@ -52,18 +52,18 @@ namespace mln * The parameter \c T is the type of values. */ template <typename T> - struct rank_ : public mln::accu::internal::base< const T&, rank_<T> > + struct rank : public mln::accu::internal::base< const T&, rank<T> > { typedef T argument; - rank_(unsigned k, unsigned n); + rank(unsigned k, unsigned n); /// Manipulators. /// \{ void init(); void take_as_init(const argument& t); void take(const argument& t); - void take(const rank_<T>& other); + void take(const rank<T>& other); void sort(); /// \} @@ -83,7 +83,7 @@ namespace mln }; - template <typename I> struct rank_< util::pix<I> >; + template <typename I> struct rank< util::pix<I> >; namespace meta @@ -96,7 +96,7 @@ namespace mln template <typename T> struct with { - typedef rank_<T> ret; + typedef accu::rank<T> ret; }; }; @@ -107,7 +107,7 @@ namespace mln template <typename T> inline - rank_<T>::rank_(unsigned k, unsigned n) + rank<T>::rank(unsigned k, unsigned n) : k_(k), n_(n), is_sorted_(false) @@ -119,14 +119,14 @@ namespace mln template <typename T> inline void - rank_<T>::init() + rank<T>::init() { elts_.clear(); } template <typename T> inline - void rank_<T>::take_as_init(const argument& t) + void rank<T>::take_as_init(const argument& t) { elts_.push_back(t); is_sorted_ = false; @@ -134,7 +134,7 @@ namespace mln template <typename T> inline - void rank_<T>::take(const argument& t) + void rank<T>::take(const argument& t) { elts_.push_back(t); is_sorted_ = false; @@ -143,7 +143,7 @@ namespace mln template <typename T> inline void - rank_<T>::take(const rank_<T>& other) + rank<T>::take(const rank<T>& other) { elts_.insert(elts_.end(), other.elts_.begin(), @@ -154,9 +154,9 @@ namespace mln template <typename T> inline const T& - rank_<T>::to_result() const + rank<T>::to_result() const { - const_cast<rank_<T>&>(*this).sort(); + const_cast<rank<T>&>(*this).sort(); if (n_ == elts_.size()) return elts_[k_]; @@ -168,7 +168,7 @@ namespace mln template <typename T> inline bool - rank_<T>::is_valid() const + rank<T>::is_valid() const { return true; } @@ -176,7 +176,7 @@ namespace mln template <typename T> inline void - rank_<T>::sort() + rank<T>::sort() { if (! is_sorted_) { @@ -191,6 +191,6 @@ namespace mln } // end of namespace mln -#include <mln/accu/rank_bool.hh> +#include <mln/accu/rankbool.hh> #endif // ! MLN_ACCU_RANK_HH diff --git a/milena/mln/accu/sum.hh b/milena/mln/accu/sum.hh index 484def9..fcfc3ba 100644 --- a/milena/mln/accu/sum.hh +++ b/milena/mln/accu/sum.hh @@ -57,17 +57,17 @@ 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< const S&, sum_<T,S> > + struct sum : public mln::accu::internal::base< const S&, sum<T,S> > { typedef T argument; - sum_(); + sum(); /// Manipulators. /// \{ void init(); void take(const argument& t); - void take(const sum_<T,S>& other); + void take(const sum<T,S>& other); /// \} /// Get the value of the accumulator. @@ -84,7 +84,7 @@ namespace mln template <typename I, typename S> - struct sum_< util::pix<I>, S >; + struct sum< util::pix<I>, S >; namespace meta { @@ -95,7 +95,7 @@ namespace mln template <typename T, typename S = mln_sum(T)> struct with { - typedef sum_<T, S> ret; + typedef accu::sum<T, S> ret; }; }; @@ -106,7 +106,7 @@ namespace mln template <typename T, typename S> inline - sum_<T,S>::sum_() + sum<T,S>::sum() { init(); } @@ -114,14 +114,14 @@ namespace mln template <typename T, typename S> inline void - sum_<T,S>::init() + sum<T,S>::init() { s_ = literal::zero; } template <typename T, typename S> inline - void sum_<T,S>::take(const argument& t) + void sum<T,S>::take(const argument& t) { s_ += t; } @@ -129,7 +129,7 @@ namespace mln template <typename T, typename S> inline void - sum_<T,S>::take(const sum_<T,S>& other) + sum<T,S>::take(const sum<T,S>& other) { s_ += other.s_; } @@ -137,7 +137,7 @@ namespace mln template <typename T, typename S> inline const S& - sum_<T,S>::to_result() const + sum<T,S>::to_result() const { return s_; } @@ -145,7 +145,7 @@ namespace mln template <typename T, typename S> inline bool - sum_<T,S>::is_valid() const + sum<T,S>::is_valid() const { return true; } diff --git a/milena/mln/accu/tuple.hh b/milena/mln/accu/tuple.hh index 00300e2..f70882b 100644 --- a/milena/mln/accu/tuple.hh +++ b/milena/mln/accu/tuple.hh @@ -47,7 +47,7 @@ # include "boost/preprocessor/repetition/enum_params.hpp" # include "boost/preprocessor/repetition/enum_params_with_a_default.hpp" -# define RESULT_ACCU(z, n, data) BOOST_PP_COMMA_IF(n) typename internal::tuple_helper_<T ## n>::result +# define RESULT_ACCU(z, n, data) BOOST_PP_COMMA_IF(n) typename internal::tuplehelper_<T ## n>::result # define ARG(z, n, data) BOOST_PP_COMMA_IF(n) const T ## n& p ## n = T ## n() # define BOOST_PP_LOCAL_MACRO(n) typedef mln_accu_with(T ## n, A) AT ## n; # define BOOST_PP_LOCAL_LIMITS (0, 9) @@ -61,8 +61,8 @@ namespace mln namespace internal { // Fwd decl. - template <typename T> struct tuple_helper_; - template <unsigned n, typename T> struct tuple_helper; + template <typename T> struct tuplehelper_; + template <unsigned n, typename T> struct tuplehelper; } /*! \brief Generic tuple of accumulators. @@ -71,23 +71,23 @@ 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)> > + 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)> > { typedef A argument; 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; + typedef tuple<A, n, BOOST_PP_ENUM_PARAMS(10, T)> self; - tuple_(); + tuple(); /// Manipulators. /// \{ void init(); void take_as_init(const argument& t); void take(const argument& t); - void take(const tuple_<A, n, BOOST_PP_ENUM_PARAMS(10, T)>& other); + void take(const tuple<A, n, BOOST_PP_ENUM_PARAMS(10, T)>& other); /// \} /// Get the value of the accumulator. @@ -115,7 +115,7 @@ namespace mln { # include BOOST_PP_LOCAL_ITERATE() - typedef tuple_<A, n, BOOST_PP_ENUM_PARAMS(10, AT)> ret; + typedef accu::tuple<A, n, BOOST_PP_ENUM_PARAMS(10, AT)> ret; }; }; @@ -128,53 +128,53 @@ namespace mln { template <typename T> - struct tuple_helper_ + struct tuplehelper_ { typedef typename T::result result; }; template <> - struct tuple_helper_<boost::tuples::null_type> + struct tuplehelper_<boost::tuples::null_type> { typedef boost::tuples::null_type result; }; template <unsigned n, typename T> - struct tuple_helper + struct tuplehelper { static void init(typename T::intern& a) { boost::get<n - 1>(a).init(); - tuple_helper<n - 1, T>::init(a); + tuplehelper<n - 1, T>::init(a); } static void take_as_init(typename T::intern& a, const typename T::argument& argument) { boost::get<n - 1>(a).take_as_init(argument); - tuple_helper<n - 1, T>::take_as_init(a, argument); + tuplehelper<n - 1, T>::take_as_init(a, argument); } static void take(typename T::intern& a, const typename T::argument& argument) { boost::get<n - 1>(a).take(argument); - tuple_helper<n - 1, T>::take(a, argument); + tuplehelper<n - 1, T>::take(a, argument); } static void take(typename T::intern& a, const typename T::intern& other) { boost::get<n - 1>(a).take(boost::get<n - 1>(other)); - tuple_helper<n - 1, T>::take(a, other); + tuplehelper<n - 1, T>::take(a, other); } static void to_result(const typename T::intern& a, typename T::result& res) { boost::get<n - 1>(res) = boost::get<n - 1>(a).to_result(); - tuple_helper<n - 1, T>::to_result(a, res); + tuplehelper<n - 1, T>::to_result(a, res); } }; template <typename T> - struct tuple_helper<0, T> + struct tuplehelper<0, T> { static void init(typename T::intern&) {} static void take_as_init(typename T::intern&, const typename T::argument&) {} @@ -186,7 +186,7 @@ namespace mln template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)> inline - tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::tuple_() + tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::tuple() { init(); } @@ -194,49 +194,49 @@ namespace mln template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)> inline void - tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::init() + tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::init() { - internal::tuple_helper<n, self>::init(this->a_); + internal::tuplehelper<n, self>::init(this->a_); } template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)> inline void - tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::take_as_init(const argument& t) + tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::take_as_init(const argument& t) { - internal::tuple_helper<n, self>::take_as_init(this->a_, t); + internal::tuplehelper<n, self>::take_as_init(this->a_, t); } template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)> inline void - tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::take(const argument& t) + tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::take(const argument& t) { - internal::tuple_helper<n, self>::take(this->a_, t); + internal::tuplehelper<n, self>::take(this->a_, t); } template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)> inline void - tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::take(const tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >& other) + tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::take(const tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >& other) { - internal::tuple_helper<n, self>::take(this->a_, other.a_); + internal::tuplehelper<n, self>::take(this->a_, other.a_); } template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)> inline - typename tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::res - tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::to_result() const + typename tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::res + tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::to_result() const { res tmp; - internal::tuple_helper<n, self>::to_result(this->a_, tmp); + internal::tuplehelper<n, self>::to_result(this->a_, tmp); return tmp; } template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)> inline bool - tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::is_valid() const + tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::is_valid() const { return true; } diff --git a/milena/mln/accu/v.hh b/milena/mln/accu/v.hh index af00fe2..a7f4cdf 100644 --- a/milena/mln/accu/v.hh +++ b/milena/mln/accu/v.hh @@ -49,19 +49,19 @@ namespace mln /// Generic val of accumulators. template <typename A> - struct val_ : public mln::accu::internal::base< const mln_result(A)& , val_<A> > + struct val : public mln::accu::internal::base< const mln_result(A)& , val<A> > { typedef mln_argument(A) argument; - val_(); - val_(const A& a); + val(); + val(const A& a); /// Manipulators. /// \{ void init(); void take_as_init(const argument& t); void take(const argument& t); - void take(const val_<A>& other); + void take(const val<A>& other); template <typename I> void take_as_init(const util::pix<I>& pix); template <typename I> @@ -92,7 +92,7 @@ namespace mln struct with { typedef mln_accu_with(mA, mln_value(V)) A; - typedef val_<A> ret; + typedef val<A> ret; }; }; @@ -102,14 +102,14 @@ namespace mln template <typename A> inline - val_<A>::val_() + val<A>::val() { init(); } template <typename A> inline - val_<A>::val_(const A& a) + val<A>::val(const A& a) : a_(a) { init(); @@ -118,7 +118,7 @@ namespace mln template <typename A> inline void - val_<A>::init() + val<A>::init() { a_.init(); } @@ -126,7 +126,7 @@ namespace mln template <typename A> inline void - val_<A>::take_as_init(const argument& t) + val<A>::take_as_init(const argument& t) { a_.take_as_init(t); } @@ -134,7 +134,7 @@ namespace mln template <typename A> inline void - val_<A>::take(const argument& t) + val<A>::take(const argument& t) { a_.take(t); } @@ -142,7 +142,7 @@ namespace mln template <typename A> inline void - val_<A>::take(const val_<A>& other) + val<A>::take(const val<A>& other) { a_.take(other.a_); } @@ -151,7 +151,7 @@ namespace mln template <typename I> inline void - val_<A>::take_as_init(const util::pix<I>& pix) + val<A>::take_as_init(const util::pix<I>& pix) { a_.take_as_init(pix.v()); // FIXME: Generalize with "value(pix)". } @@ -160,7 +160,7 @@ namespace mln template <typename I> inline void - val_<A>::take(const util::pix<I>& pix) + val<A>::take(const util::pix<I>& pix) { a_.take(pix.v()); } @@ -168,7 +168,7 @@ namespace mln template <typename A> inline const mln_result(A)& - val_<A>::to_result() const + val<A>::to_result() const { return a_.to_result(); } @@ -176,7 +176,7 @@ namespace mln template <typename A> inline bool - val_<A>::is_valid() const + val<A>::is_valid() const { return a_.is_valid(); } diff --git a/milena/mln/accu/volume.hh b/milena/mln/accu/volume.hh index aed5a51..299a09d 100644 --- a/milena/mln/accu/volume.hh +++ b/milena/mln/accu/volume.hh @@ -35,7 +35,7 @@ This accumulator uses an mln::util::pix (pixel) to update the reference level, area and volume information of the component. - The class mln/accu/volume_ is not a general-purpose accumulator; + The class mln/accu/volume is not a general-purpose accumulator; it is used to implement volume-based connected filters. \see mln::morpho::closing_volume \see mln::morpho::opening_volume */ @@ -57,8 +57,8 @@ namespace mln /// The parameter \p I is the image type on which the accumulator /// of pixels is built. template <typename I> - struct volume_ - : public mln::accu::internal::base< std::size_t , volume_<I> > + struct volume + : public mln::accu::internal::base< std::size_t , volume<I> > { /// \brief The accumulated data type. /// @@ -70,13 +70,13 @@ namespace mln /// The value type associated to the pixel type. typedef typename argument::value value; - volume_(); + volume(); /// Manipulators. /// \{ void init(); void take(const argument& pixel); - void take(const volume_<I>& other); + void take(const volume<I>& other); /// Force the value of the counter to \a v. void set_value(std::size_t v); @@ -95,7 +95,7 @@ namespace mln /// The area of the component. std::size_t area__; /// The volume of the component. - std::size_t volume__; + std::size_t volume_; }; @@ -107,10 +107,10 @@ namespace mln struct volume : public Meta_Accumulator< volume > { template <typename I> - struct with - { - typedef volume_<I> ret; - }; + struct with + { + typedef accu::volume<I> ret; + }; }; } // end of namespace mln::accu::meta @@ -120,7 +120,7 @@ namespace mln template <typename I> inline - volume_<I>::volume_() + volume<I>::volume() { init(); } @@ -128,17 +128,17 @@ namespace mln template <typename I> inline void - volume_<I>::init() + volume<I>::init() { ref_level__ = literal::zero; - volume__ = 0; + volume_ = 0; area__ = 0; } template <typename I> inline void - volume_<I>::take(const argument& pixel) + volume<I>::take(const argument& pixel) { /* FIXME: Growing a component using this particular `take' routine won't work, since the update does not take care of @@ -148,27 +148,27 @@ namespace mln 1. the empty accumulator case (which corresponds to the following code); 2. the non-empty accumulator case (which sohuld act as in - `take(const volume_<I>& other)'). + `take(const volume<I>& other)'). Currently, the implementation is only valid if the accumulator was initialy empty before the call to `take(const argument&)'. */ ref_level__ = pixel.v(); ++area__; - ++volume__; + ++volume_; } template <typename I> inline void - volume_<I>::take(const volume_<I>& other) + volume<I>::take(const volume<I>& other) { area__ += other.area__; /* FIXME: Is it `t.area__' or `area__' ? Théo said it was the latter, but both the ISMM 2005 paper and Olena 0.11 use the former. */ - volume__ += - other.volume__ + + volume_ += + other.volume_ + other.area__ * math::abs(other.ref_level__ - ref_level__); // Member ref_level__ is not touched. } @@ -176,17 +176,17 @@ namespace mln template <typename I> inline std::size_t - volume_<I>::to_result() const + volume<I>::to_result() const { - return volume__; + return volume_; } template <typename I> inline void - volume_<I>::set_value(std::size_t v) + volume<I>::set_value(std::size_t v) { - volume__ = v; + volume_ = v; // Reset the other members. ref_level__ = literal::zero; area__ = 0; @@ -195,7 +195,7 @@ namespace mln template <typename I> inline bool - volume_<I>::is_valid() const + volume<I>::is_valid() const { return true; } diff --git a/milena/mln/canvas/morpho/algebraic_union_find.hh b/milena/mln/canvas/morpho/algebraic_union_find.hh index 33528df..b61616d 100644 --- a/milena/mln/canvas/morpho/algebraic_union_find.hh +++ b/milena/mln/canvas/morpho/algebraic_union_find.hh @@ -121,7 +121,7 @@ namespace mln { parent(p) = p; /* FIXME: What if the value_type of DATA (i.e., A) were not - based on a accu::count_<mln::pix>? Currently, nothing + based on a accu::count<mln::pix>? Currently, nothing enforces this, but the code below expects this line to be valid: @@ -138,7 +138,7 @@ namespace mln be passed as an argument to the canvas' ctor. Of course, we might want to restrict attributes to the - accumulator accu::count_<mln::pix> (which is perfectly + accumulator accu::count<mln::pix> (which is perfectly acceptable), but then this class should statically check the conformance of the template parameter A to this constraint. */ diff --git a/milena/mln/estim/mean.hh b/milena/mln/estim/mean.hh index 46fb4ed..0c6fbdb 100644 --- a/milena/mln/estim/mean.hh +++ b/milena/mln/estim/mean.hh @@ -79,7 +79,7 @@ namespace mln void mean(const Image<I>& input, M& result) { mln_precondition(exact(input).has_data()); - accu::mean_<mln_value(I), S, M> a; + accu::mean<mln_value(I), S, M> a; result = level::compute(a, input); } diff --git a/milena/mln/estim/sum.hh b/milena/mln/estim/sum.hh index 96ff335..2defc4f 100644 --- a/milena/mln/estim/sum.hh +++ b/milena/mln/estim/sum.hh @@ -78,7 +78,7 @@ namespace mln void sum(const Image<I>& input, S& result) { mln_precondition(exact(input).has_data()); - accu::sum_<mln_value(I), S> a; + accu::sum<mln_value(I), S> a; result = level::compute(a, input); } diff --git a/milena/mln/make/voronoi.hh b/milena/mln/make/voronoi.hh index 2cf7a37..3f1bbe0 100644 --- a/milena/mln/make/voronoi.hh +++ b/milena/mln/make/voronoi.hh @@ -83,7 +83,7 @@ namespace mln estim::min_max (ima, min, max); unsigned nb = max - min + 1; std::vector<P> v(nb); - std::vector< accu::mean_< X > > tab_mean (nb); + std::vector< accu::mean< X > > tab_mean (nb); std::map<std::pair<V, V>, bool> m; /// Take original point. diff --git a/milena/mln/morpho/closing_area.hh b/milena/mln/morpho/closing_area.hh index 5512d83..bccee58 100644 --- a/milena/mln/morpho/closing_area.hh +++ b/milena/mln/morpho/closing_area.hh @@ -63,7 +63,7 @@ namespace mln mln_precondition(exact(output).domain() == exact(input).domain()); typedef util::pix<I> pix_t; // FIXME: Change sig of closing_attribute! - closing_attribute< accu::count_<pix_t> >(input, nbh, lambda, output); + closing_attribute< accu::count<pix_t> >(input, nbh, lambda, output); } template <typename I, typename N> diff --git a/milena/mln/morpho/closing_area_on_vertices.hh b/milena/mln/morpho/closing_area_on_vertices.hh index 51fc4cb..7ac3f7a 100644 --- a/milena/mln/morpho/closing_area_on_vertices.hh +++ b/milena/mln/morpho/closing_area_on_vertices.hh @@ -61,7 +61,7 @@ namespace mln std::size_t lambda, Image<O>& output) { mln_precondition(exact(output).domain() == exact(input).domain()); - typedef accu::count_adjacent_vertices_<P, V> attribute_t; + typedef accu::count_adjacent_vertices<P, V> attribute_t; // FIXME: Change sig of closing_attribute! closing_attribute<attribute_t>(input, nbh, lambda, output); } diff --git a/milena/mln/morpho/closing_height.hh b/milena/mln/morpho/closing_height.hh index 400f815..72b856b 100644 --- a/milena/mln/morpho/closing_height.hh +++ b/milena/mln/morpho/closing_height.hh @@ -56,7 +56,7 @@ namespace mln { mln_precondition(exact(output).domain() == exact(input).domain()); // FIXME: Change sig of closing_attribute! - closing_attribute< accu::height_<I> >(input, nbh, lambda, output); + closing_attribute< accu::height<I> >(input, nbh, lambda, output); } # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/mln/morpho/closing_volume.hh b/milena/mln/morpho/closing_volume.hh index 1845864..bf5c608 100644 --- a/milena/mln/morpho/closing_volume.hh +++ b/milena/mln/morpho/closing_volume.hh @@ -56,7 +56,7 @@ namespace mln { mln_precondition(exact(output).domain() == exact(input).domain()); // FIXME: Change sig of closing_attribute! - closing_attribute< accu::volume_<I> >(input, nbh, lambda, output); + closing_attribute< accu::volume<I> >(input, nbh, lambda, output); } # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/mln/morpho/erosion.spe.hh b/milena/mln/morpho/erosion.spe.hh index 30e671a..ec125e4 100644 --- a/milena/mln/morpho/erosion.spe.hh +++ b/milena/mln/morpho/erosion.spe.hh @@ -103,7 +103,7 @@ namespace mln const W& win = exact(win_); // FIXME: border::adjust(input, win.delta()); - extension::fill(input, mln_max(mln_value(I))); + extension::fill(input, mln_max(mln_value(I))); O output; initialize(output, input); @@ -136,7 +136,7 @@ namespace mln const W& win = exact(win_); // FIXME: border::adjust(input, win.delta()); - extension::fill(input, true); + extension::fill(input, true); O output; initialize(output, input); @@ -169,7 +169,7 @@ namespace mln const W& win = exact(win_); // FIXME: border::adjust(input, win.delta()); - extension::fill(input, true); + extension::fill(input, true); O output; output = clone(input); @@ -200,7 +200,7 @@ namespace mln const W& win = exact(win_); // FIXME: border::adjust(input, win.delta()); - extension::fill(input, true); + extension::fill(input, true); O output; output = clone(input); @@ -251,7 +251,7 @@ namespace mln p, len, win_half_length, output); - + for (int c = dim - 1; c >= 0; --c) { if (c == int(Dir)) @@ -358,7 +358,7 @@ namespace mln win_left_bkd(win::shift(win_left_fwd, mln::right)), win_right_bkd(win::shift(win_right_fwd, mln::right)), - win_bot_up(win::shift(win, mln::down) - win), + win_bot_up(win::shift(win, mln::down) - win), win_top_up(win - win::shift(win, mln::down)), win_bot_down(win::shift(win_bot_up, mln::up)), win_top_down(win::shift(win_top_up, mln::up)), @@ -461,7 +461,7 @@ namespace mln typedef erosion_arbitrary_2d_fastest_functor<I, W> F; F f(exact(input), exact(win)); - canvas::browsing::snake_generic(f); + canvas::browsing::snake_generic(f); trace::exiting("morpho::impl:erosion_arbitrary_2d_fastest"); @@ -516,7 +516,7 @@ namespace mln win_left_bkd(win::shift(win_left_fwd, mln::right)), win_right_bkd(win::shift(win_right_fwd, mln::right)), - win_bot_up(win::shift(win, mln::down) - win), + win_bot_up(win::shift(win, mln::down) - win), win_top_up(win - win::shift(win, mln::down)), win_bot_down(win::shift(win_bot_up, mln::up)), win_top_down(win::shift(win_top_up, mln::up)), diff --git a/milena/mln/morpho/opening_area.hh b/milena/mln/morpho/opening_area.hh index 580b3f8..5e6e280 100644 --- a/milena/mln/morpho/opening_area.hh +++ b/milena/mln/morpho/opening_area.hh @@ -59,7 +59,7 @@ namespace mln mln_precondition(exact(output).domain() == exact(input).domain()); typedef util::pix<I> pix_t; // FIXME: Change sig of opening_attribute! - opening_attribute< accu::count_<pix_t> >(input, nbh, lambda, output); + opening_attribute< accu::count<pix_t> >(input, nbh, lambda, output); } # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/mln/morpho/opening_area_on_vertices.hh b/milena/mln/morpho/opening_area_on_vertices.hh index 1c98024..b5c9c04 100644 --- a/milena/mln/morpho/opening_area_on_vertices.hh +++ b/milena/mln/morpho/opening_area_on_vertices.hh @@ -60,7 +60,7 @@ namespace mln std::size_t lambda, Image<O>& output) { mln_precondition(exact(output).domain() == exact(input).domain()); - typedef accu::count_adjacent_vertices_<P, V> attribute_t; + typedef accu::count_adjacent_vertices<P, V> attribute_t; // FIXME: Change sig of opening_attribute! opening_attribute<attribute_t>(input, nbh, lambda, output); } diff --git a/milena/mln/morpho/opening_height.hh b/milena/mln/morpho/opening_height.hh index f5c1fe1..bbd9d6c 100644 --- a/milena/mln/morpho/opening_height.hh +++ b/milena/mln/morpho/opening_height.hh @@ -56,7 +56,7 @@ namespace mln { mln_precondition(exact(output).domain() == exact(input).domain()); // FIXME: Change sig of opening_attribute! - opening_attribute< accu::height_<I> >(input, nbh, lambda, output); + opening_attribute< accu::height<I> >(input, nbh, lambda, output); } # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/mln/morpho/opening_volume.hh b/milena/mln/morpho/opening_volume.hh index 2845ca6..def2c5d 100644 --- a/milena/mln/morpho/opening_volume.hh +++ b/milena/mln/morpho/opening_volume.hh @@ -56,7 +56,7 @@ namespace mln { mln_precondition(exact(output).domain() == exact(input).domain()); // FIXME: Change sig of opening_attribute! - opening_attribute< accu::volume_<I> >(input, nbh, lambda, output); + opening_attribute< accu::volume<I> >(input, nbh, lambda, output); } # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/mln/morpho/rank_filter.hh b/milena/mln/morpho/rank_filter.hh index 7cf24b3..94a0a27 100644 --- a/milena/mln/morpho/rank_filter.hh +++ b/milena/mln/morpho/rank_filter.hh @@ -69,7 +69,7 @@ namespace mln mln_concrete(I) output; initialize(output, input); - accu::rank_<mln_value(I)> accu(k, convert::to_p_array(win, mln_psite(I)()).nsites()); + accu::rank<mln_value(I)> accu(k, convert::to_p_array(win, mln_psite(I)()).nsites()); mln_piter(I) p(input.domain()); mln_qiter(W) q(win, p); for_all(p) diff --git a/milena/tests/accu/all_accus.cc b/milena/tests/accu/all_accus.cc index 394d750..6cd29fa 100644 --- a/milena/tests/accu/all_accus.cc +++ b/milena/tests/accu/all_accus.cc @@ -39,16 +39,16 @@ int main() using namespace mln::accu; bbox<point2d> b; - count_<int> c; + count<int> c; mln::accu::histo<bool> h; - max_<int> ma; - mean_<int> me; + max<int> ma; + mean<int> me; // median< value::set<bool> > med; // FIXME: bool has no min so workaround! - min_<int> mi; + min<int> mi; // min_h< value::set<bool> > mh; // OK: do not work since bool has // no min/max :) - min_max_<int> mm; - nil_<int> n; - pair_< min_<int>, max_<int> > p; - sum_<int> s; + min_max<int> mm; + nil<int> n; + pair< min<int>, max<int> > p; + sum<int> s; } diff --git a/milena/tests/accu/count.cc b/milena/tests/accu/count.cc index 832c02b..bdf9ffe 100644 --- a/milena/tests/accu/count.cc +++ b/milena/tests/accu/count.cc @@ -40,12 +40,12 @@ int main() using namespace mln; { - accu::count_<value::int_u8> accu; + accu::count<value::int_u8> accu; mln_assertion(accu.to_result() == 0); } { - accu::count_<value::int_u8> accu; + accu::count<value::int_u8> accu; for (int i = 0; i < 200; i++) accu.take(i); mln_assertion(accu.to_result() == 200); diff --git a/milena/tests/accu/nil.cc b/milena/tests/accu/nil.cc index f2421ff..15afbf0 100644 --- a/milena/tests/accu/nil.cc +++ b/milena/tests/accu/nil.cc @@ -42,7 +42,7 @@ int main() using namespace mln; image2d<value::int_u8> ima(3, 3); - accu::nil_<value::int_u8> a; + accu::nil<value::int_u8> a; level::compute(a, ima); level::compute(accu::meta::nil(), ima); diff --git a/milena/tests/accu/pair.cc b/milena/tests/accu/pair.cc index 6927334..2d57ed7 100644 --- a/milena/tests/accu/pair.cc +++ b/milena/tests/accu/pair.cc @@ -42,7 +42,7 @@ int main() using namespace mln; { - accu::pair<accu::mean_<int>, accu::max<int> > mean; + accu::pair<accu::mean<int>, accu::max<int> > mean; mean.take(10); mean.take(9); diff --git a/milena/tests/accu/rank.cc b/milena/tests/accu/rank.cc index 7a7fbea..0037d06 100644 --- a/milena/tests/accu/rank.cc +++ b/milena/tests/accu/rank.cc @@ -52,47 +52,47 @@ void fill(Accumulator<A>& accu_) int main() { { - accu::rank_<value::int_u8> accu(0, 8); + accu::rank<value::int_u8> accu(0, 8); fill(accu); mln_assertion(accu.to_result() == 1u); } { - accu::rank_<value::int_u8> accu(1, 8); + accu::rank<value::int_u8> accu(1, 8); fill(accu); mln_assertion(accu.to_result() == 2u); } { - accu::rank_<value::int_u8> accu(2, 8); + accu::rank<value::int_u8> accu(2, 8); fill(accu); mln_assertion(accu.to_result() == 2u); } { - accu::rank_<value::int_u8> accu(3, 8); + accu::rank<value::int_u8> accu(3, 8); fill(accu); mln_assertion(accu.to_result() == 3u); } { - accu::rank_<value::int_u8> accu(4, 8); + accu::rank<value::int_u8> accu(4, 8); fill(accu); mln_assertion(accu.to_result() == 4u); } { - accu::rank_<value::int_u8> accu(5, 8); + accu::rank<value::int_u8> accu(5, 8); fill(accu); mln_assertion(accu.to_result() == 5u); } { - accu::rank_<value::int_u8> accu(6, 8); + accu::rank<value::int_u8> accu(6, 8); fill(accu); mln_assertion(accu.to_result() == 5u); } { - accu::rank_<value::int_u8> accu(7, 8); + accu::rank<value::int_u8> accu(7, 8); fill(accu); mln_assertion(accu.to_result() == 5u); } { - accu::rank_<bool> accu_bool(1, 5); + accu::rank<bool> accu_bool(1, 5); accu_bool.take(true); accu_bool.take(true); accu_bool.take(true); diff --git a/milena/tests/accu/tuple.cc b/milena/tests/accu/tuple.cc index 1b65caa..a83fabb 100644 --- a/milena/tests/accu/tuple.cc +++ b/milena/tests/accu/tuple.cc @@ -46,9 +46,9 @@ int main() { using namespace mln; - typedef accu::tuple_<int, 4, accu::count_<int>, accu::max<int>, accu::min<int>, accu::mean_<int> > teratuple; + typedef accu::tuple<int, 4, accu::count<int>, accu::max<int>, accu::min<int>, accu::mean<int> > teratuple; - teratuple tuple1; + teratuple tuple1; teratuple tuple2; int i1 = 7; diff --git a/milena/tests/labeling/compute.cc b/milena/tests/labeling/compute.cc index cd36ae3..e333ab9 100644 --- a/milena/tests/labeling/compute.cc +++ b/milena/tests/labeling/compute.cc @@ -54,7 +54,7 @@ int main() image2d<int_u8> ima = make::image2d(vals); int_u8 nlabels = 3; - accu::sum_<int_u8> sum; + accu::sum<int_u8> sum; p_array<float> sums = labeling::compute(sum, ima, ima, nlabels); mln_assertion(sums[0] == 0); mln_assertion(sums[1] == 4); @@ -67,7 +67,7 @@ int main() mln_assertion(sums[2] == 8); mln_assertion(sums[3] == 12); - accu::count_<mln_site_(image2d<int_u8>)> count; + accu::count<mln_site_(image2d<int_u8>)> count; p_array<unsigned int> counts = labeling::compute(count, ima, nlabels); mln_assertion(counts[0] == 18); mln_assertion(counts[1] == 4); -- 1.5.6.5
participants (1)
-
Guillaume Lazzara