libsigc++ 2.3.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

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

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# templates. More...

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

Inheritance diagram for sigc::signal_base:
[legend]

## Public Types

typedef std::size_t | size_type
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Public Member Functions

| 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.
bool | blocked () const
| Returns whether all slots in the list are blocked.
void | block (bool should_block=true)
| Sets the blocking state of all slots in the list.
void | unblock ()
| Unsets the blocking state of all 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.

## Protected Types

typedef internal::signal_impl::iterator_type | 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 | insert (iterator_type i, const slot_base& slot_)
| Adds a slot at the given position into the list of slots.
iterator_type | erase (iterator_type i)
| Removes the slot at the given position from the list of slots.
internal::signal_impl* | impl () const
| Returns the signal_impl object encapsulating the list of slots.

## Protected Attributes

internal::signal_impl* | impl_
| The signal_impl object encapsulating the slot list.

## Detailed Description

Base class for the sigc::signal# templates.

signal_base integrates most of the interface of the derived sigc::signal# templates. 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.

## Member Function Documentation

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

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:

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

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:

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.

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

inline

Returns whether the list of slots is empty.

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

iterator_type sigc::signal_base::erase | ( | iterator_type | i | ) |

protected

Removes the slot at the given position from the list of slots.

Note that this function does not work during signal emission!

Parameters

  i | An iterator pointing to the slot to be removed.

Returns
  An iterator pointing to the slot in the list after the one removed.

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.

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.

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

Returns the number of slots in the list.

Returns
  The number of slots in the list.

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

Unsets the blocking state of all slots in the list.

Since libsigc++ 2.4: