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 AnimMatrixBlender!
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 "OSGAnimMatrixChannel.h" // Channels Class
67 #include "OSGAnimMatrixBlenderBase.h"
68 #include "OSGAnimMatrixBlender.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::AnimMatrixBlender
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var AnimMatrixChannel * AnimMatrixBlenderBase::_mfChannels
90 /*! \var Matrix AnimMatrixBlenderBase::_sfOutValue
95 /***************************************************************************\
96 * FieldType/FieldTrait Instantiation *
97 \***************************************************************************/
99 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
100 PointerType FieldTraits
<AnimMatrixBlender
*, nsOSG
>::_type(
101 "AnimMatrixBlenderPtr",
103 AnimMatrixBlender::getClassType(),
107 OSG_FIELDTRAITS_GETTYPE_NS(AnimMatrixBlender
*, nsOSG
)
109 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
113 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
117 /***************************************************************************\
118 * Field Description *
119 \***************************************************************************/
121 void AnimMatrixBlenderBase::classDescInserter(TypeObject
&oType
)
123 FieldDescriptionBase
*pDesc
= NULL
;
126 pDesc
= new MFUnrecAnimMatrixChannelPtr::Description(
127 MFUnrecAnimMatrixChannelPtr::getClassType(),
130 ChannelsFieldId
, ChannelsFieldMask
,
132 (Field::FStdAccess
| Field::FClusterLocal
),
133 static_cast<FieldEditMethodSig
>(&AnimMatrixBlender::editHandleChannels
),
134 static_cast<FieldGetMethodSig
>(&AnimMatrixBlender::getHandleChannels
));
136 oType
.addInitialDesc(pDesc
);
138 pDesc
= new SFMatrix::Description(
139 SFMatrix::getClassType(),
142 OutValueFieldId
, OutValueFieldMask
,
144 (Field::FClusterLocal
),
145 static_cast<FieldEditMethodSig
>(&AnimMatrixBlender::editHandleOutValue
),
146 static_cast<FieldGetMethodSig
>(&AnimMatrixBlender::getHandleOutValue
));
148 oType
.addInitialDesc(pDesc
);
152 AnimMatrixBlenderBase::TypeObject
AnimMatrixBlenderBase::_type(
153 AnimMatrixBlenderBase::getClassname(),
154 Inherited::getClassname(),
157 reinterpret_cast<PrototypeCreateF
>(&AnimMatrixBlenderBase::createEmptyLocal
),
158 reinterpret_cast<InitContainerF
>(&AnimMatrixBlender::initMethod
),
159 reinterpret_cast<ExitContainerF
>(&AnimMatrixBlender::exitMethod
),
160 reinterpret_cast<InitalInsertDescFunc
>(
161 reinterpret_cast<void *>(&AnimMatrixBlender::classDescInserter
)),
164 "<?xml version=\"1.0\"?>\n"
167 " name=\"AnimMatrixBlender\"\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=\"AnimMatrixChannel\"\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"
194 " cardinality=\"single\"\n"
195 " visibility=\"external\"\n"
196 " access=\"public\"\n"
197 " fieldFlags=\"FClusterLocal\"\n"
200 "</FieldContainer>\n",
204 /*------------------------------ get -----------------------------------*/
206 FieldContainerType
&AnimMatrixBlenderBase::getType(void)
211 const FieldContainerType
&AnimMatrixBlenderBase::getType(void) const
216 UInt32
AnimMatrixBlenderBase::getContainerSize(void) const
218 return sizeof(AnimMatrixBlender
);
221 /*------------------------- decorator get ------------------------------*/
224 //! Get the AnimMatrixBlender::_mfChannels field.
225 const MFUnrecAnimMatrixChannelPtr
*AnimMatrixBlenderBase::getMFChannels(void) const
230 MFUnrecAnimMatrixChannelPtr
*AnimMatrixBlenderBase::editMFChannels (void)
232 editMField(ChannelsFieldMask
, _mfChannels
);
236 AnimMatrixChannel
* AnimMatrixBlenderBase::getChannels(const UInt32 index
) const
238 return _mfChannels
[index
];
241 SFMatrix
*AnimMatrixBlenderBase::editSFOutValue(void)
243 editSField(OutValueFieldMask
);
248 const SFMatrix
*AnimMatrixBlenderBase::getSFOutValue(void) const
256 void AnimMatrixBlenderBase::pushToChannels(AnimMatrixChannel
* const value
)
258 editMField(ChannelsFieldMask
, _mfChannels
);
260 _mfChannels
.push_back(value
);
263 void AnimMatrixBlenderBase::assignChannels (const MFUnrecAnimMatrixChannelPtr
&value
)
265 MFUnrecAnimMatrixChannelPtr::const_iterator elemIt
=
267 MFUnrecAnimMatrixChannelPtr::const_iterator elemEnd
=
270 static_cast<AnimMatrixBlender
*>(this)->clearChannels();
272 while(elemIt
!= elemEnd
)
274 this->pushToChannels(*elemIt
);
280 void AnimMatrixBlenderBase::removeFromChannels(UInt32 uiIndex
)
282 if(uiIndex
< _mfChannels
.size())
284 editMField(ChannelsFieldMask
, _mfChannels
);
286 _mfChannels
.erase(uiIndex
);
290 void AnimMatrixBlenderBase::removeObjFromChannels(AnimMatrixChannel
* const value
)
292 Int32 iElemIdx
= _mfChannels
.findIndex(value
);
296 editMField(ChannelsFieldMask
, _mfChannels
);
298 _mfChannels
.erase(iElemIdx
);
301 void AnimMatrixBlenderBase::clearChannels(void)
303 editMField(ChannelsFieldMask
, _mfChannels
);
311 /*------------------------------ access -----------------------------------*/
313 SizeT
AnimMatrixBlenderBase::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 AnimMatrixBlenderBase::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 AnimMatrixBlenderBase::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 AnimMatrixBlenderTransitPtr
AnimMatrixBlenderBase::createLocal(BitVector bFlags
)
364 AnimMatrixBlenderTransitPtr fc
;
366 if(getClassType().getPrototype() != NULL
)
368 FieldContainerTransitPtr tmpPtr
=
369 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
371 fc
= dynamic_pointer_cast
<AnimMatrixBlender
>(tmpPtr
);
377 //! create a new instance of the class, copy the container flags
378 AnimMatrixBlenderTransitPtr
AnimMatrixBlenderBase::createDependent(BitVector bFlags
)
380 AnimMatrixBlenderTransitPtr fc
;
382 if(getClassType().getPrototype() != NULL
)
384 FieldContainerTransitPtr tmpPtr
=
385 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
387 fc
= dynamic_pointer_cast
<AnimMatrixBlender
>(tmpPtr
);
393 //! create a new instance of the class
394 AnimMatrixBlenderTransitPtr
AnimMatrixBlenderBase::create(void)
396 AnimMatrixBlenderTransitPtr fc
;
398 if(getClassType().getPrototype() != NULL
)
400 FieldContainerTransitPtr tmpPtr
=
401 getClassType().getPrototype()-> shallowCopy();
403 fc
= dynamic_pointer_cast
<AnimMatrixBlender
>(tmpPtr
);
409 AnimMatrixBlender
*AnimMatrixBlenderBase::createEmptyLocal(BitVector bFlags
)
411 AnimMatrixBlender
*returnValue
;
413 newPtr
<AnimMatrixBlender
>(returnValue
, bFlags
);
415 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
420 //! create an empty new instance of the class, do not copy the prototype
421 AnimMatrixBlender
*AnimMatrixBlenderBase::createEmpty(void)
423 AnimMatrixBlender
*returnValue
;
425 newPtr
<AnimMatrixBlender
>(returnValue
, Thread::getCurrentLocalFlags());
427 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
428 ~Thread::getCurrentLocalFlags();
434 FieldContainerTransitPtr
AnimMatrixBlenderBase::shallowCopyLocal(
435 BitVector bFlags
) const
437 AnimMatrixBlender
*tmpPtr
;
439 newPtr(tmpPtr
, dynamic_cast<const AnimMatrixBlender
*>(this), bFlags
);
441 FieldContainerTransitPtr
returnValue(tmpPtr
);
443 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
448 FieldContainerTransitPtr
AnimMatrixBlenderBase::shallowCopyDependent(
449 BitVector bFlags
) const
451 AnimMatrixBlender
*tmpPtr
;
453 newPtr(tmpPtr
, dynamic_cast<const AnimMatrixBlender
*>(this), ~bFlags
);
455 FieldContainerTransitPtr
returnValue(tmpPtr
);
457 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
462 FieldContainerTransitPtr
AnimMatrixBlenderBase::shallowCopy(void) const
464 AnimMatrixBlender
*tmpPtr
;
467 dynamic_cast<const AnimMatrixBlender
*>(this),
468 Thread::getCurrentLocalFlags());
470 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
472 FieldContainerTransitPtr
returnValue(tmpPtr
);
480 /*------------------------- constructors ----------------------------------*/
482 AnimMatrixBlenderBase::AnimMatrixBlenderBase(void) :
489 AnimMatrixBlenderBase::AnimMatrixBlenderBase(const AnimMatrixBlenderBase
&source
) :
492 _sfOutValue (source
._sfOutValue
)
497 /*-------------------------- destructors ----------------------------------*/
499 AnimMatrixBlenderBase::~AnimMatrixBlenderBase(void)
503 void AnimMatrixBlenderBase::onCreate(const AnimMatrixBlender
*source
)
505 Inherited::onCreate(source
);
509 AnimMatrixBlender
*pThis
= static_cast<AnimMatrixBlender
*>(this);
511 MFUnrecAnimMatrixChannelPtr::const_iterator ChannelsIt
=
512 source
->_mfChannels
.begin();
513 MFUnrecAnimMatrixChannelPtr::const_iterator ChannelsEnd
=
514 source
->_mfChannels
.end ();
516 while(ChannelsIt
!= ChannelsEnd
)
518 pThis
->pushToChannels(*ChannelsIt
);
525 GetFieldHandlePtr
AnimMatrixBlenderBase::getHandleChannels (void) const
527 MFUnrecAnimMatrixChannelPtr::GetHandlePtr
returnValue(
528 new MFUnrecAnimMatrixChannelPtr::GetHandle(
530 this->getType().getFieldDesc(ChannelsFieldId
),
531 const_cast<AnimMatrixBlenderBase
*>(this)));
536 EditFieldHandlePtr
AnimMatrixBlenderBase::editHandleChannels (void)
538 MFUnrecAnimMatrixChannelPtr::EditHandlePtr
returnValue(
539 new MFUnrecAnimMatrixChannelPtr::EditHandle(
541 this->getType().getFieldDesc(ChannelsFieldId
),
544 returnValue
->setAddMethod(
545 boost::bind(&AnimMatrixBlender::pushToChannels
,
546 static_cast<AnimMatrixBlender
*>(this), _1
));
547 returnValue
->setRemoveMethod(
548 boost::bind(&AnimMatrixBlender::removeFromChannels
,
549 static_cast<AnimMatrixBlender
*>(this), _1
));
550 returnValue
->setRemoveObjMethod(
551 boost::bind(&AnimMatrixBlender::removeObjFromChannels
,
552 static_cast<AnimMatrixBlender
*>(this), _1
));
553 returnValue
->setClearMethod(
554 boost::bind(&AnimMatrixBlender::clearChannels
,
555 static_cast<AnimMatrixBlender
*>(this)));
557 editMField(ChannelsFieldMask
, _mfChannels
);
562 GetFieldHandlePtr
AnimMatrixBlenderBase::getHandleOutValue (void) const
564 SFMatrix::GetHandlePtr
returnValue(
565 new SFMatrix::GetHandle(
567 this->getType().getFieldDesc(OutValueFieldId
),
568 const_cast<AnimMatrixBlenderBase
*>(this)));
573 EditFieldHandlePtr
AnimMatrixBlenderBase::editHandleOutValue (void)
575 SFMatrix::EditHandlePtr
returnValue(
576 new SFMatrix::EditHandle(
578 this->getType().getFieldDesc(OutValueFieldId
),
582 editSField(OutValueFieldMask
);
588 #ifdef OSG_MT_CPTR_ASPECT
589 void AnimMatrixBlenderBase::execSyncV( FieldContainer
&oFrom
,
590 ConstFieldMaskArg whichField
,
591 AspectOffsetStore
&oOffsets
,
592 ConstFieldMaskArg syncMode
,
593 const UInt32 uiSyncInfo
)
595 AnimMatrixBlender
*pThis
= static_cast<AnimMatrixBlender
*>(this);
597 pThis
->execSync(static_cast<AnimMatrixBlender
*>(&oFrom
),
606 #ifdef OSG_MT_CPTR_ASPECT
607 FieldContainer
*AnimMatrixBlenderBase::createAspectCopy(
608 const FieldContainer
*pRefAspect
) const
610 AnimMatrixBlender
*returnValue
;
612 newAspectCopy(returnValue
,
613 dynamic_cast<const AnimMatrixBlender
*>(pRefAspect
),
614 dynamic_cast<const AnimMatrixBlender
*>(this));
620 void AnimMatrixBlenderBase::resolveLinks(void)
622 Inherited::resolveLinks();
624 static_cast<AnimMatrixBlender
*>(this)->clearChannels();