libsigc++ 2.6.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

Classes
Signals

Use sigc::signal::connect() with sigc::mem_fun() and sigc::ptr_fun() to connect a method or function with a signal. More...

## Classes
struct | sigc::connection
| Convinience class for safe disconnection. More...
struct | sigc::nil
| nil struct type. More...
class | sigc::signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 >
| Convenience wrapper for the numbered sigc::signal# templates. More...
class | sigc::signal0< T_return, T_accumulator >
| Signal declaration. More...
class | sigc::signal1< T_return, T_arg1, T_accumulator >
| Signal declaration. More...
class | sigc::signal2< T_return, T_arg1, T_arg2, T_accumulator >
| Signal declaration. More...
class | sigc::signal3< T_return, T_arg1, T_arg2, T_arg3, T_accumulator >
| Signal declaration. More...
class | sigc::signal4< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_accumulator >
| Signal declaration. More...
class | sigc::signal5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator >
| Signal declaration. More...
class | sigc::signal6< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_accumulator >
| Signal declaration. More...
class | sigc::signal7< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7, T_accumulator >
| Signal declaration. More...
class | sigc::signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 >::accumulated< T_accumulator >
| Convenience wrapper for the numbered sigc::signal# templates. More...
struct | sigc::signal_base
| Base class for the sigc::signal# templates. More...
struct | sigc::slot_const_iterator< T_slot >
| STL-style const iterator for slot_list. More...
struct | sigc::slot_iterator< T_slot >
| STL-style iterator for slot_list. More...
struct | sigc::slot_list< T_slot >
| STL-style list interface for sigc::signal#. More...
struct | sigc::trackable
| Base class for objects with auto-disconnection. More...

## Detailed Description

Use sigc::signal::connect() with sigc::mem_fun() and sigc::ptr_fun() to connect a method or function with a signal.

signal_clicked.connect( sigc::mem_fun(*this, &MyWindow::on_clicked) );

When the signal is emitted your method will be called.

signal::connect() returns a connection, which you can later use to disconnect your method. If the type of your object inherits from sigc::trackable the method is disconnected automatically when your object is destroyed.

When signals are copied they share the underlying information, so you can have a protected/private sigc::signal member and a public accessor method. A sigc::signal is a kind of reference-counting pointer. It's similar to std::shared_ptr<>, although sigc::signal is restricted to holding a pointer to a sigc::internal::signal_impl object that contains the implementation of the signal.

class MyClass
{
public:
typedef sigc::signal<void> MySignalType;
MySignalType get_my_signal() { return m_my_signal; }
private:
MySignalType m_my_signal;
};

signal and slot objects provide the core functionality of this library. A slot is a container for an arbitrary functor. A signal is a list of slots that are executed on emission. For compile time type safety a list of template arguments must be provided for the signal template that determines the parameter list for emission. Functors and closures are converted into slots implicitly on connection, triggering compiler errors if the given functor or closure cannot be invoked with the parameter list of the signal to connect to.

Almost any functor with the correct signature can be converted to a sigc::slot and connected to a signal. See Slots and sigc::signal::connect().