Bitcoin Core 31.99.0
P2P Digital Currency
Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
btcsignals::connection Class Reference

#include <btcsignals.h>

Classes

class  liveness
 Track liveness. More...
 

Public Member Functions

constexpr connection () noexcept=default
 The default constructor creates a connection with no associated signal. More...
 
void disconnect ()
 If a callback is associated with this connection, prevent it from being called in the future. More...
 
bool connected () const
 Returns true if this connection was created by a signal and has not been disabled. More...
 

Private Member Functions

 connection (std::shared_ptr< liveness > &&state)
 Only a signal can create an enabled connection. More...
 

Private Attributes

std::shared_ptr< livenessm_state {}
 connections have shared_ptr-like copy and move semantics. More...
 

Friends

template<typename Signature , typename Combiner >
class signal
 

Detailed Description

Definition at line 55 of file btcsignals.h.

Constructor & Destructor Documentation

◆ connection() [1/2]

btcsignals::connection::connection ( std::shared_ptr< liveness > &&  state)
inlineexplicitprivate

Only a signal can create an enabled connection.

Definition at line 80 of file btcsignals.h.

◆ connection() [2/2]

constexpr btcsignals::connection::connection ( )
constexprdefaultnoexcept

The default constructor creates a connection with no associated signal.

Member Function Documentation

◆ connected()

bool btcsignals::connection::connected ( ) const
inline

Returns true if this connection was created by a signal and has not been disabled.

Definition at line 109 of file btcsignals.h.

Here is the caller graph for this function:

◆ disconnect()

void btcsignals::connection::disconnect ( )
inline

If a callback is associated with this connection, prevent it from being called in the future.

If a connection is disabled as part of a signal's callback function, it will not be executed in the current signal invocation.

Note that disconnected callbacks are not removed from their owning signals here. They are garbage collected in signal::connect().

Definition at line 98 of file btcsignals.h.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ signal

template<typename Signature , typename Combiner >
friend class signal
friend

Definition at line 58 of file btcsignals.h.

Member Data Documentation

◆ m_state

std::shared_ptr<liveness> btcsignals::connection::m_state {}
private

connections have shared_ptr-like copy and move semantics.

Definition at line 75 of file btcsignals.h.


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