libsigc++ 3.6.0

Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
sigc::signal_base Struct Reference
Signals

Base class for the sigc::signal template. More...

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

Inheritance diagram for sigc::signal_base:
[legend]

## Public Types
using | size_type = std::size_t

## Public Member Functions
| 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.
bool | blocked () const noexcept
| Returns whether all slots in the list are blocked.
void | clear ()
| Empties the list of slots.
bool | empty () const noexcept
| Returns whether the list of slots is empty.
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.
void | unblock () noexcept
| Unsets the blocking state of all slots in the list.

## Protected Types
using | iterator_type = internal::signal_impl::iterator_type

## Protected Member Functions
iterator_type | connect (const slot_base & slot_)
| Adds a slot at the end of the list of slots.
iterator_type | connect (slot_base && slot_)
| Adds a slot at the end of the list of slots.
iterator_type | connect_first (const slot_base & slot_)
| Adds a slot at the beginning of the list of slots.
iterator_type | connect_first (slot_base && slot_)
| Adds a slot at the beginning of the list of slots.
std::shared_ptr< internal::signal_impl > | impl () const
| Returns the signal_impl object encapsulating the list of slots.
iterator_type | insert (iterator_type i, const slot_base & slot_)
| Adds a slot at the given position into the list of slots.
iterator_type | insert (iterator_type i, slot_base && slot_)
| Adds a slot at the given position into the list of slots.

## Protected Attributes
std::shared_ptr< internal::signal_impl > | impl_
| The signal_impl object encapsulating the slot list.

## Detailed Description

Base class for the sigc::signal template.

signal_base integrates most of the interface of the derived sigc::signal template. The implementation, however, resides in sigc::internal::signal_impl. A sigc::internal::signal_impl object is dynamically allocated from signal_base when first connecting a slot to the signal. This ensures that empty signals don't waste memory.

sigc::internal::signal_impl is reference-counted. When a sigc::signal object is copied, the reference count of its sigc::internal::signal_impl object is incremented. Both sigc::signal objects then refer to the same sigc::internal::signal_impl object.

## Member Typedef Documentation

## ◆ iterator_type

using sigc::signal_base::iterator_type = internal::signal_impl::iterator_type
| protected

## ◆ size_type

using sigc::signal_base::size_type = std::size_t

## Constructor & Destructor Documentation

## ◆ signal_base() [1/3]

sigc::signal_base::signal_base | ( |  | ) |
| noexcept

## ◆ signal_base() [2/3]

sigc::signal_base::signal_base | ( | const signal_base & | src | ) |
| noexcept

## ◆ signal_base() [3/3]

sigc::signal_base::signal_base | ( | signal_base && | src | ) |

## ◆ ~signal_base()

sigc::signal_base::~signal_base | ( |  | ) |

## Member Function Documentation

## ◆ block()

void sigc::signal_base::block | ( | bool | should_block = `true` | ) |
| noexcept

Sets the blocking state of all slots in the list.

If should_block is `true` then the blocking state is set. Subsequent emissions of the signal don't invoke the functors contained in the slots until unblock() or block() with should_block = `false` is called. sigc::slot_base::block() and sigc::slot_base::unblock() can change the blocking state of individual slots.

Parameters

  should_block | Indicates whether the blocking state should be set or unset.

Since libsigc++ 2.4:

## ◆ blocked()

bool sigc::signal_base::blocked | ( |  | ) | const
| noexcept

Returns whether all slots in the list are blocked.

Returns
  `true` if all slots are blocked or the list is empty.

Since libsigc++ 2.4:

## ◆ clear()

void sigc::signal_base::clear | ( |  | ) |

Empties the list of slots.

## ◆ connect() [1/2]

iterator_type sigc::signal_base::connect | ( | const slot_base & | slot_ | ) |
| protected

Adds a slot at the end of the list of slots.

With connect(), slots can also be added during signal emission. In this case, they won't be executed until the next emission occurs.

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]

iterator_type sigc::signal_base::connect | ( | slot_base && | slot_ | ) |
| protected

Adds a slot at the end of the list of slots.

With connect(), slots can also be added during signal emission. In this case, they won't be executed until the next emission occurs.

Parameters

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

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

Since libsigc++ 2.8:

## ◆ connect_first() [1/2]

iterator_type sigc::signal_base::connect_first | ( | const slot_base & | slot_ | ) |
| protected

Adds a slot at the beginning of the list of slots.

With connect_first(), slots can also be added during signal emission. In this case, they won't be executed until the next emission occurs.

Parameters

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

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

Since libsigc++ 3.6:

## ◆ connect_first() [2/2]

iterator_type sigc::signal_base::connect_first | ( | slot_base && | slot_ | ) |
| protected

Adds a slot at the beginning of the list of slots.

With connect_fist(), slots can also be added during signal emission. In this case, they won't be executed until the next emission occurs.

Parameters

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

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

Since libsigc++ 3.6:

## ◆ empty()

bool sigc::signal_base::empty | ( |  | ) | const
| inline noexcept

Returns whether the list of slots is empty.

Returns
  `true` if the list of slots is empty.

## ◆ impl()

std::shared_ptr< internal::signal_impl > sigc::signal_base::impl | ( |  | ) | const
| protected

Returns the signal_impl object encapsulating the list of slots.

Returns
  The signal_impl object encapsulating the list of slots.

## ◆ insert() [1/2]

iterator_type sigc::signal_base::insert | ( | iterator_type | i,
|  | const slot_base & | slot_
| ) |  |
| protected

Adds a slot at the given position into the list of slots.

Note that this function does not work during signal emission!

Parameters

  i | An iterator indicating the position where slot_ should be inserted.
  slot_ | The slot to add to the list of slots.

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

## ◆ insert() [2/2]

iterator_type sigc::signal_base::insert | ( | iterator_type | i,
|  | slot_base && | slot_
| ) |  |
| protected

Adds a slot at the given position into the list of slots.

Note that this function does not work during signal emission!

Parameters

  i | An iterator indicating the position where slot_ should be inserted.
  slot_ | The slot to add to the list of slots.

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

Since libsigc++ 2.8:

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

signal_base & sigc::signal_base::operator= | ( | const signal_base & | src | ) |

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

signal_base & sigc::signal_base::operator= | ( | signal_base && | src | ) |

## ◆ size()

size_type sigc::signal_base::size | ( |  | ) | const
| noexcept

Returns the number of slots in the list.

Returns
  The number of slots in the list.

## ◆ unblock()

void sigc::signal_base::unblock | ( |  | ) |
| noexcept

Unsets the blocking state of all slots in the list.

Since libsigc++ 2.4:

## Member Data Documentation

## ◆ impl_

std::shared_ptr<internal::signal_impl> sigc::signal_base::impl_
| mutable protected

The signal_impl object encapsulating the slot list.