changed: gcc8 base update
[opensg.git] / Source / Contrib / ComplexSceneManager / Sensor / InterfaceSensors / OSGTransformationInterfaceSensorBase.cpp
blobef9feb004366deca8adc394ef730a78845ca5fa1
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 TransformationInterfaceSensor!
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 "OSGTransformationInterfaceSensorBase.h"
67 #include "OSGTransformationInterfaceSensor.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::TransformationInterfaceSensor
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Matrix TransformationInterfaceSensorBase::_sfTransformation
89 /*! \var Vec3f TransformationInterfaceSensorBase::_sfTranslation
93 /*! \var Quaternion TransformationInterfaceSensorBase::_sfRotation
97 /*! \var Real32 TransformationInterfaceSensorBase::_sfRotationScale
101 /*! \var Real32 TransformationInterfaceSensorBase::_sfTranslationScale
106 /***************************************************************************\
107 * FieldType/FieldTrait Instantiation *
108 \***************************************************************************/
110 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
111 PointerType FieldTraits<TransformationInterfaceSensor *, nsOSG>::_type(
112 "TransformationInterfaceSensorPtr",
113 "DeviceInterfaceSensorPtr",
114 TransformationInterfaceSensor::getClassType(),
115 nsOSG);
116 #endif
118 OSG_FIELDTRAITS_GETTYPE_NS(TransformationInterfaceSensor *, nsOSG)
120 /***************************************************************************\
121 * Field Description *
122 \***************************************************************************/
124 void TransformationInterfaceSensorBase::classDescInserter(TypeObject &oType)
126 FieldDescriptionBase *pDesc = NULL;
129 pDesc = new SFMatrix::Description(
130 SFMatrix::getClassType(),
131 "transformation",
133 TransformationFieldId, TransformationFieldMask,
134 true,
135 (Field::FStdAccess | Field::FThreadLocal),
136 static_cast<FieldEditMethodSig>(&TransformationInterfaceSensor::editHandleTransformation),
137 static_cast<FieldGetMethodSig >(&TransformationInterfaceSensor::getHandleTransformation));
139 oType.addInitialDesc(pDesc);
141 pDesc = new SFVec3f::Description(
142 SFVec3f::getClassType(),
143 "translation",
145 TranslationFieldId, TranslationFieldMask,
146 true,
147 (Field::FStdAccess | Field::FThreadLocal),
148 static_cast<FieldEditMethodSig>(&TransformationInterfaceSensor::editHandleTranslation),
149 static_cast<FieldGetMethodSig >(&TransformationInterfaceSensor::getHandleTranslation));
151 oType.addInitialDesc(pDesc);
153 pDesc = new SFQuaternion::Description(
154 SFQuaternion::getClassType(),
155 "rotation",
157 RotationFieldId, RotationFieldMask,
158 true,
159 (Field::FStdAccess | Field::FThreadLocal),
160 static_cast<FieldEditMethodSig>(&TransformationInterfaceSensor::editHandleRotation),
161 static_cast<FieldGetMethodSig >(&TransformationInterfaceSensor::getHandleRotation));
163 oType.addInitialDesc(pDesc);
165 pDesc = new SFReal32::Description(
166 SFReal32::getClassType(),
167 "rotationScale",
169 RotationScaleFieldId, RotationScaleFieldMask,
170 true,
171 (Field::FStdAccess | Field::FThreadLocal),
172 static_cast<FieldEditMethodSig>(&TransformationInterfaceSensor::editHandleRotationScale),
173 static_cast<FieldGetMethodSig >(&TransformationInterfaceSensor::getHandleRotationScale));
175 oType.addInitialDesc(pDesc);
177 pDesc = new SFReal32::Description(
178 SFReal32::getClassType(),
179 "translationScale",
181 TranslationScaleFieldId, TranslationScaleFieldMask,
182 true,
183 (Field::FStdAccess | Field::FThreadLocal),
184 static_cast<FieldEditMethodSig>(&TransformationInterfaceSensor::editHandleTranslationScale),
185 static_cast<FieldGetMethodSig >(&TransformationInterfaceSensor::getHandleTranslationScale));
187 oType.addInitialDesc(pDesc);
191 TransformationInterfaceSensorBase::TypeObject TransformationInterfaceSensorBase::_type(
192 TransformationInterfaceSensorBase::getClassname(),
193 Inherited::getClassname(),
194 "NULL",
195 nsOSG, //Namespace
196 reinterpret_cast<PrototypeCreateF>(&TransformationInterfaceSensorBase::createEmptyLocal),
197 reinterpret_cast<InitContainerF>(&TransformationInterfaceSensor::initMethod),
198 reinterpret_cast<ExitContainerF>(&TransformationInterfaceSensor::exitMethod),
199 reinterpret_cast<InitalInsertDescFunc>(
200 reinterpret_cast<void *>(&TransformationInterfaceSensor::classDescInserter)),
201 false,
203 "<?xml version=\"1.0\"?>\n"
204 "\n"
205 "<FieldContainer\n"
206 " name=\"TransformationInterfaceSensor\"\n"
207 " parent=\"DeviceInterfaceSensor\"\n"
208 " library=\"ContribCSM\"\n"
209 " pointerfieldtypes=\"none\"\n"
210 " structure=\"concrete\"\n"
211 " systemcomponent=\"true\"\n"
212 " parentsystemcomponent=\"true\"\n"
213 " decoratable=\"false\"\n"
214 " useLocalIncludes=\"false\"\n"
215 " isNodeCore=\"false\"\n"
216 " isBundle=\"false\"\n"
217 " parentFields=\"none\"\n"
218 " >\n"
219 " <Field\n"
220 " name=\"transformation\"\n"
221 " type=\"Matrix\"\n"
222 " cardinality=\"single\"\n"
223 " visibility=\"internal\"\n"
224 " access=\"public\"\n"
225 " defaultValue=\"\"\n"
226 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
227 " >\n"
228 " </Field>\n"
229 "\n"
230 " <Field\n"
231 " name=\"translation\"\n"
232 " type=\"Vec3f\"\n"
233 " cardinality=\"single\"\n"
234 " visibility=\"internal\"\n"
235 " access=\"public\"\n"
236 " defaultValue=\"\"\n"
237 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
238 " >\n"
239 " </Field>\n"
240 "\n"
241 " <Field\n"
242 " name=\"rotation\"\n"
243 " type=\"Quaternion\"\n"
244 " cardinality=\"single\"\n"
245 " visibility=\"internal\"\n"
246 " access=\"public\"\n"
247 " defaultValue=\"\"\n"
248 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
249 " >\n"
250 " </Field>\n"
251 "\n"
252 " <Field\n"
253 " name=\"rotationScale\"\n"
254 " type=\"Real32\"\n"
255 " cardinality=\"single\"\n"
256 " visibility=\"internal\"\n"
257 " access=\"public\"\n"
258 " defaultValue=\"1.f\"\n"
259 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
260 " >\n"
261 " </Field>\n"
262 "\n"
263 " <Field\n"
264 " name=\"translationScale\"\n"
265 " type=\"Real32\"\n"
266 " cardinality=\"single\"\n"
267 " visibility=\"internal\"\n"
268 " access=\"protected\"\n"
269 " defaultValue=\"1.f\"\n"
270 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
271 " >\n"
272 " </Field>\n"
273 "</FieldContainer>\n",
277 /*------------------------------ get -----------------------------------*/
279 FieldContainerType &TransformationInterfaceSensorBase::getType(void)
281 return _type;
284 const FieldContainerType &TransformationInterfaceSensorBase::getType(void) const
286 return _type;
289 UInt32 TransformationInterfaceSensorBase::getContainerSize(void) const
291 return sizeof(TransformationInterfaceSensor);
294 /*------------------------- decorator get ------------------------------*/
297 SFMatrix *TransformationInterfaceSensorBase::editSFTransformation(void)
299 editSField(TransformationFieldMask);
301 return &_sfTransformation;
304 const SFMatrix *TransformationInterfaceSensorBase::getSFTransformation(void) const
306 return &_sfTransformation;
310 SFVec3f *TransformationInterfaceSensorBase::editSFTranslation(void)
312 editSField(TranslationFieldMask);
314 return &_sfTranslation;
317 const SFVec3f *TransformationInterfaceSensorBase::getSFTranslation(void) const
319 return &_sfTranslation;
323 SFQuaternion *TransformationInterfaceSensorBase::editSFRotation(void)
325 editSField(RotationFieldMask);
327 return &_sfRotation;
330 const SFQuaternion *TransformationInterfaceSensorBase::getSFRotation(void) const
332 return &_sfRotation;
336 SFReal32 *TransformationInterfaceSensorBase::editSFRotationScale(void)
338 editSField(RotationScaleFieldMask);
340 return &_sfRotationScale;
343 const SFReal32 *TransformationInterfaceSensorBase::getSFRotationScale(void) const
345 return &_sfRotationScale;
349 SFReal32 *TransformationInterfaceSensorBase::editSFTranslationScale(void)
351 editSField(TranslationScaleFieldMask);
353 return &_sfTranslationScale;
356 const SFReal32 *TransformationInterfaceSensorBase::getSFTranslationScale(void) const
358 return &_sfTranslationScale;
366 /*------------------------------ access -----------------------------------*/
368 SizeT TransformationInterfaceSensorBase::getBinSize(ConstFieldMaskArg whichField)
370 SizeT returnValue = Inherited::getBinSize(whichField);
372 if(FieldBits::NoField != (TransformationFieldMask & whichField))
374 returnValue += _sfTransformation.getBinSize();
376 if(FieldBits::NoField != (TranslationFieldMask & whichField))
378 returnValue += _sfTranslation.getBinSize();
380 if(FieldBits::NoField != (RotationFieldMask & whichField))
382 returnValue += _sfRotation.getBinSize();
384 if(FieldBits::NoField != (RotationScaleFieldMask & whichField))
386 returnValue += _sfRotationScale.getBinSize();
388 if(FieldBits::NoField != (TranslationScaleFieldMask & whichField))
390 returnValue += _sfTranslationScale.getBinSize();
393 return returnValue;
396 void TransformationInterfaceSensorBase::copyToBin(BinaryDataHandler &pMem,
397 ConstFieldMaskArg whichField)
399 Inherited::copyToBin(pMem, whichField);
401 if(FieldBits::NoField != (TransformationFieldMask & whichField))
403 _sfTransformation.copyToBin(pMem);
405 if(FieldBits::NoField != (TranslationFieldMask & whichField))
407 _sfTranslation.copyToBin(pMem);
409 if(FieldBits::NoField != (RotationFieldMask & whichField))
411 _sfRotation.copyToBin(pMem);
413 if(FieldBits::NoField != (RotationScaleFieldMask & whichField))
415 _sfRotationScale.copyToBin(pMem);
417 if(FieldBits::NoField != (TranslationScaleFieldMask & whichField))
419 _sfTranslationScale.copyToBin(pMem);
423 void TransformationInterfaceSensorBase::copyFromBin(BinaryDataHandler &pMem,
424 ConstFieldMaskArg whichField)
426 Inherited::copyFromBin(pMem, whichField);
428 if(FieldBits::NoField != (TransformationFieldMask & whichField))
430 editSField(TransformationFieldMask);
431 _sfTransformation.copyFromBin(pMem);
433 if(FieldBits::NoField != (TranslationFieldMask & whichField))
435 editSField(TranslationFieldMask);
436 _sfTranslation.copyFromBin(pMem);
438 if(FieldBits::NoField != (RotationFieldMask & whichField))
440 editSField(RotationFieldMask);
441 _sfRotation.copyFromBin(pMem);
443 if(FieldBits::NoField != (RotationScaleFieldMask & whichField))
445 editSField(RotationScaleFieldMask);
446 _sfRotationScale.copyFromBin(pMem);
448 if(FieldBits::NoField != (TranslationScaleFieldMask & whichField))
450 editSField(TranslationScaleFieldMask);
451 _sfTranslationScale.copyFromBin(pMem);
455 //! create a new instance of the class
456 TransformationInterfaceSensorTransitPtr TransformationInterfaceSensorBase::createLocal(BitVector bFlags)
458 TransformationInterfaceSensorTransitPtr fc;
460 if(getClassType().getPrototype() != NULL)
462 FieldContainerTransitPtr tmpPtr =
463 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
465 fc = dynamic_pointer_cast<TransformationInterfaceSensor>(tmpPtr);
468 return fc;
471 //! create a new instance of the class, copy the container flags
472 TransformationInterfaceSensorTransitPtr TransformationInterfaceSensorBase::createDependent(BitVector bFlags)
474 TransformationInterfaceSensorTransitPtr fc;
476 if(getClassType().getPrototype() != NULL)
478 FieldContainerTransitPtr tmpPtr =
479 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
481 fc = dynamic_pointer_cast<TransformationInterfaceSensor>(tmpPtr);
484 return fc;
487 //! create a new instance of the class
488 TransformationInterfaceSensorTransitPtr TransformationInterfaceSensorBase::create(void)
490 TransformationInterfaceSensorTransitPtr fc;
492 if(getClassType().getPrototype() != NULL)
494 FieldContainerTransitPtr tmpPtr =
495 getClassType().getPrototype()-> shallowCopy();
497 fc = dynamic_pointer_cast<TransformationInterfaceSensor>(tmpPtr);
500 return fc;
503 TransformationInterfaceSensor *TransformationInterfaceSensorBase::createEmptyLocal(BitVector bFlags)
505 TransformationInterfaceSensor *returnValue;
507 newPtr<TransformationInterfaceSensor>(returnValue, bFlags);
509 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
511 return returnValue;
514 //! create an empty new instance of the class, do not copy the prototype
515 TransformationInterfaceSensor *TransformationInterfaceSensorBase::createEmpty(void)
517 TransformationInterfaceSensor *returnValue;
519 newPtr<TransformationInterfaceSensor>(returnValue, Thread::getCurrentLocalFlags());
521 returnValue->_pFieldFlags->_bNamespaceMask &=
522 ~Thread::getCurrentLocalFlags();
524 return returnValue;
528 FieldContainerTransitPtr TransformationInterfaceSensorBase::shallowCopyLocal(
529 BitVector bFlags) const
531 TransformationInterfaceSensor *tmpPtr;
533 newPtr(tmpPtr, dynamic_cast<const TransformationInterfaceSensor *>(this), bFlags);
535 FieldContainerTransitPtr returnValue(tmpPtr);
537 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
539 return returnValue;
542 FieldContainerTransitPtr TransformationInterfaceSensorBase::shallowCopyDependent(
543 BitVector bFlags) const
545 TransformationInterfaceSensor *tmpPtr;
547 newPtr(tmpPtr, dynamic_cast<const TransformationInterfaceSensor *>(this), ~bFlags);
549 FieldContainerTransitPtr returnValue(tmpPtr);
551 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
553 return returnValue;
556 FieldContainerTransitPtr TransformationInterfaceSensorBase::shallowCopy(void) const
558 TransformationInterfaceSensor *tmpPtr;
560 newPtr(tmpPtr,
561 dynamic_cast<const TransformationInterfaceSensor *>(this),
562 Thread::getCurrentLocalFlags());
564 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
566 FieldContainerTransitPtr returnValue(tmpPtr);
568 return returnValue;
574 /*------------------------- constructors ----------------------------------*/
576 TransformationInterfaceSensorBase::TransformationInterfaceSensorBase(void) :
577 Inherited(),
578 _sfTransformation (),
579 _sfTranslation (),
580 _sfRotation (),
581 _sfRotationScale (Real32(1.f)),
582 _sfTranslationScale (Real32(1.f))
586 TransformationInterfaceSensorBase::TransformationInterfaceSensorBase(const TransformationInterfaceSensorBase &source) :
587 Inherited(source),
588 _sfTransformation (source._sfTransformation ),
589 _sfTranslation (source._sfTranslation ),
590 _sfRotation (source._sfRotation ),
591 _sfRotationScale (source._sfRotationScale ),
592 _sfTranslationScale (source._sfTranslationScale )
597 /*-------------------------- destructors ----------------------------------*/
599 TransformationInterfaceSensorBase::~TransformationInterfaceSensorBase(void)
604 GetFieldHandlePtr TransformationInterfaceSensorBase::getHandleTransformation (void) const
606 SFMatrix::GetHandlePtr returnValue(
607 new SFMatrix::GetHandle(
608 &_sfTransformation,
609 this->getType().getFieldDesc(TransformationFieldId),
610 const_cast<TransformationInterfaceSensorBase *>(this)));
612 return returnValue;
615 EditFieldHandlePtr TransformationInterfaceSensorBase::editHandleTransformation (void)
617 SFMatrix::EditHandlePtr returnValue(
618 new SFMatrix::EditHandle(
619 &_sfTransformation,
620 this->getType().getFieldDesc(TransformationFieldId),
621 this));
624 editSField(TransformationFieldMask);
626 return returnValue;
629 GetFieldHandlePtr TransformationInterfaceSensorBase::getHandleTranslation (void) const
631 SFVec3f::GetHandlePtr returnValue(
632 new SFVec3f::GetHandle(
633 &_sfTranslation,
634 this->getType().getFieldDesc(TranslationFieldId),
635 const_cast<TransformationInterfaceSensorBase *>(this)));
637 return returnValue;
640 EditFieldHandlePtr TransformationInterfaceSensorBase::editHandleTranslation (void)
642 SFVec3f::EditHandlePtr returnValue(
643 new SFVec3f::EditHandle(
644 &_sfTranslation,
645 this->getType().getFieldDesc(TranslationFieldId),
646 this));
649 editSField(TranslationFieldMask);
651 return returnValue;
654 GetFieldHandlePtr TransformationInterfaceSensorBase::getHandleRotation (void) const
656 SFQuaternion::GetHandlePtr returnValue(
657 new SFQuaternion::GetHandle(
658 &_sfRotation,
659 this->getType().getFieldDesc(RotationFieldId),
660 const_cast<TransformationInterfaceSensorBase *>(this)));
662 return returnValue;
665 EditFieldHandlePtr TransformationInterfaceSensorBase::editHandleRotation (void)
667 SFQuaternion::EditHandlePtr returnValue(
668 new SFQuaternion::EditHandle(
669 &_sfRotation,
670 this->getType().getFieldDesc(RotationFieldId),
671 this));
674 editSField(RotationFieldMask);
676 return returnValue;
679 GetFieldHandlePtr TransformationInterfaceSensorBase::getHandleRotationScale (void) const
681 SFReal32::GetHandlePtr returnValue(
682 new SFReal32::GetHandle(
683 &_sfRotationScale,
684 this->getType().getFieldDesc(RotationScaleFieldId),
685 const_cast<TransformationInterfaceSensorBase *>(this)));
687 return returnValue;
690 EditFieldHandlePtr TransformationInterfaceSensorBase::editHandleRotationScale (void)
692 SFReal32::EditHandlePtr returnValue(
693 new SFReal32::EditHandle(
694 &_sfRotationScale,
695 this->getType().getFieldDesc(RotationScaleFieldId),
696 this));
699 editSField(RotationScaleFieldMask);
701 return returnValue;
704 GetFieldHandlePtr TransformationInterfaceSensorBase::getHandleTranslationScale (void) const
706 SFReal32::GetHandlePtr returnValue(
707 new SFReal32::GetHandle(
708 &_sfTranslationScale,
709 this->getType().getFieldDesc(TranslationScaleFieldId),
710 const_cast<TransformationInterfaceSensorBase *>(this)));
712 return returnValue;
715 EditFieldHandlePtr TransformationInterfaceSensorBase::editHandleTranslationScale(void)
717 SFReal32::EditHandlePtr returnValue(
718 new SFReal32::EditHandle(
719 &_sfTranslationScale,
720 this->getType().getFieldDesc(TranslationScaleFieldId),
721 this));
724 editSField(TranslationScaleFieldMask);
726 return returnValue;
730 #ifdef OSG_MT_CPTR_ASPECT
731 void TransformationInterfaceSensorBase::execSyncV( FieldContainer &oFrom,
732 ConstFieldMaskArg whichField,
733 AspectOffsetStore &oOffsets,
734 ConstFieldMaskArg syncMode,
735 const UInt32 uiSyncInfo)
737 TransformationInterfaceSensor *pThis = static_cast<TransformationInterfaceSensor *>(this);
739 pThis->execSync(static_cast<TransformationInterfaceSensor *>(&oFrom),
740 whichField,
741 oOffsets,
742 syncMode,
743 uiSyncInfo);
745 #endif
748 #ifdef OSG_MT_CPTR_ASPECT
749 FieldContainer *TransformationInterfaceSensorBase::createAspectCopy(
750 const FieldContainer *pRefAspect) const
752 TransformationInterfaceSensor *returnValue;
754 newAspectCopy(returnValue,
755 dynamic_cast<const TransformationInterfaceSensor *>(pRefAspect),
756 dynamic_cast<const TransformationInterfaceSensor *>(this));
758 return returnValue;
760 #endif
762 void TransformationInterfaceSensorBase::resolveLinks(void)
764 Inherited::resolveLinks();
770 OSG_END_NAMESPACE