libsigc++  2.10.8
Public Types | Public Member Functions | List of all members
sigc::trackable Struct Reference

Base class for objects with auto-disconnection. More...

#include <sigc++/trackable.h>

Inheritance diagram for sigc::trackable:
Inheritance graph
[legend]

Public Types

typedef internal::func_destroy_notify func_destroy_notify
 

Public Member Functions

 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...
 
trackableoperator= (const trackable & src)
 
trackableoperator= (trackable && src)
 
void remove_destroy_notify_callback (void *data) const
 Remove a callback previously installed with add_destroy_notify_callback(). More...
 

Detailed Description

Base class for objects with auto-disconnection.

trackable must be inherited when objects shall automatically invalidate slots referring to them on destruction. A slot built from a member function of a trackable derived type installs a callback that is invoked when the trackable object is destroyed or overwritten.

add_destroy_notify_callback() and remove_destroy_notify_callback() can be used to manually install and remove callbacks when notification of the object dying is needed.

notify_callbacks() invokes and removes all previously installed callbacks and can therefore be used to disconnect from all signals.

Note that there is no virtual destructor. Don't use trackable* as pointer type for managing your data or the destructors of your derived types won't be called when deleting your objects.

Member Typedef Documentation

◆ func_destroy_notify

typedef internal::func_destroy_notify sigc::trackable::func_destroy_notify

Constructor & Destructor Documentation

◆ trackable() [1/3]

sigc::trackable::trackable ( )
noexcept

◆ trackable() [2/3]

sigc::trackable::trackable ( const trackable src)
noexcept

◆ trackable() [3/3]

sigc::trackable::trackable ( trackable &&  src)

◆ ~trackable()

sigc::trackable::~trackable ( )

Member Function Documentation

◆ add_destroy_notify_callback()

void sigc::trackable::add_destroy_notify_callback ( void *  data,
func_destroy_notify  func 
) const

Add a callback that is executed (notified) when the trackable object is detroyed.

Parameters
dataPassed into func upon notification.
funcCallback executed upon destruction of the object.

◆ notify_callbacks()

void sigc::trackable::notify_callbacks ( )

Execute and remove all previously installed callbacks.

◆ operator=() [1/2]

trackable& sigc::trackable::operator= ( const trackable src)

◆ operator=() [2/2]

trackable& sigc::trackable::operator= ( trackable &&  src)

◆ remove_destroy_notify_callback()

void sigc::trackable::remove_destroy_notify_callback ( void *  data) const

Remove a callback previously installed with add_destroy_notify_callback().

The callback is not executed.

Parameters
dataParameter passed into previous call to add_destroy_notify_callback().