changed: gcc8 base update
[opensg.git] / Source / System / Dynamics / Animation / OSGAnimQuaternionChannelBase.cpp
blob63a2fe77dd8ded5cb9d61ad71b7e069dfdf34c59
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 AnimQuaternionChannel!
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"
65 #include "OSGAnimQuaternionDataSource.h" // Data Class
67 #include "OSGAnimQuaternionChannelBase.h"
68 #include "OSGAnimQuaternionChannel.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::AnimQuaternionChannel
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var AnimQuaternionDataSource * AnimQuaternionChannelBase::_sfData
90 /*! \var Quaternion AnimQuaternionChannelBase::_sfOutValue
95 /***************************************************************************\
96 * FieldType/FieldTrait Instantiation *
97 \***************************************************************************/
99 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
100 PointerType FieldTraits<AnimQuaternionChannel *, nsOSG>::_type(
101 "AnimQuaternionChannelPtr",
102 "AnimChannelPtr",
103 AnimQuaternionChannel::getClassType(),
104 nsOSG);
105 #endif
107 OSG_FIELDTRAITS_GETTYPE_NS(AnimQuaternionChannel *, nsOSG)
109 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
110 AnimQuaternionChannel *,
111 nsOSG)
113 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
114 AnimQuaternionChannel *,
115 nsOSG)
117 /***************************************************************************\
118 * Field Description *
119 \***************************************************************************/
121 void AnimQuaternionChannelBase::classDescInserter(TypeObject &oType)
123 FieldDescriptionBase *pDesc = NULL;
126 pDesc = new SFUnrecAnimQuaternionDataSourcePtr::Description(
127 SFUnrecAnimQuaternionDataSourcePtr::getClassType(),
128 "data",
130 DataFieldId, DataFieldMask,
131 true,
132 (Field::FStdAccess | Field::FClusterLocal),
133 static_cast<FieldEditMethodSig>(&AnimQuaternionChannel::editHandleData),
134 static_cast<FieldGetMethodSig >(&AnimQuaternionChannel::getHandleData));
136 oType.addInitialDesc(pDesc);
138 pDesc = new SFQuaternion::Description(
139 SFQuaternion::getClassType(),
140 "outValue",
142 OutValueFieldId, OutValueFieldMask,
143 true,
144 (Field::FClusterLocal),
145 static_cast<FieldEditMethodSig>(&AnimQuaternionChannel::editHandleOutValue),
146 static_cast<FieldGetMethodSig >(&AnimQuaternionChannel::getHandleOutValue));
148 oType.addInitialDesc(pDesc);
152 AnimQuaternionChannelBase::TypeObject AnimQuaternionChannelBase::_type(
153 AnimQuaternionChannelBase::getClassname(),
154 Inherited::getClassname(),
155 "NULL",
156 nsOSG, //Namespace
157 reinterpret_cast<PrototypeCreateF>(&AnimQuaternionChannelBase::createEmptyLocal),
158 reinterpret_cast<InitContainerF>(&AnimQuaternionChannel::initMethod),
159 reinterpret_cast<ExitContainerF>(&AnimQuaternionChannel::exitMethod),
160 reinterpret_cast<InitalInsertDescFunc>(
161 reinterpret_cast<void *>(&AnimQuaternionChannel::classDescInserter)),
162 false,
164 "<?xml version=\"1.0\"?>\n"
165 "\n"
166 "<FieldContainer\n"
167 " name=\"AnimQuaternionChannel\"\n"
168 " parent=\"AnimChannel\"\n"
169 " library=\"Dynamics\"\n"
170 " pointerfieldtypes=\"both\"\n"
171 " structure=\"concrete\"\n"
172 " systemcomponent=\"true\"\n"
173 " parentsystemcomponent=\"true\"\n"
174 " decoratable=\"false\"\n"
175 " useLocalIncludes=\"false\"\n"
176 " isNodeCore=\"true\"\n"
177 " isBundle=\"false\"\n"
178 " parentFields=\"none\"\n"
179 ">\n"
180 " <Field\n"
181 " name=\"data\"\n"
182 " category=\"pointer\"\n"
183 " type=\"AnimQuaternionDataSource\"\n"
184 " cardinality=\"single\"\n"
185 " visibility=\"internal\"\n"
186 " access=\"public\"\n"
187 " defaultValue=\"NULL\"\n"
188 " fieldFlags=\"FStdAccess, FClusterLocal\"\n"
189 " >\n"
190 " </Field>\n"
191 " <Field\n"
192 " name=\"outValue\"\n"
193 " category=\"data\"\n"
194 " type=\"Quaternion\"\n"
195 " cardinality=\"single\"\n"
196 " visibility=\"internal\"\n"
197 " access=\"public\"\n"
198 " fieldFlags=\"FClusterLocal\"\n"
199 " >\n"
200 " </Field>\n"
201 "</FieldContainer>\n",
205 /*------------------------------ get -----------------------------------*/
207 FieldContainerType &AnimQuaternionChannelBase::getType(void)
209 return _type;
212 const FieldContainerType &AnimQuaternionChannelBase::getType(void) const
214 return _type;
217 UInt32 AnimQuaternionChannelBase::getContainerSize(void) const
219 return sizeof(AnimQuaternionChannel);
222 /*------------------------- decorator get ------------------------------*/
225 //! Get the AnimQuaternionChannel::_sfData field.
226 const SFUnrecAnimQuaternionDataSourcePtr *AnimQuaternionChannelBase::getSFData(void) const
228 return &_sfData;
231 SFUnrecAnimQuaternionDataSourcePtr *AnimQuaternionChannelBase::editSFData (void)
233 editSField(DataFieldMask);
235 return &_sfData;
238 //! Get the value of the AnimQuaternionChannel::_sfData field.
239 AnimQuaternionDataSource * AnimQuaternionChannelBase::getData(void) const
241 return _sfData.getValue();
244 //! Set the value of the AnimQuaternionChannel::_sfData field.
245 void AnimQuaternionChannelBase::setData(AnimQuaternionDataSource * const value)
247 editSField(DataFieldMask);
249 _sfData.setValue(value);
253 SFQuaternion *AnimQuaternionChannelBase::editSFOutValue(void)
255 editSField(OutValueFieldMask);
257 return &_sfOutValue;
260 const SFQuaternion *AnimQuaternionChannelBase::getSFOutValue(void) const
262 return &_sfOutValue;
270 /*------------------------------ access -----------------------------------*/
272 SizeT AnimQuaternionChannelBase::getBinSize(ConstFieldMaskArg whichField)
274 SizeT returnValue = Inherited::getBinSize(whichField);
276 if(FieldBits::NoField != (DataFieldMask & whichField))
278 returnValue += _sfData.getBinSize();
280 if(FieldBits::NoField != (OutValueFieldMask & whichField))
282 returnValue += _sfOutValue.getBinSize();
285 return returnValue;
288 void AnimQuaternionChannelBase::copyToBin(BinaryDataHandler &pMem,
289 ConstFieldMaskArg whichField)
291 Inherited::copyToBin(pMem, whichField);
293 if(FieldBits::NoField != (DataFieldMask & whichField))
295 _sfData.copyToBin(pMem);
297 if(FieldBits::NoField != (OutValueFieldMask & whichField))
299 _sfOutValue.copyToBin(pMem);
303 void AnimQuaternionChannelBase::copyFromBin(BinaryDataHandler &pMem,
304 ConstFieldMaskArg whichField)
306 Inherited::copyFromBin(pMem, whichField);
308 if(FieldBits::NoField != (DataFieldMask & whichField))
310 editSField(DataFieldMask);
311 _sfData.copyFromBin(pMem);
313 if(FieldBits::NoField != (OutValueFieldMask & whichField))
315 editSField(OutValueFieldMask);
316 _sfOutValue.copyFromBin(pMem);
320 //! create a new instance of the class
321 AnimQuaternionChannelTransitPtr AnimQuaternionChannelBase::createLocal(BitVector bFlags)
323 AnimQuaternionChannelTransitPtr fc;
325 if(getClassType().getPrototype() != NULL)
327 FieldContainerTransitPtr tmpPtr =
328 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
330 fc = dynamic_pointer_cast<AnimQuaternionChannel>(tmpPtr);
333 return fc;
336 //! create a new instance of the class, copy the container flags
337 AnimQuaternionChannelTransitPtr AnimQuaternionChannelBase::createDependent(BitVector bFlags)
339 AnimQuaternionChannelTransitPtr fc;
341 if(getClassType().getPrototype() != NULL)
343 FieldContainerTransitPtr tmpPtr =
344 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
346 fc = dynamic_pointer_cast<AnimQuaternionChannel>(tmpPtr);
349 return fc;
352 //! create a new instance of the class
353 AnimQuaternionChannelTransitPtr AnimQuaternionChannelBase::create(void)
355 AnimQuaternionChannelTransitPtr fc;
357 if(getClassType().getPrototype() != NULL)
359 FieldContainerTransitPtr tmpPtr =
360 getClassType().getPrototype()-> shallowCopy();
362 fc = dynamic_pointer_cast<AnimQuaternionChannel>(tmpPtr);
365 return fc;
368 AnimQuaternionChannel *AnimQuaternionChannelBase::createEmptyLocal(BitVector bFlags)
370 AnimQuaternionChannel *returnValue;
372 newPtr<AnimQuaternionChannel>(returnValue, bFlags);
374 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
376 return returnValue;
379 //! create an empty new instance of the class, do not copy the prototype
380 AnimQuaternionChannel *AnimQuaternionChannelBase::createEmpty(void)
382 AnimQuaternionChannel *returnValue;
384 newPtr<AnimQuaternionChannel>(returnValue, Thread::getCurrentLocalFlags());
386 returnValue->_pFieldFlags->_bNamespaceMask &=
387 ~Thread::getCurrentLocalFlags();
389 return returnValue;
393 FieldContainerTransitPtr AnimQuaternionChannelBase::shallowCopyLocal(
394 BitVector bFlags) const
396 AnimQuaternionChannel *tmpPtr;
398 newPtr(tmpPtr, dynamic_cast<const AnimQuaternionChannel *>(this), bFlags);
400 FieldContainerTransitPtr returnValue(tmpPtr);
402 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
404 return returnValue;
407 FieldContainerTransitPtr AnimQuaternionChannelBase::shallowCopyDependent(
408 BitVector bFlags) const
410 AnimQuaternionChannel *tmpPtr;
412 newPtr(tmpPtr, dynamic_cast<const AnimQuaternionChannel *>(this), ~bFlags);
414 FieldContainerTransitPtr returnValue(tmpPtr);
416 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
418 return returnValue;
421 FieldContainerTransitPtr AnimQuaternionChannelBase::shallowCopy(void) const
423 AnimQuaternionChannel *tmpPtr;
425 newPtr(tmpPtr,
426 dynamic_cast<const AnimQuaternionChannel *>(this),
427 Thread::getCurrentLocalFlags());
429 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
431 FieldContainerTransitPtr returnValue(tmpPtr);
433 return returnValue;
439 /*------------------------- constructors ----------------------------------*/
441 AnimQuaternionChannelBase::AnimQuaternionChannelBase(void) :
442 Inherited(),
443 _sfData (NULL),
444 _sfOutValue ()
448 AnimQuaternionChannelBase::AnimQuaternionChannelBase(const AnimQuaternionChannelBase &source) :
449 Inherited(source),
450 _sfData (NULL),
451 _sfOutValue (source._sfOutValue )
456 /*-------------------------- destructors ----------------------------------*/
458 AnimQuaternionChannelBase::~AnimQuaternionChannelBase(void)
462 void AnimQuaternionChannelBase::onCreate(const AnimQuaternionChannel *source)
464 Inherited::onCreate(source);
466 if(source != NULL)
468 AnimQuaternionChannel *pThis = static_cast<AnimQuaternionChannel *>(this);
470 pThis->setData(source->getData());
474 GetFieldHandlePtr AnimQuaternionChannelBase::getHandleData (void) const
476 SFUnrecAnimQuaternionDataSourcePtr::GetHandlePtr returnValue(
477 new SFUnrecAnimQuaternionDataSourcePtr::GetHandle(
478 &_sfData,
479 this->getType().getFieldDesc(DataFieldId),
480 const_cast<AnimQuaternionChannelBase *>(this)));
482 return returnValue;
485 EditFieldHandlePtr AnimQuaternionChannelBase::editHandleData (void)
487 SFUnrecAnimQuaternionDataSourcePtr::EditHandlePtr returnValue(
488 new SFUnrecAnimQuaternionDataSourcePtr::EditHandle(
489 &_sfData,
490 this->getType().getFieldDesc(DataFieldId),
491 this));
493 returnValue->setSetMethod(
494 boost::bind(&AnimQuaternionChannel::setData,
495 static_cast<AnimQuaternionChannel *>(this), _1));
497 editSField(DataFieldMask);
499 return returnValue;
502 GetFieldHandlePtr AnimQuaternionChannelBase::getHandleOutValue (void) const
504 SFQuaternion::GetHandlePtr returnValue(
505 new SFQuaternion::GetHandle(
506 &_sfOutValue,
507 this->getType().getFieldDesc(OutValueFieldId),
508 const_cast<AnimQuaternionChannelBase *>(this)));
510 return returnValue;
513 EditFieldHandlePtr AnimQuaternionChannelBase::editHandleOutValue (void)
515 SFQuaternion::EditHandlePtr returnValue(
516 new SFQuaternion::EditHandle(
517 &_sfOutValue,
518 this->getType().getFieldDesc(OutValueFieldId),
519 this));
522 editSField(OutValueFieldMask);
524 return returnValue;
528 #ifdef OSG_MT_CPTR_ASPECT
529 void AnimQuaternionChannelBase::execSyncV( FieldContainer &oFrom,
530 ConstFieldMaskArg whichField,
531 AspectOffsetStore &oOffsets,
532 ConstFieldMaskArg syncMode,
533 const UInt32 uiSyncInfo)
535 AnimQuaternionChannel *pThis = static_cast<AnimQuaternionChannel *>(this);
537 pThis->execSync(static_cast<AnimQuaternionChannel *>(&oFrom),
538 whichField,
539 oOffsets,
540 syncMode,
541 uiSyncInfo);
543 #endif
546 #ifdef OSG_MT_CPTR_ASPECT
547 FieldContainer *AnimQuaternionChannelBase::createAspectCopy(
548 const FieldContainer *pRefAspect) const
550 AnimQuaternionChannel *returnValue;
552 newAspectCopy(returnValue,
553 dynamic_cast<const AnimQuaternionChannel *>(pRefAspect),
554 dynamic_cast<const AnimQuaternionChannel *>(this));
556 return returnValue;
558 #endif
560 void AnimQuaternionChannelBase::resolveLinks(void)
562 Inherited::resolveLinks();
564 static_cast<AnimQuaternionChannel *>(this)->setData(NULL);
570 OSG_END_NAMESPACE