fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Dynamics / VRMLAnimation / OSGVRMLCoordinateInterpolatorBase.cpp
blob1ec68672455f62c9aa202cfbdf995ea9340cbe5f
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class VRMLCoordinateInterpolator!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
66 #include "OSGVRMLCoordinateInterpolatorBase.h"
67 #include "OSGVRMLCoordinateInterpolator.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::VRMLCoordinateInterpolator
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Pnt3f VRMLCoordinateInterpolatorBase::_mfKeyValue
89 /*! \var Pnt3f VRMLCoordinateInterpolatorBase::_mfOutValue
90 This is VRML's value field.
94 /***************************************************************************\
95 * FieldType/FieldTrait Instantiation *
96 \***************************************************************************/
98 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
99 PointerType FieldTraits<VRMLCoordinateInterpolator *, nsOSG>::_type(
100 "VRMLCoordinateInterpolatorPtr",
101 "VRMLInterpolatorPtr",
102 VRMLCoordinateInterpolator::getClassType(),
103 nsOSG);
104 #endif
106 OSG_FIELDTRAITS_GETTYPE_NS(VRMLCoordinateInterpolator *, nsOSG)
108 /***************************************************************************\
109 * Field Description *
110 \***************************************************************************/
112 void VRMLCoordinateInterpolatorBase::classDescInserter(TypeObject &oType)
114 FieldDescriptionBase *pDesc = NULL;
117 pDesc = new MFPnt3f::Description(
118 MFPnt3f::getClassType(),
119 "keyValue",
121 KeyValueFieldId, KeyValueFieldMask,
122 false,
123 (Field::FStdAccess | Field::FThreadLocal),
124 static_cast<FieldEditMethodSig>(&VRMLCoordinateInterpolator::editHandleKeyValue),
125 static_cast<FieldGetMethodSig >(&VRMLCoordinateInterpolator::getHandleKeyValue));
127 oType.addInitialDesc(pDesc);
129 pDesc = new MFPnt3f::Description(
130 MFPnt3f::getClassType(),
131 "outValue",
132 "This is VRML's value field.\n",
133 OutValueFieldId, OutValueFieldMask,
134 true,
135 (Field::FStdAccess | Field::FThreadLocal),
136 static_cast<FieldEditMethodSig>(&VRMLCoordinateInterpolator::editHandleOutValue),
137 static_cast<FieldGetMethodSig >(&VRMLCoordinateInterpolator::getHandleOutValue));
139 oType.addInitialDesc(pDesc);
143 VRMLCoordinateInterpolatorBase::TypeObject VRMLCoordinateInterpolatorBase::_type(
144 VRMLCoordinateInterpolatorBase::getClassname(),
145 Inherited::getClassname(),
146 "NULL",
147 nsOSG, //Namespace
148 reinterpret_cast<PrototypeCreateF>(&VRMLCoordinateInterpolatorBase::createEmptyLocal),
149 reinterpret_cast<InitContainerF>(&VRMLCoordinateInterpolator::initMethod),
150 reinterpret_cast<ExitContainerF>(&VRMLCoordinateInterpolator::exitMethod),
151 reinterpret_cast<InitalInsertDescFunc>(
152 reinterpret_cast<void *>(&VRMLCoordinateInterpolator::classDescInserter)),
153 false,
155 "<?xml version=\"1.0\"?>\n"
156 "\n"
157 "<FieldContainer\n"
158 " name=\"VRMLCoordinateInterpolator\"\n"
159 " parent=\"VRMLInterpolator\"\n"
160 " library=\"Dynamics\"\n"
161 " pointerfieldtypes=\"none\"\n"
162 " structure=\"concrete\"\n"
163 " systemcomponent=\"true\"\n"
164 " parentsystemcomponent=\"true\"\n"
165 " decoratable=\"false\"\n"
166 " useLocalIncludes=\"false\"\n"
167 " isNodeCore=\"true\"\n"
168 " isBundle=\"false\"\n"
169 " parentFields=\"none\"\n"
170 " docGroupBase=\"GrpDynamicsVRMLAnimation\"\n"
171 " >\n"
172 " <Field\n"
173 " name=\"keyValue\"\n"
174 " type=\"Pnt3f\"\n"
175 " cardinality=\"multi\"\n"
176 " visibility=\"external\"\n"
177 " access=\"public\"\n"
178 " defaultValue=\"\"\n"
179 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
180 " >\n"
181 " </Field>\n"
182 " <Field\n"
183 " name=\"outValue\"\n"
184 " type=\"Pnt3f\"\n"
185 " cardinality=\"multi\"\n"
186 " visibility=\"internal\"\n"
187 " access=\"public\"\n"
188 " defaultValue=\"\"\n"
189 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
190 " >\n"
191 " This is VRML's value field.\n"
192 " </Field>\n"
193 "</FieldContainer>\n",
197 /*------------------------------ get -----------------------------------*/
199 FieldContainerType &VRMLCoordinateInterpolatorBase::getType(void)
201 return _type;
204 const FieldContainerType &VRMLCoordinateInterpolatorBase::getType(void) const
206 return _type;
209 UInt32 VRMLCoordinateInterpolatorBase::getContainerSize(void) const
211 return sizeof(VRMLCoordinateInterpolator);
214 /*------------------------- decorator get ------------------------------*/
217 MFPnt3f *VRMLCoordinateInterpolatorBase::editMFKeyValue(void)
219 editMField(KeyValueFieldMask, _mfKeyValue);
221 return &_mfKeyValue;
224 const MFPnt3f *VRMLCoordinateInterpolatorBase::getMFKeyValue(void) const
226 return &_mfKeyValue;
230 MFPnt3f *VRMLCoordinateInterpolatorBase::editMFOutValue(void)
232 editMField(OutValueFieldMask, _mfOutValue);
234 return &_mfOutValue;
237 const MFPnt3f *VRMLCoordinateInterpolatorBase::getMFOutValue(void) const
239 return &_mfOutValue;
247 /*------------------------------ access -----------------------------------*/
249 SizeT VRMLCoordinateInterpolatorBase::getBinSize(ConstFieldMaskArg whichField)
251 SizeT returnValue = Inherited::getBinSize(whichField);
253 if(FieldBits::NoField != (KeyValueFieldMask & whichField))
255 returnValue += _mfKeyValue.getBinSize();
257 if(FieldBits::NoField != (OutValueFieldMask & whichField))
259 returnValue += _mfOutValue.getBinSize();
262 return returnValue;
265 void VRMLCoordinateInterpolatorBase::copyToBin(BinaryDataHandler &pMem,
266 ConstFieldMaskArg whichField)
268 Inherited::copyToBin(pMem, whichField);
270 if(FieldBits::NoField != (KeyValueFieldMask & whichField))
272 _mfKeyValue.copyToBin(pMem);
274 if(FieldBits::NoField != (OutValueFieldMask & whichField))
276 _mfOutValue.copyToBin(pMem);
280 void VRMLCoordinateInterpolatorBase::copyFromBin(BinaryDataHandler &pMem,
281 ConstFieldMaskArg whichField)
283 Inherited::copyFromBin(pMem, whichField);
285 if(FieldBits::NoField != (KeyValueFieldMask & whichField))
287 editMField(KeyValueFieldMask, _mfKeyValue);
288 _mfKeyValue.copyFromBin(pMem);
290 if(FieldBits::NoField != (OutValueFieldMask & whichField))
292 editMField(OutValueFieldMask, _mfOutValue);
293 _mfOutValue.copyFromBin(pMem);
297 //! create a new instance of the class
298 VRMLCoordinateInterpolatorTransitPtr VRMLCoordinateInterpolatorBase::createLocal(BitVector bFlags)
300 VRMLCoordinateInterpolatorTransitPtr fc;
302 if(getClassType().getPrototype() != NULL)
304 FieldContainerTransitPtr tmpPtr =
305 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
307 fc = dynamic_pointer_cast<VRMLCoordinateInterpolator>(tmpPtr);
310 return fc;
313 //! create a new instance of the class, copy the container flags
314 VRMLCoordinateInterpolatorTransitPtr VRMLCoordinateInterpolatorBase::createDependent(BitVector bFlags)
316 VRMLCoordinateInterpolatorTransitPtr fc;
318 if(getClassType().getPrototype() != NULL)
320 FieldContainerTransitPtr tmpPtr =
321 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
323 fc = dynamic_pointer_cast<VRMLCoordinateInterpolator>(tmpPtr);
326 return fc;
329 //! create a new instance of the class
330 VRMLCoordinateInterpolatorTransitPtr VRMLCoordinateInterpolatorBase::create(void)
332 VRMLCoordinateInterpolatorTransitPtr fc;
334 if(getClassType().getPrototype() != NULL)
336 FieldContainerTransitPtr tmpPtr =
337 getClassType().getPrototype()-> shallowCopy();
339 fc = dynamic_pointer_cast<VRMLCoordinateInterpolator>(tmpPtr);
342 return fc;
345 VRMLCoordinateInterpolator *VRMLCoordinateInterpolatorBase::createEmptyLocal(BitVector bFlags)
347 VRMLCoordinateInterpolator *returnValue;
349 newPtr<VRMLCoordinateInterpolator>(returnValue, bFlags);
351 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
353 return returnValue;
356 //! create an empty new instance of the class, do not copy the prototype
357 VRMLCoordinateInterpolator *VRMLCoordinateInterpolatorBase::createEmpty(void)
359 VRMLCoordinateInterpolator *returnValue;
361 newPtr<VRMLCoordinateInterpolator>(returnValue, Thread::getCurrentLocalFlags());
363 returnValue->_pFieldFlags->_bNamespaceMask &=
364 ~Thread::getCurrentLocalFlags();
366 return returnValue;
370 FieldContainerTransitPtr VRMLCoordinateInterpolatorBase::shallowCopyLocal(
371 BitVector bFlags) const
373 VRMLCoordinateInterpolator *tmpPtr;
375 newPtr(tmpPtr, dynamic_cast<const VRMLCoordinateInterpolator *>(this), bFlags);
377 FieldContainerTransitPtr returnValue(tmpPtr);
379 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
381 return returnValue;
384 FieldContainerTransitPtr VRMLCoordinateInterpolatorBase::shallowCopyDependent(
385 BitVector bFlags) const
387 VRMLCoordinateInterpolator *tmpPtr;
389 newPtr(tmpPtr, dynamic_cast<const VRMLCoordinateInterpolator *>(this), ~bFlags);
391 FieldContainerTransitPtr returnValue(tmpPtr);
393 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
395 return returnValue;
398 FieldContainerTransitPtr VRMLCoordinateInterpolatorBase::shallowCopy(void) const
400 VRMLCoordinateInterpolator *tmpPtr;
402 newPtr(tmpPtr,
403 dynamic_cast<const VRMLCoordinateInterpolator *>(this),
404 Thread::getCurrentLocalFlags());
406 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
408 FieldContainerTransitPtr returnValue(tmpPtr);
410 return returnValue;
416 /*------------------------- constructors ----------------------------------*/
418 VRMLCoordinateInterpolatorBase::VRMLCoordinateInterpolatorBase(void) :
419 Inherited(),
420 _mfKeyValue (),
421 _mfOutValue ()
425 VRMLCoordinateInterpolatorBase::VRMLCoordinateInterpolatorBase(const VRMLCoordinateInterpolatorBase &source) :
426 Inherited(source),
427 _mfKeyValue (source._mfKeyValue ),
428 _mfOutValue (source._mfOutValue )
433 /*-------------------------- destructors ----------------------------------*/
435 VRMLCoordinateInterpolatorBase::~VRMLCoordinateInterpolatorBase(void)
440 GetFieldHandlePtr VRMLCoordinateInterpolatorBase::getHandleKeyValue (void) const
442 MFPnt3f::GetHandlePtr returnValue(
443 new MFPnt3f::GetHandle(
444 &_mfKeyValue,
445 this->getType().getFieldDesc(KeyValueFieldId),
446 const_cast<VRMLCoordinateInterpolatorBase *>(this)));
448 return returnValue;
451 EditFieldHandlePtr VRMLCoordinateInterpolatorBase::editHandleKeyValue (void)
453 MFPnt3f::EditHandlePtr returnValue(
454 new MFPnt3f::EditHandle(
455 &_mfKeyValue,
456 this->getType().getFieldDesc(KeyValueFieldId),
457 this));
460 editMField(KeyValueFieldMask, _mfKeyValue);
462 return returnValue;
465 GetFieldHandlePtr VRMLCoordinateInterpolatorBase::getHandleOutValue (void) const
467 MFPnt3f::GetHandlePtr returnValue(
468 new MFPnt3f::GetHandle(
469 &_mfOutValue,
470 this->getType().getFieldDesc(OutValueFieldId),
471 const_cast<VRMLCoordinateInterpolatorBase *>(this)));
473 return returnValue;
476 EditFieldHandlePtr VRMLCoordinateInterpolatorBase::editHandleOutValue (void)
478 MFPnt3f::EditHandlePtr returnValue(
479 new MFPnt3f::EditHandle(
480 &_mfOutValue,
481 this->getType().getFieldDesc(OutValueFieldId),
482 this));
485 editMField(OutValueFieldMask, _mfOutValue);
487 return returnValue;
491 #ifdef OSG_MT_CPTR_ASPECT
492 void VRMLCoordinateInterpolatorBase::execSyncV( FieldContainer &oFrom,
493 ConstFieldMaskArg whichField,
494 AspectOffsetStore &oOffsets,
495 ConstFieldMaskArg syncMode,
496 const UInt32 uiSyncInfo)
498 VRMLCoordinateInterpolator *pThis = static_cast<VRMLCoordinateInterpolator *>(this);
500 pThis->execSync(static_cast<VRMLCoordinateInterpolator *>(&oFrom),
501 whichField,
502 oOffsets,
503 syncMode,
504 uiSyncInfo);
506 #endif
509 #ifdef OSG_MT_CPTR_ASPECT
510 FieldContainer *VRMLCoordinateInterpolatorBase::createAspectCopy(
511 const FieldContainer *pRefAspect) const
513 VRMLCoordinateInterpolator *returnValue;
515 newAspectCopy(returnValue,
516 dynamic_cast<const VRMLCoordinateInterpolator *>(pRefAspect),
517 dynamic_cast<const VRMLCoordinateInterpolator *>(this));
519 return returnValue;
521 #endif
523 void VRMLCoordinateInterpolatorBase::resolveLinks(void)
525 Inherited::resolveLinks();
527 #ifdef OSG_MT_CPTR_ASPECT
528 AspectOffsetStore oOffsets;
530 _pAspectStore->fillOffsetArray(oOffsets, this);
531 #endif
533 #ifdef OSG_MT_CPTR_ASPECT
534 _mfKeyValue.terminateShare(Thread::getCurrentAspect(),
535 oOffsets);
536 #endif
537 #ifdef OSG_MT_CPTR_ASPECT
538 _mfOutValue.terminateShare(Thread::getCurrentAspect(),
539 oOffsets);
540 #endif
544 OSG_END_NAMESPACE