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 \*---------------------------------------------------------------------------*/
41 /*! \class MemObjPointerSFieldCommon
45 /*-------------------------------------------------------------------------*/
48 template <class AccessHandlerT, Int32 NamespaceI> inline
49 MemObjPointerSFieldCommon<AccessHandlerT,
50 NamespaceI >::MemObjPointerSFieldCommon(void) :
55 template <class AccessHandlerT, Int32 NamespaceI> inline
56 MemObjPointerSFieldCommon<AccessHandlerT,
57 NamespaceI >::MemObjPointerSFieldCommon(
61 _fieldValue = source._fieldValue;
63 AccessHandler::onAdd(this, _fieldValue);
66 template <class AccessHandlerT, Int32 NamespaceI> inline
67 MemObjPointerSFieldCommon<AccessHandlerT,
68 NamespaceI >::MemObjPointerSFieldCommon(
74 AccessHandler::onAdd(this, _fieldValue);
77 /*-------------------------------------------------------------------------*/
80 template <class AccessHandlerT, Int32 NamespaceI> inline
81 MemObjPointerSFieldCommon<AccessHandlerT,
82 NamespaceI >::~MemObjPointerSFieldCommon(void)
84 AccessHandler::onSub(this, _fieldValue);
87 /*-------------------------------------------------------------------------*/
90 /*-------------------------------------------------------------------------*/
93 template <class AccessHandlerT, Int32 NamespaceI> inline
94 typename MemObjPointerSFieldCommon<AccessHandlerT,
95 NamespaceI >::value_type
96 MemObjPointerSFieldCommon<AccessHandlerT,
97 NamespaceI >::ptrStoreGet(void) const
99 return AccessHandler::validate(_fieldValue);
102 /*-------------------------------------------------------------------------*/
103 /* Changing Values */
105 template <class AccessHandlerT, Int32 NamespaceI> inline
106 void MemObjPointerSFieldCommon<AccessHandlerT,
107 NamespaceI >::ptrStoreSet(const_value pNewObj)
109 AccessHandler::onReplace(this, _fieldValue, pNewObj);
111 _fieldValue = pNewObj;
114 template <class AccessHandlerT, Int32 NamespaceI> inline
115 void MemObjPointerSFieldCommon<AccessHandlerT,
116 NamespaceI >::ptrStoreClear(void)
118 AccessHandler::onSub(this, _fieldValue);
124 /*-------------------------------------------------------------------------*/
128 template <class AccessHandlerT, Int32 NamespaceI> inline
129 void MemObjPointerSFieldCommon<AccessHandlerT,
130 NamespaceI >::copyFromBin(
131 BinaryDataHandler &pMem)
133 MemoryObject *pNewObj = NULL;
135 PtrBaseTraitsType::copyFromBin ( pMem,
138 AccessHandler ::onSyncReplace( this,
142 _fieldValue = pNewObj;
145 /*-------------------------------------------------------------------------*/
148 #ifdef OSG_MT_CPTR_ASPECT
149 template <class AccessHandlerT, Int32 NamespaceI> inline
150 void MemObjPointerSFieldCommon<AccessHandlerT,
151 NamespaceI >::syncWith(Self &source)
153 MemoryObject *pNewObj = convertToCurrentAspect(source.ptrStoreGet());
155 AccessHandler::onSyncReplace( this,
159 _fieldValue = pNewObj;