26 #ifndef MLN_ACCU_STAT_MIN_H_HH
27 # define MLN_ACCU_STAT_MIN_H_HH
33 # include <mln/accu/internal/base.hh>
34 # include <mln/accu/histo.hh>
35 # include <mln/value/set.hh>
36 # include <mln/util/pix.hh>
45 template <
typename V>
struct min_h;
56 struct accumulator_< accu::stat::min_h<V> >
58 typedef accumulator::has_untake::yes has_untake;
59 typedef accumulator::has_set_value::no has_set_value;
60 typedef accumulator::has_stop::no has_stop;
61 typedef accumulator::when_pix::use_v when_pix;
100 struct min_h :
public mln::accu::internal::base< const V& , min_h<V> >
109 void take(
const argument& t);
110 void take_as_init_(
const argument& t);
112 void untake(
const argument& t);
115 unsigned card()
const {
return h_.sum(); }
126 void debug_print_()
const;
133 mutable unsigned sum_;
139 void update_()
const;
140 void go_minus_()
const;
141 void go_plus_()
const;
146 template <
typename I>
struct min_h< util::pix<I> >;
149 # ifndef MLN_INCLUDE_ONLY
151 template <typename V>
160 template <
typename V>
163 min_h<V>::take(
const argument& t)
167 this->take_as_init_(t);
178 template <
typename V>
181 min_h<V>::take(
const min_h<V>& other)
185 for (
unsigned i = 0; i < i_; ++i)
191 template <
typename V>
194 min_h<V>::untake(
const argument& t)
196 mln_precondition(h_(t) != 0);
205 mln_invariant(sum_ >= 1);
210 if (t == t_ && h_[i_] == 0)
214 template <
typename V>
217 min_h<V>::update_()
const
227 template <
typename V>
230 min_h<V>::go_minus_()
const
242 template <
typename V>
245 min_h<V>::go_plus_()
const
253 template <
typename V>
260 i_ = mln_max(argument);
265 template <
typename V>
277 template <
typename V>
279 const typename min_h<V>::argument&
287 template <
typename V>
295 template <
typename V>
304 template <
typename V>
309 std::cout <<
"h={" << h_ <<
"} ";
310 std::cout <<
"sum=" << sum_ <<
' '
311 <<
"valid=" << valid_ <<
' '
313 <<
"t=" << t_ << std::endl;
316 template <
typename V>
318 std::ostream& operator<<(std::ostream& ostr, const min_h<V>& m)
323 # endif // ! MLN_INCLUDE_ONLY
332 #endif // ! MLN_ACCU_STAT_MIN_H_HH