Main Page Groups Namespaces

# sigc::internal::slot_rep Struct Reference

Internal representation of a slot. More...

Inheritance diagram for sigc::internal::slot_rep:

[legend]
List of all members.

## Public Member Functions

| slot_rep (hook call__, hook destroy__, hook dup__)
| ~slot_rep ()
void | destroy ()
| Destroys the slot_rep object (but doesn't delete it).
slot_rep* | dup () const
| Makes a deep copy of the slot_rep object.
void | set_parent (void* parent, hook cleanup)
| Set the parent with a callback.
void | disconnect ()
| Invalidates the slot and executes the parent's cleanup callback.

## Static Public Member Functions

static void* | notify (void* data)
| Callback that invalidates the slot.

## Public Attributes

hook | call_
| Callback that invokes the contained functor.
hook | destroy_
| Callback that detaches the slot_rep object from referred trackables and destroys it.
hook | dup_
| Callback that makes a deep copy of the slot_rep object.
hook | cleanup_
| Callback of parent_.
void* | parent_
| Parent object whose callback cleanup_ is executed on notification.

## Detailed Description

Internal representation of a slot.

Derivations of this class can be considered as a link between a slot and the functor that the slot should execute in operator(). This link is needed because in libsigc++2 the slot doesn't necessarily have exactly the same function signature as the functor thus allowing for implicit conversions. The base class slot_rep serves the purpose to

- form a common pointer type (slot_rep*),
- offer the possibility to create duplicates (dup()),
- offer a notification callback (notify()),
- implement some of slot_base's interface that depends on the notification callback, i.e.
  1. the possibility to set a single parent with a callback (set_parent()) that is executed from notify(),
  2. a generic function pointer, call_, that is simply set to zero in notify() to invalidate the slot. slot_rep inherits trackable so that connection objects can refer to the slot and are notified when the slot is destroyed.

## Constructor & Destructor Documentation

sigc::internal::slot_rep::slot_rep | ( | hook | call__,
|  | hook | destroy__,
|  | hook | dup__ |
| ) |  |  | `[inline]`

sigc::internal::slot_rep::~slot_rep | ( |  | ) | `[inline]`

## Member Function Documentation

void sigc::internal::slot_rep::destroy | ( |  | ) | `[inline]`

Destroys the slot_rep object (but doesn't delete it).

slot_rep* sigc::internal::slot_rep::dup | ( |  | ) | const`[inline]`

Makes a deep copy of the slot_rep object.

Returns:
  A deep copy of the slot_rep object.

void sigc::internal::slot_rep::set_parent | ( | void * | parent,
|  | hook | cleanup |
| ) |  |  | `[inline]`

Set the parent with a callback.

slots have one parent exclusively.

Parameters:

  | parent | The new parent.
  | cleanup | The callback to execute from notify().

void sigc::internal::slot_rep::disconnect | ( |  | ) |

Invalidates the slot and executes the parent's cleanup callback.

static void* sigc::internal::slot_rep::notify | ( | void * | data | ) | `[static]`

Callback that invalidates the slot.

This callback is registered in every object of a trackable inherited type that is referred by this slot_rep object. It is executed when the slot becomes invalid because of some referred object dying.

Parameters:

  | data | The slot_rep object that is becoming invalid (`this`).

## Member Data Documentation

hook sigc::internal::slot_rep::call_

Callback that invokes the contained functor.

hook sigc::internal::slot_rep::destroy_

Callback that detaches the slot_rep object from referred trackables and destroys it.

hook sigc::internal::slot_rep::dup_

Callback that makes a deep copy of the slot_rep object.

Returns:
  A deep copy of the slot_rep object.

hook sigc::internal::slot_rep::cleanup_

Callback of parent_.

void* sigc::internal::slot_rep::parent_

Parent object whose callback cleanup_ is executed on notification.

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

- slot_base.h