2#ifndef LIBSBX_SIGNAL_CONNECTION_HPP_
3#define LIBSBX_SIGNAL_CONNECTION_HPP_
7#include <libsbx/signals/lockable.hpp>
8#include <libsbx/signals/slot_state.hpp>
10namespace sbx::signals {
23 : _state{std::move(other._state)} { }
33 _state.swap(other._state);
41 : _state{std::move(state)} {
42 if (
auto state = _state.lock()) {
47 void release()
noexcept {
48 if (
auto state = _state.lock()) {
55 std::weak_ptr<slot_state> _state;
61 template<lockable,
typename...>
78 bool is_valid()
const noexcept {
79 return !_state.expired();
82 bool is_connected()
const noexcept {
83 const auto state = _state.lock();
84 return state && state->is_connected();
87 bool disconnect()
noexcept {
88 auto state = _state.lock();
89 return state && state->disconnect();
92 bool is_blocked()
const noexcept {
93 const auto state = _state.lock();
94 return state && state->is_blocked();
97 void block()
noexcept {
98 if (
auto state = _state.lock()) {
103 void unblock()
noexcept {
104 if (
auto state = _state.lock()) {
115 explicit connection(std::weak_ptr<slot_state> state) noexcept
116 : _state{std::move(state)} { }
118 std::weak_ptr<slot_state> _state;
124 template <lockable,
typename...>
149 _state.swap(other._state);
Definition: connection.hpp:12
Definition: connection.hpp:59
Definition: connection.hpp:122
Definition: signal.hpp:17