26 #ifndef MLN_MORPHO_ATTRIBUTE_SUM_HH
27 # define MLN_MORPHO_ATTRIBUTE_SUM_HH
33 # include <mln/accu/internal/base.hh>
35 # include <mln/trait/value_.hh>
36 # include <mln/value/builtin/all.hh>
37 # include <mln/literal/zero.hh>
39 # include <mln/util/pix.hh>
49 template <
typename I,
typename S>
class sum;
59 template <
typename I,
typename S>
60 struct accumulator_< morpho::attribute::sum<I,S> >
62 typedef accumulator::has_untake::yes has_untake;
63 typedef accumulator::has_set_value::yes has_set_value;
64 typedef accumulator::has_stop::no has_stop;
65 typedef accumulator::when_pix::use_v when_pix;
79 template <
typename I,
typename S = mln_sum(mln_value(I))>
80 class sum :
public mln::accu::internal::base< S, sum<I,S> >
82 typedef mln::accu::internal::base< S, sum<I> > super_;
85 typedef mln_value(I) argument;
93 void take(
const argument& v);
97 void take_as_init_(
const argument& v);
109 void untake(
const argument& v);
125 # ifndef MLN_INCLUDE_ONLY
127 template <
typename I,
typename S>
134 template <
typename I,
typename S>
144 template <
typename I,
typename S>
152 template <
typename I,
typename S>
160 template <
typename I,
typename S>
163 sum<I,S>::take(
const sum<I,S>& other)
170 template <
typename I,
typename S>
173 sum<I,S>::take_as_init_(
const argument& v)
178 template <
typename I,
typename S>
181 sum<I,S>::take_as_init_(
const util::pix<I>& px)
183 take_as_init_(px.v());
186 template <
typename I,
typename S>
194 template <
typename I,
typename S>
202 template <
typename I,
typename S>
210 template <
typename I,
typename S>
218 template <
typename I,
typename S>
226 template <
typename I,
typename S>
234 # endif // ! MLN_INCLUDE_ONLY
243 #endif // ! MLN_MORPHO_ATTRIBUTE_SUM_HH