changed: gcc8 base update
[opensg.git] / Source / Base / FieldContainer / Fields / PointerFields / OSGPointerAccessHandler.inl
blobe694fac12bf8d559038dc78cfcba4adad3d6dcfc
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *                 Copyright (C) 2008 by the OpenSG Forum                    *
6  *                                                                           *
7  *                            www.opensg.org                                 *
8  *                                                                           *
9  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
10  *                                                                           *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13  *                                License                                    *
14  *                                                                           *
15  * This library is free software; you can redistribute it and/or modify it   *
16  * under the terms of the GNU Library General Public License as published    *
17  * by the Free Software Foundation, version 2.                               *
18  *                                                                           *
19  * This library is distributed in the hope that it will be useful, but       *
20  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
22  * Library General Public License for more details.                          *
23  *                                                                           *
24  * You should have received a copy of the GNU Library General Public         *
25  * License along with this library; if not, write to the Free Software       *
26  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
27  *                                                                           *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30  *                                Changes                                    *
31  *                                                                           *
32  *                                                                           *
33  *                                                                           *
34  *                                                                           *
35  *                                                                           *
36  *                                                                           *
37 \*---------------------------------------------------------------------------*/
39 OSG_BEGIN_NAMESPACE
41 /*-------------------------------------------------------------------------*/
42 /* Access Handling                                                         */
44 template<typename RefCountPolicyT> inline 
45 void PointerAccessHandler<RefCountPolicyT>::onAdd(
46     SFieldBaseType * const, 
47     FieldContainer * const pObj)
49     RefCountPolicyType::addRef(pObj);
52 template<typename RefCountPolicyT> inline 
53 void PointerAccessHandler<RefCountPolicyT>::onAdd(
54     MFieldBaseType * const, 
55     FieldContainer * const pObj)
57     RefCountPolicyType::addRef(pObj);
60 template<typename RefCountPolicyT> inline 
61 void PointerAccessHandler<RefCountPolicyT>::onSub(
62     SFieldBaseType * const, 
63     FieldContainer * const pObj)
65     RefCountPolicyType::subRef(pObj);
68 template<typename RefCountPolicyT> inline 
69 void PointerAccessHandler<RefCountPolicyT>::onSub(
70     MFieldBaseType * const, 
71     FieldContainer * const pObj)
73     RefCountPolicyType::subRef(pObj);
76 template<typename RefCountPolicyT> inline 
77 void PointerAccessHandler<RefCountPolicyT>::onReplace(
78     SFieldBaseType * const pSField,
79     FieldContainer * const pOldObj,
80     FieldContainer * const pNewObj)
82     onAdd(pSField, pNewObj);
83     onSub(pSField, pOldObj);
86 template<typename RefCountPolicyT> inline 
87 void PointerAccessHandler<RefCountPolicyT>::onReplace(
88     MFieldBaseType * const pMField,
89     FieldContainer * const pOldObj,
90     FieldContainer * const pNewObj)
92     onAdd(pMField, pNewObj);
93     onSub(pMField, pOldObj);
96 /*-------------------------------------------------------------------------*/
97 /* Sync Access Handling                                                    */
99 template<typename RefCountPolicyT> inline 
100 void PointerAccessHandler<RefCountPolicyT>::onSyncAdd(
101     SFieldBaseType * const pSField, 
102     FieldContainer * const pObj   )
104     onAdd(pSField, pObj);
107 template<typename RefCountPolicyT> inline 
108 void PointerAccessHandler<RefCountPolicyT>::onSyncAdd(
109     MFieldBaseType * const pMField, 
110     FieldContainer * const pObj   )
112     onAdd(pMField, pObj);
115 template<typename RefCountPolicyT> inline 
116 void PointerAccessHandler<RefCountPolicyT>::onSyncSub(
117     SFieldBaseType * const pSField, 
118     FieldContainer * const pObj   )
120     if(pObj != NULL)
121     {
122         Thread::getCurrentChangeList()->addDelayedSubRef<
123             RefCountPolicyT>(pObj);
124     }
126 //    onSub(pSField, pObj);
129 template<typename RefCountPolicyT> inline 
130 void PointerAccessHandler<RefCountPolicyT>::onSyncSub(
131     MFieldBaseType * const pMField, 
132     FieldContainer * const pObj   )
134     if(pObj != NULL)
135     {
136         Thread::getCurrentChangeList()->addDelayedSubRef<
137             RefCountPolicyT>(pObj);
138     }
140 //    onSub(pMField, pObj);
143 template<typename RefCountPolicyT> inline 
144 void PointerAccessHandler<RefCountPolicyT>::onSyncReplace(
145     SFieldBaseType * const pSField,
146     FieldContainer * const pOldObj,
147     FieldContainer * const pNewObj)
149     onSyncAdd(pSField, pNewObj);
150     onSyncSub(pSField, pOldObj);
153 template<typename RefCountPolicyT> inline 
154 void PointerAccessHandler<RefCountPolicyT>::onSyncReplace(
155     MFieldBaseType * const pMField,
156     FieldContainer * const pOldObj,
157     FieldContainer * const pNewObj)
159     onSyncAdd(pMField, pNewObj);
160     onSyncSub(pMField, pOldObj);
163 OSG_END_NAMESPACE