xref: /aoo41x/main/udkapi/com/sun/star/uno/XWeak.idl (revision cdf0e10c)
1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27#ifndef __com_sun_star_uno_XWeak_idl__
28#define __com_sun_star_uno_XWeak_idl__
29
30#ifndef __com_sun_star_uno_XInterface_idl__
31#include <com/sun/star/uno/XInterface.idl>
32#endif
33
34#ifndef __com_sun_star_uno_XAdapter_idl__
35#include <com/sun/star/uno/XAdapter.idl>
36#endif
37
38
39//=============================================================================
40
41 module com {  module sun {  module star {  module uno {
42
43//=============================================================================
44
45// DocMerge from xml: interface com::sun::star::uno::XWeak
46/** the server-side interface to a weak object.
47
48
49
50	<p>This interface is proxy to the adapted object.
51	In order to make it possible to have weak references to objects,
52	the <type>XAdapter</type> interface must be implemented to provide
53	a weak adapter for the clients.
54
55	<h4>Concept of weak referencing:</h4>
56
57	</p>
58	<p>This module specifies the interfaces for implementing and using
59	weak references.</p>
60	<p>
61
62	</p>
63	<p>The sense of weak references is to hold a reference to an object
64	without affecting the lifetime of the object. That means that a weak
65	reference may become invalid, at any time, if the referenced object dies.
66
67	</p>
68	<p>The following interfaces describe one way to handle weak references
69	by providing a weak adapter. The weak object has to provide this
70	adapter if anyone wants to hold a weak reference. To separate their
71	lifetimes, the adapter and the original object must not share the same
72	reference counter.  The weak reference is in fact only a hard reference
73	to the adapter, which knows - but does not hold - the original object.
74	That means that the implementation and synchronization of weak
75	referencing is the responsibility of the object.  The following
76	interfaces are involved in the concept of weak referencing:
77
78	<dl>
79	<dt>
80	<type>XWeak</type>
81	</dt>
82	<dd>is the server-side interface of the referred object. This
83	referred object must support the <type>XAdapter</type> interface.
84
85	</dd>
86	<dt>
87	<type>XReference</type>
88	</dt>
89	<dd>is a client-side interface which must be implemented by
90	the holder of any weak reference. It is used for notification
91	when the adapted object dies.
92
93	</dd>
94	</dl>
95	</p>
96 */
97published interface XWeak: com::sun::star::uno::XInterface
98{
99	//-------------------------------------------------------------------------
100
101	// DocMerge from xml: method com::sun::star::uno::XWeak::queryAdapter
102	/** queries the weak adapter.
103
104
105
106		<p>It is important that the adapter must know, but not hold
107		the adapted object. If the adapted object dies, all references
108		to the adapter have to be notified to release the adapter.
109
110		</p>
111	 */
112	com::sun::star::uno::XAdapter queryAdapter();
113
114};
115
116//=============================================================================
117
118}; }; }; };
119
120/*=============================================================================
121
122=============================================================================*/
123#endif
124