libsigc++: sigc::signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 >::accumulated< T_accumulator > Class Template Reference

libsigc++ 2.2.11

- Main Page
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
sigc::signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 >::accumulated< T_accumulator > Class Template Reference
Signals

Convenience wrapper for the numbered sigc::signal# templates. More...

`#include <sigc++/signal.h>`

Inheritance diagram for sigc::signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 >::accumulated< T_accumulator >:
[legend]

List of all members.

## Public Member Functions
| accumulated (const accumulated& src)
Public Member Functions inherited from sigc::signal7< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7, T_accumulator >
iterator | connect (const slot_type& slot_)
| Add a slot to the list of slots.
result_type | emit (typename type_trait< T_arg1 >::take _A_a1, typename type_trait< T_arg2 >::take _A_a2, typename type_trait< T_arg3 >::take _A_a3, typename type_trait< T_arg4 >::take _A_a4, typename type_trait< T_arg5 >::take _A_a5, typename type_trait< T_arg6 >::take _A_a6, typename type_trait< T_arg7 >::take _A_a7) const
| Triggers the emission of the signal.
result_type | emit_reverse (typename type_trait< T_arg1 >::take _A_a1, typename type_trait< T_arg2 >::take _A_a2, typename type_trait< T_arg3 >::take _A_a3, typename type_trait< T_arg4 >::take _A_a4, typename type_trait< T_arg5 >::take _A_a5, typename type_trait< T_arg6 >::take _A_a6, typename type_trait< T_arg7 >::take _A_a7) const
| Triggers the emission of the signal in reverse order (see emit()).
result_type | operator() (typename type_trait< T_arg1 >::take _A_a1, typename type_trait< T_arg2 >::take _A_a2, typename type_trait< T_arg3 >::take _A_a3, typename type_trait< T_arg4 >::take _A_a4, typename type_trait< T_arg5 >::take _A_a5, typename type_trait< T_arg6 >::take _A_a6, typename type_trait< T_arg7 >::take _A_a7) const
| Triggers the emission of the signal (see emit()).
bound_const_mem_functor7 < result_type, signal7, typename type_trait< T_arg1 > ::take, typename type_trait < T_arg2 >::take, typename type_trait< T_arg3 >::take, typename type_trait< T_arg4 > ::take, typename type_trait < T_arg5 >::take, typename type_trait< T_arg6 >::take, typename type_trait< T_arg7 > ::take > | make_slot () const
| Creates a functor that calls emit() on this signal.
slot_list_type | slots ()
| Creates an STL-style interface for the signal's list of slots.
const slot_list_type | slots () const
| Creates an STL-style interface for the signal's list of slots.
| signal7 (const signal7& src)
Public Member Functions inherited from sigc::signal_base
| signal_base (const signal_base& src)
signal_base& | operator= (const signal_base& src)
bool | empty () const
| Returns whether the list of slots is empty.
void | clear ()
| Empties the list of slots.
size_type | size () const
| Returns the number of slots in the list.
Public Member Functions inherited from sigc::trackable
| trackable (const trackable& src)
trackable& | operator= (const trackable& src)
void | add_destroy_notify_callback (void* data, func_destroy_notify func) const
| Add a callback that is executed (notified) when the trackable object is detroyed.
void | remove_destroy_notify_callback (void* data) const
| Remove a callback previously installed with add_destroy_notify_callback().
void | notify_callbacks ()
| Execute and remove all previously installed callbacks.

## Additional Inherited Members
Public Types inherited from sigc::signal7< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7, T_accumulator >
typedef internal::signal_emit7 < T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7, T_accumulator > | emitter_type
typedef emitter_type::result_type | result_type
typedef slot< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > | slot_type
typedef slot_list< slot_type > | slot_list_type
typedef slot_list_type::iterator | iterator
typedef slot_list_type::const_iterator | const_iterator
typedef slot_list_type::reverse_iterator | reverse_iterator
typedef slot_list_type::const_reverse_iterator | const_reverse_iterator
Public Types inherited from sigc::signal_base
typedef std::size_t | size_type
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

### template<class T_return, class T_arg1 = nil, class T_arg2 = nil, class T_arg3 = nil, class T_arg4 = nil, class T_arg5 = nil, class T_arg6 = nil, class T_arg7 = nil>
template <class T_accumulator>
class sigc::signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 >::accumulated< T_accumulator >

Convenience wrapper for the numbered sigc::signal# templates.

Like sigc::signal but the additional template parameter T_accumulator defines the accumulator type that should be used.

An accumulator is a functor that uses a pair of special iterators to step through a list of slots and calculate a return value from the results of the slot invokations. The iterators' operator*() executes the slot. The return value is buffered, so that in an expression like

a = (*i) * (*i);

the slot is executed only once. The accumulator must define its return value as `result_type`.

Example 1:
  This accumulator calculates the arithmetic mean value:
  struct arithmetic_mean_accumulator
  {
  typedef double result_type;
  template<typename T_iterator>
  result_type operator()(T_iterator first, T_iterator last) const
  {
  result_type value_ = 0;
  int n_ = 0;
  for (; first != last; ++first, ++n_)
  value_ += *first;
  return value_ / n_;
  }
  };

Example 2:
  This accumulator stops signal emission when a slot returns zero:
  struct interruptable_accumulator
  {
  typedef bool result_type;
  template<typename T_iterator>
  result_type operator()(T_iterator first, T_iterator last) const
  {
  for (; first != last; ++first, ++n_)
  if (!*first) return false;
  return true;
  }
  };