changed: gcc8 base update
[opensg.git] / Source / System / Dynamics / Animation / OSGAnimKeyFrameDataSourceBase.cpp
blob447cd41990b461caa7b945fa80d1891d5dc4a02b
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class AnimKeyFrameDataSource!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
66 #include "OSGAnimKeyFrameDataSourceBase.h"
67 #include "OSGAnimKeyFrameDataSource.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::AnimKeyFrameDataSource
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Real32 AnimKeyFrameDataSourceBase::_mfInValues
89 /*! \var UInt32 AnimKeyFrameDataSourceBase::_mfInterpolationModes
94 /***************************************************************************\
95 * FieldType/FieldTrait Instantiation *
96 \***************************************************************************/
98 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
99 PointerType FieldTraits<AnimKeyFrameDataSource *, nsOSG>::_type(
100 "AnimKeyFrameDataSourcePtr",
101 "AnimDataSourcePtr",
102 AnimKeyFrameDataSource::getClassType(),
103 nsOSG);
104 #endif
106 OSG_FIELDTRAITS_GETTYPE_NS(AnimKeyFrameDataSource *, nsOSG)
108 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
109 AnimKeyFrameDataSource *,
110 nsOSG)
112 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
113 AnimKeyFrameDataSource *,
114 nsOSG)
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void AnimKeyFrameDataSourceBase::classDescInserter(TypeObject &oType)
122 FieldDescriptionBase *pDesc = NULL;
125 pDesc = new MFReal32::Description(
126 MFReal32::getClassType(),
127 "inValues",
129 InValuesFieldId, InValuesFieldMask,
130 false,
131 (Field::FClusterLocal),
132 static_cast<FieldEditMethodSig>(&AnimKeyFrameDataSource::editHandleInValues),
133 static_cast<FieldGetMethodSig >(&AnimKeyFrameDataSource::getHandleInValues));
135 oType.addInitialDesc(pDesc);
137 pDesc = new MFUInt32::Description(
138 MFUInt32::getClassType(),
139 "interpolationModes",
141 InterpolationModesFieldId, InterpolationModesFieldMask,
142 false,
143 (Field::FClusterLocal),
144 static_cast<FieldEditMethodSig>(&AnimKeyFrameDataSource::editHandleInterpolationModes),
145 static_cast<FieldGetMethodSig >(&AnimKeyFrameDataSource::getHandleInterpolationModes));
147 oType.addInitialDesc(pDesc);
151 AnimKeyFrameDataSourceBase::TypeObject AnimKeyFrameDataSourceBase::_type(
152 AnimKeyFrameDataSourceBase::getClassname(),
153 Inherited::getClassname(),
154 "NULL",
155 nsOSG, //Namespace
156 NULL,
157 reinterpret_cast<InitContainerF>(&AnimKeyFrameDataSource::initMethod),
158 reinterpret_cast<ExitContainerF>(&AnimKeyFrameDataSource::exitMethod),
159 reinterpret_cast<InitalInsertDescFunc>(
160 reinterpret_cast<void *>(&AnimKeyFrameDataSource::classDescInserter)),
161 false,
163 "<?xml version=\"1.0\"?>\n"
164 "\n"
165 "<FieldContainer\n"
166 " name=\"AnimKeyFrameDataSource\"\n"
167 " parent=\"AnimDataSource\"\n"
168 " library=\"Dynamics\"\n"
169 " pointerfieldtypes=\"both\"\n"
170 " structure=\"abstract\"\n"
171 " systemcomponent=\"true\"\n"
172 " parentsystemcomponent=\"true\"\n"
173 " decoratable=\"false\"\n"
174 " useLocalIncludes=\"false\"\n"
175 " isNodeCore=\"false\"\n"
176 " isBundle=\"false\"\n"
177 " parentFields=\"none\"\n"
178 ">\n"
179 " <Field\n"
180 " name=\"inValues\"\n"
181 " category=\"data\"\n"
182 " type=\"Real32\"\n"
183 " cardinality=\"multi\"\n"
184 " visibility=\"external\"\n"
185 " access=\"public\"\n"
186 " fieldFlags=\"FClusterLocal\"\n"
187 " >\n"
188 " </Field>\n"
189 " <Field\n"
190 " name=\"interpolationModes\"\n"
191 " category=\"data\"\n"
192 " type=\"UInt32\"\n"
193 " cardinality=\"multi\"\n"
194 " visibility=\"external\"\n"
195 " access=\"public\"\n"
196 " fieldFlags=\"FClusterLocal\"\n"
197 " >\n"
198 " </Field>\n"
199 "</FieldContainer>\n",
203 /*------------------------------ get -----------------------------------*/
205 FieldContainerType &AnimKeyFrameDataSourceBase::getType(void)
207 return _type;
210 const FieldContainerType &AnimKeyFrameDataSourceBase::getType(void) const
212 return _type;
215 UInt32 AnimKeyFrameDataSourceBase::getContainerSize(void) const
217 return sizeof(AnimKeyFrameDataSource);
220 /*------------------------- decorator get ------------------------------*/
223 MFReal32 *AnimKeyFrameDataSourceBase::editMFInValues(void)
225 editMField(InValuesFieldMask, _mfInValues);
227 return &_mfInValues;
230 const MFReal32 *AnimKeyFrameDataSourceBase::getMFInValues(void) const
232 return &_mfInValues;
236 MFUInt32 *AnimKeyFrameDataSourceBase::editMFInterpolationModes(void)
238 editMField(InterpolationModesFieldMask, _mfInterpolationModes);
240 return &_mfInterpolationModes;
243 const MFUInt32 *AnimKeyFrameDataSourceBase::getMFInterpolationModes(void) const
245 return &_mfInterpolationModes;
253 /*------------------------------ access -----------------------------------*/
255 SizeT AnimKeyFrameDataSourceBase::getBinSize(ConstFieldMaskArg whichField)
257 SizeT returnValue = Inherited::getBinSize(whichField);
259 if(FieldBits::NoField != (InValuesFieldMask & whichField))
261 returnValue += _mfInValues.getBinSize();
263 if(FieldBits::NoField != (InterpolationModesFieldMask & whichField))
265 returnValue += _mfInterpolationModes.getBinSize();
268 return returnValue;
271 void AnimKeyFrameDataSourceBase::copyToBin(BinaryDataHandler &pMem,
272 ConstFieldMaskArg whichField)
274 Inherited::copyToBin(pMem, whichField);
276 if(FieldBits::NoField != (InValuesFieldMask & whichField))
278 _mfInValues.copyToBin(pMem);
280 if(FieldBits::NoField != (InterpolationModesFieldMask & whichField))
282 _mfInterpolationModes.copyToBin(pMem);
286 void AnimKeyFrameDataSourceBase::copyFromBin(BinaryDataHandler &pMem,
287 ConstFieldMaskArg whichField)
289 Inherited::copyFromBin(pMem, whichField);
291 if(FieldBits::NoField != (InValuesFieldMask & whichField))
293 editMField(InValuesFieldMask, _mfInValues);
294 _mfInValues.copyFromBin(pMem);
296 if(FieldBits::NoField != (InterpolationModesFieldMask & whichField))
298 editMField(InterpolationModesFieldMask, _mfInterpolationModes);
299 _mfInterpolationModes.copyFromBin(pMem);
306 /*------------------------- constructors ----------------------------------*/
308 AnimKeyFrameDataSourceBase::AnimKeyFrameDataSourceBase(void) :
309 Inherited(),
310 _mfInValues (),
311 _mfInterpolationModes ()
315 AnimKeyFrameDataSourceBase::AnimKeyFrameDataSourceBase(const AnimKeyFrameDataSourceBase &source) :
316 Inherited(source),
317 _mfInValues (source._mfInValues ),
318 _mfInterpolationModes (source._mfInterpolationModes )
323 /*-------------------------- destructors ----------------------------------*/
325 AnimKeyFrameDataSourceBase::~AnimKeyFrameDataSourceBase(void)
330 GetFieldHandlePtr AnimKeyFrameDataSourceBase::getHandleInValues (void) const
332 MFReal32::GetHandlePtr returnValue(
333 new MFReal32::GetHandle(
334 &_mfInValues,
335 this->getType().getFieldDesc(InValuesFieldId),
336 const_cast<AnimKeyFrameDataSourceBase *>(this)));
338 return returnValue;
341 EditFieldHandlePtr AnimKeyFrameDataSourceBase::editHandleInValues (void)
343 MFReal32::EditHandlePtr returnValue(
344 new MFReal32::EditHandle(
345 &_mfInValues,
346 this->getType().getFieldDesc(InValuesFieldId),
347 this));
350 editMField(InValuesFieldMask, _mfInValues);
352 return returnValue;
355 GetFieldHandlePtr AnimKeyFrameDataSourceBase::getHandleInterpolationModes (void) const
357 MFUInt32::GetHandlePtr returnValue(
358 new MFUInt32::GetHandle(
359 &_mfInterpolationModes,
360 this->getType().getFieldDesc(InterpolationModesFieldId),
361 const_cast<AnimKeyFrameDataSourceBase *>(this)));
363 return returnValue;
366 EditFieldHandlePtr AnimKeyFrameDataSourceBase::editHandleInterpolationModes(void)
368 MFUInt32::EditHandlePtr returnValue(
369 new MFUInt32::EditHandle(
370 &_mfInterpolationModes,
371 this->getType().getFieldDesc(InterpolationModesFieldId),
372 this));
375 editMField(InterpolationModesFieldMask, _mfInterpolationModes);
377 return returnValue;
381 #ifdef OSG_MT_CPTR_ASPECT
382 void AnimKeyFrameDataSourceBase::execSyncV( FieldContainer &oFrom,
383 ConstFieldMaskArg whichField,
384 AspectOffsetStore &oOffsets,
385 ConstFieldMaskArg syncMode,
386 const UInt32 uiSyncInfo)
388 AnimKeyFrameDataSource *pThis = static_cast<AnimKeyFrameDataSource *>(this);
390 pThis->execSync(static_cast<AnimKeyFrameDataSource *>(&oFrom),
391 whichField,
392 oOffsets,
393 syncMode,
394 uiSyncInfo);
396 #endif
400 void AnimKeyFrameDataSourceBase::resolveLinks(void)
402 Inherited::resolveLinks();
404 #ifdef OSG_MT_CPTR_ASPECT
405 AspectOffsetStore oOffsets;
407 _pAspectStore->fillOffsetArray(oOffsets, this);
408 #endif
410 #ifdef OSG_MT_CPTR_ASPECT
411 _mfInValues.terminateShare(Thread::getCurrentAspect(),
412 oOffsets);
413 #endif
414 #ifdef OSG_MT_CPTR_ASPECT
415 _mfInterpolationModes.terminateShare(Thread::getCurrentAspect(),
416 oOffsets);
417 #endif
421 OSG_END_NAMESPACE