libsigc++
2.10.8
|
Base class for the sigc::signal# templates. More...
#include <sigc++/signal_base.h>
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 () noexcept | |
signal_base (const signal_base & src) noexcept | |
signal_base (signal_base && src) | |
~signal_base () | |
void | block (bool should_block=true) noexcept |
Sets the blocking state of all slots in the list. More... | |
bool | blocked () const noexcept |
Returns whether all slots in the list are blocked. More... | |
void | clear () |
Empties the list of slots. More... | |
bool | empty () const noexcept |
Returns whether the list of slots is empty. More... | |
signal_base & | operator= (const signal_base & src) |
signal_base & | operator= (signal_base && src) |
size_type | size () const noexcept |
Returns the number of slots in the list. More... | |
void | unblock () noexcept |
Unsets the blocking state of all slots in the list. More... | |
Public Member Functions inherited from sigc::trackable | |
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... | |
trackable & | operator= (const trackable & src) |
trackable & | operator= (trackable && src) |
void | remove_destroy_notify_callback (void *data) const |
Remove a callback previously installed with add_destroy_notify_callback(). More... | |
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. More... | |
iterator_type | connect (slot_base && slot_) |
Adds a slot at the end of the list of slots. More... | |
iterator_type | erase (iterator_type i) |
Removes the slot at the given position from the list of slots. More... | |
internal::signal_impl * | impl () const |
Returns the signal_impl object encapsulating the list of slots. More... | |
iterator_type | insert (iterator_type i, const slot_base & slot_) |
Adds a slot at the given position into the list of slots. More... | |
iterator_type | insert (iterator_type i, slot_base && slot_) |
Adds a slot at the given position into the list of slots. More... | |
Protected Attributes | |
internal::signal_impl * | impl_ |
The signal_impl object encapsulating the slot list. More... | |
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.
sigc::internal::signal_impl is reference-counted. When a sigc::signal# object is copied, the reference count of its sigc::internal::signal_impl object is incremented. Both sigc::signal# objects then refer to the same sigc::internal::signal_impl object.
Deleting the signal during emission, e.g. from one of its slots, may result in memory leaks. This drawback is fixed in version 3 of libsigc++. A workaround is to make a copy of the signal during the emission:
This is not very costly. A sigc::signal<> is not much more than a pointer to a sigc::internal::signal_impl instance, which is not copied.
|
protected |
typedef std::size_t sigc::signal_base::size_type |
|
noexcept |
|
noexcept |
sigc::signal_base::signal_base | ( | signal_base && | src | ) |
sigc::signal_base::~signal_base | ( | ) |
|
noexcept |
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.
should_block | Indicates whether the blocking state should be set or unset. |
|
noexcept |
Returns whether all slots in the list are blocked.
true
if all slots are blocked or the list is empty.void sigc::signal_base::clear | ( | ) |
Empties the list of slots.
|
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.
slot_ | The slot to add to the list of slots. |
|
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.
slot_ | The slot to add to the list of slots. |
|
inlinenoexcept |
Returns whether the list of slots is empty.
true
if the list of slots is empty.
|
protected |
Removes the slot at the given position from the list of slots.
Note that this function does not work during signal emission!
i | An iterator pointing to the slot to be removed. |
|
protected |
Returns the signal_impl object encapsulating the list of slots.
|
protected |
Adds a slot at the given position into the list of slots.
Note that this function does not work during signal emission!
i | An iterator indicating the position where slot_ should be inserted. |
slot_ | The slot to add to the list of slots. |
|
protected |
Adds a slot at the given position into the list of slots.
Note that this function does not work during signal emission!
i | An iterator indicating the position where slot_ should be inserted. |
slot_ | The slot to add to the list of slots. |
signal_base& sigc::signal_base::operator= | ( | const signal_base & | src | ) |
signal_base& sigc::signal_base::operator= | ( | signal_base && | src | ) |
|
noexcept |
Returns the number of slots in the list.
|
noexcept |
Unsets the blocking state of all slots in the list.
|
mutableprotected |
The signal_impl object encapsulating the slot list.