libsigc++ 2.0: sigc::internal::signal_impl Struct Reference

Main Page Groups Namespaces

# sigc::internal::signal_impl Struct Reference

Implementation of the signal interface. More...

List of all members.

## Public Types
typedef size_t | size_type
typedef std::list <slot_base> | slot_list
typedef slot_list::iterator | iterator_type
typedef slot_list::const_iterator | const_iterator_type
## Public Member Functions
| signal_impl ()
void | reference ()
| Increments the reference counter.
void | reference_exec ()
| Increments the reference and execution counter.
void | unreference ()
| Decrements the reference counter.
void | unreference_exec ()
| Decrements the reference and execution counter.
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.
iterator_type | connect (const slot_base& slot_)
| Adds a slot at the bottom 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.
void | sweep ()
| Removes invalid slots from the list of slots.
## Static Public Member Functions
static void* | notify (void* d)
| Callback that is executed when some slot becomes invalid.
## Public Attributes
short | ref_count_
| Reference counter.
short | exec_count_
| Execution counter.
bool | deferred_
| Indicates whether the execution of sweep() is being deferred.
std::list<slot_base> | slots_
| The list of slots.

## Detailed Description

Implementation of the signal interface.

signal_impl manages a list of slots. When a slot becomes invalid (because some referred object dies), notify() is executed. notify() either calls sweep() directly or defers the execution of sweep() when the signal is being emitted. sweep() removes all invalid slot from the list.

## Member Typedef Documentation

typedef size_t sigc::internal::signal_impl::size_type

typedef std::list<slot_base> sigc::internal::signal_impl::slot_list

typedef slot_list::iterator sigc::internal::signal_impl::iterator_type

typedef slot_list::const_iterator sigc::internal::signal_impl::const_iterator_type

## Constructor & Destructor Documentation

sigc::internal::signal_impl::signal_impl | ( |  | ) |

## Member Function Documentation

void sigc::internal::signal_impl::reference | ( |  | ) | `[inline]`

Increments the reference counter.

void sigc::internal::signal_impl::reference_exec | ( |  | ) | `[inline]`

Increments the reference and execution counter.

void sigc::internal::signal_impl::unreference | ( |  | ) | `[inline]`

Decrements the reference counter.

The object is deleted when the reference counter reaches zero.

void sigc::internal::signal_impl::unreference_exec | ( |  | ) | `[inline]`

Decrements the reference and execution counter.

Invokes sweep() if the execution counter reaches zero and the removal of one or more slots has been deferred.

bool sigc::internal::signal_impl::empty | ( |  | ) | const`[inline]`

Returns whether the list of slots is empty.

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

void sigc::internal::signal_impl::clear | ( |  | ) |

Empties the list of slots.

size_type sigc::internal::signal_impl::size | ( |  | ) | const

Returns the number of slots in the list.

Returns:
  The number of slots in the list.

iterator_type sigc::internal::signal_impl::connect | ( | const slot_base& | slot_ | ) |

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

Parameters:

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

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

iterator_type sigc::internal::signal_impl::insert | ( | iterator_type | i,
|  | const slot_base& | slot_ |
| ) |  |  |

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

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.

iterator_type sigc::internal::signal_impl::erase | ( | iterator_type | i | ) |

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

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.

void sigc::internal::signal_impl::sweep | ( |  | ) |

Removes invalid slots from the list of slots.

static void* sigc::internal::signal_impl::notify | ( | void * | d | ) | `[static]`

Callback that is executed when some slot becomes invalid.

This callback is registered in every slot when inserted into the list of slots. It is executed when a slot becomes invalid because of some referred object being destroyed. It either calls sweep() directly or defers the execution of sweep() when the signal is being emitted.

Parameters:

  | d | The signal object (`this`).

## Member Data Documentation

short sigc::internal::signal_impl::ref_count_

Reference counter.

The object is destroyed when ref_count_ reaches zero.

short sigc::internal::signal_impl::exec_count_

Execution counter.

Indicates whether the signal is being emitted.

bool sigc::internal::signal_impl::deferred_

Indicates whether the execution of sweep() is being deferred.

std::list<slot_base> sigc::internal::signal_impl::slots_

The list of slots.

The documentation for this struct was generated from the following file:

- signal_base.h