GA::kit v0.3
G&A's in-house C++ application framework
Loading...
Searching...
No Matches
sigslot::observer_base< Lockable > Struct Template Reference

#include <sigslot.hpp>

Inheritance diagram for sigslot::observer_base< Lockable >:
sigslot::detail::observer_type

Public Member Functions

virtual ~observer_base ()=default
 

Protected Member Functions

void disconnect_all ()
 

Friends

template<typename , typename ... >
class signal_base
 

Detailed Description

template<typename Lockable>
struct sigslot::observer_base< Lockable >

Observer is a base class for intrusive lifetime tracking of objects.

This is an alternative to trackable pointers, such as std::shared_ptr, and manual connection management by keeping connection objects in scope. Deriving from this class allows automatic disconnection of all the slots connected to any signal when an instance is destroyed.

Constructor & Destructor Documentation

◆ ~observer_base()

template<typename Lockable >
virtual sigslot::observer_base< Lockable >::~observer_base ( )
virtualdefault

Member Function Documentation

◆ disconnect_all()

template<typename Lockable >
void sigslot::observer_base< Lockable >::disconnect_all ( )
inlineprotected

Disconnect all signals connected to this object.

To avoid invocation of slots on a semi-destructed instance, which may happen in multi-threaded contexts, derived classes should call this method in their destructor. This will ensure proper disconnection prior to the destruction.

Friends And Related Function Documentation

◆ signal_base

template<typename Lockable >
template<typename , typename ... >
friend class signal_base
friend

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