libsigc++: sigc::slot_base Class Reference
Base type for slots. More...
#include <sigc++/functors/slot_base.h>

Public Types | |
| typedef trackable::func_destroy_notify | func_destroy_notify |
Public Member Functions | |
| slot_base () | |
| Constructs an empty slot. More... | |
| slot_base (rep_type* rep) | |
| Constructs a slot from an existing slot_rep object. More... | |
| slot_base (const slot_base& src) | |
| Constructs a slot, copying an existing one. More... | |
| ~slot_base () | |
| void | add_destroy_notify_callback (void* data, func_destroy_notify func) const |
| Add a callback that is executed (notified) when the slot is detroyed. More... | |
| bool | block (bool should_block=true) |
| Sets the blocking state. More... | |
| bool | blocked () const |
| Returns whether the slot is blocked. More... | |
| void | disconnect () |
| Disconnects the slot. More... | |
| bool | empty () const |
| Returns whether the slot is invalid. More... | |
| operator bool () const | |
| Tests whether a slot is null, because the default constructor was used. More... | |
| slot_base& | operator= (const slot_base& src) |
| Overrides this slot making a copy from another slot. More... | |
| void | remove_destroy_notify_callback (void* data) const |
| Remove a callback previously installed with add_destroy_notify_callback(). More... | |
| void | set_parent (void* parent, void*(* cleanup)(void*)) const |
| Sets the parent of this slot. More... | |
| bool | unblock () |
| Unsets the blocking state. More... | |
Public Attributes | |
| bool | blocked_ |
| Indicates whether the slot is blocked. More... | |
| rep_type* | rep_ |
| Typed slot_rep object that contains a functor. More... | |
Detailed Description
Base type for slots.
slot_base integrates most of the interface of the derived sigc::slot templates. slots can be connected to signals, be disconnected at some later point (disconnect()) and temporarily be blocked (block(), unblock()). The validity of a slot can be tested with empty().
The internal representation of a sigc::internal::slot_rep derived type is built from slot_base's derivations. set_parent() is used to register a notification callback that is executed when the slot gets invalid. add_destroy_notify_callback() is used by connection objects to add a notification callback that is executed on destruction.
Member Typedef Documentation
Constructor & Destructor Documentation
| sigc::slot_base::slot_base | ( | ) |
Constructs an empty slot.
|
explicit |
Constructs a slot from an existing slot_rep object.
- Parameters
-
rep The slot_rep object this slot should contain.
| sigc::slot_base::slot_base | ( | const slot_base& | src | ) |
Constructs a slot, copying an existing one.
- Parameters
-
src The existing slot to copy.
| sigc::slot_base::~slot_base | ( | ) |
Member Function Documentation
| void sigc::slot_base::add_destroy_notify_callback | ( | void * | data, |
| func_destroy_notify | func | ||
| ) | const |
Add a callback that is executed (notified) when the slot is detroyed.
This function is used internally by connection objects.
- Parameters
-
data Passed into func upon notification. func Callback executed upon destruction of the object.
| bool sigc::slot_base::block | ( | bool | should_block = true | ) |
Sets the blocking state.
If should_block is true then the blocking state is set. Subsequent calls to slot::operator()() don't invoke the functor contained by this slot until unblock() or block() with should_block = false is called.
- Parameters
-
should_block Indicates whether the blocking state should be set or unset.
- Returns
trueif the slot was in blocking state before.
|
inline |
Returns whether the slot is blocked.
- Returns
trueif the slot is blocked.
| void sigc::slot_base::disconnect | ( | ) |
Disconnects the slot.
Invalidates the slot and notifies the parent.
|
inline |
Returns whether the slot is invalid.
- Returns
trueif the slot is invalid (empty).
| sigc::slot_base::operator bool | ( | ) | const |
Tests whether a slot is null, because the default constructor was used.
Test a slot for null like so:
Overrides this slot making a copy from another slot.
- Parameters
-
src The slot from which to make a copy.
- Returns
this.
| void sigc::slot_base::remove_destroy_notify_callback | ( | void * | data | ) | const |
Remove a callback previously installed with add_destroy_notify_callback().
The callback is not executed.
- Parameters
-
data Parameter passed into previous call to add_destroy_notify_callback().
| void sigc::slot_base::set_parent | ( | void * | parent, |
| void *(*)(void *) | cleanup | ||
| ) | const |
Sets the parent of this slot.
This function is used by signals to register a notification callback. This notification callback is executed when the slot becomes invalid because of some referred object dying.
- Parameters
-
parent The new parent. cleanup The notification callback.
| bool sigc::slot_base::unblock | ( | ) |
Unsets the blocking state.
- Returns
trueif the slot was in blocking state before.
Member Data Documentation
| bool sigc::slot_base::blocked_ |
Indicates whether the slot is blocked.
|
mutable |
Typed slot_rep object that contains a functor.
