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 PointerSFieldCommon
45 /*-------------------------------------------------------------------------*/
48 template <class AccessHandlerT, Int32 NamespaceI> inline
49 PointerSFieldCommon<AccessHandlerT,
50 NamespaceI >::PointerSFieldCommon(void) :
55 template <class AccessHandlerT, Int32 NamespaceI> inline
56 PointerSFieldCommon<AccessHandlerT,
57 NamespaceI >::PointerSFieldCommon(const Self &source) :
60 _fieldValue = source._fieldValue;
62 AccessHandler::onAdd(this, _fieldValue);
65 template <class AccessHandlerT, Int32 NamespaceI> inline
66 PointerSFieldCommon<AccessHandlerT,
67 NamespaceI >::PointerSFieldCommon(const_value value) :
72 AccessHandler::onAdd(this, _fieldValue);
75 /*-------------------------------------------------------------------------*/
78 template <class AccessHandlerT, Int32 NamespaceI> inline
79 PointerSFieldCommon<AccessHandlerT,
80 NamespaceI >::~PointerSFieldCommon(void)
82 AccessHandler::onSub(this, _fieldValue);
85 /*-------------------------------------------------------------------------*/
88 /*-------------------------------------------------------------------------*/
91 template <class AccessHandlerT, Int32 NamespaceI> inline
92 typename PointerSFieldCommon<AccessHandlerT,
93 NamespaceI >::value_type
94 PointerSFieldCommon<AccessHandlerT,
95 NamespaceI >::ptrStoreGet(void) const
97 return AccessHandler::validate(_fieldValue);
100 /*-------------------------------------------------------------------------*/
101 /* Changing Values */
103 template <class AccessHandlerT, Int32 NamespaceI> inline
104 void PointerSFieldCommon<AccessHandlerT,
105 NamespaceI >::ptrStoreSet(const_value pNewObj)
107 AccessHandler::onReplace(this, _fieldValue, pNewObj);
109 _fieldValue = pNewObj;
112 template <class AccessHandlerT, Int32 NamespaceI> inline
113 void PointerSFieldCommon<AccessHandlerT,
114 NamespaceI >::ptrStoreClear(void)
116 AccessHandler::onSub(this, _fieldValue);
121 template <class AccessHandlerT, Int32 NamespaceI> inline
122 FieldDescriptionBase *
123 PointerSFieldCommon<AccessHandlerT,
124 NamespaceI >::createFieldDescription (
125 const Char8 *szFieldname,
127 FieldEditMethod fEditMethod,
128 FieldGetMethod fGetMethod )
133 template <class AccessHandlerT, Int32 NamespaceI> inline
134 FieldDescriptionBase *
135 PointerSFieldCommon<AccessHandlerT,
136 NamespaceI >::createIdxFieldDescription(
137 const Char8 *szFieldname,
139 FieldIndexEditMethod fEditMethod,
140 FieldIndexGetMethod fGetMethod )
145 /*-------------------------------------------------------------------------*/
149 template <class AccessHandlerT, Int32 NamespaceI> inline
150 void PointerSFieldCommon<AccessHandlerT,
151 NamespaceI >::copyFromBin(BinaryDataHandler &pMem)
153 FieldContainer *pNewObj = NULL;
155 PtrBaseTraitsType::copyFromBin ( pMem,
158 AccessHandler ::onSyncReplace( this,
162 _fieldValue = pNewObj;
165 /*-------------------------------------------------------------------------*/
168 #ifdef OSG_MT_CPTR_ASPECT
169 template <class AccessHandlerT, Int32 NamespaceI> inline
170 void PointerSFieldCommon<AccessHandlerT,
171 NamespaceI >::syncWith(Self &source)
173 FieldContainer *pNewObj = Aspect::convertToCurrent(source.ptrStoreGet());
175 AccessHandler::onSyncReplace( this,
179 _fieldValue = pNewObj;