changed: gcc8 base update
[opensg.git] / Source / System / Dynamics / Animation / OSGAnimMatrixDataSourceBase.cpp
blob7478b2a21f4ac0780616bd2a1102be9dbd630b1f
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 AnimMatrixDataSource!
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 "OSGAnimMatrixDataSourceBase.h"
67 #include "OSGAnimMatrixDataSource.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::AnimMatrixDataSource
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Matrix AnimMatrixDataSourceBase::_mfValues
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits<AnimMatrixDataSource *, nsOSG>::_type(
96 "AnimMatrixDataSourcePtr",
97 "AnimKeyFrameDataSourcePtr",
98 AnimMatrixDataSource::getClassType(),
99 nsOSG);
100 #endif
102 OSG_FIELDTRAITS_GETTYPE_NS(AnimMatrixDataSource *, nsOSG)
104 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
105 AnimMatrixDataSource *,
106 nsOSG)
108 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
109 AnimMatrixDataSource *,
110 nsOSG)
112 /***************************************************************************\
113 * Field Description *
114 \***************************************************************************/
116 void AnimMatrixDataSourceBase::classDescInserter(TypeObject &oType)
118 FieldDescriptionBase *pDesc = NULL;
121 pDesc = new MFMatrix::Description(
122 MFMatrix::getClassType(),
123 "values",
125 ValuesFieldId, ValuesFieldMask,
126 false,
127 (Field::FClusterLocal),
128 static_cast<FieldEditMethodSig>(&AnimMatrixDataSource::editHandleValues),
129 static_cast<FieldGetMethodSig >(&AnimMatrixDataSource::getHandleValues));
131 oType.addInitialDesc(pDesc);
135 AnimMatrixDataSourceBase::TypeObject AnimMatrixDataSourceBase::_type(
136 AnimMatrixDataSourceBase::getClassname(),
137 Inherited::getClassname(),
138 "NULL",
139 nsOSG, //Namespace
140 reinterpret_cast<PrototypeCreateF>(&AnimMatrixDataSourceBase::createEmptyLocal),
141 reinterpret_cast<InitContainerF>(&AnimMatrixDataSource::initMethod),
142 reinterpret_cast<ExitContainerF>(&AnimMatrixDataSource::exitMethod),
143 reinterpret_cast<InitalInsertDescFunc>(
144 reinterpret_cast<void *>(&AnimMatrixDataSource::classDescInserter)),
145 false,
147 "<?xml version=\"1.0\"?>\n"
148 "\n"
149 "<FieldContainer\n"
150 " name=\"AnimMatrixDataSource\"\n"
151 " parent=\"AnimKeyFrameDataSource\"\n"
152 " library=\"Dynamics\"\n"
153 " pointerfieldtypes=\"both\"\n"
154 " structure=\"concrete\"\n"
155 " systemcomponent=\"true\"\n"
156 " parentsystemcomponent=\"true\"\n"
157 " decoratable=\"false\"\n"
158 " useLocalIncludes=\"false\"\n"
159 " isNodeCore=\"false\"\n"
160 " isBundle=\"false\"\n"
161 " parentFields=\"none\"\n"
162 ">\n"
163 " <Field\n"
164 " name=\"values\"\n"
165 " category=\"data\"\n"
166 " type=\"Matrix\"\n"
167 " cardinality=\"multi\"\n"
168 " visibility=\"external\"\n"
169 " access=\"public\"\n"
170 " fieldFlags=\"FClusterLocal\"\n"
171 " >\n"
172 " </Field>\n"
173 "</FieldContainer>\n",
177 /*------------------------------ get -----------------------------------*/
179 FieldContainerType &AnimMatrixDataSourceBase::getType(void)
181 return _type;
184 const FieldContainerType &AnimMatrixDataSourceBase::getType(void) const
186 return _type;
189 UInt32 AnimMatrixDataSourceBase::getContainerSize(void) const
191 return sizeof(AnimMatrixDataSource);
194 /*------------------------- decorator get ------------------------------*/
197 MFMatrix *AnimMatrixDataSourceBase::editMFValues(void)
199 editMField(ValuesFieldMask, _mfValues);
201 return &_mfValues;
204 const MFMatrix *AnimMatrixDataSourceBase::getMFValues(void) const
206 return &_mfValues;
214 /*------------------------------ access -----------------------------------*/
216 SizeT AnimMatrixDataSourceBase::getBinSize(ConstFieldMaskArg whichField)
218 SizeT returnValue = Inherited::getBinSize(whichField);
220 if(FieldBits::NoField != (ValuesFieldMask & whichField))
222 returnValue += _mfValues.getBinSize();
225 return returnValue;
228 void AnimMatrixDataSourceBase::copyToBin(BinaryDataHandler &pMem,
229 ConstFieldMaskArg whichField)
231 Inherited::copyToBin(pMem, whichField);
233 if(FieldBits::NoField != (ValuesFieldMask & whichField))
235 _mfValues.copyToBin(pMem);
239 void AnimMatrixDataSourceBase::copyFromBin(BinaryDataHandler &pMem,
240 ConstFieldMaskArg whichField)
242 Inherited::copyFromBin(pMem, whichField);
244 if(FieldBits::NoField != (ValuesFieldMask & whichField))
246 editMField(ValuesFieldMask, _mfValues);
247 _mfValues.copyFromBin(pMem);
251 //! create a new instance of the class
252 AnimMatrixDataSourceTransitPtr AnimMatrixDataSourceBase::createLocal(BitVector bFlags)
254 AnimMatrixDataSourceTransitPtr fc;
256 if(getClassType().getPrototype() != NULL)
258 FieldContainerTransitPtr tmpPtr =
259 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
261 fc = dynamic_pointer_cast<AnimMatrixDataSource>(tmpPtr);
264 return fc;
267 //! create a new instance of the class, copy the container flags
268 AnimMatrixDataSourceTransitPtr AnimMatrixDataSourceBase::createDependent(BitVector bFlags)
270 AnimMatrixDataSourceTransitPtr fc;
272 if(getClassType().getPrototype() != NULL)
274 FieldContainerTransitPtr tmpPtr =
275 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
277 fc = dynamic_pointer_cast<AnimMatrixDataSource>(tmpPtr);
280 return fc;
283 //! create a new instance of the class
284 AnimMatrixDataSourceTransitPtr AnimMatrixDataSourceBase::create(void)
286 AnimMatrixDataSourceTransitPtr fc;
288 if(getClassType().getPrototype() != NULL)
290 FieldContainerTransitPtr tmpPtr =
291 getClassType().getPrototype()-> shallowCopy();
293 fc = dynamic_pointer_cast<AnimMatrixDataSource>(tmpPtr);
296 return fc;
299 AnimMatrixDataSource *AnimMatrixDataSourceBase::createEmptyLocal(BitVector bFlags)
301 AnimMatrixDataSource *returnValue;
303 newPtr<AnimMatrixDataSource>(returnValue, bFlags);
305 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
307 return returnValue;
310 //! create an empty new instance of the class, do not copy the prototype
311 AnimMatrixDataSource *AnimMatrixDataSourceBase::createEmpty(void)
313 AnimMatrixDataSource *returnValue;
315 newPtr<AnimMatrixDataSource>(returnValue, Thread::getCurrentLocalFlags());
317 returnValue->_pFieldFlags->_bNamespaceMask &=
318 ~Thread::getCurrentLocalFlags();
320 return returnValue;
324 FieldContainerTransitPtr AnimMatrixDataSourceBase::shallowCopyLocal(
325 BitVector bFlags) const
327 AnimMatrixDataSource *tmpPtr;
329 newPtr(tmpPtr, dynamic_cast<const AnimMatrixDataSource *>(this), bFlags);
331 FieldContainerTransitPtr returnValue(tmpPtr);
333 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
335 return returnValue;
338 FieldContainerTransitPtr AnimMatrixDataSourceBase::shallowCopyDependent(
339 BitVector bFlags) const
341 AnimMatrixDataSource *tmpPtr;
343 newPtr(tmpPtr, dynamic_cast<const AnimMatrixDataSource *>(this), ~bFlags);
345 FieldContainerTransitPtr returnValue(tmpPtr);
347 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
349 return returnValue;
352 FieldContainerTransitPtr AnimMatrixDataSourceBase::shallowCopy(void) const
354 AnimMatrixDataSource *tmpPtr;
356 newPtr(tmpPtr,
357 dynamic_cast<const AnimMatrixDataSource *>(this),
358 Thread::getCurrentLocalFlags());
360 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
362 FieldContainerTransitPtr returnValue(tmpPtr);
364 return returnValue;
370 /*------------------------- constructors ----------------------------------*/
372 AnimMatrixDataSourceBase::AnimMatrixDataSourceBase(void) :
373 Inherited(),
374 _mfValues ()
378 AnimMatrixDataSourceBase::AnimMatrixDataSourceBase(const AnimMatrixDataSourceBase &source) :
379 Inherited(source),
380 _mfValues (source._mfValues )
385 /*-------------------------- destructors ----------------------------------*/
387 AnimMatrixDataSourceBase::~AnimMatrixDataSourceBase(void)
392 GetFieldHandlePtr AnimMatrixDataSourceBase::getHandleValues (void) const
394 MFMatrix::GetHandlePtr returnValue(
395 new MFMatrix::GetHandle(
396 &_mfValues,
397 this->getType().getFieldDesc(ValuesFieldId),
398 const_cast<AnimMatrixDataSourceBase *>(this)));
400 return returnValue;
403 EditFieldHandlePtr AnimMatrixDataSourceBase::editHandleValues (void)
405 MFMatrix::EditHandlePtr returnValue(
406 new MFMatrix::EditHandle(
407 &_mfValues,
408 this->getType().getFieldDesc(ValuesFieldId),
409 this));
412 editMField(ValuesFieldMask, _mfValues);
414 return returnValue;
418 #ifdef OSG_MT_CPTR_ASPECT
419 void AnimMatrixDataSourceBase::execSyncV( FieldContainer &oFrom,
420 ConstFieldMaskArg whichField,
421 AspectOffsetStore &oOffsets,
422 ConstFieldMaskArg syncMode,
423 const UInt32 uiSyncInfo)
425 AnimMatrixDataSource *pThis = static_cast<AnimMatrixDataSource *>(this);
427 pThis->execSync(static_cast<AnimMatrixDataSource *>(&oFrom),
428 whichField,
429 oOffsets,
430 syncMode,
431 uiSyncInfo);
433 #endif
436 #ifdef OSG_MT_CPTR_ASPECT
437 FieldContainer *AnimMatrixDataSourceBase::createAspectCopy(
438 const FieldContainer *pRefAspect) const
440 AnimMatrixDataSource *returnValue;
442 newAspectCopy(returnValue,
443 dynamic_cast<const AnimMatrixDataSource *>(pRefAspect),
444 dynamic_cast<const AnimMatrixDataSource *>(this));
446 return returnValue;
448 #endif
450 void AnimMatrixDataSourceBase::resolveLinks(void)
452 Inherited::resolveLinks();
454 #ifdef OSG_MT_CPTR_ASPECT
455 AspectOffsetStore oOffsets;
457 _pAspectStore->fillOffsetArray(oOffsets, this);
458 #endif
460 #ifdef OSG_MT_CPTR_ASPECT
461 _mfValues.terminateShare(Thread::getCurrentAspect(),
462 oOffsets);
463 #endif
467 OSG_END_NAMESPACE