changed: gcc8 base update
[opensg.git] / Source / System / Dynamics / Skeleton / OSGSkeletonSkinningAlgorithmBase.cpp
blobd69ae4e06b40b1af8a07c88d7a451e1759fdf5fc
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 SkeletonSkinningAlgorithm!
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 "OSGSkeletonSkinningAlgorithmBase.h"
67 #include "OSGSkeletonSkinningAlgorithm.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::SkeletonSkinningAlgorithm
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Pnt3f SkeletonSkinningAlgorithmBase::_mfDrawPositions
89 /*! \var UInt32 SkeletonSkinningAlgorithmBase::_mfDrawIndex
94 /***************************************************************************\
95 * FieldType/FieldTrait Instantiation *
96 \***************************************************************************/
98 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
99 PointerType FieldTraits<SkeletonSkinningAlgorithm *, nsOSG>::_type(
100 "SkeletonSkinningAlgorithmPtr",
101 "SkinningAlgorithmPtr",
102 SkeletonSkinningAlgorithm::getClassType(),
103 nsOSG);
104 #endif
106 OSG_FIELDTRAITS_GETTYPE_NS(SkeletonSkinningAlgorithm *, nsOSG)
108 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
109 SkeletonSkinningAlgorithm *,
110 nsOSG)
112 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
113 SkeletonSkinningAlgorithm *,
114 nsOSG)
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void SkeletonSkinningAlgorithmBase::classDescInserter(TypeObject &oType)
122 FieldDescriptionBase *pDesc = NULL;
125 pDesc = new MFPnt3f::Description(
126 MFPnt3f::getClassType(),
127 "drawPositions",
129 DrawPositionsFieldId, DrawPositionsFieldMask,
130 true,
131 (Field::MFDefaultFlags | Field::FStdAccess),
132 static_cast<FieldEditMethodSig>(&SkeletonSkinningAlgorithm::editHandleDrawPositions),
133 static_cast<FieldGetMethodSig >(&SkeletonSkinningAlgorithm::getHandleDrawPositions));
135 oType.addInitialDesc(pDesc);
137 pDesc = new MFUInt32::Description(
138 MFUInt32::getClassType(),
139 "drawIndex",
141 DrawIndexFieldId, DrawIndexFieldMask,
142 true,
143 (Field::MFDefaultFlags | Field::FStdAccess),
144 static_cast<FieldEditMethodSig>(&SkeletonSkinningAlgorithm::editHandleDrawIndex),
145 static_cast<FieldGetMethodSig >(&SkeletonSkinningAlgorithm::getHandleDrawIndex));
147 oType.addInitialDesc(pDesc);
151 SkeletonSkinningAlgorithmBase::TypeObject SkeletonSkinningAlgorithmBase::_type(
152 SkeletonSkinningAlgorithmBase::getClassname(),
153 Inherited::getClassname(),
154 "NULL",
155 nsOSG, //Namespace
156 reinterpret_cast<PrototypeCreateF>(&SkeletonSkinningAlgorithmBase::createEmptyLocal),
157 reinterpret_cast<InitContainerF>(&SkeletonSkinningAlgorithm::initMethod),
158 reinterpret_cast<ExitContainerF>(&SkeletonSkinningAlgorithm::exitMethod),
159 reinterpret_cast<InitalInsertDescFunc>(
160 reinterpret_cast<void *>(&SkeletonSkinningAlgorithm::classDescInserter)),
161 false,
163 "<?xml version=\"1.0\"?>\n"
164 "\n"
165 "<FieldContainer\n"
166 " name=\"SkeletonSkinningAlgorithm\"\n"
167 " parent=\"SkinningAlgorithm\"\n"
168 " library=\"Dynamics\"\n"
169 " pointerfieldtypes=\"both\"\n"
170 " structure=\"concrete\"\n"
171 " systemcomponent=\"true\"\n"
172 " parentsystemcomponent=\"true\"\n"
173 " decoratable=\"false\"\n"
174 " childFields=\"none\"\n"
175 " parentFields=\"none\"\n"
176 ">\n"
177 " <Field\n"
178 " name=\"drawPositions\"\n"
179 " type=\"Pnt3f\"\n"
180 " category=\"data\"\n"
181 " cardinality=\"multi\"\n"
182 " visibility=\"internal\"\n"
183 " access=\"protected\"\n"
184 " >\n"
185 " </Field>\n"
186 "\n"
187 " <Field\n"
188 " name=\"drawIndex\"\n"
189 " type=\"UInt32\"\n"
190 " category=\"data\"\n"
191 " cardinality=\"multi\"\n"
192 " visibility=\"internal\"\n"
193 " access=\"protected\"\n"
194 " >\n"
195 " </Field>\n"
196 "\n"
197 "</FieldContainer>\n",
201 /*------------------------------ get -----------------------------------*/
203 FieldContainerType &SkeletonSkinningAlgorithmBase::getType(void)
205 return _type;
208 const FieldContainerType &SkeletonSkinningAlgorithmBase::getType(void) const
210 return _type;
213 UInt32 SkeletonSkinningAlgorithmBase::getContainerSize(void) const
215 return sizeof(SkeletonSkinningAlgorithm);
218 /*------------------------- decorator get ------------------------------*/
221 MFPnt3f *SkeletonSkinningAlgorithmBase::editMFDrawPositions(void)
223 editMField(DrawPositionsFieldMask, _mfDrawPositions);
225 return &_mfDrawPositions;
228 const MFPnt3f *SkeletonSkinningAlgorithmBase::getMFDrawPositions(void) const
230 return &_mfDrawPositions;
234 MFUInt32 *SkeletonSkinningAlgorithmBase::editMFDrawIndex(void)
236 editMField(DrawIndexFieldMask, _mfDrawIndex);
238 return &_mfDrawIndex;
241 const MFUInt32 *SkeletonSkinningAlgorithmBase::getMFDrawIndex(void) const
243 return &_mfDrawIndex;
251 /*------------------------------ access -----------------------------------*/
253 SizeT SkeletonSkinningAlgorithmBase::getBinSize(ConstFieldMaskArg whichField)
255 SizeT returnValue = Inherited::getBinSize(whichField);
257 if(FieldBits::NoField != (DrawPositionsFieldMask & whichField))
259 returnValue += _mfDrawPositions.getBinSize();
261 if(FieldBits::NoField != (DrawIndexFieldMask & whichField))
263 returnValue += _mfDrawIndex.getBinSize();
266 return returnValue;
269 void SkeletonSkinningAlgorithmBase::copyToBin(BinaryDataHandler &pMem,
270 ConstFieldMaskArg whichField)
272 Inherited::copyToBin(pMem, whichField);
274 if(FieldBits::NoField != (DrawPositionsFieldMask & whichField))
276 _mfDrawPositions.copyToBin(pMem);
278 if(FieldBits::NoField != (DrawIndexFieldMask & whichField))
280 _mfDrawIndex.copyToBin(pMem);
284 void SkeletonSkinningAlgorithmBase::copyFromBin(BinaryDataHandler &pMem,
285 ConstFieldMaskArg whichField)
287 Inherited::copyFromBin(pMem, whichField);
289 if(FieldBits::NoField != (DrawPositionsFieldMask & whichField))
291 editMField(DrawPositionsFieldMask, _mfDrawPositions);
292 _mfDrawPositions.copyFromBin(pMem);
294 if(FieldBits::NoField != (DrawIndexFieldMask & whichField))
296 editMField(DrawIndexFieldMask, _mfDrawIndex);
297 _mfDrawIndex.copyFromBin(pMem);
301 //! create a new instance of the class
302 SkeletonSkinningAlgorithmTransitPtr SkeletonSkinningAlgorithmBase::createLocal(BitVector bFlags)
304 SkeletonSkinningAlgorithmTransitPtr fc;
306 if(getClassType().getPrototype() != NULL)
308 FieldContainerTransitPtr tmpPtr =
309 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
311 fc = dynamic_pointer_cast<SkeletonSkinningAlgorithm>(tmpPtr);
314 return fc;
317 //! create a new instance of the class, copy the container flags
318 SkeletonSkinningAlgorithmTransitPtr SkeletonSkinningAlgorithmBase::createDependent(BitVector bFlags)
320 SkeletonSkinningAlgorithmTransitPtr fc;
322 if(getClassType().getPrototype() != NULL)
324 FieldContainerTransitPtr tmpPtr =
325 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
327 fc = dynamic_pointer_cast<SkeletonSkinningAlgorithm>(tmpPtr);
330 return fc;
333 //! create a new instance of the class
334 SkeletonSkinningAlgorithmTransitPtr SkeletonSkinningAlgorithmBase::create(void)
336 SkeletonSkinningAlgorithmTransitPtr fc;
338 if(getClassType().getPrototype() != NULL)
340 FieldContainerTransitPtr tmpPtr =
341 getClassType().getPrototype()-> shallowCopy();
343 fc = dynamic_pointer_cast<SkeletonSkinningAlgorithm>(tmpPtr);
346 return fc;
349 SkeletonSkinningAlgorithm *SkeletonSkinningAlgorithmBase::createEmptyLocal(BitVector bFlags)
351 SkeletonSkinningAlgorithm *returnValue;
353 newPtr<SkeletonSkinningAlgorithm>(returnValue, bFlags);
355 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
357 return returnValue;
360 //! create an empty new instance of the class, do not copy the prototype
361 SkeletonSkinningAlgorithm *SkeletonSkinningAlgorithmBase::createEmpty(void)
363 SkeletonSkinningAlgorithm *returnValue;
365 newPtr<SkeletonSkinningAlgorithm>(returnValue, Thread::getCurrentLocalFlags());
367 returnValue->_pFieldFlags->_bNamespaceMask &=
368 ~Thread::getCurrentLocalFlags();
370 return returnValue;
374 FieldContainerTransitPtr SkeletonSkinningAlgorithmBase::shallowCopyLocal(
375 BitVector bFlags) const
377 SkeletonSkinningAlgorithm *tmpPtr;
379 newPtr(tmpPtr, dynamic_cast<const SkeletonSkinningAlgorithm *>(this), bFlags);
381 FieldContainerTransitPtr returnValue(tmpPtr);
383 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
385 return returnValue;
388 FieldContainerTransitPtr SkeletonSkinningAlgorithmBase::shallowCopyDependent(
389 BitVector bFlags) const
391 SkeletonSkinningAlgorithm *tmpPtr;
393 newPtr(tmpPtr, dynamic_cast<const SkeletonSkinningAlgorithm *>(this), ~bFlags);
395 FieldContainerTransitPtr returnValue(tmpPtr);
397 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
399 return returnValue;
402 FieldContainerTransitPtr SkeletonSkinningAlgorithmBase::shallowCopy(void) const
404 SkeletonSkinningAlgorithm *tmpPtr;
406 newPtr(tmpPtr,
407 dynamic_cast<const SkeletonSkinningAlgorithm *>(this),
408 Thread::getCurrentLocalFlags());
410 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
412 FieldContainerTransitPtr returnValue(tmpPtr);
414 return returnValue;
420 /*------------------------- constructors ----------------------------------*/
422 SkeletonSkinningAlgorithmBase::SkeletonSkinningAlgorithmBase(void) :
423 Inherited(),
424 _mfDrawPositions (),
425 _mfDrawIndex ()
429 SkeletonSkinningAlgorithmBase::SkeletonSkinningAlgorithmBase(const SkeletonSkinningAlgorithmBase &source) :
430 Inherited(source),
431 _mfDrawPositions (source._mfDrawPositions ),
432 _mfDrawIndex (source._mfDrawIndex )
437 /*-------------------------- destructors ----------------------------------*/
439 SkeletonSkinningAlgorithmBase::~SkeletonSkinningAlgorithmBase(void)
444 GetFieldHandlePtr SkeletonSkinningAlgorithmBase::getHandleDrawPositions (void) const
446 MFPnt3f::GetHandlePtr returnValue(
447 new MFPnt3f::GetHandle(
448 &_mfDrawPositions,
449 this->getType().getFieldDesc(DrawPositionsFieldId),
450 const_cast<SkeletonSkinningAlgorithmBase *>(this)));
452 return returnValue;
455 EditFieldHandlePtr SkeletonSkinningAlgorithmBase::editHandleDrawPositions (void)
457 MFPnt3f::EditHandlePtr returnValue(
458 new MFPnt3f::EditHandle(
459 &_mfDrawPositions,
460 this->getType().getFieldDesc(DrawPositionsFieldId),
461 this));
464 editMField(DrawPositionsFieldMask, _mfDrawPositions);
466 return returnValue;
469 GetFieldHandlePtr SkeletonSkinningAlgorithmBase::getHandleDrawIndex (void) const
471 MFUInt32::GetHandlePtr returnValue(
472 new MFUInt32::GetHandle(
473 &_mfDrawIndex,
474 this->getType().getFieldDesc(DrawIndexFieldId),
475 const_cast<SkeletonSkinningAlgorithmBase *>(this)));
477 return returnValue;
480 EditFieldHandlePtr SkeletonSkinningAlgorithmBase::editHandleDrawIndex (void)
482 MFUInt32::EditHandlePtr returnValue(
483 new MFUInt32::EditHandle(
484 &_mfDrawIndex,
485 this->getType().getFieldDesc(DrawIndexFieldId),
486 this));
489 editMField(DrawIndexFieldMask, _mfDrawIndex);
491 return returnValue;
495 #ifdef OSG_MT_CPTR_ASPECT
496 void SkeletonSkinningAlgorithmBase::execSyncV( FieldContainer &oFrom,
497 ConstFieldMaskArg whichField,
498 AspectOffsetStore &oOffsets,
499 ConstFieldMaskArg syncMode,
500 const UInt32 uiSyncInfo)
502 SkeletonSkinningAlgorithm *pThis = static_cast<SkeletonSkinningAlgorithm *>(this);
504 pThis->execSync(static_cast<SkeletonSkinningAlgorithm *>(&oFrom),
505 whichField,
506 oOffsets,
507 syncMode,
508 uiSyncInfo);
510 #endif
513 #ifdef OSG_MT_CPTR_ASPECT
514 FieldContainer *SkeletonSkinningAlgorithmBase::createAspectCopy(
515 const FieldContainer *pRefAspect) const
517 SkeletonSkinningAlgorithm *returnValue;
519 newAspectCopy(returnValue,
520 dynamic_cast<const SkeletonSkinningAlgorithm *>(pRefAspect),
521 dynamic_cast<const SkeletonSkinningAlgorithm *>(this));
523 return returnValue;
525 #endif
527 void SkeletonSkinningAlgorithmBase::resolveLinks(void)
529 Inherited::resolveLinks();
531 #ifdef OSG_MT_CPTR_ASPECT
532 AspectOffsetStore oOffsets;
534 _pAspectStore->fillOffsetArray(oOffsets, this);
535 #endif
537 #ifdef OSG_MT_CPTR_ASPECT
538 _mfDrawPositions.terminateShare(Thread::getCurrentAspect(),
539 oOffsets);
540 #endif
541 #ifdef OSG_MT_CPTR_ASPECT
542 _mfDrawIndex.terminateShare(Thread::getCurrentAspect(),
543 oOffsets);
544 #endif
548 OSG_END_NAMESPACE