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 _OSGMEMOBJPOINTERACCESSHANDLERDECL_H_
40 #define _OSGMEMOBJPOINTERACCESSHANDLERDECL_H_
46 #include "OSGConfig.h"
50 // forward declarations
51 class MemObjPointerMFieldBase
;
52 class MemObjPointerSFieldBase
;
54 /*! \ingroup GrpBaseMemoryObjectsFields
55 \ingroup GrpLibOSGBase
59 template<typename RefCountPolicyT
>
60 class MemObjPointerAccessHandler
62 /*========================== PUBLIC =================================*/
66 /*---------------------------------------------------------------------*/
67 /*! \name Public Types */
70 typedef MemObjPointerAccessHandler Self
;
72 typedef RefCountPolicyT RefCountPolicyType
;
74 typedef MemObjPointerMFieldBase MFieldBaseType
;
75 typedef MemObjPointerSFieldBase SFieldBaseType
;
78 /*---------------------------------------------------------------------*/
79 /*! \name Access Handling */
82 static void onAdd (SFieldBaseType
* const pSField
,
83 MemoryObject
* const pObj
);
84 static void onAdd (MFieldBaseType
* const pMField
,
85 MemoryObject
* const pObj
);
87 static void onSub (SFieldBaseType
* const pSField
,
88 MemoryObject
* const pObj
);
89 static void onSub (MFieldBaseType
* const pMField
,
90 MemoryObject
* const pObj
);
92 static void onReplace(SFieldBaseType
* const pSField
,
93 MemoryObject
* const pOldObj
,
94 MemoryObject
* const pNewObj
);
95 static void onReplace(MFieldBaseType
* const pMField
,
96 MemoryObject
* const pOldObj
,
97 MemoryObject
* const pNewObj
);
100 /*---------------------------------------------------------------------*/
101 /*! \name Sync Access Handling */
104 static void onSyncAdd (SFieldBaseType
* const pSField
,
105 MemoryObject
* const pObj
);
106 static void onSyncAdd (MFieldBaseType
* const pMField
,
107 MemoryObject
* const pObj
);
109 static void onSyncSub (SFieldBaseType
* const pSField
,
110 MemoryObject
* const pObj
);
111 static void onSyncSub (MFieldBaseType
* const pMField
,
112 MemoryObject
* const pObj
);
114 static void onSyncReplace(SFieldBaseType
* const pSField
,
115 MemoryObject
* const pOldObj
,
116 MemoryObject
* const pNewObj
);
117 static void onSyncReplace(MFieldBaseType
* const pMField
,
118 MemoryObject
* const pOldObj
,
119 MemoryObject
* const pNewObj
);
122 /*---------------------------------------------------------------------*/
124 template <class ObjectT
>
125 static ObjectT
*validate(ObjectT
* const pObject
)
127 return RefCountPolicyType::validate(pObject
);
133 #include "OSGMemObjPointerAccessHandler.inl"
135 #endif // _OSGMEMOBJPOINTERACCESSHANDLER_H_