1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2008 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGPOINTERACCESSHANDLERDECL_H_
40 #define _OSGPOINTERACCESSHANDLERDECL_H_
46 #include "OSGConfig.h"
50 // forward declarations
51 class PointerMFieldBase
;
52 class PointerSFieldBase
;
54 /*! \ingroup GrpBaseFieldContainerFields
55 \ingroup GrpLibOSGBase
59 template<typename RefCountPolicyT
>
60 class PointerAccessHandler
62 /*========================== PUBLIC =================================*/
66 /*---------------------------------------------------------------------*/
67 /*! \name Public Types */
70 typedef PointerAccessHandler Self
;
72 typedef RefCountPolicyT RefCountPolicyType
;
74 typedef PointerMFieldBase MFieldBaseType
;
75 typedef PointerSFieldBase SFieldBaseType
;
78 /*---------------------------------------------------------------------*/
79 /*! \name Access Handling */
82 static void onAdd (SFieldBaseType
* const pSField
,
83 FieldContainer
* const pObj
);
84 static void onAdd (MFieldBaseType
* const pMField
,
85 FieldContainer
* const pObj
);
87 static void onSub (SFieldBaseType
* const pSField
,
88 FieldContainer
* const pObj
);
89 static void onSub (MFieldBaseType
* const pMField
,
90 FieldContainer
* const pObj
);
92 static void onReplace(SFieldBaseType
* const pSField
,
93 FieldContainer
* const pOldObj
,
94 FieldContainer
* const pNewObj
);
95 static void onReplace(MFieldBaseType
* const pMField
,
96 FieldContainer
* const pOldObj
,
97 FieldContainer
* const pNewObj
);
100 /*---------------------------------------------------------------------*/
101 /*! \name Sync Access Handling */
104 static void onSyncAdd (SFieldBaseType
* const pSField
,
105 FieldContainer
* const pObj
);
106 static void onSyncAdd (MFieldBaseType
* const pMField
,
107 FieldContainer
* const pObj
);
109 static void onSyncSub (SFieldBaseType
* const pSField
,
110 FieldContainer
* const pObj
);
111 static void onSyncSub (MFieldBaseType
* const pMField
,
112 FieldContainer
* const pObj
);
114 static void onSyncReplace(SFieldBaseType
* const pSField
,
115 FieldContainer
* const pOldObj
,
116 FieldContainer
* const pNewObj
);
117 static void onSyncReplace(MFieldBaseType
* const pMField
,
118 FieldContainer
* const pOldObj
,
119 FieldContainer
* const pNewObj
);
122 /*---------------------------------------------------------------------*/
124 template <class ObjectT
>
125 static ObjectT
*validate(ObjectT
* const pObject
)
127 return RefCountPolicyType::validate(pObject
);
131 /*! \ingroup GrpBaseFieldContainerFields */
132 typedef PointerAccessHandler
<NoRefCountPolicy
> NoRefCountAccessHandler
;
133 /*! \ingroup GrpBaseFieldContainerFields */
134 typedef PointerAccessHandler
<WeakRefCountPolicy
> WeakAccessHandler
;
135 /*! \ingroup GrpBaseFieldContainerFields */
136 typedef PointerAccessHandler
<UnrecordedRefCountPolicy
> UnrecordedAccessHandler
;
140 #include "OSGPointerAccessHandler.inl"
142 #endif // _OSGWEAKACCESSHANDLERDECL_H_