basic implementation of fast_signal, enqueueing in the event_loop doesn't work yet.
[beacon-ss.git] / beacon / detail / connection_impl.hpp
blobe0a0067ace0e85287cf44d18ea1d8c0e61421fe3
1 /**
2 * beacon
3 * Author: Lukas Krejci <krejci.l@centrum.cz>, (C) 2008
4 * Copyright: See COPYING file that comes with this distribution
5 */
7 #ifndef BEACON_connection_impl_H
8 #define BEACON_connection_impl_H
10 #include <beacon/config.hpp>
11 #include <beacon/intrusive_ptr.hpp>
12 #include <beacon/detail/connection_impl_base.hpp>
13 #include <beacon/detail/signal_base.hpp>
15 namespace beacon {
17 namespace detail {
19 class connection_impl : public connection_impl_base {
20 friend class signal_base;
21 public:
22 bool connected() const {
23 return _connected;
26 #ifdef ENABLE_CONNECTION_BLOCKING
27 bool blocked() const {
28 return _blocked;
31 void block() {
32 _blocked = true;
35 void unblock() {
36 _blocked = false;
38 #endif
40 void disconnect() {
41 if (_connected) {
42 _connected = false;
43 _signal->do_disconnect(_position);
47 private:
49 connection_impl(signal_base * signal, signal_base::slot_list_type::iterator pos) :
50 _signal(signal),
51 _position(pos),
52 _connected(true)
53 #ifdef ENABLE_CONNECTION_BLOCKING
54 ,_blocked(false)
55 #endif
58 signal_base * _signal;
59 signal_base::slot_list_type::iterator _position;
61 bool _connected;
62 #ifdef ENABLE_CONNECTION_BLOCKING
63 bool _blocked;
64 #endif
67 } //namespace detail
69 } //namespace beacon
71 #endif