changed: gcc8 base update
[opensg.git] / Source / Base / FieldContainer / Fields / PointerFields / OSGChildAccessHandler.h
blob5ea0f0fb755da61da0968d7e2127cc879d885a86
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 #ifndef _OSGCHILDACCESSHANDLER_H_
40 #define _OSGCHILDACCESSHANDLER_H_
42 #ifdef __sgi
43 #pragma once
44 #endif
46 #include "OSGConfig.h"
48 OSG_BEGIN_NAMESPACE
50 // forward declarations
51 class PointerMFieldBase;
53 class PointerSFieldBase;
55 template <typename AccessHandlerT, Int32 NamespaceI>
56 class ChildPointerMFieldBase;
58 template <typename AccessHandlerT, Int32 NamespaceI>
59 class ChildPointerSFieldBase;
61 /*! \ingroup GrpBaseFieldContainerFields
62 \ingroup GrpLibOSGBase
63 \nohierarchy
66 template<typename RefCountPolicyT>
67 class ChildAccessHandler
69 /*========================== PUBLIC =================================*/
71 public:
73 /*---------------------------------------------------------------------*/
74 /*! \name Public Types */
75 /*! \{ */
77 typedef ChildAccessHandler Self;
79 typedef RefCountPolicyT RefCountPolicyType;
81 typedef PointerMFieldBase MFieldBaseType;
82 typedef PointerSFieldBase SFieldBaseType;
84 typedef ChildPointerMFieldBase <Self, 0> MFieldType;
85 typedef ChildPointerSFieldBase <Self, 0> SFieldType;
87 /*! \} */
88 /*---------------------------------------------------------------------*/
89 /*! \name Access Handling */
90 /*! \{ */
92 static void onAdd (SFieldBaseType * const pSField,
93 FieldContainer * const pObj );
94 static void onAdd (MFieldBaseType * const pMField,
95 FieldContainer * const pObj );
97 static void onSub (SFieldBaseType * const pSField,
98 FieldContainer * const pObj );
99 static void onSub (MFieldBaseType * const pMField,
100 FieldContainer * const pObj );
102 static void onReplace(SFieldBaseType * const pSField,
103 FieldContainer * const pOldObj,
104 FieldContainer * const pNewObj);
105 static void onReplace(MFieldBaseType * const pMField,
106 FieldContainer * const pOldObj,
107 FieldContainer * const pNewObj);
109 /*! \} */
110 /*---------------------------------------------------------------------*/
111 /*! \name Sync Access Handling */
112 /*! \{ */
114 static void onSyncAdd (SFieldBaseType * const pSField,
115 FieldContainer * const pObj );
116 static void onSyncAdd (MFieldBaseType * const pMField,
117 FieldContainer * const pObj );
119 static void onSyncSub (SFieldBaseType * const pSField,
120 FieldContainer * const pObj );
121 static void onSyncSub (MFieldBaseType * const pMField,
122 FieldContainer * const pObj );
124 static void onSyncReplace(SFieldBaseType * const pSField,
125 FieldContainer * const pOldObj,
126 FieldContainer * const pNewObj);
127 static void onSyncReplace(MFieldBaseType * const pMField,
128 FieldContainer * const pOldObj,
129 FieldContainer * const pNewObj);
131 /*! \} */
132 /*---------------------------------------------------------------------*/
134 template <class ObjectT>
135 static ObjectT *validate(ObjectT * const pObject)
137 return RefCountPolicyType::validate(pObject);
140 /*========================== PRIVATE ================================*/
142 private:
144 /*---------------------------------------------------------------------*/
145 /*! \name Internal Helper */
146 /*! \{ */
148 static SFieldType * dcastSField(SFieldBaseType * const pSField);
149 static MFieldType * dcastMField(MFieldBaseType * const pMField);
151 /*! \} */
152 /*---------------------------------------------------------------------*/
153 /*! \name Linking */
154 /*! \{ */
156 // static void unlinkChild (FieldContainerPtrConst pChild,
157 // UInt16 const parentFieldId );
158 static void linkParent (FieldContainer * const pParent,
159 UInt16 const childFieldId,
160 FieldContainer * const pChild,
161 UInt16 const parentFieldId);
162 static void unlinkParent(FieldContainer * const pParent,
163 FieldContainer * const pChild,
164 UInt16 const parentFieldId);
166 /*! \} */
167 /*---------------------------------------------------------------------*/
170 /*! \ingroup GrpBaseFieldContainerFields */
171 typedef ChildAccessHandler<UnrecordedRefCountPolicy> UnrecChildAccessHandler;
173 OSG_END_NAMESPACE
175 #include "OSGChildAccessHandler.inl"
177 #endif // _OSGCHILDACCESSHANDLER_H_