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 AnimTargetAttachment!
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 "OSGAnimBlender.h" // Blenders Class
67 #include "OSGAnimTargetAttachmentBase.h"
68 #include "OSGAnimTargetAttachment.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::AnimTargetAttachment
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var std::string AnimTargetAttachmentBase::_sfTargetId
90 /*! \var AnimBlender * AnimTargetAttachmentBase::_mfBlenders
95 /***************************************************************************\
96 * FieldType/FieldTrait Instantiation *
97 \***************************************************************************/
99 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
100 PointerType FieldTraits
<AnimTargetAttachment
*, nsOSG
>::_type(
101 "AnimTargetAttachmentPtr",
103 AnimTargetAttachment::getClassType(),
107 OSG_FIELDTRAITS_GETTYPE_NS(AnimTargetAttachment
*, nsOSG
)
109 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
110 AnimTargetAttachment
*,
113 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
114 AnimTargetAttachment
*,
117 /***************************************************************************\
118 * Field Description *
119 \***************************************************************************/
121 void AnimTargetAttachmentBase::classDescInserter(TypeObject
&oType
)
123 FieldDescriptionBase
*pDesc
= NULL
;
126 pDesc
= new SFString::Description(
127 SFString::getClassType(),
130 TargetIdFieldId
, TargetIdFieldMask
,
132 (Field::FClusterLocal
),
133 static_cast<FieldEditMethodSig
>(&AnimTargetAttachment::editHandleTargetId
),
134 static_cast<FieldGetMethodSig
>(&AnimTargetAttachment::getHandleTargetId
));
136 oType
.addInitialDesc(pDesc
);
138 pDesc
= new MFUnrecAnimBlenderPtr::Description(
139 MFUnrecAnimBlenderPtr::getClassType(),
142 BlendersFieldId
, BlendersFieldMask
,
144 (Field::FStdAccess
| Field::FClusterLocal
),
145 static_cast<FieldEditMethodSig
>(&AnimTargetAttachment::editHandleBlenders
),
146 static_cast<FieldGetMethodSig
>(&AnimTargetAttachment::getHandleBlenders
));
148 oType
.addInitialDesc(pDesc
);
152 AnimTargetAttachmentBase::TypeObject
AnimTargetAttachmentBase::_type(
153 AnimTargetAttachmentBase::getClassname(),
154 Inherited::getClassname(),
155 "AnimTargetAttachment",
157 reinterpret_cast<PrototypeCreateF
>(&AnimTargetAttachmentBase::createEmptyLocal
),
158 reinterpret_cast<InitContainerF
>(&AnimTargetAttachment::initMethod
),
159 reinterpret_cast<ExitContainerF
>(&AnimTargetAttachment::exitMethod
),
160 reinterpret_cast<InitalInsertDescFunc
>(
161 reinterpret_cast<void *>(&AnimTargetAttachment::classDescInserter
)),
164 "<?xml version=\"1.0\"?>\n"
167 " name=\"AnimTargetAttachment\"\n"
168 " parent=\"Attachment\"\n"
169 " library=\"Dynamics\"\n"
170 " pointerfieldtypes=\"both\"\n"
171 " structure=\"concrete\"\n"
172 " systemcomponent=\"true\"\n"
173 " parentsystemcomponent=\"true\"\n"
176 " name=\"targetId\"\n"
177 " type=\"std::string\"\n"
178 " category=\"data\"\n"
179 " cardinality=\"single\"\n"
180 " visibility=\"external\"\n"
181 " access=\"public\"\n"
182 " defaultValue=\"\"\n"
183 " fieldFlags=\"FClusterLocal\"\n"
187 " name=\"blenders\"\n"
188 " type=\"AnimBlender\"\n"
189 " category=\"pointer\"\n"
190 " cardinality=\"multi\"\n"
191 " visibility=\"internal\"\n"
192 " access=\"public\"\n"
193 " fieldFlags=\"FStdAccess, FClusterLocal\"\n"
196 "</FieldContainer>\n",
200 /*------------------------------ get -----------------------------------*/
202 FieldContainerType
&AnimTargetAttachmentBase::getType(void)
207 const FieldContainerType
&AnimTargetAttachmentBase::getType(void) const
212 UInt32
AnimTargetAttachmentBase::getContainerSize(void) const
214 return sizeof(AnimTargetAttachment
);
217 /*------------------------- decorator get ------------------------------*/
220 SFString
*AnimTargetAttachmentBase::editSFTargetId(void)
222 editSField(TargetIdFieldMask
);
227 const SFString
*AnimTargetAttachmentBase::getSFTargetId(void) const
233 //! Get the AnimTargetAttachment::_mfBlenders field.
234 const MFUnrecAnimBlenderPtr
*AnimTargetAttachmentBase::getMFBlenders(void) const
239 MFUnrecAnimBlenderPtr
*AnimTargetAttachmentBase::editMFBlenders (void)
241 editMField(BlendersFieldMask
, _mfBlenders
);
245 AnimBlender
* AnimTargetAttachmentBase::getBlenders(const UInt32 index
) const
247 return _mfBlenders
[index
];
252 void AnimTargetAttachmentBase::pushToBlenders(AnimBlender
* const value
)
254 editMField(BlendersFieldMask
, _mfBlenders
);
256 _mfBlenders
.push_back(value
);
259 void AnimTargetAttachmentBase::assignBlenders (const MFUnrecAnimBlenderPtr
&value
)
261 MFUnrecAnimBlenderPtr::const_iterator elemIt
=
263 MFUnrecAnimBlenderPtr::const_iterator elemEnd
=
266 static_cast<AnimTargetAttachment
*>(this)->clearBlenders();
268 while(elemIt
!= elemEnd
)
270 this->pushToBlenders(*elemIt
);
276 void AnimTargetAttachmentBase::removeFromBlenders(UInt32 uiIndex
)
278 if(uiIndex
< _mfBlenders
.size())
280 editMField(BlendersFieldMask
, _mfBlenders
);
282 _mfBlenders
.erase(uiIndex
);
286 void AnimTargetAttachmentBase::removeObjFromBlenders(AnimBlender
* const value
)
288 Int32 iElemIdx
= _mfBlenders
.findIndex(value
);
292 editMField(BlendersFieldMask
, _mfBlenders
);
294 _mfBlenders
.erase(iElemIdx
);
297 void AnimTargetAttachmentBase::clearBlenders(void)
299 editMField(BlendersFieldMask
, _mfBlenders
);
307 /*------------------------------ access -----------------------------------*/
309 SizeT
AnimTargetAttachmentBase::getBinSize(ConstFieldMaskArg whichField
)
311 SizeT returnValue
= Inherited::getBinSize(whichField
);
313 if(FieldBits::NoField
!= (TargetIdFieldMask
& whichField
))
315 returnValue
+= _sfTargetId
.getBinSize();
317 if(FieldBits::NoField
!= (BlendersFieldMask
& whichField
))
319 returnValue
+= _mfBlenders
.getBinSize();
325 void AnimTargetAttachmentBase::copyToBin(BinaryDataHandler
&pMem
,
326 ConstFieldMaskArg whichField
)
328 Inherited::copyToBin(pMem
, whichField
);
330 if(FieldBits::NoField
!= (TargetIdFieldMask
& whichField
))
332 _sfTargetId
.copyToBin(pMem
);
334 if(FieldBits::NoField
!= (BlendersFieldMask
& whichField
))
336 _mfBlenders
.copyToBin(pMem
);
340 void AnimTargetAttachmentBase::copyFromBin(BinaryDataHandler
&pMem
,
341 ConstFieldMaskArg whichField
)
343 Inherited::copyFromBin(pMem
, whichField
);
345 if(FieldBits::NoField
!= (TargetIdFieldMask
& whichField
))
347 editSField(TargetIdFieldMask
);
348 _sfTargetId
.copyFromBin(pMem
);
350 if(FieldBits::NoField
!= (BlendersFieldMask
& whichField
))
352 editMField(BlendersFieldMask
, _mfBlenders
);
353 _mfBlenders
.copyFromBin(pMem
);
357 //! create a new instance of the class
358 AnimTargetAttachmentTransitPtr
AnimTargetAttachmentBase::createLocal(BitVector bFlags
)
360 AnimTargetAttachmentTransitPtr fc
;
362 if(getClassType().getPrototype() != NULL
)
364 FieldContainerTransitPtr tmpPtr
=
365 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
367 fc
= dynamic_pointer_cast
<AnimTargetAttachment
>(tmpPtr
);
373 //! create a new instance of the class, copy the container flags
374 AnimTargetAttachmentTransitPtr
AnimTargetAttachmentBase::createDependent(BitVector bFlags
)
376 AnimTargetAttachmentTransitPtr fc
;
378 if(getClassType().getPrototype() != NULL
)
380 FieldContainerTransitPtr tmpPtr
=
381 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
383 fc
= dynamic_pointer_cast
<AnimTargetAttachment
>(tmpPtr
);
389 //! create a new instance of the class
390 AnimTargetAttachmentTransitPtr
AnimTargetAttachmentBase::create(void)
392 AnimTargetAttachmentTransitPtr fc
;
394 if(getClassType().getPrototype() != NULL
)
396 FieldContainerTransitPtr tmpPtr
=
397 getClassType().getPrototype()-> shallowCopy();
399 fc
= dynamic_pointer_cast
<AnimTargetAttachment
>(tmpPtr
);
405 AnimTargetAttachment
*AnimTargetAttachmentBase::createEmptyLocal(BitVector bFlags
)
407 AnimTargetAttachment
*returnValue
;
409 newPtr
<AnimTargetAttachment
>(returnValue
, bFlags
);
411 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
416 //! create an empty new instance of the class, do not copy the prototype
417 AnimTargetAttachment
*AnimTargetAttachmentBase::createEmpty(void)
419 AnimTargetAttachment
*returnValue
;
421 newPtr
<AnimTargetAttachment
>(returnValue
, Thread::getCurrentLocalFlags());
423 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
424 ~Thread::getCurrentLocalFlags();
430 FieldContainerTransitPtr
AnimTargetAttachmentBase::shallowCopyLocal(
431 BitVector bFlags
) const
433 AnimTargetAttachment
*tmpPtr
;
435 newPtr(tmpPtr
, dynamic_cast<const AnimTargetAttachment
*>(this), bFlags
);
437 FieldContainerTransitPtr
returnValue(tmpPtr
);
439 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
444 FieldContainerTransitPtr
AnimTargetAttachmentBase::shallowCopyDependent(
445 BitVector bFlags
) const
447 AnimTargetAttachment
*tmpPtr
;
449 newPtr(tmpPtr
, dynamic_cast<const AnimTargetAttachment
*>(this), ~bFlags
);
451 FieldContainerTransitPtr
returnValue(tmpPtr
);
453 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
458 FieldContainerTransitPtr
AnimTargetAttachmentBase::shallowCopy(void) const
460 AnimTargetAttachment
*tmpPtr
;
463 dynamic_cast<const AnimTargetAttachment
*>(this),
464 Thread::getCurrentLocalFlags());
466 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
468 FieldContainerTransitPtr
returnValue(tmpPtr
);
476 /*------------------------- constructors ----------------------------------*/
478 AnimTargetAttachmentBase::AnimTargetAttachmentBase(void) :
485 AnimTargetAttachmentBase::AnimTargetAttachmentBase(const AnimTargetAttachmentBase
&source
) :
487 _sfTargetId (source
._sfTargetId
),
493 /*-------------------------- destructors ----------------------------------*/
495 AnimTargetAttachmentBase::~AnimTargetAttachmentBase(void)
499 void AnimTargetAttachmentBase::onCreate(const AnimTargetAttachment
*source
)
501 Inherited::onCreate(source
);
505 AnimTargetAttachment
*pThis
= static_cast<AnimTargetAttachment
*>(this);
507 MFUnrecAnimBlenderPtr::const_iterator BlendersIt
=
508 source
->_mfBlenders
.begin();
509 MFUnrecAnimBlenderPtr::const_iterator BlendersEnd
=
510 source
->_mfBlenders
.end ();
512 while(BlendersIt
!= BlendersEnd
)
514 pThis
->pushToBlenders(*BlendersIt
);
521 GetFieldHandlePtr
AnimTargetAttachmentBase::getHandleTargetId (void) const
523 SFString::GetHandlePtr
returnValue(
524 new SFString::GetHandle(
526 this->getType().getFieldDesc(TargetIdFieldId
),
527 const_cast<AnimTargetAttachmentBase
*>(this)));
532 EditFieldHandlePtr
AnimTargetAttachmentBase::editHandleTargetId (void)
534 SFString::EditHandlePtr
returnValue(
535 new SFString::EditHandle(
537 this->getType().getFieldDesc(TargetIdFieldId
),
541 editSField(TargetIdFieldMask
);
546 GetFieldHandlePtr
AnimTargetAttachmentBase::getHandleBlenders (void) const
548 MFUnrecAnimBlenderPtr::GetHandlePtr
returnValue(
549 new MFUnrecAnimBlenderPtr::GetHandle(
551 this->getType().getFieldDesc(BlendersFieldId
),
552 const_cast<AnimTargetAttachmentBase
*>(this)));
557 EditFieldHandlePtr
AnimTargetAttachmentBase::editHandleBlenders (void)
559 MFUnrecAnimBlenderPtr::EditHandlePtr
returnValue(
560 new MFUnrecAnimBlenderPtr::EditHandle(
562 this->getType().getFieldDesc(BlendersFieldId
),
565 returnValue
->setAddMethod(
566 boost::bind(&AnimTargetAttachment::pushToBlenders
,
567 static_cast<AnimTargetAttachment
*>(this), _1
));
568 returnValue
->setRemoveMethod(
569 boost::bind(&AnimTargetAttachment::removeFromBlenders
,
570 static_cast<AnimTargetAttachment
*>(this), _1
));
571 returnValue
->setRemoveObjMethod(
572 boost::bind(&AnimTargetAttachment::removeObjFromBlenders
,
573 static_cast<AnimTargetAttachment
*>(this), _1
));
574 returnValue
->setClearMethod(
575 boost::bind(&AnimTargetAttachment::clearBlenders
,
576 static_cast<AnimTargetAttachment
*>(this)));
578 editMField(BlendersFieldMask
, _mfBlenders
);
584 #ifdef OSG_MT_CPTR_ASPECT
585 void AnimTargetAttachmentBase::execSyncV( FieldContainer
&oFrom
,
586 ConstFieldMaskArg whichField
,
587 AspectOffsetStore
&oOffsets
,
588 ConstFieldMaskArg syncMode
,
589 const UInt32 uiSyncInfo
)
591 AnimTargetAttachment
*pThis
= static_cast<AnimTargetAttachment
*>(this);
593 pThis
->execSync(static_cast<AnimTargetAttachment
*>(&oFrom
),
602 #ifdef OSG_MT_CPTR_ASPECT
603 FieldContainer
*AnimTargetAttachmentBase::createAspectCopy(
604 const FieldContainer
*pRefAspect
) const
606 AnimTargetAttachment
*returnValue
;
608 newAspectCopy(returnValue
,
609 dynamic_cast<const AnimTargetAttachment
*>(pRefAspect
),
610 dynamic_cast<const AnimTargetAttachment
*>(this));
616 void AnimTargetAttachmentBase::resolveLinks(void)
618 Inherited::resolveLinks();
620 static_cast<AnimTargetAttachment
*>(this)->clearBlenders();