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 AnimMatrixChannel!
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 "OSGAnimMatrixDataSource.h" // Data Class
67 #include "OSGAnimMatrixChannelBase.h"
68 #include "OSGAnimMatrixChannel.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
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",
103 AnimMatrixChannel::getClassType(),
107 OSG_FIELDTRAITS_GETTYPE_NS(AnimMatrixChannel
*, nsOSG
)
109 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
113 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
117 /***************************************************************************\
118 * Field Description *
119 \***************************************************************************/
121 void AnimMatrixChannelBase::classDescInserter(TypeObject
&oType
)
123 FieldDescriptionBase
*pDesc
= NULL
;
126 pDesc
= new SFUnrecAnimMatrixDataSourcePtr::Description(
127 SFUnrecAnimMatrixDataSourcePtr::getClassType(),
130 DataFieldId
, DataFieldMask
,
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(),
142 OutValueFieldId
, OutValueFieldMask
,
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(),
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
)),
164 "<?xml version=\"1.0\"?>\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"
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"
192 " name=\"outValue\"\n"
193 " category=\"data\"\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"
202 "</FieldContainer>\n",
206 /*------------------------------ get -----------------------------------*/
208 FieldContainerType
&AnimMatrixChannelBase::getType(void)
213 const FieldContainerType
&AnimMatrixChannelBase::getType(void) const
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
232 SFUnrecAnimMatrixDataSourcePtr
*AnimMatrixChannelBase::editSFData (void)
234 editSField(DataFieldMask
);
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
);
261 const SFMatrix
*AnimMatrixChannelBase::getSFOutValue(void) const
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();
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
);
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
);
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
);
369 AnimMatrixChannel
*AnimMatrixChannelBase::createEmptyLocal(BitVector bFlags
)
371 AnimMatrixChannel
*returnValue
;
373 newPtr
<AnimMatrixChannel
>(returnValue
, bFlags
);
375 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
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
;
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
;
422 FieldContainerTransitPtr
AnimMatrixChannelBase::shallowCopy(void) const
424 AnimMatrixChannel
*tmpPtr
;
427 dynamic_cast<const AnimMatrixChannel
*>(this),
428 Thread::getCurrentLocalFlags());
430 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
432 FieldContainerTransitPtr
returnValue(tmpPtr
);
440 /*------------------------- constructors ----------------------------------*/
442 AnimMatrixChannelBase::AnimMatrixChannelBase(void) :
445 _sfOutValue (Matrix(0.f
, 0.f
, 0.f
))
449 AnimMatrixChannelBase::AnimMatrixChannelBase(const AnimMatrixChannelBase
&source
) :
452 _sfOutValue (source
._sfOutValue
)
457 /*-------------------------- destructors ----------------------------------*/
459 AnimMatrixChannelBase::~AnimMatrixChannelBase(void)
463 void AnimMatrixChannelBase::onCreate(const AnimMatrixChannel
*source
)
465 Inherited::onCreate(source
);
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(
480 this->getType().getFieldDesc(DataFieldId
),
481 const_cast<AnimMatrixChannelBase
*>(this)));
486 EditFieldHandlePtr
AnimMatrixChannelBase::editHandleData (void)
488 SFUnrecAnimMatrixDataSourcePtr::EditHandlePtr
returnValue(
489 new SFUnrecAnimMatrixDataSourcePtr::EditHandle(
491 this->getType().getFieldDesc(DataFieldId
),
494 returnValue
->setSetMethod(
495 boost::bind(&AnimMatrixChannel::setData
,
496 static_cast<AnimMatrixChannel
*>(this), _1
));
498 editSField(DataFieldMask
);
503 GetFieldHandlePtr
AnimMatrixChannelBase::getHandleOutValue (void) const
505 SFMatrix::GetHandlePtr
returnValue(
506 new SFMatrix::GetHandle(
508 this->getType().getFieldDesc(OutValueFieldId
),
509 const_cast<AnimMatrixChannelBase
*>(this)));
514 EditFieldHandlePtr
AnimMatrixChannelBase::editHandleOutValue (void)
516 SFMatrix::EditHandlePtr
returnValue(
517 new SFMatrix::EditHandle(
519 this->getType().getFieldDesc(OutValueFieldId
),
523 editSField(OutValueFieldMask
);
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
),
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));
561 void AnimMatrixChannelBase::resolveLinks(void)
563 Inherited::resolveLinks();
565 static_cast<AnimMatrixChannel
*>(this)->setData(NULL
);