xref: /aoo42x/main/vos/inc/vos/refobj.inl (revision 45373f17)
1*45373f17SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3*45373f17SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*45373f17SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*45373f17SAndrew Rist * distributed with this work for additional information
6*45373f17SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*45373f17SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*45373f17SAndrew Rist * "License"); you may not use this file except in compliance
9*45373f17SAndrew Rist * with the License.  You may obtain a copy of the License at
10*45373f17SAndrew Rist *
11*45373f17SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*45373f17SAndrew Rist *
13*45373f17SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*45373f17SAndrew Rist * software distributed under the License is distributed on an
15*45373f17SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*45373f17SAndrew Rist * KIND, either express or implied.  See the License for the
17*45373f17SAndrew Rist * specific language governing permissions and limitations
18*45373f17SAndrew Rist * under the License.
19*45373f17SAndrew Rist *
20*45373f17SAndrew Rist *************************************************************/
21*45373f17SAndrew Rist
22*45373f17SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir
25cdf0e10cSrcweirtemplate <class T>
26cdf0e10cSrcweirORefObj<T>::ORefObj(const T& Obj)
27cdf0e10cSrcweir{
28cdf0e10cSrcweir	m_Obj = Obj;
29cdf0e10cSrcweir
30cdf0e10cSrcweir	m_RefCount.acquire();
31cdf0e10cSrcweir}
32cdf0e10cSrcweir
33cdf0e10cSrcweirtemplate <class T>
34cdf0e10cSrcweirinline ORefObj<T>::~ORefObj()
35cdf0e10cSrcweir{
36cdf0e10cSrcweir	VOS_ASSERT(m_RefCount.referenced() == 0);
37cdf0e10cSrcweir}
38cdf0e10cSrcweir
39cdf0e10cSrcweirtemplate <class T>
40cdf0e10cSrcweirinline T& ORefObj<T>::operator=(const T& Obj)
41cdf0e10cSrcweir{
42cdf0e10cSrcweir	m_Obj = Obj;
43cdf0e10cSrcweir
44cdf0e10cSrcweir	return m_Obj;
45cdf0e10cSrcweir}
46cdf0e10cSrcweir
47cdf0e10cSrcweirtemplate <class T>
48cdf0e10cSrcweirinline ORefObj<T>::operator T&()
49cdf0e10cSrcweir{
50cdf0e10cSrcweir	return m_Obj;
51cdf0e10cSrcweir}
52cdf0e10cSrcweir
53cdf0e10cSrcweirtemplate <class T>
54cdf0e10cSrcweirinline ORefObj<T>::operator const T&() const
55cdf0e10cSrcweir{
56cdf0e10cSrcweir	return m_Obj;
57cdf0e10cSrcweir}
58cdf0e10cSrcweir
59cdf0e10cSrcweirtemplate <class T>
60cdf0e10cSrcweirinline T& ORefObj<T>::operator() ()
61cdf0e10cSrcweir{
62cdf0e10cSrcweir	return m_Obj;
63cdf0e10cSrcweir}
64cdf0e10cSrcweir
65cdf0e10cSrcweirtemplate <class T>
66cdf0e10cSrcweirinline const T& ORefObj<T>::operator() () const
67cdf0e10cSrcweir{
68cdf0e10cSrcweir	return m_Obj;
69cdf0e10cSrcweir}
70cdf0e10cSrcweir
71cdf0e10cSrcweirtemplate <class T>
72cdf0e10cSrcweirinline T& ORefObj<T>::getObj()
73cdf0e10cSrcweir{
74cdf0e10cSrcweir	return m_Obj;
75cdf0e10cSrcweir}
76cdf0e10cSrcweir
77cdf0e10cSrcweirtemplate <class T>
78cdf0e10cSrcweirinline const T& ORefObj<T>::getObj() const
79cdf0e10cSrcweir{
80cdf0e10cSrcweir	return m_Obj;
81cdf0e10cSrcweir}
82cdf0e10cSrcweir
83