1#ifndef LIBSBX_SIGNAL_CONNECTION_HPP_
2#define LIBSBX_SIGNAL_CONNECTION_HPP_
6#include <libsbx/signals/lockable.hpp>
7#include <libsbx/signals/slot_state.hpp>
9namespace sbx::signals {
22 : _state{std::move(other._state)} { }
32 _state.swap(other._state);
40 : _state{std::move(state)} {
41 if (
auto state = _state.lock()) {
46 void release()
noexcept {
47 if (
auto state = _state.lock()) {
54 std::weak_ptr<slot_state> _state;
60 template<lockable,
typename...>
77 bool is_valid()
const noexcept {
78 return !_state.expired();
81 bool is_connected()
const noexcept {
82 const auto state = _state.lock();
83 return state && state->is_connected();
86 bool disconnect()
noexcept {
87 auto state = _state.lock();
88 return state && state->disconnect();
91 bool is_blocked()
const noexcept {
92 const auto state = _state.lock();
93 return state && state->is_blocked();
96 void block()
noexcept {
97 if (
auto state = _state.lock()) {
102 void unblock()
noexcept {
103 if (
auto state = _state.lock()) {
114 explicit connection(std::weak_ptr<slot_state> state) noexcept
115 : _state{std::move(state)} { }
117 std::weak_ptr<slot_state> _state;
123 template <lockable,
typename...>
148 _state.swap(other._state);
Definition: connection.hpp:11
Definition: connection.hpp:58
Definition: connection.hpp:121
Definition: signal.hpp:16