1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 TestMultiPartitionStage!
50 *****************************************************************************
51 \*****************************************************************************/
56 #include "OSGConfig.h"
61 #include "OSGTestMultiPartitionStageBase.h"
62 #include "OSGTestMultiPartitionStage.h"
64 #include <boost/bind.hpp>
66 #ifdef WIN32 // turn off 'this' : used in base member initializer list warning
67 #pragma warning(disable:4355)
72 /***************************************************************************\
74 \***************************************************************************/
76 /*! \class OSG::TestMultiPartitionStage
77 just dumps a message on traversal and render for testing
80 /***************************************************************************\
81 * Field Documentation *
82 \***************************************************************************/
84 /*! \var std::string TestMultiPartitionStageBase::_sfMessage
88 /*! \var Int32 TestMultiPartitionStageBase::_sfNumPartitions
92 /*! \var Int32 TestMultiPartitionStageBase::_mfOrder
96 /*! \var bool TestMultiPartitionStageBase::_sfUseGroup
101 /***************************************************************************\
102 * FieldType/FieldTrait Instantiation *
103 \***************************************************************************/
105 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
106 PointerType FieldTraits
<TestMultiPartitionStage
*, nsOSG
>::_type(
107 "TestMultiPartitionStagePtr",
109 TestMultiPartitionStage::getClassType(),
113 OSG_FIELDTRAITS_GETTYPE_NS(TestMultiPartitionStage
*, nsOSG
)
115 /***************************************************************************\
116 * Field Description *
117 \***************************************************************************/
119 void TestMultiPartitionStageBase::classDescInserter(TypeObject
&oType
)
121 FieldDescriptionBase
*pDesc
= NULL
;
124 pDesc
= new SFString::Description(
125 SFString::getClassType(),
128 MessageFieldId
, MessageFieldMask
,
130 (Field::SFDefaultFlags
| Field::FStdAccess
),
131 static_cast<FieldEditMethodSig
>(&TestMultiPartitionStage::editHandleMessage
),
132 static_cast<FieldGetMethodSig
>(&TestMultiPartitionStage::getHandleMessage
));
134 oType
.addInitialDesc(pDesc
);
136 pDesc
= new SFInt32::Description(
137 SFInt32::getClassType(),
140 NumPartitionsFieldId
, NumPartitionsFieldMask
,
142 (Field::SFDefaultFlags
| Field::FStdAccess
),
143 static_cast<FieldEditMethodSig
>(&TestMultiPartitionStage::editHandleNumPartitions
),
144 static_cast<FieldGetMethodSig
>(&TestMultiPartitionStage::getHandleNumPartitions
));
146 oType
.addInitialDesc(pDesc
);
148 pDesc
= new MFInt32::Description(
149 MFInt32::getClassType(),
152 OrderFieldId
, OrderFieldMask
,
154 (Field::MFDefaultFlags
| Field::FStdAccess
),
155 static_cast<FieldEditMethodSig
>(&TestMultiPartitionStage::editHandleOrder
),
156 static_cast<FieldGetMethodSig
>(&TestMultiPartitionStage::getHandleOrder
));
158 oType
.addInitialDesc(pDesc
);
160 pDesc
= new SFBool::Description(
161 SFBool::getClassType(),
164 UseGroupFieldId
, UseGroupFieldMask
,
166 (Field::SFDefaultFlags
| Field::FStdAccess
),
167 static_cast<FieldEditMethodSig
>(&TestMultiPartitionStage::editHandleUseGroup
),
168 static_cast<FieldGetMethodSig
>(&TestMultiPartitionStage::getHandleUseGroup
));
170 oType
.addInitialDesc(pDesc
);
174 TestMultiPartitionStageBase::TypeObject
TestMultiPartitionStageBase::_type(
175 TestMultiPartitionStageBase::getClassname(),
176 Inherited::getClassname(),
179 reinterpret_cast<PrototypeCreateF
>(&TestMultiPartitionStageBase::createEmptyLocal
),
180 TestMultiPartitionStage::initMethod
,
181 TestMultiPartitionStage::exitMethod
,
182 reinterpret_cast<InitalInsertDescFunc
>(&TestMultiPartitionStage::classDescInserter
),
185 "<?xml version=\"1.0\"?>\n"
188 "\tname=\"TestMultiPartitionStage\"\n"
189 "\tparent=\"Stage\"\n"
190 "\tlibrary=\"Group\"\n"
191 "\tpointerfieldtypes=\"none\"\n"
192 "\tstructure=\"concrete\"\n"
193 "\tsystemcomponent=\"true\"\n"
194 "\tparentsystemcomponent=\"true\"\n"
195 "\tdecoratable=\"false\"\n"
196 "\tuseLocalIncludes=\"false\"\n"
197 " isNodeCore=\"true\"\n"
199 "just dumps a message on traversal and render for testing\n"
201 "\t\tname=\"message\"\n"
202 "\t\ttype=\"std::string\"\n"
203 "\t\tcardinality=\"single\"\n"
204 "\t\tvisibility=\"external\"\n"
205 "\t\taccess=\"public\"\n"
209 " name=\"numPartitions\"\n"
211 " cardinality=\"single\"\n"
212 " visibility=\"external\"\n"
213 " access=\"public\"\n"
214 " defaultValue=\"1\"\n"
220 " cardinality=\"multi\"\n"
221 " visibility=\"external\"\n"
222 " access=\"public\"\n"
226 " name=\"useGroup\"\n"
228 " cardinality=\"single\"\n"
229 " visibility=\"external\"\n"
230 " access=\"public\"\n"
233 "</FieldContainer>\n",
234 "just dumps a message on traversal and render for testing\n"
237 /*------------------------------ get -----------------------------------*/
239 FieldContainerType
&TestMultiPartitionStageBase::getType(void)
244 const FieldContainerType
&TestMultiPartitionStageBase::getType(void) const
249 UInt32
TestMultiPartitionStageBase::getContainerSize(void) const
251 return sizeof(TestMultiPartitionStage
);
254 /*------------------------- decorator get ------------------------------*/
257 SFString
*TestMultiPartitionStageBase::editSFMessage(void)
259 editSField(MessageFieldMask
);
264 const SFString
*TestMultiPartitionStageBase::getSFMessage(void) const
270 SFInt32
*TestMultiPartitionStageBase::editSFNumPartitions(void)
272 editSField(NumPartitionsFieldMask
);
274 return &_sfNumPartitions
;
277 const SFInt32
*TestMultiPartitionStageBase::getSFNumPartitions(void) const
279 return &_sfNumPartitions
;
283 MFInt32
*TestMultiPartitionStageBase::editMFOrder(void)
285 editMField(OrderFieldMask
, _mfOrder
);
290 const MFInt32
*TestMultiPartitionStageBase::getMFOrder(void) const
296 SFBool
*TestMultiPartitionStageBase::editSFUseGroup(void)
298 editSField(UseGroupFieldMask
);
303 const SFBool
*TestMultiPartitionStageBase::getSFUseGroup(void) const
313 /*------------------------------ access -----------------------------------*/
315 SizeT
TestMultiPartitionStageBase::getBinSize(ConstFieldMaskArg whichField
)
317 SizeT returnValue
= Inherited::getBinSize(whichField
);
319 if(FieldBits::NoField
!= (MessageFieldMask
& whichField
))
321 returnValue
+= _sfMessage
.getBinSize();
323 if(FieldBits::NoField
!= (NumPartitionsFieldMask
& whichField
))
325 returnValue
+= _sfNumPartitions
.getBinSize();
327 if(FieldBits::NoField
!= (OrderFieldMask
& whichField
))
329 returnValue
+= _mfOrder
.getBinSize();
331 if(FieldBits::NoField
!= (UseGroupFieldMask
& whichField
))
333 returnValue
+= _sfUseGroup
.getBinSize();
339 void TestMultiPartitionStageBase::copyToBin(BinaryDataHandler
&pMem
,
340 ConstFieldMaskArg whichField
)
342 Inherited::copyToBin(pMem
, whichField
);
344 if(FieldBits::NoField
!= (MessageFieldMask
& whichField
))
346 _sfMessage
.copyToBin(pMem
);
348 if(FieldBits::NoField
!= (NumPartitionsFieldMask
& whichField
))
350 _sfNumPartitions
.copyToBin(pMem
);
352 if(FieldBits::NoField
!= (OrderFieldMask
& whichField
))
354 _mfOrder
.copyToBin(pMem
);
356 if(FieldBits::NoField
!= (UseGroupFieldMask
& whichField
))
358 _sfUseGroup
.copyToBin(pMem
);
362 void TestMultiPartitionStageBase::copyFromBin(BinaryDataHandler
&pMem
,
363 ConstFieldMaskArg whichField
)
365 Inherited::copyFromBin(pMem
, whichField
);
367 if(FieldBits::NoField
!= (MessageFieldMask
& whichField
))
369 editSField(MessageFieldMask
);
370 _sfMessage
.copyFromBin(pMem
);
372 if(FieldBits::NoField
!= (NumPartitionsFieldMask
& whichField
))
374 editSField(NumPartitionsFieldMask
);
375 _sfNumPartitions
.copyFromBin(pMem
);
377 if(FieldBits::NoField
!= (OrderFieldMask
& whichField
))
379 editMField(OrderFieldMask
, _mfOrder
);
380 _mfOrder
.copyFromBin(pMem
);
382 if(FieldBits::NoField
!= (UseGroupFieldMask
& whichField
))
384 editSField(UseGroupFieldMask
);
385 _sfUseGroup
.copyFromBin(pMem
);
389 //! create a new instance of the class
390 TestMultiPartitionStageTransitPtr
TestMultiPartitionStageBase::createLocal(BitVector bFlags
)
392 TestMultiPartitionStageTransitPtr fc
;
394 if(getClassType().getPrototype() != NULL
)
396 FieldContainerTransitPtr tmpPtr
=
397 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
399 fc
= dynamic_pointer_cast
<TestMultiPartitionStage
>(tmpPtr
);
405 //! create a new instance of the class, copy the container flags
406 TestMultiPartitionStageTransitPtr
TestMultiPartitionStageBase::createDependent(BitVector bFlags
)
408 TestMultiPartitionStageTransitPtr fc
;
410 if(getClassType().getPrototype() != NULL
)
412 FieldContainerTransitPtr tmpPtr
=
413 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
415 fc
= dynamic_pointer_cast
<TestMultiPartitionStage
>(tmpPtr
);
421 //! create a new instance of the class
422 TestMultiPartitionStageTransitPtr
TestMultiPartitionStageBase::create(void)
424 TestMultiPartitionStageTransitPtr fc
;
426 if(getClassType().getPrototype() != NULL
)
428 FieldContainerTransitPtr tmpPtr
=
429 getClassType().getPrototype()-> shallowCopy();
431 fc
= dynamic_pointer_cast
<TestMultiPartitionStage
>(tmpPtr
);
437 TestMultiPartitionStage
*TestMultiPartitionStageBase::createEmptyLocal(BitVector bFlags
)
439 TestMultiPartitionStage
*returnValue
;
441 newPtr
<TestMultiPartitionStage
>(returnValue
, bFlags
);
443 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
448 //! create an empty new instance of the class, do not copy the prototype
449 TestMultiPartitionStage
*TestMultiPartitionStageBase::createEmpty(void)
451 TestMultiPartitionStage
*returnValue
;
453 newPtr
<TestMultiPartitionStage
>(returnValue
, Thread::getCurrentLocalFlags());
455 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
456 ~Thread::getCurrentLocalFlags();
462 FieldContainerTransitPtr
TestMultiPartitionStageBase::shallowCopyLocal(
463 BitVector bFlags
) const
465 TestMultiPartitionStage
*tmpPtr
;
467 newPtr(tmpPtr
, dynamic_cast<const TestMultiPartitionStage
*>(this), bFlags
);
469 FieldContainerTransitPtr
returnValue(tmpPtr
);
471 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
476 FieldContainerTransitPtr
TestMultiPartitionStageBase::shallowCopyDependent(
477 BitVector bFlags
) const
479 TestMultiPartitionStage
*tmpPtr
;
481 newPtr(tmpPtr
, dynamic_cast<const TestMultiPartitionStage
*>(this), ~bFlags
);
483 FieldContainerTransitPtr
returnValue(tmpPtr
);
485 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
490 FieldContainerTransitPtr
TestMultiPartitionStageBase::shallowCopy(void) const
492 TestMultiPartitionStage
*tmpPtr
;
495 dynamic_cast<const TestMultiPartitionStage
*>(this),
496 Thread::getCurrentLocalFlags());
498 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
500 FieldContainerTransitPtr
returnValue(tmpPtr
);
508 /*------------------------- constructors ----------------------------------*/
510 TestMultiPartitionStageBase::TestMultiPartitionStageBase(void) :
513 _sfNumPartitions (Int32(1)),
519 TestMultiPartitionStageBase::TestMultiPartitionStageBase(const TestMultiPartitionStageBase
&source
) :
521 _sfMessage (source
._sfMessage
),
522 _sfNumPartitions (source
._sfNumPartitions
),
523 _mfOrder (source
._mfOrder
),
524 _sfUseGroup (source
._sfUseGroup
)
529 /*-------------------------- destructors ----------------------------------*/
531 TestMultiPartitionStageBase::~TestMultiPartitionStageBase(void)
536 GetFieldHandlePtr
TestMultiPartitionStageBase::getHandleMessage (void) const
538 SFString::GetHandlePtr
returnValue(
539 new SFString::GetHandle(
541 this->getType().getFieldDesc(MessageFieldId
),
542 const_cast<TestMultiPartitionStageBase
*>(this)));
547 EditFieldHandlePtr
TestMultiPartitionStageBase::editHandleMessage (void)
549 SFString::EditHandlePtr
returnValue(
550 new SFString::EditHandle(
552 this->getType().getFieldDesc(MessageFieldId
),
556 editSField(MessageFieldMask
);
561 GetFieldHandlePtr
TestMultiPartitionStageBase::getHandleNumPartitions (void) const
563 SFInt32::GetHandlePtr
returnValue(
564 new SFInt32::GetHandle(
566 this->getType().getFieldDesc(NumPartitionsFieldId
),
567 const_cast<TestMultiPartitionStageBase
*>(this)));
572 EditFieldHandlePtr
TestMultiPartitionStageBase::editHandleNumPartitions (void)
574 SFInt32::EditHandlePtr
returnValue(
575 new SFInt32::EditHandle(
577 this->getType().getFieldDesc(NumPartitionsFieldId
),
581 editSField(NumPartitionsFieldMask
);
586 GetFieldHandlePtr
TestMultiPartitionStageBase::getHandleOrder (void) const
588 MFInt32::GetHandlePtr
returnValue(
589 new MFInt32::GetHandle(
591 this->getType().getFieldDesc(OrderFieldId
),
592 const_cast<TestMultiPartitionStageBase
*>(this)));
597 EditFieldHandlePtr
TestMultiPartitionStageBase::editHandleOrder (void)
599 MFInt32::EditHandlePtr
returnValue(
600 new MFInt32::EditHandle(
602 this->getType().getFieldDesc(OrderFieldId
),
606 editMField(OrderFieldMask
, _mfOrder
);
611 GetFieldHandlePtr
TestMultiPartitionStageBase::getHandleUseGroup (void) const
613 SFBool::GetHandlePtr
returnValue(
614 new SFBool::GetHandle(
616 this->getType().getFieldDesc(UseGroupFieldId
),
617 const_cast<TestMultiPartitionStageBase
*>(this)));
622 EditFieldHandlePtr
TestMultiPartitionStageBase::editHandleUseGroup (void)
624 SFBool::EditHandlePtr
returnValue(
625 new SFBool::EditHandle(
627 this->getType().getFieldDesc(UseGroupFieldId
),
631 editSField(UseGroupFieldMask
);
637 #ifdef OSG_MT_CPTR_ASPECT
638 void TestMultiPartitionStageBase::execSyncV( FieldContainer
&oFrom
,
639 ConstFieldMaskArg whichField
,
640 AspectOffsetStore
&oOffsets
,
641 ConstFieldMaskArg syncMode
,
642 const UInt32 uiSyncInfo
)
644 TestMultiPartitionStage
*pThis
= static_cast<TestMultiPartitionStage
*>(this);
646 pThis
->execSync(static_cast<TestMultiPartitionStage
*>(&oFrom
),
655 #ifdef OSG_MT_CPTR_ASPECT
656 FieldContainer
*TestMultiPartitionStageBase::createAspectCopy(
657 const FieldContainer
*pRefAspect
) const
659 TestMultiPartitionStage
*returnValue
;
661 newAspectCopy(returnValue
,
662 dynamic_cast<const TestMultiPartitionStage
*>(pRefAspect
),
663 dynamic_cast<const TestMultiPartitionStage
*>(this));
669 void TestMultiPartitionStageBase::resolveLinks(void)
671 Inherited::resolveLinks();
673 #ifdef OSG_MT_CPTR_ASPECT
674 AspectOffsetStore oOffsets
;
676 _pAspectStore
->fillOffsetArray(oOffsets
, this);
679 #ifdef OSG_MT_CPTR_ASPECT
680 _mfOrder
.terminateShare(Thread::getCurrentAspect(),