Public Types | Public Member Functions | Protected Attributes

mln::accu::count_value< V > Struct Template Reference
[On values]

Define an accumulator that counts the occurrence of a given value. More...

#include <count_value.hh>

Inheritance diagram for mln::accu::count_value< V >:
Inheritance graph

List of all members.

Public Types

typedef V argument
typedef Accumulator< void > category
typedef count_value< V > exact_t
typedef unsigned q_result
typedef mln::metal::unqualif
< unsigned >::ret 
result

Public Member Functions

 count_value ()
 count_value (const V &ref)
bool is_valid () const
 Check whether this accu is able to return a result.
unsigned subj_ ()
void take_as_init (const T &t)
 Take as initialization the value t.
void take_as_init_ (const T &t)
 Default implementation of "take as initialization".
void take_n_times (unsigned n, const T &t)
 Take n times the value t.
void take_n_times_ (unsigned n, const T &t)
 Default implementation of "take n times".
unsigned to_result () const
 Get the value of the accumulator.

void init ()
 Manipulators.
void take (const argument &)
void take (const count_value< V > &other)
void untake (const argument &)
void untake (const count_value< V > &other)
void set_value (unsigned c)
 Force the value of the counter to c.

Protected Attributes

unsigned count_
 The value of the counter.
ref_
 The value which must be counted.
bool valid_
 Set to false if the reference value is not set.

Detailed Description

template<typename V>
struct mln::accu::count_value< V >

Define an accumulator that counts the occurrence of a given value.

Definition at line 72 of file count_value.hh.


Member Typedef Documentation

template<typename V>
typedef V mln::accu::count_value< V >::argument

Definition at line 75 of file count_value.hh.

typedef Accumulator<void> mln::Accumulator< count_value< V > >::category [inherited]

Reimplemented from mln::Proxy< count_value< V > >.

Definition at line 80 of file accumulator.hh.

typedef count_value< V > mln::Object< count_value< V > >::exact_t [inherited]

Definition at line 173 of file object.hh.

typedef unsigned mln::accu::internal::base< unsigned , count_value< V > >::q_result [inherited]

Definition at line 58 of file base.hh.

typedef mln::metal::unqualif< unsigned >::ret mln::accu::internal::base< unsigned , count_value< V > >::result [inherited]

Definition at line 59 of file base.hh.


Constructor & Destructor Documentation

template<typename V >
mln::accu::count_value< V >::count_value (  )  [inline]
template<typename V >
mln::accu::count_value< V >::count_value ( const V &  ref  )  [inline, explicit]

Member Function Documentation

template<typename V >
void mln::accu::count_value< V >::init (  )  [inline]

Manipulators.

Definition at line 153 of file count_value.hh.

References mln::accu::count_value< V >::count_.

Referenced by mln::accu::count_value< V >::count_value().

template<typename V >
bool mln::accu::count_value< V >::is_valid (  )  const [inline]

Check whether this accu is able to return a result.

Always true here.

Definition at line 216 of file count_value.hh.

References mln::accu::count_value< V >::valid_.

Referenced by mln::accu::count_value< V >::take(), and mln::accu::count_value< V >::untake().

template<typename V >
void mln::accu::count_value< V >::set_value ( unsigned  c  )  [inline]

Force the value of the counter to c.

Definition at line 208 of file count_value.hh.

References mln::accu::count_value< V >::count_.

unsigned mln::accu::internal::base< unsigned , count_value< V > >::subj_ (  )  [inherited]
template<typename V >
void mln::accu::count_value< V >::take ( const argument l  )  [inline]
template<typename V >
void mln::accu::count_value< V >::take ( const count_value< V > &  other  )  [inline]
void mln::Accumulator< count_value< V > >::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< count_value< V > >::take_as_init_ ( const T &  t  )  [inherited]

Default implementation of "take as initialization".

void mln::Accumulator< count_value< V > >::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 '_').

void mln::Accumulator< count_value< V > >::take_n_times_ ( unsigned  n,
const T &  t 
) [inherited]

Default implementation of "take n times".

template<typename V >
unsigned mln::accu::count_value< V >::to_result (  )  const [inline]

Get the value of the accumulator.

Definition at line 199 of file count_value.hh.

References mln::accu::count_value< V >::count_.

template<typename V >
void mln::accu::count_value< V >::untake ( const count_value< V > &  other  )  [inline]
template<typename V >
void mln::accu::count_value< V >::untake ( const argument l  )  [inline]

Member Data Documentation

template<typename V>
unsigned mln::accu::count_value< V >::count_ [protected]
template<typename V>
V mln::accu::count_value< V >::ref_ [protected]

The value which must be counted.

Definition at line 103 of file count_value.hh.

Referenced by mln::accu::count_value< V >::count_value(), mln::accu::count_value< V >::take(), and mln::accu::count_value< V >::untake().

template<typename V>
bool mln::accu::count_value< V >::valid_ [protected]

Set to false if the reference value is not set.

Definition at line 106 of file count_value.hh.

Referenced by mln::accu::count_value< V >::count_value(), and mln::accu::count_value< V >::is_valid().