sigx++
2.0.1
Main Page
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
sigx
connection_wrapper.h
Go to the documentation of this file.
1
#ifndef _SIGX_CONNECTION_HPP_
2
#define _SIGX_CONNECTION_HPP_
3
4
/*
5
* Copyright 2006 Klaus Triendl
6
*
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Library General Public
9
* License as published by the Free Software Foundation; either
10
* version 2 of the License, or (at your option) any later version.
11
*
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Library General Public License for more details.
16
*
17
* You should have received a copy of the GNU Library General Public
18
* License along with this library; if not, write to the Free
19
* Software Foundation, 51 Franklin Street, Fifth Floor,
20
* Boston, MA 02110-1301, USA.
21
*/
22
23
#include <tr1/memory>
// std::tr1::shared_ptr
24
#include <sigxconfig.h>
25
#include <
sigx/fwddecl.h
>
26
#include <
sigx/shared_dispatchable.h
>
27
28
29
namespace
sigx
30
{
31
35
class
SIGX_API
connection_wrapper
36
{
37
private
:
38
// volatile because the value should be always read from the variable itself;
39
// this is necessary because the sigc::connection* is "late bound", i.e.
40
// it is set by the server thread after an asynchronous "connect" message.
41
// When the next tunnel functor is created (let's say with disconnect())
42
// then m_sigc_conn is dereferenced (*m_sigc_conn) and the actual pointer
43
// value (the sigc::connection*) is treated volatile at the other side of
44
// the tunnel (at the server thread's side).
45
// It is const because the connection_wrapper object doesn't modify the pointer.
46
typedef
std::tr1::shared_ptr<const volatile sigc_connection_ptr> shared_sigc_conn_ptr;
47
48
49
public
:
52
connection_wrapper
();
56
connection_wrapper
(
const
shared_dispatchable
& _A_disp,
const
shared_sigc_conn_ptr& _A_conn);
59
connection_wrapper
(
const
connection_wrapper
& other)
throw
();
60
64
~
connection_wrapper
()
throw
();
65
68
connection_wrapper
& operator =(
const
connection_wrapper
& other);
69
70
public
:
74
bool
empty()
const
;
75
79
bool
connected()
const
;
80
84
bool
blocked()
const
;
85
89
bool
block(
bool
should_block =
true
);
90
94
bool
unblock();
95
99
void
disconnect();
100
105
operator
bool();
106
107
protected
:
108
void
destroy_self();
109
110
111
private
:
113
shared_sigc_conn_ptr m_sigc_conn;
116
shared_dispatchable
m_shared_disp;
119
volatile
int
* m_sigcconn_refcount;
120
};
121
122
123
}
// namespace sigx
124
125
126
#endif // end file guard
Generated on Mon Sep 2 2013 01:02:21 for sigx++ by
1.8.4