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