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 StackedTransform!
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 "OSGTransformationElement.h" // TransformElements Class
67 #include "OSGStackedTransformBase.h"
68 #include "OSGStackedTransform.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::StackedTransform
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var TransformationElement * StackedTransformBase::_mfTransformElements
91 /***************************************************************************\
92 * FieldType/FieldTrait Instantiation *
93 \***************************************************************************/
95 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
96 PointerType FieldTraits
<StackedTransform
*, nsOSG
>::_type(
97 "StackedTransformPtr",
99 StackedTransform::getClassType(),
103 OSG_FIELDTRAITS_GETTYPE_NS(StackedTransform
*, nsOSG
)
105 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
109 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
113 /***************************************************************************\
114 * Field Description *
115 \***************************************************************************/
117 void StackedTransformBase::classDescInserter(TypeObject
&oType
)
119 FieldDescriptionBase
*pDesc
= NULL
;
122 pDesc
= new MFUnrecChildTransformationElementPtr::Description(
123 MFUnrecChildTransformationElementPtr::getClassType(),
126 TransformElementsFieldId
, TransformElementsFieldMask
,
128 (Field::MFDefaultFlags
| Field::FNullCheckAccess
),
129 static_cast<FieldEditMethodSig
>(&StackedTransform::editHandleTransformElements
),
130 static_cast<FieldGetMethodSig
>(&StackedTransform::getHandleTransformElements
));
132 oType
.addInitialDesc(pDesc
);
136 StackedTransformBase::TypeObject
StackedTransformBase::_type(
137 StackedTransformBase::getClassname(),
138 Inherited::getClassname(),
141 reinterpret_cast<PrototypeCreateF
>(&StackedTransformBase::createEmptyLocal
),
142 reinterpret_cast<InitContainerF
>(&StackedTransform::initMethod
),
143 reinterpret_cast<ExitContainerF
>(&StackedTransform::exitMethod
),
144 reinterpret_cast<InitalInsertDescFunc
>(
145 reinterpret_cast<void *>(&StackedTransform::classDescInserter
)),
148 "<?xml version=\"1.0\" ?>\n"
151 " name=\"StackedTransform\"\n"
152 " parent=\"Group\"\n"
153 " library=\"Group\"\n"
154 " structure=\"concrete\"\n"
155 " pointerfieldtypes=\"both\"\n"
156 " systemcomponent=\"true\"\n"
157 " parentsystemcomponent=\"true\"\n"
158 " isNodeCore=\"true\"\n"
161 " name=\"TransformElements\"\n"
162 " type=\"TransformationElement\"\n"
163 " category=\"childpointer\"\n"
164 " cardinality=\"multi\"\n"
165 " childParentType=\"FieldContainer\"\n"
166 " visibility=\"external\"\n"
167 " access=\"public\"\n"
168 " ptrFieldAccess = \"nullCheck\"\n"
169 " linkParentField=\"ParentStack\"\n"
172 "</FieldContainer>\n",
176 /*------------------------------ get -----------------------------------*/
178 FieldContainerType
&StackedTransformBase::getType(void)
183 const FieldContainerType
&StackedTransformBase::getType(void) const
188 UInt32
StackedTransformBase::getContainerSize(void) const
190 return sizeof(StackedTransform
);
193 /*------------------------- decorator get ------------------------------*/
196 //! Get the StackedTransform::_mfTransformElements field.
197 const MFUnrecChildTransformationElementPtr
*StackedTransformBase::getMFTransformElements(void) const
199 return &_mfTransformElements
;
201 TransformationElement
* StackedTransformBase::getTransformElements(const UInt32 index
) const
203 return _mfTransformElements
[index
];
208 void StackedTransformBase::pushToTransformElements(TransformationElement
* const value
)
213 editMField(TransformElementsFieldMask
, _mfTransformElements
);
215 _mfTransformElements
.push_back(value
);
218 void StackedTransformBase::assignTransformElements(const MFUnrecChildTransformationElementPtr
&value
)
220 MFUnrecChildTransformationElementPtr::const_iterator elemIt
=
222 MFUnrecChildTransformationElementPtr::const_iterator elemEnd
=
225 static_cast<StackedTransform
*>(this)->clearTransformElements();
227 while(elemIt
!= elemEnd
)
229 this->pushToTransformElements(*elemIt
);
235 void StackedTransformBase::insertIntoTransformElements(UInt32 uiIndex
,
236 TransformationElement
* const value
)
241 editMField(TransformElementsFieldMask
, _mfTransformElements
);
243 MFUnrecChildTransformationElementPtr::iterator fieldIt
= _mfTransformElements
.begin_nc();
247 _mfTransformElements
.insert(fieldIt
, value
);
250 void StackedTransformBase::replaceInTransformElements(UInt32 uiIndex
,
251 TransformationElement
* const value
)
256 if(uiIndex
>= _mfTransformElements
.size())
259 editMField(TransformElementsFieldMask
, _mfTransformElements
);
261 _mfTransformElements
.replace(uiIndex
, value
);
264 void StackedTransformBase::replaceObjInTransformElements(TransformationElement
* const pOldElem
,
265 TransformationElement
* const pNewElem
)
270 Int32 elemIdx
= _mfTransformElements
.findIndex(pOldElem
);
274 editMField(TransformElementsFieldMask
, _mfTransformElements
);
276 _mfTransformElements
.replace(elemIdx
, pNewElem
);
280 void StackedTransformBase::removeFromTransformElements(UInt32 uiIndex
)
282 if(uiIndex
< _mfTransformElements
.size())
284 editMField(TransformElementsFieldMask
, _mfTransformElements
);
286 _mfTransformElements
.erase(uiIndex
);
290 void StackedTransformBase::removeObjFromTransformElements(TransformationElement
* const value
)
292 Int32 iElemIdx
= _mfTransformElements
.findIndex(value
);
296 editMField(TransformElementsFieldMask
, _mfTransformElements
);
298 _mfTransformElements
.erase(iElemIdx
);
301 void StackedTransformBase::clearTransformElements(void)
303 editMField(TransformElementsFieldMask
, _mfTransformElements
);
306 _mfTransformElements
.clear();
311 /*------------------------------ access -----------------------------------*/
313 SizeT
StackedTransformBase::getBinSize(ConstFieldMaskArg whichField
)
315 SizeT returnValue
= Inherited::getBinSize(whichField
);
317 if(FieldBits::NoField
!= (TransformElementsFieldMask
& whichField
))
319 returnValue
+= _mfTransformElements
.getBinSize();
325 void StackedTransformBase::copyToBin(BinaryDataHandler
&pMem
,
326 ConstFieldMaskArg whichField
)
328 Inherited::copyToBin(pMem
, whichField
);
330 if(FieldBits::NoField
!= (TransformElementsFieldMask
& whichField
))
332 _mfTransformElements
.copyToBin(pMem
);
336 void StackedTransformBase::copyFromBin(BinaryDataHandler
&pMem
,
337 ConstFieldMaskArg whichField
)
339 Inherited::copyFromBin(pMem
, whichField
);
341 if(FieldBits::NoField
!= (TransformElementsFieldMask
& whichField
))
343 editMField(TransformElementsFieldMask
, _mfTransformElements
);
344 _mfTransformElements
.copyFromBin(pMem
);
348 //! create a new instance of the class
349 StackedTransformTransitPtr
StackedTransformBase::createLocal(BitVector bFlags
)
351 StackedTransformTransitPtr fc
;
353 if(getClassType().getPrototype() != NULL
)
355 FieldContainerTransitPtr tmpPtr
=
356 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
358 fc
= dynamic_pointer_cast
<StackedTransform
>(tmpPtr
);
364 //! create a new instance of the class, copy the container flags
365 StackedTransformTransitPtr
StackedTransformBase::createDependent(BitVector bFlags
)
367 StackedTransformTransitPtr fc
;
369 if(getClassType().getPrototype() != NULL
)
371 FieldContainerTransitPtr tmpPtr
=
372 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
374 fc
= dynamic_pointer_cast
<StackedTransform
>(tmpPtr
);
380 //! create a new instance of the class
381 StackedTransformTransitPtr
StackedTransformBase::create(void)
383 StackedTransformTransitPtr fc
;
385 if(getClassType().getPrototype() != NULL
)
387 FieldContainerTransitPtr tmpPtr
=
388 getClassType().getPrototype()-> shallowCopy();
390 fc
= dynamic_pointer_cast
<StackedTransform
>(tmpPtr
);
396 StackedTransform
*StackedTransformBase::createEmptyLocal(BitVector bFlags
)
398 StackedTransform
*returnValue
;
400 newPtr
<StackedTransform
>(returnValue
, bFlags
);
402 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
407 //! create an empty new instance of the class, do not copy the prototype
408 StackedTransform
*StackedTransformBase::createEmpty(void)
410 StackedTransform
*returnValue
;
412 newPtr
<StackedTransform
>(returnValue
, Thread::getCurrentLocalFlags());
414 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
415 ~Thread::getCurrentLocalFlags();
421 FieldContainerTransitPtr
StackedTransformBase::shallowCopyLocal(
422 BitVector bFlags
) const
424 StackedTransform
*tmpPtr
;
426 newPtr(tmpPtr
, dynamic_cast<const StackedTransform
*>(this), bFlags
);
428 FieldContainerTransitPtr
returnValue(tmpPtr
);
430 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
435 FieldContainerTransitPtr
StackedTransformBase::shallowCopyDependent(
436 BitVector bFlags
) const
438 StackedTransform
*tmpPtr
;
440 newPtr(tmpPtr
, dynamic_cast<const StackedTransform
*>(this), ~bFlags
);
442 FieldContainerTransitPtr
returnValue(tmpPtr
);
444 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
449 FieldContainerTransitPtr
StackedTransformBase::shallowCopy(void) const
451 StackedTransform
*tmpPtr
;
454 dynamic_cast<const StackedTransform
*>(this),
455 Thread::getCurrentLocalFlags());
457 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
459 FieldContainerTransitPtr
returnValue(tmpPtr
);
467 /*------------------------- constructors ----------------------------------*/
469 StackedTransformBase::StackedTransformBase(void) :
471 _mfTransformElements (this,
472 TransformElementsFieldId
,
473 TransformationElement::ParentStackFieldId
)
477 StackedTransformBase::StackedTransformBase(const StackedTransformBase
&source
) :
479 _mfTransformElements (this,
480 TransformElementsFieldId
,
481 TransformationElement::ParentStackFieldId
)
486 /*-------------------------- destructors ----------------------------------*/
488 StackedTransformBase::~StackedTransformBase(void)
492 /*-------------------------------------------------------------------------*/
495 bool StackedTransformBase::unlinkChild(
496 FieldContainer
* const pChild
,
497 UInt16
const childFieldId
)
499 if(childFieldId
== TransformElementsFieldId
)
501 TransformationElement
* pTypedChild
=
502 dynamic_cast<TransformationElement
*>(pChild
);
504 if(pTypedChild
!= NULL
)
506 Int32 iChildIdx
= _mfTransformElements
.findIndex(pTypedChild
);
510 editMField(TransformElementsFieldMask
, _mfTransformElements
);
512 _mfTransformElements
.erase(iChildIdx
);
517 SWARNING
<< "Parent ([" << this
518 << "] id [" << this->getId()
519 << "] type [" << this->getType().getCName()
520 << "] childFieldId [" << childFieldId
521 << "]) - Child ([" << pChild
522 << "] id [" << pChild
->getId()
523 << "] type [" << pChild
->getType().getCName()
524 << "]): link inconsistent!"
534 return Inherited::unlinkChild(pChild
, childFieldId
);
537 void StackedTransformBase::onCreate(const StackedTransform
*source
)
539 Inherited::onCreate(source
);
543 StackedTransform
*pThis
= static_cast<StackedTransform
*>(this);
545 MFUnrecChildTransformationElementPtr::const_iterator TransformElementsIt
=
546 source
->_mfTransformElements
.begin();
547 MFUnrecChildTransformationElementPtr::const_iterator TransformElementsEnd
=
548 source
->_mfTransformElements
.end ();
550 while(TransformElementsIt
!= TransformElementsEnd
)
552 pThis
->pushToTransformElements(*TransformElementsIt
);
554 ++TransformElementsIt
;
559 GetFieldHandlePtr
StackedTransformBase::getHandleTransformElements (void) const
561 MFUnrecChildTransformationElementPtr::GetHandlePtr
returnValue(
562 new MFUnrecChildTransformationElementPtr::GetHandle(
563 &_mfTransformElements
,
564 this->getType().getFieldDesc(TransformElementsFieldId
),
565 const_cast<StackedTransformBase
*>(this)));
570 EditFieldHandlePtr
StackedTransformBase::editHandleTransformElements(void)
572 MFUnrecChildTransformationElementPtr::EditHandlePtr
returnValue(
573 new MFUnrecChildTransformationElementPtr::EditHandle(
574 &_mfTransformElements
,
575 this->getType().getFieldDesc(TransformElementsFieldId
),
578 returnValue
->setAddMethod(
579 boost::bind(&StackedTransform::pushToTransformElements
,
580 static_cast<StackedTransform
*>(this), _1
));
581 returnValue
->setInsertMethod(
582 boost::bind(&StackedTransform::insertIntoTransformElements
,
583 static_cast<StackedTransform
*>(this), _1
, _2
));
584 returnValue
->setReplaceMethod(
585 boost::bind(&StackedTransform::replaceInTransformElements
,
586 static_cast<StackedTransform
*>(this), _1
, _2
));
587 returnValue
->setReplaceObjMethod(
588 boost::bind(&StackedTransform::replaceObjInTransformElements
,
589 static_cast<StackedTransform
*>(this), _1
, _2
));
590 returnValue
->setRemoveMethod(
591 boost::bind(&StackedTransform::removeFromTransformElements
,
592 static_cast<StackedTransform
*>(this), _1
));
593 returnValue
->setRemoveObjMethod(
594 boost::bind(&StackedTransform::removeObjFromTransformElements
,
595 static_cast<StackedTransform
*>(this), _1
));
596 returnValue
->setClearMethod(
597 boost::bind(&StackedTransform::clearTransformElements
,
598 static_cast<StackedTransform
*>(this)));
600 editMField(TransformElementsFieldMask
, _mfTransformElements
);
606 #ifdef OSG_MT_CPTR_ASPECT
607 void StackedTransformBase::execSyncV( FieldContainer
&oFrom
,
608 ConstFieldMaskArg whichField
,
609 AspectOffsetStore
&oOffsets
,
610 ConstFieldMaskArg syncMode
,
611 const UInt32 uiSyncInfo
)
613 StackedTransform
*pThis
= static_cast<StackedTransform
*>(this);
615 pThis
->execSync(static_cast<StackedTransform
*>(&oFrom
),
624 #ifdef OSG_MT_CPTR_ASPECT
625 FieldContainer
*StackedTransformBase::createAspectCopy(
626 const FieldContainer
*pRefAspect
) const
628 StackedTransform
*returnValue
;
630 newAspectCopy(returnValue
,
631 dynamic_cast<const StackedTransform
*>(pRefAspect
),
632 dynamic_cast<const StackedTransform
*>(this));
638 void StackedTransformBase::resolveLinks(void)
640 Inherited::resolveLinks();
642 static_cast<StackedTransform
*>(this)->clearTransformElements();