1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2003 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 template <class ParentT> inline
42 void TraversalDataHandlerMixin<ParentT>::changed(ConstFieldMaskArg whichField,
46 Inherited::changed(whichField, origin, details);
49 template <class ParentT> inline
50 void TraversalDataHandlerMixin<ParentT>::setData(
53 RenderActionBase *pAction)
55 TraversalData *pStoredData =
56 pAction->template getData<TraversalData *>(this->_iDataSlotId);
58 bool bCheckCallback = false;
60 OSG_ASSERT(iDataSlotId == this->_iDataSlotId);
62 if(pStoredData == NULL)
64 pAction->setData(pData, this->_iDataSlotId);
65 bCheckCallback = true;
67 else if(pStoredData != pData)
69 pData->copyFrom(pStoredData);
71 pAction->setData(pData, this->_iDataSlotId);
72 bCheckCallback = true;
75 if(bCheckCallback == true)
77 if(this->hasDestroyedFunctor(
78 boost::bind(&DataSlotHandler::clearData,
82 this->_iDataSlotId)) == false)
84 this->addDestroyedFunctor(
85 boost::bind(&DataSlotHandler::clearData,
86 static_cast<DataSlotHandler *>(pAction),
89 this->_iDataSlotId), "");
91 pAction->addDestroyedFunctorFor(
93 &Self::template clearDestroyedFunctorFor<DataSlotHandler>,
101 this->addChangedFunctor(
102 boost::bind(&TraversalData::updateData,
109 pData->addChangedFunctor(
110 boost::bind(&Self::dataDestroyed,
117 if(pStoredData != NULL)
119 this->subChangedFunctor(
120 boost::bind(&TraversalData::updateData,
126 pStoredData->subChangedFunctor(
127 boost::bind(&Self::dataDestroyed,
137 /*-------------------------------------------------------------------------*/
140 /*-------------------------------------------------------------------------*/
143 /*-------------------------------------------------------------------------*/
147 /*-------------------------------------------------------------------------*/
150 template <class ParentT> inline
151 TraversalDataHandlerMixin<ParentT>::TraversalDataHandlerMixin(void) :
156 template <class ParentT> inline
157 TraversalDataHandlerMixin<ParentT>::TraversalDataHandlerMixin(
158 const TraversalDataHandlerMixin &source) :
164 template <class ParentT> inline
165 TraversalDataHandlerMixin<ParentT>::~TraversalDataHandlerMixin(void)
169 template <class ParentT> inline
170 void TraversalDataHandlerMixin<ParentT>::dataDestroyed(
171 FieldContainer *pCore,
172 BitVector whichField,
175 if(whichField == 0x0000)
177 this->subChangedFunctor(
178 boost::bind(&TraversalData::updateData,
179 dynamic_cast<TraversalData *>(pCore),
186 template <class ParentT> inline
187 void TraversalDataHandlerMixin<ParentT>::dump( UInt32 uiIndent,
188 const BitVector bvFlags ) const
192 /*-------------------------------------------------------------------------*/
195 /*-------------------------------------------------------------------------*/
198 /*-------------------------------------------------------------------------*/