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 VRMLInterpolator!
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"
66 #include "OSGVRMLInterpolatorBase.h"
67 #include "OSGVRMLInterpolator.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::VRMLInterpolator
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Real32 VRMLInterpolatorBase::_sfInValue
86 This is VRML's fraction field.
89 /*! \var Real32 VRMLInterpolatorBase::_mfKey
93 /*! \var UInt32 VRMLInterpolatorBase::_mfResortIndex
98 /***************************************************************************\
99 * FieldType/FieldTrait Instantiation *
100 \***************************************************************************/
102 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
103 PointerType FieldTraits
<VRMLInterpolator
*, nsOSG
>::_type(
104 "VRMLInterpolatorPtr",
106 VRMLInterpolator::getClassType(),
110 OSG_FIELDTRAITS_GETTYPE_NS(VRMLInterpolator
*, nsOSG
)
112 /***************************************************************************\
113 * Field Description *
114 \***************************************************************************/
116 void VRMLInterpolatorBase::classDescInserter(TypeObject
&oType
)
118 FieldDescriptionBase
*pDesc
= NULL
;
121 pDesc
= new SFReal32::Description(
122 SFReal32::getClassType(),
124 "This is VRML's fraction field.\n",
125 InValueFieldId
, InValueFieldMask
,
127 (Field::FStdAccess
| Field::FThreadLocal
),
128 static_cast<FieldEditMethodSig
>(&VRMLInterpolator::editHandleInValue
),
129 static_cast<FieldGetMethodSig
>(&VRMLInterpolator::getHandleInValue
));
131 oType
.addInitialDesc(pDesc
);
133 pDesc
= new MFReal32::Description(
134 MFReal32::getClassType(),
137 KeyFieldId
, KeyFieldMask
,
139 (Field::FStdAccess
| Field::FThreadLocal
),
140 static_cast<FieldEditMethodSig
>(&VRMLInterpolator::editHandleKey
),
141 static_cast<FieldGetMethodSig
>(&VRMLInterpolator::getHandleKey
));
143 oType
.addInitialDesc(pDesc
);
145 pDesc
= new MFUInt32::Description(
146 MFUInt32::getClassType(),
149 ResortIndexFieldId
, ResortIndexFieldMask
,
151 (Field::FStdAccess
| Field::FThreadLocal
),
152 static_cast<FieldEditMethodSig
>(&VRMLInterpolator::editHandleResortIndex
),
153 static_cast<FieldGetMethodSig
>(&VRMLInterpolator::getHandleResortIndex
));
155 oType
.addInitialDesc(pDesc
);
159 VRMLInterpolatorBase::TypeObject
VRMLInterpolatorBase::_type(
160 VRMLInterpolatorBase::getClassname(),
161 Inherited::getClassname(),
164 reinterpret_cast<PrototypeCreateF
>(&VRMLInterpolatorBase::createEmptyLocal
),
165 reinterpret_cast<InitContainerF
>(&VRMLInterpolator::initMethod
),
166 reinterpret_cast<ExitContainerF
>(&VRMLInterpolator::exitMethod
),
167 reinterpret_cast<InitalInsertDescFunc
>(
168 reinterpret_cast<void *>(&VRMLInterpolator::classDescInserter
)),
170 ResortIndexFieldMask
,
171 "<?xml version=\"1.0\"?>\n"
174 " name=\"VRMLInterpolator\"\n"
175 " parent=\"NodeCore\"\n"
176 " library=\"Dynamics\"\n"
177 " pointerfieldtypes=\"none\"\n"
178 " structure=\"concrete\"\n"
179 " systemcomponent=\"true\"\n"
180 " parentsystemcomponent=\"true\"\n"
181 " decoratable=\"false\"\n"
182 " useLocalIncludes=\"false\"\n"
183 " isNodeCore=\"true\"\n"
184 " isBundle=\"false\"\n"
185 " parentFields=\"none\"\n"
186 " fieldsUnmarkedOnCreate=\"ResortIndexFieldMask\"\n"
187 " docGroupBase=\"GrpDynamicsVRMLAnimation\"\n"
190 " name=\"inValue\"\n"
192 " cardinality=\"single\"\n"
193 " visibility=\"internal\"\n"
194 " access=\"public\"\n"
195 " defaultValue=\"0.f\"\n"
196 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
198 " This is VRML's fraction field.\n"
203 " cardinality=\"multi\"\n"
204 " visibility=\"external\"\n"
205 " access=\"public\"\n"
206 " defaultValue=\"\"\n"
207 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
211 " name=\"resortIndex\"\n"
213 " cardinality=\"multi\"\n"
214 " visibility=\"external\"\n"
215 " access=\"public\"\n"
216 " defaultValue=\"\"\n"
217 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
220 "</FieldContainer>\n",
224 /*------------------------------ get -----------------------------------*/
226 FieldContainerType
&VRMLInterpolatorBase::getType(void)
231 const FieldContainerType
&VRMLInterpolatorBase::getType(void) const
236 UInt32
VRMLInterpolatorBase::getContainerSize(void) const
238 return sizeof(VRMLInterpolator
);
241 /*------------------------- decorator get ------------------------------*/
244 SFReal32
*VRMLInterpolatorBase::editSFInValue(void)
246 editSField(InValueFieldMask
);
251 const SFReal32
*VRMLInterpolatorBase::getSFInValue(void) const
257 MFReal32
*VRMLInterpolatorBase::editMFKey(void)
259 editMField(KeyFieldMask
, _mfKey
);
264 const MFReal32
*VRMLInterpolatorBase::getMFKey(void) const
270 MFUInt32
*VRMLInterpolatorBase::editMFResortIndex(void)
272 editMField(ResortIndexFieldMask
, _mfResortIndex
);
274 return &_mfResortIndex
;
277 const MFUInt32
*VRMLInterpolatorBase::getMFResortIndex(void) const
279 return &_mfResortIndex
;
287 /*------------------------------ access -----------------------------------*/
289 SizeT
VRMLInterpolatorBase::getBinSize(ConstFieldMaskArg whichField
)
291 SizeT returnValue
= Inherited::getBinSize(whichField
);
293 if(FieldBits::NoField
!= (InValueFieldMask
& whichField
))
295 returnValue
+= _sfInValue
.getBinSize();
297 if(FieldBits::NoField
!= (KeyFieldMask
& whichField
))
299 returnValue
+= _mfKey
.getBinSize();
301 if(FieldBits::NoField
!= (ResortIndexFieldMask
& whichField
))
303 returnValue
+= _mfResortIndex
.getBinSize();
309 void VRMLInterpolatorBase::copyToBin(BinaryDataHandler
&pMem
,
310 ConstFieldMaskArg whichField
)
312 Inherited::copyToBin(pMem
, whichField
);
314 if(FieldBits::NoField
!= (InValueFieldMask
& whichField
))
316 _sfInValue
.copyToBin(pMem
);
318 if(FieldBits::NoField
!= (KeyFieldMask
& whichField
))
320 _mfKey
.copyToBin(pMem
);
322 if(FieldBits::NoField
!= (ResortIndexFieldMask
& whichField
))
324 _mfResortIndex
.copyToBin(pMem
);
328 void VRMLInterpolatorBase::copyFromBin(BinaryDataHandler
&pMem
,
329 ConstFieldMaskArg whichField
)
331 Inherited::copyFromBin(pMem
, whichField
);
333 if(FieldBits::NoField
!= (InValueFieldMask
& whichField
))
335 editSField(InValueFieldMask
);
336 _sfInValue
.copyFromBin(pMem
);
338 if(FieldBits::NoField
!= (KeyFieldMask
& whichField
))
340 editMField(KeyFieldMask
, _mfKey
);
341 _mfKey
.copyFromBin(pMem
);
343 if(FieldBits::NoField
!= (ResortIndexFieldMask
& whichField
))
345 editMField(ResortIndexFieldMask
, _mfResortIndex
);
346 _mfResortIndex
.copyFromBin(pMem
);
350 //! create a new instance of the class
351 VRMLInterpolatorTransitPtr
VRMLInterpolatorBase::createLocal(BitVector bFlags
)
353 VRMLInterpolatorTransitPtr fc
;
355 if(getClassType().getPrototype() != NULL
)
357 FieldContainerTransitPtr tmpPtr
=
358 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
360 fc
= dynamic_pointer_cast
<VRMLInterpolator
>(tmpPtr
);
366 //! create a new instance of the class, copy the container flags
367 VRMLInterpolatorTransitPtr
VRMLInterpolatorBase::createDependent(BitVector bFlags
)
369 VRMLInterpolatorTransitPtr fc
;
371 if(getClassType().getPrototype() != NULL
)
373 FieldContainerTransitPtr tmpPtr
=
374 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
376 fc
= dynamic_pointer_cast
<VRMLInterpolator
>(tmpPtr
);
382 //! create a new instance of the class
383 VRMLInterpolatorTransitPtr
VRMLInterpolatorBase::create(void)
385 VRMLInterpolatorTransitPtr fc
;
387 if(getClassType().getPrototype() != NULL
)
389 FieldContainerTransitPtr tmpPtr
=
390 getClassType().getPrototype()-> shallowCopy();
392 fc
= dynamic_pointer_cast
<VRMLInterpolator
>(tmpPtr
);
398 VRMLInterpolator
*VRMLInterpolatorBase::createEmptyLocal(BitVector bFlags
)
400 VRMLInterpolator
*returnValue
;
402 newPtr
<VRMLInterpolator
>(returnValue
, bFlags
);
404 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
409 //! create an empty new instance of the class, do not copy the prototype
410 VRMLInterpolator
*VRMLInterpolatorBase::createEmpty(void)
412 VRMLInterpolator
*returnValue
;
414 newPtr
<VRMLInterpolator
>(returnValue
, Thread::getCurrentLocalFlags());
416 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
417 ~Thread::getCurrentLocalFlags();
423 FieldContainerTransitPtr
VRMLInterpolatorBase::shallowCopyLocal(
424 BitVector bFlags
) const
426 VRMLInterpolator
*tmpPtr
;
428 newPtr(tmpPtr
, dynamic_cast<const VRMLInterpolator
*>(this), bFlags
);
430 FieldContainerTransitPtr
returnValue(tmpPtr
);
432 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
437 FieldContainerTransitPtr
VRMLInterpolatorBase::shallowCopyDependent(
438 BitVector bFlags
) const
440 VRMLInterpolator
*tmpPtr
;
442 newPtr(tmpPtr
, dynamic_cast<const VRMLInterpolator
*>(this), ~bFlags
);
444 FieldContainerTransitPtr
returnValue(tmpPtr
);
446 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
451 FieldContainerTransitPtr
VRMLInterpolatorBase::shallowCopy(void) const
453 VRMLInterpolator
*tmpPtr
;
456 dynamic_cast<const VRMLInterpolator
*>(this),
457 Thread::getCurrentLocalFlags());
459 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
461 FieldContainerTransitPtr
returnValue(tmpPtr
);
469 /*------------------------- constructors ----------------------------------*/
471 VRMLInterpolatorBase::VRMLInterpolatorBase(void) :
473 _sfInValue (Real32(0.f
)),
479 VRMLInterpolatorBase::VRMLInterpolatorBase(const VRMLInterpolatorBase
&source
) :
481 _sfInValue (source
._sfInValue
),
482 _mfKey (source
._mfKey
),
483 _mfResortIndex (source
._mfResortIndex
)
488 /*-------------------------- destructors ----------------------------------*/
490 VRMLInterpolatorBase::~VRMLInterpolatorBase(void)
495 GetFieldHandlePtr
VRMLInterpolatorBase::getHandleInValue (void) const
497 SFReal32::GetHandlePtr
returnValue(
498 new SFReal32::GetHandle(
500 this->getType().getFieldDesc(InValueFieldId
),
501 const_cast<VRMLInterpolatorBase
*>(this)));
506 EditFieldHandlePtr
VRMLInterpolatorBase::editHandleInValue (void)
508 SFReal32::EditHandlePtr
returnValue(
509 new SFReal32::EditHandle(
511 this->getType().getFieldDesc(InValueFieldId
),
515 editSField(InValueFieldMask
);
520 GetFieldHandlePtr
VRMLInterpolatorBase::getHandleKey (void) const
522 MFReal32::GetHandlePtr
returnValue(
523 new MFReal32::GetHandle(
525 this->getType().getFieldDesc(KeyFieldId
),
526 const_cast<VRMLInterpolatorBase
*>(this)));
531 EditFieldHandlePtr
VRMLInterpolatorBase::editHandleKey (void)
533 MFReal32::EditHandlePtr
returnValue(
534 new MFReal32::EditHandle(
536 this->getType().getFieldDesc(KeyFieldId
),
540 editMField(KeyFieldMask
, _mfKey
);
545 GetFieldHandlePtr
VRMLInterpolatorBase::getHandleResortIndex (void) const
547 MFUInt32::GetHandlePtr
returnValue(
548 new MFUInt32::GetHandle(
550 this->getType().getFieldDesc(ResortIndexFieldId
),
551 const_cast<VRMLInterpolatorBase
*>(this)));
556 EditFieldHandlePtr
VRMLInterpolatorBase::editHandleResortIndex (void)
558 MFUInt32::EditHandlePtr
returnValue(
559 new MFUInt32::EditHandle(
561 this->getType().getFieldDesc(ResortIndexFieldId
),
565 editMField(ResortIndexFieldMask
, _mfResortIndex
);
571 #ifdef OSG_MT_CPTR_ASPECT
572 void VRMLInterpolatorBase::execSyncV( FieldContainer
&oFrom
,
573 ConstFieldMaskArg whichField
,
574 AspectOffsetStore
&oOffsets
,
575 ConstFieldMaskArg syncMode
,
576 const UInt32 uiSyncInfo
)
578 VRMLInterpolator
*pThis
= static_cast<VRMLInterpolator
*>(this);
580 pThis
->execSync(static_cast<VRMLInterpolator
*>(&oFrom
),
589 #ifdef OSG_MT_CPTR_ASPECT
590 FieldContainer
*VRMLInterpolatorBase::createAspectCopy(
591 const FieldContainer
*pRefAspect
) const
593 VRMLInterpolator
*returnValue
;
595 newAspectCopy(returnValue
,
596 dynamic_cast<const VRMLInterpolator
*>(pRefAspect
),
597 dynamic_cast<const VRMLInterpolator
*>(this));
603 void VRMLInterpolatorBase::resolveLinks(void)
605 Inherited::resolveLinks();
607 #ifdef OSG_MT_CPTR_ASPECT
608 AspectOffsetStore oOffsets
;
610 _pAspectStore
->fillOffsetArray(oOffsets
, this);
613 #ifdef OSG_MT_CPTR_ASPECT
614 _mfKey
.terminateShare(Thread::getCurrentAspect(),
617 #ifdef OSG_MT_CPTR_ASPECT
618 _mfResortIndex
.terminateShare(Thread::getCurrentAspect(),