changed: gcc8 base update
[opensg.git] / Source / System / Dynamics / Animation / OSGAnimMatrixChannelBase.cpp
blob6c85004e95be6847429c900eaf7fdf0038fecb1a
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 AnimMatrixChannel!
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"
65 #include "OSGAnimMatrixDataSource.h" // Data Class
67 #include "OSGAnimMatrixChannelBase.h"
68 #include "OSGAnimMatrixChannel.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::AnimMatrixChannel
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var AnimMatrixDataSource * AnimMatrixChannelBase::_sfData
90 /*! \var Matrix AnimMatrixChannelBase::_sfOutValue
95 /***************************************************************************\
96 * FieldType/FieldTrait Instantiation *
97 \***************************************************************************/
99 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
100 PointerType FieldTraits<AnimMatrixChannel *, nsOSG>::_type(
101 "AnimMatrixChannelPtr",
102 "AnimChannelPtr",
103 AnimMatrixChannel::getClassType(),
104 nsOSG);
105 #endif
107 OSG_FIELDTRAITS_GETTYPE_NS(AnimMatrixChannel *, nsOSG)
109 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
110 AnimMatrixChannel *,
111 nsOSG)
113 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
114 AnimMatrixChannel *,
115 nsOSG)
117 /***************************************************************************\
118 * Field Description *
119 \***************************************************************************/
121 void AnimMatrixChannelBase::classDescInserter(TypeObject &oType)
123 FieldDescriptionBase *pDesc = NULL;
126 pDesc = new SFUnrecAnimMatrixDataSourcePtr::Description(
127 SFUnrecAnimMatrixDataSourcePtr::getClassType(),
128 "data",
130 DataFieldId, DataFieldMask,
131 true,
132 (Field::FStdAccess | Field::FClusterLocal),
133 static_cast<FieldEditMethodSig>(&AnimMatrixChannel::editHandleData),
134 static_cast<FieldGetMethodSig >(&AnimMatrixChannel::getHandleData));
136 oType.addInitialDesc(pDesc);
138 pDesc = new SFMatrix::Description(
139 SFMatrix::getClassType(),
140 "outValue",
142 OutValueFieldId, OutValueFieldMask,
143 true,
144 (Field::FClusterLocal),
145 static_cast<FieldEditMethodSig>(&AnimMatrixChannel::editHandleOutValue),
146 static_cast<FieldGetMethodSig >(&AnimMatrixChannel::getHandleOutValue));
148 oType.addInitialDesc(pDesc);
152 AnimMatrixChannelBase::TypeObject AnimMatrixChannelBase::_type(
153 AnimMatrixChannelBase::getClassname(),
154 Inherited::getClassname(),
155 "NULL",
156 nsOSG, //Namespace
157 reinterpret_cast<PrototypeCreateF>(&AnimMatrixChannelBase::createEmptyLocal),
158 reinterpret_cast<InitContainerF>(&AnimMatrixChannel::initMethod),
159 reinterpret_cast<ExitContainerF>(&AnimMatrixChannel::exitMethod),
160 reinterpret_cast<InitalInsertDescFunc>(
161 reinterpret_cast<void *>(&AnimMatrixChannel::classDescInserter)),
162 false,
164 "<?xml version=\"1.0\"?>\n"
165 "\n"
166 "<FieldContainer\n"
167 " name=\"AnimMatrixChannel\"\n"
168 " parent=\"AnimChannel\"\n"
169 " library=\"Dynamics\"\n"
170 " pointerfieldtypes=\"both\"\n"
171 " structure=\"concrete\"\n"
172 " systemcomponent=\"true\"\n"
173 " parentsystemcomponent=\"true\"\n"
174 " decoratable=\"false\"\n"
175 " useLocalIncludes=\"false\"\n"
176 " isNodeCore=\"true\"\n"
177 " isBundle=\"false\"\n"
178 " parentFields=\"none\"\n"
179 ">\n"
180 " <Field\n"
181 " name=\"data\"\n"
182 " category=\"pointer\"\n"
183 " type=\"AnimMatrixDataSource\"\n"
184 " cardinality=\"single\"\n"
185 " visibility=\"internal\"\n"
186 " access=\"public\"\n"
187 " defaultValue=\"NULL\"\n"
188 " fieldFlags=\"FStdAccess, FClusterLocal\"\n"
189 " >\n"
190 " </Field>\n"
191 " <Field\n"
192 " name=\"outValue\"\n"
193 " category=\"data\"\n"
194 " type=\"Matrix\"\n"
195 " cardinality=\"single\"\n"
196 " visibility=\"internal\"\n"
197 " access=\"public\"\n"
198 " defaultValue=\"0.f, 0.f, 0.f\"\n"
199 " fieldFlags=\"FClusterLocal\"\n"
200 " >\n"
201 " </Field>\n"
202 "</FieldContainer>\n",
206 /*------------------------------ get -----------------------------------*/
208 FieldContainerType &AnimMatrixChannelBase::getType(void)
210 return _type;
213 const FieldContainerType &AnimMatrixChannelBase::getType(void) const
215 return _type;
218 UInt32 AnimMatrixChannelBase::getContainerSize(void) const
220 return sizeof(AnimMatrixChannel);
223 /*------------------------- decorator get ------------------------------*/
226 //! Get the AnimMatrixChannel::_sfData field.
227 const SFUnrecAnimMatrixDataSourcePtr *AnimMatrixChannelBase::getSFData(void) const
229 return &_sfData;
232 SFUnrecAnimMatrixDataSourcePtr *AnimMatrixChannelBase::editSFData (void)
234 editSField(DataFieldMask);
236 return &_sfData;
239 //! Get the value of the AnimMatrixChannel::_sfData field.
240 AnimMatrixDataSource * AnimMatrixChannelBase::getData(void) const
242 return _sfData.getValue();
245 //! Set the value of the AnimMatrixChannel::_sfData field.
246 void AnimMatrixChannelBase::setData(AnimMatrixDataSource * const value)
248 editSField(DataFieldMask);
250 _sfData.setValue(value);
254 SFMatrix *AnimMatrixChannelBase::editSFOutValue(void)
256 editSField(OutValueFieldMask);
258 return &_sfOutValue;
261 const SFMatrix *AnimMatrixChannelBase::getSFOutValue(void) const
263 return &_sfOutValue;
271 /*------------------------------ access -----------------------------------*/
273 SizeT AnimMatrixChannelBase::getBinSize(ConstFieldMaskArg whichField)
275 SizeT returnValue = Inherited::getBinSize(whichField);
277 if(FieldBits::NoField != (DataFieldMask & whichField))
279 returnValue += _sfData.getBinSize();
281 if(FieldBits::NoField != (OutValueFieldMask & whichField))
283 returnValue += _sfOutValue.getBinSize();
286 return returnValue;
289 void AnimMatrixChannelBase::copyToBin(BinaryDataHandler &pMem,
290 ConstFieldMaskArg whichField)
292 Inherited::copyToBin(pMem, whichField);
294 if(FieldBits::NoField != (DataFieldMask & whichField))
296 _sfData.copyToBin(pMem);
298 if(FieldBits::NoField != (OutValueFieldMask & whichField))
300 _sfOutValue.copyToBin(pMem);
304 void AnimMatrixChannelBase::copyFromBin(BinaryDataHandler &pMem,
305 ConstFieldMaskArg whichField)
307 Inherited::copyFromBin(pMem, whichField);
309 if(FieldBits::NoField != (DataFieldMask & whichField))
311 editSField(DataFieldMask);
312 _sfData.copyFromBin(pMem);
314 if(FieldBits::NoField != (OutValueFieldMask & whichField))
316 editSField(OutValueFieldMask);
317 _sfOutValue.copyFromBin(pMem);
321 //! create a new instance of the class
322 AnimMatrixChannelTransitPtr AnimMatrixChannelBase::createLocal(BitVector bFlags)
324 AnimMatrixChannelTransitPtr fc;
326 if(getClassType().getPrototype() != NULL)
328 FieldContainerTransitPtr tmpPtr =
329 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
331 fc = dynamic_pointer_cast<AnimMatrixChannel>(tmpPtr);
334 return fc;
337 //! create a new instance of the class, copy the container flags
338 AnimMatrixChannelTransitPtr AnimMatrixChannelBase::createDependent(BitVector bFlags)
340 AnimMatrixChannelTransitPtr fc;
342 if(getClassType().getPrototype() != NULL)
344 FieldContainerTransitPtr tmpPtr =
345 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
347 fc = dynamic_pointer_cast<AnimMatrixChannel>(tmpPtr);
350 return fc;
353 //! create a new instance of the class
354 AnimMatrixChannelTransitPtr AnimMatrixChannelBase::create(void)
356 AnimMatrixChannelTransitPtr fc;
358 if(getClassType().getPrototype() != NULL)
360 FieldContainerTransitPtr tmpPtr =
361 getClassType().getPrototype()-> shallowCopy();
363 fc = dynamic_pointer_cast<AnimMatrixChannel>(tmpPtr);
366 return fc;
369 AnimMatrixChannel *AnimMatrixChannelBase::createEmptyLocal(BitVector bFlags)
371 AnimMatrixChannel *returnValue;
373 newPtr<AnimMatrixChannel>(returnValue, bFlags);
375 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
377 return returnValue;
380 //! create an empty new instance of the class, do not copy the prototype
381 AnimMatrixChannel *AnimMatrixChannelBase::createEmpty(void)
383 AnimMatrixChannel *returnValue;
385 newPtr<AnimMatrixChannel>(returnValue, Thread::getCurrentLocalFlags());
387 returnValue->_pFieldFlags->_bNamespaceMask &=
388 ~Thread::getCurrentLocalFlags();
390 return returnValue;
394 FieldContainerTransitPtr AnimMatrixChannelBase::shallowCopyLocal(
395 BitVector bFlags) const
397 AnimMatrixChannel *tmpPtr;
399 newPtr(tmpPtr, dynamic_cast<const AnimMatrixChannel *>(this), bFlags);
401 FieldContainerTransitPtr returnValue(tmpPtr);
403 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
405 return returnValue;
408 FieldContainerTransitPtr AnimMatrixChannelBase::shallowCopyDependent(
409 BitVector bFlags) const
411 AnimMatrixChannel *tmpPtr;
413 newPtr(tmpPtr, dynamic_cast<const AnimMatrixChannel *>(this), ~bFlags);
415 FieldContainerTransitPtr returnValue(tmpPtr);
417 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
419 return returnValue;
422 FieldContainerTransitPtr AnimMatrixChannelBase::shallowCopy(void) const
424 AnimMatrixChannel *tmpPtr;
426 newPtr(tmpPtr,
427 dynamic_cast<const AnimMatrixChannel *>(this),
428 Thread::getCurrentLocalFlags());
430 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
432 FieldContainerTransitPtr returnValue(tmpPtr);
434 return returnValue;
440 /*------------------------- constructors ----------------------------------*/
442 AnimMatrixChannelBase::AnimMatrixChannelBase(void) :
443 Inherited(),
444 _sfData (NULL),
445 _sfOutValue (Matrix(0.f, 0.f, 0.f))
449 AnimMatrixChannelBase::AnimMatrixChannelBase(const AnimMatrixChannelBase &source) :
450 Inherited(source),
451 _sfData (NULL),
452 _sfOutValue (source._sfOutValue )
457 /*-------------------------- destructors ----------------------------------*/
459 AnimMatrixChannelBase::~AnimMatrixChannelBase(void)
463 void AnimMatrixChannelBase::onCreate(const AnimMatrixChannel *source)
465 Inherited::onCreate(source);
467 if(source != NULL)
469 AnimMatrixChannel *pThis = static_cast<AnimMatrixChannel *>(this);
471 pThis->setData(source->getData());
475 GetFieldHandlePtr AnimMatrixChannelBase::getHandleData (void) const
477 SFUnrecAnimMatrixDataSourcePtr::GetHandlePtr returnValue(
478 new SFUnrecAnimMatrixDataSourcePtr::GetHandle(
479 &_sfData,
480 this->getType().getFieldDesc(DataFieldId),
481 const_cast<AnimMatrixChannelBase *>(this)));
483 return returnValue;
486 EditFieldHandlePtr AnimMatrixChannelBase::editHandleData (void)
488 SFUnrecAnimMatrixDataSourcePtr::EditHandlePtr returnValue(
489 new SFUnrecAnimMatrixDataSourcePtr::EditHandle(
490 &_sfData,
491 this->getType().getFieldDesc(DataFieldId),
492 this));
494 returnValue->setSetMethod(
495 boost::bind(&AnimMatrixChannel::setData,
496 static_cast<AnimMatrixChannel *>(this), _1));
498 editSField(DataFieldMask);
500 return returnValue;
503 GetFieldHandlePtr AnimMatrixChannelBase::getHandleOutValue (void) const
505 SFMatrix::GetHandlePtr returnValue(
506 new SFMatrix::GetHandle(
507 &_sfOutValue,
508 this->getType().getFieldDesc(OutValueFieldId),
509 const_cast<AnimMatrixChannelBase *>(this)));
511 return returnValue;
514 EditFieldHandlePtr AnimMatrixChannelBase::editHandleOutValue (void)
516 SFMatrix::EditHandlePtr returnValue(
517 new SFMatrix::EditHandle(
518 &_sfOutValue,
519 this->getType().getFieldDesc(OutValueFieldId),
520 this));
523 editSField(OutValueFieldMask);
525 return returnValue;
529 #ifdef OSG_MT_CPTR_ASPECT
530 void AnimMatrixChannelBase::execSyncV( FieldContainer &oFrom,
531 ConstFieldMaskArg whichField,
532 AspectOffsetStore &oOffsets,
533 ConstFieldMaskArg syncMode,
534 const UInt32 uiSyncInfo)
536 AnimMatrixChannel *pThis = static_cast<AnimMatrixChannel *>(this);
538 pThis->execSync(static_cast<AnimMatrixChannel *>(&oFrom),
539 whichField,
540 oOffsets,
541 syncMode,
542 uiSyncInfo);
544 #endif
547 #ifdef OSG_MT_CPTR_ASPECT
548 FieldContainer *AnimMatrixChannelBase::createAspectCopy(
549 const FieldContainer *pRefAspect) const
551 AnimMatrixChannel *returnValue;
553 newAspectCopy(returnValue,
554 dynamic_cast<const AnimMatrixChannel *>(pRefAspect),
555 dynamic_cast<const AnimMatrixChannel *>(this));
557 return returnValue;
559 #endif
561 void AnimMatrixChannelBase::resolveLinks(void)
563 Inherited::resolveLinks();
565 static_cast<AnimMatrixChannel *>(this)->setData(NULL);
571 OSG_END_NAMESPACE