1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
48 ** class AnimQuaternionBlender!
50 *****************************************************************************
51 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
65 #include "OSGAnimQuaternionChannel.h" // Channels Class
67 #include "OSGAnimQuaternionBlenderBase.h"
68 #include "OSGAnimQuaternionBlender.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::AnimQuaternionBlender
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var AnimQuaternionChannel * AnimQuaternionBlenderBase::_mfChannels
90 /*! \var Quaternion AnimQuaternionBlenderBase::_sfOutValue
95 /***************************************************************************\
96 * FieldType/FieldTrait Instantiation *
97 \***************************************************************************/
99 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
100 PointerType FieldTraits
<AnimQuaternionBlender
*, nsOSG
>::_type(
101 "AnimQuaternionBlenderPtr",
103 AnimQuaternionBlender::getClassType(),
107 OSG_FIELDTRAITS_GETTYPE_NS(AnimQuaternionBlender
*, nsOSG
)
109 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
110 AnimQuaternionBlender
*,
113 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
114 AnimQuaternionBlender
*,
117 /***************************************************************************\
118 * Field Description *
119 \***************************************************************************/
121 void AnimQuaternionBlenderBase::classDescInserter(TypeObject
&oType
)
123 FieldDescriptionBase
*pDesc
= NULL
;
126 pDesc
= new MFUnrecAnimQuaternionChannelPtr::Description(
127 MFUnrecAnimQuaternionChannelPtr::getClassType(),
130 ChannelsFieldId
, ChannelsFieldMask
,
132 (Field::FStdAccess
| Field::FClusterLocal
),
133 static_cast<FieldEditMethodSig
>(&AnimQuaternionBlender::editHandleChannels
),
134 static_cast<FieldGetMethodSig
>(&AnimQuaternionBlender::getHandleChannels
));
136 oType
.addInitialDesc(pDesc
);
138 pDesc
= new SFQuaternion::Description(
139 SFQuaternion::getClassType(),
142 OutValueFieldId
, OutValueFieldMask
,
144 (Field::FClusterLocal
),
145 static_cast<FieldEditMethodSig
>(&AnimQuaternionBlender::editHandleOutValue
),
146 static_cast<FieldGetMethodSig
>(&AnimQuaternionBlender::getHandleOutValue
));
148 oType
.addInitialDesc(pDesc
);
152 AnimQuaternionBlenderBase::TypeObject
AnimQuaternionBlenderBase::_type(
153 AnimQuaternionBlenderBase::getClassname(),
154 Inherited::getClassname(),
157 reinterpret_cast<PrototypeCreateF
>(&AnimQuaternionBlenderBase::createEmptyLocal
),
158 reinterpret_cast<InitContainerF
>(&AnimQuaternionBlender::initMethod
),
159 reinterpret_cast<ExitContainerF
>(&AnimQuaternionBlender::exitMethod
),
160 reinterpret_cast<InitalInsertDescFunc
>(
161 reinterpret_cast<void *>(&AnimQuaternionBlender::classDescInserter
)),
164 "<?xml version=\"1.0\"?>\n"
167 " name=\"AnimQuaternionBlender\"\n"
168 " parent=\"AnimBlender\"\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"
181 " name=\"channels\"\n"
182 " category=\"pointer\"\n"
183 " type=\"AnimQuaternionChannel\"\n"
184 " cardinality=\"multi\"\n"
185 " visibility=\"external\"\n"
186 " access=\"public\"\n"
187 " fieldFlags=\"FStdAccess, FClusterLocal\"\n"
191 " name=\"outValue\"\n"
192 " category=\"data\"\n"
193 " type=\"Quaternion\"\n"
194 " cardinality=\"single\"\n"
195 " visibility=\"external\"\n"
196 " access=\"public\"\n"
197 " fieldFlags=\"FClusterLocal\"\n"
200 "</FieldContainer>\n",
204 /*------------------------------ get -----------------------------------*/
206 FieldContainerType
&AnimQuaternionBlenderBase::getType(void)
211 const FieldContainerType
&AnimQuaternionBlenderBase::getType(void) const
216 UInt32
AnimQuaternionBlenderBase::getContainerSize(void) const
218 return sizeof(AnimQuaternionBlender
);
221 /*------------------------- decorator get ------------------------------*/
224 //! Get the AnimQuaternionBlender::_mfChannels field.
225 const MFUnrecAnimQuaternionChannelPtr
*AnimQuaternionBlenderBase::getMFChannels(void) const
230 MFUnrecAnimQuaternionChannelPtr
*AnimQuaternionBlenderBase::editMFChannels (void)
232 editMField(ChannelsFieldMask
, _mfChannels
);
236 AnimQuaternionChannel
* AnimQuaternionBlenderBase::getChannels(const UInt32 index
) const
238 return _mfChannels
[index
];
241 SFQuaternion
*AnimQuaternionBlenderBase::editSFOutValue(void)
243 editSField(OutValueFieldMask
);
248 const SFQuaternion
*AnimQuaternionBlenderBase::getSFOutValue(void) const
256 void AnimQuaternionBlenderBase::pushToChannels(AnimQuaternionChannel
* const value
)
258 editMField(ChannelsFieldMask
, _mfChannels
);
260 _mfChannels
.push_back(value
);
263 void AnimQuaternionBlenderBase::assignChannels (const MFUnrecAnimQuaternionChannelPtr
&value
)
265 MFUnrecAnimQuaternionChannelPtr::const_iterator elemIt
=
267 MFUnrecAnimQuaternionChannelPtr::const_iterator elemEnd
=
270 static_cast<AnimQuaternionBlender
*>(this)->clearChannels();
272 while(elemIt
!= elemEnd
)
274 this->pushToChannels(*elemIt
);
280 void AnimQuaternionBlenderBase::removeFromChannels(UInt32 uiIndex
)
282 if(uiIndex
< _mfChannels
.size())
284 editMField(ChannelsFieldMask
, _mfChannels
);
286 _mfChannels
.erase(uiIndex
);
290 void AnimQuaternionBlenderBase::removeObjFromChannels(AnimQuaternionChannel
* const value
)
292 Int32 iElemIdx
= _mfChannels
.findIndex(value
);
296 editMField(ChannelsFieldMask
, _mfChannels
);
298 _mfChannels
.erase(iElemIdx
);
301 void AnimQuaternionBlenderBase::clearChannels(void)
303 editMField(ChannelsFieldMask
, _mfChannels
);
311 /*------------------------------ access -----------------------------------*/
313 SizeT
AnimQuaternionBlenderBase::getBinSize(ConstFieldMaskArg whichField
)
315 SizeT returnValue
= Inherited::getBinSize(whichField
);
317 if(FieldBits::NoField
!= (ChannelsFieldMask
& whichField
))
319 returnValue
+= _mfChannels
.getBinSize();
321 if(FieldBits::NoField
!= (OutValueFieldMask
& whichField
))
323 returnValue
+= _sfOutValue
.getBinSize();
329 void AnimQuaternionBlenderBase::copyToBin(BinaryDataHandler
&pMem
,
330 ConstFieldMaskArg whichField
)
332 Inherited::copyToBin(pMem
, whichField
);
334 if(FieldBits::NoField
!= (ChannelsFieldMask
& whichField
))
336 _mfChannels
.copyToBin(pMem
);
338 if(FieldBits::NoField
!= (OutValueFieldMask
& whichField
))
340 _sfOutValue
.copyToBin(pMem
);
344 void AnimQuaternionBlenderBase::copyFromBin(BinaryDataHandler
&pMem
,
345 ConstFieldMaskArg whichField
)
347 Inherited::copyFromBin(pMem
, whichField
);
349 if(FieldBits::NoField
!= (ChannelsFieldMask
& whichField
))
351 editMField(ChannelsFieldMask
, _mfChannels
);
352 _mfChannels
.copyFromBin(pMem
);
354 if(FieldBits::NoField
!= (OutValueFieldMask
& whichField
))
356 editSField(OutValueFieldMask
);
357 _sfOutValue
.copyFromBin(pMem
);
361 //! create a new instance of the class
362 AnimQuaternionBlenderTransitPtr
AnimQuaternionBlenderBase::createLocal(BitVector bFlags
)
364 AnimQuaternionBlenderTransitPtr fc
;
366 if(getClassType().getPrototype() != NULL
)
368 FieldContainerTransitPtr tmpPtr
=
369 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
371 fc
= dynamic_pointer_cast
<AnimQuaternionBlender
>(tmpPtr
);
377 //! create a new instance of the class, copy the container flags
378 AnimQuaternionBlenderTransitPtr
AnimQuaternionBlenderBase::createDependent(BitVector bFlags
)
380 AnimQuaternionBlenderTransitPtr fc
;
382 if(getClassType().getPrototype() != NULL
)
384 FieldContainerTransitPtr tmpPtr
=
385 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
387 fc
= dynamic_pointer_cast
<AnimQuaternionBlender
>(tmpPtr
);
393 //! create a new instance of the class
394 AnimQuaternionBlenderTransitPtr
AnimQuaternionBlenderBase::create(void)
396 AnimQuaternionBlenderTransitPtr fc
;
398 if(getClassType().getPrototype() != NULL
)
400 FieldContainerTransitPtr tmpPtr
=
401 getClassType().getPrototype()-> shallowCopy();
403 fc
= dynamic_pointer_cast
<AnimQuaternionBlender
>(tmpPtr
);
409 AnimQuaternionBlender
*AnimQuaternionBlenderBase::createEmptyLocal(BitVector bFlags
)
411 AnimQuaternionBlender
*returnValue
;
413 newPtr
<AnimQuaternionBlender
>(returnValue
, bFlags
);
415 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
420 //! create an empty new instance of the class, do not copy the prototype
421 AnimQuaternionBlender
*AnimQuaternionBlenderBase::createEmpty(void)
423 AnimQuaternionBlender
*returnValue
;
425 newPtr
<AnimQuaternionBlender
>(returnValue
, Thread::getCurrentLocalFlags());
427 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
428 ~Thread::getCurrentLocalFlags();
434 FieldContainerTransitPtr
AnimQuaternionBlenderBase::shallowCopyLocal(
435 BitVector bFlags
) const
437 AnimQuaternionBlender
*tmpPtr
;
439 newPtr(tmpPtr
, dynamic_cast<const AnimQuaternionBlender
*>(this), bFlags
);
441 FieldContainerTransitPtr
returnValue(tmpPtr
);
443 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
448 FieldContainerTransitPtr
AnimQuaternionBlenderBase::shallowCopyDependent(
449 BitVector bFlags
) const
451 AnimQuaternionBlender
*tmpPtr
;
453 newPtr(tmpPtr
, dynamic_cast<const AnimQuaternionBlender
*>(this), ~bFlags
);
455 FieldContainerTransitPtr
returnValue(tmpPtr
);
457 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
462 FieldContainerTransitPtr
AnimQuaternionBlenderBase::shallowCopy(void) const
464 AnimQuaternionBlender
*tmpPtr
;
467 dynamic_cast<const AnimQuaternionBlender
*>(this),
468 Thread::getCurrentLocalFlags());
470 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
472 FieldContainerTransitPtr
returnValue(tmpPtr
);
480 /*------------------------- constructors ----------------------------------*/
482 AnimQuaternionBlenderBase::AnimQuaternionBlenderBase(void) :
489 AnimQuaternionBlenderBase::AnimQuaternionBlenderBase(const AnimQuaternionBlenderBase
&source
) :
492 _sfOutValue (source
._sfOutValue
)
497 /*-------------------------- destructors ----------------------------------*/
499 AnimQuaternionBlenderBase::~AnimQuaternionBlenderBase(void)
503 void AnimQuaternionBlenderBase::onCreate(const AnimQuaternionBlender
*source
)
505 Inherited::onCreate(source
);
509 AnimQuaternionBlender
*pThis
= static_cast<AnimQuaternionBlender
*>(this);
511 MFUnrecAnimQuaternionChannelPtr::const_iterator ChannelsIt
=
512 source
->_mfChannels
.begin();
513 MFUnrecAnimQuaternionChannelPtr::const_iterator ChannelsEnd
=
514 source
->_mfChannels
.end ();
516 while(ChannelsIt
!= ChannelsEnd
)
518 pThis
->pushToChannels(*ChannelsIt
);
525 GetFieldHandlePtr
AnimQuaternionBlenderBase::getHandleChannels (void) const
527 MFUnrecAnimQuaternionChannelPtr::GetHandlePtr
returnValue(
528 new MFUnrecAnimQuaternionChannelPtr::GetHandle(
530 this->getType().getFieldDesc(ChannelsFieldId
),
531 const_cast<AnimQuaternionBlenderBase
*>(this)));
536 EditFieldHandlePtr
AnimQuaternionBlenderBase::editHandleChannels (void)
538 MFUnrecAnimQuaternionChannelPtr::EditHandlePtr
returnValue(
539 new MFUnrecAnimQuaternionChannelPtr::EditHandle(
541 this->getType().getFieldDesc(ChannelsFieldId
),
544 returnValue
->setAddMethod(
545 boost::bind(&AnimQuaternionBlender::pushToChannels
,
546 static_cast<AnimQuaternionBlender
*>(this), _1
));
547 returnValue
->setRemoveMethod(
548 boost::bind(&AnimQuaternionBlender::removeFromChannels
,
549 static_cast<AnimQuaternionBlender
*>(this), _1
));
550 returnValue
->setRemoveObjMethod(
551 boost::bind(&AnimQuaternionBlender::removeObjFromChannels
,
552 static_cast<AnimQuaternionBlender
*>(this), _1
));
553 returnValue
->setClearMethod(
554 boost::bind(&AnimQuaternionBlender::clearChannels
,
555 static_cast<AnimQuaternionBlender
*>(this)));
557 editMField(ChannelsFieldMask
, _mfChannels
);
562 GetFieldHandlePtr
AnimQuaternionBlenderBase::getHandleOutValue (void) const
564 SFQuaternion::GetHandlePtr
returnValue(
565 new SFQuaternion::GetHandle(
567 this->getType().getFieldDesc(OutValueFieldId
),
568 const_cast<AnimQuaternionBlenderBase
*>(this)));
573 EditFieldHandlePtr
AnimQuaternionBlenderBase::editHandleOutValue (void)
575 SFQuaternion::EditHandlePtr
returnValue(
576 new SFQuaternion::EditHandle(
578 this->getType().getFieldDesc(OutValueFieldId
),
582 editSField(OutValueFieldMask
);
588 #ifdef OSG_MT_CPTR_ASPECT
589 void AnimQuaternionBlenderBase::execSyncV( FieldContainer
&oFrom
,
590 ConstFieldMaskArg whichField
,
591 AspectOffsetStore
&oOffsets
,
592 ConstFieldMaskArg syncMode
,
593 const UInt32 uiSyncInfo
)
595 AnimQuaternionBlender
*pThis
= static_cast<AnimQuaternionBlender
*>(this);
597 pThis
->execSync(static_cast<AnimQuaternionBlender
*>(&oFrom
),
606 #ifdef OSG_MT_CPTR_ASPECT
607 FieldContainer
*AnimQuaternionBlenderBase::createAspectCopy(
608 const FieldContainer
*pRefAspect
) const
610 AnimQuaternionBlender
*returnValue
;
612 newAspectCopy(returnValue
,
613 dynamic_cast<const AnimQuaternionBlender
*>(pRefAspect
),
614 dynamic_cast<const AnimQuaternionBlender
*>(this));
620 void AnimQuaternionBlenderBase::resolveLinks(void)
622 Inherited::resolveLinks();
624 static_cast<AnimQuaternionBlender
*>(this)->clearChannels();