changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Groups / Misc / OSGComponentTransformBase.cpp
blob402948e33ab17e1cdfe3717aeaf88e24b940535e
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 ComponentTransform!
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 "OSGComponentTransformBase.h"
67 #include "OSGComponentTransform.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::ComponentTransform
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Vec3f ComponentTransformBase::_sfCenter
89 /*! \var Quaternion ComponentTransformBase::_sfRotation
93 /*! \var Vec3f ComponentTransformBase::_sfScale
97 /*! \var Quaternion ComponentTransformBase::_sfScaleOrientation
101 /*! \var Vec3f ComponentTransformBase::_sfTranslation
106 /***************************************************************************\
107 * FieldType/FieldTrait Instantiation *
108 \***************************************************************************/
110 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
111 PointerType FieldTraits<ComponentTransform *, nsOSG>::_type(
112 "ComponentTransformPtr",
113 "TransformPtr",
114 ComponentTransform::getClassType(),
115 nsOSG);
116 #endif
118 OSG_FIELDTRAITS_GETTYPE_NS(ComponentTransform *, nsOSG)
120 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
121 ComponentTransform *,
122 nsOSG)
124 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
125 ComponentTransform *,
126 nsOSG)
128 /***************************************************************************\
129 * Field Description *
130 \***************************************************************************/
132 void ComponentTransformBase::classDescInserter(TypeObject &oType)
134 FieldDescriptionBase *pDesc = NULL;
137 pDesc = new SFVec3f::Description(
138 SFVec3f::getClassType(),
139 "center",
141 CenterFieldId, CenterFieldMask,
142 false,
143 (Field::SFDefaultFlags | Field::FStdAccess),
144 static_cast<FieldEditMethodSig>(&ComponentTransform::editHandleCenter),
145 static_cast<FieldGetMethodSig >(&ComponentTransform::getHandleCenter));
147 oType.addInitialDesc(pDesc);
149 pDesc = new SFQuaternion::Description(
150 SFQuaternion::getClassType(),
151 "rotation",
153 RotationFieldId, RotationFieldMask,
154 false,
155 (Field::SFDefaultFlags | Field::FStdAccess),
156 static_cast<FieldEditMethodSig>(&ComponentTransform::editHandleRotation),
157 static_cast<FieldGetMethodSig >(&ComponentTransform::getHandleRotation));
159 oType.addInitialDesc(pDesc);
161 pDesc = new SFVec3f::Description(
162 SFVec3f::getClassType(),
163 "scale",
165 ScaleFieldId, ScaleFieldMask,
166 false,
167 (Field::SFDefaultFlags | Field::FStdAccess),
168 static_cast<FieldEditMethodSig>(&ComponentTransform::editHandleScale),
169 static_cast<FieldGetMethodSig >(&ComponentTransform::getHandleScale));
171 oType.addInitialDesc(pDesc);
173 pDesc = new SFQuaternion::Description(
174 SFQuaternion::getClassType(),
175 "scaleOrientation",
177 ScaleOrientationFieldId, ScaleOrientationFieldMask,
178 false,
179 (Field::SFDefaultFlags | Field::FStdAccess),
180 static_cast<FieldEditMethodSig>(&ComponentTransform::editHandleScaleOrientation),
181 static_cast<FieldGetMethodSig >(&ComponentTransform::getHandleScaleOrientation));
183 oType.addInitialDesc(pDesc);
185 pDesc = new SFVec3f::Description(
186 SFVec3f::getClassType(),
187 "translation",
189 TranslationFieldId, TranslationFieldMask,
190 false,
191 (Field::SFDefaultFlags | Field::FStdAccess),
192 static_cast<FieldEditMethodSig>(&ComponentTransform::editHandleTranslation),
193 static_cast<FieldGetMethodSig >(&ComponentTransform::getHandleTranslation));
195 oType.addInitialDesc(pDesc);
199 ComponentTransformBase::TypeObject ComponentTransformBase::_type(
200 ComponentTransformBase::getClassname(),
201 Inherited::getClassname(),
202 "NULL",
203 nsOSG, //Namespace
204 reinterpret_cast<PrototypeCreateF>(&ComponentTransformBase::createEmptyLocal),
205 reinterpret_cast<InitContainerF>(&ComponentTransform::initMethod),
206 reinterpret_cast<ExitContainerF>(&ComponentTransform::exitMethod),
207 reinterpret_cast<InitalInsertDescFunc>(
208 reinterpret_cast<void *>(&ComponentTransform::classDescInserter)),
209 false,
211 "<?xml version=\"1.0\" ?>\n"
212 "\n"
213 "<FieldContainer\n"
214 " name=\"ComponentTransform\"\n"
215 " parent=\"Transform\"\n"
216 " library=\"Group\"\n"
217 " structure=\"concrete\"\n"
218 " pointerfieldtypes=\"both\"\n"
219 " systemcomponent=\"true\"\n"
220 " parentsystemcomponent=\"true\"\n"
221 " isNodeCore=\"true\"\n"
222 " docGroupBase=\"GrpGroupMisc\"\n"
223 " >\n"
224 " <Field\n"
225 "\t name=\"center\"\n"
226 "\t type=\"Vec3f\"\n"
227 "\t cardinality=\"single\"\n"
228 "\t visibility=\"external\"\n"
229 "\t >\n"
230 " </Field>\n"
231 " <Field\n"
232 "\t name=\"rotation\"\n"
233 "\t type=\"Quaternion\"\n"
234 "\t cardinality=\"single\"\n"
235 "\t visibility=\"external\"\n"
236 "\t >\n"
237 " </Field>\n"
238 " <Field\n"
239 "\t name=\"scale\"\n"
240 "\t type=\"Vec3f\"\n"
241 "\t cardinality=\"single\"\n"
242 "\t visibility=\"external\"\n"
243 "\t >\n"
244 " </Field>\n"
245 " <Field\n"
246 "\t name=\"scaleOrientation\"\n"
247 "\t type=\"Quaternion\"\n"
248 "\t cardinality=\"single\"\n"
249 "\t visibility=\"external\"\n"
250 "\t >\n"
251 " </Field>\n"
252 " <Field\n"
253 "\t name=\"translation\"\n"
254 "\t type=\"Vec3f\"\n"
255 "\t cardinality=\"single\"\n"
256 "\t visibility=\"external\"\n"
257 "\t >\n"
258 " </Field>\n"
259 "</FieldContainer>\n",
263 /*------------------------------ get -----------------------------------*/
265 FieldContainerType &ComponentTransformBase::getType(void)
267 return _type;
270 const FieldContainerType &ComponentTransformBase::getType(void) const
272 return _type;
275 UInt32 ComponentTransformBase::getContainerSize(void) const
277 return sizeof(ComponentTransform);
280 /*------------------------- decorator get ------------------------------*/
283 SFVec3f *ComponentTransformBase::editSFCenter(void)
285 editSField(CenterFieldMask);
287 return &_sfCenter;
290 const SFVec3f *ComponentTransformBase::getSFCenter(void) const
292 return &_sfCenter;
296 SFQuaternion *ComponentTransformBase::editSFRotation(void)
298 editSField(RotationFieldMask);
300 return &_sfRotation;
303 const SFQuaternion *ComponentTransformBase::getSFRotation(void) const
305 return &_sfRotation;
309 SFVec3f *ComponentTransformBase::editSFScale(void)
311 editSField(ScaleFieldMask);
313 return &_sfScale;
316 const SFVec3f *ComponentTransformBase::getSFScale(void) const
318 return &_sfScale;
322 SFQuaternion *ComponentTransformBase::editSFScaleOrientation(void)
324 editSField(ScaleOrientationFieldMask);
326 return &_sfScaleOrientation;
329 const SFQuaternion *ComponentTransformBase::getSFScaleOrientation(void) const
331 return &_sfScaleOrientation;
335 SFVec3f *ComponentTransformBase::editSFTranslation(void)
337 editSField(TranslationFieldMask);
339 return &_sfTranslation;
342 const SFVec3f *ComponentTransformBase::getSFTranslation(void) const
344 return &_sfTranslation;
352 /*------------------------------ access -----------------------------------*/
354 SizeT ComponentTransformBase::getBinSize(ConstFieldMaskArg whichField)
356 SizeT returnValue = Inherited::getBinSize(whichField);
358 if(FieldBits::NoField != (CenterFieldMask & whichField))
360 returnValue += _sfCenter.getBinSize();
362 if(FieldBits::NoField != (RotationFieldMask & whichField))
364 returnValue += _sfRotation.getBinSize();
366 if(FieldBits::NoField != (ScaleFieldMask & whichField))
368 returnValue += _sfScale.getBinSize();
370 if(FieldBits::NoField != (ScaleOrientationFieldMask & whichField))
372 returnValue += _sfScaleOrientation.getBinSize();
374 if(FieldBits::NoField != (TranslationFieldMask & whichField))
376 returnValue += _sfTranslation.getBinSize();
379 return returnValue;
382 void ComponentTransformBase::copyToBin(BinaryDataHandler &pMem,
383 ConstFieldMaskArg whichField)
385 Inherited::copyToBin(pMem, whichField);
387 if(FieldBits::NoField != (CenterFieldMask & whichField))
389 _sfCenter.copyToBin(pMem);
391 if(FieldBits::NoField != (RotationFieldMask & whichField))
393 _sfRotation.copyToBin(pMem);
395 if(FieldBits::NoField != (ScaleFieldMask & whichField))
397 _sfScale.copyToBin(pMem);
399 if(FieldBits::NoField != (ScaleOrientationFieldMask & whichField))
401 _sfScaleOrientation.copyToBin(pMem);
403 if(FieldBits::NoField != (TranslationFieldMask & whichField))
405 _sfTranslation.copyToBin(pMem);
409 void ComponentTransformBase::copyFromBin(BinaryDataHandler &pMem,
410 ConstFieldMaskArg whichField)
412 Inherited::copyFromBin(pMem, whichField);
414 if(FieldBits::NoField != (CenterFieldMask & whichField))
416 editSField(CenterFieldMask);
417 _sfCenter.copyFromBin(pMem);
419 if(FieldBits::NoField != (RotationFieldMask & whichField))
421 editSField(RotationFieldMask);
422 _sfRotation.copyFromBin(pMem);
424 if(FieldBits::NoField != (ScaleFieldMask & whichField))
426 editSField(ScaleFieldMask);
427 _sfScale.copyFromBin(pMem);
429 if(FieldBits::NoField != (ScaleOrientationFieldMask & whichField))
431 editSField(ScaleOrientationFieldMask);
432 _sfScaleOrientation.copyFromBin(pMem);
434 if(FieldBits::NoField != (TranslationFieldMask & whichField))
436 editSField(TranslationFieldMask);
437 _sfTranslation.copyFromBin(pMem);
441 //! create a new instance of the class
442 ComponentTransformTransitPtr ComponentTransformBase::createLocal(BitVector bFlags)
444 ComponentTransformTransitPtr fc;
446 if(getClassType().getPrototype() != NULL)
448 FieldContainerTransitPtr tmpPtr =
449 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
451 fc = dynamic_pointer_cast<ComponentTransform>(tmpPtr);
454 return fc;
457 //! create a new instance of the class, copy the container flags
458 ComponentTransformTransitPtr ComponentTransformBase::createDependent(BitVector bFlags)
460 ComponentTransformTransitPtr fc;
462 if(getClassType().getPrototype() != NULL)
464 FieldContainerTransitPtr tmpPtr =
465 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
467 fc = dynamic_pointer_cast<ComponentTransform>(tmpPtr);
470 return fc;
473 //! create a new instance of the class
474 ComponentTransformTransitPtr ComponentTransformBase::create(void)
476 ComponentTransformTransitPtr fc;
478 if(getClassType().getPrototype() != NULL)
480 FieldContainerTransitPtr tmpPtr =
481 getClassType().getPrototype()-> shallowCopy();
483 fc = dynamic_pointer_cast<ComponentTransform>(tmpPtr);
486 return fc;
489 ComponentTransform *ComponentTransformBase::createEmptyLocal(BitVector bFlags)
491 ComponentTransform *returnValue;
493 newPtr<ComponentTransform>(returnValue, bFlags);
495 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
497 return returnValue;
500 //! create an empty new instance of the class, do not copy the prototype
501 ComponentTransform *ComponentTransformBase::createEmpty(void)
503 ComponentTransform *returnValue;
505 newPtr<ComponentTransform>(returnValue, Thread::getCurrentLocalFlags());
507 returnValue->_pFieldFlags->_bNamespaceMask &=
508 ~Thread::getCurrentLocalFlags();
510 return returnValue;
514 FieldContainerTransitPtr ComponentTransformBase::shallowCopyLocal(
515 BitVector bFlags) const
517 ComponentTransform *tmpPtr;
519 newPtr(tmpPtr, dynamic_cast<const ComponentTransform *>(this), bFlags);
521 FieldContainerTransitPtr returnValue(tmpPtr);
523 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
525 return returnValue;
528 FieldContainerTransitPtr ComponentTransformBase::shallowCopyDependent(
529 BitVector bFlags) const
531 ComponentTransform *tmpPtr;
533 newPtr(tmpPtr, dynamic_cast<const ComponentTransform *>(this), ~bFlags);
535 FieldContainerTransitPtr returnValue(tmpPtr);
537 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
539 return returnValue;
542 FieldContainerTransitPtr ComponentTransformBase::shallowCopy(void) const
544 ComponentTransform *tmpPtr;
546 newPtr(tmpPtr,
547 dynamic_cast<const ComponentTransform *>(this),
548 Thread::getCurrentLocalFlags());
550 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
552 FieldContainerTransitPtr returnValue(tmpPtr);
554 return returnValue;
560 /*------------------------- constructors ----------------------------------*/
562 ComponentTransformBase::ComponentTransformBase(void) :
563 Inherited(),
564 _sfCenter (),
565 _sfRotation (),
566 _sfScale (),
567 _sfScaleOrientation (),
568 _sfTranslation ()
572 ComponentTransformBase::ComponentTransformBase(const ComponentTransformBase &source) :
573 Inherited(source),
574 _sfCenter (source._sfCenter ),
575 _sfRotation (source._sfRotation ),
576 _sfScale (source._sfScale ),
577 _sfScaleOrientation (source._sfScaleOrientation ),
578 _sfTranslation (source._sfTranslation )
583 /*-------------------------- destructors ----------------------------------*/
585 ComponentTransformBase::~ComponentTransformBase(void)
590 GetFieldHandlePtr ComponentTransformBase::getHandleCenter (void) const
592 SFVec3f::GetHandlePtr returnValue(
593 new SFVec3f::GetHandle(
594 &_sfCenter,
595 this->getType().getFieldDesc(CenterFieldId),
596 const_cast<ComponentTransformBase *>(this)));
598 return returnValue;
601 EditFieldHandlePtr ComponentTransformBase::editHandleCenter (void)
603 SFVec3f::EditHandlePtr returnValue(
604 new SFVec3f::EditHandle(
605 &_sfCenter,
606 this->getType().getFieldDesc(CenterFieldId),
607 this));
610 editSField(CenterFieldMask);
612 return returnValue;
615 GetFieldHandlePtr ComponentTransformBase::getHandleRotation (void) const
617 SFQuaternion::GetHandlePtr returnValue(
618 new SFQuaternion::GetHandle(
619 &_sfRotation,
620 this->getType().getFieldDesc(RotationFieldId),
621 const_cast<ComponentTransformBase *>(this)));
623 return returnValue;
626 EditFieldHandlePtr ComponentTransformBase::editHandleRotation (void)
628 SFQuaternion::EditHandlePtr returnValue(
629 new SFQuaternion::EditHandle(
630 &_sfRotation,
631 this->getType().getFieldDesc(RotationFieldId),
632 this));
635 editSField(RotationFieldMask);
637 return returnValue;
640 GetFieldHandlePtr ComponentTransformBase::getHandleScale (void) const
642 SFVec3f::GetHandlePtr returnValue(
643 new SFVec3f::GetHandle(
644 &_sfScale,
645 this->getType().getFieldDesc(ScaleFieldId),
646 const_cast<ComponentTransformBase *>(this)));
648 return returnValue;
651 EditFieldHandlePtr ComponentTransformBase::editHandleScale (void)
653 SFVec3f::EditHandlePtr returnValue(
654 new SFVec3f::EditHandle(
655 &_sfScale,
656 this->getType().getFieldDesc(ScaleFieldId),
657 this));
660 editSField(ScaleFieldMask);
662 return returnValue;
665 GetFieldHandlePtr ComponentTransformBase::getHandleScaleOrientation (void) const
667 SFQuaternion::GetHandlePtr returnValue(
668 new SFQuaternion::GetHandle(
669 &_sfScaleOrientation,
670 this->getType().getFieldDesc(ScaleOrientationFieldId),
671 const_cast<ComponentTransformBase *>(this)));
673 return returnValue;
676 EditFieldHandlePtr ComponentTransformBase::editHandleScaleOrientation(void)
678 SFQuaternion::EditHandlePtr returnValue(
679 new SFQuaternion::EditHandle(
680 &_sfScaleOrientation,
681 this->getType().getFieldDesc(ScaleOrientationFieldId),
682 this));
685 editSField(ScaleOrientationFieldMask);
687 return returnValue;
690 GetFieldHandlePtr ComponentTransformBase::getHandleTranslation (void) const
692 SFVec3f::GetHandlePtr returnValue(
693 new SFVec3f::GetHandle(
694 &_sfTranslation,
695 this->getType().getFieldDesc(TranslationFieldId),
696 const_cast<ComponentTransformBase *>(this)));
698 return returnValue;
701 EditFieldHandlePtr ComponentTransformBase::editHandleTranslation (void)
703 SFVec3f::EditHandlePtr returnValue(
704 new SFVec3f::EditHandle(
705 &_sfTranslation,
706 this->getType().getFieldDesc(TranslationFieldId),
707 this));
710 editSField(TranslationFieldMask);
712 return returnValue;
716 #ifdef OSG_MT_CPTR_ASPECT
717 void ComponentTransformBase::execSyncV( FieldContainer &oFrom,
718 ConstFieldMaskArg whichField,
719 AspectOffsetStore &oOffsets,
720 ConstFieldMaskArg syncMode,
721 const UInt32 uiSyncInfo)
723 ComponentTransform *pThis = static_cast<ComponentTransform *>(this);
725 pThis->execSync(static_cast<ComponentTransform *>(&oFrom),
726 whichField,
727 oOffsets,
728 syncMode,
729 uiSyncInfo);
731 #endif
734 #ifdef OSG_MT_CPTR_ASPECT
735 FieldContainer *ComponentTransformBase::createAspectCopy(
736 const FieldContainer *pRefAspect) const
738 ComponentTransform *returnValue;
740 newAspectCopy(returnValue,
741 dynamic_cast<const ComponentTransform *>(pRefAspect),
742 dynamic_cast<const ComponentTransform *>(this));
744 return returnValue;
746 #endif
748 void ComponentTransformBase::resolveLinks(void)
750 Inherited::resolveLinks();
756 OSG_END_NAMESPACE