c++-gtk-utils
Public Member Functions | Friends | List of all members
Cgu::Releaser Class Reference

A class used for tracking EmitterArg and SafeEmitterArg connections. More...

#include <c++-gtk-utils/emitter.h>

Public Member Functions

Releaseroperator= (const Releaser &r)
 
 Releaser (const Releaser &r)
 
 Releaser ()=default
 
 ~Releaser ()
 

Friends

template<class... T>
class EmitterArg
 
template<class... T>
class SafeEmitterArg
 

Detailed Description

A class used for tracking EmitterArg and SafeEmitterArg connections.

See also
EmitterArg SafeEmitterArg
emitter.h
Callback namespace

This class provides tracking of EmitterArg and SafeEmitterArg connections. It should be a public member of any target class which wants functors representing any of its methods to be disconnected automatically from an EmitterArg or SafeEmitterArg object when the target class object is destroyed, and is passed as one of the arguments to the connect() method of EmitterArg or SafeEmitterArg.

All its methods are thread-safe.

For further background, read this: emitter.h

Constructor & Destructor Documentation

◆ Releaser() [1/2]

Cgu::Releaser::Releaser ( const Releaser r)
inline

This does not copy anything from the Releaser object passed as an argument - see the notes on assignment for an explanation of why. This does not throw.

Parameters
rA Releaser object.
Exceptions
std::bad_allocThis constructor might throw std::bad_alloc if memory is exhausted and the system throws in that case.
Thread::MutexErrorThis constructor might throw Thread::MutexError if initialisation of the contained mutex fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.)

◆ Releaser() [2/2]

Cgu::Releaser::Releaser ( )
default
Exceptions
std::bad_allocThe default constructor might throw std::bad_alloc if memory is exhausted and the system throws in that case.
Thread::MutexErrorThe default constructor might throw Thread::MutexError if initialisation of the contained mutex fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.)

◆ ~Releaser()

Cgu::Releaser::~Releaser ( )

The destructor does not throw provided that the destructors of any bound arguments of a functor managed by this Releaser object do not throw (as they should not do), and assuming that merely iterating through an unordered_set does not throw (as it would not on any sane implementation).

Member Function Documentation

◆ operator=()

Releaser& Cgu::Releaser::operator= ( const Releaser r)

See notes on assignment to see how this operates. This does not throw provided that the destructors of any bound arguments of a functor managed by this Releaser object prior to assignment do not throw (as they should not do), and assuming that merely iterating through a list does not throw (as it would not on any sane implementation).

Parameters
rThe assignee.

Friends And Related Function Documentation

◆ EmitterArg

template<class... T>
friend class EmitterArg
friend

◆ SafeEmitterArg

template<class... T>
friend class SafeEmitterArg
friend

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