xref: /aoo42x/main/vos/inc/vos/refobj.inl (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
28
29template <class T>
30ORefObj<T>::ORefObj(const T& Obj)
31{
32	m_Obj = Obj;
33
34	m_RefCount.acquire();
35}
36
37template <class T>
38inline ORefObj<T>::~ORefObj()
39{
40	VOS_ASSERT(m_RefCount.referenced() == 0);
41}
42
43template <class T>
44inline T& ORefObj<T>::operator=(const T& Obj)
45{
46	m_Obj = Obj;
47
48	return m_Obj;
49}
50
51template <class T>
52inline ORefObj<T>::operator T&()
53{
54	return m_Obj;
55}
56
57template <class T>
58inline ORefObj<T>::operator const T&() const
59{
60	return m_Obj;
61}
62
63template <class T>
64inline T& ORefObj<T>::operator() ()
65{
66	return m_Obj;
67}
68
69template <class T>
70inline const T& ORefObj<T>::operator() () const
71{
72	return m_Obj;
73}
74
75template <class T>
76inline T& ORefObj<T>::getObj()
77{
78	return m_Obj;
79}
80
81template <class T>
82inline const T& ORefObj<T>::getObj() const
83{
84	return m_Obj;
85}
86
87