34#if defined __clang__ || (__GNUC__ > 5)
35#define SIGSLOT_MAY_ALIAS __attribute__((__may_alias__))
37#define SIGSLOT_MAY_ALIAS
40#if defined(__GXX_RTTI) || defined(__cpp_rtti) || defined(_CPPRTTI)
41#define SIGSLOT_RTTI_ENABLED 1
66std::weak_ptr<T>
to_weak(std::weak_ptr<T> w) {
71std::weak_ptr<T>
to_weak(std::shared_ptr<T> s) {
82template <
typename...T>
85template <
typename,
typename =
void>
92template <
typename,
typename,
typename =
void,
typename =
void>
95template <
typename F,
typename P,
typename... T>
97 void_t<decltype(((*std::declval<P>()).*std::declval<F>())(std::declval<T>()...))>>
100template <
typename F,
typename... T>
102 void_t<decltype(
std::declval<F>()(std::declval<T>()...))>>
106template <
typename T,
typename =
void>
111 decltype(std::declval<T>().lock()),
112 decltype(std::declval<T>().reset())>>
115template <
typename T,
typename =
void>
120 :
is_weak_ptr<decltype(to_weak(std::declval<T>()))> {};
124static constexpr bool with_rtti =
125#ifdef SIGSLOT_RTTI_ENABLED
136template <
typename L,
typename... T>
152constexpr bool is_pmf_v = std::is_member_function_pointer<T>::value;
156 std::remove_pointer_t<T>>::value;
160template <
typename,
typename...>
185struct a {
virtual ~a() =
default;
void f();
virtual void g(); };
186struct b {
virtual ~b() =
default;
virtual void h(); };
187struct c :
a,
b {
void g()
override; };
213 template <
typename T>
215 return *
static_cast<T*
>(value());
218 template <
typename T>
220 return *
static_cast<const T*
>(value());
223 inline explicit operator bool()
const {
224 return value() !=
nullptr;
228 return std::equal(std::begin(data), std::end(data), std::begin(o.
data));
236template <
typename T,
typename =
void>
239 d.
value<std::nullptr_t>() =
nullptr;
242 static constexpr bool is_disconnectable =
false;
243 static constexpr bool must_check_object =
true;
252 static constexpr bool is_disconnectable =
true;
253 static constexpr bool must_check_object =
false;
262 static constexpr bool is_disconnectable =
true;
263 static constexpr bool must_check_object =
false;
272 static constexpr bool is_disconnectable = trait::with_rtti;
273 static constexpr bool must_check_object =
true;
279 using call_type =
decltype(&std::remove_reference<T>::type::operator());
292 std::uninitialized_fill(std::begin(d.
data), std::end(d.
data),
'\0');
307template <
typename T,
typename =
void>
317 return reinterpret_cast<obj_ptr>(t);
331 !trait::is_weak_ptr_v<T> &&
332 trait::is_weak_ptr_compatible_v<T>>>
335 return t ?
reinterpret_cast<obj_ptr>(t.get()) :
nullptr;
354 inline
bool try_lock() noexcept {
return true; }
372 void lock() noexcept {
374 while (!state.load(std::memory_order_relaxed)) {
375 std::this_thread::yield();
385 return state.exchange(
false, std::memory_order_acquire);
389 state.store(
true, std::memory_order_release);
393 std::atomic<bool> state {
true};
405 template <
typename... Args>
406 explicit payload(Args && ...args)
407 : value(std::forward<Args>(args)...)
410 std::atomic<std::size_t> count{1};
418 : m_data(new payload)
421 template <
typename U>
422 explicit copy_on_write(U && x, std::enable_if_t<!std::is_same<std::decay_t<U>,
424 : m_data(new payload(
std::forward<U>(x)))
440 if (m_data && (--m_data->count == 0)) {
453 auto tmp = std::move(x);
462 return m_data->value;
466 return m_data->value;
471 swap(x.m_data, y.m_data);
475 bool unique() const noexcept {
476 return m_data->count == 1;
513#ifdef SIGSLOT_REDUCE_COMPILE_TIME
514template <
typename B,
typename D,
typename ...Arg>
515inline std::shared_ptr<B> make_shared(Arg && ... arg) {
516 return std::shared_ptr<B>(
static_cast<B*
>(
new D(std::forward<Arg>(arg)...)));
519template <
typename B,
typename D,
typename ...Arg>
521 return std::static_pointer_cast<B>(std::make_shared<D>(std::forward<Arg>(arg)...));
539 virtual bool connected() const noexcept {
return m_connected; }
542 bool ret = m_connected.exchange(
false);
549 bool blocked() const noexcept {
return m_blocked.load(); }
550 void block() noexcept { m_blocked.store(
true); }
551 void unblock() noexcept { m_blocked.store(
false); }
569 template <
typename,
typename...>
570 friend class ::sigslot::signal_base;
574 std::atomic<bool> m_connected;
575 std::atomic<bool> m_blocked;
592 : m_state{std::move(o.m_state)}
597 m_state.swap(o.m_state);
604 : m_state{std::move(s)}
606 if (
auto d = m_state.lock()) {
611 void release() noexcept {
612 if (
auto d = m_state.lock()) {
618 std::weak_ptr<detail::slot_state> m_state;
639 bool valid() const noexcept {
640 return !m_state.expired();
644 const auto d = m_state.lock();
645 return d && d->connected();
649 auto d = m_state.lock();
650 return d && d->disconnect();
654 const auto d = m_state.lock();
655 return d && d->blocked();
659 if (
auto d = m_state.lock()) {
665 if (
auto d = m_state.lock()) {
676 explicit connection(std::weak_ptr<detail::slot_state> s) noexcept
677 : m_state{std::move(s)}
707 m_state.swap(o.m_state);
726template <
typename Lockable>
739 std::unique_lock<Lockable> _{m_mutex};
740 m_connections.clear();
744 template <
typename,
typename ...>
748 std::unique_lock<Lockable> _{m_mutex};
749 m_connections.emplace_back(std::move(conn));
753 std::vector<scoped_connection> m_connections;
775template <
typename...>
778template <
typename... T>
786template <
typename... Args>
801 template <
typename... U>
803 if (slot_state::connected() && !slot_state::blocked()) {
804 call_slot(std::forward<U>(u)...);
809 template <
typename C>
812 auto p = get_callable();
813 return cp && p && cp == p;
816 template <
typename C>
817 std::enable_if_t<function_traits<C>::must_check_object,
bool>
819 return has_callable(c) && check_class_type<std::decay_t<C>>();
822 template <
typename C>
823 std::enable_if_t<!function_traits<C>::must_check_object,
bool>
825 return has_callable(c);
829 template <
typename O>
849#ifdef SIGSLOT_RTTI_ENABLED
851 virtual const std::type_info& get_callable_type() const noexcept {
852 return typeid(
nullptr);
856 template <
typename U>
857 bool check_class_type()
const {
858 return typeid(U) == get_callable_type();
862 template <
typename U>
876template <
typename Func,
typename... Args>
879 template <
typename F,
typename G
id>
882 , func{
std::forward<F>(f)} {}
893#ifdef SIGSLOT_RTTI_ENABLED
894 const std::type_info& get_callable_type() const noexcept
override {
900 std::decay_t<Func> func;
906template <
typename Func,
typename... Args>
909 template <
typename F>
912 , func{
std::forward<F>(f)} {}
925#ifdef SIGSLOT_RTTI_ENABLED
926 const std::type_info& get_callable_type() const noexcept
override {
932 std::decay_t<Func> func;
940template <
typename Pmf,
typename Ptr,
typename... Args>
943 template <
typename F,
typename P>
946 , pmf{
std::forward<F>(f)}
947 , ptr{
std::forward<P>(p)} {}
951 ((*ptr).*pmf)(args...);
962#ifdef SIGSLOT_RTTI_ENABLED
963 const std::type_info& get_callable_type() const noexcept
override {
969 std::decay_t<Pmf> pmf;
970 std::decay_t<Ptr> ptr;
976template <
typename Pmf,
typename Ptr,
typename... Args>
979 template <
typename F,
typename P>
982 , pmf{
std::forward<F>(f)}
983 , ptr{
std::forward<P>(p)} {}
989 ((*ptr).*pmf)(conn, args...);
999#ifdef SIGSLOT_RTTI_ENABLED
1000 const std::type_info& get_callable_type() const noexcept
override {
1006 std::decay_t<Pmf> pmf;
1007 std::decay_t<Ptr> ptr;
1015template <
typename Func,
typename WeakPtr,
typename... Args>
1018 template <
typename F,
typename P>
1021 , func{
std::forward<F>(f)}
1022 , ptr{
std::forward<P>(p)}
1026 return !ptr.expired() && slot_state::connected();
1031 auto sp = ptr.lock();
1033 slot_state::disconnect();
1036 if (slot_state::connected()) {
1049#ifdef SIGSLOT_RTTI_ENABLED
1050 const std::type_info& get_callable_type() const noexcept
override {
1051 return typeid(func);
1056 std::decay_t<Func> func;
1057 std::decay_t<WeakPtr> ptr;
1065template <
typename Pmf,
typename WeakPtr,
typename... Args>
1068 template <
typename F,
typename P>
1071 , pmf{
std::forward<F>(f)}
1072 , ptr{
std::forward<P>(p)}
1076 return !ptr.expired() && slot_state::connected();
1081 auto sp = ptr.lock();
1083 slot_state::disconnect();
1086 if (slot_state::connected()) {
1087 ((*sp).*pmf)(args...);
1099#ifdef SIGSLOT_RTTI_ENABLED
1100 const std::type_info& get_callable_type() const noexcept
override {
1106 std::decay_t<Pmf> pmf;
1107 std::decay_t<WeakPtr> ptr;
1133template <
typename Lockable,
typename... T>
1135 template <
typename L>
1136 using is_thread_safe = std::integral_constant<bool, !std::is_same<L, detail::null_mutex>::value>;
1138 template <
typename U,
typename L>
1139 using cow_type = std::conditional_t<is_thread_safe<L>::value,
1142 template <
typename U,
typename L>
1143 using cow_copy_type = std::conditional_t<is_thread_safe<L>::value,
1146 using lock_type = std::unique_lock<Lockable>;
1149 using slots_type = std::vector<slot_ptr>;
1150 struct group_type { slots_type slts;
group_id gid; };
1151 using list_type = std::vector<group_type>;
1166 : m_block{o.m_block.load()}
1168 lock_type lock(o.m_mutex);
1170 swap(m_slots, o.m_slots);
1174 lock_type lock1(m_mutex, std::defer_lock);
1175 lock_type lock2(o.m_mutex, std::defer_lock);
1176 std::lock(lock1, lock2);
1179 swap(m_slots, o.m_slots);
1180 m_block.store(o.m_block.exchange(m_block.load()));
1196 template <
typename... U>
1204 cow_copy_type<list_type, Lockable> ref = slots_reference();
1207 for (
const auto &s : group.slts) {
1208 s->operator()(a...);
1224 template <
typename Callable>
1225 std::enable_if_t<trait::is_callable_v<arg_list, Callable>,
connection>
1228 auto s = make_slot<slot_t>(std::forward<Callable>(c), gid);
1230 add_slot(std::move(s));
1244 template <
typename Callable>
1245 std::enable_if_t<trait::is_callable_v<ext_arg_list, Callable>,
connection>
1248 auto s = make_slot<slot_t>(std::forward<Callable>(c), gid);
1250 std::static_pointer_cast<slot_t>(s)->conn = conn;
1251 add_slot(std::move(s));
1264 template <
typename Pmf,
typename Ptr>
1265 std::enable_if_t<trait::is_callable_v<arg_list, Pmf, Ptr> &&
1269 auto s = make_slot<slot_t>(std::forward<Pmf>(pmf), std::forward<Ptr>(ptr), gid);
1271 add_slot(std::move(s));
1272 ptr->add_connection(conn);
1284 template <
typename Pmf,
typename Ptr>
1285 std::enable_if_t<trait::is_callable_v<arg_list, Pmf, Ptr> &&
1286 !trait::is_observer_v<Ptr> &&
1287 !trait::is_weak_ptr_compatible_v<Ptr>,
connection>
1290 auto s = make_slot<slot_t>(std::forward<Pmf>(pmf), std::forward<Ptr>(ptr), gid);
1292 add_slot(std::move(s));
1304 template <
typename Pmf,
typename Ptr>
1305 std::enable_if_t<trait::is_callable_v<ext_arg_list, Pmf, Ptr> &&
1306 !trait::is_weak_ptr_compatible_v<Ptr>,
connection>
1309 auto s = make_slot<slot_t>(std::forward<Pmf>(pmf), std::forward<Ptr>(ptr), gid);
1311 std::static_pointer_cast<slot_t>(s)->conn = conn;
1312 add_slot(std::move(s));
1333 template <
typename Pmf,
typename Ptr>
1334 std::enable_if_t<!trait::is_callable_v<arg_list, Pmf> &&
1335 trait::is_weak_ptr_compatible_v<Ptr>,
connection>
1338 auto w = to_weak(std::forward<Ptr>(ptr));
1340 auto s = make_slot<slot_t>(std::forward<Pmf>(pmf), w, gid);
1342 add_slot(std::move(s));
1363 template <
typename Callable,
typename Trackable>
1364 std::enable_if_t<trait::is_callable_v<arg_list, Callable> &&
1365 trait::is_weak_ptr_compatible_v<Trackable>,
connection>
1368 auto w = to_weak(std::forward<Trackable>(ptr));
1370 auto s = make_slot<slot_t>(std::forward<Callable>(c), w, gid);
1372 add_slot(std::move(s));
1380 template <
typename... CallArgs>
1382 return connect(std::forward<CallArgs>(args)...);
1399 template <
typename Callable>
1400 std::enable_if_t<(trait::is_callable_v<arg_list, Callable> ||
1401 trait::is_callable_v<ext_arg_list, Callable> ||
1402 trait::is_pmf_v<Callable>) &&
1405 return disconnect_if([&] (
const auto &s) {
1406 return s->has_full_callable(c);
1422 template <
typename Obj>
1423 std::enable_if_t<!trait::is_callable_v<arg_list, Obj> &&
1424 !trait::is_callable_v<ext_arg_list, Obj> &&
1425 !trait::is_pmf_v<Obj>,
size_t>
1427 return disconnect_if([&] (
const auto &s) {
1428 return s->has_object(obj);
1445 template <
typename Callable,
typename Obj>
1447 return disconnect_if([&] (
const auto &s) {
1448 return s->has_object(obj) && s->has_callable(c);
1462 lock_type lock(m_mutex);
1464 if (group.gid == gid) {
1465 size_t count = group.slts.size();
1478 lock_type lock(m_mutex);
1487 m_block.store(
true);
1495 m_block.store(
false);
1502 return m_block.load();
1510 cow_copy_type<list_type, Lockable> ref = slots_reference();
1513 count += g.slts.size();
1523 lock_type lock(m_mutex);
1524 const auto idx = state->
index();
1525 const auto gid = state->
group();
1529 if (group.gid == gid) {
1530 auto &slts = group.slts;
1533 if (idx < slts.size() && slts[idx] && slts[idx].get() == state) {
1535 slts[idx]->index() = idx;
1546 inline cow_copy_type<list_type, Lockable> slots_reference() {
1547 lock_type lock(m_mutex);
1552 template <
typename Slot,
typename... A>
1553 inline auto make_slot(A && ...a) {
1554 return detail::make_shared<slot_base, Slot>(*
this, std::forward<A>(a)...);
1558 void add_slot(slot_ptr &&s) {
1561 lock_type lock(m_mutex);
1565 auto it = groups.begin();
1566 while (it != groups.end() && it->gid < gid) {
1571 if (it == groups.end() || it->gid != gid) {
1572 it = groups.insert(it, {{}, gid});
1576 s->index() = it->slts.size();
1577 it->slts.push_back(std::move(s));
1581 template <
typename Cond>
1582 size_t disconnect_if(Cond && cond) {
1583 lock_type lock(m_mutex);
1588 for (
auto &group : groups) {
1589 auto &slts = group.slts;
1591 while (i < slts.size()) {
1592 if (cond(slts[i])) {
1594 slts[i]->index() = i;
1613 cow_type<list_type, Lockable> m_slots;
1614 std::atomic<bool> m_block;
1623template <
typename... T>
1632template <
typename... T>
Definition: sigslot.hpp:583
~connection_blocker() noexcept
Definition: sigslot.hpp:586
connection_blocker(const connection_blocker &)=delete
connection_blocker(connection_blocker &&o) noexcept
Definition: sigslot.hpp:591
connection_blocker & operator=(connection_blocker &&o) noexcept
Definition: sigslot.hpp:595
friend class connection
Definition: sigslot.hpp:602
connection_blocker()=default
connection_blocker & operator=(const connection_blocker &)=delete
Definition: sigslot.hpp:629
void block() noexcept
Definition: sigslot.hpp:658
void unblock() noexcept
Definition: sigslot.hpp:664
bool blocked() const noexcept
Definition: sigslot.hpp:653
connection(const connection &) noexcept=default
bool disconnect() noexcept
Definition: sigslot.hpp:648
virtual ~connection()=default
connection(std::weak_ptr< detail::slot_state > s) noexcept
Definition: sigslot.hpp:676
connection(connection &&) noexcept=default
connection_blocker blocker() const noexcept
Definition: sigslot.hpp:670
bool connected() const noexcept
Definition: sigslot.hpp:643
friend class signal_base
Definition: sigslot.hpp:675
std::weak_ptr< detail::slot_state > m_state
Definition: sigslot.hpp:681
connection & operator=(const connection &) noexcept=default
Definition: sigslot.hpp:401
friend void swap(copy_on_write &x, copy_on_write &y) noexcept
Definition: sigslot.hpp:469
copy_on_write(copy_on_write &&x) noexcept
Definition: sigslot.hpp:433
copy_on_write()
Definition: sigslot.hpp:417
copy_on_write & operator=(const copy_on_write &x) noexcept
Definition: sigslot.hpp:445
element_type & write()
Definition: sigslot.hpp:458
copy_on_write(const copy_on_write &x) noexcept
Definition: sigslot.hpp:427
const element_type & read() const noexcept
Definition: sigslot.hpp:465
copy_on_write(U &&x, std::enable_if_t<!std::is_same< std::decay_t< U >, copy_on_write >::value > *=nullptr)
Definition: sigslot.hpp:422
copy_on_write & operator=(copy_on_write &&x) noexcept
Definition: sigslot.hpp:452
T element_type
Definition: sigslot.hpp:415
~copy_on_write()
Definition: sigslot.hpp:439
Definition: sigslot.hpp:787
virtual obj_ptr get_object() const noexcept
Definition: sigslot.hpp:840
bool has_object(const O &o) const
Definition: sigslot.hpp:830
std::enable_if_t< function_traits< C >::must_check_object, bool > has_full_callable(const C &c) const
Definition: sigslot.hpp:818
bool has_callable(const C &c) const
Definition: sigslot.hpp:810
void do_disconnect() final
Definition: sigslot.hpp:835
slot_base(cleanable &c, group_id gid)
Definition: sigslot.hpp:791
~slot_base() override=default
void operator()(U &&...u)
Definition: sigslot.hpp:802
bool check_class_type() const
Definition: sigslot.hpp:863
virtual func_ptr get_callable() const noexcept
Definition: sigslot.hpp:845
std::enable_if_t<!function_traits< C >::must_check_object, bool > has_full_callable(const C &c) const
Definition: sigslot.hpp:824
virtual void call_slot(Args...)=0
Definition: sigslot.hpp:907
func_ptr get_callable() const noexcept override
Definition: sigslot.hpp:921
connection conn
Definition: sigslot.hpp:914
constexpr slot_extended(cleanable &c, F &&f, group_id gid)
Definition: sigslot.hpp:910
void call_slot(Args ...args) override
Definition: sigslot.hpp:917
Definition: sigslot.hpp:977
connection conn
Definition: sigslot.hpp:985
func_ptr get_callable() const noexcept override
Definition: sigslot.hpp:992
obj_ptr get_object() const noexcept override
Definition: sigslot.hpp:995
constexpr slot_pmf_extended(cleanable &c, F &&f, P &&p, group_id gid)
Definition: sigslot.hpp:980
void call_slot(Args ...args) override
Definition: sigslot.hpp:988
Definition: sigslot.hpp:1066
void call_slot(Args ...args) override
Definition: sigslot.hpp:1080
obj_ptr get_object() const noexcept override
Definition: sigslot.hpp:1095
bool connected() const noexcept override
Definition: sigslot.hpp:1075
constexpr slot_pmf_tracked(cleanable &c, F &&f, P &&p, group_id gid)
Definition: sigslot.hpp:1069
func_ptr get_callable() const noexcept override
Definition: sigslot.hpp:1091
Definition: sigslot.hpp:941
obj_ptr get_object() const noexcept override
Definition: sigslot.hpp:958
func_ptr get_callable() const noexcept override
Definition: sigslot.hpp:954
constexpr slot_pmf(cleanable &c, F &&f, P &&p, group_id gid)
Definition: sigslot.hpp:944
void call_slot(Args ...args) override
Definition: sigslot.hpp:950
Definition: sigslot.hpp:528
auto index() const
Definition: sigslot.hpp:556
group_id group() const
Definition: sigslot.hpp:564
void unblock() noexcept
Definition: sigslot.hpp:551
auto & index()
Definition: sigslot.hpp:560
void block() noexcept
Definition: sigslot.hpp:550
virtual void do_disconnect()
Definition: sigslot.hpp:554
bool disconnect() noexcept
Definition: sigslot.hpp:541
virtual bool connected() const noexcept
Definition: sigslot.hpp:539
constexpr slot_state(group_id gid) noexcept
Definition: sigslot.hpp:530
bool blocked() const noexcept
Definition: sigslot.hpp:549
virtual ~slot_state()=default
Definition: sigslot.hpp:1016
bool connected() const noexcept override
Definition: sigslot.hpp:1025
constexpr slot_tracked(cleanable &c, F &&f, P &&p, group_id gid)
Definition: sigslot.hpp:1019
void call_slot(Args ...args) override
Definition: sigslot.hpp:1030
obj_ptr get_object() const noexcept override
Definition: sigslot.hpp:1045
func_ptr get_callable() const noexcept override
Definition: sigslot.hpp:1041
Definition: sigslot.hpp:877
void call_slot(Args ...args) override
Definition: sigslot.hpp:885
constexpr slot(cleanable &c, F &&f, Gid gid)
Definition: sigslot.hpp:880
func_ptr get_callable() const noexcept override
Definition: sigslot.hpp:889
Definition: sigslot.hpp:688
scoped_connection(scoped_connection &&o) noexcept
Definition: sigslot.hpp:701
~scoped_connection() override
Definition: sigslot.hpp:691
scoped_connection(const connection &c) noexcept
Definition: sigslot.hpp:695
scoped_connection & operator=(scoped_connection &&o) noexcept
Definition: sigslot.hpp:705
scoped_connection(const scoped_connection &) noexcept=delete
scoped_connection()=default
scoped_connection & operator=(const scoped_connection &) noexcept=delete
friend class signal_base
Definition: sigslot.hpp:712
scoped_connection(connection &&c) noexcept
Definition: sigslot.hpp:696
Definition: sigslot.hpp:1134
std::enable_if_t<(trait::is_callable_v< arg_list, Callable >||trait::is_callable_v< ext_arg_list, Callable >||trait::is_pmf_v< Callable >) &&detail::function_traits< Callable >::is_disconnectable, size_t > disconnect(const Callable &c)
Definition: sigslot.hpp:1404
signal_base & operator=(signal_base &&o)
Definition: sigslot.hpp:1173
bool blocked() const noexcept
Definition: sigslot.hpp:1501
size_t slot_count() noexcept
Definition: sigslot.hpp:1509
std::enable_if_t< trait::is_callable_v< arg_list, Pmf, Ptr > &&!trait::is_observer_v< Ptr > &&!trait::is_weak_ptr_compatible_v< Ptr >, connection > connect(Pmf &&pmf, Ptr &&ptr, group_id gid=0)
Definition: sigslot.hpp:1288
void disconnect_all()
Definition: sigslot.hpp:1477
void operator()(U &&...a)
Definition: sigslot.hpp:1197
signal_base & operator=(const signal_base &)=delete
signal_base(signal_base &&o)
Definition: sigslot.hpp:1165
void clean(detail::slot_state *state) override
Definition: sigslot.hpp:1522
signal_base() noexcept
Definition: sigslot.hpp:1157
scoped_connection connect_scoped(CallArgs &&...args)
Definition: sigslot.hpp:1381
std::enable_if_t< trait::is_callable_v< arg_list, Callable >, connection > connect(Callable &&c, group_id gid=0)
Definition: sigslot.hpp:1226
std::enable_if_t<!trait::is_callable_v< arg_list, Pmf > &&trait::is_weak_ptr_compatible_v< Ptr >, connection > connect(Pmf &&pmf, Ptr &&ptr, group_id gid=0)
Definition: sigslot.hpp:1336
std::enable_if_t< trait::is_callable_v< ext_arg_list, Callable >, connection > connect_extended(Callable &&c, group_id gid=0)
Definition: sigslot.hpp:1246
signal_base(const signal_base &)=delete
std::enable_if_t<!trait::is_callable_v< arg_list, Obj > &&!trait::is_callable_v< ext_arg_list, Obj > &&!trait::is_pmf_v< Obj >, size_t > disconnect(const Obj &obj)
Definition: sigslot.hpp:1426
std::enable_if_t< trait::is_callable_v< ext_arg_list, Pmf, Ptr > &&!trait::is_weak_ptr_compatible_v< Ptr >, connection > connect_extended(Pmf &&pmf, Ptr &&ptr, group_id gid=0)
Definition: sigslot.hpp:1307
void block() noexcept
Definition: sigslot.hpp:1486
~signal_base() override
Definition: sigslot.hpp:1158
size_t disconnect(group_id gid)
Definition: sigslot.hpp:1461
std::enable_if_t< trait::is_callable_v< arg_list, Callable > &&trait::is_weak_ptr_compatible_v< Trackable >, connection > connect(Callable &&c, Trackable &&ptr, group_id gid=0)
Definition: sigslot.hpp:1366
void unblock() noexcept
Definition: sigslot.hpp:1494
std::enable_if_t< trait::is_callable_v< arg_list, Pmf, Ptr > &&trait::is_observer_v< Ptr >, connection > connect(Pmf &&pmf, Ptr &&ptr, group_id gid=0)
Definition: sigslot.hpp:1267
size_t disconnect(const Callable &c, const Obj &obj)
Definition: sigslot.hpp:1446
func_ptr get_function_ptr(const T &t)
Definition: sigslot.hpp:290
std::shared_ptr< slot_base< T... > > slot_ptr
Definition: sigslot.hpp:779
const T & cow_read(const T &v)
Definition: sigslot.hpp:487
T & cow_write(T &v)
Definition: sigslot.hpp:497
std::shared_ptr< B > make_shared(Arg &&... arg)
Definition: sigslot.hpp:520
obj_ptr get_object_ptr(const T &t)
Definition: sigslot.hpp:340
const void * obj_ptr
Definition: sigslot.hpp:302
typename detail::voider< T... >::type void_t
Definition: sigslot.hpp:83
constexpr bool is_pointer_v
Definition: sigslot.hpp:146
std::weak_ptr< T > to_weak(std::weak_ptr< T > w)
Definition: sigslot.hpp:66
constexpr bool is_func_v
Definition: sigslot.hpp:149
constexpr bool is_weak_ptr_compatible_v
determine if a pointer is convertible into a "weak" pointer
Definition: sigslot.hpp:133
constexpr bool has_call_operator_v
Definition: sigslot.hpp:143
constexpr bool is_observer_v
Definition: sigslot.hpp:155
constexpr bool is_pmf_v
Definition: sigslot.hpp:152
constexpr bool is_callable_v
determine if a type T (Callable or Pmf) is callable with supplied arguments
Definition: sigslot.hpp:137
constexpr bool is_weak_ptr_v
Definition: sigslot.hpp:140
Definition: sigslot.hpp:45
std::int32_t group_id
Definition: sigslot.hpp:166
Definition: crossguid.cpp:388
void swap(xg::Guid &lhs, xg::Guid &rhs) noexcept
Definition: crossguid.cpp:390
#define SIGSLOT_MAY_ALIAS
Definition: sigslot.hpp:37
Definition: sigslot.hpp:770
virtual ~cleanable()=default
virtual void clean(slot_state *)=0
decltype(&std::remove_reference< T >::type::operator()) call_type
Definition: sigslot.hpp:279
static void ptr(const T &, func_ptr &d)
Definition: sigslot.hpp:281
static void ptr(T &t, func_ptr &d)
Definition: sigslot.hpp:248
static void ptr(const T &t, func_ptr &d)
Definition: sigslot.hpp:268
static void ptr(T *t, func_ptr &d)
Definition: sigslot.hpp:258
Definition: sigslot.hpp:237
static void ptr(const T &, func_ptr &d)
Definition: sigslot.hpp:238
Definition: sigslot.hpp:185
Definition: sigslot.hpp:186
Definition: sigslot.hpp:187
Definition: sigslot.hpp:346
null_mutex() noexcept=default
void unlock() noexcept
Definition: sigslot.hpp:356
void lock() noexcept
Definition: sigslot.hpp:355
static obj_ptr get(const T &t)
Definition: sigslot.hpp:323
static obj_ptr get(const T &t)
Definition: sigslot.hpp:334
static obj_ptr get(const T *t)
Definition: sigslot.hpp:316
Definition: sigslot.hpp:308
static obj_ptr get(const T &)
Definition: sigslot.hpp:309
Definition: sigslot.hpp:50
Definition: sigslot.hpp:364
bool try_lock() noexcept
Definition: sigslot.hpp:384
spin_mutex() noexcept=default
void unlock() noexcept
Definition: sigslot.hpp:388
Definition: sigslot.hpp:727
friend class signal_base
Definition: sigslot.hpp:745
void disconnect_all()
Definition: sigslot.hpp:738
virtual ~observer_base()=default
Definition: sigslot.hpp:86
Definition: sigslot.hpp:93
Definition: sigslot.hpp:116
Definition: sigslot.hpp:107
Definition: sigslot.hpp:79
void type
Definition: sigslot.hpp:79
represent a list of types
Definition: sigslot.hpp:57
Definition: sigslot.hpp:204
mock::fun_types _
Definition: sigslot.hpp:231
bool operator==(const func_ptr &o) const
Definition: sigslot.hpp:227
const void * value() const
Definition: sigslot.hpp:209
void * value()
Definition: sigslot.hpp:205
T & value()
Definition: sigslot.hpp:214
const T & value() const
Definition: sigslot.hpp:219
char data[sizeof(mock::fun_types)]
Definition: sigslot.hpp:232
Definition: sigslot.hpp:189
void * o
Definition: sigslot.hpp:194