Milena (Olena)  User documentation 2.0a Id
 All Classes Namespaces Functions Variables Typedefs Enumerator Groups Pages
mln::accu::math::sum< T, S > Struct Template Reference

Generic sum accumulator class. More...

#include <sum.hh>

Inherits mln::accu::internal::base< const S &, sum< T, S > >.

Public Member Functions

bool is_valid () const
 Check whether this accu is able to return a result.
 
void take_as_init (const T &t)
 Take as initialization the value t.
 
void take_n_times (unsigned n, const T &t)
 Take n times the value t.
 
const S & to_result () const
 Get the value of the accumulator.
 
void init ()
 Manipulators.
 

Detailed Description

template<typename T, typename S = typename mln::value::props< T >::sum>
struct mln::accu::math::sum< T, S >

Generic sum accumulator class.

Parameter T is the type of values that we sum. Parameter S is the type to store the value sum; the default type of S is the summation type (property) of T.

Definition at line 112 of file accu/math/sum.hh.

Member Function Documentation

template<typename T , typename S >
void sum< T, S >::init ( )
inline

Manipulators.

Definition at line 161 of file accu/math/sum.hh.

References mln::literal::zero.

template<typename T , typename S >
bool sum< T, S >::is_valid ( ) const
inline

Check whether this accu is able to return a result.

Always true here.

Definition at line 222 of file accu/math/sum.hh.

void mln::Accumulator< sum< T, S > >::take_as_init ( const T &  t)
inherited

Take as initialization the value t.

Dev note: this is a final method; override if needed by take_as_init_ (ending with '_').

void mln::Accumulator< sum< T, S > >::take_n_times ( unsigned  n,
const T &  t 
)
inherited

Take n times the value t.

Dev note: this is a final method; override if needed by take_as_init_ (ending with '_').

template<typename T , typename S >
const S & sum< T, S >::to_result ( ) const
inline

Get the value of the accumulator.

Definition at line 206 of file accu/math/sum.hh.