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 AnimTemplate!
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 "OSGAnimDataSource.h" // Sources Class
67 #include "OSGAnimTemplateBase.h"
68 #include "OSGAnimTemplate.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::AnimTemplate
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var std::string AnimTemplateBase::_sfName
90 /*! \var AnimDataSource * AnimTemplateBase::_mfSources
94 /*! \var std::string AnimTemplateBase::_mfTargetIds
99 /***************************************************************************\
100 * FieldType/FieldTrait Instantiation *
101 \***************************************************************************/
103 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
104 PointerType FieldTraits
<AnimTemplate
*, nsOSG
>::_type(
106 "AttachmentContainerPtr",
107 AnimTemplate::getClassType(),
111 OSG_FIELDTRAITS_GETTYPE_NS(AnimTemplate
*, nsOSG
)
113 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
117 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
121 /***************************************************************************\
122 * Field Description *
123 \***************************************************************************/
125 void AnimTemplateBase::classDescInserter(TypeObject
&oType
)
127 FieldDescriptionBase
*pDesc
= NULL
;
130 pDesc
= new SFString::Description(
131 SFString::getClassType(),
134 NameFieldId
, NameFieldMask
,
136 (Field::FClusterLocal
),
137 static_cast<FieldEditMethodSig
>(&AnimTemplate::editHandleName
),
138 static_cast<FieldGetMethodSig
>(&AnimTemplate::getHandleName
));
140 oType
.addInitialDesc(pDesc
);
142 pDesc
= new MFUnrecAnimDataSourcePtr::Description(
143 MFUnrecAnimDataSourcePtr::getClassType(),
146 SourcesFieldId
, SourcesFieldMask
,
148 (Field::FStdAccess
| Field::FClusterLocal
),
149 static_cast<FieldEditMethodSig
>(&AnimTemplate::editHandleSources
),
150 static_cast<FieldGetMethodSig
>(&AnimTemplate::getHandleSources
));
152 oType
.addInitialDesc(pDesc
);
154 pDesc
= new MFString::Description(
155 MFString::getClassType(),
158 TargetIdsFieldId
, TargetIdsFieldMask
,
160 (Field::FClusterLocal
),
161 static_cast<FieldEditMethodSig
>(&AnimTemplate::editHandleTargetIds
),
162 static_cast<FieldGetMethodSig
>(&AnimTemplate::getHandleTargetIds
));
164 oType
.addInitialDesc(pDesc
);
168 AnimTemplateBase::TypeObject
AnimTemplateBase::_type(
169 AnimTemplateBase::getClassname(),
170 Inherited::getClassname(),
174 reinterpret_cast<InitContainerF
>(&AnimTemplate::initMethod
),
175 reinterpret_cast<ExitContainerF
>(&AnimTemplate::exitMethod
),
176 reinterpret_cast<InitalInsertDescFunc
>(
177 reinterpret_cast<void *>(&AnimTemplate::classDescInserter
)),
180 "<?xml version=\"1.0\"?>\n"
183 " name=\"AnimTemplate\"\n"
184 " parent=\"AttachmentContainer\"\n"
185 " library=\"Dynamics\"\n"
186 " pointerfieldtypes=\"both\"\n"
187 " structure=\"abstract\"\n"
188 " systemcomponent=\"true\"\n"
189 " parentsystemcomponent=\"true\"\n"
190 " decoratable=\"false\"\n"
191 " useLocalIncludes=\"false\"\n"
192 " isNodeCore=\"false\"\n"
193 " isBundle=\"false\"\n"
194 " parentFields=\"none\"\n"
198 " category=\"data\"\n"
199 " type=\"std::string\"\n"
200 " cardinality=\"single\"\n"
201 " visibility=\"external\"\n"
202 " access=\"public\"\n"
203 " fieldFlags=\"FClusterLocal\"\n"
207 " name=\"sources\"\n"
208 " category=\"pointer\"\n"
209 " type=\"AnimDataSource\"\n"
210 " cardinality=\"multi\"\n"
211 " visibility=\"external\"\n"
212 " access=\"public\"\n"
213 " fieldFlags=\"FStdAccess, FClusterLocal\"\n"
217 " name=\"targetIds\"\n"
218 " category=\"data\"\n"
219 " type=\"std::string\"\n"
220 " cardinality=\"multi\"\n"
221 " visibility=\"external\"\n"
222 " access=\"public\"\n"
223 " fieldFlags=\"FClusterLocal\"\n"
226 "</FieldContainer>\n",
230 /*------------------------------ get -----------------------------------*/
232 FieldContainerType
&AnimTemplateBase::getType(void)
237 const FieldContainerType
&AnimTemplateBase::getType(void) const
242 UInt32
AnimTemplateBase::getContainerSize(void) const
244 return sizeof(AnimTemplate
);
247 /*------------------------- decorator get ------------------------------*/
250 SFString
*AnimTemplateBase::editSFName(void)
252 editSField(NameFieldMask
);
257 const SFString
*AnimTemplateBase::getSFName(void) const
263 //! Get the AnimTemplate::_mfSources field.
264 const MFUnrecAnimDataSourcePtr
*AnimTemplateBase::getMFSources(void) const
269 MFUnrecAnimDataSourcePtr
*AnimTemplateBase::editMFSources (void)
271 editMField(SourcesFieldMask
, _mfSources
);
275 AnimDataSource
* AnimTemplateBase::getSources(const UInt32 index
) const
277 return _mfSources
[index
];
280 MFString
*AnimTemplateBase::editMFTargetIds(void)
282 editMField(TargetIdsFieldMask
, _mfTargetIds
);
284 return &_mfTargetIds
;
287 const MFString
*AnimTemplateBase::getMFTargetIds(void) const
289 return &_mfTargetIds
;
295 void AnimTemplateBase::pushToSources(AnimDataSource
* const value
)
297 editMField(SourcesFieldMask
, _mfSources
);
299 _mfSources
.push_back(value
);
302 void AnimTemplateBase::assignSources (const MFUnrecAnimDataSourcePtr
&value
)
304 MFUnrecAnimDataSourcePtr::const_iterator elemIt
=
306 MFUnrecAnimDataSourcePtr::const_iterator elemEnd
=
309 static_cast<AnimTemplate
*>(this)->clearSources();
311 while(elemIt
!= elemEnd
)
313 this->pushToSources(*elemIt
);
319 void AnimTemplateBase::removeFromSources(UInt32 uiIndex
)
321 if(uiIndex
< _mfSources
.size())
323 editMField(SourcesFieldMask
, _mfSources
);
325 _mfSources
.erase(uiIndex
);
329 void AnimTemplateBase::removeObjFromSources(AnimDataSource
* const value
)
331 Int32 iElemIdx
= _mfSources
.findIndex(value
);
335 editMField(SourcesFieldMask
, _mfSources
);
337 _mfSources
.erase(iElemIdx
);
340 void AnimTemplateBase::clearSources(void)
342 editMField(SourcesFieldMask
, _mfSources
);
350 /*------------------------------ access -----------------------------------*/
352 SizeT
AnimTemplateBase::getBinSize(ConstFieldMaskArg whichField
)
354 SizeT returnValue
= Inherited::getBinSize(whichField
);
356 if(FieldBits::NoField
!= (NameFieldMask
& whichField
))
358 returnValue
+= _sfName
.getBinSize();
360 if(FieldBits::NoField
!= (SourcesFieldMask
& whichField
))
362 returnValue
+= _mfSources
.getBinSize();
364 if(FieldBits::NoField
!= (TargetIdsFieldMask
& whichField
))
366 returnValue
+= _mfTargetIds
.getBinSize();
372 void AnimTemplateBase::copyToBin(BinaryDataHandler
&pMem
,
373 ConstFieldMaskArg whichField
)
375 Inherited::copyToBin(pMem
, whichField
);
377 if(FieldBits::NoField
!= (NameFieldMask
& whichField
))
379 _sfName
.copyToBin(pMem
);
381 if(FieldBits::NoField
!= (SourcesFieldMask
& whichField
))
383 _mfSources
.copyToBin(pMem
);
385 if(FieldBits::NoField
!= (TargetIdsFieldMask
& whichField
))
387 _mfTargetIds
.copyToBin(pMem
);
391 void AnimTemplateBase::copyFromBin(BinaryDataHandler
&pMem
,
392 ConstFieldMaskArg whichField
)
394 Inherited::copyFromBin(pMem
, whichField
);
396 if(FieldBits::NoField
!= (NameFieldMask
& whichField
))
398 editSField(NameFieldMask
);
399 _sfName
.copyFromBin(pMem
);
401 if(FieldBits::NoField
!= (SourcesFieldMask
& whichField
))
403 editMField(SourcesFieldMask
, _mfSources
);
404 _mfSources
.copyFromBin(pMem
);
406 if(FieldBits::NoField
!= (TargetIdsFieldMask
& whichField
))
408 editMField(TargetIdsFieldMask
, _mfTargetIds
);
409 _mfTargetIds
.copyFromBin(pMem
);
416 /*------------------------- constructors ----------------------------------*/
418 AnimTemplateBase::AnimTemplateBase(void) :
426 AnimTemplateBase::AnimTemplateBase(const AnimTemplateBase
&source
) :
428 _sfName (source
._sfName
),
430 _mfTargetIds (source
._mfTargetIds
)
435 /*-------------------------- destructors ----------------------------------*/
437 AnimTemplateBase::~AnimTemplateBase(void)
441 void AnimTemplateBase::onCreate(const AnimTemplate
*source
)
443 Inherited::onCreate(source
);
447 AnimTemplate
*pThis
= static_cast<AnimTemplate
*>(this);
449 MFUnrecAnimDataSourcePtr::const_iterator SourcesIt
=
450 source
->_mfSources
.begin();
451 MFUnrecAnimDataSourcePtr::const_iterator SourcesEnd
=
452 source
->_mfSources
.end ();
454 while(SourcesIt
!= SourcesEnd
)
456 pThis
->pushToSources(*SourcesIt
);
463 GetFieldHandlePtr
AnimTemplateBase::getHandleName (void) const
465 SFString::GetHandlePtr
returnValue(
466 new SFString::GetHandle(
468 this->getType().getFieldDesc(NameFieldId
),
469 const_cast<AnimTemplateBase
*>(this)));
474 EditFieldHandlePtr
AnimTemplateBase::editHandleName (void)
476 SFString::EditHandlePtr
returnValue(
477 new SFString::EditHandle(
479 this->getType().getFieldDesc(NameFieldId
),
483 editSField(NameFieldMask
);
488 GetFieldHandlePtr
AnimTemplateBase::getHandleSources (void) const
490 MFUnrecAnimDataSourcePtr::GetHandlePtr
returnValue(
491 new MFUnrecAnimDataSourcePtr::GetHandle(
493 this->getType().getFieldDesc(SourcesFieldId
),
494 const_cast<AnimTemplateBase
*>(this)));
499 EditFieldHandlePtr
AnimTemplateBase::editHandleSources (void)
501 MFUnrecAnimDataSourcePtr::EditHandlePtr
returnValue(
502 new MFUnrecAnimDataSourcePtr::EditHandle(
504 this->getType().getFieldDesc(SourcesFieldId
),
507 returnValue
->setAddMethod(
508 boost::bind(&AnimTemplate::pushToSources
,
509 static_cast<AnimTemplate
*>(this), _1
));
510 returnValue
->setRemoveMethod(
511 boost::bind(&AnimTemplate::removeFromSources
,
512 static_cast<AnimTemplate
*>(this), _1
));
513 returnValue
->setRemoveObjMethod(
514 boost::bind(&AnimTemplate::removeObjFromSources
,
515 static_cast<AnimTemplate
*>(this), _1
));
516 returnValue
->setClearMethod(
517 boost::bind(&AnimTemplate::clearSources
,
518 static_cast<AnimTemplate
*>(this)));
520 editMField(SourcesFieldMask
, _mfSources
);
525 GetFieldHandlePtr
AnimTemplateBase::getHandleTargetIds (void) const
527 MFString::GetHandlePtr
returnValue(
528 new MFString::GetHandle(
530 this->getType().getFieldDesc(TargetIdsFieldId
),
531 const_cast<AnimTemplateBase
*>(this)));
536 EditFieldHandlePtr
AnimTemplateBase::editHandleTargetIds (void)
538 MFString::EditHandlePtr
returnValue(
539 new MFString::EditHandle(
541 this->getType().getFieldDesc(TargetIdsFieldId
),
545 editMField(TargetIdsFieldMask
, _mfTargetIds
);
551 #ifdef OSG_MT_CPTR_ASPECT
552 void AnimTemplateBase::execSyncV( FieldContainer
&oFrom
,
553 ConstFieldMaskArg whichField
,
554 AspectOffsetStore
&oOffsets
,
555 ConstFieldMaskArg syncMode
,
556 const UInt32 uiSyncInfo
)
558 AnimTemplate
*pThis
= static_cast<AnimTemplate
*>(this);
560 pThis
->execSync(static_cast<AnimTemplate
*>(&oFrom
),
570 void AnimTemplateBase::resolveLinks(void)
572 Inherited::resolveLinks();
574 static_cast<AnimTemplate
*>(this)->clearSources();
576 #ifdef OSG_MT_CPTR_ASPECT
577 AspectOffsetStore oOffsets
;
579 _pAspectStore
->fillOffsetArray(oOffsets
, this);
582 #ifdef OSG_MT_CPTR_ASPECT
583 _mfTargetIds
.terminateShare(Thread::getCurrentAspect(),