libsigc++: sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator > Class Template Reference

libsigc++ 2.10.7

Public Types | Public Member Functions | List of all members
sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator > Class Template Reference
Signals

Signal declaration. More...

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

Inheritance diagram for sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >:
[legend]

## Public Types
typedef slot_list_type::const_iterator | const_iterator
typedef slot_list_type::const_reverse_iterator | const_reverse_iterator
typedef internal::signal_emit5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator > | emitter_type
typedef slot_list_type::iterator | iterator
typedef emitter_type::result_type | result_type
typedef slot_list_type::reverse_iterator | reverse_iterator
typedef slot_list< slot_type > | slot_list_type
typedef slot< T_return(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5)> | slot_type
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

## Public Member Functions
| signal5 ()
| signal5 (const signal5& src)
| signal5 (signal5&& src)
iterator | connect (const slot_type& slot_)
| Add a slot to the list of slots. More...
iterator | connect (slot_type&& slot_)
| Add a slot to the list of slots. More...
result_type | emit (type_trait_take_t< T_arg1 > _A_a1, type_trait_take_t< T_arg2 > _A_a2, type_trait_take_t< T_arg3 > _A_a3, type_trait_take_t< T_arg4 > _A_a4, type_trait_take_t< T_arg5 > _A_a5) const
| Triggers the emission of the signal. More...
result_type | emit_reverse (type_trait_take_t< T_arg1 > _A_a1, type_trait_take_t< T_arg2 > _A_a2, type_trait_take_t< T_arg3 > _A_a3, type_trait_take_t< T_arg4 > _A_a4, type_trait_take_t< T_arg5 > _A_a5) const
| Triggers the emission of the signal in reverse order (see emit()). More...
bound_const_mem_functor5< result_type, signal5, type_trait_take_t< T_arg1 >, type_trait_take_t< T_arg2 >, type_trait_take_t< T_arg3 >, type_trait_take_t< T_arg4 >, type_trait_take_t< T_arg5 > > | make_slot () const
| Creates a functor that calls emit() on this signal. More...
result_type | operator() (type_trait_take_t< T_arg1 > _A_a1, type_trait_take_t< T_arg2 > _A_a2, type_trait_take_t< T_arg3 > _A_a3, type_trait_take_t< T_arg4 > _A_a4, type_trait_take_t< T_arg5 > _A_a5) const
| Triggers the emission of the signal (see emit()). More...
signal5& | operator= (const signal5& src)
signal5& | operator= (signal5&& src)
slot_list_type | slots ()
| Creates an STL-style interface for the signal's list of slots. More...
const slot_list_type | slots () const
| Creates an STL-style interface for the signal's list of slots. More...
Public Member Functions inherited from sigc::signal_base
| signal_base () noexcept
| signal_base (const signal_base& src) noexcept
| signal_base (signal_base&& src)
| ~signal_base ()
void | block (bool should_block=true) noexcept
| Sets the blocking state of all slots in the list. More...
bool | blocked () const noexcept
| Returns whether all slots in the list are blocked. More...
void | clear ()
| Empties the list of slots. More...
bool | empty () const noexcept
| Returns whether the list of slots is empty. More...
signal_base& | operator= (const signal_base& src)
signal_base& | operator= (signal_base&& src)
size_type | size () const noexcept
| Returns the number of slots in the list. More...
void | unblock () noexcept
| Unsets the blocking state of all slots in the list. More...
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable& src) noexcept
| trackable (trackable&& src)
| ~trackable ()
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. More...
void | notify_callbacks ()
| Execute and remove all previously installed callbacks. More...
trackable& | operator= (const trackable& src)
trackable& | operator= (trackable&& src)
void | remove_destroy_notify_callback (void* data) const
| Remove a callback previously installed with add_destroy_notify_callback(). More...

## Additional Inherited Members
Protected Types inherited from sigc::signal_base
typedef internal::signal_impl::iterator_type | iterator_type
Protected Member Functions inherited from sigc::signal_base
iterator_type | connect (const slot_base& slot_)
| Adds a slot at the end of the list of slots. More...
iterator_type | connect (slot_base&& slot_)
| Adds a slot at the end of the list of slots. More...
iterator_type | erase (iterator_type i)
| Removes the slot at the given position from the list of slots. More...
internal::signal_impl* | impl () const
| Returns the signal_impl object encapsulating the list of slots. More...
iterator_type | insert (iterator_type i, const slot_base& slot_)
| Adds a slot at the given position into the list of slots. More...
iterator_type | insert (iterator_type i, slot_base&& slot_)
| Adds a slot at the given position into the list of slots. More...
Protected Attributes inherited from sigc::signal_base
internal::signal_impl* | impl_
| The signal_impl object encapsulating the slot list. More...

## Detailed Description

### template<class T_return, class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_accumulator = nil>
class sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >

Signal declaration.

signal5 can be used to connect() slots that are invoked during subsequent calls to emit(). Any functor or slot can be passed into connect(). It is converted into a slot implicitly.

If you want to connect one signal to another, use make_slot() to retrieve a functor that emits the signal when invoked.

Be careful if you directly pass one signal into the connect() method of another: a shallow copy of the signal is made and the signal's slots are not disconnected until both the signal and its clone are destroyed, which is probably not what you want.

The following template arguments are used:

- T_return The desired return type for the emit() function (may be overridden by the accumulator).
- T_arg1 Argument type used in the definition of emit().
- T_arg2 Argument type used in the definition of emit().
- T_arg3 Argument type used in the definition of emit().
- T_arg4 Argument type used in the definition of emit().
- T_arg5 Argument type used in the definition of emit().
- T_accumulator The accumulator type used for emission. The default `nil` means that no accumulator should be used, for example if signal emission returns the return value of the last slot invoked.

You should use the more convenient unnumbered sigc::signal template.

## Member Typedef Documentation

## ◆ const_iterator

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

typedef slot_list_type::const_iterator sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::const_iterator

## ◆ const_reverse_iterator

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

typedef slot_list_type::const_reverse_iterator sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::const_reverse_iterator

## ◆ emitter_type

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

typedef internal::signal_emit5<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator> sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::emitter_type

## ◆ iterator

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

typedef slot_list_type::iterator sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::iterator

## ◆ result_type

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

typedef emitter_type::result_type sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::result_type

## ◆ reverse_iterator

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

typedef slot_list_type::reverse_iterator sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::reverse_iterator

## ◆ slot_list_type

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

typedef slot_list<slot_type> sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::slot_list_type

## ◆ slot_type

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

typedef slot<T_return(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5)> sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::slot_type

## Constructor & Destructor Documentation

## ◆ signal5() [1/3]

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::signal5 | ( |  | ) |
| inline

## ◆ signal5() [2/3]

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::signal5 | ( | const signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >& | src | ) |
| inline

## ◆ signal5() [3/3]

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::signal5 | ( | signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >&& | src | ) |
| inline

## Member Function Documentation

## ◆ connect() [1/2]

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

iterator sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::connect | ( | const slot_type& | slot_ | ) |
| inline

Add a slot to the list of slots.

Any functor or slot may be passed into connect(). It will be converted into a slot implicitly. The returned iterator may be stored for disconnection of the slot at some later point. It stays valid until the slot is removed from the list of slots. The iterator can also be implicitly converted into a sigc::connection object that may be used safely beyond the life time of the slot.

std::function<> and C++11 lambda expressions are functors. These are examples of functors that can be connected to a signal.

std::bind() creates a functor, but this functor typically has an operator()() which is a variadic template. Our functor_trait can't deduce the result type of such a functor. If you first assign the return value of std::bind() to a std::function, you can connect the std::function to a signal.

Parameters

  slot_ | The slot to add to the list of slots.

Returns
  An iterator pointing to the new slot in the list.

## ◆ connect() [2/2]

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

iterator sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::connect | ( | slot_type&& | slot_ | ) |
| inline

Add a slot to the list of slots.

See also
  connect(const slot_type& slot_).

Since libsigc++ 2.8:

## ◆ emit()

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

result_type sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::emit | ( | type_trait_take_t< T_arg1 > | _A_a1,
|  | type_trait_take_t< T_arg2 > | _A_a2,
|  | type_trait_take_t< T_arg3 > | _A_a3,
|  | type_trait_take_t< T_arg4 > | _A_a4,
|  | type_trait_take_t< T_arg5 > | _A_a5
| ) |  | const
| inline

Triggers the emission of the signal.

During signal emission all slots that have been connected to the signal are invoked unless they are manually set into a blocking state. The parameters are passed on to the slots. If T_accumulated is not `nil`, an accumulator of this type is used to process the return values of the slot invocations. Otherwise, the return value of the last slot invoked is returned.

Parameters

  _A_a1 | Argument to be passed on to the slots.
  _A_a2 | Argument to be passed on to the slots.
  _A_a3 | Argument to be passed on to the slots.
  _A_a4 | Argument to be passed on to the slots.
  _A_a5 | Argument to be passed on to the slots.

Returns
  The accumulated return values of the slot invocations.

## ◆ emit_reverse()

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

result_type sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::emit_reverse | ( | type_trait_take_t< T_arg1 > | _A_a1,
|  | type_trait_take_t< T_arg2 > | _A_a2,
|  | type_trait_take_t< T_arg3 > | _A_a3,
|  | type_trait_take_t< T_arg4 > | _A_a4,
|  | type_trait_take_t< T_arg5 > | _A_a5
| ) |  | const
| inline

Triggers the emission of the signal in reverse order (see emit()).

Deprecated:
  This is apparently not useful, but please let us know if you need it.

## ◆ make_slot()

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

bound_const_mem_functor5<result_type, signal5, type_trait_take_t<T_arg1>, type_trait_take_t<T_arg2>, type_trait_take_t<T_arg3>, type_trait_take_t<T_arg4>, type_trait_take_t<T_arg5> > sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::make_slot | ( |  | ) | const
| inline

Creates a functor that calls emit() on this signal.

sigc::mem_fun(mysignal, &sigc::signal5::emit)
sigc::signal5::emit
result_type emit(type_trait_take_t< T_arg1 > _A_a1, type_trait_take_t< T_arg2 > _A_a2, type_trait_take_t< T_arg3 > _A_a3, type_trait_take_t< T_arg4 > _A_a4, type_trait_take_t< T_arg5 > _A_a5) const
Triggers the emission of the signal.
Definition: signal.h:3574
sigc::mem_fun
mem_functor0< T_return, T_obj > mem_fun(T_return(T_obj::*_A_func)())
Creates a functor of type sigc::mem_functor0 which wraps a method.
Definition: mem_fun.h:5797

yields the same result.

Returns
  A functor that calls emit() on this signal.

## ◆ operator()()

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

result_type sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::operator() | ( | type_trait_take_t< T_arg1 > | _A_a1,
|  | type_trait_take_t< T_arg2 > | _A_a2,
|  | type_trait_take_t< T_arg3 > | _A_a3,
|  | type_trait_take_t< T_arg4 > | _A_a4,
|  | type_trait_take_t< T_arg5 > | _A_a5
| ) |  | const
| inline

Triggers the emission of the signal (see emit()).

Deprecated:
  This is apparently not useful, but let us know if you need it.

## ◆ operator=() [1/2]

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

signal5& sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::operator= | ( | const signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >& | src | ) |
| inline

## ◆ operator=() [2/2]

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

signal5& sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::operator= | ( | signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >&& | src | ) |
| inline

## ◆ slots() [1/2]

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

slot_list_type sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::slots | ( |  | ) |
| inline

Creates an STL-style interface for the signal's list of slots.

This interface supports iteration, insertion and removal of slots.

Returns
  An STL-style interface for the signal's list of slots.

Deprecated:
  This is apparently not useful, but please let us know if you need it.

## ◆ slots() [2/2]

template <class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_accumulator = nil>

const slot_list_type sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >::slots | ( |  | ) | const
| inline

Creates an STL-style interface for the signal's list of slots.

This interface supports iteration, insertion and removal of slots.

Returns
  An STL-style interface for the signal's list of slots.

Deprecated:
  This is apparently not useful, but please let us know if you need it.