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 BaseSkeletonJoint!
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 "OSGSkeleton.h" // Skeleton Class
67 #include "OSGBaseSkeletonJointBase.h"
68 #include "OSGBaseSkeletonJoint.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::BaseSkeletonJoint
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var Skeleton * BaseSkeletonJointBase::_sfSkeleton
90 /*! \var Int16 BaseSkeletonJointBase::_sfJointId
91 Id of the joint in the skeleton, used to assign vertices to joints.
92 The joints in a skeleton must have a unique jointId and they should
93 form an interval (no holes) [0, N].
97 /***************************************************************************\
98 * FieldType/FieldTrait Instantiation *
99 \***************************************************************************/
101 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
102 PointerType FieldTraits
<BaseSkeletonJoint
*, nsOSG
>::_type(
103 "BaseSkeletonJointPtr",
105 BaseSkeletonJoint::getClassType(),
109 OSG_FIELDTRAITS_GETTYPE_NS(BaseSkeletonJoint
*, nsOSG
)
111 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
115 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
119 DataType
&FieldTraits
< BaseSkeletonJoint
*, nsOSG
+ 1 >::getType(void)
121 return FieldTraits
<BaseSkeletonJoint
*, nsOSG
>::getType();
125 OSG_EXPORT_PTR_SFIELD(ChildPointerSField
,
127 UnrecordedRefCountPolicy
,
131 OSG_EXPORT_PTR_MFIELD(ChildPointerMField
,
133 UnrecordedRefCountPolicy
,
137 DataType
&FieldTraits
<BaseSkeletonJoint
*, nsOSG
+ 2 >::getType(void)
139 return FieldTraits
<BaseSkeletonJoint
*, nsOSG
>::getType();
143 OSG_SFIELDTYPE_INST(ParentPointerSField
,
148 OSG_FIELD_DLLEXPORT_DEF3(ParentPointerSField
,
154 OSG_MFIELDTYPE_INST(ParentPointerMField
,
159 OSG_FIELD_DLLEXPORT_DEF3(ParentPointerMField
,
165 /***************************************************************************\
166 * Field Description *
167 \***************************************************************************/
169 void BaseSkeletonJointBase::classDescInserter(TypeObject
&oType
)
171 FieldDescriptionBase
*pDesc
= NULL
;
174 pDesc
= new SFParentSkeletonPtr::Description(
175 SFParentSkeletonPtr::getClassType(),
177 "Parent skeleton.\n",
178 SkeletonFieldId
, SkeletonFieldMask
,
180 (Field::SFDefaultFlags
| Field::FStdAccess
),
181 static_cast <FieldEditMethodSig
>(&BaseSkeletonJoint::invalidEditField
),
182 static_cast <FieldGetMethodSig
>(&BaseSkeletonJoint::invalidGetField
));
184 oType
.addInitialDesc(pDesc
);
186 pDesc
= new SFInt16::Description(
187 SFInt16::getClassType(),
189 "Id of the joint in the skeleton, used to assign vertices to joints.\n"
190 "The joints in a skeleton must have a unique jointId and they should\n"
191 "form an interval (no holes) [0, N].\n",
192 JointIdFieldId
, JointIdFieldMask
,
194 (Field::SFDefaultFlags
| Field::FStdAccess
),
195 static_cast<FieldEditMethodSig
>(&BaseSkeletonJoint::editHandleJointId
),
196 static_cast<FieldGetMethodSig
>(&BaseSkeletonJoint::getHandleJointId
));
198 oType
.addInitialDesc(pDesc
);
202 BaseSkeletonJointBase::TypeObject
BaseSkeletonJointBase::_type(
203 BaseSkeletonJointBase::getClassname(),
204 Inherited::getClassname(),
208 reinterpret_cast<InitContainerF
>(&BaseSkeletonJoint::initMethod
),
209 reinterpret_cast<ExitContainerF
>(&BaseSkeletonJoint::exitMethod
),
210 reinterpret_cast<InitalInsertDescFunc
>(
211 reinterpret_cast<void *>(&BaseSkeletonJoint::classDescInserter
)),
214 "<?xml version=\"1.0\"?>\n"
217 " name=\"BaseSkeletonJoint\"\n"
218 " parent=\"Group\"\n"
219 " library=\"Dynamics\"\n"
220 " pointerfieldtypes=\"both\"\n"
221 " structure=\"abstract\"\n"
222 " systemcomponent=\"true\"\n"
223 " parentsystemcomponent=\"true\"\n"
224 " decoratable=\"false\"\n"
225 " isNodeCore=\"false\"\n"
226 " childFields=\"both\"\n"
227 " parentFields=\"both\"\n"
230 " name=\"skeleton\"\n"
231 " type=\"Skeleton\"\n"
232 " category=\"parentpointer\"\n"
233 " cardinality=\"single\"\n"
234 " defaultValue=\"NULL\"\n"
235 " visibility=\"internal\"\n"
238 " Parent skeleton.\n"
242 " name=\"jointId\"\n"
244 " category=\"data\"\n"
245 " cardinality=\"single\"\n"
246 " defaultValue=\"BaseSkeletonJoint::INVALID_JOINT_ID\"\n"
247 " visibility=\"external\"\n"
248 " access=\"public\"\n"
250 " Id of the joint in the skeleton, used to assign vertices to joints.\n"
251 " The joints in a skeleton must have a unique jointId and they should\n"
252 " form an interval (no holes) [0, N].\n"
254 "</FieldContainer>\n",
258 /*------------------------------ get -----------------------------------*/
260 FieldContainerType
&BaseSkeletonJointBase::getType(void)
265 const FieldContainerType
&BaseSkeletonJointBase::getType(void) const
270 UInt32
BaseSkeletonJointBase::getContainerSize(void) const
272 return sizeof(BaseSkeletonJoint
);
275 /*------------------------- decorator get ------------------------------*/
279 SFInt16
*BaseSkeletonJointBase::editSFJointId(void)
281 editSField(JointIdFieldMask
);
286 const SFInt16
*BaseSkeletonJointBase::getSFJointId(void) const
296 /*------------------------------ access -----------------------------------*/
298 SizeT
BaseSkeletonJointBase::getBinSize(ConstFieldMaskArg whichField
)
300 SizeT returnValue
= Inherited::getBinSize(whichField
);
302 if(FieldBits::NoField
!= (SkeletonFieldMask
& whichField
))
304 returnValue
+= _sfSkeleton
.getBinSize();
306 if(FieldBits::NoField
!= (JointIdFieldMask
& whichField
))
308 returnValue
+= _sfJointId
.getBinSize();
314 void BaseSkeletonJointBase::copyToBin(BinaryDataHandler
&pMem
,
315 ConstFieldMaskArg whichField
)
317 Inherited::copyToBin(pMem
, whichField
);
319 if(FieldBits::NoField
!= (SkeletonFieldMask
& whichField
))
321 _sfSkeleton
.copyToBin(pMem
);
323 if(FieldBits::NoField
!= (JointIdFieldMask
& whichField
))
325 _sfJointId
.copyToBin(pMem
);
329 void BaseSkeletonJointBase::copyFromBin(BinaryDataHandler
&pMem
,
330 ConstFieldMaskArg whichField
)
332 Inherited::copyFromBin(pMem
, whichField
);
334 if(FieldBits::NoField
!= (SkeletonFieldMask
& whichField
))
336 editSField(SkeletonFieldMask
);
337 _sfSkeleton
.copyFromBin(pMem
);
339 if(FieldBits::NoField
!= (JointIdFieldMask
& whichField
))
341 editSField(JointIdFieldMask
);
342 _sfJointId
.copyFromBin(pMem
);
349 /*------------------------- constructors ----------------------------------*/
351 BaseSkeletonJointBase::BaseSkeletonJointBase(void) :
354 _sfJointId (Int16(BaseSkeletonJoint::INVALID_JOINT_ID
))
358 BaseSkeletonJointBase::BaseSkeletonJointBase(const BaseSkeletonJointBase
&source
) :
361 _sfJointId (source
._sfJointId
)
366 /*-------------------------- destructors ----------------------------------*/
368 BaseSkeletonJointBase::~BaseSkeletonJointBase(void)
371 /*-------------------------------------------------------------------------*/
374 bool BaseSkeletonJointBase::linkParent(
375 FieldContainer
* const pParent
,
376 UInt16
const childFieldId
,
377 UInt16
const parentFieldId
)
379 if(parentFieldId
== SkeletonFieldId
)
381 Skeleton
* pTypedParent
=
382 dynamic_cast< Skeleton
* >(pParent
);
384 if(pTypedParent
!= NULL
)
386 FieldContainer
*pOldParent
=
387 _sfSkeleton
.getValue ();
389 UInt16 oldChildFieldId
=
390 _sfSkeleton
.getParentFieldPos();
392 if(pOldParent
!= NULL
)
394 pOldParent
->unlinkChild(this, oldChildFieldId
);
397 editSField(SkeletonFieldMask
);
399 _sfSkeleton
.setValue(static_cast<Skeleton
*>(pParent
), childFieldId
);
407 return Inherited::linkParent(pParent
, childFieldId
, parentFieldId
);
410 bool BaseSkeletonJointBase::unlinkParent(
411 FieldContainer
* const pParent
,
412 UInt16
const parentFieldId
)
414 if(parentFieldId
== SkeletonFieldId
)
416 Skeleton
* pTypedParent
=
417 dynamic_cast< Skeleton
* >(pParent
);
419 if(pTypedParent
!= NULL
)
421 if(_sfSkeleton
.getValue() == pTypedParent
)
423 editSField(SkeletonFieldMask
);
425 _sfSkeleton
.setValue(NULL
, 0xFFFF);
430 SWARNING
<< "Child ([" << this
431 << "] id [" << this->getId()
432 << "] type [" << this->getType().getCName()
433 << "] parentFieldId [" << parentFieldId
434 << "]) - Parent ([" << pParent
435 << "] id [" << pParent
->getId()
436 << "] type [" << pParent
->getType().getCName()
437 << "]): link inconsistent!"
446 return Inherited::unlinkParent(pParent
, parentFieldId
);
451 GetFieldHandlePtr
BaseSkeletonJointBase::getHandleSkeleton (void) const
453 SFParentSkeletonPtr::GetHandlePtr returnValue
;
458 EditFieldHandlePtr
BaseSkeletonJointBase::editHandleSkeleton (void)
460 EditFieldHandlePtr returnValue
;
465 GetFieldHandlePtr
BaseSkeletonJointBase::getHandleJointId (void) const
467 SFInt16::GetHandlePtr
returnValue(
468 new SFInt16::GetHandle(
470 this->getType().getFieldDesc(JointIdFieldId
),
471 const_cast<BaseSkeletonJointBase
*>(this)));
476 EditFieldHandlePtr
BaseSkeletonJointBase::editHandleJointId (void)
478 SFInt16::EditHandlePtr
returnValue(
479 new SFInt16::EditHandle(
481 this->getType().getFieldDesc(JointIdFieldId
),
485 editSField(JointIdFieldMask
);
491 #ifdef OSG_MT_CPTR_ASPECT
492 void BaseSkeletonJointBase::execSyncV( FieldContainer
&oFrom
,
493 ConstFieldMaskArg whichField
,
494 AspectOffsetStore
&oOffsets
,
495 ConstFieldMaskArg syncMode
,
496 const UInt32 uiSyncInfo
)
498 BaseSkeletonJoint
*pThis
= static_cast<BaseSkeletonJoint
*>(this);
500 pThis
->execSync(static_cast<BaseSkeletonJoint
*>(&oFrom
),
510 void BaseSkeletonJointBase::resolveLinks(void)
512 Inherited::resolveLinks();